From 7b76391180904d58156aef13abcac0256ff7fcc1 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 23 九月 2022 10:07:56 +0800
Subject: [PATCH] 1.登出接口接入
---
pages/xtsy/index.html | 9 ++++
pages/login/index.html | 13 ++----
pages/sbgl/rcdj.html | 10 ++++
js/global.js | 46 +++++++++++++++++------
4 files changed, 55 insertions(+), 23 deletions(-)
diff --git a/js/global.js b/js/global.js
index 70ec3bb..0ad3afc 100644
--- a/js/global.js
+++ b/js/global.js
@@ -1,14 +1,36 @@
(function(w) {
- // 鏍煎紡鍖栧湴鍧�鏍忓弬鏁� 灏嗗璞¤嚜鍔ㄦ嫾鎺ユ垚鍦板潃鏍忎紶鍙傚舰寮�
- w.formatParams = function() {
- const data = {
- userid: 33,
- usercode: '002',
- username: '寮犱笁',
- usertype: 'APP'
- }
- return data;
+ // 鏍煎紡鍖栧湴鍧�鏍忓弬鏁� 灏嗗璞¤嚜鍔ㄦ嫾鎺ユ垚鍦板潃鏍忎紶鍙傚舰寮�
+ w.formatParams = function(data) {
+ let temp = ''
+ Object.keys(data).map((key, index) => {
+ temp += '&' + key + '=' + data[key]
+ })
+ let firstCharAt = temp.charAt(0)
+ temp = temp.replace(firstCharAt, '?')
+ return temp;
}
-
-
-})(window);
\ No newline at end of file
+
+ w.topPopoverClick = function(type) {
+
+ if (type === '鎿嶄綔鎸囧') {
+ console.log('鎿嶄綔鎸囧')
+ } else if (type === '鎴愬搧杩芥函') {
+ console.log('鎴愬搧杩芥函')
+ } else if (type === '閫�鍑虹櫥褰�') {
+ const data = {
+ userid: localStorage.getItem('userid'),
+ usercode: localStorage.getItem('usercode'),
+ username: localStorage.getItem('username'),
+ usertype: localStorage.getItem('usertype')
+ }
+ post('Login/LoginAppOut' + formatParams(data)).then(res => {
+ if (res.code === '200') {
+ window.location.href = '../login/index.html'
+ }
+ })
+ }
+
+ // return 1
+ }
+
+})(window);
diff --git a/pages/login/index.html b/pages/login/index.html
index 92af73e..32502d1 100644
--- a/pages/login/index.html
+++ b/pages/login/index.html
@@ -50,7 +50,8 @@
</van-field>
</div>
<div style="margin-top:30px;">
- <van-button type="info" style="border-radius: 10px;" @click='loginClick' size="large">绔嬪嵆鐧诲綍
+ <van-button type="info" style="border-radius: 10px;" :disabled="username===''||password===''"
+ @click='loginClick' size="large">绔嬪嵆鐧诲綍
</van-button>
</div>
</div>
@@ -73,7 +74,7 @@
},
mounted() {
- console.log(formatParams(),1)
+
},
methods: {
loginClick() {
@@ -105,18 +106,12 @@
username: res.data.username,
usertype: res.data.usertype
}
-
-
- post('Login/ForcedOffline?userid=' + res.data.userid + '&usercode=' + res.data
- .usercode + '&username=' + res.data.username + '&usertype=' + res.data
- .usertype).then(res2 => {
+ post('Login/ForcedOffline' + formatParams(data2)).then(res2 => {
if (res2.code === '200') {
this.loginClick()
}
-
})
}
-
}).catch(err => {
console.log(err);
});
diff --git a/pages/sbgl/rcdj.html b/pages/sbgl/rcdj.html
index a00c143..da60ea7 100644
--- a/pages/sbgl/rcdj.html
+++ b/pages/sbgl/rcdj.html
@@ -19,6 +19,8 @@
<script type="text/javascript" src="../../js/common.js"></script>
+ <script type="text/javascript" src="../../js/global.js"></script>
+
<!-- <link rel="stylesheet" href="../../css/global.css" type="text/css" charset="utf-8" /> -->
<script type="text/javascript">
@@ -518,7 +520,13 @@
this.overlayShow = true
},
onSelect(action) {
- vant.Toast(action.text);
+ if(action.text==='鎿嶄綔鎸囧'){
+ topPopoverClick('鎿嶄綔鎸囧')
+ }else if(action.text==='鎴愬搧杩芥函'){
+ topPopoverClick('鎴愬搧杩芥函')
+ }else if(action.text==='閫�鍑虹櫥褰�'){
+ topPopoverClick('閫�鍑虹櫥褰�')
+ }
this.overlayShow = false
},
}
diff --git a/pages/xtsy/index.html b/pages/xtsy/index.html
index aec973f..453a6f7 100644
--- a/pages/xtsy/index.html
+++ b/pages/xtsy/index.html
@@ -21,6 +21,7 @@
<link rel="stylesheet" href="../css/global.css" type="text/css" charset="utf-8" />
+ <script type="text/javascript" src="../../js/global.js"></script>
</head>
<body>
@@ -150,7 +151,13 @@
},
// 椤堕儴鍙冲浘鏍囦笅鎷夐�夋嫨
onSelect(action) {
- vant.Toast(action.text);
+ if(action.text==='鎿嶄綔鎸囧'){
+ topPopoverClick('鎿嶄綔鎸囧')
+ }else if(action.text==='鎴愬搧杩芥函'){
+ topPopoverClick('鎴愬搧杩芥函')
+ }else if(action.text==='閫�鍑虹櫥褰�'){
+ topPopoverClick('閫�鍑虹櫥褰�')
+ }
this.overlayShow = false
},
}
--
Gitblit v1.9.3