123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
- <member-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
- <view class="div common-header-wrap">
- <view class="status-holder"></view>
- <view :style="'height:'+navHeight+'px'"></view>
- <view class="common-header-holder"></view>
- <view class="common-header-fixed">
- <title-header />
- <uni-nav-bar title="意见反馈" class="common-header" left-icon="back" @clickLeft="goBack()">
- </uni-nav-bar>
- </view>
- </view>
- <view class="div feedback-form">
- <view class="div field-line-right" ><textarea class="feedback-message field-input" v-model="feedback" placeholder="反馈内容:" ></textarea></view>
- <!-- <flex-line class="field-line" :show-border="true"><text class="span field-name">验证码</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="pictureCode" /><image mode="aspectFit" @click="changePictureCode" height="48" :src="pictureCodeUrl" class="img countdown" ></view></flex-line> -->
- <view class="div pt-10 pb-10"><view class="div common-btn ds-button-large" @click="submit">保存</view></view>
- </view>
- <view class="scroll-view div" style="position:relative">
- <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
- <view class="div feedback-list" v-if="feedback_list && feedback_list.length">
- <view class="div feedback-item" v-for="(item, index) in feedback_list" :key="index">
- <view class="div feedback-info">
- <view class="div p-info">
- <view class="div explain">咨询内容
- <text class="span right">{{ $moment.unix(item.fb_time).format('YYYY年MM月DD日') }}</text>
- </view>
- <view class="div name">{{item.fb_content}}</view>
- </view>
- </view>
- </view>
- </view>
- <empty-record v-else-if="feedback_list && !feedback_list.length"></empty-record>
- </scroll-view>
- </view>
- </view></member-base>
- </template>
- <script>
- import {getFontSize} from '@/util/common'
- import TitleHeader from '../../TitleHeader'
- import MemberBase from '../MemberBase'
- import { mapState, mapMutations } from 'vuex'
- import EmptyRecord from '../../EmptyRecord'
- import { getFeedbackList, addFeedback } from '../../../api/memberFeedback'
- import { checkPictureCaptcha } from '../../../api/common'
- import flexLine from '../../flexLine'
- import { env } from '../../../static/config'
- export default {
- name:'MemberFeedback',
- computed:{
- fontSize(){
- return getFontSize()
- },
- },
- data(){
- return {
- navHeight: 0,
- feedback: '',
- params: { 'page': 0, 'per_page': 10 },
- pictureCode: '',
- pictureCodeUrl: '',
- pictureCodeValid: false,
- feedback_list: false,
- loading: false, // 是否加载更多
- isMore: true // 是否有更多
- }
- },
- components:{
- TitleHeader,
- MemberBase,
- flexLine,
- EmptyRecord
- },
- mounted(){
- // #ifdef MP-WEIXIN
- this.navHeight = uni.getMenuButtonBoundingClientRect().top
- // #endif
- // this.changePictureCode()
- },
- created () {
- this.loadMore()
- },
- watch: {
- pictureCode: function (val) {
- if (val.length >= 4) {
- this.pictureCodeWait = true
- checkPictureCaptcha(val).then(
- response => {
- this.pictureCodeWait = false
- this.pictureCodeValid = true
- },
- error => {
- this.pictureCodeWait = false
- uni.showToast({icon:'none',title: error.message})
- }
- )
- }
- }
- },
- methods:{
- goBack(){uni.navigateBack({delta:1})},
- submit () {
- // if (!this.pictureCode) {
- // uni.showToast({icon:'none',title: '请先输入图片验证码'})
- // return
- // }
- if (!this.feedback) {
- uni.showToast({icon:'none',title: '请先输入反馈内容'})
- return
- }
- // if (!this.pictureCodeValid) {
- // uni.showToast({icon:'none',title: '验证码错误'})
- // return
- // }
- addFeedback(this.feedback).then(res => {
- uni.showToast({icon:'none',title: res.message})
- this.feedback = ''
- this.pictureCode = ''
- this.params = { 'page': 0, 'per_page': 10 }
- this.feedback_list = false
- this.loading = false
- this.isMore = true
- this.loadMore()
- this.changePictureCode()
- }).catch(function (error) {
- uni.showToast({icon:'none',title: error.message})
- })
- },
- changePictureCode () {
- this.pictureCodeUrl = env.API_HOST + '/Seccode/makecode?r=' + Math.random()
- },
- loadMore () {
- this.loading = true
- this.params.page = ++this.params.page
- if (this.isMore) {
- this.loading = false
- this.getConsultList(true)
- }
- },
- getConsultList () {
- uni.showLoading({ title: '加载中' })
- getFeedbackList(this.params).then(res => {
- uni.hideLoading()
- if (res.result.hasmore) {
- this.isMore = true
- } else {
- this.isMore = false
- }
- this.feedback_list = res.result.feedback_list.data
- }).catch(function (error) {
- uni.hideLoading()
- uni.showToast({icon:'none',title: error.message})
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .scroll-view-wrapper{display: flex;flex-direction: column;}
- .scroll-view{flex:1}
- .feedback-form{background: #fff;padding:0 $pageSpace;box-shadow: 0px 4px 4px #f7f7f7;position: relative;}
- .feedback-message{background: #fbfbfb;margin: .5rem 0;font-size: .7rem;padding: .5rem;height: 4rem;border: 0;box-sizing: border-box;width: 100%;}
- .feedback-list{background: #fff;padding:0 $pageSpace;}
- .feedback-item{background:#fff;border-bottom:1px dashed #eee;}
- .feedback-info{padding:.5rem 0;display: flex}
- .feedback-info .p-info{width: 100%;}
- .feedback-info .p-info .name{font-size:$subFontSize;color:$primaryColor;word-break:break-all}
- .feedback-info .p-info .explain{font-size:$subFontSize;margin-bottom:.5rem}
- .feedback-info .p-info .explain .right{float:right;color:gray}
- .feedback-info .p-info .replay{font-size:$subFontSize;padding-top:.5rem;color:$descTextColor}
- .countdown{width: auto;height: 1.75rem;min-width: 4rem;}
- </style>
|