feat: 蓝星登录
This commit is contained in:
@@ -237,6 +237,18 @@ export function getPermissionInfo() {
|
||||
method: 'GET'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取token
|
||||
export function socialLogin(token) {
|
||||
return request({
|
||||
url: '/admin-api/system/auth/social-login',
|
||||
method: 'post',
|
||||
token,
|
||||
header: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
})
|
||||
}
|
||||
// 账号注销
|
||||
export function accountCancel(token) {
|
||||
return request({
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</view>
|
||||
<u-button size="mini" v-if="disabled" class="jnpf-file-disabled">{{buttonText}}</u-button>
|
||||
<view v-for='(item,index) in fileList' :key="index" class="jnpf-file-item u-type-primary u-flex u-line-1"
|
||||
@tap='downLoad(item)'>
|
||||
@click.stop='downLoad(item)'>
|
||||
<view class="jnpf-file-item-txt u-line-1" v-if="item.fileSize">
|
||||
<!-- {{item.name+'('+`${jnpf.toFileSize(item.fileSize)}`+' )'}} -->
|
||||
{{item.name}}
|
||||
@@ -208,20 +208,23 @@
|
||||
this.$forceUpdate();
|
||||
},
|
||||
downLoad(item) {
|
||||
if (item.fileExtension && imgTypeList.includes(item.fileExtension)) return this.previewImage(item)
|
||||
const {fileUrl} = item
|
||||
window.location.href = fileUrl
|
||||
// if (item.fileExtension && imgTypeList.includes(item.fileExtension)) return this.previewImage(item)
|
||||
// #ifdef MP
|
||||
this.previewFile(item)
|
||||
// this.previewFile(item)
|
||||
|
||||
// #endif
|
||||
// #ifndef MP
|
||||
getDownloadUrl('annex', item.fileId).then(res => {
|
||||
const fileUrl = this.baseURL + res.data.url + '&name=' + item.name;
|
||||
// getDownloadUrl('annex', item.fileId).then(res => {
|
||||
// const fileUrl = this.baseURL + res.data.url + '&name=' + item.name;
|
||||
// #ifdef H5
|
||||
window.location.href = fileUrl;
|
||||
// window.location.href = fileUrl;
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
this.downloadFile(res.data.url);
|
||||
// this.downloadFile(res.data.url);
|
||||
// #endif
|
||||
})
|
||||
// })
|
||||
// #endif
|
||||
},
|
||||
// 移除某个文件
|
||||
|
||||
@@ -298,7 +298,6 @@
|
||||
} from '@/api/apply/visualDev'
|
||||
import UserSelect from '@/components/Jnpf/CandidateSelect'
|
||||
import {getOrganizeSelector} from '@/api/common.js'
|
||||
import flowBtn from '../../workFlow/components/flowBtn.vue'
|
||||
export default {
|
||||
components: {
|
||||
CustomButton,
|
||||
@@ -332,7 +331,7 @@
|
||||
isAdd: false,
|
||||
showMoreMenu: false,
|
||||
moreMenuList: [],
|
||||
lc_fire_operation_detail: [],
|
||||
createData: {}, // 初始值
|
||||
deptList: [],
|
||||
showProcessDialog: false,
|
||||
processList: [],
|
||||
@@ -774,7 +773,7 @@
|
||||
this.approvalSubmitting = false
|
||||
}
|
||||
},
|
||||
|
||||
// 获取布局和初始值
|
||||
async getDesForm() {
|
||||
try {
|
||||
const res = await getDesForm(this.config.modelId);
|
||||
@@ -782,8 +781,9 @@
|
||||
const data = res.data ? JSON.parse(res.data) : {};
|
||||
this.formConf = JSON.parse(data.formData);
|
||||
console.log(this.formConf,'formConf--')
|
||||
console.log(data,'data--111')
|
||||
this.formConf.labelWidth = 160;
|
||||
this.lc_fire_operation_detail = data?.lc_fire_operation_detail || [];
|
||||
this.createData = data
|
||||
await this.getDeptList();
|
||||
await this.fillFormData(this.formConf, this.formData);
|
||||
this.showPage = true;
|
||||
@@ -894,11 +894,12 @@
|
||||
await this.getApprovalData();
|
||||
this.initMoreMenuList()
|
||||
} else {
|
||||
console.log(this.formData,'formData111')
|
||||
const {user,deptInfoList} = this.userInfo
|
||||
this.isAdd = true;
|
||||
this.formData = {
|
||||
...this.formData,
|
||||
lc_fire_operation_detail: this.lc_fire_operation_detail,
|
||||
...this.createData,
|
||||
applyDepId: deptInfoList ? String(deptInfoList[0].deptId) : '' ,
|
||||
applyDepName: deptInfoList && deptInfoList[0].deptName,
|
||||
applyUser: user.nickname
|
||||
@@ -1042,6 +1043,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
if(vModel == 'applyUser') {
|
||||
this.$set(item, 'disabled', true);
|
||||
}
|
||||
if (vModel) {
|
||||
let val = data.hasOwnProperty(vModel) ? data[vModel] : config.defaultValue;
|
||||
if (!config.isSubTable) config.defaultValue = val;
|
||||
|
||||
@@ -193,8 +193,9 @@
|
||||
if (!isAccept) return this.$u.toast(`请上传图片`)
|
||||
// #endif
|
||||
let tempFilePaths = res.tempFilePaths[0]
|
||||
console.log(this.baseURL,'baseURL---')
|
||||
uni.uploadFile({
|
||||
url: this.baseURL + 'userAvatar',
|
||||
url: this.baseURL + '/admin-api/infra/file/jeelowcode/upload',
|
||||
filePath: tempFilePaths,
|
||||
name: 'file',
|
||||
header: {
|
||||
@@ -202,14 +203,18 @@
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
let data = JSON.parse(uploadFileRes.data)
|
||||
if (data.code === 200) {
|
||||
UpdateAvatar(data.data.name).then(res => {
|
||||
this.$u.toast('头像更换成功')
|
||||
this.avatarSrc = this.baseURL2 + data.data.url
|
||||
})
|
||||
} else {
|
||||
this.$u.toast(data.msg)
|
||||
}
|
||||
console.log(data,'data-----')
|
||||
this.avatarSrc =data.data.fileUrl
|
||||
console.log(this.avatarSrc,'-this.avatarSrc')
|
||||
this.$u.toast('头像更换成功')
|
||||
// if (data.code === 0) {
|
||||
// UpdateAvatar(data.data.name).then(res => {
|
||||
// this.$u.toast('头像更换成功')
|
||||
// this.avatarSrc = this.baseURL2 + data.data.url
|
||||
// })
|
||||
// } else {
|
||||
// this.$u.toast(data.msg)
|
||||
// }
|
||||
},
|
||||
fail: (err) => {
|
||||
this.$u.toast('头像更换失败')
|
||||
|
||||
@@ -49,6 +49,9 @@
|
||||
<view class="remember-wrap">
|
||||
<u-checkbox v-model="remember"><span class="remember-text">记住账号密码</span></u-checkbox>
|
||||
</view>
|
||||
<view class="remember-wrap">
|
||||
<u-checkbox v-model="isCertify"><span class="remember-text">是否认证</span></u-checkbox>
|
||||
</view>
|
||||
<view class="loginBtnBox">
|
||||
<u-button @click="login" type="primary" :loading="loading">{{ loading ? "登录中...":"登录"}}
|
||||
</u-button>
|
||||
@@ -119,6 +122,7 @@
|
||||
<script>
|
||||
import {
|
||||
login,
|
||||
socialLogin,
|
||||
getPermissionInfo,
|
||||
getByName,
|
||||
getCallback,
|
||||
@@ -134,10 +138,12 @@
|
||||
useUserStore
|
||||
} from '@/store/modules/user'
|
||||
import logoImg from '@/static/logo.png'
|
||||
let unique = 0
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
remember: false,
|
||||
isCertify: false,
|
||||
logoImg,
|
||||
imgUrl: '',
|
||||
loading: false,
|
||||
@@ -508,7 +514,19 @@
|
||||
// jnpf_ticket: this.ssoTicket,
|
||||
// grant_type: 'password',
|
||||
// }
|
||||
let query = {
|
||||
if(this.isCertify){
|
||||
// 认证登录
|
||||
this.certifyLogin()
|
||||
}else {
|
||||
this.getLogin()
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
// 普通登录
|
||||
getLogin(){
|
||||
let query = {
|
||||
tenantName: this.formData.tenantName,
|
||||
username: this.formData.username,
|
||||
password: this.formData.password,
|
||||
@@ -555,8 +573,53 @@
|
||||
this.changeCode()
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
// 认证登录
|
||||
certifyLogin(){
|
||||
lx.biz.getAuthCode({
|
||||
appId: "8889088-16130048", // AppID
|
||||
success: (res) => {
|
||||
console.log('免登授权码:', res.authCode)
|
||||
this.exchangeToken(res.authCode)
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('获取免登授权码失败:', err)
|
||||
uni.showToast({
|
||||
title: '免登失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
async exchangeToken(authCode) {
|
||||
try {
|
||||
const type = '110'
|
||||
const code = authCode
|
||||
const state = this.uuid()
|
||||
const res = await socialLogin(type, code, state)
|
||||
|
||||
const userStore = useUserStore()
|
||||
// 存储Token和用户信息
|
||||
userStore.setToken(res)
|
||||
uni.switchTab({
|
||||
url: '/pages/index/indexWork'
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('换取Token失败:', err)
|
||||
uni.showToast({
|
||||
title: '登录失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
uuid() {
|
||||
const time = Date.now()
|
||||
const random = Math.floor(Math.random() * 1000000000)
|
||||
unique++
|
||||
return 'qrcode_' + random + unique + String(time)
|
||||
},
|
||||
ssoLogin() {
|
||||
getTicket().then(res => {
|
||||
|
||||
@@ -21,7 +21,7 @@ const define = {
|
||||
report,
|
||||
pcURL,
|
||||
webSocketUrl,
|
||||
comUploadUrl: baseURL + '/api/file/Uploader/',
|
||||
comUploadUrl: baseURL,
|
||||
timeout: 1000000,
|
||||
aMapWebKey: '',
|
||||
cipherKey: 'EY8WePvjM5GGwQzn', // 加密key
|
||||
|
||||
Reference in New Issue
Block a user