瀏覽代碼

常见问题根据配置来

seimin 2 年之前
父節點
當前提交
119bb9672a
共有 2 個文件被更改,包括 56 次插入54 次删除
  1. 50 53
      src/views/Login.vue
  2. 6 1
      src/views/indes.vue

+ 50 - 53
src/views/Login.vue

@@ -36,30 +36,27 @@ export default {
36 36
       zhanghao: "",
37 37
       mima: "",
38 38
       requesterLgoinType: "",
39
-      isSSo: true, // 是否单点登录
39
+      isSSo: true // 是否单点登录
40 40
     };
41 41
   },
42 42
   components: {
43
-    LoadIng,
43
+    LoadIng
44 44
   },
45 45
   methods: {
46 46
     // 登陆
47 47
     login() {
48 48
       var that = this;
49
-      that.$http.post("service/auth/wechatAuth", {}).then((res) => {
49
+      that.$http.post("service/auth/wechatAuth", {}).then(res => {
50 50
         if (res.data.url) {
51 51
           window.location.href = res.data.url;
52 52
         } else {
53
-          console.log(res.data)
53
+          console.log(res.data);
54 54
           if (res.data.user) {
55 55
             localStorage.setItem(
56 56
               "loginUser",
57 57
               JSON.stringify(res.data.user.user)
58 58
             );
59
-            localStorage.setItem(
60
-              "menu",
61
-              JSON.stringify(res.data.user.menu)
62
-            );
59
+            localStorage.setItem("menu", JSON.stringify(res.data.user.menu));
63 60
             localStorage.setItem(
64 61
               "login_requester",
65 62
               JSON.stringify(res.data.user.requester)
@@ -77,12 +74,12 @@ export default {
77 74
         that.login();
78 75
       } else {
79 76
         var code = {
80
-          code: url[1],
77
+          code: url[1]
81 78
           // name: "微信处理人"
82 79
         };
83 80
         // alert("2--传code参数:");
84 81
         // alert(JSON.stringify(code));
85
-        that.$http.post("service/auth/wechatLoginEncrypt", code).then((res) => {
82
+        that.$http.post("service/auth/wechatLoginEncrypt", code).then(res => {
86 83
           if (res.data.state == 200) {
87 84
             console.log(res.data);
88 85
             // alert(3);
@@ -92,10 +89,7 @@ export default {
92 89
                 "loginUser",
93 90
                 JSON.stringify(res.data.user.user)
94 91
               );
95
-              localStorage.setItem(
96
-                "menu",
97
-                JSON.stringify(res.data.user.menu)
98
-              );
92
+              localStorage.setItem("menu", JSON.stringify(res.data.user.menu));
99 93
               localStorage.setItem(
100 94
                 "login_requester",
101 95
                 JSON.stringify(res.data.user.requester)
@@ -107,7 +101,7 @@ export default {
107 101
               .$createDialog({
108 102
                 type: "alert",
109 103
                 title: "您的账号被删除,请联系管理员",
110
-                icon: "cubeic-alert",
104
+                icon: "cubeic-alert"
111 105
               })
112 106
               .show();
113 107
           } else {
@@ -115,7 +109,7 @@ export default {
115 109
               .$createDialog({
116 110
                 type: "alert",
117 111
                 title: res.data.remarks,
118
-                icon: "cubeic-alert",
112
+                icon: "cubeic-alert"
119 113
               })
120 114
               .show();
121 115
           }
@@ -129,19 +123,16 @@ export default {
129 123
         .post("service/auth/loginEncrypt", {
130 124
           // username: "DingDanDan",
131 125
           username: "admin",
132
-          password: "20200326",
126
+          password: "20200326"
133 127
         })
134
-        .then(function (res) {
128
+        .then(function(res) {
135 129
           that.loading = false;
136 130
           if (res.data && res.data.state == 200) {
137 131
             localStorage.setItem(
138 132
               "loginUser",
139 133
               JSON.stringify(res.data.data.user)
140 134
             );
141
-            localStorage.setItem(
142
-              "menu",
143
-              JSON.stringify(res.data.data.menu)
144
-            );
135
+            localStorage.setItem("menu", JSON.stringify(res.data.data.menu));
145 136
             localStorage.setItem(
146 137
               "login_requester",
147 138
               JSON.stringify(res.data.data.requester)
@@ -156,35 +147,41 @@ export default {
156 147
       this.$http
157 148
         .post("service/sysinfo/data/fetchDataList/systemConfiguration", {
158 149
           idx: 0,
159
-          sum: 1000,
150
+          sum: 1000
160 151
         })
161
-        .then((res) => {
152
+        .then(res => {
162 153
           let list = res.data.list;
163
-          let repairMain = list.find((v) => v.keyconfig == "repairMain"); //报修主体
164
-          let incidentWithConsumable = list.find(
165
-            (v) => v.keyconfig == "incidentWithConsumable"
166
-          ); //是否绑定耗材
167
-          let wxIncidentWithCmdb = list.find(
168
-            (v) => v.keyconfig == "wxIncidentWithCmdb"
169
-          ); //是否绑定资产
170
-          localStorage.setItem(
171
-            "valConfig",
172
-            JSON.stringify(repairMain.valueconfig)
173
-          );
174
-          localStorage.setItem(
175
-            "incidentWithConsumable",
176
-            incidentWithConsumable.valueconfig
177
-          );
178
-          localStorage.setItem(
179
-            "wxIncidentWithCmdb",
180
-            wxIncidentWithCmdb.valueconfig
181
-          );
154
+          list.forEach(v => {
155
+            switch (v.keyconfig) {
156
+              case "repairMain": //报修主体
157
+                localStorage.setItem(
158
+                  "valConfig",
159
+                  JSON.stringify(v.valueconfig)
160
+                );
161
+                break;
162
+              case "incidentWithConsumable": //是否绑定耗材
163
+                localStorage.setItem("incidentWithConsumable", v.valueconfig);
164
+                break;
165
+              case "wxIncidentWithCmdb": //是否绑定资产
166
+                localStorage.setItem("wxIncidentWithCmdb", v.valueconfig);
167
+                break;
168
+              // case "wxBxQuestions": //微信报修常见问题链接
169
+              //   localStorage.setItem("wxBxQuestions", v.valueconfig);
170
+              //   break;
171
+              // case "wxGuide": //微信报修服务指南链接
172
+              //   localStorage.setItem("wxGuide", v.valueconfig);
173
+              //   break;
174
+              case "wxClQuestions": //微信处理常见问题链接
175
+                localStorage.setItem("wxClQuestions", v.valueconfig);
176
+                break;
177
+            }
178
+          });
182 179
           this.$router.push({ path: "/main" });
183 180
         });
184 181
     },
185 182
     // 获取报修人登录方式
186 183
     getLoginType() {
187
-      this.$http.post("service/wechat/getLoginType", {}).then((result) => {
184
+      this.$http.post("service/wechat/getLoginType", {}).then(result => {
188 185
         if (result.data.status == 200) {
189 186
           this.requesterLgoinType = result.data.data;
190 187
           window.localStorage.setItem(
@@ -206,21 +203,21 @@ export default {
206 203
       var ssoStr = "";
207 204
       var ssoJson;
208 205
       if (this.isSSo) {
209
-        ssoStr = location.search.replace("?", "").split("&")[0].split("=")[1];
206
+        ssoStr = location.search
207
+          .replace("?", "")
208
+          .split("&")[0]
209
+          .split("=")[1];
210 210
         ssoStr = decode(decodeURIComponent(ssoStr));
211 211
         ssoJson = JSON.parse(ssoStr);
212 212
       }
213 213
       var postData = this.isSSo
214 214
         ? { username: ssoJson.a, password: ssoJson.u, t: false }
215 215
         : { username: this.zhanghao, password: this.mima };
216
-      this.$http.post("service/auth/loginEncrypt", postData).then((res) => {
216
+      this.$http.post("service/auth/loginEncrypt", postData).then(res => {
217 217
         that.loading = false;
218 218
         if (res.data && res.data.state == 200) {
219 219
           localStorage.setItem("loginUser", JSON.stringify(res.data.data.user));
220
-          localStorage.setItem(
221
-            "menu",
222
-            JSON.stringify(res.data.data.menu)
223
-          );
220
+          localStorage.setItem("menu", JSON.stringify(res.data.data.menu));
224 221
           localStorage.setItem(
225 222
             "login_requester",
226 223
             JSON.stringify(res.data.data.requester)
@@ -233,7 +230,7 @@ export default {
233 230
               title: "系统错误",
234 231
               content: "请稍后再试",
235 232
               icon: "cubeic-wrong",
236
-              color: "red",
233
+              color: "red"
237 234
             })
238 235
             .show();
239 236
         }
@@ -247,7 +244,7 @@ export default {
247 244
         return unescape(r[2]);
248 245
       }
249 246
       return null;
250
-    },
247
+    }
251 248
   },
252 249
   created() {
253 250
     if (location.search.length > 0) {
@@ -259,7 +256,7 @@ export default {
259 256
       this.zlogin();
260 257
     }
261 258
     this.getLoginType();
262
-  },
259
+  }
263 260
 };
264 261
 </script>
265 262
 

+ 6 - 1
src/views/indes.vue

@@ -10,10 +10,14 @@
10 10
         <i class="iconfont icon-xinjian"></i>
11 11
         <span>新建事件</span>
12 12
       </div>-->
13
-      <router-link to="/knowList">
13
+      <router-link to="/knowList" v-if="wxClQuestions == 0">
14 14
         <i class="iconfont icon-message"></i>
15 15
         <span>常见问题</span>
16 16
       </router-link>
17
+      <a :href="wxClQuestions" v-if="wxClQuestions != 0 && wxClQuestions != -1">
18
+        <i class="iconfont icon-xinjian"></i>
19
+        <span>常见问题</span>
20
+      </a>
17 21
       <router-link to="/guide">
18 22
         <i class="iconfont icon-fuwuzhinan"></i>
19 23
         <span>公告公示</span>
@@ -221,6 +225,7 @@ import { SM } from "./../http/http";
221 225
 export default {
222 226
   data() {
223 227
     return {
228
+      wxClQuestions:localStorage.getItem("wxClQuestions"),
224 229
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
225 230
       incidentWithConsumable: localStorage.getItem("incidentWithConsumable"),//是否绑定耗材
226 231
       wxIncidentWithCmdb: localStorage.getItem("wxIncidentWithCmdb"),//是否绑定资产