|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
- <view v-show="accountIsShow">
|
|
|
+
|
|
|
+ <view v-if="accountIsShow">
|
|
|
<view class="title">账号密码登录</view>
|
|
|
<view class="usernameAndPassword">
|
|
|
<view class="usernameContent">
|
|
@@ -21,7 +22,7 @@
|
|
|
点击登录,即代表已阅读并同意<a href="#">隐私政策</a>和<a href="#">用户协议</a>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view v-show="phoneIsShow">
|
|
|
+ <view v-if="phoneIsShow">
|
|
|
<view class="title">手机验证码登录</view>
|
|
|
<view class="usernameAndPassword">
|
|
|
<view class="phoneContent">
|
|
@@ -41,11 +42,17 @@
|
|
|
点击登录,即代表已阅读并同意<a href="#">隐私政策</a>和<a href="#">用户协议</a>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
+
|
|
|
+ <initial ref="mywebview"></initial>
|
|
|
+
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+
|
|
|
export default {
|
|
|
+
|
|
|
data: function() {
|
|
|
return {
|
|
|
passwordShow: true,
|
|
@@ -76,7 +83,7 @@
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
-
|
|
|
+ uni.setStorageSync('im_show','0');
|
|
|
this.windowWidth = uni.getSystemInfoSync().windowWidth;
|
|
|
this.windowHeight = uni.getSystemInfoSync().windowHeight;
|
|
|
//console.log(this.windowWidth);
|
|
@@ -97,6 +104,12 @@
|
|
|
this.getUsernamePassword();
|
|
|
},
|
|
|
computed: {
|
|
|
+ sisStageIp: function() {
|
|
|
+ return this.$store.state.wholeSituationBackStageIp;
|
|
|
+ },
|
|
|
+ sisStagePort: function() {
|
|
|
+ return this.$store.state.wholeSituationBackStagePort;
|
|
|
+ },
|
|
|
backStageIp: function() {
|
|
|
return this.$store.state.wholeSituationBackStageIp;
|
|
|
},
|
|
@@ -114,9 +127,14 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
showPass(e) {
|
|
|
this.passwordShow = e;
|
|
|
},
|
|
|
+ destroyUseWebViews() {
|
|
|
+ this.$refs.mywebview.destroyUseWebViews();
|
|
|
+
|
|
|
+ },
|
|
|
usernameInput(e) {
|
|
|
if (e.detail.value != "") {
|
|
|
this.usernameFlag = true;
|
|
@@ -249,76 +267,264 @@
|
|
|
title: "请先用密码登录!"
|
|
|
});
|
|
|
}
|
|
|
- },
|
|
|
- getUsernamePassword: function() {
|
|
|
- this.lastUserName = uni.getStorageSync('gyeeusername');
|
|
|
- this.lastPassWord = uni.getStorageSync('gyeepassword');
|
|
|
- if (this.lastUserName != '' && this.lastPassWord != '') {
|
|
|
- uni.switchTab({
|
|
|
- url: '/pages/index/Index'
|
|
|
+ },getFingerPrintPassword: function() {
|
|
|
+ let _this = this;
|
|
|
+ if (uni.getStorageSync('fingerPrintname') != '' && uni.getStorageSync('fingerPrintpassword') != '') {
|
|
|
+
|
|
|
+ uni.setStorageSync('gyeeusername', uni.getStorageSync('fingerPrintname'));
|
|
|
+ uni.setStorageSync('gyeepassword', uni.getStorageSync('fingerPrintpassword'));
|
|
|
+ uni.setStorageSync('userid', uni.getStorageSync('fingerPrintuserid'));
|
|
|
+
|
|
|
+
|
|
|
+ this.username = uni.getStorageSync('gyeeusername');
|
|
|
+ this.password = uni.getStorageSync('gyeepassword');
|
|
|
+ uni.request({
|
|
|
+ url: 'http://' + this.backStageIp + ':' + this.backStagePort + '/GyeeuserController/login?username=' + this.username +
|
|
|
+ '&password=' + this.password,
|
|
|
+ data: {},
|
|
|
+ method: 'GET',
|
|
|
+ success: function(res) {
|
|
|
+ //console.log(res.data);
|
|
|
+ _this.userid = res.data.data;
|
|
|
+
|
|
|
+
|
|
|
+ uni.setStorageSync('userid', _this.userid);
|
|
|
+ uni.setStorageSync('fingerPrintuserid', _this.userid);
|
|
|
+ //sessionStorage.setItem('userid',_this.userid);
|
|
|
+ if (res.data.code == 200) {
|
|
|
+
|
|
|
+
|
|
|
+ _this.dataprocessing.viewUserid();
|
|
|
+ _this.dataprocessing.monitoringAuthority();
|
|
|
+
|
|
|
+
|
|
|
+ _this.createUserOnline();
|
|
|
+ _this.setUsernamePassword();
|
|
|
+ _this.loginFalg = true;
|
|
|
+ _this.lastUserName = _this.username;
|
|
|
+ _this.lastPassWord = _this.password;
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/index/Index'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ content: '用户名密码输入错误,请核对'
|
|
|
+ });
|
|
|
+ _this.username = '';
|
|
|
+ _this.password = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ _this.tips = '网络错误,小程序端请检查合法域名';
|
|
|
+ }
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
+ // getUsernamePassword: function() {
|
|
|
+ // this.lastUserName = uni.getStorageSync('gyeeusername');
|
|
|
+ // this.lastPassWord = uni.getStorageSync('gyeepassword');
|
|
|
+
|
|
|
+ // this.createUserOnline();
|
|
|
+
|
|
|
+ // if (this.lastUserName != '' && this.lastPassWord != '') {
|
|
|
+ // uni.switchTab({
|
|
|
+ // url: '/pages/index/Index'
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
removeUsernamePassword: function() {
|
|
|
uni.removeStorageSync('gyeeusername');
|
|
|
uni.removeStorageSync('gyeepassword');
|
|
|
//uni.removeStorageSync('userid');
|
|
|
+ },getUsernamePassword: function() {
|
|
|
+ let _this = this;
|
|
|
+ this.username = uni.getStorageSync('gyeeusername');
|
|
|
+ this.password = uni.getStorageSync('gyeepassword');
|
|
|
+ if(this.username!="" && this.password!="")
|
|
|
+ {
|
|
|
+ uni.request({
|
|
|
+ url: 'http://' + this.backStageIp + ':' + this.backStagePort + '/GyeeuserController/login?username=' + this.username +
|
|
|
+ '&password=' + this.password,
|
|
|
+ data: {},
|
|
|
+ method: 'GET',
|
|
|
+ success: function(res) {
|
|
|
+ //console.log(res.data);
|
|
|
+ _this.userid = res.data.data;
|
|
|
+
|
|
|
+
|
|
|
+ uni.setStorageSync('userid', _this.userid);
|
|
|
+ uni.setStorageSync('fingerPrintuserid', _this.userid);
|
|
|
+ //sessionStorage.setItem('userid',_this.userid);
|
|
|
+ if (res.data.code == 200) {
|
|
|
+
|
|
|
+
|
|
|
+ _this.dataprocessing.viewUserid();
|
|
|
+ _this.dataprocessing.monitoringAuthority();
|
|
|
+
|
|
|
+ // let plusDrawerList = uni.getStorageSync('plusList');
|
|
|
+
|
|
|
+ // _this.dataprocessing.putWindPowerStationId(plusDrawerList[0].windId);
|
|
|
+ // _this.dataprocessing.putWindPowerStationName(plusDrawerList[0].name);
|
|
|
+
|
|
|
+ // if(_this.dataprocessing.getWindPowerStationId()=='')
|
|
|
+ // {
|
|
|
+ // //debugger
|
|
|
+ // _this.dataprocessing.putWindPowerStationId(_this.$store.state.default_wpid);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if(_this.dataprocessing.getWindPowerStationName()=='')
|
|
|
+ // {
|
|
|
+ // //debugger
|
|
|
+ // _this.dataprocessing.putWindPowerStationName(_this.$store.state.default_wpname);
|
|
|
+ // }
|
|
|
+ _this.createUserOnline();
|
|
|
+ _this.setUsernamePassword();
|
|
|
+ _this.loginFalg = true;
|
|
|
+ _this.lastUserName = _this.username;
|
|
|
+ _this.lastPassWord = _this.password;
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/index/Index'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ content: '用户名密码输入错误,请核对'
|
|
|
+ });
|
|
|
+ _this.username = '';
|
|
|
+ _this.password = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ _this.tips = '网络错误,小程序端请检查合法域名';
|
|
|
+ },
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
+
|
|
|
login: function() {
|
|
|
let _this = this;
|
|
|
- uni.request({
|
|
|
- url: 'http://' + this.backStageIp + ':' + this.backStagePort + '/GyeeuserController/login?username=' + this.username +
|
|
|
- '&password=' + this.password,
|
|
|
- data: {},
|
|
|
- method: 'GET',
|
|
|
- success: function(res) {
|
|
|
- //console.log(res.data);
|
|
|
- _this.userid = res.data.data;
|
|
|
-
|
|
|
-
|
|
|
- uni.setStorageSync('userid', _this.userid);
|
|
|
- uni.setStorageSync('fingerPrintuserid', _this.userid);
|
|
|
- //sessionStorage.setItem('userid',_this.userid);
|
|
|
- if (res.data.code == 200) {
|
|
|
-
|
|
|
-
|
|
|
- _this.dataprocessing.viewUserid();
|
|
|
- _this.dataprocessing.monitoringAuthority();
|
|
|
-
|
|
|
- // let plusDrawerList = uni.getStorageSync('plusList');
|
|
|
+
|
|
|
+ if(this.username!="" && this.password!="")
|
|
|
+ {
|
|
|
+ uni.request({
|
|
|
+ url: 'http://' + this.backStageIp + ':' + this.backStagePort + '/GyeeuserController/login?username=' + this.username +
|
|
|
+ '&password=' + this.password,
|
|
|
+ data: {},
|
|
|
+ method: 'GET',
|
|
|
+ success: function(res) {
|
|
|
+ //console.log(res.data);
|
|
|
+ _this.userid = res.data.data;
|
|
|
+
|
|
|
+
|
|
|
+ uni.setStorageSync('userid', _this.userid);
|
|
|
+ uni.setStorageSync('fingerPrintuserid', _this.userid);
|
|
|
+ //sessionStorage.setItem('userid',_this.userid);
|
|
|
+ if (res.data.code == 200) {
|
|
|
+
|
|
|
+
|
|
|
+ _this.dataprocessing.viewUserid();
|
|
|
+ _this.dataprocessing.monitoringAuthority();
|
|
|
+
|
|
|
+ // let plusDrawerList = uni.getStorageSync('plusList');
|
|
|
+
|
|
|
+ // _this.dataprocessing.putWindPowerStationId(plusDrawerList[0].windId);
|
|
|
+ // _this.dataprocessing.putWindPowerStationName(plusDrawerList[0].name);
|
|
|
+
|
|
|
+ // if(_this.dataprocessing.getWindPowerStationId()=='')
|
|
|
+ // {
|
|
|
+ // //debugger
|
|
|
+ // _this.dataprocessing.putWindPowerStationId(_this.$store.state.default_wpid);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if(_this.dataprocessing.getWindPowerStationName()=='')
|
|
|
+ // {
|
|
|
+ // //debugger
|
|
|
+ // _this.dataprocessing.putWindPowerStationName(_this.$store.state.default_wpname);
|
|
|
+ // }
|
|
|
+ _this.createUserOnline();
|
|
|
+ _this.setUsernamePassword();
|
|
|
+ _this.loginFalg = true;
|
|
|
+ _this.lastUserName = _this.username;
|
|
|
+ _this.lastPassWord = _this.password;
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/index/Index'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ content: '用户名密码输入错误,请核对'
|
|
|
+ });
|
|
|
+ _this.username = '';
|
|
|
+ _this.password = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ _this.tips = '网络错误,小程序端请检查合法域名';
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ uni.showToast({
|
|
|
+ title: "用户名和密码不能为空!",
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ async createUserOnline() {
|
|
|
+ let _this = this;
|
|
|
+
|
|
|
+ let userid=uni.getStorageSync('userid');
|
|
|
+ // 创建一个this.socketTask对象【发送、接收、关闭socket都由这个对象操作】
|
|
|
+ _this.socketTask_getUserList = uni.connectSocket({
|
|
|
+ // 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】
|
|
|
+ url: 'ws://' + _this.sisStageIp + ':' + _this.sisStagePort + '/websocket/pageNumber_4/functionNumber_5/'+userid,
|
|
|
+ success(data) {
|
|
|
+ console.log(data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /* let windpowerstationid = uni.getStorageSync('windpowerstationName'); */
|
|
|
+ // 消息的发送和接收必须在正常连接打开中,才能发送或接收【否则会失败】
|
|
|
+ _this.socketTask_getUserList.onOpen(res => {
|
|
|
+ console.log('WebSocket连接正常打开中...!');
|
|
|
+ _this.is_open_socket = true;
|
|
|
+
|
|
|
+ // 注:只有连接正常打开中 ,才能正常收到消息
|
|
|
+ _this.socketTask_getUserList.onMessage(res => {
|
|
|
+ /* _this.windpowerstationdetail.getUserList = JSON.parse(res.data); */
|
|
|
+ _this.lastUserName = uni.getStorageSync('gyeeusername');
|
|
|
+ _this.userid = uni.getStorageSync('userid');
|
|
|
+ let templist=JSON.parse(res.data);
|
|
|
+
|
|
|
+ if(templist!=null && templist!=undefined)
|
|
|
+ {
|
|
|
+ uni.showToast({
|
|
|
+ title: "同名用户登录,当前用户下线!",
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
|
|
|
- // _this.dataprocessing.putWindPowerStationId(plusDrawerList[0].windId);
|
|
|
- // _this.dataprocessing.putWindPowerStationName(plusDrawerList[0].name);
|
|
|
+
|
|
|
|
|
|
- // if(_this.dataprocessing.getWindPowerStationId()=='')
|
|
|
- // {
|
|
|
- // //debugger
|
|
|
- // _this.dataprocessing.putWindPowerStationId(_this.$store.state.default_wpid);
|
|
|
- // }
|
|
|
-
|
|
|
- // if(_this.dataprocessing.getWindPowerStationName()=='')
|
|
|
- // {
|
|
|
- // //debugger
|
|
|
- // _this.dataprocessing.putWindPowerStationName(_this.$store.state.default_wpname);
|
|
|
- // }
|
|
|
- _this.setUsernamePassword();
|
|
|
- _this.loginFalg = true;
|
|
|
- _this.lastUserName = _this.username;
|
|
|
- _this.lastPassWord = _this.password;
|
|
|
- uni.switchTab({
|
|
|
- url: '/pages/index/Index'
|
|
|
- });
|
|
|
- } else {
|
|
|
- uni.showModal({
|
|
|
- content: '用户名密码输入错误,请核对'
|
|
|
+ //plus.runtime.quit();
|
|
|
+ //#ifdef H5
|
|
|
+ _this.destroyUseWebViews();
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/components/login/Login'
|
|
|
});
|
|
|
- _this.username = '';
|
|
|
- _this.password = '';
|
|
|
+ //#endif
|
|
|
+ //#ifdef APP-PLUS
|
|
|
+ setTimeout(function() {
|
|
|
+ plus.runtime.quit()
|
|
|
+ }, 1000);//如果是首页的onload调用时需要延时一下,二级页面无需延时,可直接获取
|
|
|
+ //#endif
|
|
|
}
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- _this.tips = '网络错误,小程序端请检查合法域名';
|
|
|
- }
|
|
|
+ //_this.userList = JSON.parse(res.data);
|
|
|
+
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
checkIsSoterEnrolledInDeviceFingerPrint() {
|
|
@@ -337,6 +543,7 @@
|
|
|
//_this.setUsernamePassword();
|
|
|
//_this.loginFalg = true;
|
|
|
//_this.getUser()
|
|
|
+ _this.createUserOnline();
|
|
|
_this.getFingerPrintPassword();
|
|
|
} else {
|
|
|
uni.showToast({
|