dever 4 years ago
parent
commit
8fdaba281a
2 changed files with 57 additions and 83 deletions
  1. 47 72
      pages/index/index.vue
  2. 10 11
      pages/index/list.vue

+ 47 - 72
pages/index/index.vue

@@ -1,37 +1,42 @@
 <template>
 	<view class="container">
 		<view class="banner">
-			<image src="https://img-shop.qmimg.cn/s23107/2020/04/26/3eb7808bf105262604.jpg" mode="" class="bg"></image>
-			<view class="intro">
-				<view class="greet">您好,{{ isLogin ? member.nickname : '游客' }}</view>
-				<view class="note">一杯奶茶,一口软欧包,在奈雪遇见两种美好</view>
+			<image :src="fetch.config.home_top" mode="" class="bg"></image>
+			<view class="intro" v-if="fetch.user.id <= 0">
+				<view class="greet">您好,{{fetch.user.username}}</view>
+				<view class="note">{{fetch.config.info}}</view>
 			</view>
 		</view>
 		<view class="content">
-			<view class="entrance">
-				<view class="item" @tap="takein">
-					<image src="/static/images/index/zq.png" class="icon"></image>
-					<view class="title">记忆</view>
+			<view class="entrance" v-if="fetch.user.id > 0">
+				<view class="item" @tap="user">
+					<image :src="fetch.user.avatar" class="icon"></image>
+					<view class="title">{{fetch.user.username}}</view>
 				</view>
-				<view class="item" @tap="takeout">
+				<view class="item" @tap="jiyi">
 					<image src="/static/images/index/wm.png" class="icon"></image>
-					<view class="title">事件</view>
+					<view class="title">记忆</view>
+				</view>
+			</view>
+			<view class="entrance" v-if="fetch.user.id <= 0">
+				<view class="item" @tap="login">
+					<view class="title">登录</view>
 				</view>
 			</view>
 			<view class="info">
-				<view class="integral_section" @tap="integrals">
+				<view class="integral_section">
 					<view class="top">
-						<text class="title">我的余额</text>
-						<text class="value">411</text>
+						<text class="title">{{fetch.score.name}}</text>
+						<text class="value">{{fetch.score.score}}</text>
 					</view>
-					<view class="bottom">
-						进入商城兑换合小券及小记周边好礼
+					<view class="bottom" v-if="fetch.score.info">
+						{{fetch.score.info}}
 						<view class="iconfont iconarrow-right"></view>
 					</view>
 				</view>
-				<view class="qrcode_section" @tap="memberCode">
+				<view class="qrcode_section" @tap="invite">
 					<image src="/static/images/index/qrcode.png"></image>
-					<text>邀请码</text>
+					<text>身份证明</text>
 				</view>
 			</view>
 			<view class="navigators" style="display: none;">
@@ -67,12 +72,12 @@
 			<view class="member-news">
 				<view class="header">
 					<view class="title">小记宣传栏</view>
-					<view class="iconfont iconRightbutton"></view>
+					<view class="iconfont iconRightbutton" style="display: none;"></view>
 				</view>
 				<view class="list">
-					<view class="item">
-						<image src="https://img-shop.qmimg.cn/s23107/2020/04/27/0039bf41c9ebd50a2c.jpg"></image>
-						<view class="title">"梅"你不行 | 霸气杨梅清爽回归</view>
+					<view class="item" v-for="(v, k) in fetch.xuanchuan" :key="k" @click="xuanchuan(v.link)">
+						<image :src="v.pic"></image>
+						<view class="title">{{v.name}}</view>
 					</view>
 				</view>
 			</view>
@@ -81,82 +86,52 @@
 </template>
 
 <script>
-	import {mapState, mapGetters} from 'vuex'
-	
 	export default {
 		data() {
 			return {
 				fetch : {
 					user : {},
+					config : {
+						home_top : '',
+					},
+					score : {},
 				},
 			}
 		},
-		computed: {
-			...mapState(['member']),
-		},
 		onShow() {
-			//this.Dever.checkLogin();
-			this.getData(1);
+			this.getData();
 		},
 		// 重新加载
 		onPullDownRefresh: function() {
-			this.getData(1);
-		},
-		//下拉加载
-		onReachBottom() {
-			this.getData(2);
+			this.getData();
 		},
 		methods: {
-			getData : function(page) {
+			getData : function() {
 				this.Dever.get(this, 'app/collection/?l=api.home', {id:-1});
 			},
 			view : function(id) {
 				this.Dever.location('dream/index?id=' + id);
 			},
 			
-			takein() {
-				this.$store.commit('SET_ORDER_TYPE', 'takein')
-				uni.switchTab({
-					url: '/pages/menu/menu'
-				})
+			xuanchuan : function(link) {
+				this.Dever.location(link);
 			},
-			takeout() {
-				if(!this.isLogin) {
-					uni.navigateTo({url: '/pages/login/login'})
-					return
-				}
-				uni.navigateTo({
-					url: "/pages/address/address?is_choose=true"	
-				})
+			
+			login : function() {
+				this.Dever.location('user/login');
 			},
-			integrals() {
-				if(!this.isLogin) {
-					uni.navigateTo({url: '/pages/login/login'})
-					return
-				}
-				uni.navigateTo({
-					url: '/pages/integrals/integrals'
-				})
+			
+			jiyi : function() {
+				this.Dever.alert('敬请期待');
 			},
-			packages() {
-				uni.navigateTo({
-					url: '/pages/packages/index'
-				})
+			
+			user : function() {
+				
 			},
-			memberCode() {
-				if(!this.isLogin) {
-					uni.navigateTo({url: '/pages/login/login'})
-					return
-				}
-				uni.navigateTo({
-					url: '/pages/mine/member-code'
-				})
+			
+			invite : function() {
+				this.Dever.alert('敬请期待');
 			},
-			invite() {
-				uni.navigateTo({
-					url: '/pages/activities/invite'
-				})
-			}
 		}
 	}
 </script>

+ 10 - 11
pages/index/list.vue

@@ -13,9 +13,9 @@
 				<!-- goods list begin -->
 				<scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="top" @scroll="scoll">
 					<view class="wrapper">
-						<swiper class="ads" id="ads" autoplay :interval="3000" indicator-dots>
-							<swiper-item v-for="(item, index) in ads" :key='index'>
-								<image :src="item.image"></image>
+						<swiper class="ads" id="ads" autoplay :interval="3000" indicator-dots v-if="fetch.focus.length > 0">
+							<swiper-item v-for="(v, k) in fetch.focus" :key="k" @tap="go" :data-url="v.link">
+								<image :src="v.pic"></image>
 							</swiper-item>
 						</swiper>
 						<view class="list">
@@ -66,13 +66,6 @@ export default {
 				hot : [],
 			},
 			height : 'height:100%',
-			ads: [
-				{image: 'https://img-shop.qmimg.cn/s23107/2020/04/27/4ebdb582a5185358c4.jpg?imageView2/2/w/600/h/600'},
-				{image: 'https://images.qmai.cn/s23107/2020/05/08/c25de6ef72d2890630.png?imageView2/2/w/600/h/600'},
-				{image: 'https://img-shop.qmimg.cn/s23107/2020/04/10/add546c1b1561f880d.jpg?imageView2/2/w/600/h/600'},
-				{image: 'https://images.qmai.cn/s23107/2020/04/30/b3af19e0de8ed42f61.jpg?imageView2/2/w/600/h/600'},
-				{image: 'https://img-shop.qmimg.cn/s23107/2020/04/17/8aeb78516d63864420.jpg?imageView2/2/w/600/h/600'}
-			],
 			cate_index: 0,//默认分类
 			top: 0,
 			view: '',
@@ -99,7 +92,6 @@ export default {
 		getData : function() {
 			var self = this;
 			this.Dever.get(this, 'app/collection/?l=api.getList', {id:-1}, function(t) {
-				console.info(t);
 				uni.getSystemInfo({
 					success: function (res) {
 						self.height = 'height:' + res.windowHeight + 'px';
@@ -109,6 +101,13 @@ export default {
 		},
 		location : function(id) {
 			this.Dever.location('dream/index?id=' + id);
+		},
+		
+		go : function(e) {
+			var link = e.currentTarget.dataset.url;
+			if (link) {
+				this.Dever.location(link);
+			}
 		},
 		
 		menu : function(index, id) {