乡村相册登录适应
This commit is contained in:
		
							
								
								
									
										15
									
								
								bin/serve.js
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								bin/serve.js
									
									
									
									
									
								
							| @@ -14,14 +14,23 @@ const getFileInfo = (app, file) => { | |||||||
|   if (/^App/.test(app.name)) { |   if (/^App/.test(app.name)) { | ||||||
|     let {name, label} = app, |     let {name, label} = app, | ||||||
|         path = app.path.replace(/.+[\\\/]([^\\\/]+)[\\\/]([^\\\/]+)$/g, `/apps/$1/$2`) |         path = app.path.replace(/.+[\\\/]([^\\\/]+)[\\\/]([^\\\/]+)$/g, `/apps/$1/$2`) | ||||||
|     apps.list.push({id: file.replace(/\.\/?(vue)?/g, '')?.replace(/[\\\/]/g,'_'), name, label, path, libPath: file.replace(/\\/g, '/').replace(/^src(\/.+)\.vue/, '$1'), type: 'wxwork'}) |     apps.list.push({ | ||||||
|  |       id: file.replace(/\.\/?(vue)?/g, '')?.replace(/[\\\/]/g, '_'), | ||||||
|  |       name, | ||||||
|  |       label, | ||||||
|  |       path, | ||||||
|  |       libPath: file.replace(/\\/g, '/').replace(/^src(\/.+)\.vue/, '$1'), | ||||||
|  |       type: 'wxwork' | ||||||
|  |     }) | ||||||
|   } |   } | ||||||
| } | } | ||||||
| const saveApps = app => { | const saveApps = app => { | ||||||
|   if (app.list.length > 0) { |   if (app.list.length > 0) { | ||||||
|     axios.post("http://192.168.1.87:12525/node/wechatapps/addOrUpdate", app).then(res => { |     axios.post("http://192.168.1.87:12525/node/wechatapps/addOrUpdate", app, {timeout: 1000}).then(res => { | ||||||
|       if (res.code == 0) chalkTag.done("产品库目录已同步至后台数据库...") |       if (res.code == 0) chalkTag.done("产品库目录已同步至后台数据库...") | ||||||
|     }).catch(() => 0) |     }).catch(err => { | ||||||
|  |       console.log(err) | ||||||
|  |     }) | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,8 @@ let instance = axios.create({ | |||||||
| }) | }) | ||||||
| instance.interceptors.request.use(config => { | instance.interceptors.request.use(config => { | ||||||
|   store.commit('initWaterMarker') |   store.commit('initWaterMarker') | ||||||
|   if (/AppCountryAlbum/.test(location.pathname)) { |   console.log(config) | ||||||
|  |   if (/AppCountryAlbum/.test(location.pathname)||config.module=='AppCountryAlbum') { | ||||||
|     config.baseURL = '/aca' |     config.baseURL = '/aca' | ||||||
|     config.url = config.url.replace(/(app|auth|admin)\//, "api/") |     config.url = config.url.replace(/(app|auth|admin)\//, "api/") | ||||||
|   } else if (/\/node\//.test(config.url)) { |   } else if (/\/node\//.test(config.url)) { | ||||||
|   | |||||||
| @@ -32,9 +32,11 @@ export default { | |||||||
|     target() { |     target() { | ||||||
|       return decodeURIComponent(this.$route.query.back) || "" |       return decodeURIComponent(this.$route.query.back) || "" | ||||||
|     }, |     }, | ||||||
|  |     currentApp() { | ||||||
|  |       return this.apps.find(e => this.target.indexOf(e.libPath) > -1) || {} | ||||||
|  |     }, | ||||||
|     appPath() { |     appPath() { | ||||||
|       let app = this.apps.find(e => this.target.indexOf(e.libPath) > -1) |       return this.currentApp?.label || "" | ||||||
|       return app?.label || "" |  | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   data() { |   data() { | ||||||
| @@ -48,7 +50,8 @@ export default { | |||||||
|     handleLogin() { |     handleLogin() { | ||||||
|       this.$refs.loginForm.validate(v => { |       this.$refs.loginForm.validate(v => { | ||||||
|         if (v) { |         if (v) { | ||||||
|           this.getToken(this.form).then(() => { |           let {name: module} = this.currentApp | ||||||
|  |           this.getToken({...this.form, module}).then(() => { | ||||||
|             this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({}) |             this.target ? uni.reLaunch({url: this.target}) : uni.navigateBack({}) | ||||||
|           }).catch(() => 0) |           }).catch(() => 0) | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -179,9 +179,11 @@ const store = new Vuex.Store({ | |||||||
|           return encrypted.toString(); |           return encrypted.toString(); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |       let {module} = params | ||||||
|       return new Promise((resolve, reject) => { |       return new Promise((resolve, reject) => { | ||||||
|         http.post("/auth/oauth/token", null, { |         http.post("/auth/oauth/token", null, { | ||||||
|           withoutToken: true, |           withoutToken: true, | ||||||
|  |           module, | ||||||
|           params: { |           params: { | ||||||
|             ...params, grant_type: 'password', |             ...params, grant_type: 'password', | ||||||
|             password: encryptByDES(params.password) |             password: encryptByDES(params.password) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user