默认提交
Showing
10 changed files
with
199 additions
and
51 deletions
src/image/logo.jpeg
0 → 100644
2.94 KB
src/image/logo.png
deleted
100644 → 0
1.01 KB
1 | import { | 1 | import { |
2 | getBindtapData | 2 | getBindtapData, |
3 | pxToRpx, | ||
4 | getLastScreenHeight | ||
3 | } from '../../utils/util'; | 5 | } from '../../utils/util'; |
4 | 6 | ||
5 | let app = getApp(); | 7 | let app = getApp(); |
6 | Page({ | 8 | Page({ |
7 | data: { | 9 | data: { |
10 | isOverShare: true, | ||
8 | authorizeVisible: false, | 11 | authorizeVisible: false, |
9 | total: 0, | 12 | total: 0, |
10 | page: 1, | 13 | page: 1, |
11 | size: 10, | 14 | size: 10, |
15 | dataList: [], | ||
12 | productList: [], // 产品列表 | 16 | productList: [], // 产品列表 |
13 | indexInfo: {}, | 17 | indexInfo: {}, |
14 | userInfo: {} | 18 | userInfo: {}, |
19 | options: {}, | ||
20 | detailData: {}, | ||
21 | vidHeight: 0, // 视频高度 | ||
22 | isVideoEnded: false, | ||
23 | }, | ||
24 | onShareAppMessage() { | ||
25 | let detailData = this.data.detailData; | ||
26 | let title = detailData && detailData.videoName || ""; | ||
27 | let path = `pages/detail/detail?c=${detailData.videoCode}`; | ||
28 | let imageUrl = detailData && detailData.thumbnail || ""; | ||
29 | return { | ||
30 | title, | ||
31 | path, | ||
32 | imageUrl | ||
33 | } | ||
34 | |||
15 | }, | 35 | }, |
16 | onShareAppMessage() {}, | ||
17 | showAuth() { | 36 | showAuth() { |
18 | this.setData({ | 37 | this.setData({ |
19 | authorizeVisible: true | 38 | authorizeVisible: true |
20 | }) | 39 | }) |
21 | }, | 40 | }, |
22 | onLoad(options) {}, | 41 | onLoad(options) { |
42 | this.setData({ | ||
43 | options | ||
44 | }); | ||
45 | this.queryVideoDetail(); | ||
46 | this.initData(); | ||
47 | }, | ||
23 | 48 | ||
24 | /** | 49 | /** |
25 | * 基础方法 | 50 | * 基础方法 |
26 | * 授权完毕重拉数据用 | 51 | * 授权完毕重拉数据用 |
27 | */ | 52 | */ |
28 | initData() { | 53 | initData() { |
29 | 54 | this.queryVideoMore(); | |
30 | }, | 55 | }, |
56 | |||
31 | /** | 57 | /** |
32 | * 到达底部 | 58 | * 到达底部 |
33 | * 做加载更多操作 | 59 | * 做加载更多操作 |
34 | */ | 60 | */ |
35 | onReachBottom() { | 61 | onReachBottom() { |
36 | return; | ||
37 | if (this.data.dataList.length < this.data.total) { | 62 | if (this.data.dataList.length < this.data.total) { |
38 | this.setData({ | 63 | this.setData({ |
39 | page: this.data.page + 1 | 64 | page: this.data.page + 1 |
40 | }); | 65 | }); |
41 | // this.queryDataList(); | 66 | this.queryVideoMore(); |
42 | } | 67 | } |
43 | }, | 68 | }, |
44 | 69 | ||
... | @@ -50,24 +75,73 @@ Page({ | ... | @@ -50,24 +75,73 @@ Page({ |
50 | }) | 75 | }) |
51 | }, | 76 | }, |
52 | 77 | ||
53 | |||
54 | /** | 78 | /** |
55 | * 到个人列表页面 | 79 | * 到个人列表页面 |
56 | */ | 80 | */ |
57 | toPersonalList() { | 81 | toPersonalList() { |
82 | let detailData = this.data.detailData; | ||
83 | if (detailData && detailData.accountCode) { | ||
84 | detailData.c = detailData.accountCode; | ||
85 | app.router.push({ | ||
86 | path: "personalList", | ||
87 | query: detailData | ||
88 | }) | ||
89 | } | ||
90 | }, | ||
91 | |||
92 | /** | ||
93 | * 跳转详情页面 | ||
94 | */ | ||
95 | onDetailHandler(evt) { | ||
96 | let curItem = getBindtapData(evt); | ||
97 | app.router.push({ | ||
98 | path: "detail", | ||
99 | query: { | ||
100 | c: curItem.videoCode || "" | ||
101 | } | ||
102 | }) | ||
103 | }, | ||
104 | |||
105 | /** | ||
106 | * 播放完毕 | ||
107 | */ | ||
108 | onVideoEndedHandler(evt) { | ||
109 | this.setData({ | ||
110 | isVideoEnded: true | ||
111 | }) | ||
112 | }, | ||
113 | |||
114 | /** | ||
115 | * 重播 | ||
116 | */ | ||
117 | onReplayHandler() { | ||
118 | let video = wx.createVideoContext("vid", this); | ||
119 | console.log("video:", video); | ||
120 | video.seek(0); | ||
121 | video.play(); | ||
122 | this.setData({ | ||
123 | isVideoEnded: false | ||
124 | }) | ||
125 | }, | ||
126 | |||
127 | /** | ||
128 | * 返回首页 | ||
129 | */ | ||
130 | toIndex() { | ||
58 | app.router.push({ | 131 | app.router.push({ |
59 | path: "personalList", | 132 | openType: "reLaunch", |
133 | path: "index" | ||
60 | }) | 134 | }) |
61 | }, | 135 | }, |
62 | 136 | ||
63 | /** | 137 | /** |
64 | * 请求DataList | 138 | * 请求DataList |
65 | */ | 139 | */ |
66 | queryDataList() { | 140 | queryVideoMore() { |
67 | return new Promise((resolve, reject) => { | 141 | return new Promise((resolve, reject) => { |
68 | app.post({ | 142 | app.post({ |
69 | sid: false, | 143 | sid: false, |
70 | url: app.api.dataList, | 144 | url: app.api.videoMore, |
71 | data: { | 145 | data: { |
72 | page: this.data.page, | 146 | page: this.data.page, |
73 | size: this.data.size, | 147 | size: this.data.size, |
... | @@ -75,6 +149,7 @@ Page({ | ... | @@ -75,6 +149,7 @@ Page({ |
75 | }).then((result) => { | 149 | }).then((result) => { |
76 | let dataList = result.list; | 150 | let dataList = result.list; |
77 | dataList = this.data.dataList.concat(dataList); | 151 | dataList = this.data.dataList.concat(dataList); |
152 | console.log("dataList:", dataList); | ||
78 | this.setData({ | 153 | this.setData({ |
79 | dataList: dataList, | 154 | dataList: dataList, |
80 | total: result.total | 155 | total: result.total |
... | @@ -85,6 +160,41 @@ Page({ | ... | @@ -85,6 +160,41 @@ Page({ |
85 | }, | 160 | }, |
86 | 161 | ||
87 | /** | 162 | /** |
163 | * 视频详情 | ||
164 | */ | ||
165 | queryVideoDetail() { | ||
166 | return new Promise((resolve, reject) => { | ||
167 | app.post({ | ||
168 | url: app.api.rewardDetail, | ||
169 | data: { | ||
170 | videoCode: this.data.options.c | ||
171 | } | ||
172 | }).then((result) => { | ||
173 | this.setData({ | ||
174 | detailData: result | ||
175 | }) | ||
176 | // let { | ||
177 | // width, | ||
178 | // height | ||
179 | // } = result; | ||
180 | // let vidHeight = (height / width) * 750; | ||
181 | // if (vidHeight < 800) { | ||
182 | // vidHeight = 800; | ||
183 | // } else { | ||
184 | // vidHeight = getLastScreenHeight(132); | ||
185 | // } | ||
186 | // this.setData({ | ||
187 | // vidHeight: vidHeight, | ||
188 | // }); | ||
189 | |||
190 | resolve(result); | ||
191 | }).catch((err) => { | ||
192 | reject(err); | ||
193 | }); | ||
194 | }); | ||
195 | }, | ||
196 | |||
197 | /** | ||
88 | * 隐藏蒙层 | 198 | * 隐藏蒙层 |
89 | */ | 199 | */ |
90 | hideMask() { | 200 | hideMask() { | ... | ... |
... | @@ -41,7 +41,7 @@ | ... | @@ -41,7 +41,7 @@ |
41 | 41 | ||
42 | .vid { | 42 | .vid { |
43 | margin: 24px auto 0; | 43 | margin: 24px auto 0; |
44 | width: 640px; | 44 | width: 710px; |
45 | border-radius: 16px; | 45 | border-radius: 16px; |
46 | } | 46 | } |
47 | } | 47 | } |
... | @@ -77,10 +77,12 @@ | ... | @@ -77,10 +77,12 @@ |
77 | 77 | ||
78 | .t1 { | 78 | .t1 { |
79 | width: 100%; | 79 | width: 100%; |
80 | font-size: 32px; | ||
81 | font-weight: normal; | ||
80 | } | 82 | } |
81 | 83 | ||
82 | .name { | 84 | .name { |
83 | font-size: 36px; | 85 | // font-size: 36px; |
84 | } | 86 | } |
85 | 87 | ||
86 | .num { | 88 | .num { |
... | @@ -95,8 +97,9 @@ | ... | @@ -95,8 +97,9 @@ |
95 | display: flex; | 97 | display: flex; |
96 | 98 | ||
97 | .btn { | 99 | .btn { |
98 | margin-right: 24px; | 100 | // margin-right: 24px; |
99 | width: 200px; | 101 | margin: 0 0; |
102 | width: 240px; | ||
100 | height: 80px; | 103 | height: 80px; |
101 | font-size: 32px; | 104 | font-size: 32px; |
102 | background-color: #3ec03c; | 105 | background-color: #3ec03c; |
... | @@ -112,6 +115,7 @@ | ... | @@ -112,6 +115,7 @@ |
112 | 115 | ||
113 | .t1 { | 116 | .t1 { |
114 | padding: 0 6px; | 117 | padding: 0 6px; |
118 | |||
115 | } | 119 | } |
116 | 120 | ||
117 | &:last-child { | 121 | &:last-child { |
... | @@ -124,7 +128,9 @@ | ... | @@ -124,7 +128,9 @@ |
124 | color: #7f776e; | 128 | color: #7f776e; |
125 | } | 129 | } |
126 | 130 | ||
127 | 131 | .btn3 { | |
132 | background-color: #8d8d8d; | ||
133 | } | ||
128 | } | 134 | } |
129 | 135 | ||
130 | } | 136 | } |
... | @@ -134,7 +140,7 @@ | ... | @@ -134,7 +140,7 @@ |
134 | @extend .bb; | 140 | @extend .bb; |
135 | padding: 0 24px; | 141 | padding: 0 24px; |
136 | font-size: 36px; | 142 | font-size: 36px; |
137 | margin: 0px auto 24px; | 143 | margin: 24px auto 0px; |
138 | } | 144 | } |
139 | 145 | ||
140 | // 广告 | 146 | // 广告 |
... | @@ -170,16 +176,16 @@ | ... | @@ -170,16 +176,16 @@ |
170 | 176 | ||
171 | .tit { | 177 | .tit { |
172 | @extend .bb; | 178 | @extend .bb; |
173 | padding: 24px 0; | 179 | padding: 8px 0; |
174 | height: 230px; | 180 | height: 180px; |
175 | flex: 1; | 181 | flex: 1; |
176 | font-size: 36px; | 182 | font-size: 40px; |
177 | @include ellipsis(4); | 183 | @include ellipsis(3); |
178 | } | 184 | } |
179 | 185 | ||
180 | .poster { | 186 | .poster { |
181 | width: 350px; | 187 | width: 350px; |
182 | height: 230px; | 188 | height: 180px; |
183 | border-radius: 8px; | 189 | border-radius: 8px; |
184 | } | 190 | } |
185 | } | 191 | } | ... | ... |
... | @@ -20,12 +20,10 @@ | ... | @@ -20,12 +20,10 @@ |
20 | </view> | 20 | </view> |
21 | </view> | 21 | </view> |
22 | <view class="btn-wrap"> | 22 | <view class="btn-wrap"> |
23 | <view class="btn btn2"> | 23 | <!-- <view class="tit">{{item.videoName}}</view> --> |
24 | <view class="tit">一家人在一起的时刻</view> | ||
25 | <!-- <view class="btn btn2"> | ||
24 | <span>更多推荐</span> | 26 | <span>更多推荐</span> |
25 | </view> | ||
26 | <!-- <view class="btn"> | ||
27 | <span class="t1 iconfont iconhome"></span> | ||
28 | <span>返回首页</span> | ||
29 | </view> --> | 27 | </view> --> |
30 | </view> | 28 | </view> |
31 | </view> | 29 | </view> |
... | @@ -40,14 +38,14 @@ | ... | @@ -40,14 +38,14 @@ |
40 | <view class="more"> | 38 | <view class="more"> |
41 | <view class="more-title">-- 更多推荐欣赏 --</view> | 39 | <view class="more-title">-- 更多推荐欣赏 --</view> |
42 | <view class="more-list"> | 40 | <view class="more-list"> |
43 | <view wx:for="{{2}}" wx:key="{{index}}" class="more-list-item"> | 41 | <view bindtap="onDetailHandler" data-data="{{item}}" data-index="{{index}}" wx:for="{{dataList}}" wx:key="{{index}}" class="more-list-item"> |
44 | <view class="tit">新政策来了!家有小孩的都要过来看看</view> | 42 | <view class="tit">{{item.videoName}}</view> |
45 | <image class="poster" src="https://kd.cdn.xyiyang.com/pro/mzczcradmin/008194acee794506aac4c7200ce654dc.jpg" /> | 43 | <image class="poster" src="{{item.thumbnail}}" /> |
46 | </view> | 44 | </view> |
47 | </view> | 45 | </view> |
48 | </view> | 46 | </view> |
49 | <!-- 返回首页按钮 --> | 47 | <!-- 返回首页按钮 --> |
50 | <view class="index-btn"> | 48 | <view bindtap="toIndex" class="index-btn"> |
51 | <span class="t1 iconfont iconhome"></span> | 49 | <span class="t1 iconfont iconhome"></span> |
52 | <span>返回首页</span> | 50 | <span>返回首页</span> |
53 | </view> | 51 | </view> |
... | @@ -58,3 +56,4 @@ | ... | @@ -58,3 +56,4 @@ |
58 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> | 56 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> |
59 | </van-popup> | 57 | </van-popup> |
60 | <!-- <shortcut></shortcut> --> | 58 | <!-- <shortcut></shortcut> --> |
59 | <shortcut class="red-p" types="{{[]}}" pics="{{['red-package']}}"></shortcut> | ... | ... |
... | @@ -75,18 +75,51 @@ Page({ | ... | @@ -75,18 +75,51 @@ Page({ |
75 | }, | 75 | }, |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * | 78 | * 打赏 |
79 | */ | 79 | */ |
80 | onRewardHandler(evt) { | 80 | onRewardHandler(evt) { |
81 | let curItem = getBindtapData(evt); | 81 | let curItem = getBindtapData(evt); |
82 | console.log("curItem:", curItem); | 82 | console.log("curItem:", curItem); |
83 | curItem.packet = "ONE_CENT"; | ||
83 | app.post({ | 84 | app.post({ |
84 | url: app.api.wxPay, | 85 | url: app.api.wxPay, |
85 | data: curItem | 86 | data: curItem |
86 | }).then((result) => { | 87 | }).then((res2) => { |
87 | console.log("wxPay result:", result); | 88 | console.log("wxPay result:", res2); |
88 | }).catch((err) => { | 89 | wx.requestPayment({ |
90 | timeStamp: res2.timeStamp + "", | ||
91 | nonceStr: res2.nonceStr, | ||
92 | paySign: res2.paySign, | ||
93 | package: res2.package, | ||
94 | signType: 'MD5', | ||
95 | success(res) { | ||
96 | // console.log("success:", res); | ||
89 | 97 | ||
98 | // 支付成功 | ||
99 | app.router.push({ | ||
100 | path: "rewardCompleted", | ||
101 | query: { | ||
102 | c: "" // orderCode | ||
103 | } | ||
104 | }) | ||
105 | }, | ||
106 | fail(res) { | ||
107 | console.log("fail:", res); | ||
108 | wx.showModal({ | ||
109 | content: '赞赏失败', | ||
110 | showCancel: false, | ||
111 | success(res) { | ||
112 | // if (res.confirm) { | ||
113 | // console.log('用户点击确定') | ||
114 | // } else if (res.cancel) { | ||
115 | // console.log('用户点击取消') | ||
116 | // } | ||
117 | } | ||
118 | }) | ||
119 | } | ||
120 | }) | ||
121 | }).catch((err) => { | ||
122 | console.log("catch:", err); | ||
90 | }); | 123 | }); |
91 | }, | 124 | }, |
92 | 125 | ... | ... |
... | @@ -22,29 +22,31 @@ | ... | @@ -22,29 +22,31 @@ |
22 | 22 | ||
23 | position: relative; | 23 | position: relative; |
24 | width: 207px; | 24 | width: 207px; |
25 | height: 207px; | ||
25 | margin: 0 auto; | 26 | margin: 0 auto; |
26 | 27 | ||
27 | &-bg { | 28 | &-bg { |
28 | text-align: center; | 29 | text-align: center; |
29 | position: absolute; | 30 | position: absolute; |
30 | width: 207px; | 31 | width: 207px; |
31 | top: -3px; | 32 | border-radius: 50%; |
33 | // top: -3px; | ||
32 | } | 34 | } |
33 | 35 | ||
34 | // 头像 | 36 | // 头像 |
35 | .avatar { | 37 | // .avatar { |
36 | margin: 0 auto; | 38 | // margin: 0 auto; |
37 | position: relative; | 39 | // position: relative; |
38 | display: block; | 40 | // display: block; |
39 | width: 201px; | 41 | // width: 201px; |
40 | height: 201px; | 42 | // height: 201px; |
41 | border-radius: 50%; | 43 | // border-radius: 50%; |
42 | overflow: hidden | 44 | // overflow: hidden |
43 | } | 45 | // } |
44 | 46 | ||
45 | .avatar-avatar::after { | 47 | // .avatar-avatar::after { |
46 | border-radius: 205px; | 48 | // border-radius: 205px; |
47 | } | 49 | // } |
48 | } | 50 | } |
49 | 51 | ||
50 | .reward { | 52 | .reward { | ... | ... |
... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
6 | <view class="top-space"></view> | 6 | <view class="top-space"></view> |
7 | <view class="content"> | 7 | <view class="content"> |
8 | <view class="portrait"> | 8 | <view class="portrait"> |
9 | <image class="portrait-bg" mode="widthFix" src="../../image/reward/reward-portrait-bg.png" /> | 9 | <image class="portrait-bg" mode="widthFix" src="../../image/logo.jpeg" /> |
10 | <!-- <open-data class="avatar" type="userAvatarUrl"></open-data> --> | 10 | <!-- <open-data class="avatar" type="userAvatarUrl"></open-data> --> |
11 | </view> | 11 | </view> |
12 | <view class="reward"> | 12 | <view class="reward"> | ... | ... |
-
Please register or sign in to post a comment