style: 修改代码格式

This commit is contained in:
zyn
2023-12-15 11:41:23 +08:00
parent 19a18489a8
commit 221e68134b
2 changed files with 34 additions and 25 deletions
+19 -19
View File
@@ -8,8 +8,8 @@ import hwh5 from '@/api/hwh5-cloudonline.js'
import { Message, MessageBox, Loading } from 'element-ui'
import { Dialog } from 'vant'
function getCode() {
let url = window.location.href
function getCode () {
const url = window.location.href
if (url && url !== '') {
if (url.split('code=').length > 1) {
return url.split('code=')[1]
@@ -17,7 +17,7 @@ function getCode() {
}
}
function toIdmLoginPage(url) {
function toIdmLoginPage (url) {
if (webLoginType === 'idm') {
let href = url
if (href.indexOf('localhost:9090' > -1)) {
@@ -29,7 +29,7 @@ function toIdmLoginPage(url) {
}
// 重新登录
function loginAgain() {
function loginAgain () {
store.dispatch('logout').then(() => {
if (webLoginType === 'idm') {
if (isMobile()) {
@@ -47,7 +47,7 @@ function loginAgain() {
}
// 退出登录
function loginOut() {
function loginOut () {
store.dispatch('logout').then(() => {
if (webLoginType === 'idm') {
window.location.href = ssoLogout + encodeURIComponent(window.location.origin)
@@ -59,14 +59,14 @@ function loginOut() {
}
// idm登录
function loginInIdm(code) {
function loginInIdm (code) {
return new Promise((resolve, reject) => {
let loading = Loading.service({
const loading = Loading.service({
lock: true,
text: '登录中...',
spinner: 'el-icon-loading'
})
let _formData = new FormData()
const _formData = new FormData()
_formData.append('code', code)
// 获取用户信息
loginIdm(_formData).then(res => {
@@ -89,9 +89,9 @@ function loginInIdm(code) {
}
// welink登录
function loginInPhone() {
return new Promise(async (resolve, reject) => {
let loading = Loading.service({
function loginInPhone () {
return new Promise( (resolve, reject) => {
const loading = Loading.service({
lock: true,
text: '登录中...',
spinner: 'el-icon-loading'
@@ -99,7 +99,7 @@ function loginInPhone() {
hwh5.getAuthCode().then(data => {
console.log('获取到了welinkCode', data)
if (data) {
let code = data.code
const code = data.code
getTokenToWeLink({
code: code,
name: encodeURIComponent('standards' + '-' + 'regulations'),
@@ -128,17 +128,17 @@ function loginInPhone() {
})
}
function loginNew(res) {
function loginNew (res) {
return new Promise((resolve, reject) => {
if (res.data.orgId === null || res.data.orgId === '') {
Message.warning('未分配组织机构,请联系管理员分配后重新登录')
return
}
let Base64 = require('js-base64').Base64
const Base64 = require('js-base64').Base64
// 解析用户信息
let userInfoStr = Base64.decode(res.data)
let userInfoJSON = decodeURIComponent(userInfoStr)
let userInfo = JSON.parse(userInfoJSON)
const userInfoStr = Base64.decode(res.data)
const userInfoJSON = decodeURIComponent(userInfoStr)
const userInfo = JSON.parse(userInfoJSON)
userInfo.userId = userInfo.usid
store.commit('setToken', userInfo.token)
store.commit('setUserInfo', JSON.stringify(userInfo))
@@ -167,7 +167,7 @@ function loginNew(res) {
})
}
function quit() {
function quit () {
Message.warning('系统无权限访问')
if (isMobile()) {
Dialog.confirm({
@@ -191,7 +191,7 @@ function quit() {
}
}
function close() {
function close () {
if (isMobile()) {
hwh5.close()
}