123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- <template>
- <view class="index tn-safe-area-inset-bottom">
- <tn-nav-bar customBack>
- <view slot="back" class='tn-custom-nav-bar__back' @click="goBack()">
- <text class='icon tn-icon-left'></text>
- </view>
- <view slot="default" style="display: flex;">
- <view style="flex:1;margin-left:25px">
- <text>问题反馈</text>
- </view>
-
- <view @click="showHis">
- <text class='tn-icon-time'></text>
- 历史反馈
- </view>
- </view>
- </tn-nav-bar>
- <view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
- <view style="display: flex;line-height: 37px;padding: 16px;">
- <view style="margin-right: 8px;">问题类型</view>
- <view style="flex:1"><uni-data-select :clear="false" v-model="typeValue" :localdata="range" @change="change"></uni-data-select></view>
-
- </view>
-
-
- <view class="tn-margin tn-bg-gray--light tn-padding" style="border-radius: 10rpx;">
- <textarea maxlength="500" v-model="contentValue" placeholder="请描述您遇到的问题..." placeholder-style="color:#AAAAAA"></textarea>
- </view>
-
- <view class="tn-margin-left tn-padding-top-xs">
- <uni-file-picker
- v-model="imgList" :limit="6" :auto-upload="false" @select="select" @success="success">
-
-
- </uni-file-picker>
- </view>
- <view style="display: flex;line-height: 37px;padding: 16px;">
- <view style="margin-right: 8px;">联系方式</view>
- <view style="flex:1">
- <uni-easyinput v-model="contactMethod" placeholder="请输入内容"></uni-easyinput>
-
- </view>
-
- </view>
- </view>
-
- <view class="tn-flex tn-footerfixed">
-
- <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
- <tn-button backgroundColor="#3668FC" padding="40rpx 0" width="60%" shadow fontBold @click="saveForm()">
- <!-- <text class="tn-icon-light tn-padding-right-xs tn-color-black"></text> -->
- <text class="tn-color-white">提交</text>
- <!-- <text class="tn-icon-camera tn-padding-left-xs tn-color-black"></text> -->
- </tn-button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import request from '../../utils/request'
- export default {
- data() {
- return {
- imgList:[],
- fileDetailList:[],
- showHistory: false,
- content: [],
- contentValue:'',
- contactMethod:uni.getStorageSync('userInfo')?JSON.parse(uni.getStorageSync('userInfo')).userName:'',
- typeValue:1,
- range: [{
- value: 1,
- text: "汇报系统故障"
- },
- {
- value: 2,
- text: "平台问题"
- },
- {
- value: 3,
- text: "投诉"
- },
- ],
- showEmpty: false,
- }
- },
- filters: {
- formatDate(value) {
- if (!value) return '';
- const date = new Date(value);
- const today = new Date();
- const yesterday = new Date(today); // 昨天的日期
- yesterday.setDate(yesterday.getDate() - 1); // 将昨天的日期设置为前一天
- if (date.getFullYear() == today.getFullYear() && date.getMonth() == today.getMonth() && date.getDate() ==
- today.getDate()) {
- return '今天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
- .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
- }
- if (date.getFullYear() == yesterday.getFullYear() && date.getMonth() == yesterday.getMonth() && date
- .getDate() == yesterday.getDate()) {
- return '昨天 ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
- .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
- }
- return date.toLocaleDateString() + ' ' + (date.getHours() > 9 ? '' : '0') + date.getHours() + ':' + (date
- .getMinutes() > 9 ? '' : '0') + date.getMinutes(); // 根据需要格式化日期
- },
- },
- created() {
- // uni.navigateTo({
- // url:'/pages/mine/addFeed'
- // })
- },
- methods: {
- showHis(){
- uni.navigateTo({
- url:'/pages/mine/feedback'
- })
- },
-
- goBack() {
- uni.navigateBack();
- },
- select(e) {
- console.log('选择文件:', e)
- let tempFiles = e.tempFiles;
- for (let i in tempFiles) {
- this.upfile(tempFiles[i])
- }
- },
- upfile(file) {
- let that = this;
- console.warn(file);
- uni.uploadFile({
- url: 'http://slb-m.dev.ml1993.com/oss/upload/userFeedback', //仅为示例,非真实的接口地址
- filePath: file.url,
- name: 'file',
- success: (uploadFileRes) => {
- console.warn(JSON.parse(uploadFileRes.data));
- let resultMap = JSON.parse(uploadFileRes.data).resultMap;
- that.fileDetailList.push({
- name: file.name,
- fileName: file.name, // 原始文件名
- ftpUrl: resultMap.uploadUrl, // 文件访问url
- })
- }
- });
- },
- // 上传成功
- success(e) {
- console.log('上传成功')
- },
- saveForm(){
- let that = this;
- let params = {
-
- };
-
- if(!this.contentValue){
- uni.showToast({
- title: '请输入您遇到的问题',
- duration: 2000,
- icon:'none'
- });
- return false;
- }
-
-
-
- if(!this.contactMethod){
- uni.showToast({
- title: '请输入您的联系方式',
- duration: 2000,
- icon:'none'
- });
- return false;
- }
-
- uni.showToast({
- title: '提交中...',
- icon:'none'
- });
-
- params.slbFeedback = JSON.stringify({
- type:this.typeValue,
- content:this.contentValue,
- contactMethod:this.contactMethod,
- userNo:uni.getStorageSync('userNo'),
- });
-
-
- params.fileDetailList = JSON.stringify(this.fileDetailList);
- request.post('/slbFeedback/add', params).then(res => {
- if(res.success){
- uni.showToast({
- title:'已提交',
- icon:'none',
- success:()=>{
- setTimeout(()=>{
- uni.redirectTo({
- url:'/pages/mine/feedback'
- });
- },2000)
-
- }
- })
-
- }else{
- uni.showToast({
- title:res.msg,
- icon:'none'
- })
- }
- console.warn(res);
- })
- }
- },
- onLoad() {
-
- }
- }
- </script>
- <style lang="scss" scoped>
- /* 胶囊*/
- .tn-custom-nav-bar__back {
- width: 60%;
- height: 100%;
- position: relative;
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- box-sizing: border-box;
- // background-color: rgba(0, 0, 0, 0.15);
- border-radius: 1000rpx;
- border: 1rpx solid rgba(255, 255, 255, 0.5);
- // color: #FFFFFF;
- font-size: 18px;
- .icon {
- display: block;
- flex: 1;
- margin: auto;
- text-align: center;
- }
- &:before {
- content: " ";
- width: 1rpx;
- height: 110%;
- position: absolute;
- top: 22.5%;
- left: 0;
- right: 0;
- margin: auto;
- transform: scale(0.5);
- transform-origin: 0 0;
- pointer-events: none;
- box-sizing: border-box;
- opacity: 0.7;
- background-color: #FFFFFF;
- }
- }
- </style>
|