Skip to content

Commit 76b7dd2

Browse files
committed
feat: upgrade user experience
1 parent d2e0e57 commit 76b7dd2

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

miniprogram/app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"pages/myStarred/index"
77
],
88
"window": {
9+
"backgroundColor": "#f6f6f6",
910
"backgroundTextStyle": "light",
1011
"navigationBarBackgroundColor": "#fff",
1112
"navigationBarTitleText": "程序员做饭指南",

miniprogram/pages/detail/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Page({
88
visible: true,
99
liked: false,
1010
starred: false,
11+
done: false,
1112
stepIndexes: new Array(10).fill(0),
1213
},
1314

@@ -27,20 +28,18 @@ Page({
2728

2829
async getData() {
2930
const { id } = this.data;
30-
wx.showLoading({
31-
title: '加载中',
32-
})
31+
32+
this.setData({ done: false })
3333
try {
3434
const { result } = await wx.cloud.callFunction({
3535
name: 'getCookbook',
3636
data: {
3737
id
3838
}
3939
})
40-
wx.hideLoading()
4140
if (result.errno == 0) {
4241
const { likeds, liked, starreds, starred } = result.data
43-
42+
this.setData({ done: true })
4443
this.setData({
4544
liked,
4645
likeds,
@@ -51,7 +50,7 @@ Page({
5150
} catch(e) {
5251
console.log(e);
5352
} finally {
54-
wx.hideLoading()
53+
this.setData({ done: true })
5554
}
5655
},
5756

@@ -100,6 +99,7 @@ Page({
10099
try {
101100
wx.showLoading({
102101
title: '加载中',
102+
mask: true
103103
})
104104
const { result } = await wx.cloud.callFunction({
105105
name: 'setCookbook',

miniprogram/pages/detail/index.less

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@
132132
padding-bottom: env(safe-area-inset-bottom, 28rpx);
133133
background-color: #fff;
134134
box-shadow: #ccc 0 0 10px;
135+
transform: translateY(100%);
136+
transition: all .3s ease;
137+
138+
&--active {
139+
transform: translateY(0);
140+
}
135141

136142
&__button {
137143
display: flex;

miniprogram/pages/detail/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
</view>
4949
</view>
5050

51-
<view class="actions">
51+
<view class="actions actions--{{done ? 'active' : ''}}">
5252
<t-button-group>
5353
<t-button t-class="actions__button" size="large" block data-type="liked" bind:tap="toggleStarOrLike">
5454
<t-icon name="heart{{liked ? '-filled' : ''}}" color="{{liked ? '#e34d59' : ''}}" size="36rpx" class="actions__icon"/> {{likeds ? likeds + ' 人' : ''}}喜欢

0 commit comments

Comments
 (0)