From 33ef7f5cdb6dc1e46ee33c2cd7494b7093699d48 Mon Sep 17 00:00:00 2001 From: mocheng <3057647414@qq.com> Date: Thu, 19 Jun 2025 16:48:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/config.js | 2 +- common/http.api.js | 5 +++- common/http.interceptor.js | 2 +- manifest.json | 1 + pages/sys/login/index.vue | 54 +++++++++++++++++++++----------------- vue.config.js | 34 ++++++++++++------------ 6 files changed, 54 insertions(+), 44 deletions(-) diff --git a/common/config.js b/common/config.js index 83f3f42..8a35c82 100644 --- a/common/config.js +++ b/common/config.js @@ -24,6 +24,6 @@ const config = { } // 设置后台接口服务的基础地址 -config.baseUrl = 'https://aidex.vip/api'; +config.baseUrl = 'http://192.168.0.104:8080'; export default config; \ No newline at end of file diff --git a/common/http.api.js b/common/http.api.js index cde0b6e..4aa590c 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -10,11 +10,14 @@ const install = (Vue, vm) => { // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 vm.$u.api = { + + login: (params = {}) => vm.$u.post(config.adminPath+'/auth/login', params), + // 基础服务:登录登出、身份信息、菜单授权、切换系统、字典数据等 lang: (params = {}) => vm.$u.get('/lang/'+params.lang), index: (params = {}) => vm.$u.get(config.adminPath+'/mobile/index', params), getUserInfo: (params = {}) => vm.$u.get(config.adminPath+'/mobile/user/getUserInfo', params), - login: (params = {}) => vm.$u.post(config.adminPath+'/mobile/login/loginByPassword', params), + // login: (params = {}) => vm.$u.post(config.adminPath+'/mobile/login/loginByPassword', params), sendCode: (params = {}) => vm.$u.post(config.adminPath+'/mobile/login/sendCode', params), registerUser: (params = {}) => vm.$u.post(config.adminPath+'/mobile/user/registerUser', params), //首页相关api diff --git a/common/http.interceptor.js b/common/http.interceptor.js index f1ff85e..1b0f8e9 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -14,7 +14,7 @@ const install = (Vue, vm) => { originalData: true, // 默认头部,http2约定header名称统一小写 aidex header: { - 'content-type': 'application/x-www-form-urlencoded', + 'content-type': 'application/json', 'x-requested-with': 'XMLHttpRequest' } }); diff --git a/manifest.json b/manifest.json index a43efd7..bb53a99 100644 --- a/manifest.json +++ b/manifest.json @@ -5,6 +5,7 @@ "versionName" : "1.8.4", "versionCode" : "100", "transformPx" : false, + "sassImplementationName": "node-sass", "app-plus" : { // APP-VUE分包,可提APP升启动速度,2.7.12开始支持,兼容微信小程序分包方案,默认关闭 "optimization" : { diff --git a/pages/sys/login/index.vue b/pages/sys/login/index.vue index 3049830..9096c42 100644 --- a/pages/sys/login/index.vue +++ b/pages/sys/login/index.vue @@ -93,8 +93,8 @@ export default { data() { return { phoneNo:'', - username: '', - password: '', + username: 'admin', + password: 'admin123', loginType: 'currentPhone', showPassword: false, remember: true, @@ -164,7 +164,7 @@ export default { } }); }, - submit(loginType) { + async submit(loginType) { if (this.username.length == 0) { this.$u.toast('请输入账号'); return; @@ -173,28 +173,34 @@ export default { this.$u.toast('请输入密码'); return; } - this.$u.api.login({ - username: this.username, - password: this.password, - validCode: this.validCode, - loginType: loginType - }) - .then(res => { - if(res.msg){ - this.$u.toast(res.msg); - } - if (res.code == '200') { - setTimeout(() => { - uni.reLaunch({ - url: '/pages/sys/msg/index' - }); - }, 500); - } - if (res.isValidCodeLogin){ - this.isValidCodeLogin = true; - this.refreshImgValidCode(); - } + // this.$u.api.login( + // { + // "tenantId": '000000', + // "username": this.username, + // "password": this.password, + // "grantType": "password", + // "uuid": "7cb3ea4fe2ae4f08bbd561c94ef0191b", + // "clientId": "dab457a1ea14411787c240db05bb0832" + // } + // ) + let res=await this.$u.api.login({ + "tenantId": "000000", // 把单引号换成双引号 + "username": this.username, + "password": this.password, + "grantType": "password", + "uuid": "7cb3ea4fe2ae4f08bbd561c94ef0191b", + "clientId": "dab457a1ea14411787c240db05bb0832" }); + console.log(res) + if (res.code=="200"){ + this.$u.toast("登录成功") + this.$u.access_token=res.data.access_token + setTimeout(() => { + uni.reLaunch({ + url: '/pages/sys/msg/index' + }); + }, 500); + } }, wxLogin(res) { this.$u.toast('微信登录'); diff --git a/vue.config.js b/vue.config.js index bf97f8d..d4472ca 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,20 +1,20 @@ /** * Copyright (c) 2013-Now http://aidex.vip All rights reserved. */ -// module.exports = { -// configureWebpack: { -// devServer: { -// port : 8080, -// disableHostCheck : true, -// proxy : { -// "/js" : { -// // target : "http://127.0.0.1:8980", -// target : "https://demo.aidex.vip", -// changeOrigin : true, -// secure : false -// } -// } -// } -// }, -// productionSourceMap: false, -// } +module.exports = { + configureWebpack: { + devServer: { + port : 8081, + disableHostCheck : true, + proxy : { + "/js" : { + target : "http://192.168.0.104:8080", + // target : "https://demo.aidex.vip", + changeOrigin : true, + secure : false + } + } + } + }, + productionSourceMap: false, +}