【fix ESLint】src/views/user

This commit is contained in:
danshihao
2023-03-06 17:12:08 +08:00
parent a6185c2b41
commit 17ee85b38f
3 changed files with 34 additions and 30 deletions
+24 -22
View File
@@ -29,7 +29,7 @@
autocomplete="false"
placeholder="请输入密码"
>
<a-icon title="显示密码" @click="passwordType='text'" slot="suffix" v-if="passwordType=='password'" type="eye" :style="{ color: '#B3B7C2',fontSize:'20px' }"/>
<a-icon title="显示密码" @click="passwordType='text'" slot="suffix" v-if="passwordType==='password'" type="eye" :style="{ color: '#B3B7C2',fontSize:'20px' }"/>
<a-icon title="隐藏密码" @click="passwordType='password'" slot="suffix" v-else type="eye-invisible" :style="{ color: '#B3B7C2',fontSize:'20px' }"/>
<a-icon slot="prefix" type="lock" :style="{ color: '#B3B7C2',fontSize:'20px' }"/>
</a-input>
@@ -37,7 +37,7 @@
</a-col>
<a-col :span="3"></a-col>
</a-row>
<a-row style="margin-bottom: 0%;">
<a-row style="margin-bottom: 0;">
<a-col :span="3"></a-col>
<a-col :span="12">
<a-form-item>
@@ -53,8 +53,8 @@
</a-form-item>
</a-col>
<a-col :span="6" style="text-align: right">
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
<img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode" alt=""/>
<img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode" alt=""/>
</a-col>
<a-col :span="3"></a-col>
</a-row>
@@ -138,8 +138,8 @@
</a-form-item>
</a-col>
<a-col :span="10" style="text-align: right">
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
<img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode" alt=""/>
<img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode" alt=""/>
</a-col>
</a-row>
<a-row>
@@ -181,12 +181,12 @@
import { mapActions } from 'vuex'
import { timeFix } from '@/utils/util'
import Vue from 'vue'
import { ACCESS_TOKEN, ENCRYPTED_STRING, USER_INFO } from '@/store/mutation-types'
import { putAction, postAction, getAction } from '@/api/manage'
import { ACCESS_TOKEN/* , ENCRYPTED_STRING, USER_INFO */ } from '@/store/mutation-types'
import { /* putAction, */ postAction, getAction } from '@/api/manage'
import { getRSAPublicKey } from '@/utils/encryption.js'
import { JSEncrypt } from 'jsencrypt'
const Base64 = require('js-base64').Base64
// const Base64 = require('js-base64').Base64
export default {
components: {},
@@ -255,7 +255,7 @@ export default {
loginParams.username = encrypt.encrypt(values.username)
loginParams.password = encrypt.encrypt(values.password)
// 登录
that.Login(loginParams).then((res) => {
that.Login(loginParams).then((/* res */) => {
this.loginSuccess()
}).catch((err) => {
if (err.code === 500) {
@@ -331,7 +331,7 @@ export default {
})
},
loginSuccess () {
this.$router.push({ path: '/' }).catch((res) => {})
this.$router.push({ path: '/' }).catch((/* res */) => {})
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`
@@ -356,13 +356,15 @@ export default {
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('您的手机号码格式不正确!')
}
},
validateInputCode (rule, value, callback) {
if (!value || this.verifiedCode == this.inputCodeContent) {
if (!value || this.verifiedCode === this.inputCodeContent) {
callback()
} else {
// eslint-disable-next-line standard/no-callback-literal
callback('您输入的验证码不正确!')
}
},
@@ -385,27 +387,27 @@ export default {
}
// 判断当前设备
function isMobile () {
var userAgentInfo = navigator.userAgent
const userAgentInfo = navigator.userAgent
var mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
var mobile_flag = false
let mobileFlag = false
// 根据userAgent判断是否是手机
for (var v = 0; v < mobileAgents.length; v++) {
for (let v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobile_flag = true
mobileFlag = true
break
}
}
var screen_width = window.screen.width
var screen_height = window.screen.height
const screenWidth = window.screen.width
const screenHeight = window.screen.height
// 根据屏幕分辨率判断是否是手机
if (screen_width < 500 && screen_height < 800) {
mobile_flag = true
if (screenWidth < 500 && screenHeight < 800) {
mobileFlag = true
}
return mobile_flag
return mobileFlag
}
</script>
@@ -16,10 +16,10 @@
<template slot="title">
<span>您有多个租户请选择登录租户</span>
</template>
<a-avatar style="backgroundColor:#87d068" icon="gold" />
<a-avatar style="background-color:#87d068" icon="gold" />
</a-tooltip>
<a-select @change="handleTenantChange" :class="{'valid-error':validate_status1=='error'}" placeholder="请选择登录租户" style="margin-left:10px;width: 80%">
<a-select @change="handleTenantChange" :class="{'valid-error':validate_status1==='error'}" placeholder="请选择登录租户" style="margin-left:10px;width: 80%">
<a-icon slot="suffixIcon" type="gold" />
<a-select-option v-for="d in tenantList" :key="d.id" :value="d.id">
{{ d.name }}
@@ -32,10 +32,10 @@
<template slot="title">
<span>您有多个部门,请选择登录部门</span>
</template>
<a-avatar style="backgroundColor:rgb(104, 208, 203);" icon="gold" />
<a-avatar style="background-color:rgb(104, 208, 203);" icon="gold" />
</a-tooltip>
<a-select @change="handleDepartChange" :class="{'valid-error':validate_status2=='error'}" placeholder="请选择登录部门" style="margin-left:10px;width: 80%">
<a-select @change="handleDepartChange" :class="{'valid-error':validate_status2==='error'}" placeholder="请选择登录部门" style="margin-left:10px;width: 80%">
<a-icon slot="suffixIcon" type="gold" />
<a-select-option v-for="d in departList" :key="d.id" :value="d.orgCode">
{{ d.departName }}
@@ -81,6 +81,7 @@ export default {
} else if (!this.isMultiDepart && this.isMultiTenant) {
return '请选择租户'
}
return ''
}
},
methods: {
@@ -92,16 +93,16 @@ export default {
this.validate_status2 = ''
},
bizDepart (loginResult) {
const multi_depart = loginResult.multi_depart
const multiDepart = loginResult.multi_depart + ''
// 0:无部门 1:一个部门 2:多个部门
if (multi_depart == 0) {
if (multiDepart === '0') {
this.$notification.warn({
message: '提示',
description: `您尚未归属部门,请确认账号信息`,
duration: 3
})
this.isMultiDepart = false
} else if (multi_depart == 2) {
} else if (multiDepart === '2') {
this.visible = true
this.isMultiDepart = true
this.departList = loginResult.departs
@@ -164,6 +165,7 @@ export default {
} else {
this.requestFailed(res)
this.$store.dispatch('Logout')
// eslint-disable-next-line prefer-promise-reject-errors
reject()
}
})
@@ -97,7 +97,7 @@ export const JeroThirdLoginMixin = {
thirdLoginUserCreate () {
this.thirdCreateUserLoding = true
// 账号名后面添加两位随机数
this.thirdLoginInfo.suffix = parseInt(Math.random() * 98 + 1)
this.thirdLoginInfo.suffix = parseInt((Math.random() * 98 + 1) + '')
// this.thirdLoginInfo.operateCode = 123 //测试校验失败
postAction('/sys/third/user/create', this.thirdLoginInfo).then(res => {
if (res.success) {