| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <template>
- <view class="page">
- <view class="content">
- <view style="padding: 30rpx 0;">
- <text>请选择您要反馈的问题类型:</text>
- </view>
- <radio-group class="block" @change="RadioChange">
- <view class="radioBox">
- <view class="radioItem" :class="data.feedbackType==item.feedbackType?'checkBorder':'defalutBorder'"
- v-for="(item,index) in typeList" :key="index">
- <label class="flex">
- <view class="">
- <radio style="transform: scale(.7);" class="round blue"
- :class="data.feedbackType===item.feedbackType?'checked':''"
- :checked="data.feedbackType==item.feedbackType?true:false"
- :value="item.feedbackType"></radio>
- </view>
- <view class="text-left padding-left-20 flex"
- style="flex-direction: column;justify-content: center;">
- {{item.title}}
- </view>
- </label>
- </view>
- </view>
- </radio-group>
- <view class="area">
- <view>
- <textarea @input="input" :value="data.content" maxlength="120"
- placeholder="请描述您的问题,以便我们尽快为您处理"></textarea>
- <view class="text-right text-df text-gray padding-bottom-10">
- {{data.content.length}} / 120
- </view>
- </view>
- <view class="imgArea">
- <view class="padding-bottom-20">
- <text class="">请提供相关问题的截图或照片(最多四张)</text>
- </view>
- <view class="cu-form-group" style="padding: 20rpx 0 0 0;">
- <view class="grid col-4 grid-square flex-sub">
- <view class="bg-img" v-for="(item,index) in imgList" :key="index" @click="viewImage(index)">
- <image :src="imgList[index]" mode="aspectFill"></image>
- <view class="cu-tag bg-red" @click.stop="DelImg(index)">
- <text class='cuIcon-close'></text>
- </view>
- </view>
- <view class="solids" @click="chooseImage" v-if="imgList.length<4">
- <text class='cuIcon-add ' style="font-size: 60rpx;color: #c9c9c9;"></text>
- </view>
- </view>
- </view>
- <!-- <u-upload @on-choose-complete="chooseImage" :auto-upload="false" width="194" height="194" :action="action" max-count="4" :file-list="fileList" ></u-upload> -->
- </view>
- </view>
- <view class="bg-white" style="height: 150rpx;">
- </view>
- </view>
- <view class="bg-white margin-top-20 footer-fixed " @click="sumit">
- <view class="flex flex-direction padding-sm">
- <button class="radius cu-btn base-bg-color" style="padding: 45rpx;">提交反馈</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- var app = getApp();
- export default {
- data() {
- return {
- //图片回显
- imgList: [],
- data: {
- openId: '',
- phone: '',
- content: '',
- name: '',
- images: '',
- member_id: '',
- feedbackType: "0",
- residentialId: '',
- tenantType: 1
- },
- //选择项列表
- typeList: [{
- title: '功能异常:功能故障或不可用',
- feedbackType: '0'
- },
- {
- title: '产品建议:用的不爽,我有建议',
- feedbackType: '1'
- },
- {
- title: '其他问题',
- feedbackType: '2'
- },
- ],
- }
- },
- methods: {
- //选择反馈类型
- RadioChange(e) {
- this.data.feedbackType = e.detail.value
- },
- /**输入问题描述
- * @param {Object} e
- */
- input(e) {
- this.data.content = e.detail.value
- },
- sumit() {
- if (this.$isEmpty(this.data.content)) {
- uni.showToast({
- title: "问题描述不能为空",
- icon: "none"
- })
- return
- }
- if (this.data.content.length < 3) {
- uni.showToast({
- title: "问题描述不能少于三个字",
- icon: "none"
- })
- return
- }
- if (this.$isEmpty(this.imgList)) {
- uni.showToast({
- title: "请提供相关截图",
- icon: "none"
- })
- return
- }
- this.data.member_id = app.globalData.member.id
- this.data.openId = uni.getStorageSync('openid') || ''
- this.data.phone = uni.getStorageSync('myPhone') || ''
- this.data.name = app.globalData.member.name
- this.data.images = this.imgList.join(',')
- this.data.residentialId = uni.getStorageSync('residentialId') || ''
- this.$http.feedback(this.data).then(res => {
- if (res.data.success) {
- this.$dialog.showModal('提交成功', false).then(() => {
- uni.switchTab({
- url: "../wode"
- })
- })
- } else {
- this.$u.toast('提交失败')
- }
- })
- },
- /**
- * 上传问题截图
- */
- async chooseImage() {
- let paths = await this.$wxApi.chooseImage(4)
- for (let path of paths) {
- let url = (await this.$http.uploadFile(path)).data.data.link
- this.imgList.push(url)
- }
- },
- /*预览图片*/
- viewImage(index) {
- uni.previewImage({
- urls: this.imgList,
- current: index
- });
- },
- /*删除图片*/
- DelImg(index) {
- uni.showModal({
- title: '提示',
- content: '确定要删除这张照片吗?',
- cancelText: '取消',
- confirmText: '确定',
- success: res => {
- if (res.confirm) {
- this.imgList.splice(index, 1)
- }
- }
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .page {
- background-color: #FFFFFF;
- min-height: 100vh;
- }
- view {
- box-sizing: border-box;
- }
- .commit {
- color: #fff;
- font-size: 28upx;
- text-align: center;
- line-height: 88upx;
- margin: 0 20upx;
- width: 690upx;
- height: 88upx;
- background: #59a5f0;
- border-radius: 25px;
- margin-bottom: 50upx;
- position: absolute;
- left: 0;
- right: 0;
- bottom: 0;
- }
- .content {
- margin: 0 26rpx;
- .radioBox {
- padding-top: 10rpx;
- .radioItem {
- padding: 18rpx;
- margin-bottom: 15rpx;
- border-radius: 10rpx;
- }
- .defalutBorder {
- border: 1rpx solid #d1d1d1;
- }
- .checkBorder {
- border: 1rpx solid #59a5f0;
- color: #59a5f0;
- }
- }
- .area {
- margin-top: 20rpx;
- padding: 20rpx;
- border-radius: 12rpx;
- border: 1rpx solid #d1d1d1;
- textarea {
- width: 100%;
- line-height: 50rpx;
- }
- .imgArea {
- border-top: 1rpx solid #d1d1d1;
- padding-top: 30rpx;
- }
- }
- }
- </style>
|