Browse Source

完善问卷提交处理

dygapp 2 years ago
parent
commit
b128e572af

+ 8 - 8
src/utils/request.js

@@ -1,10 +1,10 @@
 import axios from 'axios'
 import {msgBoxNoLogin, msgBoxNoRole, msgError} from './dw-msg'
-import Cookies from 'js-cookie'
-const TokenKey = 'Admin-Token'
-const getToken = () => {
-  return Cookies.get(TokenKey)
-}
+// import Cookies from 'js-cookie'
+// const TokenKey = 'Admin-Token'
+// const getToken = () => {
+//   return Cookies.get(TokenKey)
+// }
 // 全局的 axios 默认值
 axios.defaults.baseURL = process.env.DW_API_URL
 // 请求超时时间
@@ -22,9 +22,9 @@ const service = axios.create({
 // 请求拦截器
 service.interceptors.request.use(
   config => {
-    if (getToken()) {
-      config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
-    }
+    // if (getToken()) {
+    //   config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
+    // }
     return config
   },
   error => {

+ 5 - 1
src/views/dw-survey/DwSurveyList.vue

@@ -116,7 +116,7 @@
 </template>
 
 <script>
-
+import Cookies from 'js-cookie'
 import {dwSurveyCreate, dwSurveyList} from '@/api/dw-survey'
 import {dwSurveyCopy, dwSurveyDelete} from '../../api/dw-survey'
 
@@ -142,6 +142,10 @@ export default {
     }
   },
   mounted () {
+    const token = this.$route.query.token
+    if (token && !Cookies.get('Admin-Token')) {
+      Cookies.set('Admin-Token', token)
+    }
     this.queryList(1)
   },
   methods: {

+ 6 - 0
static/diaowen/js/dw/an/msg.js

@@ -70,6 +70,12 @@ function resultStatus2Msg(resptype,sid,ruleCode) {
   }else if(resptype==='202'){
     tempMsg.resultNote = '超过有效答卷次数!';
     tempMsg.resultColor = "#e70f0f";
+  } else if (resptype==='901') {
+    tempMsg.resultNote = '用户未登录!';
+    tempMsg.resultColor = "#e70f0f";
+  } else if (resptype==='902') {
+    tempMsg.resultNote = '已提交过问卷,不能重复提交!';
+    tempMsg.resultColor = "#e70f0f";
   }
   tempMsg.respType = resptype;
   setResultMsg(tempMsg);

+ 1 - 1
static/diaowen/message.html

@@ -47,7 +47,7 @@
       <div style="font-size: 14px;color: rgb(24, 144, 255);" id="resultNote">参数不完整</div>
       <div style="font-size: 14px;color: rgba(0, 0, 0, 0.45);padding: 20px;" id="respType">状态码:0</div>
       <div style="font-size: 14px;color: rgb(24, 144, 255);" id="totalScore"></div>
-      <div style="textAlign:'center'" id="reqUrlDiv" >
+      <div style="text-align:'center'" id="reqUrlDiv" >
         <a href="#" ></a>
       </div>
       <div id="ruleCodeDiv" style="padding: 10px;display: none;">