Commit b45a5d92 authored by liuzhaoh's avatar liuzhaoh

解决main.js文件的冲突

parents 465f2219 f1047d6a
...@@ -5,9 +5,11 @@ import { router } from './router' ...@@ -5,9 +5,11 @@ import { router } from './router'
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue' import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { createPinia } from 'pinia'
const app = createApp(App) const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) { for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component) app.component(key, component)
} }
app.use(router).use(ElementPlus).mount('#app') app.use(router).use(ElementPlus).use(createPinia()).mount('#app')
//创娃store很简单,调用pinia中的definestore函数即可,该函数族收两个参数:
import {defineStore} from 'pinia'
import user from './user'
console.log(user.actions)
//第一个参敬是应用程序中store的唯一id,就是给数据仓库起个名字
//第二个参数是一个对象,store的配置项,比如配置store内的嫩据,修改数据的方法等等
export const useUsersStore = defineStore('user',{
//其他配置项
//这里的state与vue2中用来存放初始化变量的data的写法相似,需要return
state: user.state,
actions: user.actions,
})
import { defineStore } from 'pinia'
import { getToken, removeToken, setToken } from '@/utils/auth'
import { getInfo, findPcMenu, getLogin, getWeather, login, logout, getFunctionList, captchaLoginFun } from '@/request/user.js'
//第一个参敬是应用程序中store的唯一id,就是给数据仓库起个名字
//第二个参数是一个对象,store的配置项,比如配置store内的嫩据,修改数据的方法等等
export const useUsersStore = defineStore('user', {
//其他配置项
//这里的state与vue2中用来存放初始化变量的data的写法相似,需要return
state: () => {
return {
token: getToken('TOKEN'),
name: '',
avatar: '',
introduction: '',
rememberMe: '',
dataBranchFactoryId: '',
roles: [],
menuLimitsObj: {},
weather: null,
customerId: getToken('customerId'),
office: {},
istrue: false,
functionAuthority: getToken('FUNC_AUTHORITY') ? JSON.parse(getToken('FUNC_AUTHORITY')) : '',
}
},
actions: {
login(userInfo) {
debugger
const { account, password, rememberMe } = userInfo
return new Promise((resolve, reject) => {
login(JSON.stringify(userInfo)).then(response => {
if (response.code != 1 && response.msg != "密码已过期,请重置!") {
return reject(response)
}
const { data } = response
setToken('TOKEN', data)
setToken('rememberMe', rememberMe)
resolve(response)
}).catch(error => {
resolve(response)
})
})
},
captchaLogin(userInfo) {
const { account, password, rememberMe } = userInfo
return new Promise((resolve, reject) => {
captchaLoginFun(JSON.stringify(userInfo)).then(response => {
if (response.code != 1) {
return reject(response)
}
const { data } = response
setToken('TOKEN', data)
setToken('rememberMe', rememberMe)
resolve(response)
}).catch(error => {
resolve(response)
})
})
},
getFunctionList(customerId) {
return new Promise((resolve, reject) => {
getFunctionList(customerId).then(response => {
const { data } = response
let obj = {}
if (data && data.length) {
for (let item of data) {
obj[item.code] = item
}
}
this.functionAuthority = obj
setToken('FUNC_AUTHORITY', JSON.stringify(obj))
resolve(obj)
}).catch(error => {
reject(error)
})
})
},
},
})
import request from "./index.js";
export function login(data) {
return request({
url: '/user/login',
method: 'post',
data
})
}
export function captchaLoginFun(data) {
return request({
url: '/user/captchaLogin',
method: 'post',
data
})
}
export function getLogin() {
return request({
url: '/login',
method: 'get'
})
}
export function getInfo() {
return request({
url: '/system/permission?appCode=bme-pc-service&userId=1',
method: 'get'
})
}
export function findPcMenu(customerId) {
return request({
url:'/modelConfigController/findPcMenu?customerId=' + customerId,
method: 'get'
})
}
export function getWeather(customerId) {
return request({
url:'/system/weather?customerId=' + customerId,
method: 'get'
})
}
export function getFunctionList(customerId) {
return request({
url:'/system/function/listAllEnable?customerId=' + customerId + "&isEnable=" + true,
method: 'get'
})
}
export function logout() {
return request({
url:'/user/logout',
method: 'post'
})
}
export function upload(url, data) {
url.indexOf('admin') > -1 ? url = process.env.VUE_APP_BASE_API4 + url
: url = process.env.VUE_APP_BASE_API1 + url
return request({
url: url,
method: 'post',
data: data
})
}
export function exportFlie(url, data) {
url.indexOf('admin') > -1 ? url = process.env.VUE_APP_BASE_API4 + url
: url = process.env.VUE_APP_BASE_API1 + url
return request({
url: url,
headers: {
responseType: 'blob'
},
method: 'post',
data: data
})
}
<template> <template>
<div class="login-container" v-show="!token"> <div class="login-container">
<div class="login-container-title"> <div class="login-container-title">
<h1 class="title">超低排放管控治一体化管理平台</h1> <h1 class="title">DCTOM 除尘器智能管控治平台</h1>
</div> </div>
<el-form <el-form
v-if="loginShow" v-if="loginShow"
...@@ -17,112 +17,82 @@ ...@@ -17,112 +17,82 @@
<span>User login</span> <span>User login</span>
</div> </div>
<el-form-item prop="account"> <div class="gap-20">
<el-input <el-form-item prop="account">
ref="username"
v-model="loginOldForm.account"
placeholder="用户名 / User name"
name="username"
type="text"
tabindex="1"
@blur="handleAccountBlur"
@input="debounceAction"
autocomplete="on"
/>
</el-form-item>
<el-tooltip v-model="capsOldTooltip" content="Caps lock is On" placement="right" manual>
<el-form-item prop="password">
<el-input v-model="loginOldForm.password" show-password placeholder="密码 / Password" tabindex="1" />
</el-form-item>
</el-tooltip>
<el-form-item prop="captcha" v-if="!needPhoneCertificate">
<el-input
ref="captcha"
class="captcha"
v-model="loginOldForm.captcha"
placeholder="请输入验证码"
name="captcha"
type="text"
tabindex="1"
autocomplete="on"
/>
<img :src="verifyCode" @click="fetchVerifyCli" />
</el-form-item>
<el-checkbox-group v-model="loginOldForm.rememberMe">
<el-checkbox label="记住密码" value="" name="type" />
</el-checkbox-group>
<el-button :loading="oldloading" type="primary" @click.prevent="handleLoginNew" @keyup.enter="handleLoginNew">登录</el-button>
</el-form>
<el-form
v-else
ref="loginForm"
:model="loginForm"
:rules="loginRules"
class="login-form"
:validate-on-rule-change="false"
autocomplete="on"
label-position="left"
>
<div class="title-container">
<h3 class="title">用户登录</h3>
<span>User login</span>
</div>
<el-form-item prop="account">
<el-input
ref="username"
v-model="loginForm.account"
placeholder="用户名 / User name"
name="username"
:validate-event="false"
type="text"
tabindex="1"
autocomplete="off"
/>
</el-form-item>
<el-tooltip v-model="capsTooltip" content="Caps lock is On" placement="right" manual>
<el-form-item prop="password">
<el-input <el-input
v-model="loginForm.password" ref="username"
show-password v-model="loginOldForm.account"
:validate-event="false" placeholder="用户名 / User name"
autocomplete="new-password" name="username"
placeholder="密码 / Password" type="text"
tabindex="1" tabindex="1"
@blur="handleAccountBlur($event)"
@input="debounceAction"
autocomplete="on"
/> />
</el-form-item> </el-form-item>
</el-tooltip> </div>
<div class="gap-20">
<el-tooltip
v-model="capsOldTooltip"
content="Caps lock is On"
placement="right"
manual
>
<el-form-item prop="password">
<el-input
v-model="loginOldForm.password"
show-password
placeholder="密码 / Password"
tabindex="1"
/>
</el-form-item>
</el-tooltip>
</div>
<div class="gap-20 captcha-box" v-if="!needPhoneCertificate">
<el-form-item prop="captcha">
<div class="captcha-container" >
<div class="captcha-value">
<el-input
ref="captcha"
class="captcha"
v-model="loginOldForm.captcha"
placeholder="请输入验证码"
name="captcha"
type="text"
tabindex="1"
autocomplete="on"
/>
</div>
<img
class="captcha-img"
:src="verifyCode"
@click="fetchVerifyCli"
/>
</div>
</el-form-item>
</div>
<el-checkbox-group v-model="loginForm.rememberMe"> <el-checkbox v-model="loginOldForm.rememberMe" label="记住密码" size="large" />
<el-checkbox label="记住密码" name="type" />
</el-checkbox-group>
<el-button <el-button
class="login-btn" :loading="oldloading"
:loading="loading"
type="primary" type="primary"
@click.prevent="handleLoginBefore" @click.prevent="handleLoginNew"
@keyup.enter="handleLoginBefore" @keyup.enter="handleLoginNew"
>登录</el-button> >登录</el-button
>
</el-form> </el-form>
<el-dialog title="Or connect with" v-model="showDialog"> <el-dialog
Can not be simulated on local, so please combine you own business title="修改密码"
simulation! ! ! v-model="dialogChangePassword"
<br /> class="dialogChangePassword"
<br /> :close-on-click-modal="false"
<br /> width="33%"
<social-sign /> >
</el-dialog>
<el-dialog title="修改密码" v-model="dialogChangePassword" class="dialogChangePassword" :close-on-click-modal="false" width="33%">
<el-form <el-form
ref="ruleForm" ref="ruleForm"
label-position="right" label-position="right"
...@@ -136,20 +106,40 @@ ...@@ -136,20 +106,40 @@
<el-input v-model="ruleForm.currentPassword" /> <el-input v-model="ruleForm.currentPassword" />
</el-form-item> </el-form-item>
<el-form-item label="新密码:" prop="pass"> <el-form-item label="新密码:" prop="pass">
<el-input v-model="ruleForm.pass" show-password type="password" autocomplete="off" /> <el-input
v-model="ruleForm.pass"
show-password
type="password"
autocomplete="off"
/>
</el-form-item> </el-form-item>
<el-form-item label="确认密码:" prop="checkPass"> <el-form-item label="确认密码:" prop="checkPass">
<el-input v-model="ruleForm.checkPass" show-password type="password" autocomplete="off" /> <el-input
v-model="ruleForm.checkPass"
show-password
type="password"
autocomplete="off"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="monitoringmap-btn"> <div class="monitoringmap-btn">
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> <el-button type="primary" @click="submitForm('ruleForm')"
<el-button type="info" plain @click="resetForm('ruleForm')">重置</el-button> >保存</el-button
>
<el-button type="info" plain @click="resetForm('ruleForm')"
>重置</el-button
>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="手机验证" v-model="dialogPhoneCertificate" class="dialogChangePassword" :close-on-click-modal="false" width="33%"> <el-dialog
title="手机验证"
v-model="dialogPhoneCertificate"
class="dialogChangePassword"
:close-on-click-modal="false"
width="33%"
>
<el-form <el-form
ref="phoneForm" ref="phoneForm"
label-position="right" label-position="right"
...@@ -169,10 +159,14 @@ ...@@ -169,10 +159,14 @@
placeholder="请输入手机号码" placeholder="请输入手机号码"
@select="handleSelect" @select="handleSelect"
></el-autocomplete> ></el-autocomplete>
<el-button :disabled="captchaSendStatus" class="captcha-btn" @click.prevent="sendCaptchaCheck()"> <el-button
:disabled="captchaSendStatus"
class="captcha-btn"
@click.prevent="sendCaptchaCheck()"
>
{{ {{
"发送验证码" + "发送验证码" +
(captchaWaitTime > 0 ? "(" + captchaWaitTime + ")" : "") (captchaWaitTime > 0 ? "(" + captchaWaitTime + ")" : "")
}} }}
</el-button> </el-button>
</el-form-item> </el-form-item>
...@@ -198,12 +192,19 @@ ...@@ -198,12 +192,19 @@
type="primary" type="primary"
@click.prevent="handleLogin" @click.prevent="handleLogin"
@keyup.enter="handleLogin" @keyup.enter="handleLogin"
>进行验证</el-button> >进行验证</el-button
>
</div> </div>
</el-form> </el-form>
</el-dialog> </el-dialog>
<el-dialog title="绑定手机" v-model="dialogPhoneBind" class="dialogChangePassword" :close-on-click-modal="false" width="33%"> <el-dialog
title="绑定手机"
v-model="dialogPhoneBind"
class="dialogChangePassword"
:close-on-click-modal="false"
width="33%"
>
<el-form <el-form
ref="phoneBindForm" ref="phoneBindForm"
label-position="right" label-position="right"
...@@ -243,7 +244,8 @@ ...@@ -243,7 +244,8 @@
type="primary" type="primary"
@click.prevent="handleLoginBind" @click.prevent="handleLoginBind"
@keyup.enter="handleLoginBind" @keyup.enter="handleLoginBind"
>提交绑定</el-button> >提交绑定</el-button
>
</div> </div>
</el-form> </el-form>
</el-dialog> </el-dialog>
...@@ -251,169 +253,181 @@ ...@@ -251,169 +253,181 @@
</template> </template>
<script> <script>
// import SocialSign from "./components/SocialSignin"; import { useUsersStore } from "@/pinia/user.js";
// import { mapActions, mapState } from 'vuex' import { getToken, removeToken, setToken } from "@/utils/auth";
import { getToken, removeToken, setToken } from '@/utils/auth' import { getData, getDataFun, postData } from "@/request/method";
import { getData, getDataFun, postData } from '@/request/method' import { ElMessage } from "element-plus";
// import { Message } from 'element-ui' import { MD5 } from "crypto-js";
import { MD5 } from 'crypto-js';
export default { export default {
name: 'Login', name: "Login",
data() { data() {
const validateUsername = (rule, value, callback) => { const validateUsername = (rule, value, callback) => {
if (!value) { if (!value) {
callback(new Error('请输入正确的用户名')) callback(new Error("请输入正确的用户名"));
} else { } else {
callback() callback();
} }
} };
const validateOldPassword = (rule, value, callback) => { const validateOldPassword = (rule, value, callback) => {
if (!value) { if (!value) {
callback(new Error('请输入正确的密码')) callback(new Error("请输入正确的密码"));
} else { } else {
callback() callback();
} }
} };
const validatePassword = (rule, value, callback) => { const validatePassword = (rule, value, callback) => {
if (!value && this.loginForm.captcha == 'BME202288') { if (!value && this.loginForm.captcha == "BME202288") {
this.loginForm.captchaKey = 'BME_12_BME202288' this.loginForm.captchaKey = "BME_12_BME202288";
callback() callback();
} else if (!value) { } else if (!value) {
callback(new Error('请输入正确的密码')) callback(new Error("请输入正确的密码"));
} else { } else {
callback() callback();
} }
} };
const validatePhone = (rule, value, callback) => { const validatePhone = (rule, value, callback) => {
let reg = /^1[0-9]{10}$/ let reg = /^1[0-9]{10}$/;
reg.test(value) reg.test(value);
console.log(this.bindIphones)
let bindIphones = [] let bindIphones = [];
this.bindIphones.forEach(item => { this.bindIphones.forEach((item) => {
bindIphones.push(item.value) bindIphones.push(item.value);
}) });
if (!value && this.phoneForm.captcha == 'BME202288') { if (!value && this.phoneForm.captcha == "BME202288") {
this.phoneForm.captchaKey = 'BME_12_BME202288' this.phoneForm.captchaKey = "BME_12_BME202288";
callback() callback();
} else if (!reg.test(value)) { } else if (!reg.test(value)) {
callback(new Error('手机号码格式不正确')) callback(new Error("手机号码格式不正确"));
this.captchaSendStatus = true this.captchaSendStatus = true;
} else if (bindIphones && bindIphones.length > 0 && $.inArray(value, bindIphones) < 0) { } else if (
callback(new Error('该手机号码没有绑定过')) bindIphones &&
this.captchaSendStatus = true bindIphones.length > 0 &&
$.inArray(value, bindIphones) < 0
) {
callback(new Error("该手机号码没有绑定过"));
this.captchaSendStatus = true;
} else { } else {
callback() callback();
if (this.captchaWaitTime <= 0) { if (this.captchaWaitTime <= 0) {
this.captchaSendStatus = false this.captchaSendStatus = false;
} }
} }
} };
const validatePhone1 = (rule, value, callback) => { const validatePhone1 = (rule, value, callback) => {
let reg = /^1[0-9]{10}$/ let reg = /^1[0-9]{10}$/;
reg.test(value) reg.test(value);
if (!reg.test(value)) { if (!reg.test(value)) {
callback(new Error('手机号码格式不正确')) callback(new Error("手机号码格式不正确"));
} else { } else {
callback() callback();
} }
} };
const validatePhone2 = (rule, value, callback) => { const validatePhone2 = (rule, value, callback) => {
//debugger; //debugger;
let reg = /^1[0-9]{10}$/ let reg = /^1[0-9]{10}$/;
reg.test(value) reg.test(value);
if (!reg.test(value)) { if (!reg.test(value)) {
callback(new Error('手机号码格式不正确')) callback(new Error("手机号码格式不正确"));
} else if (value !== this.phoneBindForm.iphoneBind) { } else if (value !== this.phoneBindForm.iphoneBind) {
callback(new Error('两次输入手机号码不一致!')) callback(new Error("两次输入手机号码不一致!"));
} else { } else {
callback() callback();
} }
} };
const validateverification = (rule, value, callback) => { const validateverification = (rule, value, callback) => {
if (value.length < 4) { if (value.length < 4) {
callback(new Error('验证码不能少于4位')) callback(new Error("验证码不能少于4位"));
} else { } else {
callback() callback();
} }
} };
const checkAge = (rule, value, callback) => { const checkAge = (rule, value, callback) => {
if (!value) { if (!value) {
return callback(new Error('密码不能为空')) return callback(new Error("密码不能为空"));
} }
setTimeout(() => { setTimeout(() => {
callback() callback();
}, 1000) }, 1000);
} };
const validatePass = (rule, value, callback) => { const validatePass = (rule, value, callback) => {
if (value === '') { if (value === "") {
callback(new Error('请输入密码')) callback(new Error("请输入密码"));
} else { } else {
let regex = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[\~\!\@\#\$\%\^\&\*\(\)\[\]\{\}\\<\>\?\+])[a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)\[\]\{\}\ \<\>\?\+]{8,20}$/; let regex =
/^(?=.*\d)(?=.*[a-zA-Z])(?=.*[\~\!\@\#\$\%\^\&\*\(\)\[\]\{\}\\<\>\?\+])[a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)\[\]\{\}\ \<\>\?\+]{8,20}$/;
if (!regex.test(value)) { if (!regex.test(value)) {
callback( callback(
new Error( new Error(
"密码不符合规范,必须包含至少一个数字、英文字母、“~!@#$%^&*()<>”中的一个特殊字符" "密码不符合规范,必须包含至少一个数字、英文字母、“~!@#$%^&*()<>”中的一个特殊字符"
) )
); );
} else if (this.ruleForm.checkPass !== '') { } else if (this.ruleForm.checkPass !== "") {
this.$refs.ruleForm.validateField('checkPass') this.$refs.ruleForm.validateField("checkPass");
} }
callback() callback();
} }
} };
const validatePass2 = (rule, value, callback) => { const validatePass2 = (rule, value, callback) => {
if (value === '') { if (value === "") {
callback(new Error('请再次输入密码')) callback(new Error("请再次输入密码"));
} else if (value !== this.ruleForm.pass) { } else if (value !== this.ruleForm.pass) {
callback(new Error('两次输入密码不一致!')) callback(new Error("两次输入密码不一致!"));
} else { } else {
callback() callback();
} }
} };
return { return {
homePageAuth: 1, homePageAuth: 1,
capsOldTooltip: false, capsOldTooltip: false,
oldloading: false, oldloading: false,
loginShow: true, loginShow: true,
loginForm: { loginForm: {
appCode: '1', appCode: "1",
account: '', account: "",
password: '', password: "",
iphone: '', iphone: "",
captcha: '', captcha: "",
captchaKey: 'BME_12_BME202288', captchaKey: "BME_12_BME202288",
rememberMe: false rememberMe: false,
}, },
loginOldRules: { loginOldRules: {
account: [{ required: true, trigger: 'blur', validator: validateUsername }], account: [
password: [{ required: true, trigger: 'blur', validator: validateOldPassword }], { required: true, trigger: "blur", validator: validateUsername },
captcha: [{ required: true, trigger: 'blur', validator: validateverification }] ],
password: [
{ required: true, trigger: "blur", validator: validateOldPassword },
],
captcha: [
{ required: true, trigger: "blur", validator: validateverification },
],
}, },
captchaSendStatus: true, captchaSendStatus: true,
captchaWaitTime: 0, captchaWaitTime: 0,
verify: '/user/captcha?v=_' + new Date().valueOf(), verify: "/user/captcha?v=_" + new Date().valueOf(),
verifyCode: undefined, verifyCode: undefined,
loginRules: { loginRules: {
account: [{ required: true, trigger: 'blur', validator: validateUsername }], account: [
password: [{ required: true, trigger: 'blur', validator: validatePassword }] { required: true, trigger: "blur", validator: validateUsername },
],
password: [
{ required: true, trigger: "blur", validator: validatePassword },
],
}, },
rule: {}, rule: {},
passwordType: 'password', passwordType: "password",
capsTooltip: false, capsTooltip: false,
loading: false, loading: false,
showDialog: false,
redirect: undefined, redirect: undefined,
otherQuery: {}, otherQuery: {},
token: false, token: false,
dialogChangePassword: false, dialogChangePassword: false,
ruleForm: { ruleForm: {
pass: '', pass: "",
checkPass: '', checkPass: "",
currentPassword: '' currentPassword: "",
}, },
dialogPhoneCertificate: false, dialogPhoneCertificate: false,
needPhoneCertificate: true, needPhoneCertificate: true,
...@@ -421,156 +435,157 @@ export default { ...@@ -421,156 +435,157 @@ export default {
iphone: [ iphone: [
{ {
required: true, required: true,
trigger: ['blur', 'change'], trigger: ["blur", "change"],
validator: validatePhone validator: validatePhone,
} },
],
captcha: [
{ required: true, trigger: "blur", validator: validateverification },
], ],
captcha: [{ required: true, trigger: 'blur', validator: validateverification }]
}, },
phoneForm: { phoneForm: {
appCode: '1', appCode: "1",
account: '', account: "",
password: '', password: "",
iphone: '', iphone: "",
captcha: '', captcha: "",
captchaKey: 'BME_12_BME202288' captchaKey: "BME_12_BME202288",
}, },
bindIphones: [], bindIphones: [],
isVerify: false, isVerify: false,
rules: { rules: {
pass: [{ validator: validatePass, trigger: 'blur' }], pass: [{ validator: validatePass, trigger: "blur" }],
checkPass: [{ validator: validatePass2, trigger: 'blur' }], checkPass: [{ validator: validatePass2, trigger: "blur" }],
currentPassword: [{ validator: checkAge, trigger: 'blur' }] currentPassword: [{ validator: checkAge, trigger: "blur" }],
}, },
phoneBindForm: { phoneBindForm: {
account: '', account: "",
iphoneBind: '', iphoneBind: "",
iphoneBindRe: '' iphoneBindRe: "",
}, },
phoneBindFormRules: { phoneBindFormRules: {
iphoneBind: [ iphoneBind: [
{ {
required: true, required: true,
trigger: ['blur', 'change'], trigger: ["blur", "change"],
validator: validatePhone1 validator: validatePhone1,
} },
], ],
iphoneBindRe: [ iphoneBindRe: [
{ {
required: true, required: true,
trigger: ['blur', 'change'], trigger: ["blur", "change"],
validator: validatePhone2 validator: validatePhone2,
} },
] ],
}, },
loginOldForm: { loginOldForm: {
appCode: '1', appCode: "1",
account: '', account: "",
password: '', password: "",
captcha: '', captcha: "",
captchaKey: '', captchaKey: "",
rememberMe: false rememberMe: false,
}, },
dialogPhoneBind: false dialogPhoneBind: false,
} store: null,
}, };
computed: {
// ...mapState({
// name: state => state.user.name,
// rememberMe: state => state.user.rememberMe
// })
}, },
computed: {},
watch: { watch: {
$route: { $route: {
handler: function (route) { handler: function (route) {
console.log(route) const query = route.query;
const query = route.query
if (query) { if (query) {
this.redirect = query.redirect this.redirect = query.redirect;
this.otherQuery = this.getOtherQuery(query) this.otherQuery = this.getOtherQuery(query);
} }
}, },
immediate: true immediate: true,
} },
}, },
created() { created() {
// this.getAppCode(); this.store = useUsersStore();
console.log('-----------------------------------------') this.token = this.$route.query.token;
console.log('token11', this.$route.query.token)
this.token = this.$route.query.token
if (this.$route.query.token) { if (this.$route.query.token) {
this.nanjingLogin(this.$route.query.token) this.nanjingLogin(this.$route.query.token);
} else { } else {
this.fetchVerifyCli() this.fetchVerifyCli();
} }
this.loginForm = { this.loginForm = {
account: '', account: "",
password: '', password: "",
captcha: '', captcha: "",
rememberMe: false rememberMe: false,
} };
this.loginOldForm = { this.loginOldForm = {
account: '', account: "",
password: '', password: "",
captcha: '', captcha: "",
rememberMe: false rememberMe: false,
} };
}, },
mounted() { mounted() {
if (getToken('rememberMe') == 'true') { if (getToken("rememberMe") == "true") {
this.loginForm.account = getToken('account') this.loginForm.account = getToken("account");
this.loginForm.password = getToken('password') this.loginForm.password = getToken("password");
} else { } else {
this.loginForm.account = '' this.loginForm.account = "";
this.loginForm.password = '' this.loginForm.password = "";
} }
// this.fetchVerifyCli(); this.debounceAction = this.debounce(this.handleAccountInput, 100);
this.debounceAction = this.debounce(this.handleAccountInput, 100)
}, },
destroyed() { destroyed() {
// window.removeEventListener('storage', this.afterQRScan) // window.removeEventListener('storage', this.afterQRScan)
}, },
methods: { methods: {
codeEnter(flag) { codeEnter(flag) {
var _self = this var _self = this;
document.onkeydown = function (e) { document.onkeydown = function (e) {
if (window.event == undefined) { if (window.event == undefined) {
var key = e.keyCode var key = e.keyCode;
} else { } else {
var key = window.event.keyCode var key = window.event.keyCode;
} }
if (key == 13) { if (key == 13) {
if (flag) { if (flag) {
_self.handleOldLogin() _self.handleOldLogin();
} else { } else {
_self.handleLoginBefore() _self.handleLoginBefore();
} }
} }
} };
}, },
/** /**
* 账号焦点变化,判断登录验证方式 * 账号焦点变化,判断登录验证方式
*/ */
handleAccountBlur(event) { handleAccountBlur(event) {
getData('/config/simpleLoginConfig?appCode=bme-pc-service&account=' + event.currentTarget.value, true).then(result => { getData(
this.needPhoneCertificate = !result.data "/config/simpleLoginConfig?appCode=bme-pc-service&account=" +
this.isVerify = true (event.currentTarget.value || event.target.value),
}) true
).then((result) => {
this.needPhoneCertificate = !result.data;
this.isVerify = true;
});
}, },
handleAccountInput(value) { handleAccountInput(value) {
getData('/config/simpleLoginConfig?appCode=bme-pc-service&account=' + value, true).then(result => { getData(
this.needPhoneCertificate = !result.data "/config/simpleLoginConfig?appCode=bme-pc-service&account=" + value,
this.isVerify = true true
}) ).then((result) => {
this.needPhoneCertificate = !result.data;
this.isVerify = true;
});
}, },
// 防抖工具函数 // 防抖工具函数
debounce(fn, theTime) { debounce(fn, theTime) {
return function () { return function () {
clearTimeout(fn.timer) clearTimeout(fn.timer);
fn.timer = setTimeout(() => { fn.timer = setTimeout(() => {
fn.call(this, ...arguments) fn.call(this, ...arguments);
}, theTime) }, theTime);
} };
}, },
/** /**
* @Description: 获取登录校验 * @Description: 获取登录校验
...@@ -579,126 +594,139 @@ export default { ...@@ -579,126 +594,139 @@ export default {
* @return boolean; * @return boolean;
*/ */
async getAppCode() { async getAppCode() {
let appCode = false let appCode = false;
await getData('/user/captchaLoginConfig?appCode=bme-pc-service') await getData("/user/captchaLoginConfig?appCode=bme-pc-service")
.then(res => { .then((res) => {
if (res.code == 1) { if (res.code == 1) {
setToken('appCode', res.data) setToken("appCode", res.data);
appCode = res.data appCode = res.data;
this.loginShow = res.data this.loginShow = res.data;
this.codeEnter(res.data) this.codeEnter(res.data);
} else { } else {
setToken('appCode', false) setToken("appCode", false);
appCode = false appCode = false;
// Message.warning('登录方式判断接口异常') // ElMessage .warning('登录方式判断接口异常')
this.codeEnter(false) this.codeEnter(false);
} }
}) })
.catch(() => { .catch(() => {
setToken('appCode', false) setToken("appCode", false);
// Message.warning('登录方式判断接口报错') // ElMessage .warning('登录方式判断接口报错')
this.codeEnter(false) this.codeEnter(false);
}) });
}, },
handleLoginBind() { handleLoginBind() {
this.$refs.phoneBindForm.validate(valid => { this.$refs.phoneBindForm.validate((valid) => {
if (valid) { if (valid) {
postData(this.$api.user.updateAccountIphone, { postData("/user/updateAccountIphone", {
account: this.phoneBindForm.account, account: this.phoneBindForm.account,
iphone: this.phoneBindForm.iphoneBindRe iphone: this.phoneBindForm.iphoneBindRe,
}).then(res => { }).then((res) => {
console.log(res.data)
if (res.code == 1) { if (res.code == 1) {
this.$message({ this.$message({
type: 'success', type: "success",
message: '绑定成功!' message: "绑定成功!",
}) });
this.dialogPhoneBind = false this.dialogPhoneBind = false;
} }
}) });
} }
}) });
}, },
querySearchIphone(queryString, cb) { querySearchIphone(queryString, cb) {
var bindIphones = this.bindIphones var bindIphones = this.bindIphones;
var results = queryString ? bindIphones.filter(this.createFilter(queryString)) : bindIphones var results = queryString
? bindIphones.filter(this.createFilter(queryString))
: bindIphones;
// 调用 callback 返回建议列表的数据 // 调用 callback 返回建议列表的数据
cb(results) cb(results);
}, },
createFilter(queryString) { createFilter(queryString) {
return bindIphone => { return (bindIphone) => {
return bindIphone.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0 return (
} bindIphone.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
0
);
};
}, },
handleSelect(item) { handleSelect(item) {
console.log(item) console.log(item);
}, },
submitForm(formName) { submitForm(formName) {
//debugger; //debugger;
this.$refs[formName].validate(valid => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
const obj = { const obj = {
oldPassword: MD5(this.ruleForm.currentPassword + "`1qazx").toString() , oldPassword: MD5(
this.ruleForm.currentPassword + "`1qazx"
).toString(),
newPassword: MD5(this.ruleForm.pass + "`1qazx").toString(), newPassword: MD5(this.ruleForm.pass + "`1qazx").toString(),
confirmPassword: MD5(this.ruleForm.checkPass+ "`1qazx").toString() confirmPassword: MD5(this.ruleForm.checkPass + "`1qazx").toString(),
} };
if (!this.needPhoneCertificate) { if (!this.needPhoneCertificate) {
obj.appCode = 'bme-pc-service' obj.appCode = "bme-pc-service";
} }
postData(this.$api.user.changePassword, obj).then(res => { postData("/management/savePassword", obj).then((res) => {
if (res.code == 1) { if (res.code == 1) {
this.$message({ this.$message({
type: 'success', type: "success",
message: '密码修改成功' message: "密码修改成功",
}) });
this.dialogChangePassword = false this.dialogChangePassword = false;
this.captchaSendStatus = false this.captchaSendStatus = false;
this.captchaWaitTime = 0 this.captchaWaitTime = 0;
this.phoneForm = { this.phoneForm = {
appCode: '1', appCode: "1",
account: '', account: "",
password: '', password: "",
iphone: '', iphone: "",
captcha: '', captcha: "",
captchaKey: 'BME_12_BME202288' captchaKey: "BME_12_BME202288",
} };
} }
}) });
} else { } else {
console.log('error submit!!') console.log("error submit!!");
return false return false;
} }
}) });
}, },
resetForm(formName) { resetForm(formName) {
this.$refs[formName].resetFields() this.$refs[formName].resetFields();
}, },
sendCaptcha() { sendCaptcha() {
getData('/user/sendSMS?iphone=' + this.phoneForm.iphone + '&account=' + this.loginForm.account + '&appCode=bme-pc-service', true) getData(
.then(result => { "/user/sendSMS?iphone=" +
this.phoneForm.iphone +
"&account=" +
this.loginForm.account +
"&appCode=bme-pc-service",
true
)
.then((result) => {
if (result.data && result.data.captchaKey) { if (result.data && result.data.captchaKey) {
this.phoneForm.captchaKey = result.data.captchaKey this.phoneForm.captchaKey = result.data.captchaKey;
} else { } else {
console.log('error fetch verify code!!') console.log("error fetch verify code!!");
} }
}) })
.catch(e => { .catch((e) => {
console.log('error fetch verify code!!' + e) console.log("error fetch verify code!!" + e);
}) });
}, },
calcuCaptchaWaitTime() { calcuCaptchaWaitTime() {
if (this.captchaWaitTime > 0) { if (this.captchaWaitTime > 0) {
this.captchaWaitTime = this.captchaWaitTime - 1 this.captchaWaitTime = this.captchaWaitTime - 1;
if (this.calcuTimer) { if (this.calcuTimer) {
clearTimeout(this.calcuTimer) clearTimeout(this.calcuTimer);
} }
this.calcuTimer = setTimeout(() => { this.calcuTimer = setTimeout(() => {
this.calcuCaptchaWaitTime() this.calcuCaptchaWaitTime();
}, 1000) }, 1000);
} else { } else {
this.captchaSendStatus = false this.captchaSendStatus = false;
this.captchaWaitTime = 0 this.captchaWaitTime = 0;
this.$forceUpdate() this.$forceUpdate();
} }
}, },
sendCaptchaCheck() { sendCaptchaCheck() {
...@@ -727,176 +755,180 @@ export default { ...@@ -727,176 +755,180 @@ export default {
.catch((e) => { .catch((e) => {
console.log("error fetch verify code!!" + e); console.log("error fetch verify code!!" + e);
});*/ });*/
this.captchaSendStatus = true this.captchaSendStatus = true;
this.captchaWaitTime = 60 this.captchaWaitTime = 60;
this.$forceUpdate() this.$forceUpdate();
this.calcuCaptchaWaitTime() this.calcuCaptchaWaitTime();
this.sendCaptcha() this.sendCaptcha();
}, },
checkCapslock(e) { checkCapslock(e) {
const { key } = e const { key } = e;
this.capsTooltip = key && key.length === 1 && key >= 'A' && key <= 'Z' this.capsTooltip = key && key.length === 1 && key >= "A" && key <= "Z";
}, },
verifyCli() { verifyCli() {
this.verify = '/user/captcha?v=_' + new Date().valueOf() this.verify = "/user/captcha?v=_" + new Date().valueOf();
}, },
fetchVerifyCli() { fetchVerifyCli() {
getData('/user/captcha?v=_' + new Date().valueOf(), true) getData("/user/captcha?v=_" + new Date().valueOf(), true)
.then(result => { .then((result) => {
const { captchaKey, base64Img } = result.data const { captchaKey, base64Img } = result.data;
this.verifyCode = base64Img this.verifyCode = base64Img;
this.loginOldForm.captchaKey = captchaKey this.loginOldForm.captchaKey = captchaKey;
})
.catch(e => {
console.log('error fetch verify code!!' + e)
}) })
.catch((e) => {
console.log("error fetch verify code!!" + e);
});
}, },
handleLoginBefore() { handleLoginBefore() {
if (this.loginForm.password == 'BME202288') { if (this.loginForm.password == "BME202288") {
this.phoneForm.account = this.loginForm.account this.phoneForm.account = this.loginForm.account;
this.phoneForm.password = '' this.phoneForm.password = "";
this.dialogPhoneCertificate = true this.dialogPhoneCertificate = true;
} else { } else {
getData( getData(
'/user/existIphone?account=' + "/user/existIphone?account=" +
this.loginForm.account + this.loginForm.account +
'&password=' + "&password=" +
encodeURIComponent(MD5(this.loginForm.password + "`1qazx").toString()) + encodeURIComponent(
'&appCode=bme-pc-service', MD5(this.loginForm.password + "`1qazx").toString()
) +
"&appCode=bme-pc-service",
true true
).then(result => { ).then((result) => {
console.log(result.data) console.log(result.data);
if (result.code == 1 && result.data && result.data.length > 0) { if (result.code == 1 && result.data && result.data.length > 0) {
this.phoneForm.account = this.loginForm.account this.phoneForm.account = this.loginForm.account;
this.phoneForm.password = this.loginForm.password this.phoneForm.password = this.loginForm.password;
this.dialogPhoneCertificate = true this.dialogPhoneCertificate = true;
this.bindIphones = [] this.bindIphones = [];
result.data.forEach(element => { result.data.forEach((element) => {
this.bindIphones.push({ value: element }) this.bindIphones.push({ value: element });
}) });
} else if (result.code == 9001 && result.msg == '手机号和账户绑定关系不存在,请重新输入!') { } else if (
//this.phoneBindForm.account = this.loginForm.account; result.code == 9001 &&
//this.dialogPhoneBind = true; result.msg == "手机号和账户绑定关系不存在,请重新输入!"
this.phoneForm.account = this.loginForm.account ) {
this.phoneForm.password = this.loginForm.password this.phoneForm.account = this.loginForm.account;
this.dialogPhoneCertificate = true this.phoneForm.password = this.loginForm.password;
this.bindIphones = [] this.dialogPhoneCertificate = true;
this.bindIphones = [];
} }
}) });
} }
}, },
handleLogin() { handleLogin() {
this.$refs.phoneForm.validate(valid => { this.$refs.phoneForm.validate((valid) => {
if (valid) { if (valid) {
this.loading = true this.loading = true;
this.phoneForm.appCode = 'bme-pc-service' this.phoneForm.appCode = "bme-pc-service";
let bindIphones = [] let bindIphones = [];
this.bindIphones.forEach(item => { this.bindIphones.forEach((item) => {
bindIphones.push(item.value) bindIphones.push(item.value);
}) });
const phoneFormOrigin = {...this.phoneForm}; const phoneFormOrigin = { ...this.phoneForm };
phoneFormOrigin.password = MD5(this.phoneForm.password + "`1qazx").toString() phoneFormOrigin.password = MD5(
this.$store this.phoneForm.password + "`1qazx"
.dispatch('user/login', phoneFormOrigin) ).toString();
.then(data => { this.store
if ($.inArray(this.phoneForm.iphone, bindIphones) < 0 && this.phoneForm.captcha != 'BME202288') { .login(phoneFormOrigin)
postData(this.$api.user.updateAccountIphone, { .then((data) => {
if (
$.inArray(this.phoneForm.iphone, bindIphones) < 0 &&
this.phoneForm.captcha != "BME202288"
) {
postData("/user/updateAccountIphone", {
account: this.phoneForm.account, account: this.phoneForm.account,
iphone: this.phoneForm.iphone iphone: this.phoneForm.iphone,
}).then(res => { }).then((res) => {
console.log(res.data) console.log(res.data);
if (res.code == 1) { if (res.code == 1) {
this.getProfile(data) this.getProfile(data);
} }
}) });
} else { } else {
this.getProfile(data) this.getProfile(data);
} }
}) })
.catch(data => { .catch((data) => {
if (data.code === 9003) { if (data.code === 9003) {
this.verifyCli() this.verifyCli();
} }
removeToken() removeToken();
this.loading = false this.loading = false;
}) });
} else { } else {
console.log('error submit!!') console.log("error submit!!");
return false return false;
} }
}) });
}, },
// 南京登录 // 南京登录
nanjingLogin(token) { nanjingLogin(token) {
setToken('TOKEN', token) setToken("TOKEN", token);
this.getProfile() this.getProfile();
}, },
getProfile(result) { getProfile(result) {
getData(this.$api.user.profile) getData("/system/user/profile")
.then(async data => { .then(async (data) => {
let customerName = data.data.customerName || '' let customerName = data.data.customerName || "";
let customerId = data.data.customerId let customerId = data.data.customerId;
setToken('customerName', customerName) setToken("customerName", customerName);
setToken('dataBranchFactoryId', data.data.dataBranchFactoryId) setToken("dataBranchFactoryId", data.data.dataBranchFactoryId);
setToken('customerId', customerId) setToken("customerId", customerId);
setToken('userId', data.data.id) setToken("userId", data.data.id);
sessionStorage.setItem('userId', data.data.id) sessionStorage.setItem("userId", data.data.id);
let homeFlag = await this.getPermissionData(data.data.id) let homeFlag = await this.getPermissionData(data.data.id);
this.$store.dispatch('user/setCustomerId', customerId) this.store.customerId = customerId;
this.$store.dispatch('user/setDataBranchFactoryId', data.data.dataBranchFactoryId) this.store.dataBranchFactoryId = data.data.dataBranchFactoryId;
this.$store.dispatch('user/setOffice', { this.store.office = {
officeId: data.data.officeId, officeId: data.data.officeId,
officeName: data.data.officeNameList officeName: data.data.officeNameList,
}) };
this.$store.dispatch('settings/changeSetting', false) this.store.istrue = false;
// 此接口是针对港陆闭环的,民营日照不需要调这个接口,暂时去掉 // 此接口是针对港陆闭环的,民营日照不需要调这个接口,暂时去掉
if (customerId != 35) { if (customerId != 35) {
this.$store.dispatch('user/getFunctionList', customerId) this.store.getFunctionList(customerId);
}
document.onkeydown = undefined;
if (
result &&
result.code == 9999 &&
result.msg == "密码已过期,请重置!"
) {
this.dialogChangePassword = true;
this.dialogPhoneCertificate = false;
this.dialogPhoneBind = false;
} }
document.onkeydown = undefined setToken("permissions", 0);
if (result && result.code == 9999 && result.msg == '密码已过期,请重置!') { if (homeFlag == 0) {
this.dialogChangePassword = true
this.dialogPhoneCertificate = false
this.dialogPhoneBind = false
} else if (data.data.ultralowBoard === 1) {
// 是否有抄底看板权限
setToken('permissions', 1)
this.$router.push({ this.$router.push({
path: '/superLowBillboard' path: "/newHome/homePage",
}) });
} else { } else {
setToken('permissions', 0) this.$router.push({
if (homeFlag == 0) { path: this.redirect || "/",
this.$router.push({ query: this.otherQuery,
path: '/newHome/homePage', });
})
} else {
this.$router.push({
path: this.redirect || '/',
query: this.otherQuery
})
}
} }
this.loading = false this.loading = false;
}) })
.catch(data => { .catch((data) => {
this.$store.dispatch('settings/changeSetting', false) this.store.istrue = false;
this.$router.push({ this.$router.push({
path: this.redirect || '/', path: this.redirect || "/",
query: this.otherQuery query: this.otherQuery,
}) });
this.loading = false this.loading = false;
}) });
}, },
getOtherQuery(query) { getOtherQuery(query) {
return Object.keys(query).reduce((acc, cur) => { return Object.keys(query).reduce((acc, cur) => {
if (cur !== 'redirect' && cur !== 'token') { if (cur !== "redirect" && cur !== "token") {
acc[cur] = query[cur] acc[cur] = query[cur];
} }
return acc return acc;
}, {}) }, {});
}, },
/** /**
* 判断图片验证还是手机号验证 * 判断图片验证还是手机号验证
...@@ -904,126 +936,138 @@ export default { ...@@ -904,126 +936,138 @@ export default {
async handleLoginNew() { async handleLoginNew() {
if (!this.isVerify) { if (!this.isVerify) {
// 处理谷歌浏览器自带默认值的情况,因为初始化时获取不到,所以这里特殊处理 // 处理谷歌浏览器自带默认值的情况,因为初始化时获取不到,所以这里特殊处理
await getData('/config/simpleLoginConfig?appCode=bme-pc-service&account=' + this.loginOldForm.account, true).then(result => { await getData(
this.needPhoneCertificate = !result.data "/config/simpleLoginConfig?appCode=bme-pc-service&account=" +
this.isVerify = true this.loginOldForm.account,
}) true
).then((result) => {
this.needPhoneCertificate = !result.data;
this.isVerify = true;
});
} }
if (this.needPhoneCertificate) { if (this.needPhoneCertificate) {
this.loginForm.account = this.loginOldForm.account this.loginForm.account = this.loginOldForm.account;
this.loginForm.password = this.loginOldForm.password this.loginForm.password = this.loginOldForm.password;
this.handleLoginBefore() this.handleLoginBefore();
} else { } else {
this.handleOldLogin() this.handleOldLogin();
} }
}, },
handleOldLogin() { handleOldLogin() {
this.$refs.loginOldForm.validate(valid => { this.$refs.loginOldForm.validate((valid) => {
if (valid) { if (valid) {
this.oldloading = true this.oldloading = true;
this.loginOldForm.appCode = 'bme-pc-service' this.loginOldForm.appCode = "bme-pc-service";
const loginOldFormOrigin = {...this.loginOldForm}; const loginOldFormOrigin = { ...this.loginOldForm };
loginOldFormOrigin.password = MD5(this.loginOldForm.password + "`1qazx").toString(); loginOldFormOrigin.password = MD5(
this.$store this.loginOldForm.password + "`1qazx"
.dispatch('user/captchaLogin', loginOldFormOrigin) ).toString();
this.store
.captchaLogin(loginOldFormOrigin)
.then(() => { .then(() => {
this.getOldProfile() console.log("登录成功");
this.getOldProfile();
}) })
.catch(data => { .catch((data) => {
this.oldloading = false this.oldloading = false;
if (data.code === 9003) { if (data.code === 9003) {
this.verifyCli() this.verifyCli();
} else if (data.code == 9999 && data.msg == '密码已过期,请重置!') { } else if (
setToken('TOKEN', data.data) data.code == 9999 &&
this.dialogChangePassword = true data.msg == "密码已过期,请重置!"
this.dialogPhoneCertificate = false ) {
this.dialogPhoneBind = false setToken("TOKEN", data.data);
this.dialogChangePassword = true;
this.dialogPhoneCertificate = false;
this.dialogPhoneBind = false;
} else { } else {
removeToken() removeToken();
this.oldloading = false this.oldloading = false;
} }
}) });
} else { } else {
console.log('error submit!!') console.log("error submit!!");
return false return false;
} }
}) });
}, },
getOldProfile() { getOldProfile() {
getData(this.$api.user.profile) getData("/system/user/profile")
.then(async data => { .then(async (data) => {
let customerName = data.data.customerName || '' let customerName = data.data.customerName || "";
let customerId = data.data.customerId let customerId = data.data.customerId;
setToken('customerName', customerName) setToken("customerName", customerName);
setToken('dataBranchFactoryId', data.data.dataBranchFactoryId) setToken("dataBranchFactoryId", data.data.dataBranchFactoryId);
setToken('customerId', customerId) setToken("customerId", customerId);
setToken('userId', data.data.id) setToken("userId", data.data.id);
sessionStorage.setItem('userId', data.data.id) sessionStorage.setItem("userId", data.data.id);
let homeFlag = await this.getPermissionData(data.data.id); let homeFlag = await this.getPermissionData(data.data.id);
this.$store.dispatch('user/setCustomerId', customerId) this.store.customerId = customerId;
this.$store.dispatch('user/setDataBranchFactoryId', data.data.dataBranchFactoryId) this.store.dataBranchFactoryId = data.data.dataBranchFactoryId;
this.$store.dispatch('user/setOffice', { this.store.office = {
officeId: data.data.officeId,
officeName: data.data.officeNameList,
};
this.store.office = {
officeId: data.data.officeId, officeId: data.data.officeId,
officeName: data.data.officeNameList officeName: data.data.officeNameList,
}) };
this.$store.dispatch('settings/changeSetting', false) this.store.istrue = false;
// 此接口是针对港陆闭环的,民营日照不需要调这个接口,暂时去掉 // 此接口是针对港陆闭环的,民营日照不需要调这个接口,暂时去掉
if (customerId != 35) { if (customerId != 35) {
this.$store.dispatch('user/getFunctionList', customerId) this.store.getFunctionList(customerId);
} }
document.onkeydown = undefined document.onkeydown = undefined;
if (data.data.ultralowBoard === 1) { setToken("permissions", 0);
// 是否有抄底看板权限 if (homeFlag == 0) {
setToken('permissions', 1)
this.$router.push({ this.$router.push({
path: '/superLowBillboard' path: "/newHome/homePage",
}) });
} else { } else {
setToken('permissions', 0) this.$router.push({
if (homeFlag == 0) { path: this.redirect || "/",
this.$router.push({ query: this.otherQuery,
path: '/newHome/homePage', });
})
} else {
this.$router.push({
path: this.redirect || '/',
query: this.otherQuery
})
}
} }
this.oldloading = false
this.oldloading = false;
}) })
.catch(data => { .catch((data) => {
this.$store.dispatch('settings/changeSetting', false) // this.store.dispatch("settings/changeSetting", false);
this.$router.push({ this.$router.push({
path: this.redirect || '/', path: this.redirect || "/",
query: this.otherQuery query: this.otherQuery,
}) });
this.oldloading = false this.oldloading = false;
}) });
}, },
getPermissionData(userId) { getPermissionData(userId) {
return new Promise((resolve)=>{ return new Promise((resolve) => {
const url = this.$api.user.getPowerData const url = "/management/admin/userDataPermission";
const params = { const params = {
userId userId,
} };
getDataFun(url, params).then(res => { getDataFun(url, params).then((res) => {
if (res && res.data) { if (res && res.data) {
sessionStorage.setItem('permissionData', JSON.stringify(res.data)) sessionStorage.setItem("permissionData", JSON.stringify(res.data));
sessionStorage.setItem('branchFactoryList', JSON.stringify(res.data.branchFactoryIdList)) sessionStorage.setItem(
sessionStorage.setItem('primaryTypeList', res.data.devicePrimaryTypeIdList); "branchFactoryList",
sessionStorage.setItem('pcProductDevice', res.data.pcProductDevice); JSON.stringify(res.data.branchFactoryIdList)
sessionStorage.setItem('homePageAuth', res.data.homePageAuth); );
resolve(res.data.homePageAuth); sessionStorage.setItem(
"primaryTypeList",
res.data.devicePrimaryTypeIdList
);
sessionStorage.setItem("pcProductDevice", res.data.pcProductDevice);
sessionStorage.setItem("homePageAuth", res.data.homePageAuth);
resolve(res.data.homePageAuth);
} }
}) });
}); });
} },
} },
} };
</script> </script>
<style lang="scss"> <style lang="scss">
...@@ -1063,11 +1107,14 @@ $cursor: #ccc; ...@@ -1063,11 +1107,14 @@ $cursor: #ccc;
} }
&:-webkit-autofill { &:-webkit-autofill {
box-shadow: 0 0 0px 1000px $bg inset !important; box-shadow: 0 0 0px 1000px #fff inset !important;
-webkit-text-fill-color: $cursor !important; -webkit-text-fill-color: $cursor !important;
} }
} }
} }
.el-input__wrapper {
width: 100%;
}
.captcha { .captcha {
input { input {
...@@ -1077,12 +1124,8 @@ $cursor: #ccc; ...@@ -1077,12 +1124,8 @@ $cursor: #ccc;
} }
.el-form-item { .el-form-item {
// border: 1px solid rgba(255, 255, 255, 0.1);
// background: rgba(0, 0, 0, 0.1);
// // border-radius: 5px;
// color: #454545;
border: none; border: none;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #fff;
background: #fff; background: #fff;
} }
} }
...@@ -1100,9 +1143,9 @@ $light_gray: #eee; ...@@ -1100,9 +1143,9 @@ $light_gray: #eee;
} }
.login-container { .login-container {
min-height: 100%; min-height: 100vh;
width: 100%; width: 100%;
background-image: url('../../assets/bg.jpg'); background-image: url("../../assets/bg.jpg");
background-size: cover; background-size: cover;
overflow: hidden; overflow: hidden;
...@@ -1123,6 +1166,7 @@ $light_gray: #eee; ...@@ -1123,6 +1166,7 @@ $light_gray: #eee;
position: absolute; position: absolute;
right: 14vw; right: 14vw;
top: 22%; top: 22%;
border-radius: 20px;
.el-checkbox-group label { .el-checkbox-group label {
margin-top: 20px; margin-top: 20px;
...@@ -1131,14 +1175,14 @@ $light_gray: #eee; ...@@ -1131,14 +1175,14 @@ $light_gray: #eee;
button { button {
width: 100%; width: 100%;
margin-top: 40px; margin-top: 40px;
background: #003b8f; background: #2182a0;
height: 40px; height: 40px;
} }
img { img {
position: absolute; // position: absolute;
top: 13px; // top: 13px;
right: 0; // right: 0;
cursor: pointer; cursor: pointer;
} }
} }
...@@ -1160,7 +1204,7 @@ $light_gray: #eee; ...@@ -1160,7 +1204,7 @@ $light_gray: #eee;
.login-btn { .login-btn {
width: 100%; width: 100%;
margin-top: 40px; margin-top: 40px;
background: #003b8f; background: #2182a0;
height: 40px; height: 40px;
} }
...@@ -1171,9 +1215,9 @@ $light_gray: #eee; ...@@ -1171,9 +1215,9 @@ $light_gray: #eee;
} }
img { img {
position: absolute; // position: absolute;
top: 13px; // top: 13px;
right: 0; // right: 0;
cursor: pointer; cursor: pointer;
} }
} }
...@@ -1204,7 +1248,7 @@ $light_gray: #eee; ...@@ -1204,7 +1248,7 @@ $light_gray: #eee;
.title { .title {
font-size: 26px; font-size: 26px;
display: inline-block; display: inline-block;
color: #003b8f; color: #2182a0;
} }
span { span {
...@@ -1225,4 +1269,26 @@ $light_gray: #eee; ...@@ -1225,4 +1269,26 @@ $light_gray: #eee;
} }
} }
} }
.gap-20 {
margin-top: 20px;
}
.captcha-box {
min-height: 50px;
.captcha-container {
width: 100%;
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
.captcha-value {
width: 60%;
}
.captcha-img {
width: 30%;
flex: 0;
height: auto;
margin-right: -20px;
}
}
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment