Browse Source

恢复账号密码登录

seimin 9 months ago
parent
commit
1f741e8afa
5 changed files with 25 additions and 21 deletions
  1. 2 1
      config/index.js
  2. 1 8
      src/main.js
  3. 1 1
      src/router/index.js
  4. 18 8
      src/views/Login.vue
  5. 3 3
      upload/development.js

+ 2 - 1
config/index.js

@@ -13,7 +13,8 @@ module.exports = {
13 13
     assetsPublicPath: '/',
14 14
     proxyTable: {
15 15
       '/service': {//自定义名字,代表的是以下target中的内容
16
-        target: host.host+'/service/',//微信
16
+        // target: host.host+'/service/',//微信
17
+        target: 'http://192.168.4.105/service/',//微信
17 18
         changeOrigin: false,//是否允许跨域
18 19
         pathRewrite: {
19 20
           '^/service': ''

+ 1 - 8
src/main.js

@@ -19,14 +19,7 @@ let protocolName = document.location.protocol; //http协议
19 19
 axios.defaults.baseURL = protocolName + "//" + domainName;
20 20
 
21 21
 // axios.defaults.timeout = 5000;
22
-axios.interceptors.response.use(function (response) {
23
-  return response;
24
-}, function (error) {
25
-  if(error && error.response && error.response.status == 444){
26
-    window.location.href = location.origin + '/user.jsp';
27
-  }
28
-  return Promise.reject(error);
29
-});
22
+
30 23
 Vue.prototype.$http = axios;
31 24
 Vue.config.productionTip = false;
32 25
 Vue.prototype.$host = protocolName + "//" + domainName;

+ 1 - 1
src/router/index.js

@@ -236,7 +236,7 @@ export default new Router({
236 236
     path: '*',
237 237
     hidden: true,
238 238
     redirect: {
239
-      path: '/'
239
+      path: '/login'
240 240
     }
241 241
   }
242 242
   ]

+ 18 - 8
src/views/Login.vue

@@ -1,5 +1,5 @@
1 1
 <template>
2
-  <div class="fle bgColor" v-if="!isSSo && false">
2
+  <div class="fle bgColor" v-if="!isSSo">
3 3
     <load-ing v-show="requesterLgoinType == 'wechat'"></load-ing>
4 4
     <h2
5 5
       v-if="requesterLgoinType == 'web'"
@@ -211,10 +211,20 @@ export default {
211 211
     zlogin() {
212 212
       console.log(this);
213 213
       var that = this;
214
+      var ssoStr = "";
215
+      var ssoJson;
216
+      if (this.isSSo) {
217
+        ssoStr = location.search
218
+          .replace("?", "")
219
+          .split("&")[0]
220
+          .split("=")[1];
221
+        ssoStr = decode(decodeURIComponent(ssoStr));
222
+        ssoJson = JSON.parse(ssoStr);
223
+      }
214 224
       var postData = this.isSSo
215
-        ? { type: 'pc' }
225
+        ? { username: ssoJson.a, password: ssoJson.u, t: false }
216 226
         : { username: this.zhanghao, password: this.mima };
217
-      this.$http.post("service/auth/sslLogin", postData).then(res => {
227
+      this.$http.post("service/auth/loginEncrypt", postData).then(res => {
218 228
         that.loading = false;
219 229
         if (res.data && res.data.state == 200) {
220 230
           localStorage.setItem("loginUser", JSON.stringify(res.data.data.user));
@@ -224,10 +234,6 @@ export default {
224 234
             JSON.stringify(res.data.data.requester)
225 235
           );
226 236
           this.getConfig(res.data.data.user,res.data.data.requester);
227
-        }else if (res.data && res.data.state == 501) {
228
-          var user = JSON.parse(localStorage.getItem('loginUser'));
229
-          var requester = JSON.parse(localStorage.getItem('login_requester'));
230
-          user && requester && this.getConfig(user,requester);
231 237
         } else {
232 238
           that
233 239
             .$createDialog({
@@ -252,7 +258,11 @@ export default {
252 258
     }
253 259
   },
254 260
   created() {
255
-    this.isSSo = true;
261
+    if (location.search.length > 0) {
262
+      this.isSSo = Boolean(this.getQueryString("t"));
263
+    } else {
264
+      this.isSSo = false;
265
+    }
256 266
     if (this.isSSo) {
257 267
       this.zlogin();
258 268
     }

+ 3 - 3
upload/development.js

@@ -1,11 +1,11 @@
1 1
 const shell = require('shelljs')
2 2
 const path = require('path');
3 3
 const config = {
4
-  ip: "192.168.3.110", // ssh地址
4
+  ip: "192.168.3.122", // ssh地址
5 5
   username: "root", // ssh 用户名
6 6
   port: 22,      //端口
7
-  password: "123456", // ssh 密码
8
-  path: '/home/itsm/project/web/userApp', // 上传地址,删除地址
7
+  password: "DStech@123", // ssh 密码
8
+  path: '/home/itsm/project/web/mdv2/userApp', // 上传地址,删除地址
9 9
   buildPath: '../dist' // 本地打包后文件地址
10 10
 }
11 11
 let Client = require('ssh2-sftp-client');