|
@@ -22,6 +22,7 @@
|
|
|
|
|
|
<div class="single-input input_login">
|
|
|
<el-button class="single_login" @click="loginIn">登录</el-button>
|
|
|
+ <el-button class="single_login" @click="loginIn('2')">游客登录</el-button>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
@@ -78,164 +79,173 @@ export default {
|
|
|
// });
|
|
|
// }, 10000);
|
|
|
},
|
|
|
- loginIn(){
|
|
|
- let store = useRootStore()
|
|
|
- this.message_text = null;
|
|
|
- if(this.loginForm.identifyingCode == "" || this.loginForm.identifyingCode == null){
|
|
|
- this.message_text = "请输入验证码!";
|
|
|
- }
|
|
|
- if(this.show_num.join("") != this.loginForm.identifyingCode.toString().toLocaleLowerCase()){
|
|
|
- this.message_text = "验证码输入错误!";
|
|
|
- }
|
|
|
- if(this.loginForm.passWord == "" || this.loginForm.passWord == null){
|
|
|
- this.message_text = "请输入密码!";
|
|
|
- }
|
|
|
-
|
|
|
- if(this.loginForm.userName == "" || this.loginForm.userName == null){
|
|
|
- this.message_text = "请输入用户名!";
|
|
|
- }
|
|
|
- if(this.message_text != null){
|
|
|
-
|
|
|
- showMessage({
|
|
|
- type:"warning",
|
|
|
- message:this.message_text
|
|
|
- })
|
|
|
- this.draw();
|
|
|
- return;
|
|
|
- }
|
|
|
- loginIn(this.loginForm.userName,Base64.encode(this.loginForm.passWord)).then(data =>{
|
|
|
-
|
|
|
- var result = data.msg;
|
|
|
-
|
|
|
- var rows = result[0].Rows;
|
|
|
- if (result.length == 0) {
|
|
|
- showMessage({
|
|
|
- type:'error',
|
|
|
- message:'获取登录信息失败'
|
|
|
- })
|
|
|
- this.draw()
|
|
|
- return;
|
|
|
+ loginIn(type){
|
|
|
+ let store = useRootStore()
|
|
|
+ this.message_text = null;
|
|
|
+ if(this.loginForm.identifyingCode == "" || this.loginForm.identifyingCode == null){
|
|
|
+ this.message_text = "请输入验证码!";
|
|
|
}
|
|
|
- var rowcount = result[0].TotalRowCount;
|
|
|
- if (rowcount != "1") {
|
|
|
- showMessage({
|
|
|
- type:'error',
|
|
|
- message:'用户名或密码错误'
|
|
|
- })
|
|
|
- this.draw()
|
|
|
- return;
|
|
|
+ if(this.show_num.join("") != this.loginForm.identifyingCode.toString().toLocaleLowerCase()){
|
|
|
+ this.message_text = "验证码输入错误!";
|
|
|
+ }
|
|
|
+ if(this.loginForm.passWord == "" || this.loginForm.passWord == null){
|
|
|
+ this.message_text = "请输入密码!";
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.loginForm.userName == "" || this.loginForm.userName == null){
|
|
|
+ this.message_text = "请输入用户名!";
|
|
|
}
|
|
|
- if (rows.length != 1) {
|
|
|
+ let username;
|
|
|
+ let password;
|
|
|
+ if(type=='2'){
|
|
|
+ username = 'youke';
|
|
|
+ password = '123456';
|
|
|
+ }else{
|
|
|
+ if(this.message_text != null){
|
|
|
+
|
|
|
showMessage({
|
|
|
- type:'error',
|
|
|
- message:'用户名或密码错误'
|
|
|
+ type:"warning",
|
|
|
+ message:this.message_text
|
|
|
})
|
|
|
- this.draw()
|
|
|
+ this.draw();
|
|
|
return;
|
|
|
}
|
|
|
- // if (rows[0].USERNAME != "PTGL"
|
|
|
- // && rows[0].USERNAME != "ADMIN"
|
|
|
- // && rows[0].USERNAME != "ptgl"
|
|
|
- // && rows[0].USERNAME != "admin") {
|
|
|
- // layerAlert("系统提示", "无登录权限!", null, 2);
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (rows[0].USERNAME == "jptgl") {
|
|
|
- // showMessage({
|
|
|
- // type:'error',
|
|
|
- // message:'无登录权限'
|
|
|
- // })
|
|
|
- // this.draw()
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (rows[0].ROLE_CODE != "0"
|
|
|
- // && rows[0].ROLE_CODE != "1" && rows[0].ROLE_CODE != "12") {
|
|
|
- // showMessage({
|
|
|
- // type:'error',
|
|
|
- // message:'无登录权限'
|
|
|
- // })
|
|
|
- // this.draw()
|
|
|
- // return;
|
|
|
- // }
|
|
|
- var LOGIN_LOCK = rows[0]["LOGIN_LOCK"];
|
|
|
- if (LOGIN_LOCK == 1) {
|
|
|
- var time = new Date(rows[0]["GETTIME"]).getTime() - new Date(rows[0]["LAST_TIME"]).getTime();
|
|
|
- time = time / 1000;
|
|
|
- if (time < 20) {
|
|
|
+ username = this.loginForm.userName;
|
|
|
+ password = this.loginForm.passWord;
|
|
|
+ }
|
|
|
+ loginIn(username,Base64.encode(password)).then(data =>{
|
|
|
+
|
|
|
+ var result = data.msg;
|
|
|
+
|
|
|
+ var rows = result[0].Rows;
|
|
|
+ if (result.length == 0) {
|
|
|
showMessage({
|
|
|
type:'error',
|
|
|
- message:'当前用户已登录'
|
|
|
+ message:'获取登录信息失败'
|
|
|
})
|
|
|
this.draw()
|
|
|
return;
|
|
|
}
|
|
|
- }
|
|
|
+ var rowcount = result[0].TotalRowCount;
|
|
|
+ if (rowcount != "1") {
|
|
|
+ showMessage({
|
|
|
+ type:'error',
|
|
|
+ message:'用户名或密码错误'
|
|
|
+ })
|
|
|
+ this.draw()
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (rows.length != 1) {
|
|
|
+ showMessage({
|
|
|
+ type:'error',
|
|
|
+ message:'用户名或密码错误'
|
|
|
+ })
|
|
|
+ this.draw()
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // if (rows[0].USERNAME != "PTGL"
|
|
|
+ // && rows[0].USERNAME != "ADMIN"
|
|
|
+ // && rows[0].USERNAME != "ptgl"
|
|
|
+ // && rows[0].USERNAME != "admin") {
|
|
|
+ // layerAlert("系统提示", "无登录权限!", null, 2);
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (rows[0].USERNAME == "jptgl") {
|
|
|
+ // showMessage({
|
|
|
+ // type:'error',
|
|
|
+ // message:'无登录权限'
|
|
|
+ // })
|
|
|
+ // this.draw()
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (rows[0].ROLE_CODE != "0"
|
|
|
+ // && rows[0].ROLE_CODE != "1" && rows[0].ROLE_CODE != "12") {
|
|
|
+ // showMessage({
|
|
|
+ // type:'error',
|
|
|
+ // message:'无登录权限'
|
|
|
+ // })
|
|
|
+ // this.draw()
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ var LOGIN_LOCK = rows[0]["LOGIN_LOCK"];
|
|
|
+ if (LOGIN_LOCK == 1) {
|
|
|
+ var time = new Date(rows[0]["GETTIME"]).getTime() - new Date(rows[0]["LAST_TIME"]).getTime();
|
|
|
+ time = time / 1000;
|
|
|
+ if (time < 20) {
|
|
|
+ showMessage({
|
|
|
+ type:'error',
|
|
|
+ message:'当前用户已登录'
|
|
|
+ })
|
|
|
+ this.draw()
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取用户信息
|
|
|
+ var usercode = rows[0].USERID;
|
|
|
+ var username = rows[0].USERNAME;
|
|
|
+ var truename = rows[0].NAME;
|
|
|
+ var unitcode = rows[0].UNIT;
|
|
|
+ var unitname = rows[0].UNIT_NAME;
|
|
|
+ var lasttime = rows[0].LAST_TIME;
|
|
|
+ var password = Base64.encode(this.loginForm.passWord)
|
|
|
+ var change_time = rows[0].CHANGE_TIME;
|
|
|
+ var role = rows[0].ROLE_CODE;
|
|
|
+ var userkeycode = rows[0]["TEMPUSERKEYCODE"];
|
|
|
|
|
|
- //获取用户信息
|
|
|
- var usercode = rows[0].USERID;
|
|
|
- var username = rows[0].USERNAME;
|
|
|
- var truename = rows[0].NAME;
|
|
|
- var unitcode = rows[0].UNIT;
|
|
|
- var unitname = rows[0].UNIT_NAME;
|
|
|
- var lasttime = rows[0].LAST_TIME;
|
|
|
- var password = Base64.encode(this.loginForm.passWord)
|
|
|
- var change_time = rows[0].CHANGE_TIME;
|
|
|
- var role = rows[0].ROLE_CODE;
|
|
|
- var userkeycode = rows[0]["TEMPUSERKEYCODE"];
|
|
|
+ //保存用户信息
|
|
|
|
|
|
- //保存用户信息
|
|
|
+ editLoginState(usercode,userkeycode).then(res =>{
|
|
|
|
|
|
- editLoginState(usercode,userkeycode).then(res =>{
|
|
|
+ var date = res.msg;
|
|
|
+ if (date[0]["success"] == "true") {
|
|
|
+ localStorage.setItem("xyxx_usercode", usercode);
|
|
|
+ localStorage.setItem("xyxx_username", username);
|
|
|
+ localStorage.setItem("xyxx_unitcode", unitcode);
|
|
|
+ localStorage.setItem("xyxx_unitname", unitname);
|
|
|
+ localStorage.setItem("xyxx_password", password);
|
|
|
+ localStorage.setItem("xyxx_lasttime", lasttime);
|
|
|
+ localStorage.setItem("xyxx_changetime", change_time);
|
|
|
+ localStorage.setItem("xyxx_role", role);
|
|
|
+ localStorage.setItem("xyxx_userkeycode", userkeycode);
|
|
|
+ localStorage.setItem("xyxx-part", '');
|
|
|
+ store.userInfo = {
|
|
|
+ xyxx_usercode:usercode,
|
|
|
+ xyxx_username:username,
|
|
|
+ xyxx_unitcode:unitcode,
|
|
|
+ xyxx_unitname:unitname,
|
|
|
+ xyxx_password:password,
|
|
|
+ xyxx_lasttime:lasttime,
|
|
|
+ xyxx_changetime:change_time,
|
|
|
+ xyxx_role:role,
|
|
|
+ xyxx_userkeycode:userkeycode
|
|
|
+ }
|
|
|
+ localStorage.setItem('dataWatchLoginUserInfo',JSON.stringify(store.userInfo))
|
|
|
+ this.$router.push('/main')
|
|
|
|
|
|
- var date = res.msg;
|
|
|
- if (date[0]["success"] == "true") {
|
|
|
- localStorage.setItem("xyxx_usercode", usercode);
|
|
|
- localStorage.setItem("xyxx_username", username);
|
|
|
- localStorage.setItem("xyxx_unitcode", unitcode);
|
|
|
- localStorage.setItem("xyxx_unitname", unitname);
|
|
|
- localStorage.setItem("xyxx_password", password);
|
|
|
- localStorage.setItem("xyxx_lasttime", lasttime);
|
|
|
- localStorage.setItem("xyxx_changetime", change_time);
|
|
|
- localStorage.setItem("xyxx_role", role);
|
|
|
- localStorage.setItem("xyxx_userkeycode", userkeycode);
|
|
|
- localStorage.setItem("xyxx-part", '');
|
|
|
- store.userInfo = {
|
|
|
- xyxx_usercode:usercode,
|
|
|
- xyxx_username:username,
|
|
|
- xyxx_unitcode:unitcode,
|
|
|
- xyxx_unitname:unitname,
|
|
|
- xyxx_password:password,
|
|
|
- xyxx_lasttime:lasttime,
|
|
|
- xyxx_changetime:change_time,
|
|
|
- xyxx_role:role,
|
|
|
- xyxx_userkeycode:userkeycode
|
|
|
+ //user.InsertSyslog(unitcode, usercode, "系统登录", "政务管理-登录", "登录系统成功");
|
|
|
+ //切换首页
|
|
|
+ //parent.location.href = 'index.html';
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ ElMessageBox.alert('登录失败!', '提示', {
|
|
|
+ confirmButtonText: '确定'
|
|
|
+ });
|
|
|
+ this.draw();
|
|
|
+ return;
|
|
|
}
|
|
|
- localStorage.setItem('dataWatchLoginUserInfo',JSON.stringify(store.userInfo))
|
|
|
- this.$router.push('/main')
|
|
|
+ })
|
|
|
+ this.setOperationTime();
|
|
|
+ addLoginLog().then(response => {
|
|
|
+ var date = response.msg;
|
|
|
+ if (date[0]["success"] == "true") {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- //user.InsertSyslog(unitcode, usercode, "系统登录", "政务管理-登录", "登录系统成功");
|
|
|
- //切换首页
|
|
|
- //parent.location.href = 'index.html';
|
|
|
- return;
|
|
|
- } else {
|
|
|
- ElMessageBox.alert('登录失败!', '提示', {
|
|
|
- confirmButtonText: '确定'
|
|
|
- });
|
|
|
- this.draw();
|
|
|
- return;
|
|
|
- }
|
|
|
})
|
|
|
- this.setOperationTime();
|
|
|
- addLoginLog().then(response => {
|
|
|
- var date = response.msg;
|
|
|
- if (date[0]["success"] == "true") {
|
|
|
- return;
|
|
|
- } else {
|
|
|
- return;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- })
|
|
|
},
|
|
|
draw() {
|
|
|
var canvas_width = this.canvas.width;
|