sadjv3/anmo-shop/my/feedback/index.vue

198 lines
4.6 KiB
Vue
Raw Permalink Normal View History

2024-06-04 10:03:14 +08:00
<template>
<view class="page">
<view class="bg">
<view class="feedback-title">
<text>问题和意见</text>
<text @tap="chooseMsg" style="color: #096f4b;">快速键入</text>
</view>
<view class="feedback-body"><textarea placeholder="请详细描述你的问题和意见..." v-model="sendDate.content" class="feedback-textare" /></view>
</view>
<view class="bg" style="margin-top: 20rpx;">
<view class="feedback-title"><text>联系方式</text></view>
<view class="feedback-body"><input class="feedback-input" v-model="sendDate.contact" placeholder="方便我们联系你 " /></view>
</view>
<view style="position: fixed;bottom: 0rpx;left: 0;right: 0;background: #FFFFFF;height: 110rpx;line-height: 110rpx;z-index: 999;width: 100%;padding: 0 30rpx;">
<button style="" class="feedback-submit" @tap="send">提交</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
msgContents: ['界面显示错乱', '启动缓慢,卡出翔了', 'UI无法直视丑哭了', '偶发性崩溃'],
stars: [1, 2, 3, 4, 5],
imageList: [],
sendDate: {
score: 5,
content: '',
contact: ''
}
};
},
onLoad() {
// let deviceInfo = {
// appid: plus.runtime.appid,
// imei: plus.device.imei, //设备标识
// p: plus.os.name === 'Android' ? 'a' : 'i', //平台类型i表示iOS平台a表示Android平台。
// md: plus.device.model, //设备型号
// app_version: plus.runtime.version,
// plus_version: plus.runtime.innerVersion, //基座版本号
// os: plus.os.version,
// net: '' + plus.networkinfo.getCurrentType()
// };
// this.sendDate = Object.assign(deviceInfo, this.sendDate);
},
methods: {
close(e) {
this.imageList.splice(e, 1);
},
chooseMsg() {
//快速输入
uni.showActionSheet({
itemList: this.msgContents,
success: res => {
this.sendDate.content = this.msgContents[res.tapIndex];
}
});
},
chooseImg() {
//选择图片
uni.chooseImage({
sourceType: ['camera', 'album'],
sizeType: 'compressed',
count: 8 - this.imageList.length,
success: res => {
this.imageList = this.imageList.concat(res.tempFilePaths);
}
});
},
chooseStar(e) {
//点击评星
this.sendDate.score = e;
},
previewImage() {
//预览图片
uni.previewImage({
urls: this.imageList
});
},
send() {
//发送反馈
console.log(JSON.stringify(this.sendDate));
let userId = this.$queue.getData('userId');
let phone = this.$queue.getData('phone') ? this.$queue.getData('phone') : '';
if (!this.sendDate.content) {
uni.showToast({
icon: 'none',
title: '请输入反馈内容'
});
return;
}
if (!this.sendDate.contact) {
uni.showToast({
icon: 'none',
title: '请填写联系方式'
});
return;
}
this.$queue.showLoading('加载中...');
this.$Request.postJson('/app/message/insertMessage', {
state: 2,
title: this.sendDate.contact,
content: this.sendDate.content,
userId: userId
// title: this.sendDate.contact,
// content: JSON.stringify(this.sendDate),
// state: 2
}).then(res => {
if (res.code === 0) {
uni.showToast({
title: '提交成功'
});
setTimeout(function() {
uni.navigateBack();
}, 1000);
} else {
uni.hideLoading();
uni.showModal({
showCancel: false,
title: '投诉失败',
content: res.msg
});
}
});
}
}
};
</script>
<style>
@font-face {
font-family: uniicons;
font-weight: normal;
font-style: normal;
src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf') format('truetype');
}
page {
background-color: #f7f7f7;
}
.bg{
background-color: #ffffff;
padding: 30rpx;
}
/*问题反馈*/
.feedback-title {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
color: #333333;
font-weight: 600;
font-size: 32rpx;
}
.feedback-star-view.feedback-title {
justify-content: flex-start;
margin: 0;
}
.feedback-body {
font-size: 28rpx;
padding: 16upx;
margin: 16upx 0;
border-radius: 16upx;
background: #F5F5F5;
/* color: #FFF; */
}
.feedback-textare {
height: 200upx;
font-size: 28rpx;
line-height: 50upx;
width: 100%;
box-sizing: border-box;
padding: 20upx 30upx 0;
}
.feedback-input {
font-size: 28rpx;
height: 60upx;
padding: 15upx 20upx;
line-height: 60upx;
}
.feedback-submit {
background: linear-gradient(to right, #223845, #00a85b);
color: #FFFFFF;
margin: 16rpx 0;
width: 100%;
border-radius: 50rpx;
height: 78rpx;
line-height: 78rpx;
font-size: 30rpx;
text-align: center;
}
</style>