接入登录

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; export default config;

View File

@ -10,11 +10,14 @@ const install = (Vue, vm) => {
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下 // 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = { vm.$u.api = {
login: (params = {}) => vm.$u.post(config.adminPath+'/auth/login', params),
// 基础服务:登录登出、身份信息、菜单授权、切换系统、字典数据等 // 基础服务:登录登出、身份信息、菜单授权、切换系统、字典数据等
lang: (params = {}) => vm.$u.get('/lang/'+params.lang), lang: (params = {}) => vm.$u.get('/lang/'+params.lang),
index: (params = {}) => vm.$u.get(config.adminPath+'/mobile/index', params), index: (params = {}) => vm.$u.get(config.adminPath+'/mobile/index', params),
getUserInfo: (params = {}) => vm.$u.get(config.adminPath+'/mobile/user/getUserInfo', 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), sendCode: (params = {}) => vm.$u.post(config.adminPath+'/mobile/login/sendCode', params),
registerUser: (params = {}) => vm.$u.post(config.adminPath+'/mobile/user/registerUser', params), registerUser: (params = {}) => vm.$u.post(config.adminPath+'/mobile/user/registerUser', params),
//首页相关api //首页相关api

View File

@ -14,7 +14,7 @@ const install = (Vue, vm) => {
originalData: true, originalData: true,
// 默认头部http2约定header名称统一小写 aidex // 默认头部http2约定header名称统一小写 aidex
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/json',
'x-requested-with': 'XMLHttpRequest' 'x-requested-with': 'XMLHttpRequest'
} }
}); });

View File

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

View File

@ -93,8 +93,8 @@ export default {
data() { data() {
return { return {
phoneNo:'', phoneNo:'',
username: '', username: 'admin',
password: '', password: 'admin123',
loginType: 'currentPhone', loginType: 'currentPhone',
showPassword: false, showPassword: false,
remember: true, remember: true,
@ -164,7 +164,7 @@ export default {
} }
}); });
}, },
submit(loginType) { async submit(loginType) {
if (this.username.length == 0) { if (this.username.length == 0) {
this.$u.toast('请输入账号'); this.$u.toast('请输入账号');
return; return;
@ -173,28 +173,34 @@ export default {
this.$u.toast('请输入密码'); this.$u.toast('请输入密码');
return; return;
} }
this.$u.api.login({ // this.$u.api.login(
username: this.username, // {
password: this.password, // "tenantId": '000000',
validCode: this.validCode, // "username": this.username,
loginType: loginType // "password": this.password,
}) // "grantType": "password",
.then(res => { // "uuid": "7cb3ea4fe2ae4f08bbd561c94ef0191b",
if(res.msg){ // "clientId": "dab457a1ea14411787c240db05bb0832"
this.$u.toast(res.msg); // }
} // )
if (res.code == '200') { 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(() => { setTimeout(() => {
uni.reLaunch({ uni.reLaunch({
url: '/pages/sys/msg/index' url: '/pages/sys/msg/index'
}); });
}, 500); }, 500);
} }
if (res.isValidCodeLogin){
this.isValidCodeLogin = true;
this.refreshImgValidCode();
}
});
}, },
wxLogin(res) { wxLogin(res) {
this.$u.toast('微信登录'); this.$u.toast('微信登录');

View File

@ -1,20 +1,20 @@
/** /**
* Copyright (c) 2013-Now http://aidex.vip All rights reserved. * Copyright (c) 2013-Now http://aidex.vip All rights reserved.
*/ */
// module.exports = { module.exports = {
// configureWebpack: { configureWebpack: {
// devServer: { devServer: {
// port : 8080, port : 8081,
// disableHostCheck : true, disableHostCheck : true,
// proxy : { proxy : {
// "/js" : { "/js" : {
// // target : "http://127.0.0.1:8980", target : "http://192.168.0.104:8080",
// target : "https://demo.aidex.vip", // target : "https://demo.aidex.vip",
// changeOrigin : true, changeOrigin : true,
// secure : false secure : false
// } }
// } }
// } }
// }, },
// productionSourceMap: false, productionSourceMap: false,
// } }