Przeglądaj źródła

Merge branch 'develop/3.1.0' into test

DESKTOP-SVI9JE1\muzen 2 lat temu
rodzic
commit
c349cc9da9

+ 1 - 0
package.json

@@ -70,6 +70,7 @@
     "@lucky-canvas/vue": "^0.1.11",
     "@vue/shared": "^3.0.0",
     "@zebra-ui/swiper": "^2.2.2",
+    "axios": "^1.4.0",
     "core-js": "^3.6.5",
     "flyio": "^0.6.2",
     "js-base64": "^3.7.5",

+ 3 - 0
src/main.js

@@ -1,8 +1,11 @@
 import Vue from 'vue'
 import App from './App'
+import axios from 'axios'
 
 Vue.config.productionTip = false
 
+Vue.prototype.$axios = axios
+
 // 打开App
 Vue.prototype.openApp = function (page, channel, audioType, audioId) {
   // 

+ 0 - 5
src/pages/activity/index.vue

@@ -42,15 +42,10 @@ export default {
   },
   methods: {
     getDetail() {
-      uni.showLoading({
-        title: '加载中...',
-        mask: true
-      })
       detail({
         activityId: this.form.activityId
       }).then(res => {
         if (res.data.code === 0) {
-          uni.hideLoading()
           this.pic = res.data.data.pic
         } else {
           uni.showToast({

+ 0 - 4
src/pages/agreement/index.vue

@@ -18,15 +18,11 @@ export default {
   },
   methods: {
     getDetail(type) {
-      uni.showLoading({
-        mask: true
-      })
       detail({
         type: type
       }).then(res => {
         if (res.data.code === 0) {
           this.form = res.data.data
-          uni.hideLoading()
         }
       })
     }

+ 0 - 4
src/pages/help/detail.vue

@@ -48,11 +48,7 @@ export default {
   },
   methods: {
     getDetail() {
-      uni.showLoading({
-        mask: true
-      })
       detail(this.form).then(res => {
-        uni.hideLoading()
         if (res.data.code === 0) {
           this.tableData = res.data.data.records
           this.total = res.data.data.total

+ 26 - 45
src/pages/help/index.vue

@@ -10,10 +10,10 @@
       </radio-group>
     </view>
     <view class="textarea">
-      <textarea placeholder="请描述您遇到的问题或意见" />
+      <textarea v-model="form.content" placeholder="请描述您遇到的问题或意见" />
     </view>
     <view class="upload">
-      <view class="img-list" v-for="(item, index) in form.imageFiles" :key="index">
+      <view class="img-list" v-for="(item, index) in imageFiles" :key="index">
         <uni-icons class="close" type="closeempty" color="#FFF" size="12" @click="getDelete(index)" />
         <img :src="item" />
       </view>
@@ -32,13 +32,23 @@
 </template>
 
 <script>
-import { Base64 } from 'js-base64'
 import { list, submit } from '@/api/help.js'
 export default {
   data() {
+    const info = getApp().globalData.userInfo
     return {
       // 表单
-      form: {},
+      form: {
+        appVersion: info.version,
+        phone: info.phone,
+        platformType: info.deviceType,
+        systemVersion: info.systemVersion,
+        imageFiles: '',
+        type: '',
+        content: ''
+      },
+      // 图片列表
+      imageFiles: [],
       // 单选
       active: 0,
       // 反馈类型
@@ -47,27 +57,12 @@ export default {
   },
   onLoad() {
     this.getList()
-    const e = getApp().globalData.userInfo
-    this.form = {
-      appVersion: e.version,
-      phone: e.phone,
-      platformType: e.deviceType,
-      systemVersion: e.systemVersion,
-      imageFiles: [],
-      type: '',
-      content: ''
-    }
   },
   methods: {
     // 反馈类型
     getList() {
-      uni.showLoading({
-        title: '加载中...',
-        mask: true
-      })
       list().then(res => {
         if (res.data.code === 0) {
-          uni.hideLoading()
           this.typeOptions = res.data.data
         }
       })
@@ -75,54 +70,40 @@ export default {
 
     // 单选
     radioChange(e) {
-      this.typeOptions.map(i => {
-        if (i.id === e.detail.value) {
-          this.active = i.id
-          this.form.type = i.id
-        }
-      })
+      this.active = e.detail.value
+      this.form.type = e.detail.value
     },
 
     // 上传
     upload() {
-      // let count = 9 - this.form.imageFiles.length
-      // uni.chooseImage({
-      //   count: count,
-      //   sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
-      //   sourceType: ['album'], //从相册选择
-      //   success: (res) => {
-      //     res.tempFilePaths.map(i => {
-      //       this.form.imageFiles.push(Base64.encode(i))
-      //     })
-      //   }
-      // })
       selectImageCount.postMessage(`${this.form.imageFiles.length}`)
       selectImage.postMessage('获取相册信息')
-      window['receiveImageAddress'] = res => {
-        JSON.parse(res).addressList.map(i => {
-          this.form.imageFiles.push(Base64.encode(i))
+      window['receiveImageAddress'] = e => {
+        JSON.parse(e).addressList.map(i => {
+          this.imageFiles.push(i)
         })
       }
     },
 
     // 删除按钮
     getDelete(index) {
-      this.form.imageFiles.splice(index, 1)
+      this.imageFiles.splice(index, 1)
     },
 
     // 提交
     getSubmit() {
       if (this.form.type !== '' && this.form.content !== '') {
-        uni.showLoading({
-          title: '提交中...',
-          mask: true
-        })
+        this.form.imageFiles = this.imageFiles.join(',')
         submit(this.form).then(res => {
-          uni.hideLoading()
           if (res.data.code === 0) {
             uni.showToast({
               title: '提交成功!'
             })
+            this.form.imageFiles = ''
+            this.form.type = ''
+            this.active = 0
+            this.form.content = ''
+            this.imageFiles = []
           } else {
             uni.showToast({
               title: res.data.message,

+ 2 - 1
src/utils/request.js

@@ -8,7 +8,8 @@ function request(e) {
   }
 
   uni.showLoading({
-    title: '加载中...'
+    title: '加载中...',
+    mask: true
   })
 
   const promise = new Promise((resolve, reject) => {