Browse Source

bug修改

1004749546@qq.com 4 years ago
parent
commit
03804012ae
2 changed files with 9 additions and 6 deletions
  1. 0 5
      pages/goods/index.vue
  2. 9 1
      pagesA/goods/goods.vue

+ 0 - 5
pages/goods/index.vue

@@ -65,11 +65,6 @@
 			// 是否登录
 			checkLogin().then(res => {
 				this.hasLogin = res.status == 200
-				// if(res.status != 200){
-				// 	uni.navigateTo({
-				// 		url:"/pages/login/login"
-				// 	})
-				// }
 			})
 		},
 		// 下拉刷新

+ 9 - 1
pagesA/goods/goods.vue

@@ -2,7 +2,7 @@
 	<view class="content">
 		<view v-if="goldLimit>0" class="info">该类商品需购满{{goldLimit}}乐豆才能下单哦!</view>
 		<view v-if="goodsList.length">
-			<uni-coods :list="goodsList"></uni-coods>
+			<uni-coods :hasLogin="hasLogin" :list="goodsList"></uni-coods>
 			<view class="loadmore"><u-loadmore @loadmore="loadmore" :status="status" /></view>
 		</view>
 		<!-- 购物车 -->
@@ -14,6 +14,7 @@
 	import {
 		getGoodsList
 	} from '@/api/goods.js'
+	import {checkLogin} from '@/api/login.js'
 	export default {
 		data() {
 			return {
@@ -26,6 +27,7 @@
 				status: 'loadmore',
 				count: 0,
 				dragPic: '/static/cart.png',  //  购物车图标
+				hasLogin: false
 			};
 		},
 		onLoad(opts) {
@@ -51,6 +53,12 @@
 				uni.stopPullDownRefresh()
 			}, 200)
 		},
+		onShow() {
+			// 是否登录
+			checkLogin().then(res => {
+				this.hasLogin = res.status == 200
+			})
+		},
 		methods: {
 			// 查询商品
 			getGoods(item,index){