feat: 优化代码
This commit is contained in:
@@ -428,13 +428,13 @@
|
|||||||
},
|
},
|
||||||
// 是否显示底部按钮
|
// 是否显示底部按钮
|
||||||
isShowBtn(){
|
isShowBtn(){
|
||||||
const {approveStatus,id} = this.dataForm
|
const {approveStatus} = this.dataForm
|
||||||
const {config,isProcess} = this
|
const {config,isProcess} = this
|
||||||
|
if(config.current == 1 && approveStatus == 0) return false
|
||||||
|
if(config.current == 2) return true
|
||||||
|
if(config.current == 3 || config.current == 4) return false
|
||||||
if(!isProcess) return true
|
if(!isProcess) return true
|
||||||
console.log(approveStatus,'approveStatus--')
|
if(isProcess) return false
|
||||||
console.log(config.current,'config.current--')
|
|
||||||
if(approveStatus == 3 &&config.current ==3 ) return false
|
|
||||||
if(approveStatus !== 4 || !id || config.current && config.current == 2 ) return true
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1274,7 +1274,8 @@
|
|||||||
if (component.$options.name === 'jnpf-organize-select') {
|
if (component.$options.name === 'jnpf-organize-select') {
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
for (let child of component.$children) {
|
const children = component.$children || [];
|
||||||
|
for (let child of children) {
|
||||||
const res = findOrganizeSelect(child);
|
const res = findOrganizeSelect(child);
|
||||||
if (res) return res;
|
if (res) return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,7 +215,7 @@
|
|||||||
if(options.code){
|
if(options.code){
|
||||||
this.exchangeToken(options)
|
this.exchangeToken(options)
|
||||||
}else if(options.socialLogin){
|
}else if(options.socialLogin){
|
||||||
this.getLogin()
|
this.getLogin('creat')
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.certifyLogin()
|
this.certifyLogin()
|
||||||
@@ -523,7 +523,7 @@
|
|||||||
this.loading = true
|
this.loading = true
|
||||||
const password = md5Libs.md5(this.formData.password);
|
const password = md5Libs.md5(this.formData.password);
|
||||||
const encryptPassword = this.jnpf.aesEncryption.encrypt(password);
|
const encryptPassword = this.jnpf.aesEncryption.encrypt(password);
|
||||||
this.getLogin()
|
this.getLogin('click')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return
|
return
|
||||||
@@ -531,7 +531,8 @@
|
|||||||
this.certifyLogin()
|
this.certifyLogin()
|
||||||
},
|
},
|
||||||
// 普通登录
|
// 普通登录
|
||||||
getLogin(){
|
getLogin(type){
|
||||||
|
if(type !== 'click') return
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
let query = {
|
let query = {
|
||||||
tenantName: this.formData.tenantName,
|
tenantName: this.formData.tenantName,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ function request(config) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------- 核心调整:刷新token请求改为问号拼接参数 -------------
|
// ------------- 刷新token请求改为问号拼接参数 -------------
|
||||||
if (!refreshToken) {
|
if (!refreshToken) {
|
||||||
await handleAuthorized()
|
await handleAuthorized()
|
||||||
reject(res.data.msg)
|
reject(res.data.msg)
|
||||||
@@ -79,7 +79,7 @@ function request(config) {
|
|||||||
|
|
||||||
isRefreshingToken = true
|
isRefreshingToken = true
|
||||||
try {
|
try {
|
||||||
// 拼接URL参数:和PC端一致,POST方法 + ?refreshToken=xxx
|
// 拼接URL参数
|
||||||
const refreshUrl = `${host}/admin-api/system/auth/refresh-token?refreshToken=${encodeURIComponent(refreshToken)}`
|
const refreshUrl = `${host}/admin-api/system/auth/refresh-token?refreshToken=${encodeURIComponent(refreshToken)}`
|
||||||
// 调用刷新token接口(POST方法 + URL参数,无请求体)
|
// 调用刷新token接口(POST方法 + URL参数,无请求体)
|
||||||
const refreshRes = await uni.request({
|
const refreshRes = await uni.request({
|
||||||
@@ -91,15 +91,14 @@ function request(config) {
|
|||||||
},
|
},
|
||||||
data: {} // 无请求体,参数全在URL上
|
data: {} // 无请求体,参数全在URL上
|
||||||
})
|
})
|
||||||
|
|
||||||
// 刷新成功处理
|
// 刷新成功处理
|
||||||
if (refreshRes.statusCode === 200 && refreshRes.data.code === 200) {
|
if (refreshRes.data.code == 0) {
|
||||||
const newTokenData = refreshRes.data.data
|
const newTokenData = refreshRes.data.data
|
||||||
// 存储新token(建议用项目封装的setToken方法)
|
// 存储新token
|
||||||
uni.setStorageSync('token', newTokenData.token)
|
uni.setStorageSync('token', newTokenData.accessToken)
|
||||||
uni.setStorageSync('refreshToken', newTokenData.refreshToken)
|
uni.setStorageSync('refreshToken', newTokenData.refreshToken)
|
||||||
// 更新请求头
|
// 更新请求头
|
||||||
header['Authorization'] = newTokenData.token
|
header['Authorization'] = newTokenData.accessToken
|
||||||
// 重试当前请求
|
// 重试当前请求
|
||||||
coreRequest()
|
coreRequest()
|
||||||
// 执行队列请求
|
// 执行队列请求
|
||||||
|
|||||||
Reference in New Issue
Block a user