接入登录

This commit is contained in:
mocheng 2025-06-19 16:48:26 +08:00
parent 342c482c6c
commit 33ef7f5cdb
6 changed files with 54 additions and 44 deletions

View File

@ -24,6 +24,6 @@ const config = {
}
// 设置后台接口服务的基础地址
config.baseUrl = 'https://aidex.vip/api';
config.baseUrl = 'http://192.168.0.104:8080';
export default config;

View File

@ -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

View File

@ -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'
}
});

View File

@ -5,6 +5,7 @@
"versionName" : "1.8.4",
"versionCode" : "100",
"transformPx" : false,
"sassImplementationName": "node-sass",
"app-plus" : {
// APP-VUEAPP2.7.12
"optimization" : {

View File

@ -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') {
// 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);
}
if (res.isValidCodeLogin){
this.isValidCodeLogin = true;
this.refreshImgValidCode();
}
});
},
wxLogin(res) {
this.$u.toast('微信登录');

View File

@ -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",
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,
// }
changeOrigin : true,
secure : false
}
}
}
},
productionSourceMap: false,
}