ソースを参照

Merge branch 'develop_yh2.0' of chelingzhu-web/zxyj-mini-html into master

lilei 4 年 前
コミット
bbcc14faec

+ 29 - 7
pages/goods/index.vue

@@ -14,9 +14,13 @@
 					<uni-coods :goldLimit="item.type.goldLimit" :list="item.list"></uni-coods>
 				</view>
 			</view>
-			<view v-if="goodsListLength==0">
+			<view v-if="goodsListLength==0&&hasLogin">
 				<u-empty icon-size="60" :text="noDataText" mode="list"></u-empty>
 			</view>
+			<view class="nologin" v-if="!hasLogin"> 
+				<view>您还未登录,请登录后再浏览商品</view>
+				<u-button plain size="mini" shape="circle" @click="toLoginPage">立即登录</u-button>
+			</view>
 		</view>
 		<!-- 购物车 -->
 		<uni-cart-fix :dragPic="dragPic"></uni-cart-fix>
@@ -40,6 +44,7 @@
 				goodsList:[], // 商品
 				goodsType:[], // 商品分类
 				dragPic: '/static/cart.png',  //  购物车图标
+				hasLogin: false
 			}
 		},
 		onLoad() {
@@ -59,11 +64,12 @@
 		onShow() {
 			// 是否登录
 			checkLogin().then(res => {
-				if(res.status != 200){
-					uni.navigateTo({
-						url:"/pages/login/login"
-					})
-				}
+				this.hasLogin = res.status == 200
+				// if(res.status != 200){
+				// 	uni.navigateTo({
+				// 		url:"/pages/login/login"
+				// 	})
+				// }
 			})
 		},
 		// 下拉刷新
@@ -115,7 +121,7 @@
 			clickBanner(index){
 				let row = this.imageTopList[index]
 				console.log(index,row)
-				if(row.jumpType !== 'NONE'){
+				if(row.jumpType !== 'NONE' && this.hasLogin){
 					// 跳外网地址
 					if(row.jumpUrl.indexOf('http') == 0){
 						
@@ -126,6 +132,8 @@
 							url: row.jumpUrl
 						})
 					}
+				}else{
+					this.toLoginPage()
 				}
 			},
 			// 获取banner
@@ -142,6 +150,11 @@
 					url:"/pagesA/goods/goods?goodsTypeNo="+ item.goodsTypeNo + "&goldLimit="+ item.goldLimit + "&name=" + item.name
 				})
 			},
+			toLoginPage(){
+				uni.navigateTo({
+					url: '/pages/login/login'
+				})
+			}
 		}
 	}
 </script>
@@ -162,6 +175,15 @@
 					padding-top: 5upx;
 				}
 			}
+			.nologin{
+				padding: 50upx 0;
+				text-align: center;
+				>view{
+					padding: 30upx 0;
+					font-size: 0.8em;
+					color: #666;
+				}
+			}
 		}
 		.t1{
 			padding: 20upx 0;

+ 3 - 1
pages/index/index.vue

@@ -274,7 +274,7 @@
 			clickBanner(index){
 				let row = this.imageTopList[index]
 				console.log(index,row)
-				if(row.jumpType !== 'NONE'){
+				if(row.jumpType !== 'NONE' && this.hasLogin){
 					// 如果是大转盘
 					if(row.jumpUrl.indexOf('pagesA/luckDraw') >= 0){
 						if(this.showFixedLottery){
@@ -292,6 +292,8 @@
 							url: row.jumpUrl
 						})
 					}
+				}else{
+					this.toLoginPage()
 				}
 			},
 			// 查询购物车

+ 3 - 3
pages/userCenter/index.vue

@@ -54,9 +54,9 @@
 				if(this.hasLogin){
 					this.getUserInfo()
 				}else{
-					uni.navigateTo({
-						url:"/pages/login/login"
-					})
+					// uni.navigateTo({
+					// 	url:"/pages/login/login"
+					// })
 				}
 			})
 		},

+ 8 - 2
pagesA/giftCard/giftCard.vue

@@ -13,7 +13,7 @@
 				<image class="module-header-bg" src="/static/giftcard/module-header-bg.png"></image>
 				<view class="giftcard-main recharge-code">
 					<view class="inp-con">
-						<u-input v-model="rechargeCode" placeholder="请输入充值码" :maxlength="8" input-align="center" />
+						<u-input v-model="rechargeCode" placeholder="请输入充值码" :maxlength="9" input-align="center" />
 					</view>
 					<u-button class="recharge-btn" shape="circle" :custom-style="customBtnStyle" hover-class="none" @click="goRecharge">立即充值</u-button>
 				</view>
@@ -78,6 +78,11 @@
 			this.rechargeCode = ''
 		},
 		methods: {
+			// 校验卡号输入,只能输入字母和数字
+			vailRcode(event){
+				console.log(event)
+				this.rechargeCode = event.replace(/[^\w\.\/]/ig,'')
+			},
 			//  立即充值
 			goRecharge(){
 				if(!this.rechargeCode){
@@ -87,7 +92,8 @@
 					})
 					return
 				}
-				giftCardUseCard({ sequence: this.rechargeCode }).then(res => {
+				let sequence = this.rechargeCode.replace(/[^\w\.\/]/ig,'')
+				giftCardUseCard({ sequence }).then(res => {
 					if(res.status == 200){
 						this.ldNum = res.data
 						this.messagePop = true

+ 1 - 1
store/index.js

@@ -115,7 +115,7 @@ const store = new Vuex.Store({
 		vuex_netStatus: '',
 		// 客服电话
 		vuex_kfMobile: '4008826012',
-		vuex_noLogin: false,
+		vuex_noLogin: true,
 		vuex_isClick: false,
 		// 大转盘
 		vuex_LuckDraw: null,