Commit 6fd90f2f authored by haiyoucuv's avatar haiyoucuv

init

parent 30d16745
...@@ -6,8 +6,8 @@ ComponentWithStore({ ...@@ -6,8 +6,8 @@ ComponentWithStore({
storeBindings: { storeBindings: {
store, store,
fields: { fields: {
homeInfo: () => store.homeInfo,
showPhoneBtn: () => !store.homeInfo.mobile, showPhoneBtn: () => !store.homeInfo.mobile,
activityInfo: () => store.activityInfo,
}, },
actions: {}, actions: {},
}, },
...@@ -33,15 +33,12 @@ ComponentWithStore({ ...@@ -33,15 +33,12 @@ ComponentWithStore({
prompt: "200毫升", prompt: "200毫升",
logo: "//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6logo.7ee8ec3fc21f699756f54512835ffd8d50a18bed.png", logo: "//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6logo.7ee8ec3fc21f699756f54512835ffd8d50a18bed.png",
}, },
].concat(new Array(2 + ~~(Math.random() * 10)).fill({ ]
img: "//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6.fd352be87520d04261ba36348022c36836e4c819.png",
introduce: "更多的鲜活营养,更好喝的鲜甜口感,更优质的牧场奶源,更安全的品质保障更多的鲜活营养,更好喝的鲜甜口感,更优质的牧场奶源,更安全的品质保障",
prompt: "200毫升",
logo: "//yun.duiba.com.cn/polaris/%E9%B2%9C%E7%89%9B%E5%A5%B6logo.7ee8ec3fc21f699756f54512835ffd8d50a18bed.png",
}))
}, },
created() {
store.updateActivity();
},
methods: { methods: {
onShareAppMessage() { onShareAppMessage() {
return { return {
......
<!--pages/activity/activity.wxml--> <!--pages/activity/activity.wxml-->
<view class="act_root"> <view class="act_root">
<swiper class="act_swiper" autoplay> <swiper class="act_swiper" autoplay>
<swiper-item class="act_swiper_item" wx:for="{{banner}}"> <swiper-item class="act_swiper_item" wx:for="{{activityInfo.topBanners}}">
<image class="swiper_item_img" src="{{item}}" lazy-load/> <image class="swiper_item_img" src="{{item}}" lazy-load/>
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="act_prod_list"> <view class="act_prod_list">
<view class="act_prod_item" wx:for="{{prodList}}"> <view class="act_prod_item" wx:for="{{activityInfo.productList}}">
<view class="prod_item_prompt">{{item.prompt}}</view> <view class="prod_item_prompt">{{item.prompt}}</view>
<view class="prod_item_introduce">{{item.introduce}}</view> <view class="prod_item_introduce">{{item.content}}</view>
<image class="prod_item_img" src="{{item.img}}" mode="aspectFit" lazy-load/> <image class="prod_item_img" src="{{item.img}}" mode="aspectFit" lazy-load/>
<image class="prod_item_logo" src="{{item.logo}}" mode="aspectFit" lazy-load/> <image class="prod_item_logo" src="{{item.logo}}" mode="aspectFit" lazy-load/>
<view <view
......
...@@ -31,7 +31,7 @@ ComponentWithStore({ ...@@ -31,7 +31,7 @@ ComponentWithStore({
canIUseGetUserProfile: wx.canIUse('getUserProfile'), canIUseGetUserProfile: wx.canIUse('getUserProfile'),
canIUseNicknameComp: wx.canIUse('input.type.nickname'), canIUseNicknameComp: wx.canIUse('input.type.nickname'),
}, },
async ready() { async created() {
this.updateHomeInfo(); this.updateHomeInfo();
}, },
methods: { methods: {
......
...@@ -11,10 +11,8 @@ class Store { ...@@ -11,10 +11,8 @@ class Store {
mobile: "", mobile: "",
subscribe: "", subscribe: "",
first: true, first: true,
topBanners: [ topBanners: [],
], activities: []
activities: [
]
} }
async updateHomeInfo() { async updateHomeInfo() {
...@@ -31,6 +29,26 @@ class Store { ...@@ -31,6 +29,26 @@ class Store {
this.homeInfo = data; this.homeInfo = data;
} }
activityInfo = {
topBanners: [],
productList: [],
}
async updateActivity() {
// wx.showLoading({
// title: '加载中',
// mask: true,
// });
const {success, data} = await request({
url: API_PATH.activity,
});
if (!success) return;
this.activityInfo = data;
}
} }
// 数据仓库 // 数据仓库
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment