Browse Source

退出登录

littlegreen 2 years ago
parent
commit
7ab5823243

+ 52 - 8
pages/menus/menu/menu.vue

@@ -109,21 +109,65 @@
 					title: '系统提示',
 					content: '是否确认退出登录?',
 					success (res) {
+						uni.showLoading({
+							title:'正在退出登录中',
+							icon:'none',
+							mask:true
+						})
 						if (res.confirm) {
-							logout().then(res=>{
-								if(res.data.code===200&&res.data.msg==="退出成功"){
-									uni.reLaunch({
-										url:'/pages/home/home'
-									})
-								}
-							})
+							try{
+								logout().then(res=>{
+									if(res.data.code===200&&res.data.msg==="退出成功"){
+										uni.hideLoading()
+										uni.reLaunch({
+											url:'/pages/home/home'
+										})
+									}
+								})
+							}catch(err){
+								uni.hideLoading()
+							}
+							
 						} else if (res.cancel) {
+							uni.hideLoading()
 							console.log('用户点击取消')
 						}
+						
+					}
+				})
+				//#endif
+				//#ifndef MP-WEIXIN
+				uni.showModal({
+					title: '系统提示',
+					content: '是否确认退出登录?',
+					success (res) {
+						uni.showLoading({
+							title:'正在退出登录中',
+							icon:'none',
+							mask:true
+						})
+						if (res.confirm) {
+							try{
+								logout().then(res=>{
+									if(res.data.code===200&&res.data.msg==="退出成功"){
+										uni.hideLoading()
+										uni.reLaunch({
+											url:'/pages/home/home'
+										})
+									}
+								})
+							}catch(err){
+								uni.hideLoading()
+							}
+							
+						} else if (res.cancel) {
+							uni.hideLoading()
+							console.log('用户点击取消')
+						}
+						
 					}
 				})
 				//#endif
-				
 			}
 		},
 		onLoad() {

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/pages/menus/menu/menu.js.map


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/menus/menu/menu.js


Some files were not shown because too many files changed in this diff