Forráskód Böngészése

登录规范修改

zhaoxw 4 éve
szülő
commit
6410a9b398
3 módosított fájl, 42 hozzáadás és 13 törlés
  1. 5 7
      pages/index/index.vue
  2. 13 6
      pages/index/login.vue
  3. 24 0
      pages/user/index.vue

+ 5 - 7
pages/index/index.vue

@@ -112,13 +112,11 @@
 					this.swiperHeight = res.windowWidth / 2
 				}
 			})
-			if (!uni.getStorageSync('token')) {
-				uni.reLaunch({
-					url: '/pages/index/login'
-				});
-			}
-			// this.getBaseInfo()
-			// this.getPreferGoodsList()
+			// if (!uni.getStorageSync('token')) {
+			// 	uni.reLaunch({
+			// 		url: '/pages/index/login'
+			// 	});
+			// }
 		},
 		onShow() {
 			this.getBaseInfo()

+ 13 - 6
pages/index/login.vue

@@ -16,14 +16,17 @@
 			<!-- <view class="authorize-login" @click="getUserInfo">登录</view> -->
 			<!-- #ifdef MP-WEIXIN -->
 			<button class="authorize-login" open-type="getUserInfo" @getuserinfo="getUserinfoWechat" withCredentials="true">
-				登录
+				微信一键登录
 			</button>
 			<!-- #endif -->
 			<!-- #ifdef APP-PLUS -->
 			<button class="authorize-login" @click="getUserinfoApp">
-				登录
+				微信一键登录
 			</button>
 			<!-- #endif -->
+			<button class="authorize-login" @click="goIndex">
+				再逛逛
+			</button>
 			<view @click="showAgreement = true" class="agreement">点击登录视为同意<text class="underline">平台服务协议</text></view>
 		</view>
 		{{tipxx}}
@@ -165,6 +168,11 @@
 			})
 		},
 		methods: {
+			goIndex() {
+				uni.switchTab({
+				    url: '/pages/index/index'
+				});
+			},
 			// getPhoneNumber(e) {
 			// 	if (this.wxLoginData) {
 			// 		let _that = this
@@ -209,7 +217,7 @@
 								fail: (error) => {
 									console.log(33333, error)
 									this.$refs.uTips.show({
-										title: '微信登录授权失败',
+										title: '微信登录授权失败,请再试试',
 										type: 'warning',
 									})
 								}
@@ -266,7 +274,7 @@
 								fail: (error) => {
 									console.log(2222, error)
 									that.$refs.uTips.show({
-										title: '微信登录授权失败',
+										title: '微信登录授权失败,请再试试',
 										type: 'warning',
 									})
 								}
@@ -305,7 +313,6 @@
 
 			// 发请求获取个人数据 envType:1小程序 0:app
 			getUserInfo(envType) {
-				debugger
 				console.log('发请求获取个人数据envType',envType)
 				NET.request(API.WxLogin, {
 					...this.wxLoginData,
@@ -333,7 +340,7 @@
 				}).catch(error => {
 					console.log(44444, error)
 					this.$refs.uTips.show({
-						title: '微信登录授权失败',
+						title: '微信登录授权失败,请再试试',
 						type: 'warning',
 					})
 				})

+ 24 - 0
pages/user/index.vue

@@ -75,6 +75,14 @@
 				<view class="item-btn-text">关于我们</view>
 				<view class="iconfont iconfangxiang"></view>
 			</view>
+			<view class="line-box" v-if="userData.userName">
+				<view class="split-line"></view>
+			</view>
+			<view class="item-btn" @click="loginOut()" v-if="userData.userName">
+				<view class="iconfont iconguanyu item-btn-icon"></view>
+				<view class="item-btn-text">退出登录</view>
+				<view class="iconfont iconfangxiang"></view>
+			</view>
 		</view>
 		<u-top-tips ref="uTips"></u-top-tips>
 	</view>
@@ -118,6 +126,22 @@
 			}, 500)
 		},
 		methods: {
+			// 注销
+			loginOut() {
+			    try {
+			        uni.clearStorageSync();
+					uni.reLaunch({
+						url: '/pages/index/login'
+					});
+			    } catch (e) {
+			        console.log(e, '退出登录')
+			    }
+			},
+			gologin() {
+				uni.reLaunch({
+					url: '/pages/index/login'
+				});
+			},
 			//  获取全部数据
 			getBaseData() {
 				NET.request(API.getMainInfo, {}, 'GET').then(res => {