瀏覽代碼

反馈功能完成

JXDS18FUJT 1 年之前
父節點
當前提交
a5c69b3c77
共有 6 個文件被更改,包括 294 次插入2 次删除
  1. 18 0
      src/api/modules/advise.js
  2. 20 0
      src/api/modules/file.js
  3. 1 1
      src/api/request.js
  4. 233 0
      src/otherPages/userAdvise/index.vue
  5. 14 1
      src/pages.json
  6. 8 0
      src/pages/user/index.vue

+ 18 - 0
src/api/modules/advise.js

@@ -0,0 +1,18 @@
+import request from '../request'
+
+const advise = {
+
+    //微信小程序上传文件接口
+    studentFeedBack(data) {
+        return request({
+            url: "student/feed/back",
+            method: "POST",
+
+            data
+        })
+    }
+
+
+}
+
+export default advise

+ 20 - 0
src/api/modules/file.js

@@ -0,0 +1,20 @@
+import request from '../request'
+
+const file = {
+
+    //微信小程序上传文件接口
+    studentFileInfoUploadImage(data) {
+        return request({
+            url: "student/file/info/uploadImage",
+            method: "POST",
+            headers: {
+                'content-type': 'multipart/form-data'
+            },
+            data
+        })
+    }
+
+
+}
+
+export default file

+ 1 - 1
src/api/request.js

@@ -13,7 +13,7 @@ const service = axios.create({
 	// axios中请求配置有baseURL选项,表示请求URL公共部分
 	//#ifdef MP-WEIXIN
 	//baseURL: process.env.NODE_ENV === 'development' ? 'https://jpcj-admin1.zzxcx.net/stage-api' : 'https://jpcj-admin.zzxcx.net/prod-api',
-	baseURL: process.env.NODE_ENV === 'development' ? 'https://nbjk1.zzxcx.net/nbjk-admin/' : 'https://1a0j71808.imdo.co/',
+	baseURL: process.env.NODE_ENV === 'development' ? 'https://nbjk1.zzxcx.net/nbjk-admin/' : 'https://nbjk.zzxcx.net/nbjk-admin/',
 	
 	//#endif
 	//#ifdef MP-TOUTIAO

+ 233 - 0
src/otherPages/userAdvise/index.vue

@@ -0,0 +1,233 @@
+<template>
+  <view class="bg">
+    <view class="header">
+      <radio-group class="option" @change="radioChange">
+        <label class="radio">
+          <radio checked color="#498ef5" value="1" /><text
+            style="font-weight: 600; padding-left: 10rpx"
+            >遇到问题</text
+          >
+        </label>
+        <label class="radio">
+          <radio color="#498ef5" value="2" /><text
+            style="font-weight: 600; padding-left: 10rpx"
+            >使用建议</text
+          >
+        </label>
+      </radio-group>
+    </view>
+    <view>
+      <view class="form">
+        <view class="content">
+          <textarea
+            maxlength="250"
+            :placeholder="placeholder"
+            class=""
+            v-model="form.content"
+          ></textarea>
+          <view class="uplaod">
+            <van-uploader
+              accept="image"
+              @delete="deleteAdviseImg"
+              :max-count="4"
+              :file-list="fileList"
+              @after-read="afterRead"
+            >
+              <image style="width: 80px; height: 80px" :src="i"></image>
+            </van-uploader>
+          </view>
+        </view>
+        <view class="phone">
+          <input
+            v-model="form.phone"
+            placeholder="请填写手机号码"
+            class="phone-input"
+          />
+        </view>
+      </view>
+    </view>
+    <view class="submit">
+      <view @click="submitAdvise" class="submit-button">提交</view>
+    </view>
+  </view>
+</template>
+
+<script>
+import store from "@/store";
+import api from "@/api";
+export default {
+  data() {
+    return {
+      form: {
+        content: "",
+        phone: "",
+        type: "1",
+        imgs: "",
+      },
+      uploadUrl:
+        process.env.NODE_ENV === "development"
+          ? "https://nbjk1.zzxcx.net/nbjk-admin/"
+          : "https://nbjk.zzxcx.net/nbjk-admin/",
+      i: "https://ct-1305573081.cos.ap-shanghai.myqcloud.com/ctjk/mp-wx/userAdvise/upload_icon.png",
+      fileList: [],
+      placeholder:
+        "遇到的问题如下:1、打开了某个页面2、执行某个操作遇到了什么问题3、其他附加描述",
+    };
+  },
+  methods: {
+    deleteAdviseImg(e){
+      console.log(e)
+     let fileList= this.fileList.filter((item,index)=>{
+       return e.detail.index!==index
+
+      })
+
+      this.fileList =fileList
+
+    },
+    submitAdvise(e) {
+      console.log(e);
+      let that = this;
+      var res = /^[1][3,4,5,6.7,8,9][0-9]{9}$/;
+      if (!res.test(this.form.phone)) {
+        uni.showToast({
+          icon: "error",
+          title: "手机号格式错误",
+        });
+        return;
+      }
+      api.advise
+        .studentFeedBack({
+          ...that.form,
+          imgIds: that.fileList.map((item) => item.id).join(","),
+        })
+        .then((res) => {
+          uni.showToast({
+            title: "成功",
+          });
+        });
+    },
+    afterRead(e) {
+      console.log(e);
+
+      let that = this;
+      uni.uploadFile({
+        url: that.uploadUrl + "/student/file/info/uploadImage",
+        filePath: e.detail.file.url,
+        name: "img",
+        header: {
+          Authorization: store.state.user.tokenObj.token
+            ? "Bearer " + store.state.user.tokenObj.token
+            : "",
+          "Content-Type": "application/json;charset=utf8",
+        },
+        formData: {
+          businessType: that.form.type,
+        },
+        success(res) {
+          var resData = JSON.parse(res.data);
+
+          if (resData.code == 200) {
+            that.fileList.push({
+              url: e.detail.file.url,
+              id: resData.data,
+              name: resData.data,
+              isImage:true
+            });
+          } else {
+            uni.showToast({
+              icon: "error",
+              title: "上传失败",
+            });
+          }
+        },
+      });
+    },
+    radioChange(e) {
+      this.form.type = e.detail.value;
+      this.placeholder =
+        e.detail.value == "1"
+          ? "遇到的问题如下:1、打开了某个页面2、执行某个操作遇到了什么问题3、其他附加描述"
+          : "请详细描述您在使用视频APP时的想法和建议";
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.bg {
+  background: #fff;
+  width: 100vw;
+  height: 100vh;
+}
+.inline-block {
+  display: inline-block;
+}
+.header {
+  padding-left: 114rpx;
+  padding-right: 114rpx;
+  display: flex;
+  justify-content: space-between;
+  .option {
+    width: 100%;
+    display: flex;
+    justify-content: space-between;
+    margin-top: 56rpx;
+  }
+}
+.form {
+  padding-left: 30rpx;
+  padding-right: 30rpx;
+  margin-top: 30rpx;
+  .phone {
+    margin-top: 50rpx;
+    .phone-input {
+      height: 108rpx;
+      line-height: 108rpx;
+      background: rgba(242, 243, 245, 1);
+      overflow: hidden;
+      border-radius: 54rpx;
+      padding-left: 40rpx;
+    }
+  }
+
+  .content {
+    width: 100%;
+    background: rgba(242, 243, 245, 1);
+    height: 456rpx;
+    position: relative;
+
+    .uplaod {
+      // position: absolute;
+      // bottom: 32rpx;
+      padding-left: 30rpx;
+      z-index: 999;
+      margin-top: 20px;
+    }
+  }
+  .content > textarea {
+    width: 630rpx;
+
+    height: 220rpx;
+    padding-top: 20rpx;
+    padding-left: 30rpx;
+    padding-right: 30rpx;
+    border-radius: 5rpx;
+  }
+}
+.submit {
+  position: absolute;
+  bottom: 80rpx;
+  width: 100%;
+  .submit-button {
+    width: 530rpx;
+    line-height: 80rpx;
+    text-align: center;
+    margin: 0 auto;
+    background: rgba(73, 142, 245, 1);
+    color: #fff;
+
+    border-radius: 40rpx;
+  }
+}
+</style>

+ 14 - 1
src/pages.json

@@ -184,6 +184,7 @@
         "navigationBarTitleText": "用户信息"
       }
     },
+    
     {
       "path": "pages/carVideo/shortVideoPaly",
       "style": {
@@ -302,6 +303,13 @@
             "enablePullDownRefresh": false
           }
         },
+        {
+          "path": "userAdvise/index",
+          "style": {
+            "navigationBarTitleText": "提交反馈",
+            "enablePullDownRefresh": false
+          }
+        },
         {
           "path": "exerciseSpecify/index",
           "style": {}
@@ -531,13 +539,18 @@
       "van-grid": "wxcomponents/vant/grid/index",
       "van-grid-item": "wxcomponents/vant/grid-item/index",
       "van-nav-bar": "wxcomponents/vant/nav-bar/index",
-      "van-action-sheet":"wxcomponents/vant/action-sheet/index"
+      "van-action-sheet":"wxcomponents/vant/action-sheet/index",
+      "van-uploader":"wxcomponents/vant/uploader/index"
     }
   },
   "condition": {
     //模式配置,仅开发期间生效
     "current": 0, //当前激活的模式(list 的索引项)
     "list": [
+      {
+        "path":"otherPages/userAdvise/index",
+        "name": "反馈建议"
+      },
       {
         "path":"otherPages/myExamRoadVideo/index",
         "name": "我的考场"

+ 8 - 0
src/pages/user/index.vue

@@ -76,6 +76,14 @@
           center
           url="/otherPages/createReferCode/index"
         >
+        </van-cell>
+            <van-cell
+          title-class="uni-app-fontsize-paragraph"
+          title="用户反馈"
+          is-link
+          center
+          url="/otherPages/userAdvise/index"
+        >
         </van-cell>
         <!-- <van-cell title="我要提现" value="" is-link center @click="goCashOut">
         </van-cell> -->