ソースを参照

登录流程修改

lilei 4 年 前
コミット
dcb63f7765
6 ファイル変更38 行追加23 行削除
  1. 1 1
      App.vue
  2. 6 6
      pages.json
  3. 5 10
      pages/index/index.vue
  4. 15 3
      pages/login/login.vue
  5. 3 0
      pages/login/phoneLogin.vue
  6. 8 3
      pages/userCenter/index.vue

+ 1 - 1
App.vue

@@ -1,6 +1,6 @@
 <script>
 	// const uat_URL = 'https://carwash.test.zyucgj.com/gc-shop/' // 预发布
-	const uat_URL = 'http://192.168.16.102:8302/gc-shop/' // 本地
+	const uat_URL = 'http://192.168.16.104:8302/gc-shop/' // 本地
 	const pro_URL = 'https://carwash.zyucgj.com/gc-shop/'  // 生产
 	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url

+ 6 - 6
pages.json

@@ -4,23 +4,23 @@
 	},
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
-			"path": "pages/index/index", // 首页
+			"path": "pages/login/login",
 			"style": {
-				"navigationBarTitleText": "乐色管家",
-				"enablePullDownRefresh": false
+				"navigationBarTitleText": "授权登录"
 			}
 		},
 		{
-			"path": "pages/goods/index", // 商城
+			"path": "pages/index/index", // 首页
 			"style": {
 				"navigationBarTitleText": "乐色管家",
 				"enablePullDownRefresh": false
 			}
 		},
 		{
-			"path": "pages/login/login",
+			"path": "pages/goods/index", // 商城
 			"style": {
-				"navigationBarTitleText": "授权登录"
+				"navigationBarTitleText": "乐色管家",
+				"enablePullDownRefresh": false
 			}
 		},
 		{

+ 5 - 10
pages/index/index.vue

@@ -80,14 +80,6 @@
 			}
 		},
 		onLoad() {
-			// 是否登录
-			checkLogin().then(res => {
-				console.log(res,'checkLogin')
-				this.hasLogin = res.status == 200
-				if(!this.hasLogin){
-					this.toLoginPage()
-				}
-			})
 			// 获取订单状态数据字典
 			this.getCodeList('RUBBISH_TYPE','vuex_rubbishType')
 			// 获取顶部轮播图
@@ -114,12 +106,15 @@
 			})
 		},
 		onShow() {
-			
+			// 是否登录
+			checkLogin().then(res => {
+				console.log(res,'checkLogin')
+				this.hasLogin = res.status == 200
+			})
 		},
 		methods: {
 			// 获取用户信息
 			getUserInfo(){
-				console.log('getUserInfogetUserInfogetUserInfo')
 				getUserInfo().then(res => {
 					if(res.status == 200){
 						this.$u.vuex("vuex_userData",res.data)

+ 15 - 3
pages/login/login.vue

@@ -9,9 +9,13 @@
 					微信登陆
 				</u-button>
 				<u-gap height="30"></u-gap>
-				<u-button shape="circle" plain :custom-style="phoneButton" class="login-btn" @click="phoneLogin" type="info">
+				<u-button shape="circle" :custom-style="phoneButton" class="login-btn" @click="phoneLogin" type="primary">
 					手机号码登录
 				</u-button>
+				<u-gap height="60"></u-gap>
+				<u-button shape="circle" plain lass="login-btn" @click="cansel" type="info">
+					暂不登录
+				</u-button>
 			</view>
 		</view>
 		<view @click="toYs">登录即代表同意<text>隐私政策</text>和<text>服务条款</text></view>
@@ -33,7 +37,7 @@
 					background: '#07c160'
 				},
 				phoneButton: {
-					background: '#ffffff'
+					background: '#00aaff'
 				}
 			}
 		},
@@ -53,7 +57,15 @@
 				this.path = decodeURIComponent(path);
 			}
 		},
+		onUnload() {
+			uni.$off('getUserInfo')
+		},
 		methods: {
+			cansel(){
+				uni.reLaunch({
+					url: '/pages/index/index'
+				})
+			},
 			toYs(){
 				uni.navigateTo({
 					url: '/pages/agreement/agreement'
@@ -154,7 +166,7 @@
 				justify-content: center;
 			}
 			.login-btns{
-				padding: 30upx 0;
+				padding: 60upx 0;
 				.login-btn{
 					margin: 30upx 0;
 				}

+ 3 - 0
pages/login/phoneLogin.vue

@@ -52,6 +52,9 @@
 		},
 		onLoad(opts) {
 		},
+		onUnload() {
+			uni.$off('getUserInfo')
+		},
 		methods: {
 			//   登录
 			submitFn(){

+ 8 - 3
pages/userCenter/index.vue

@@ -7,7 +7,7 @@
 				<u-image v-show="!hasLogin" src="/static/logo.png" width="100" height="100"></u-image>
 			</view>
 			<view class="user-info">
-				<text v-show="hasLogin">{{userData.mobile||'--'}}</text>
+				<text v-show="hasLogin">{{user.mobile||'--'}}</text>
 				<u-button v-show="!hasLogin" plain size="mini" shape="circle" @click="toLoginPage">登录</u-button>
 			</view>
 			<view v-if="hasLogin">
@@ -16,7 +16,7 @@
 		</view>
 		<view class="my-ledou" v-if="hasLogin">
 			<view class="user-jifen">
-				<view>我的乐豆:<text>{{userData.currentGold||0}}</text></view>
+				<view>我的乐豆:<text>{{user.currentGold||0}}</text></view>
 				<u-image mode="scaleToFill" width="35rpx" height="35rpx" src="/static/ledou.png"></u-image>
 			</view>
 			<view>
@@ -51,10 +51,15 @@
 				console.log(res,'checkLogin')
 				this.hasLogin = res.status == 200
 				if(this.hasLogin){
-					// this.getUserInfo()
+					this.getUserInfo()
 				}
 			})
 		},
+		computed: {
+			user() {
+				return this.userData 
+			}
+		},
 		onLoad() {
 		},
 		methods:{