feat: 新增需求
This commit is contained in:
@@ -3,24 +3,30 @@
|
||||
<view class="login-bg">
|
||||
<image src="../../static/image/login-bg.jpg" mode="widthFix"></image>
|
||||
<view class="logoImg">
|
||||
<u-image :src="appIcon" mode="widthFix" :border-radius="20" width="160" height="160">
|
||||
<image src="../../static/image/logoT.png" mode="widthFix"></image>
|
||||
<!-- <u-image src="../../static/image/logo.png" mode="widthFix" :border-radius="20" width="160" height="160">
|
||||
<template #error>
|
||||
<u-image :src="logoImg" mode="widthFix" width="160" height="160">
|
||||
</u-image>
|
||||
</template>
|
||||
</u-image>
|
||||
</u-image> -->
|
||||
</view>
|
||||
<view class="login-version">
|
||||
<!-- <view class="login-version">
|
||||
<view class="login-version-text">{{sysConfigInfo.sysVersion || define.sysVersion}}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="logo-hd u-flex-col">
|
||||
<view class="loginSwitch u-flex-col">
|
||||
<view class="loginInputBox u-flex-col" v-show="!isSso && !ssoLoading">
|
||||
<u-form :model="formData" :rules="rules" ref="dataForm" :errorType="['toast']" label-position="left"
|
||||
label-width="150" label-align="left">
|
||||
<u-form-item prop="account" :borderBottom="false">
|
||||
<u-input input-align='left' v-model="formData.account" placeholder="请输入帐号" @focus="onFocus"
|
||||
<u-form-item v-show="false" prop="account" :borderBottom="false">
|
||||
<u-input input-align='left' v-model="formData.tenantName" placeholder="请输入租户名称" @focus="onFocus"
|
||||
@blur="onBlur" border border-color="#F0F1F3" placeholder-style="#9D9D9D">
|
||||
</u-input>
|
||||
</u-form-item>
|
||||
<u-form-item prop="username" :borderBottom="false">
|
||||
<u-input input-align='left' v-model="formData.username" placeholder="请输入帐号" @focus="onFocus"
|
||||
@blur="onBlur" border border-color="#F0F1F3" placeholder-style="#9D9D9D">
|
||||
</u-input>
|
||||
</u-form-item>
|
||||
@@ -107,13 +113,14 @@
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<view class="copyright" v-if="isKeyUp">{{copyright}}</view>
|
||||
<view class="copyright">{{copyright}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
login,
|
||||
getConfig,
|
||||
getPermissionInfo,
|
||||
getByName,
|
||||
getCallback,
|
||||
otherlogin,
|
||||
getLoginConfig,
|
||||
@@ -135,7 +142,8 @@
|
||||
imgUrl: '',
|
||||
loading: false,
|
||||
formData: {
|
||||
account: "",
|
||||
tenantName: "000000",
|
||||
username: "",
|
||||
password: "",
|
||||
code: "",
|
||||
origin: 'password'
|
||||
@@ -144,7 +152,7 @@
|
||||
codeLength: 4,
|
||||
isCode: false,
|
||||
rules: {
|
||||
account: [{
|
||||
username: [{
|
||||
required: true,
|
||||
message: '请输入账号',
|
||||
trigger: 'blur',
|
||||
@@ -158,7 +166,7 @@
|
||||
sysConfigInfo: {},
|
||||
appIcon: '',
|
||||
sysName: '',
|
||||
copyright: '',
|
||||
copyright: '综合监控系统',
|
||||
socialsList: [],
|
||||
show: false,
|
||||
tenantUserInfo: [],
|
||||
@@ -203,23 +211,25 @@
|
||||
}
|
||||
this.ssoTicket = uni.getStorageSync('ssoTicket')
|
||||
this.sysConfigInfo = uni.getStorageSync('sysConfigInfo')
|
||||
console.log(this.define,'define-------------')
|
||||
this.appIcon = !!this.sysConfigInfo.appIcon ? this.baseURL + this.sysConfigInfo.appIcon :
|
||||
logoImg
|
||||
this.sysName = !!this.sysConfigInfo.companyName ? this.sysConfigInfo.sysName :
|
||||
'JNPF快速开发平台'
|
||||
this.copyright = !!this.sysConfigInfo.copyright ? this.sysConfigInfo.copyright :
|
||||
this.define.copyright
|
||||
// this.copyright = !!this.sysConfigInfo.copyright ? this.sysConfigInfo.copyright :
|
||||
// this.define.copyright
|
||||
// this.copyright = !!this.sysConfigInfo.copyright && this.sysConfigInfo.copyright
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.sysName
|
||||
})
|
||||
let needCode = uni.getStorageSync('app_loginNeedCode')
|
||||
this.isCode = needCode
|
||||
this.changeCode()
|
||||
this.getLoginConfig()
|
||||
// this.getLoginConfig()
|
||||
this.formData.password = '';
|
||||
if (options.data) {
|
||||
this.tenantUserInfo = JSON.parse(options.data)
|
||||
if (this.tenantUserInfo) this.show = true
|
||||
// if (this.tenantUserInfo) this.show = true
|
||||
}
|
||||
this.initAccount()
|
||||
// #ifndef H5
|
||||
@@ -228,6 +238,8 @@
|
||||
return this.isKeyUp
|
||||
})
|
||||
// #endif
|
||||
|
||||
this.initLoginConfig()
|
||||
},
|
||||
methods: {
|
||||
initAccount() {
|
||||
@@ -279,7 +291,7 @@
|
||||
if (this.tenantUserInfo.length == 1) {
|
||||
this.loginHandel()
|
||||
} else {
|
||||
this.show = true
|
||||
// this.show = true
|
||||
}
|
||||
} else {
|
||||
this.show = false
|
||||
@@ -442,14 +454,37 @@
|
||||
this.ssoLoading = false
|
||||
})
|
||||
},
|
||||
getCodeConfig(val) {
|
||||
if (!val) return
|
||||
getConfig(val).then(res => {
|
||||
this.needCode = !!res.data.enableVerificationCode
|
||||
if (this.needCode) {
|
||||
this.codeLength = res.data.verificationCodeNumber || 4
|
||||
this.changeCode()
|
||||
}
|
||||
|
||||
initLoginConfig() {
|
||||
// 1. 强制关闭SSO登录,显示账号密码登录
|
||||
this.isSso = false
|
||||
// 2. 关闭SSO加载状态,让页面正常显示
|
||||
this.ssoLoading = false
|
||||
// 3. 可选:配置第三方登录列表(如果需要显示微信/QQ登录)
|
||||
// 如需显示第三方登录,取消下面注释并调整配置;不需要则留空数组
|
||||
this.socialsList = [
|
||||
// 示例:微信登录配置(根据实际项目的icon/class调整)
|
||||
// {
|
||||
// enname: 'wechat_open',
|
||||
// name: '微信登录',
|
||||
// icon: 'icon-ym icon-ym-wechat' // 替换成项目真实的微信图标类名
|
||||
// },
|
||||
// 示例:QQ登录配置
|
||||
// {
|
||||
// enname: 'qq',
|
||||
// name: 'QQ登录',
|
||||
// icon: 'icon-ym icon-ym-qq' // 替换成项目真实的QQ图标类名
|
||||
// }
|
||||
]
|
||||
// 4. 可选:SSO相关配置(用不到可以不赋值)
|
||||
this.preUrl = ''
|
||||
this.ticketParams = ''
|
||||
},
|
||||
getCodeConfig() {
|
||||
const userStore = useUserStore()
|
||||
getByName(this.formData.tenantName).then(res => {
|
||||
const data = res.data
|
||||
userStore.setTenantId(data)
|
||||
})
|
||||
},
|
||||
changeCode() {
|
||||
@@ -464,14 +499,20 @@
|
||||
this.loading = true
|
||||
const password = md5Libs.md5(this.formData.password);
|
||||
const encryptPassword = this.jnpf.aesEncryption.encrypt(password);
|
||||
// let query = {
|
||||
// account: this.formData.account,
|
||||
// password: encryptPassword,
|
||||
// timestamp: this.timestamp,
|
||||
// code: this.formData.code,
|
||||
// origin: this.formData.origin,
|
||||
// jnpf_ticket: this.ssoTicket,
|
||||
// grant_type: 'password',
|
||||
// }
|
||||
let query = {
|
||||
account: this.formData.account,
|
||||
password: encryptPassword,
|
||||
timestamp: this.timestamp,
|
||||
code: this.formData.code,
|
||||
origin: this.formData.origin,
|
||||
jnpf_ticket: this.ssoTicket,
|
||||
grant_type: 'password',
|
||||
tenantName: this.formData.tenantName,
|
||||
username: this.formData.username,
|
||||
password: this.formData.password,
|
||||
rememberMe : false
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
const clientId = plus.push.getClientInfo().clientid;
|
||||
@@ -480,19 +521,30 @@
|
||||
// query.Client_Id = uni.getStorageSync('cid')
|
||||
// #endif
|
||||
login(query).then(res => {
|
||||
let token = res.data.token
|
||||
let token = res.data.accessToken
|
||||
userStore.setToken(token)
|
||||
this.rememberAccount()
|
||||
setTimeout(()=>{
|
||||
userStore.getCurrentUser().then(res => {
|
||||
this.loading = false
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
if(res.code == 0){
|
||||
getPermissionInfo().then(res=>{
|
||||
if(res.code == 0){
|
||||
userStore.setUserInfo(res.data)
|
||||
uni.switchTab({
|
||||
url: '/pages/index/indexWork'
|
||||
});
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
},1000)
|
||||
}
|
||||
// setTimeout(()=>{
|
||||
// userStore.getCurrentUser().then(res => {
|
||||
// this.loading = false
|
||||
// uni.switchTab({
|
||||
// url: '/pages/index/index'
|
||||
// });
|
||||
// }).catch(() => {
|
||||
// this.loading = false
|
||||
// })
|
||||
// },1000)
|
||||
// getPermissionInfo
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
title: err,
|
||||
@@ -571,8 +623,8 @@
|
||||
}
|
||||
|
||||
.logoImg {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
width: 260rpx;
|
||||
height: 260rpx;
|
||||
margin: 0 auto;
|
||||
position: absolute;
|
||||
/* #ifdef APP-PLUS */
|
||||
|
||||
Reference in New Issue
Block a user