Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DC-TOM
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘照晖
DC-TOM
Commits
b45a5d92
Commit
b45a5d92
authored
May 19, 2025
by
liuzhaoh
Browse files
Options
Browse Files
Download
Plain Diff
解决main.js文件的冲突
parents
465f2219
f1047d6a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
820 additions
and
575 deletions
+820
-575
bg.jpg
src/assets/bg.jpg
+0
-0
main.js
src/main.js
+3
-1
index.js
src/pinia/index.js
+13
-0
user.js
src/pinia/user.js
+81
-0
user.js
src/request/user.js
+83
-0
index.vue
src/views/login/index.vue
+640
-574
No files found.
src/assets/bg.jpg
0 → 100644
View file @
b45a5d92
136 KB
src/main.js
View file @
b45a5d92
...
...
@@ -5,9 +5,11 @@ import { router } from './router'
import
ElementPlus
from
'element-plus'
import
'element-plus/dist/index.css'
import
*
as
ElementPlusIconsVue
from
'@element-plus/icons-vue'
import
{
createPinia
}
from
'pinia'
const
app
=
createApp
(
App
)
for
(
const
[
key
,
component
]
of
Object
.
entries
(
ElementPlusIconsVue
))
{
app
.
component
(
key
,
component
)
}
app
.
use
(
router
).
use
(
ElementPlus
).
mount
(
'#app'
)
app
.
use
(
router
).
use
(
ElementPlus
).
use
(
createPinia
()).
mount
(
'#app'
)
src/pinia/index.js
0 → 100644
View file @
b45a5d92
//创娃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
,
})
src/pinia/user.js
0 → 100644
View file @
b45a5d92
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
)
})
})
},
},
})
src/request/user.js
0 → 100644
View file @
b45a5d92
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
})
}
src/views/login/index.vue
View file @
b45a5d92
<
template
>
<div
class=
"login-container"
v-show=
"!token"
>
<div
class=
"login-container"
>
<div
class=
"login-container-title"
>
<h1
class=
"title"
>
超低排放管控治一体化管理
平台
</h1>
<h1
class=
"title"
>
DCTOM 除尘器智能管控治
平台
</h1>
</div>
<el-form
v-if=
"loginShow"
...
...
@@ -17,112 +17,82 @@
<span>
User login
</span>
</div>
<el-form-item
prop=
"account"
>
<el-input
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"
>
<div
class=
"gap-20"
>
<el-form-item
prop=
"account"
>
<el-input
v-model=
"loginForm.password
"
show-password
:validate-event=
"fals
e"
autocomplete=
"new-password
"
placeholder=
"密码 / Password
"
ref=
"username
"
v-model=
"loginOldForm.account"
placeholder=
"用户名 / User nam
e"
name=
"username
"
type=
"text
"
tabindex=
"1"
@
blur=
"handleAccountBlur($event)"
@
input=
"debounceAction"
autocomplete=
"on"
/>
</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
label=
"记住密码"
name=
"type"
/>
</el-checkbox-group>
<el-checkbox
v-model=
"loginOldForm.rememberMe"
label=
"记住密码"
size=
"large"
/>
<el-button
class=
"login-btn"
:loading=
"loading"
:loading=
"oldloading"
type=
"primary"
@
click
.
prevent=
"handleLoginBefore"
@
keyup
.
enter=
"handleLoginBefore"
>
登录
</el-button>
@
click
.
prevent=
"handleLoginNew"
@
keyup
.
enter=
"handleLoginNew"
>
登录
</el-button
>
</el-form>
<el-dialog
title=
"Or connect with"
v-model=
"showDialog"
>
Can not be simulated on local, so please combine you own business
simulation! ! !
<br
/>
<br
/>
<br
/>
<social-sign
/>
</el-dialog>
<el-dialog
title=
"修改密码"
v-model=
"dialogChangePassword"
class=
"dialogChangePassword"
:close-on-click-modal=
"false"
width=
"33%"
>
<el-dialog
title=
"修改密码"
v-model=
"dialogChangePassword"
class=
"dialogChangePassword"
:close-on-click-modal=
"false"
width=
"33%"
>
<el-form
ref=
"ruleForm"
label-position=
"right"
...
...
@@ -136,20 +106,40 @@
<el-input
v-model=
"ruleForm.currentPassword"
/>
</el-form-item>
<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
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>
<div
class=
"monitoringmap-btn"
>
<el-button
type=
"primary"
@
click=
"submitForm('ruleForm')"
>
保存
</el-button>
<el-button
type=
"info"
plain
@
click=
"resetForm('ruleForm')"
>
重置
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm('ruleForm')"
>
保存
</el-button
>
<el-button
type=
"info"
plain
@
click=
"resetForm('ruleForm')"
>
重置
</el-button
>
</div>
</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
ref=
"phoneForm"
label-position=
"right"
...
...
@@ -169,10 +159,14 @@
placeholder=
"请输入手机号码"
@
select=
"handleSelect"
></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-form-item>
...
...
@@ -198,12 +192,19 @@
type=
"primary"
@
click
.
prevent=
"handleLogin"
@
keyup
.
enter=
"handleLogin"
>
进行验证
</el-button>
>
进行验证
</el-button
>
</div>
</el-form>
</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
ref=
"phoneBindForm"
label-position=
"right"
...
...
@@ -243,7 +244,8 @@
type=
"primary"
@
click
.
prevent=
"handleLoginBind"
@
keyup
.
enter=
"handleLoginBind"
>
提交绑定
</el-button>
>
提交绑定
</el-button
>
</div>
</el-form>
</el-dialog>
...
...
@@ -251,169 +253,181 @@
</
template
>
<
script
>
// import SocialSign from "./components/SocialSignin";
// import { mapActions, mapState } from 'vuex'
import
{
getToken
,
removeToken
,
setToken
}
from
'@/utils/auth'
import
{
getData
,
getDataFun
,
postData
}
from
'@/request/method'
// import { Message } from 'element-ui'
import
{
MD5
}
from
'crypto-js'
;
import
{
useUsersStore
}
from
"@/pinia/user.js"
;
import
{
getToken
,
removeToken
,
setToken
}
from
"@/utils/auth"
;
import
{
getData
,
getDataFun
,
postData
}
from
"@/request/method"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
MD5
}
from
"crypto-js"
;
export
default
{
name
:
'Login'
,
name
:
"Login"
,
data
()
{
const
validateUsername
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
callback
(
new
Error
(
'请输入正确的用户名'
))
callback
(
new
Error
(
"请输入正确的用户名"
));
}
else
{
callback
()
callback
()
;
}
}
}
;
const
validateOldPassword
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
callback
(
new
Error
(
'请输入正确的密码'
))
callback
(
new
Error
(
"请输入正确的密码"
));
}
else
{
callback
()
callback
()
;
}
}
}
;
const
validatePassword
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
&&
this
.
loginForm
.
captcha
==
'BME202288'
)
{
this
.
loginForm
.
captchaKey
=
'BME_12_BME202288'
callback
()
if
(
!
value
&&
this
.
loginForm
.
captcha
==
"BME202288"
)
{
this
.
loginForm
.
captchaKey
=
"BME_12_BME202288"
;
callback
()
;
}
else
if
(
!
value
)
{
callback
(
new
Error
(
'请输入正确的密码'
))
callback
(
new
Error
(
"请输入正确的密码"
));
}
else
{
callback
()
callback
()
;
}
}
}
;
const
validatePhone
=
(
rule
,
value
,
callback
)
=>
{
let
reg
=
/^1
[
0-9
]{10}
$/
reg
.
test
(
value
)
console
.
log
(
this
.
bindIphones
)
let
reg
=
/^1
[
0-9
]{10}
$/
;
reg
.
test
(
value
);
let
bindIphones
=
[]
this
.
bindIphones
.
forEach
(
item
=>
{
bindIphones
.
push
(
item
.
value
)
})
let
bindIphones
=
[]
;
this
.
bindIphones
.
forEach
(
(
item
)
=>
{
bindIphones
.
push
(
item
.
value
)
;
})
;
if
(
!
value
&&
this
.
phoneForm
.
captcha
==
'BME202288'
)
{
this
.
phoneForm
.
captchaKey
=
'BME_12_BME202288'
callback
()
if
(
!
value
&&
this
.
phoneForm
.
captcha
==
"BME202288"
)
{
this
.
phoneForm
.
captchaKey
=
"BME_12_BME202288"
;
callback
()
;
}
else
if
(
!
reg
.
test
(
value
))
{
callback
(
new
Error
(
'手机号码格式不正确'
))
this
.
captchaSendStatus
=
true
}
else
if
(
bindIphones
&&
bindIphones
.
length
>
0
&&
$
.
inArray
(
value
,
bindIphones
)
<
0
)
{
callback
(
new
Error
(
'该手机号码没有绑定过'
))
this
.
captchaSendStatus
=
true
callback
(
new
Error
(
"手机号码格式不正确"
));
this
.
captchaSendStatus
=
true
;
}
else
if
(
bindIphones
&&
bindIphones
.
length
>
0
&&
$
.
inArray
(
value
,
bindIphones
)
<
0
)
{
callback
(
new
Error
(
"该手机号码没有绑定过"
));
this
.
captchaSendStatus
=
true
;
}
else
{
callback
()
callback
()
;
if
(
this
.
captchaWaitTime
<=
0
)
{
this
.
captchaSendStatus
=
false
this
.
captchaSendStatus
=
false
;
}
}
}
}
;
const
validatePhone1
=
(
rule
,
value
,
callback
)
=>
{
let
reg
=
/^1
[
0-9
]{10}
$/
reg
.
test
(
value
)
let
reg
=
/^1
[
0-9
]{10}
$/
;
reg
.
test
(
value
)
;
if
(
!
reg
.
test
(
value
))
{
callback
(
new
Error
(
'手机号码格式不正确'
))
callback
(
new
Error
(
"手机号码格式不正确"
));
}
else
{
callback
()
callback
()
;
}
}
}
;
const
validatePhone2
=
(
rule
,
value
,
callback
)
=>
{
//debugger;
let
reg
=
/^1
[
0-9
]{10}
$/
reg
.
test
(
value
)
let
reg
=
/^1
[
0-9
]{10}
$/
;
reg
.
test
(
value
)
;
if
(
!
reg
.
test
(
value
))
{
callback
(
new
Error
(
'手机号码格式不正确'
))
callback
(
new
Error
(
"手机号码格式不正确"
));
}
else
if
(
value
!==
this
.
phoneBindForm
.
iphoneBind
)
{
callback
(
new
Error
(
'两次输入手机号码不一致!'
))
callback
(
new
Error
(
"两次输入手机号码不一致!"
));
}
else
{
callback
()
callback
()
;
}
}
}
;
const
validateverification
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
.
length
<
4
)
{
callback
(
new
Error
(
'验证码不能少于4位'
))
callback
(
new
Error
(
"验证码不能少于4位"
));
}
else
{
callback
()
callback
()
;
}
}
}
;
const
checkAge
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
return
callback
(
new
Error
(
'密码不能为空'
))
return
callback
(
new
Error
(
"密码不能为空"
));
}
setTimeout
(()
=>
{
callback
()
},
1000
)
}
callback
()
;
},
1000
)
;
}
;
const
validatePass
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'请输入密码'
))
if
(
value
===
""
)
{
callback
(
new
Error
(
"请输入密码"
));
}
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
))
{
callback
(
new
Error
(
"密码不符合规范,必须包含至少一个数字、英文字母、“~!@#$%^&*()<>”中的一个特殊字符"
)
);
}
else
if
(
this
.
ruleForm
.
checkPass
!==
''
)
{
this
.
$refs
.
ruleForm
.
validateField
(
'checkPass'
)
}
else
if
(
this
.
ruleForm
.
checkPass
!==
""
)
{
this
.
$refs
.
ruleForm
.
validateField
(
"checkPass"
);
}
callback
()
callback
()
;
}
}
}
;
const
validatePass2
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'请再次输入密码'
))
if
(
value
===
""
)
{
callback
(
new
Error
(
"请再次输入密码"
));
}
else
if
(
value
!==
this
.
ruleForm
.
pass
)
{
callback
(
new
Error
(
'两次输入密码不一致!'
))
callback
(
new
Error
(
"两次输入密码不一致!"
));
}
else
{
callback
()
callback
()
;
}
}
}
;
return
{
homePageAuth
:
1
,
capsOldTooltip
:
false
,
oldloading
:
false
,
loginShow
:
true
,
loginForm
:
{
appCode
:
'1'
,
account
:
''
,
password
:
''
,
iphone
:
''
,
captcha
:
''
,
captchaKey
:
'BME_12_BME202288'
,
rememberMe
:
false
appCode
:
"1"
,
account
:
""
,
password
:
""
,
iphone
:
""
,
captcha
:
""
,
captchaKey
:
"BME_12_BME202288"
,
rememberMe
:
false
,
},
loginOldRules
:
{
account
:
[{
required
:
true
,
trigger
:
'blur'
,
validator
:
validateUsername
}],
password
:
[{
required
:
true
,
trigger
:
'blur'
,
validator
:
validateOldPassword
}],
captcha
:
[{
required
:
true
,
trigger
:
'blur'
,
validator
:
validateverification
}]
account
:
[
{
required
:
true
,
trigger
:
"blur"
,
validator
:
validateUsername
},
],
password
:
[
{
required
:
true
,
trigger
:
"blur"
,
validator
:
validateOldPassword
},
],
captcha
:
[
{
required
:
true
,
trigger
:
"blur"
,
validator
:
validateverification
},
],
},
captchaSendStatus
:
true
,
captchaWaitTime
:
0
,
verify
:
'/user/captcha?v=_'
+
new
Date
().
valueOf
(),
verify
:
"/user/captcha?v=_"
+
new
Date
().
valueOf
(),
verifyCode
:
undefined
,
loginRules
:
{
account
:
[{
required
:
true
,
trigger
:
'blur'
,
validator
:
validateUsername
}],
password
:
[{
required
:
true
,
trigger
:
'blur'
,
validator
:
validatePassword
}]
account
:
[
{
required
:
true
,
trigger
:
"blur"
,
validator
:
validateUsername
},
],
password
:
[
{
required
:
true
,
trigger
:
"blur"
,
validator
:
validatePassword
},
],
},
rule
:
{},
passwordType
:
'password'
,
passwordType
:
"password"
,
capsTooltip
:
false
,
loading
:
false
,
showDialog
:
false
,
redirect
:
undefined
,
otherQuery
:
{},
token
:
false
,
dialogChangePassword
:
false
,
ruleForm
:
{
pass
:
''
,
checkPass
:
''
,
currentPassword
:
''
pass
:
""
,
checkPass
:
""
,
currentPassword
:
""
,
},
dialogPhoneCertificate
:
false
,
needPhoneCertificate
:
true
,
...
...
@@ -421,156 +435,157 @@ export default {
iphone
:
[
{
required
:
true
,
trigger
:
[
'blur'
,
'change'
],
validator
:
validatePhone
}
trigger
:
[
"blur"
,
"change"
],
validator
:
validatePhone
,
},
],
captcha
:
[
{
required
:
true
,
trigger
:
"blur"
,
validator
:
validateverification
},
],
captcha
:
[{
required
:
true
,
trigger
:
'blur'
,
validator
:
validateverification
}]
},
phoneForm
:
{
appCode
:
'1'
,
account
:
''
,
password
:
''
,
iphone
:
''
,
captcha
:
''
,
captchaKey
:
'BME_12_BME202288'
appCode
:
"1"
,
account
:
""
,
password
:
""
,
iphone
:
""
,
captcha
:
""
,
captchaKey
:
"BME_12_BME202288"
,
},
bindIphones
:
[],
isVerify
:
false
,
rules
:
{
pass
:
[{
validator
:
validatePass
,
trigger
:
'blur'
}],
checkPass
:
[{
validator
:
validatePass2
,
trigger
:
'blur'
}],
currentPassword
:
[{
validator
:
checkAge
,
trigger
:
'blur'
}]
pass
:
[{
validator
:
validatePass
,
trigger
:
"blur"
}],
checkPass
:
[{
validator
:
validatePass2
,
trigger
:
"blur"
}],
currentPassword
:
[{
validator
:
checkAge
,
trigger
:
"blur"
}],
},
phoneBindForm
:
{
account
:
''
,
iphoneBind
:
''
,
iphoneBindRe
:
''
account
:
""
,
iphoneBind
:
""
,
iphoneBindRe
:
""
,
},
phoneBindFormRules
:
{
iphoneBind
:
[
{
required
:
true
,
trigger
:
[
'blur'
,
'change'
],
validator
:
validatePhone1
}
trigger
:
[
"blur"
,
"change"
],
validator
:
validatePhone1
,
}
,
],
iphoneBindRe
:
[
{
required
:
true
,
trigger
:
[
'blur'
,
'change'
],
validator
:
validatePhone2
}
]
trigger
:
[
"blur"
,
"change"
],
validator
:
validatePhone2
,
}
,
]
,
},
loginOldForm
:
{
appCode
:
'1'
,
account
:
''
,
password
:
''
,
captcha
:
''
,
captchaKey
:
''
,
rememberMe
:
false
appCode
:
"1"
,
account
:
""
,
password
:
""
,
captcha
:
""
,
captchaKey
:
""
,
rememberMe
:
false
,
},
dialogPhoneBind
:
false
}
},
computed
:
{
// ...mapState({
// name: state => state.user.name,
// rememberMe: state => state.user.rememberMe
// })
dialogPhoneBind
:
false
,
store
:
null
,
};
},
computed
:
{},
watch
:
{
$route
:
{
handler
:
function
(
route
)
{
console
.
log
(
route
)
const
query
=
route
.
query
const
query
=
route
.
query
;
if
(
query
)
{
this
.
redirect
=
query
.
redirect
this
.
otherQuery
=
this
.
getOtherQuery
(
query
)
this
.
redirect
=
query
.
redirect
;
this
.
otherQuery
=
this
.
getOtherQuery
(
query
)
;
}
},
immediate
:
true
}
immediate
:
true
,
}
,
},
created
()
{
// this.getAppCode();
console
.
log
(
'-----------------------------------------'
)
console
.
log
(
'token11'
,
this
.
$route
.
query
.
token
)
this
.
token
=
this
.
$route
.
query
.
token
this
.
store
=
useUsersStore
();
this
.
token
=
this
.
$route
.
query
.
token
;
if
(
this
.
$route
.
query
.
token
)
{
this
.
nanjingLogin
(
this
.
$route
.
query
.
token
)
this
.
nanjingLogin
(
this
.
$route
.
query
.
token
)
;
}
else
{
this
.
fetchVerifyCli
()
this
.
fetchVerifyCli
()
;
}
this
.
loginForm
=
{
account
:
''
,
password
:
''
,
captcha
:
''
,
rememberMe
:
false
}
account
:
""
,
password
:
""
,
captcha
:
""
,
rememberMe
:
false
,
}
;
this
.
loginOldForm
=
{
account
:
''
,
password
:
''
,
captcha
:
''
,
rememberMe
:
false
}
account
:
""
,
password
:
""
,
captcha
:
""
,
rememberMe
:
false
,
}
;
},
mounted
()
{
if
(
getToken
(
'rememberMe'
)
==
'true'
)
{
this
.
loginForm
.
account
=
getToken
(
'account'
)
this
.
loginForm
.
password
=
getToken
(
'password'
)
if
(
getToken
(
"rememberMe"
)
==
"true"
)
{
this
.
loginForm
.
account
=
getToken
(
"account"
);
this
.
loginForm
.
password
=
getToken
(
"password"
);
}
else
{
this
.
loginForm
.
account
=
''
this
.
loginForm
.
password
=
''
this
.
loginForm
.
account
=
""
;
this
.
loginForm
.
password
=
""
;
}
// this.fetchVerifyCli();
this
.
debounceAction
=
this
.
debounce
(
this
.
handleAccountInput
,
100
)
this
.
debounceAction
=
this
.
debounce
(
this
.
handleAccountInput
,
100
);
},
destroyed
()
{
// window.removeEventListener('storage', this.afterQRScan)
},
methods
:
{
codeEnter
(
flag
)
{
var
_self
=
this
var
_self
=
this
;
document
.
onkeydown
=
function
(
e
)
{
if
(
window
.
event
==
undefined
)
{
var
key
=
e
.
keyCode
var
key
=
e
.
keyCode
;
}
else
{
var
key
=
window
.
event
.
keyCode
var
key
=
window
.
event
.
keyCode
;
}
if
(
key
==
13
)
{
if
(
flag
)
{
_self
.
handleOldLogin
()
_self
.
handleOldLogin
()
;
}
else
{
_self
.
handleLoginBefore
()
_self
.
handleLoginBefore
()
;
}
}
}
}
;
},
/**
* 账号焦点变化,判断登录验证方式
*/
handleAccountBlur
(
event
)
{
getData
(
'/config/simpleLoginConfig?appCode=bme-pc-service&account='
+
event
.
currentTarget
.
value
,
true
).
then
(
result
=>
{
this
.
needPhoneCertificate
=
!
result
.
data
this
.
isVerify
=
true
})
getData
(
"/config/simpleLoginConfig?appCode=bme-pc-service&account="
+
(
event
.
currentTarget
.
value
||
event
.
target
.
value
),
true
).
then
((
result
)
=>
{
this
.
needPhoneCertificate
=
!
result
.
data
;
this
.
isVerify
=
true
;
});
},
handleAccountInput
(
value
)
{
getData
(
'/config/simpleLoginConfig?appCode=bme-pc-service&account='
+
value
,
true
).
then
(
result
=>
{
this
.
needPhoneCertificate
=
!
result
.
data
this
.
isVerify
=
true
})
getData
(
"/config/simpleLoginConfig?appCode=bme-pc-service&account="
+
value
,
true
).
then
((
result
)
=>
{
this
.
needPhoneCertificate
=
!
result
.
data
;
this
.
isVerify
=
true
;
});
},
// 防抖工具函数
debounce
(
fn
,
theTime
)
{
return
function
()
{
clearTimeout
(
fn
.
timer
)
clearTimeout
(
fn
.
timer
)
;
fn
.
timer
=
setTimeout
(()
=>
{
fn
.
call
(
this
,
...
arguments
)
},
theTime
)
}
fn
.
call
(
this
,
...
arguments
)
;
},
theTime
)
;
}
;
},
/**
* @Description: 获取登录校验
...
...
@@ -579,126 +594,139 @@ export default {
* @return boolean;
*/
async
getAppCode
()
{
let
appCode
=
false
await
getData
(
'/user/captchaLoginConfig?appCode=bme-pc-service'
)
.
then
(
res
=>
{
let
appCode
=
false
;
await
getData
(
"/user/captchaLoginConfig?appCode=bme-pc-service"
)
.
then
(
(
res
)
=>
{
if
(
res
.
code
==
1
)
{
setToken
(
'appCode'
,
res
.
data
)
appCode
=
res
.
data
this
.
loginShow
=
res
.
data
this
.
codeEnter
(
res
.
data
)
setToken
(
"appCode"
,
res
.
data
);
appCode
=
res
.
data
;
this
.
loginShow
=
res
.
data
;
this
.
codeEnter
(
res
.
data
)
;
}
else
{
setToken
(
'appCode'
,
false
)
appCode
=
false
//
Message
.warning('登录方式判断接口异常')
this
.
codeEnter
(
false
)
setToken
(
"appCode"
,
false
);
appCode
=
false
;
//
ElMessage
.warning('登录方式判断接口异常')
this
.
codeEnter
(
false
)
;
}
})
.
catch
(()
=>
{
setToken
(
'appCode'
,
false
)
//
Message
.warning('登录方式判断接口报错')
this
.
codeEnter
(
false
)
})
setToken
(
"appCode"
,
false
);
//
ElMessage
.warning('登录方式判断接口报错')
this
.
codeEnter
(
false
)
;
})
;
},
handleLoginBind
()
{
this
.
$refs
.
phoneBindForm
.
validate
(
valid
=>
{
this
.
$refs
.
phoneBindForm
.
validate
(
(
valid
)
=>
{
if
(
valid
)
{
postData
(
this
.
$api
.
user
.
updateAccountIphone
,
{
postData
(
"/user/updateAccountIphone"
,
{
account
:
this
.
phoneBindForm
.
account
,
iphone
:
this
.
phoneBindForm
.
iphoneBindRe
}).
then
(
res
=>
{
console
.
log
(
res
.
data
)
iphone
:
this
.
phoneBindForm
.
iphoneBindRe
,
}).
then
((
res
)
=>
{
if
(
res
.
code
==
1
)
{
this
.
$message
({
type
:
'success'
,
message
:
'绑定成功!'
})
this
.
dialogPhoneBind
=
false
type
:
"success"
,
message
:
"绑定成功!"
,
})
;
this
.
dialogPhoneBind
=
false
;
}
})
})
;
}
})
})
;
},
querySearchIphone
(
queryString
,
cb
)
{
var
bindIphones
=
this
.
bindIphones
var
results
=
queryString
?
bindIphones
.
filter
(
this
.
createFilter
(
queryString
))
:
bindIphones
var
bindIphones
=
this
.
bindIphones
;
var
results
=
queryString
?
bindIphones
.
filter
(
this
.
createFilter
(
queryString
))
:
bindIphones
;
// 调用 callback 返回建议列表的数据
cb
(
results
)
cb
(
results
)
;
},
createFilter
(
queryString
)
{
return
bindIphone
=>
{
return
bindIphone
.
value
.
toLowerCase
().
indexOf
(
queryString
.
toLowerCase
())
===
0
}
return
(
bindIphone
)
=>
{
return
(
bindIphone
.
value
.
toLowerCase
().
indexOf
(
queryString
.
toLowerCase
())
===
0
);
};
},
handleSelect
(
item
)
{
console
.
log
(
item
)
console
.
log
(
item
)
;
},
submitForm
(
formName
)
{
//debugger;
this
.
$refs
[
formName
].
validate
(
valid
=>
{
this
.
$refs
[
formName
].
validate
(
(
valid
)
=>
{
if
(
valid
)
{
const
obj
=
{
oldPassword
:
MD5
(
this
.
ruleForm
.
currentPassword
+
"`1qazx"
).
toString
()
,
oldPassword
:
MD5
(
this
.
ruleForm
.
currentPassword
+
"`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
)
{
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
)
{
this
.
$message
({
type
:
'success'
,
message
:
'密码修改成功'
})
this
.
dialogChangePassword
=
false
this
.
captchaSendStatus
=
false
this
.
captchaWaitTime
=
0
type
:
"success"
,
message
:
"密码修改成功"
,
})
;
this
.
dialogChangePassword
=
false
;
this
.
captchaSendStatus
=
false
;
this
.
captchaWaitTime
=
0
;
this
.
phoneForm
=
{
appCode
:
'1'
,
account
:
''
,
password
:
''
,
iphone
:
''
,
captcha
:
''
,
captchaKey
:
'BME_12_BME202288'
}
appCode
:
"1"
,
account
:
""
,
password
:
""
,
iphone
:
""
,
captcha
:
""
,
captchaKey
:
"BME_12_BME202288"
,
}
;
}
})
})
;
}
else
{
console
.
log
(
'error submit!!'
)
return
false
console
.
log
(
"error submit!!"
);
return
false
;
}
})
})
;
},
resetForm
(
formName
)
{
this
.
$refs
[
formName
].
resetFields
()
this
.
$refs
[
formName
].
resetFields
()
;
},
sendCaptcha
()
{
getData
(
'/user/sendSMS?iphone='
+
this
.
phoneForm
.
iphone
+
'&account='
+
this
.
loginForm
.
account
+
'&appCode=bme-pc-service'
,
true
)
.
then
(
result
=>
{
getData
(
"/user/sendSMS?iphone="
+
this
.
phoneForm
.
iphone
+
"&account="
+
this
.
loginForm
.
account
+
"&appCode=bme-pc-service"
,
true
)
.
then
((
result
)
=>
{
if
(
result
.
data
&&
result
.
data
.
captchaKey
)
{
this
.
phoneForm
.
captchaKey
=
result
.
data
.
captchaKey
this
.
phoneForm
.
captchaKey
=
result
.
data
.
captchaKey
;
}
else
{
console
.
log
(
'error fetch verify code!!'
)
console
.
log
(
"error fetch verify code!!"
);
}
})
.
catch
(
e
=>
{
console
.
log
(
'error fetch verify code!!'
+
e
)
})
.
catch
(
(
e
)
=>
{
console
.
log
(
"error fetch verify code!!"
+
e
);
})
;
},
calcuCaptchaWaitTime
()
{
if
(
this
.
captchaWaitTime
>
0
)
{
this
.
captchaWaitTime
=
this
.
captchaWaitTime
-
1
this
.
captchaWaitTime
=
this
.
captchaWaitTime
-
1
;
if
(
this
.
calcuTimer
)
{
clearTimeout
(
this
.
calcuTimer
)
clearTimeout
(
this
.
calcuTimer
)
;
}
this
.
calcuTimer
=
setTimeout
(()
=>
{
this
.
calcuCaptchaWaitTime
()
},
1000
)
this
.
calcuCaptchaWaitTime
()
;
},
1000
)
;
}
else
{
this
.
captchaSendStatus
=
false
this
.
captchaWaitTime
=
0
this
.
$forceUpdate
()
this
.
captchaSendStatus
=
false
;
this
.
captchaWaitTime
=
0
;
this
.
$forceUpdate
()
;
}
},
sendCaptchaCheck
()
{
...
...
@@ -727,176 +755,180 @@ export default {
.catch((e) => {
console.log("error fetch verify code!!" + e);
});*/
this
.
captchaSendStatus
=
true
this
.
captchaWaitTime
=
60
this
.
$forceUpdate
()
this
.
calcuCaptchaWaitTime
()
this
.
sendCaptcha
()
this
.
captchaSendStatus
=
true
;
this
.
captchaWaitTime
=
60
;
this
.
$forceUpdate
()
;
this
.
calcuCaptchaWaitTime
()
;
this
.
sendCaptcha
()
;
},
checkCapslock
(
e
)
{
const
{
key
}
=
e
this
.
capsTooltip
=
key
&&
key
.
length
===
1
&&
key
>=
'A'
&&
key
<=
'Z'
const
{
key
}
=
e
;
this
.
capsTooltip
=
key
&&
key
.
length
===
1
&&
key
>=
"A"
&&
key
<=
"Z"
;
},
verifyCli
()
{
this
.
verify
=
'/user/captcha?v=_'
+
new
Date
().
valueOf
()
this
.
verify
=
"/user/captcha?v=_"
+
new
Date
().
valueOf
();
},
fetchVerifyCli
()
{
getData
(
'/user/captcha?v=_'
+
new
Date
().
valueOf
(),
true
)
.
then
(
result
=>
{
const
{
captchaKey
,
base64Img
}
=
result
.
data
this
.
verifyCode
=
base64Img
this
.
loginOldForm
.
captchaKey
=
captchaKey
})
.
catch
(
e
=>
{
console
.
log
(
'error fetch verify code!!'
+
e
)
getData
(
"/user/captcha?v=_"
+
new
Date
().
valueOf
(),
true
)
.
then
((
result
)
=>
{
const
{
captchaKey
,
base64Img
}
=
result
.
data
;
this
.
verifyCode
=
base64Img
;
this
.
loginOldForm
.
captchaKey
=
captchaKey
;
})
.
catch
((
e
)
=>
{
console
.
log
(
"error fetch verify code!!"
+
e
);
});
},
handleLoginBefore
()
{
if
(
this
.
loginForm
.
password
==
'BME202288'
)
{
this
.
phoneForm
.
account
=
this
.
loginForm
.
account
this
.
phoneForm
.
password
=
''
this
.
dialogPhoneCertificate
=
true
if
(
this
.
loginForm
.
password
==
"BME202288"
)
{
this
.
phoneForm
.
account
=
this
.
loginForm
.
account
;
this
.
phoneForm
.
password
=
""
;
this
.
dialogPhoneCertificate
=
true
;
}
else
{
getData
(
'/user/existIphone?account='
+
"/user/existIphone?account="
+
this
.
loginForm
.
account
+
'&password='
+
encodeURIComponent
(
MD5
(
this
.
loginForm
.
password
+
"`1qazx"
).
toString
())
+
'&appCode=bme-pc-service'
,
"&password="
+
encodeURIComponent
(
MD5
(
this
.
loginForm
.
password
+
"`1qazx"
).
toString
()
)
+
"&appCode=bme-pc-service"
,
true
).
then
(
result
=>
{
console
.
log
(
result
.
data
)
).
then
(
(
result
)
=>
{
console
.
log
(
result
.
data
)
;
if
(
result
.
code
==
1
&&
result
.
data
&&
result
.
data
.
length
>
0
)
{
this
.
phoneForm
.
account
=
this
.
loginForm
.
account
this
.
phoneForm
.
password
=
this
.
loginForm
.
password
this
.
dialogPhoneCertificate
=
true
this
.
bindIphones
=
[]
result
.
data
.
forEach
(
element
=>
{
this
.
bindIphones
.
push
({
value
:
element
})
})
}
else
if
(
result
.
code
==
9001
&&
result
.
msg
==
'手机号和账户绑定关系不存在,请重新输入!'
)
{
//this.phoneBindForm.account = this.loginForm.account;
//this.dialogPhoneBind = true;
this
.
phoneForm
.
account
=
this
.
loginForm
.
account
this
.
phoneForm
.
password
=
this
.
loginForm
.
password
this
.
dialogPhoneCertificate
=
true
this
.
bindIphones
=
[]
this
.
phoneForm
.
account
=
this
.
loginForm
.
account
;
this
.
phoneForm
.
password
=
this
.
loginForm
.
password
;
this
.
dialogPhoneCertificate
=
true
;
this
.
bindIphones
=
[];
result
.
data
.
forEach
((
element
)
=>
{
this
.
bindIphones
.
push
({
value
:
element
});
});
}
else
if
(
result
.
code
==
9001
&&
result
.
msg
==
"手机号和账户绑定关系不存在,请重新输入!"
)
{
this
.
phoneForm
.
account
=
this
.
loginForm
.
account
;
this
.
phoneForm
.
password
=
this
.
loginForm
.
password
;
this
.
dialogPhoneCertificate
=
true
;
this
.
bindIphones
=
[];
}
})
})
;
}
},
handleLogin
()
{
this
.
$refs
.
phoneForm
.
validate
(
valid
=>
{
this
.
$refs
.
phoneForm
.
validate
(
(
valid
)
=>
{
if
(
valid
)
{
this
.
loading
=
true
this
.
phoneForm
.
appCode
=
'bme-pc-service'
let
bindIphones
=
[]
this
.
bindIphones
.
forEach
(
item
=>
{
bindIphones
.
push
(
item
.
value
)
})
const
phoneFormOrigin
=
{...
this
.
phoneForm
};
phoneFormOrigin
.
password
=
MD5
(
this
.
phoneForm
.
password
+
"`1qazx"
).
toString
()
this
.
$store
.
dispatch
(
'user/login'
,
phoneFormOrigin
)
.
then
(
data
=>
{
if
(
$
.
inArray
(
this
.
phoneForm
.
iphone
,
bindIphones
)
<
0
&&
this
.
phoneForm
.
captcha
!=
'BME202288'
)
{
postData
(
this
.
$api
.
user
.
updateAccountIphone
,
{
this
.
loading
=
true
;
this
.
phoneForm
.
appCode
=
"bme-pc-service"
;
let
bindIphones
=
[];
this
.
bindIphones
.
forEach
((
item
)
=>
{
bindIphones
.
push
(
item
.
value
);
});
const
phoneFormOrigin
=
{
...
this
.
phoneForm
};
phoneFormOrigin
.
password
=
MD5
(
this
.
phoneForm
.
password
+
"`1qazx"
).
toString
();
this
.
store
.
login
(
phoneFormOrigin
)
.
then
((
data
)
=>
{
if
(
$
.
inArray
(
this
.
phoneForm
.
iphone
,
bindIphones
)
<
0
&&
this
.
phoneForm
.
captcha
!=
"BME202288"
)
{
postData
(
"/user/updateAccountIphone"
,
{
account
:
this
.
phoneForm
.
account
,
iphone
:
this
.
phoneForm
.
iphone
}).
then
(
res
=>
{
console
.
log
(
res
.
data
)
iphone
:
this
.
phoneForm
.
iphone
,
}).
then
(
(
res
)
=>
{
console
.
log
(
res
.
data
)
;
if
(
res
.
code
==
1
)
{
this
.
getProfile
(
data
)
this
.
getProfile
(
data
)
;
}
})
})
;
}
else
{
this
.
getProfile
(
data
)
this
.
getProfile
(
data
)
;
}
})
.
catch
(
data
=>
{
.
catch
(
(
data
)
=>
{
if
(
data
.
code
===
9003
)
{
this
.
verifyCli
()
this
.
verifyCli
()
;
}
removeToken
()
this
.
loading
=
false
})
removeToken
()
;
this
.
loading
=
false
;
})
;
}
else
{
console
.
log
(
'error submit!!'
)
return
false
console
.
log
(
"error submit!!"
);
return
false
;
}
})
})
;
},
// 南京登录
nanjingLogin
(
token
)
{
setToken
(
'TOKEN'
,
token
)
this
.
getProfile
()
setToken
(
"TOKEN"
,
token
);
this
.
getProfile
()
;
},
getProfile
(
result
)
{
getData
(
this
.
$api
.
user
.
profile
)
.
then
(
async
data
=>
{
let
customerName
=
data
.
data
.
customerName
||
''
let
customerId
=
data
.
data
.
customerId
setToken
(
'customerName'
,
customerName
)
setToken
(
'dataBranchFactoryId'
,
data
.
data
.
dataBranchFactoryId
)
setToken
(
'customerId'
,
customerId
)
setToken
(
'userId'
,
data
.
data
.
id
)
sessionStorage
.
setItem
(
'userId'
,
data
.
data
.
id
)
let
homeFlag
=
await
this
.
getPermissionData
(
data
.
data
.
id
)
this
.
$store
.
dispatch
(
'user/setCustomerId'
,
customerId
)
this
.
$store
.
dispatch
(
'user/setDataBranchFactoryId'
,
data
.
data
.
dataBranchFactoryId
)
this
.
$store
.
dispatch
(
'user/setOffice'
,
{
getData
(
"/system/user/profile"
)
.
then
(
async
(
data
)
=>
{
let
customerName
=
data
.
data
.
customerName
||
""
;
let
customerId
=
data
.
data
.
customerId
;
setToken
(
"customerName"
,
customerName
);
setToken
(
"dataBranchFactoryId"
,
data
.
data
.
dataBranchFactoryId
);
setToken
(
"customerId"
,
customerId
);
setToken
(
"userId"
,
data
.
data
.
id
);
sessionStorage
.
setItem
(
"userId"
,
data
.
data
.
id
);
let
homeFlag
=
await
this
.
getPermissionData
(
data
.
data
.
id
)
;
this
.
store
.
customerId
=
customerId
;
this
.
store
.
dataBranchFactoryId
=
data
.
data
.
dataBranchFactoryId
;
this
.
store
.
office
=
{
officeId
:
data
.
data
.
officeId
,
officeName
:
data
.
data
.
officeNameList
}
)
this
.
$store
.
dispatch
(
'settings/changeSetting'
,
false
)
officeName
:
data
.
data
.
officeNameList
,
}
;
this
.
store
.
istrue
=
false
;
// 此接口是针对港陆闭环的,民营日照不需要调这个接口,暂时去掉
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
if
(
result
&&
result
.
code
==
9999
&&
result
.
msg
==
'密码已过期,请重置!'
)
{
this
.
dialogChangePassword
=
true
this
.
dialogPhoneCertificate
=
false
this
.
dialogPhoneBind
=
false
}
else
if
(
data
.
data
.
ultralowBoard
===
1
)
{
// 是否有抄底看板权限
setToken
(
'permissions'
,
1
)
setToken
(
"permissions"
,
0
);
if
(
homeFlag
==
0
)
{
this
.
$router
.
push
({
path
:
'/superLowBillboard'
})
path
:
"/newHome/homePage"
,
})
;
}
else
{
setToken
(
'permissions'
,
0
)
if
(
homeFlag
==
0
)
{
this
.
$router
.
push
({
path
:
'/newHome/homePage'
,
})
}
else
{
this
.
$router
.
push
({
path
:
this
.
redirect
||
'/'
,
query
:
this
.
otherQuery
})
}
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
,
query
:
this
.
otherQuery
,
});
}
this
.
loading
=
false
this
.
loading
=
false
;
})
.
catch
(
data
=>
{
this
.
$store
.
dispatch
(
'settings/changeSetting'
,
false
)
.
catch
(
(
data
)
=>
{
this
.
store
.
istrue
=
false
;
this
.
$router
.
push
({
path
:
this
.
redirect
||
'/'
,
query
:
this
.
otherQuery
})
this
.
loading
=
false
})
path
:
this
.
redirect
||
"/"
,
query
:
this
.
otherQuery
,
})
;
this
.
loading
=
false
;
})
;
},
getOtherQuery
(
query
)
{
return
Object
.
keys
(
query
).
reduce
((
acc
,
cur
)
=>
{
if
(
cur
!==
'redirect'
&&
cur
!==
'token'
)
{
acc
[
cur
]
=
query
[
cur
]
if
(
cur
!==
"redirect"
&&
cur
!==
"token"
)
{
acc
[
cur
]
=
query
[
cur
]
;
}
return
acc
},
{})
return
acc
;
},
{})
;
},
/**
* 判断图片验证还是手机号验证
...
...
@@ -904,126 +936,138 @@ export default {
async
handleLoginNew
()
{
if
(
!
this
.
isVerify
)
{
// 处理谷歌浏览器自带默认值的情况,因为初始化时获取不到,所以这里特殊处理
await
getData
(
'/config/simpleLoginConfig?appCode=bme-pc-service&account='
+
this
.
loginOldForm
.
account
,
true
).
then
(
result
=>
{
this
.
needPhoneCertificate
=
!
result
.
data
this
.
isVerify
=
true
})
await
getData
(
"/config/simpleLoginConfig?appCode=bme-pc-service&account="
+
this
.
loginOldForm
.
account
,
true
).
then
((
result
)
=>
{
this
.
needPhoneCertificate
=
!
result
.
data
;
this
.
isVerify
=
true
;
});
}
if
(
this
.
needPhoneCertificate
)
{
this
.
loginForm
.
account
=
this
.
loginOldForm
.
account
this
.
loginForm
.
password
=
this
.
loginOldForm
.
password
this
.
handleLoginBefore
()
this
.
loginForm
.
account
=
this
.
loginOldForm
.
account
;
this
.
loginForm
.
password
=
this
.
loginOldForm
.
password
;
this
.
handleLoginBefore
()
;
}
else
{
this
.
handleOldLogin
()
this
.
handleOldLogin
()
;
}
},
handleOldLogin
()
{
this
.
$refs
.
loginOldForm
.
validate
(
valid
=>
{
this
.
$refs
.
loginOldForm
.
validate
(
(
valid
)
=>
{
if
(
valid
)
{
this
.
oldloading
=
true
this
.
loginOldForm
.
appCode
=
'bme-pc-service'
const
loginOldFormOrigin
=
{
...
this
.
loginOldForm
};
this
.
oldloading
=
true
;
this
.
loginOldForm
.
appCode
=
"bme-pc-service"
;
const
loginOldFormOrigin
=
{
...
this
.
loginOldForm
};
loginOldFormOrigin
.
password
=
MD5
(
this
.
loginOldForm
.
password
+
"`1qazx"
).
toString
();
this
.
$store
.
dispatch
(
'user/captchaLogin'
,
loginOldFormOrigin
)
loginOldFormOrigin
.
password
=
MD5
(
this
.
loginOldForm
.
password
+
"`1qazx"
).
toString
();
this
.
store
.
captchaLogin
(
loginOldFormOrigin
)
.
then
(()
=>
{
this
.
getOldProfile
()
console
.
log
(
"登录成功"
);
this
.
getOldProfile
();
})
.
catch
(
data
=>
{
this
.
oldloading
=
false
.
catch
(
(
data
)
=>
{
this
.
oldloading
=
false
;
if
(
data
.
code
===
9003
)
{
this
.
verifyCli
()
}
else
if
(
data
.
code
==
9999
&&
data
.
msg
==
'密码已过期,请重置!'
)
{
setToken
(
'TOKEN'
,
data
.
data
)
this
.
dialogChangePassword
=
true
this
.
dialogPhoneCertificate
=
false
this
.
dialogPhoneBind
=
false
this
.
verifyCli
();
}
else
if
(
data
.
code
==
9999
&&
data
.
msg
==
"密码已过期,请重置!"
)
{
setToken
(
"TOKEN"
,
data
.
data
);
this
.
dialogChangePassword
=
true
;
this
.
dialogPhoneCertificate
=
false
;
this
.
dialogPhoneBind
=
false
;
}
else
{
removeToken
()
this
.
oldloading
=
false
removeToken
()
;
this
.
oldloading
=
false
;
}
})
})
;
}
else
{
console
.
log
(
'error submit!!'
)
return
false
console
.
log
(
"error submit!!"
);
return
false
;
}
})
})
;
},
getOldProfile
()
{
getData
(
this
.
$api
.
user
.
profile
)
.
then
(
async
data
=>
{
let
customerName
=
data
.
data
.
customerName
||
''
let
customerId
=
data
.
data
.
customerId
setToken
(
'customerName'
,
customerName
)
setToken
(
'dataBranchFactoryId'
,
data
.
data
.
dataBranchFactoryId
)
setToken
(
'customerId'
,
customerId
)
setToken
(
'userId'
,
data
.
data
.
id
)
sessionStorage
.
setItem
(
'userId'
,
data
.
data
.
id
)
getData
(
"/system/user/profile"
)
.
then
(
async
(
data
)
=>
{
let
customerName
=
data
.
data
.
customerName
||
""
;
let
customerId
=
data
.
data
.
customerId
;
setToken
(
"customerName"
,
customerName
);
setToken
(
"dataBranchFactoryId"
,
data
.
data
.
dataBranchFactoryId
);
setToken
(
"customerId"
,
customerId
);
setToken
(
"userId"
,
data
.
data
.
id
);
sessionStorage
.
setItem
(
"userId"
,
data
.
data
.
id
);
let
homeFlag
=
await
this
.
getPermissionData
(
data
.
data
.
id
);
this
.
$store
.
dispatch
(
'user/setCustomerId'
,
customerId
)
this
.
$store
.
dispatch
(
'user/setDataBranchFactoryId'
,
data
.
data
.
dataBranchFactoryId
)
this
.
$store
.
dispatch
(
'user/setOffice'
,
{
this
.
store
.
customerId
=
customerId
;
this
.
store
.
dataBranchFactoryId
=
data
.
data
.
dataBranchFactoryId
;
this
.
store
.
office
=
{
officeId
:
data
.
data
.
officeId
,
officeName
:
data
.
data
.
officeNameList
,
};
this
.
store
.
office
=
{
officeId
:
data
.
data
.
officeId
,
officeName
:
data
.
data
.
officeNameList
}
)
this
.
$store
.
dispatch
(
'settings/changeSetting'
,
false
)
officeName
:
data
.
data
.
officeNameList
,
}
;
this
.
store
.
istrue
=
false
;
// 此接口是针对港陆闭环的,民营日照不需要调这个接口,暂时去掉
if
(
customerId
!=
35
)
{
this
.
$store
.
dispatch
(
'user/getFunctionList'
,
customerId
)
this
.
store
.
getFunctionList
(
customerId
);
}
document
.
onkeydown
=
undefined
if
(
data
.
data
.
ultralowBoard
===
1
)
{
// 是否有抄底看板权限
setToken
(
'permissions'
,
1
)
document
.
onkeydown
=
undefined
;
setToken
(
"permissions"
,
0
);
if
(
homeFlag
==
0
)
{
this
.
$router
.
push
({
path
:
'/superLowBillboard'
})
path
:
"/newHome/homePage"
,
})
;
}
else
{
setToken
(
'permissions'
,
0
)
if
(
homeFlag
==
0
)
{
this
.
$router
.
push
({
path
:
'/newHome/homePage'
,
})
}
else
{
this
.
$router
.
push
({
path
:
this
.
redirect
||
'/'
,
query
:
this
.
otherQuery
})
}
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
,
query
:
this
.
otherQuery
,
});
}
this
.
oldloading
=
false
this
.
oldloading
=
false
;
})
.
catch
(
data
=>
{
this
.
$store
.
dispatch
(
'settings/changeSetting'
,
false
)
.
catch
(
(
data
)
=>
{
// this.store.dispatch("settings/changeSetting", false);
this
.
$router
.
push
({
path
:
this
.
redirect
||
'/'
,
query
:
this
.
otherQuery
})
this
.
oldloading
=
false
})
path
:
this
.
redirect
||
"/"
,
query
:
this
.
otherQuery
,
})
;
this
.
oldloading
=
false
;
})
;
},
getPermissionData
(
userId
)
{
return
new
Promise
((
resolve
)
=>
{
const
url
=
this
.
$api
.
user
.
getPowerData
return
new
Promise
((
resolve
)
=>
{
const
url
=
"/management/admin/userDataPermission"
;
const
params
=
{
userId
}
getDataFun
(
url
,
params
).
then
(
res
=>
{
userId
,
}
;
getDataFun
(
url
,
params
).
then
(
(
res
)
=>
{
if
(
res
&&
res
.
data
)
{
sessionStorage
.
setItem
(
'permissionData'
,
JSON
.
stringify
(
res
.
data
))
sessionStorage
.
setItem
(
'branchFactoryList'
,
JSON
.
stringify
(
res
.
data
.
branchFactoryIdList
))
sessionStorage
.
setItem
(
'primaryTypeList'
,
res
.
data
.
devicePrimaryTypeIdList
);
sessionStorage
.
setItem
(
'pcProductDevice'
,
res
.
data
.
pcProductDevice
);
sessionStorage
.
setItem
(
'homePageAuth'
,
res
.
data
.
homePageAuth
);
resolve
(
res
.
data
.
homePageAuth
);
sessionStorage
.
setItem
(
"permissionData"
,
JSON
.
stringify
(
res
.
data
));
sessionStorage
.
setItem
(
"branchFactoryList"
,
JSON
.
stringify
(
res
.
data
.
branchFactoryIdList
)
);
sessionStorage
.
setItem
(
"primaryTypeList"
,
res
.
data
.
devicePrimaryTypeIdList
);
sessionStorage
.
setItem
(
"pcProductDevice"
,
res
.
data
.
pcProductDevice
);
sessionStorage
.
setItem
(
"homePageAuth"
,
res
.
data
.
homePageAuth
);
resolve
(
res
.
data
.
homePageAuth
);
}
})
})
;
});
}
}
}
}
,
}
,
}
;
</
script
>
<
style
lang=
"scss"
>
...
...
@@ -1063,11 +1107,14 @@ $cursor: #ccc;
}
&
:
-
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
;
}
}
}
.el-input__wrapper
{
width
:
100%
;
}
.captcha
{
input
{
...
...
@@ -1077,12 +1124,8 @@ $cursor: #ccc;
}
.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-bottom
:
1px
solid
#
ccc
;
border-bottom
:
1px
solid
#
fff
;
background
:
#fff
;
}
}
...
...
@@ -1100,9 +1143,9 @@ $light_gray: #eee;
}
.login-container
{
min-height
:
100
%
;
min-height
:
100
vh
;
width
:
100%
;
background-image
:
url(
'../../assets/bg.jpg'
)
;
background-image
:
url(
"../../assets/bg.jpg"
)
;
background-size
:
cover
;
overflow
:
hidden
;
...
...
@@ -1123,6 +1166,7 @@ $light_gray: #eee;
position
:
absolute
;
right
:
14vw
;
top
:
22%
;
border-radius
:
20px
;
.el-checkbox-group
label
{
margin-top
:
20px
;
...
...
@@ -1131,14 +1175,14 @@ $light_gray: #eee;
button
{
width
:
100%
;
margin-top
:
40px
;
background
:
#
003b8f
;
background
:
#
2182a0
;
height
:
40px
;
}
img
{
position
:
absolute
;
top
:
13px
;
right
:
0
;
//
position: absolute;
//
top: 13px;
//
right: 0;
cursor
:
pointer
;
}
}
...
...
@@ -1160,7 +1204,7 @@ $light_gray: #eee;
.login-btn
{
width
:
100%
;
margin-top
:
40px
;
background
:
#
003b8f
;
background
:
#
2182a0
;
height
:
40px
;
}
...
...
@@ -1171,9 +1215,9 @@ $light_gray: #eee;
}
img
{
position
:
absolute
;
top
:
13px
;
right
:
0
;
//
position: absolute;
//
top: 13px;
//
right: 0;
cursor
:
pointer
;
}
}
...
...
@@ -1204,7 +1248,7 @@ $light_gray: #eee;
.title
{
font-size
:
26px
;
display
:
inline-block
;
color
:
#
003b8f
;
color
:
#
2182a0
;
}
span
{
...
...
@@ -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
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment