Skip to content

Commit

Permalink
社区
Browse files Browse the repository at this point in the history
  • Loading branch information
YaelCassini committed Jun 23, 2021
1 parent d1d3f1d commit 9a6257b
Show file tree
Hide file tree
Showing 21 changed files with 322 additions and 25 deletions.
1 change: 1 addition & 0 deletions .tea/entryFiles-development/index$.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ require('../../pages/my-achievement/my-achievement?hash=3e2e5e2d473d03821badb545
require('../../pages/my-shop/my-shop?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/my-wish/my-wish?hash=51de122843dd2e2a42f1ae1d1b016af1c756c195');
require('../../pages/hot-comment/hot-comment?hash=5e997e0f2af536b7d695e874e98cc0d48d6ea05e');
require('../../pages/hot-item/hot-item?hash=4e7b9cf6c1993213ed46d336fc6cebb0486ea438');
1 change: 1 addition & 0 deletions .tea/entryFiles-development/index$.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ require('../../pages/my-achievement/my-achievement?hash=3e2e5e2d473d03821badb545
require('../../pages/my-shop/my-shop?hash=32d7d2807ed4e666ef03b4b3fe8c38ecf2e34e68');
require('../../pages/my-wish/my-wish?hash=51de122843dd2e2a42f1ae1d1b016af1c756c195');
require('../../pages/hot-comment/hot-comment?hash=5e997e0f2af536b7d695e874e98cc0d48d6ea05e');
require('../../pages/hot-item/hot-item?hash=4e7b9cf6c1993213ed46d336fc6cebb0486ea438');
}
self.bootstrapApp ? self.bootstrapApp({ success }) : success();
}
4 changes: 4 additions & 0 deletions app.acss
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ button {
background-color: rgb(99, 182, 120);
border: 0; padding: 0;
}
button :active{
color:red;
background: #79a165;
}

.bc_blue {
background-color: rgb(147, 211, 163);
Expand Down
3 changes: 2 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"pages/my-achievement/my-achievement",
"pages/my-shop/my-shop",
"pages/my-wish/my-wish",
"pages/hot-comment/hot-comment"
"pages/hot-comment/hot-comment",
"pages/hot-item/hot-item"
],
"window": {
"defaultTitle": "茶荟",
Expand Down
1 change: 0 additions & 1 deletion pages/business/business.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
"comment": "/pages/card/components/Comment/Comment",
"category-nav": "/components/category-nav/category-nav",
"masonry": "/pages/business/components/Masonry/Masonry"

}
}
2 changes: 1 addition & 1 deletion pages/card/card.axml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</view>

<view style="height:20p; width:30%; margin-top: -10px">
<button onTap="AddtoWish" style="margin-left: 50px; margin-bottom: -10px; width: 160px;" type="primary" size="mini">加入收藏</button>
<button onTap="AddtoWish" style="margin-left: 50px; margin-bottom: -10px; width: 160px;" type="primary" size="mini">加入愿望单</button>
<button style="margin-left: 50px; margin-bottom: -10px; width: 160px;" type="primary" size="mini">立即购买</button>
</view>
</container>
Expand Down
4 changes: 3 additions & 1 deletion pages/card/components/Comment/Comment.axml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@
<view class="score-item__star" a:if="{{item.score>=5}}"> <image src = "/asserts/icon/star1.png"></image> </view>
<view class="score-item__star" a:else> <image src = "/asserts/icon/star0.png"></image> </view>

<button onTap="AddtoCollection" data-id="{{item}}" class="comment-item__subtitle">收藏测评</button>
</view>



<view
class="comment-item"
style="flex-direction:{{columns===1?'row':'column'}};"
Expand All @@ -79,7 +81,7 @@
<view class="comment-item__container">
<view class="comment-item__body">
<view class="comment-item__title">{{item.title}}</view>
<button onTap="AddtoCollection" data-id="{{item}}" class="comment-item__subtitle">收藏</button>
<button onTap="AddtoWish" data-id="{{item}}" class="comment-item__subtitle">加入愿望单</button>
</view>
<view class="comment-item__design">
<view class="comment-item__design2">
Expand Down
55 changes: 55 additions & 0 deletions pages/card/components/Comment/Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Component({
commentData: [],
columns: 2,
isRanking: false,
commodity:[],
onTapCommodity: () => {},
jumpToGoods: () => {},
},
Expand Down Expand Up @@ -45,5 +46,59 @@ Component({
console.error;
});
},
AddtoWish(event)
{
console.log(event);
var item=event.target.dataset.id;
var seller_id = item.seller_id;
var commodity_id = item.commodity_id;
console.log("seller:"+seller_id);
console.log("commodity:"+commodity_id);
my.serverless.db.collection('commodity').find({
seller_id: { $eq: item.seller_id },
id: { $eq: item.commodity_id },
})
.then(res => {
this.setData({["commodity"]:res.result[0]});
console.log("commodity:"+this.data.commodity);
my.serverless.db.collection('wish').insertOne(this.data.commodity)
.then(res => {
console.log("success add to wish");
my.showToast({
type: 'success',
content: '已将该单品加入我的愿望单',
duration: 2000,
});
})
.catch(error =>{
console.log("failed add to wish");
my.showToast({
type: 'fail',
content: '该单品已在我的愿望单中',
duration: 2000,
});
console.error;
});
})
.catch(console.error);
// my.serverless.db.collection('wish').insertOne(item)
// .then(res => {
// console.log("success add to wish");
// my.showToast({
// type: 'success',
// content: '已将该单品加入我的愿望单',
// duration: 2000,
// });
// })
// .catch(error =>{
// console.log("failed add to wish");
// my.showToast({
// type: 'fail',
// content: '该单品已在我的愿望单中',
// duration: 2000,
// });
// console.error;
// });
},
},
});
14 changes: 9 additions & 5 deletions pages/community/community.axml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
</swiper>
</container>

<container onTap="jumpToHotComment" className="container-item">
<title onTap="jumpToHotComment" slot="header" hasLine="true" showIcon="true">热门评测</title>
<view onTap="jumpToHotComment">
<container className="container-item">
<title slot="header" hasLine="true" showIcon="true">热门评测</title>
<swiper indicator-dots="{{indicatorDots}}" class="item"
style="height:250px"
autoplay="{{autoplay}}"
vertical="{{vertical}}"
interval="{{interval}}"
interval="{{interval2}}"
circular="{{circular}}">
<block a:for="{{recommend}}">
<swiper-item>
Expand All @@ -45,14 +46,17 @@
</block>
</swiper>
</container>
</view>


<view onTap="jumpToHotItem">
<container className="container-item" type="onewithtwo">
<title slot="header" hasLine="true" showIcon="true">热门单品</title>
<view class="grid-item" style ="height: 300rpx;background-image: url('../../asserts/picture/zhaopaiyuyuannaicha.jpg');background-size:100% " slot="first"></view>
<view class="grid-item" slot="second" style="background-image: url('../../asserts/picture/heilongtang1.jpg');background-size:100% " ></view>
<view class="grid-item" slot="third" style="background-image: url('../../asserts/picture/boba.jpg');background-size:100% "></view>
</container>

</view>



Expand All @@ -64,7 +68,7 @@
items="{{items}}"
/>
<container className="item">
<view class="item" style="background-image: url('../../asserts/picture/low-hot.jpg');background-size:100%"></view>
<view id="recommend" class="item" style="background-image: url({{recommendpic}});background-size:100%"></view>
</container>

<button style="margin-left: 0px;" type="primary" size="mini" onTap="preStep">上一个</button>
Expand Down
39 changes: 33 additions & 6 deletions pages/community/community.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
const recommendpics = [
'../../asserts/picture/low-hot.jpg',
'../../asserts/picture/recommend2.jpg',
'../../asserts/picture/recommend3.jpg',
'../../asserts/picture/recommend2.jpg',
'../../asserts/picture/recommend.jpg'
];
Page({
data: {
background: ['blue', 'red', 'yellow'],
indicatorDots: true,
autoplay: false,
autoplay: true,
vertical: false,
interval: 1000,
interval2: 3000,
circular: false,
recommend:['../../asserts/picture/recommend.jpg','../../asserts/picture/recommend2.jpg','../../asserts/picture/recommend3.jpg'],

recommendpic:'../../asserts/picture/low-hot.jpg',
activeIndex: 1,
failIndex: 0,
size: 0,
Expand All @@ -20,11 +29,11 @@ Page({
}, {
title: '夏季果茶',
}, {
title: '冷萃咖啡',
title: '风味咖啡',
}, {
title: '步骤3',
title: '芝士奶盖',
}, {
title: '步骤3',
title: '冷萃冰沙',
}],

orderList: [
Expand Down Expand Up @@ -83,6 +92,16 @@ Page({
jumpToHotComment()
{
console.log("this is jump to HotComment");
my.navigateTo({
url: '/pages/hot-comment/hot-comment',
})
},
jumpToHotItem()
{
console.log("this is jump to HotItem");
my.navigateTo({
url: '/pages/hot-item/hot-item',
})
},
changeIndicatorDots(e) {
this.setData({
Expand Down Expand Up @@ -111,12 +130,20 @@ Page({
},
nextStep() {
this.setData({
activeIndex: this.data.activeIndex + 1,
activeIndex: this.data.activeIndex%5 + 1,
});
var picindex = (this.data.activeIndex-1)%5;
this.setData({
recommendpic: recommendpics[picindex],
});
},
preStep() {
this.setData({
activeIndex: this.data.activeIndex - 1,
activeIndex: (this.data.activeIndex+5-2)%5+1,
});
var picindex = (this.data.activeIndex-1)%5;
this.setData({
recommendpic: recommendpics[picindex],
});
},
onCardClick(ev) {
Expand Down
2 changes: 1 addition & 1 deletion pages/home/components/Masonry/Masonry.acss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.masonry {
padding: 0 8rpx;
padding: 0rpx;
display: grid;
grid-template-columns: 1fr 1fr;
align-items: stretch;
Expand Down
8 changes: 7 additions & 1 deletion pages/home/home.acss
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
/* .content{
margin: 0rpx;
padding: 0rpx;
width: 50%;
} */

.search-nav {
display: flex;
align-items: center;
width: 100%;
width: 95%;
padding: 24rpx;
box-sizing: border-box;
}
Expand Down
6 changes: 3 additions & 3 deletions pages/home/home.axml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
name="EmptyType"
from="../../components/Empty/empty-type.sjs"
/>
<commodity-drawer
<!-- <commodity-drawer
commodityId="{{selectedCommodityId}}"
show="{{showCommodityDrawer}}"
onClose="onCloseCommodityDrawer"
onConfirm="onConfirm"
/>
<view disable-scroll="{{showCommodityDrawer}}">
/> -->
<view class="content" disable-scroll=true>

<location />
<view class="search-nav">
Expand Down
4 changes: 0 additions & 4 deletions pages/home/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ Page({
id: TREND,
title: '人气店家',
},
{
id: ALL,
title: '猜你喜欢',
},

],
activeTabId: NEW,
Expand Down
5 changes: 5 additions & 0 deletions pages/hot-comment/hot-comment.axml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
name="EmptyType"
from="../../components/Empty/empty-type.sjs"
/>
<tab
activeId="{{activeTabId}}"
onActiveTabChange="onActiveTabChange"
tabs="{{tabs}}"
/>
<view disable-scroll=false>
<comment
a:if="{{currentCommodities.length>0}}"
Expand Down
19 changes: 19 additions & 0 deletions pages/hot-comment/hot-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ Page({
currentCommodities: [],
selectedCommodityId: '',
showCommodityDrawer: false,
activeTabId: 0,
tabs: [
{
id: 0,
title: '最新',
},
{
id: 1,
title: '最热',
},
{
id: 2,
title: '好友圈',
},
],
},
onLoad()
{
Expand All @@ -14,4 +29,8 @@ Page({
})
.catch(console.error);
},
onActiveTabChange(id) {
this.setData({ activeTabId: id });
// this.fetchCurrentCommodities(id);
},
});
2 changes: 1 addition & 1 deletion pages/hot-comment/hot-comment.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"defaultTitle": "我的收藏",
"defaultTitle": "热门评测",
"usingComponents": {
"comment": "/pages/my-collection/components/Comment/Comment",
"search": "/components/Search/Search",
Expand Down
Loading

0 comments on commit 9a6257b

Please sign in to comment.