Commit be1dfe24541efb7290ecaa22b3586322d87d077a
1 parent
10398d68
直播列表和直播详情页
Showing
27 changed files
with
1635 additions
and
153 deletions
app.json
1 | { | 1 | { |
2 | "pages": [ | 2 | "pages": [ |
3 | "pages/index/index/index", | 3 | "pages/index/index/index", |
4 | + "pages/justTest/justTest", | ||
4 | "pages/goods/categoryList/categoryList", | 5 | "pages/goods/categoryList/categoryList", |
5 | "pages/cart/cart/cart", | 6 | "pages/cart/cart/cart", |
6 | "pages/cart/cart2/cart2", | 7 | "pages/cart/cart2/cart2", |
@@ -85,16 +86,17 @@ | @@ -85,16 +86,17 @@ | ||
85 | "pages/video/index", | 86 | "pages/video/index", |
86 | "pages/template/index", | 87 | "pages/template/index", |
87 | "pages/store/index" | 88 | "pages/store/index" |
88 | - | ||
89 | ], | 89 | ], |
90 | 90 | ||
91 | "subPackages": [{ | 91 | "subPackages": [{ |
92 | "root": "packageA/", | 92 | "root": "packageA/", |
93 | "name":"pack1", | 93 | "name":"pack1", |
94 | "pages": [ | 94 | "pages": [ |
95 | + "pages/liveStream/liveStream", | ||
95 | "pages/prom_list/prom_list", | 96 | "pages/prom_list/prom_list", |
96 | "pages/quan_list/quan_list", | 97 | "pages/quan_list/quan_list", |
97 | - "pages/quan_pro/quan_pro" | 98 | + "pages/quan_pro/quan_pro", |
99 | + "pages/liveStreamDetails/liveStreamDetails" | ||
98 | ], | 100 | ], |
99 | "plugins": { | 101 | "plugins": { |
100 | "live-player-plugin": { | 102 | "live-player-plugin": { |
packageA/images/index/tuangou-pic.jpg
0 → 100644
25 KB
packageA/images/liveStreamDetails/circle.jpg
0 → 100644
3.83 KB
packageA/images/liveStreamDetails/cover.jpg
0 → 100644
88.7 KB
packageA/images/liveStreamDetails/friend.jpg
0 → 100644
4.38 KB
packageA/images/liveStreamDetails/goods.jpg
0 → 100644
7.99 KB
packageA/images/liveStreamDetails/home.jpg
0 → 100644
1.38 KB
packageA/images/liveStreamDetails/playbill.jpg
0 → 100644
96.2 KB
packageA/images/liveStreamDetails/save.jpg
0 → 100644
968 Bytes
packageA/images/liveStreamDetails/share.jpg
0 → 100644
1.09 KB
packageA/pages/liveStream/liveStream.js
0 → 100644
1 | +// pages/liveStream/liveStream.js | ||
2 | + | ||
3 | +var t = require("../../../utils/util"), | ||
4 | + ut = t, | ||
5 | + e = require("../../../utils/common.js"), | ||
6 | + a = require("../../../utils/wxParse/wxParse.js"), | ||
7 | + s = getApp(), | ||
8 | + i = s.request, | ||
9 | + rq = i, | ||
10 | + oo = s.globalData, | ||
11 | + o = s.globalData.setting, | ||
12 | + os = o; | ||
13 | +var utils = require('../../../utils/util.js'),ut=utils; | ||
14 | +var regeneratorRuntime = require('../../../utils/runtime.js'); | ||
15 | + | ||
16 | +Page({ | ||
17 | + | ||
18 | + /** | ||
19 | + * 页面的初始数据 | ||
20 | + */ | ||
21 | + data: { | ||
22 | + goodsList: [], | ||
23 | + imghost: '', | ||
24 | + liveList: {} | ||
25 | + }, | ||
26 | + | ||
27 | + // 点击直播列表项 | ||
28 | + clickItem: function (e) { | ||
29 | + // id:列表项id | ||
30 | + // live:直播类别 即将开始/直播中/精彩回放 | ||
31 | + wx.navigateTo({ | ||
32 | + url: '/packageA/pages/liveStreamDetails/liveStreamDetails?id=' + e.currentTarget.dataset.id + '&live=' + e.currentTarget.dataset.live | ||
33 | + }) | ||
34 | + console.log('options-->'); | ||
35 | + }, | ||
36 | + | ||
37 | + // 点击 订阅/观看直播/观看回放 按钮,跳转直播组件 | ||
38 | + clickLive: function (e) { | ||
39 | + console.log('当前房间号roomid:',e.currentTarget.dataset.roomid); | ||
40 | + let roomId = e.currentTarget.dataset.roomid; | ||
41 | + let customParams = encodeURIComponent(JSON.stringify({ path: 'pages/index/index', pid: 1 })); | ||
42 | + wx.navigateTo({ | ||
43 | + url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}&custom_params=${customParams}` | ||
44 | + }) | ||
45 | + }, | ||
46 | + | ||
47 | + /** | ||
48 | + * 生命周期函数--监听页面加载 | ||
49 | + */ | ||
50 | + onLoad: function (options) { | ||
51 | + var live = {}; | ||
52 | + live.toBegin = []; // 即将开始 | ||
53 | + live.ing = []; // 直播中 | ||
54 | + live.over = []; // 已结束 | ||
55 | + | ||
56 | + // 请求数据 | ||
57 | + var that = this; | ||
58 | + getApp().request.promiseGet("/api/weshop/wx/livelist/page", {}).then(res=>{ | ||
59 | + console.log('ressss--->',res); | ||
60 | + if(res.data.code==0){ | ||
61 | + that.setData({ | ||
62 | + goodsList: res.data.data.pageData | ||
63 | + }) | ||
64 | + } | ||
65 | + // console.log(goodsList); | ||
66 | + | ||
67 | + var result = res.data.data.pageData; | ||
68 | + var liveStatus; | ||
69 | + if(res.data.code == 0) { | ||
70 | + for(var i in result) { | ||
71 | + console.log(i + '当前直播状态:', result[i].live_status); | ||
72 | + liveStatus = result[i].live_status; | ||
73 | + // 这里只显示101/102/103状态 | ||
74 | + if (liveStatus == '101') { | ||
75 | + live.ing.push(result[i]); | ||
76 | + } else if (liveStatus == '102') { | ||
77 | + live.toBegin.push(result[i]); | ||
78 | + } else if (liveStatus == '103') { | ||
79 | + live.over.push(result[i]); | ||
80 | + } | ||
81 | + } | ||
82 | + // console.log('live--->', live); | ||
83 | + that.setData({ | ||
84 | + live | ||
85 | + }); | ||
86 | + } | ||
87 | + }) | ||
88 | + }, | ||
89 | + | ||
90 | + /** | ||
91 | + * 生命周期函数--监听页面初次渲染完成 | ||
92 | + */ | ||
93 | + onReady: function () { | ||
94 | + | ||
95 | + }, | ||
96 | + | ||
97 | + /** | ||
98 | + * 生命周期函数--监听页面显示 | ||
99 | + */ | ||
100 | + onShow: function () { | ||
101 | + | ||
102 | + }, | ||
103 | + | ||
104 | + /** | ||
105 | + * 生命周期函数--监听页面隐藏 | ||
106 | + */ | ||
107 | + onHide: function () { | ||
108 | + | ||
109 | + }, | ||
110 | + | ||
111 | + /** | ||
112 | + * 生命周期函数--监听页面卸载 | ||
113 | + */ | ||
114 | + onUnload: function () { | ||
115 | + | ||
116 | + }, | ||
117 | + | ||
118 | + /** | ||
119 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
120 | + */ | ||
121 | + onPullDownRefresh: function () { | ||
122 | + | ||
123 | + }, | ||
124 | + | ||
125 | + /** | ||
126 | + * 页面上拉触底事件的处理函数 | ||
127 | + */ | ||
128 | + onReachBottom: function () { | ||
129 | + | ||
130 | + }, | ||
131 | + | ||
132 | + /** | ||
133 | + * 用户点击右上角分享 | ||
134 | + */ | ||
135 | + onShareAppMessage: function () { | ||
136 | + | ||
137 | + } | ||
138 | +}) | ||
0 | \ No newline at end of file | 139 | \ No newline at end of file |
packageA/pages/liveStream/liveStream.json
0 → 100644
packageA/pages/liveStream/liveStream.wxml
0 → 100644
1 | +<!--pages/liveStream/liveStream.wxml--> | ||
2 | +<wxs src="../../../utils/filter.wxs" module="filter"></wxs> | ||
3 | +<view> | ||
4 | + <block wx:if="{{live === '{}'}}">当前暂无直播</block> | ||
5 | + <!-- 即将开始 --> | ||
6 | + <block wx:if="{{live.toBegin.length > 0}}"> | ||
7 | + <view class="title">即将开始</view> | ||
8 | + <view class="list"> | ||
9 | + <block wx:for="{{live.toBegin}}"> | ||
10 | + <view class="list-item" data-id="{{item.id}}" data-live="toBegin" catchtap="clickItem"> | ||
11 | + <view class="list-item-left"> | ||
12 | + <image src="{{item.cover_img}}" class="item-pic" mode="aspectFill"></image> | ||
13 | + <!-- <view class="item-desc"> | ||
14 | + <view>{{item.name}}</view> | ||
15 | + <view>{{filter.format_time(item.start_time)}}</view> | ||
16 | + </view> --> | ||
17 | + </view> | ||
18 | + <view class="list-item-right"> | ||
19 | + <view class="item-title">{{item.name}}</view> | ||
20 | + <subscribe room-id="{{item.roomid}}" stopPropagation="{{true}}"></subscribe> | ||
21 | + </view> | ||
22 | + | ||
23 | + </view> | ||
24 | + | ||
25 | + </block> | ||
26 | + </view> | ||
27 | + </block> | ||
28 | + | ||
29 | + | ||
30 | + <!-- 直播中 --> | ||
31 | + <block wx:if="{{live.ing.length > 0}}"> | ||
32 | + <view class="title">直播中</view> | ||
33 | + <view class="list"> | ||
34 | + <block wx:for="{{live.ing}}"> | ||
35 | + <view class="list-item" catchtap="clickItem" data-id="{{item.id}}" data-live="ing"> | ||
36 | + <view class="list-item-left"> | ||
37 | + <image src="{{item.cover_img}}" class="item-pic" mode="aspectFill"></image> | ||
38 | + </view> | ||
39 | + <view class="list-item-right"> | ||
40 | + <view class="item-title">{{item.name}}</view> | ||
41 | + <view class="item-btn" catchtap="clickLive" data-roomid="{{item.roomid}}">观看直播</view> | ||
42 | + </view> | ||
43 | + </view> | ||
44 | + </block> | ||
45 | + </view> | ||
46 | + </block> | ||
47 | + | ||
48 | + | ||
49 | + <!-- 精彩回放 --> | ||
50 | + <block wx:if="{{live.over.length > 0}}"> | ||
51 | + <view class="title">精彩回放</view> | ||
52 | + <view class="list"> | ||
53 | + <block wx:for="{{live.over}}"> | ||
54 | + <view class="list-item" bindtap="clickItem" data-id="{{item.id}}" data-live="over"> | ||
55 | + <view class="list-item-left"> | ||
56 | + <image src="{{item.cover_img}}" class="item-pic" mode="aspectFill"></image> | ||
57 | + </view> | ||
58 | + <view class="list-item-right"> | ||
59 | + <view class="item-title">{{item.name}}</view> | ||
60 | + <view class="item-btn" catchtap="clickLive" data-roomid="{{item.roomid}}">观看回放</view> | ||
61 | + </view> | ||
62 | + </view> | ||
63 | + </block> | ||
64 | + </view> | ||
65 | + </block> | ||
66 | +</view> | ||
0 | \ No newline at end of file | 67 | \ No newline at end of file |
packageA/pages/liveStream/liveStream.wxss
0 → 100644
1 | +/* pages/liveStream/liveStream.wxss */ | ||
2 | +.title { | ||
3 | + font-size: 30rpx; | ||
4 | + padding: 50rpx 32rpx; | ||
5 | +} | ||
6 | +.list-item { | ||
7 | + padding: 0 32rpx 30rpx; | ||
8 | + display: flex; | ||
9 | +} | ||
10 | +.list-item-left { | ||
11 | + position: relative; | ||
12 | + width: 300rpx; | ||
13 | + height: 300rpx; | ||
14 | + flex-shrink: 0; | ||
15 | +} | ||
16 | +.list-item-right { | ||
17 | + display: flex; | ||
18 | + flex-direction: column; | ||
19 | + justify-content: space-between; | ||
20 | + padding-left: 32rpx; | ||
21 | + /* position: relative; | ||
22 | + padding-bottom: 70rpx; */ | ||
23 | +} | ||
24 | +.item-pic { | ||
25 | + /* width: 400rpx; */ | ||
26 | + width: 100%; | ||
27 | + height: 100%; | ||
28 | + background-color: #eee; | ||
29 | +} | ||
30 | +.item-desc { | ||
31 | + position: absolute; | ||
32 | + bottom: 0; | ||
33 | + width: 100%; | ||
34 | + background: black; | ||
35 | + color: #fff; | ||
36 | + text-align: center; | ||
37 | + padding-bottom: 23rpx; | ||
38 | + | ||
39 | + background: -moz-linear-gradient(bottom,#7A7171, transparent);/*Mozilla*/ | ||
40 | + background: -webkit-gradient(bottom,0 50%,100% 50%,from(#7A7171),to(transparent));/*Old gradient for webkit*/ | ||
41 | + background: -webkit-linear-gradient(bottom,rgba(0,0,0,.8),transparent);/*new gradient for Webkit*/ | ||
42 | + background: -o-linear-gradient(bottom,#7A7171,transparent); /*Opera11*/ | ||
43 | +} | ||
44 | +.item-desc view:first-child { | ||
45 | + font-size: 24rpx; | ||
46 | + font-weight: bold; | ||
47 | +} | ||
48 | +.item-desc view:last-child { | ||
49 | + font-size: 17rpx; | ||
50 | +} | ||
51 | +.item-title { | ||
52 | + font-weight: bold; | ||
53 | + font-size: 30rpx; | ||
54 | + text-align: justify; | ||
55 | + | ||
56 | + display: -webkit-box; | ||
57 | + -webkit-box-orient: vertical; | ||
58 | + -webkit-line-clamp: 4; | ||
59 | + overflow: hidden; | ||
60 | +} | ||
61 | + | ||
62 | +.item-btn { | ||
63 | + width: 172rpx; | ||
64 | + height: 56rpx; | ||
65 | + line-height: 56rpx; | ||
66 | + background-color: #000; | ||
67 | + color: #fff; | ||
68 | + font-size: 28rpx; | ||
69 | + text-align: center; | ||
70 | +} | ||
71 | +subscribe { | ||
72 | + position: relative; | ||
73 | +} | ||
74 | +.subscribe--live-player-subscribe__btn { | ||
75 | + width: 172rpx !important; | ||
76 | + height: 56rpx !important; | ||
77 | + line-height: 56rpx !important; | ||
78 | + background-color: #000 !important; | ||
79 | + font-size: 28rpx !important; | ||
80 | + position: relative; | ||
81 | + border-radius: 0 !important; | ||
82 | + margin: 0 !important; | ||
83 | +} | ||
84 | +.subscribe--live-player-notSubscribe::before { | ||
85 | + content: '订阅'; | ||
86 | + position: absolute; | ||
87 | + left: 0; | ||
88 | + width: 172rpx; | ||
89 | + height: 56rpx; | ||
90 | + background-color: #000; | ||
91 | + color: #fff; | ||
92 | +} | ||
93 | +.subscribe--live-player-hasSubscribe { | ||
94 | + background-color: #666 !important; | ||
95 | +} | ||
0 | \ No newline at end of file | 96 | \ No newline at end of file |
packageA/pages/liveStreamDetails/liveStreamDetails.js
0 → 100644
1 | +// pages/liveStreamDetails/liveStreamDetails.js | ||
2 | +var t = require("../../../utils/util.js"), | ||
3 | + ut = t, | ||
4 | + e = require("../../../utils/common.js"), | ||
5 | + a = require("../../../utils/wxParse/wxParse.js"), | ||
6 | + s = getApp(), | ||
7 | + i = s.request, | ||
8 | + rq = i, | ||
9 | + oo = s.globalData, | ||
10 | + o = s.globalData.setting, | ||
11 | + os = o; | ||
12 | + | ||
13 | +const app = getApp(); | ||
14 | + | ||
15 | +Page({ | ||
16 | + /** | ||
17 | + * 页面的初始数据 | ||
18 | + */ | ||
19 | + data: { | ||
20 | + details: {}, | ||
21 | + status: '', | ||
22 | + btnText: '', | ||
23 | + showActionSheet: true, | ||
24 | + showPlaybill: true, | ||
25 | + windowWidth: 0, | ||
26 | + windowHeight: 0, | ||
27 | + dpr: 0, | ||
28 | + canvasScale: 1.0, | ||
29 | + nickName: '', | ||
30 | + avatarUrl: '', | ||
31 | + coverImg: '', | ||
32 | + canvasToImgPath: '' | ||
33 | + }, | ||
34 | + | ||
35 | + // 点击商品 | ||
36 | + clickgoods: function (e) { | ||
37 | + console.log('...........>', e.currentTarget.dataset.url); | ||
38 | + wx.navigateTo({ | ||
39 | + url: '../../../' + e.currentTarget.dataset.url | ||
40 | + }); | ||
41 | + }, | ||
42 | + | ||
43 | + // 返回首页 | ||
44 | + backHome: function () { | ||
45 | + wx.reLaunch({ | ||
46 | + url: '../../../pages/index/index/index', | ||
47 | + }) | ||
48 | + }, | ||
49 | + | ||
50 | + // 分享操作表 | ||
51 | + clickShare: function () { | ||
52 | + this.setData({ | ||
53 | + showActionSheet: !this.data.showActionSheet | ||
54 | + }) | ||
55 | + }, | ||
56 | + | ||
57 | + // actionSheet - 取消按钮 | ||
58 | + hiddenActionSheet: function () { | ||
59 | + this.setData({ | ||
60 | + showActionSheet: 'false' | ||
61 | + }) | ||
62 | + }, | ||
63 | + | ||
64 | + //生成海报 | ||
65 | + createPlaybill: function () { | ||
66 | + // 1.提示 “正在生成海报...” | ||
67 | + wx.showLoading({ | ||
68 | + title: '正在生成海报...' | ||
69 | + }); | ||
70 | + // 2.生成海报,如果生成完毕,关闭提示 | ||
71 | + this.drawPlaybill(); | ||
72 | + // 3.展示生成的海报 | ||
73 | + this.setData({ | ||
74 | + showPlaybill: !this.data.showPlaybill, | ||
75 | + showActionSheet: 'false' | ||
76 | + }); | ||
77 | + }, | ||
78 | + | ||
79 | + // 获取设备信息 | ||
80 | + getSystemInfo: function() { | ||
81 | + let that = this; | ||
82 | + wx.getSystemInfo({ | ||
83 | + success: function(res) { | ||
84 | + that.setData({ | ||
85 | + windowWidth: res.windowWidth, | ||
86 | + windowHeight: res.windowHeight, | ||
87 | + dpr: res.pixelRatio | ||
88 | + }) | ||
89 | + } | ||
90 | + }); | ||
91 | + }, | ||
92 | + | ||
93 | + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | ||
94 | + drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { | ||
95 | + var lineWidth = 0; | ||
96 | + var lastSubStrIndex = 0; //每次开始截取的字符串的索引 | ||
97 | + var han = 0; | ||
98 | + for (let i = 0; i < str.length; i++) { | ||
99 | + if (han == 2) return; | ||
100 | + //lineWidth += ctx.measureText(str[i]).width; | ||
101 | + lineWidth += ut.measureText(str[i], 21.3 * unit); | ||
102 | + if (lineWidth > canvasWidth) { | ||
103 | + han++; | ||
104 | + | ||
105 | + if (han == 2) { | ||
106 | + ctx.textAlign = 'justify'; | ||
107 | + ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分 | ||
108 | + } else { | ||
109 | + ctx.textAlign = 'justify'; | ||
110 | + ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); | ||
111 | + } | ||
112 | + initHeight += 22; //22为字体的高度 | ||
113 | + lineWidth = 0; | ||
114 | + lastSubStrIndex = i; | ||
115 | + titleHeight += 20; | ||
116 | + } | ||
117 | + if (i == str.length - 1) { //绘制剩余部分 | ||
118 | + ctx.textAlign = 'justify'; | ||
119 | + ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight); | ||
120 | + } | ||
121 | + } | ||
122 | + }, | ||
123 | + | ||
124 | + // 生成海报 | ||
125 | + drawPlaybill: function () { | ||
126 | + var that = this | ||
127 | + // 适配屏get幕 | ||
128 | + let scale = this.data.windowWidth / 375.0 | ||
129 | + | ||
130 | + this.setData({ totalHeight: 667*scale}) | ||
131 | + // 获取Canvas | ||
132 | + let ctx = wx.createCanvasContext('myCanvas') | ||
133 | + | ||
134 | + // 放大 因为不放大的话,生成的分享图会模糊。暂时先注释 | ||
135 | + ctx.scale(this.data.canvasScale, this.data.canvasScale) | ||
136 | + | ||
137 | + // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
138 | + // os.stoid; | ||
139 | + | ||
140 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
141 | + os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | ||
142 | + + "?sceneValue=1012" + "&pageValue=packageA/pages/liveStreamDetails/liveStreamDetails" | ||
143 | + // console.log('path3---->', path3); | ||
144 | + | ||
145 | + | ||
146 | + // 绘制主背景白色 | ||
147 | + ctx.setFillStyle('#ffffff') | ||
148 | + ctx.fillRect(0, 0, this.data.windowWidth, this.data.totalHeight) | ||
149 | + ctx.draw(true); | ||
150 | + | ||
151 | + | ||
152 | + const coverImag = this.data.details['cover_img']; | ||
153 | + const title = this.data.details.name; | ||
154 | + console.log('detail--->', this.data.details); | ||
155 | + | ||
156 | + | ||
157 | + //绘制头像 | ||
158 | + wx.getImageInfo({ | ||
159 | + src: that.data.avatarUrl, | ||
160 | + success: function(res) { | ||
161 | + ctx.save(); | ||
162 | + ctx.beginPath(); | ||
163 | + ctx.arc(29*scale, 27*scale, 14*scale, 0, 2*Math.PI); | ||
164 | + ctx.clip(); | ||
165 | + ctx.drawImage(res.path, 15*scale, 13*scale, 28*scale, 28*scale); | ||
166 | + ctx.restore() | ||
167 | + ctx.draw(true); | ||
168 | + } | ||
169 | + }) | ||
170 | + | ||
171 | + // 绘制昵称 | ||
172 | + ctx.setFontSize(12*scale); | ||
173 | + ctx.setFillStyle('#ADADAD'); | ||
174 | + ctx.fillText(this.data.nickName, 54*scale, 32*scale); | ||
175 | + | ||
176 | + //绘制主图 | ||
177 | + wx.getImageInfo({ | ||
178 | + src: coverImag, | ||
179 | + success: function(res) { | ||
180 | + ctx.drawImage(res.path, 0, 52*scale, 240*scale, 191*scale); | ||
181 | + ctx.draw(true); | ||
182 | + } | ||
183 | + }) | ||
184 | + | ||
185 | + //绘制文字 | ||
186 | + ctx.setFontSize(14*scale); | ||
187 | + ctx.setFillStyle('#1E1E1E'); | ||
188 | + // ctx.fillText(title, 10*scale, 281*scale, 97*scale); | ||
189 | + this.drawText(ctx, title, 10*scale, 281*scale, 130*scale, 130*scale, scale); | ||
190 | + // ctx.draw(true); | ||
191 | + | ||
192 | + //绘制小程序码 | ||
193 | + wx.getImageInfo({ | ||
194 | + src: path3, | ||
195 | + success: function(res) { | ||
196 | + ctx.drawImage(res.path, 152*scale, 262*scale, 66*scale, 66*scale); | ||
197 | + ctx.draw(true); | ||
198 | + } | ||
199 | + }) | ||
200 | + | ||
201 | + //绘制文字:常按识别 | ||
202 | + ctx.setFontSize(14*scale); | ||
203 | + ctx.setFillStyle('#1E1E1E'); | ||
204 | + ctx.fillText('长按识别小程序', 135*scale, 350*scale); | ||
205 | + | ||
206 | + | ||
207 | + //把画板内容绘制成图片,并回调 画板图片路径 | ||
208 | + ctx.draw(true, function() { | ||
209 | + setTimeout(function() { | ||
210 | + wx.canvasToTempFilePath({ | ||
211 | + x: 0, | ||
212 | + y: 0, | ||
213 | + destWidth: that.data.windowWidth*2, | ||
214 | + destHeight: that.data.windowHeight*2, | ||
215 | + fileType: 'jpg', | ||
216 | + quality: 1, | ||
217 | + canvasId: 'myCanvas', | ||
218 | + success: function(res) { | ||
219 | + wx.hideLoading(); | ||
220 | + that.setData({ | ||
221 | + canvasToImgPath: res.tempFilePath, | ||
222 | + }); | ||
223 | + console.log(res.tempFilePath); | ||
224 | + } | ||
225 | + }) | ||
226 | + }, 3000) | ||
227 | + }); | ||
228 | + }, | ||
229 | + | ||
230 | + | ||
231 | + | ||
232 | + //点击观看直播 | ||
233 | + clickBtn: function () { | ||
234 | + let roomId = this.data.details.roomid; | ||
235 | + // let customPearams = encodeURIComponent(JSON.stringify({ path: 'pages/index/index', pid: 1 })); | ||
236 | + wx.navigateTo({ | ||
237 | + url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}` | ||
238 | + }) | ||
239 | + }, | ||
240 | + | ||
241 | + // 保存图片到手机 | ||
242 | + onSaveToPhone() { | ||
243 | + // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限 | ||
244 | + this.getSetting().then((res) => { | ||
245 | + // 判断用户是否授权了保存到相册的权限,如果没有发起授权 | ||
246 | + if (!res.authSetting['scope.writePhotosAlbum']) { | ||
247 | + this.authorize().then(() => { | ||
248 | + // 同意授权后保存下载文件 | ||
249 | + this.savedownloadFile(this.data.canvasToImgPath) | ||
250 | + }) | ||
251 | + } else { | ||
252 | + // 如果已经授权,保存下载文件 | ||
253 | + this.savedownloadFile(this.data.canvasToImgPath) | ||
254 | + } | ||
255 | + }) | ||
256 | + }, | ||
257 | + | ||
258 | + //打开设置,引导用户授权 | ||
259 | + onOpenSetting() { | ||
260 | + wx.openSetting({ | ||
261 | + success:(res) => { | ||
262 | + console.log(res.authSetting) | ||
263 | + } | ||
264 | + }) | ||
265 | + }, | ||
266 | + | ||
267 | + // 获取用户已经授予了哪些权限 | ||
268 | + getSetting() { | ||
269 | + return new Promise((resolve, reject) => { | ||
270 | + wx.getSetting({ | ||
271 | + success: res => { | ||
272 | + console.log('getting---->', res); | ||
273 | + resolve(res) | ||
274 | + } | ||
275 | + }) | ||
276 | + }) | ||
277 | + }, | ||
278 | + | ||
279 | + // 发起首次授权请求 | ||
280 | + authorize() { | ||
281 | + // isFirst 用来记录是否为首次发起授权, | ||
282 | + // 如果首次授权拒绝后,isFirst赋值为1 | ||
283 | + let isFirst = wx.getStorageSync('isFirst') || 0; | ||
284 | + return new Promise((resolve, reject) => { | ||
285 | + wx.authorize({ | ||
286 | + scope: 'scope.writePhotosAlbum', | ||
287 | + // 同意授权 | ||
288 | + success: () => { | ||
289 | + resolve() | ||
290 | + }, | ||
291 | + // 拒绝授权,这里是用户拒绝授权后的回调 | ||
292 | + fail: res => { | ||
293 | + if(isFirst === 0) { | ||
294 | + wx.setStorageSync('isFirst', 1); | ||
295 | + wx.showToast({ | ||
296 | + title: '保存失败', | ||
297 | + icon: 'none', | ||
298 | + duration: 1000 | ||
299 | + }) | ||
300 | + } else { | ||
301 | + this.showModal() | ||
302 | + } | ||
303 | + console.log('拒绝授权'); | ||
304 | + reject() | ||
305 | + } | ||
306 | + }) | ||
307 | + }) | ||
308 | + }, | ||
309 | + | ||
310 | + //保存下载文件 | ||
311 | + savedownloadFile(img) { | ||
312 | + this.downLoadFile(img).then((res) => { | ||
313 | + return this.saveImageToPhotosAlbum(res.tempFilePath) | ||
314 | + }).then(() => { | ||
315 | + }) | ||
316 | + }, | ||
317 | + | ||
318 | + //单文件下载(下载文件资源到本地),客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径。 | ||
319 | + downLoadFile(img) { | ||
320 | + return new Promise((resolve, reject) => { | ||
321 | + wx.showLoading({ | ||
322 | + title: '保存中...', | ||
323 | + mask: true, | ||
324 | + }); | ||
325 | + wx.downloadFile({ | ||
326 | + url: img, | ||
327 | + success: (res) => { | ||
328 | + console.log('downloadfile', res) | ||
329 | + resolve(res) | ||
330 | + } | ||
331 | + }) | ||
332 | + }) | ||
333 | + }, | ||
334 | + | ||
335 | + // 保存图片到系统相册 | ||
336 | + saveImageToPhotosAlbum(saveUrl) { | ||
337 | + var self = this; | ||
338 | + return new Promise((resolve, reject) => { | ||
339 | + wx.saveImageToPhotosAlbum({ | ||
340 | + filePath: saveUrl, | ||
341 | + success: (res) => { | ||
342 | + wx.showToast({ | ||
343 | + title: '保存成功', | ||
344 | + duration: 1000, | ||
345 | + }); | ||
346 | + self.setData({ | ||
347 | + showPlaybill: 'true' | ||
348 | + }); | ||
349 | + resolve() | ||
350 | + } | ||
351 | + }) | ||
352 | + }) | ||
353 | + }, | ||
354 | + | ||
355 | + | ||
356 | + // 弹出模态框提示用户是否要去设置页授权 | ||
357 | + showModal() { | ||
358 | + wx.showModal({ | ||
359 | + title: '检测到您没有打开保存到相册的权限,是否前往设置打开?', | ||
360 | + success: (res) => { | ||
361 | + if (res.confirm) { | ||
362 | + console.log('用户点击确定') | ||
363 | + this.onOpenSetting() // 打开设置页面 | ||
364 | + } else if (res.cancel) { | ||
365 | + console.log('用户点击取消') | ||
366 | + } | ||
367 | + } | ||
368 | + }) | ||
369 | + }, | ||
370 | + /** | ||
371 | + * 生命周期函数--监听页面加载 | ||
372 | + */ | ||
373 | + onLoad: function (options) { | ||
374 | + var that = this; | ||
375 | + this.getSystemInfo(); | ||
376 | + | ||
377 | + getApp().request.promiseGet("/api/weshop/wx/livelist/get",{ | ||
378 | + data:{ id: options.id } | ||
379 | + }).then(res=>{ | ||
380 | + if(res.data.code==0){ | ||
381 | + var obj = res.data.data; | ||
382 | + var goods = JSON.parse(obj.goods); | ||
383 | + obj.goods = goods; | ||
384 | + that.setData({ | ||
385 | + details: obj | ||
386 | + }) | ||
387 | + } | ||
388 | + }) | ||
389 | + | ||
390 | + switch(options.live) { | ||
391 | + case 'toBegin': { | ||
392 | + this.setData({ | ||
393 | + btnText: '订阅' | ||
394 | + }) | ||
395 | + break; | ||
396 | + } | ||
397 | + case 'ing': { | ||
398 | + this.setData({ | ||
399 | + btnText: '进入直播间' | ||
400 | + }) | ||
401 | + break; | ||
402 | + } | ||
403 | + default: { | ||
404 | + this.setData({ | ||
405 | + btnText: '回放直播' | ||
406 | + }) | ||
407 | + break; | ||
408 | + } | ||
409 | + } | ||
410 | + | ||
411 | + this.setData({ | ||
412 | + nickName: app.globalData.userInfo.nickname, | ||
413 | + avatarUrl: app.globalData.userInfo.head_pic | ||
414 | + }) | ||
415 | + | ||
416 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
417 | + os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | ||
418 | + wx.getImageInfo({ | ||
419 | + src: path3, | ||
420 | + success: function(res) { | ||
421 | + // ctx.drawImage(res.path, 152*scale, 262*scale, 66*scale, 66*scale); | ||
422 | + // ctx.draw(true); | ||
423 | + that.setData({ | ||
424 | + ewm: res.path | ||
425 | + }) | ||
426 | + } | ||
427 | + }) | ||
428 | + }, | ||
429 | + | ||
430 | + // 获取图片信息 | ||
431 | + getImageInfo(src) { | ||
432 | + return new Promise((resolve, reject) => { | ||
433 | + wx.getImageInfo({ | ||
434 | + src: src, | ||
435 | + success: (res) => { | ||
436 | + resolve(res); | ||
437 | + } | ||
438 | + }) | ||
439 | + }); | ||
440 | + }, | ||
441 | + | ||
442 | + /** | ||
443 | + * 生命周期函数--监听页面初次渲染完成 | ||
444 | + */ | ||
445 | + onReady: function () { | ||
446 | + | ||
447 | + }, | ||
448 | + | ||
449 | + /** | ||
450 | + * 生命周期函数--监听页面显示 | ||
451 | + */ | ||
452 | + onShow: function () { | ||
453 | + | ||
454 | + }, | ||
455 | + | ||
456 | + /** | ||
457 | + * 生命周期函数--监听页面隐藏 | ||
458 | + */ | ||
459 | + onHide: function () { | ||
460 | + | ||
461 | + }, | ||
462 | + | ||
463 | + /** | ||
464 | + * 生命周期函数--监听页面卸载 | ||
465 | + */ | ||
466 | + onUnload: function () { | ||
467 | + | ||
468 | + }, | ||
469 | + | ||
470 | + /** | ||
471 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
472 | + */ | ||
473 | + onPullDownRefresh: function () { | ||
474 | + | ||
475 | + }, | ||
476 | + | ||
477 | + /** | ||
478 | + * 页面上拉触底事件的处理函数 | ||
479 | + */ | ||
480 | + onReachBottom: function () { | ||
481 | + | ||
482 | + }, | ||
483 | + | ||
484 | + /** | ||
485 | + * 用户点击右上角分享 | ||
486 | + */ | ||
487 | + onShareAppMessage: function () { | ||
488 | + this.setData({ | ||
489 | + showActionSheet: 'false' | ||
490 | + }) | ||
491 | + var self = this; | ||
492 | + return { | ||
493 | + title: this.data.details.name, | ||
494 | + success: function(res) { | ||
495 | + console.log('res---->', res); | ||
496 | + }, | ||
497 | + complete: function(res) { | ||
498 | + console.log('comple', res) | ||
499 | + } | ||
500 | + } | ||
501 | + } | ||
502 | +}) |
packageA/pages/liveStreamDetails/liveStreamDetails.json
0 → 100644
packageA/pages/liveStreamDetails/liveStreamDetails.skeleton.wxml
0 → 100644
1 | +<!-- | ||
2 | +此文件为开发者工具生成,生成时间: 2020/7/4 下午3:58:01 | ||
3 | +使用方法: | ||
4 | +1. 在"packageA\pages\liveStreamDetails\liveStreamDetails.wxml"中使用`include`指令引入此模板, | ||
5 | +2. 在"packageA\pages\liveStreamDetails\liveStreamDetails.wxss"中使用`import`指令引入"packageA\pages\liveStreamDetails\liveStreamDetails.skeleton.wxss" | ||
6 | +3. 书写对应的逻辑,来控制骨架屏的显示与隐藏 | ||
7 | + | ||
8 | +更多详细信息可以参考文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/skeleton.html | ||
9 | +--> | ||
10 | +<view class="sk-container"></view> | ||
0 | \ No newline at end of file | 11 | \ No newline at end of file |
packageA/pages/liveStreamDetails/liveStreamDetails.skeleton.wxss
0 → 100644
1 | +/* | ||
2 | +此文件为开发者工具生成,生成时间: 2020/7/4 下午3:58:01 | ||
3 | +使用方法:参考 "packageA\pages\liveStreamDetails\liveStreamDetails.skeleton.wxml" | ||
4 | +*/ | ||
5 | +.sk-transparent { | ||
6 | + color: transparent !important; | ||
7 | + } | ||
8 | +.sk-container { | ||
9 | + position: absolute; | ||
10 | + overflow: hidden; | ||
11 | + top: 0; | ||
12 | + left: 0; | ||
13 | + right: 0; | ||
14 | + bottom: 0; | ||
15 | + z-index: 1000000; | ||
16 | + background-color: transparent; | ||
17 | + } |
packageA/pages/liveStreamDetails/liveStreamDetails.wxml
0 → 100644
1 | +<!--pages/liveStreamDetails/liveStreamDetails.wxml--> | ||
2 | +<wxs src="../../../utils/filter.wxs" module="filter"></wxs> | ||
3 | +<wxs src="../../../utils/myUtils.wxs" module="myUtils"></wxs> | ||
4 | +<!-- <wxs src="/packageA/pages/liveStreamDetails/wxs.wxs" module="tool"></wxs> --> | ||
5 | +<view class="content"> | ||
6 | + <!-- 封面标题 --> | ||
7 | + <view class="cover-container"> | ||
8 | + <image src="{{details.cover_img}}" class="cover-img" mode="aspectFill"></image> | ||
9 | + <!-- <view class="cover-desc"> | ||
10 | + <view>{{details.name}}</view> | ||
11 | + <view>{{filter.format_time(details.start_time)}}</view> | ||
12 | + </view> --> | ||
13 | + </view> | ||
14 | + | ||
15 | + <!-- 直播详情 --> | ||
16 | + <view class="desc-container"> | ||
17 | + <view class="desc-title">{{details.name}}</view> | ||
18 | + <text class="desc-status">{{myUtils.liveStatus(details.live_status)}}</text> | ||
19 | + <!-- <view class="desc-content"> | ||
20 | + <view>6月24日20:00锁定直播 盘点年中 「上榜」好货!</view> | ||
21 | + <view>护肤、彩妆、香氛群星汇聚,更有折扣买赠与神秘新品加持~</view> | ||
22 | + <view>多轮抽奖惊喜连连,不容错过!</view> | ||
23 | + </view> --> | ||
24 | + </view> | ||
25 | + | ||
26 | + <!-- 列表 --> | ||
27 | + <view class="list"> | ||
28 | + <!-- 列表项 --> | ||
29 | + <block wx:for="{{details.goods}}"> | ||
30 | + <view class="list-item" bindtap="clickgoods" data-url="{{item.url}}"> | ||
31 | + <!-- {{item}} --> | ||
32 | + <image src="{{item.cover_img}}" class="item-pic"></image> | ||
33 | + <view class="item-desc-container"> | ||
34 | + <view class="item-desc"> | ||
35 | + <!-- <view>WEI</view> --> | ||
36 | + <view>{{item.name}}</view> | ||
37 | + </view> | ||
38 | + <view class="item-price">{{item.price}}</view> | ||
39 | + </view> | ||
40 | + </view> | ||
41 | + </block> | ||
42 | + | ||
43 | + </view> | ||
44 | + | ||
45 | + <!-- 回放直播 --> | ||
46 | + <view class="btn-container"> | ||
47 | + <subscribe wx:if="{{details.live_status === '102'}}" class="btn" room-id="{{details.roomid}}" stopPropagation="{{true}}"></subscribe> | ||
48 | + <view wx:else class="btn" bindtap="clickBtn">{{btnText}}</view> | ||
49 | + </view> | ||
50 | + | ||
51 | + <!-- 分享 --> | ||
52 | + <view class="share-container"> | ||
53 | + <image src="/packageA/images/liveStreamDetails/share.jpg" bindtap="clickShare"></image> | ||
54 | + <image src="/packageA/images/liveStreamDetails/home.jpg" bindtap="backHome"></image> | ||
55 | + </view> | ||
56 | + | ||
57 | + <!-- actionSheet --> | ||
58 | + <view class="{{showActionSheet ? 'share-actionSheet':'share-actionSheet active'}}" hidden="{{showActionSheet}}"> | ||
59 | + <view class="share-actionSheet-title">分享</view> | ||
60 | + <view class="share-actionSheet-list"> | ||
61 | + <view class="share-actionSheet-item" hover-class="active"> | ||
62 | + <button open-type="share"> | ||
63 | + <image src="/packageA/images/liveStreamDetails/friend.jpg" class="share-actionSheet-pic"></image> | ||
64 | + <text class="share-actionSheet-desc">发送给朋友</text> | ||
65 | + </button> | ||
66 | + </view> | ||
67 | + <view class="share-actionSheet-item" hover-class="active" bindtap="createPlaybill"> | ||
68 | + <image src="/packageA/images/liveStreamDetails/circle.jpg" class="share-actionSheet-pic"></image> | ||
69 | + <text class="share-actionSheet-desc">生成分享海报</text> | ||
70 | + </view> | ||
71 | + </view> | ||
72 | + <view class="share-actionSheet-cancle" bindtap="hiddenActionSheet">取消</view> | ||
73 | + </view> | ||
74 | + | ||
75 | + <!-- 生成海报 --> | ||
76 | + <view class="{{showPlaybill ? 'playbill':'playbill active'}}" hidden="{{showPlaybill}}"> | ||
77 | + <!-- <image src="{{canvasToImgPath}}" class="playbill-pic"></image> --> | ||
78 | + <canvas canvas-id="myCanvas" class="playbill-pic" style="width:{{windowWidth*dpr}};height:width:{{windowHeight*dpr}}"></canvas> | ||
79 | + <view class="playbill-save" bindtap="onSaveToPhone"> | ||
80 | + <image src="/packageA/images/liveStreamDetails/save.jpg"></image>保存至相册 | ||
81 | + </view> | ||
82 | + </view> | ||
83 | + | ||
84 | + <!-- mask --> | ||
85 | + <!-- 这里mask必须强制放在actionsheet和playbill的后面 --> | ||
86 | + <view class="mask" bindtap="hiddenActionSheet"></view> | ||
87 | + | ||
88 | +</view> |
packageA/pages/liveStreamDetails/liveStreamDetails.wxss
0 → 100644
1 | +/* pages/liveStreamDetails/liveStreamDetails.wxss */ | ||
2 | +.active { | ||
3 | + background-color: #ddd; | ||
4 | +} | ||
5 | + | ||
6 | +.content { | ||
7 | + background-color: white; | ||
8 | + padding-bottom: 168rpx; | ||
9 | +} | ||
10 | +.cover-container { | ||
11 | + height: 646rpx; | ||
12 | + position: relative; | ||
13 | +} | ||
14 | +.cover-img { | ||
15 | + width: 100%; | ||
16 | + height: 100%; | ||
17 | +} | ||
18 | +.cover-desc { | ||
19 | + position: absolute; | ||
20 | + bottom: 0; | ||
21 | + width: 100%; | ||
22 | + text-align: center; | ||
23 | + padding-top: 64rpx; | ||
24 | + padding-bottom: 64rpx; | ||
25 | + color: #fff; | ||
26 | + | ||
27 | + background: -moz-linear-gradient(bottom,#7A7171, transparent);/*Mozilla*/ | ||
28 | + background: -webkit-gradient(bottom,0 50%,100% 50%,from(#7A7171),to(transparent));/*Old gradient for webkit*/ | ||
29 | + background: -webkit-linear-gradient(bottom,rgba(0,0,0,.8),transparent);/*new gradient for Webkit*/ | ||
30 | + background: -o-linear-gradient(bottom,#7A7171,transparent); /*Opera11*/ | ||
31 | +} | ||
32 | +.cover-desc view:first-child { | ||
33 | + font-size: 50rpx; | ||
34 | +} | ||
35 | +.cover-desc view:last-child { | ||
36 | + font-size: 42rpx; | ||
37 | +} | ||
38 | + | ||
39 | +.desc-container { | ||
40 | + padding: 56rpx 46rpx 41rpx; | ||
41 | + color: #3E3E3E; | ||
42 | +} | ||
43 | +.desc-title { | ||
44 | + font-size: 42rpx; | ||
45 | + font-weight: bold; | ||
46 | +} | ||
47 | +.desc-status { | ||
48 | + display: inline-block; | ||
49 | + color: #5B5B5B; | ||
50 | + font-size: 28rpx; | ||
51 | + height: 50rpx; | ||
52 | + line-height: 50rpx; | ||
53 | + padding: 0 30rpx; | ||
54 | + background-color: #eee; | ||
55 | + margin-top: 22rpx; | ||
56 | + margin-bottom: 44rpx; | ||
57 | +} | ||
58 | +.desc-content { | ||
59 | + font-size: 29rpx; | ||
60 | +} | ||
61 | +.list { | ||
62 | + padding: 0 36rpx; | ||
63 | +} | ||
64 | +.list-item { | ||
65 | + display: flex; | ||
66 | + padding-bottom: 34rpx; | ||
67 | +} | ||
68 | +.list-item:not(:first-child) { | ||
69 | + padding-top: 34rpx; | ||
70 | +} | ||
71 | +.list-item:not(:last-child) { | ||
72 | + border-bottom: 2rpx solid #B5B5B5; | ||
73 | +} | ||
74 | +.item-pic { | ||
75 | + width: 224rpx; | ||
76 | + height: 224rpx; | ||
77 | + border: 2rpx solid #E1E1E1; | ||
78 | +} | ||
79 | +.item-desc-container { | ||
80 | + padding-left: 46rpx; | ||
81 | + font-size: 24rpx; | ||
82 | + display: flex; | ||
83 | + flex-direction: column; | ||
84 | + justify-content: space-between; | ||
85 | +} | ||
86 | +.item-desc view:first-child { | ||
87 | + padding-top: 10rpx; | ||
88 | + padding-bottom: 38rpx; | ||
89 | +} | ||
90 | +.item-price:before { | ||
91 | + content: '¥'; | ||
92 | +} | ||
93 | + | ||
94 | +.share-container { | ||
95 | + /* width: 86rpx; */ | ||
96 | + position: fixed; | ||
97 | + padding: 0 8rpx; | ||
98 | + box-shadow: 0px 0px 2px 1px rgba(0,0,0,0.1); | ||
99 | + right: 28rpx; | ||
100 | + top: 50%; | ||
101 | + background-color: #fff; | ||
102 | +} | ||
103 | +.share-container image { | ||
104 | + display: block; | ||
105 | + width: 60rpx; | ||
106 | + height: 60rpx; | ||
107 | + padding-top: 14rpx; | ||
108 | + padding-bottom: 11rpx; | ||
109 | +} | ||
110 | +.share-container image:first-child { | ||
111 | + border-bottom: 2rpx solid #E7E7E7; | ||
112 | +} | ||
113 | + | ||
114 | + | ||
115 | +.btn-container { | ||
116 | + background-color: #fff; | ||
117 | + box-sizing: border-box; | ||
118 | + padding: 24rpx 128rpx; | ||
119 | + position: fixed; | ||
120 | + bottom: 0; | ||
121 | + width: 100%; | ||
122 | + box-shadow: 0px -1px 4px 1px rgba(0,0,0,0.1); | ||
123 | +} | ||
124 | +.btn { | ||
125 | + color: #fff; | ||
126 | + background-color: #000; | ||
127 | + font-size: 36rpx; | ||
128 | + line-height: 120rpx; | ||
129 | + text-align: center; | ||
130 | + /* width: 618rpx; | ||
131 | + height: 92rpx; */ | ||
132 | +} | ||
133 | +.subscribe--live-player-notSubscribe { | ||
134 | + position: relative; | ||
135 | +} | ||
136 | +.subscribe--live-player-notSubscribe::before { | ||
137 | + content: '订阅'; | ||
138 | + position: absolute; | ||
139 | + left: 0; | ||
140 | + width: 100%; | ||
141 | + height: auto; | ||
142 | + background-color: #000; | ||
143 | + color: #fff; | ||
144 | +} | ||
145 | +.subscribe--live-player-subscribe__btn { | ||
146 | + width: 100% !important; | ||
147 | + height: auto !important; | ||
148 | + font-size: 36rpx !important; | ||
149 | + line-height: 120rpx !important; | ||
150 | + border-radius: 0 !important; | ||
151 | + background-color: #000 !important; | ||
152 | +} | ||
153 | +.subscribe--live-player-hasSubscribe { | ||
154 | + background-color: #666 !important; | ||
155 | +} | ||
156 | + | ||
157 | +.share-actionSheet { | ||
158 | + background-color: white; | ||
159 | + padding-top: 45rpx; | ||
160 | + position: fixed; | ||
161 | + width: 100%; | ||
162 | + bottom: 0; | ||
163 | + z-index: 2; | ||
164 | +} | ||
165 | +.share-actionSheet-title { | ||
166 | + font-size: 38rpx; | ||
167 | + | ||
168 | +} | ||
169 | +.share-actionSheet-list { | ||
170 | + display: flex; | ||
171 | + justify-content: space-around; | ||
172 | + padding-bottom: 30rpx; | ||
173 | +} | ||
174 | +.share-actionSheet-item { | ||
175 | + text-align: center; | ||
176 | + padding: 20rpx; | ||
177 | +} | ||
178 | +.share-actionSheet-pic { | ||
179 | + display: block; | ||
180 | + width: 118rpx; | ||
181 | + height: 118rpx; | ||
182 | + border-radius: 50%; | ||
183 | + margin: 0 auto; | ||
184 | +} | ||
185 | +.share-actionSheet-desc { | ||
186 | + font-size: 28rpx; | ||
187 | +} | ||
188 | + | ||
189 | +.share-actionSheet-title, | ||
190 | +.share-actionSheet-cancle { | ||
191 | + text-align: center; | ||
192 | +} | ||
193 | + | ||
194 | +.share-actionSheet-cancle { | ||
195 | + padding: 30rpx 0; | ||
196 | + border-top: 2rpx solid #CBCBCB; | ||
197 | +} | ||
198 | + | ||
199 | +.mask { | ||
200 | + display: none; | ||
201 | + background-color: rgba(0,0,0,.7); | ||
202 | + position: fixed; | ||
203 | + top: 0; | ||
204 | + bottom: 0; | ||
205 | + left: 0; | ||
206 | + right: 0; | ||
207 | +} | ||
208 | +.playbill { | ||
209 | + position: fixed; | ||
210 | + left: 50%; | ||
211 | + top: 50%; | ||
212 | + transform: translate(-50%, -50%); | ||
213 | + z-index: 9999; | ||
214 | + background: none; | ||
215 | +} | ||
216 | +.share-actionSheet.active ~ .mask, | ||
217 | +.playbill.active ~ .mask { | ||
218 | + display: block; | ||
219 | +} | ||
220 | + | ||
221 | +.playbill-pic { | ||
222 | + width: 478rpx; | ||
223 | + height: 737rpx; | ||
224 | + border-width: 31rpx 20rpx 51rpx; | ||
225 | + border-color: black; | ||
226 | + border-style: solid; | ||
227 | + margin: 0 auto 26rpx; | ||
228 | +} | ||
229 | + | ||
230 | +.playbill-save { | ||
231 | + width: 560rpx; | ||
232 | + height: 100rpx; | ||
233 | + line-height: 100rpx; | ||
234 | + background-color: black; | ||
235 | + color: #fff; | ||
236 | + font-size: 36rpx; | ||
237 | + text-align: center; | ||
238 | +} | ||
239 | +.playbill-save image { | ||
240 | + width: 44rpx; | ||
241 | + height: 36rpx; | ||
242 | + margin-right: 23rpx; | ||
243 | +} | ||
244 | + | ||
245 | +button::after { | ||
246 | + border: none; | ||
247 | +} | ||
0 | \ No newline at end of file | 248 | \ No newline at end of file |
packageA/pages/prom_list/prom_list.js
@@ -12,6 +12,7 @@ var utils = require('../../../utils/util.js'),ut=utils; | @@ -12,6 +12,7 @@ var utils = require('../../../utils/util.js'),ut=utils; | ||
12 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 12 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
13 | 13 | ||
14 | 14 | ||
15 | + | ||
15 | Page({ | 16 | Page({ |
16 | data: { | 17 | data: { |
17 | gid: "", | 18 | gid: "", |
pages/goods/goodsInfo/goodsInfo.js
@@ -3219,17 +3219,17 @@ Page({ | @@ -3219,17 +3219,17 @@ Page({ | ||
3219 | //--定义的保存图片方法,分享团--- | 3219 | //--定义的保存图片方法,分享团--- |
3220 | saveImageToPhotosAlbum: function() { | 3220 | saveImageToPhotosAlbum: function() { |
3221 | //--先判断会员状态-- | 3221 | //--先判断会员状态-- |
3222 | - var user_info = getApp().globalData.userInfo; | ||
3223 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
3224 | - //getApp().my_warnning("请先登录",0,this); | ||
3225 | - wx.navigateTo({ url: '/pages/getphone/getphone', }) | ||
3226 | - return false; | ||
3227 | - } | 3222 | + // var user_info = getApp().globalData.userInfo; |
3223 | + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
3224 | + // //getApp().my_warnning("请先登录",0,this); | ||
3225 | + // wx.navigateTo({ url: '/pages/getphone/getphone', }) | ||
3226 | + // return false; | ||
3227 | + // } | ||
3228 | 3228 | ||
3229 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 | 3229 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 |
3230 | - var type = this.data.prom_type; | ||
3231 | - if (type == 6) type = 2; | ||
3232 | - if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; | 3230 | + // var type = this.data.prom_type; |
3231 | + // if (type == 6) type = 2; | ||
3232 | + // if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; | ||
3233 | 3233 | ||
3234 | wx.showLoading({ | 3234 | wx.showLoading({ |
3235 | title: '生成中...', | 3235 | title: '生成中...', |
@@ -3254,7 +3254,7 @@ Page({ | @@ -3254,7 +3254,7 @@ Page({ | ||
3254 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | 3254 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
3255 | os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | 3255 | os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; |
3256 | 3256 | ||
3257 | - console.log(path3); | 3257 | + console.log('xiaochengxu----->',path3); |
3258 | 3258 | ||
3259 | //读取文件成功则OK-- | 3259 | //读取文件成功则OK-- |
3260 | wx.getImageInfo({ | 3260 | wx.getImageInfo({ |
@@ -3284,155 +3284,164 @@ Page({ | @@ -3284,155 +3284,164 @@ Page({ | ||
3284 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | 3284 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
3285 | context.setFillStyle("black"); | 3285 | context.setFillStyle("black"); |
3286 | context.setFontSize(21.3 * unit) | 3286 | context.setFontSize(21.3 * unit) |
3287 | - th.draw_Text(context, th.data.data.goods_name, | ||
3288 | - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); | 3287 | + th.draw_Text(context, th.data.data.goods_name, 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); |
3289 | //------产品的价格------- | 3288 | //------产品的价格------- |
3290 | - context.setFontSize(23 * unit) | ||
3291 | - context.setFillStyle("red") | ||
3292 | - context.fillText("¥", 416 * unit, 185 * unit); | ||
3293 | - context.setFontSize(31 * unit) | ||
3294 | - var pri0 = th.data.data.shop_price; | ||
3295 | - if (th.data.prom_act) | ||
3296 | - pri0 = th.data.prom_act.price; | ||
3297 | - | ||
3298 | - pri0 = parseFloat(pri0).toFixed(2); | ||
3299 | - context.fillText(pri0, 438 * unit, 185 * unit); | 3289 | + // context.setFontSize(23 * unit) |
3290 | + // context.setFillStyle("red") | ||
3291 | + // context.fillText("¥", 416 * unit, 185 * unit); | ||
3292 | + // context.setFontSize(31 * unit) | ||
3293 | + // var pri0 = th.data.data.shop_price; | ||
3294 | + // if (th.data.prom_act) | ||
3295 | + // pri0 = th.data.prom_act.price; | ||
3296 | + | ||
3297 | + // pri0 = parseFloat(pri0).toFixed(2); | ||
3298 | + // context.fillText(pri0, 438 * unit, 185 * unit); | ||
3300 | //---市场价划掉--- | 3299 | //---市场价划掉--- |
3301 | - context.setFillStyle("gray") | ||
3302 | - context.setFontSize(22 * unit) | ||
3303 | - context.fillText("¥" + th.data.data.market_price, 426 * unit, 213 * unit); | ||
3304 | - context.setStrokeStyle('gray') | ||
3305 | - context.setLineWidth(1 * unit) | ||
3306 | - context.moveTo(426 * unit, 206 * unit) | ||
3307 | - context.lineTo(510 * unit, 206 * unit) | ||
3308 | - context.stroke(); | 3300 | + // context.setFillStyle("gray") |
3301 | + // context.setFontSize(22 * unit) | ||
3302 | + // context.fillText("¥" + th.data.data.market_price, 426 * unit, 213 * unit); | ||
3303 | + // context.setStrokeStyle('gray') | ||
3304 | + // context.setLineWidth(1 * unit) | ||
3305 | + // context.moveTo(426 * unit, 206 * unit) | ||
3306 | + // context.lineTo(510 * unit, 206 * unit) | ||
3307 | + // context.stroke(); | ||
3309 | //---中间大图--- | 3308 | //---中间大图--- |
3310 | context.drawImage(th.data.share_goods_img, 68 * unit, 242 * unit, 410 * unit, 410 * unit); | 3309 | context.drawImage(th.data.share_goods_img, 68 * unit, 242 * unit, 410 * unit, 410 * unit); |
3311 | - //-------大图后面就不一样了----------- | ||
3312 | - switch (type) { | ||
3313 | - case 0: //普通商品的展示 | ||
3314 | - //中间的几个字 | ||
3315 | - var g_path = "../../../images/share/s_gou.png"; | ||
3316 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3317 | - context.setFillStyle("red") | ||
3318 | - context.setFontSize(18 * unit) | ||
3319 | - context.fillText("正品保证", 84 * unit, 690 * unit); | ||
3320 | - | ||
3321 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3322 | - context.setFillStyle("red") | ||
3323 | - context.setFontSize(18 * unit) | ||
3324 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | ||
3325 | - | ||
3326 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3327 | - context.setFillStyle("red") | ||
3328 | - context.setFontSize(18 * unit) | ||
3329 | - context.fillText("官方验证", 420 * unit, 690 * unit); | ||
3330 | - //---画线--- | ||
3331 | - context.setLineWidth(1 * unit) | ||
3332 | - context.moveTo(32 * unit, 710 * unit) | ||
3333 | - context.lineTo(520 * unit, 710 * unit) | ||
3334 | - context.stroke(); | ||
3335 | - //---文字--- | ||
3336 | - context.setFontSize(22 * unit) | ||
3337 | - context.setFillStyle("black") | ||
3338 | - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit); | ||
3339 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit); | ||
3340 | - //---二维吗图--- | ||
3341 | - context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); | ||
3342 | - break; | ||
3343 | - case 1: //秒杀商品的展示 | ||
3344 | - //---画线--- | ||
3345 | - context.setLineWidth(1 * unit) | ||
3346 | - context.moveTo(32 * unit, 670 * unit) | ||
3347 | - context.lineTo(520 * unit, 670 * unit) | ||
3348 | - context.stroke(); | 3310 | + |
3311 | + //---文字--- | ||
3312 | + context.setFontSize(22 * unit) | ||
3313 | + context.setFillStyle("black") | ||
3314 | + context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit); | ||
3315 | + context.fillText("长按识别小程序码", 40 * unit, 826 * unit); | ||
3316 | + //---二维吗图--- | ||
3317 | + context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); | ||
3349 | 3318 | ||
3350 | - //画秒杀的图片 | ||
3351 | - var miaos_path = '../../../images/share/miao_share.png'; | ||
3352 | - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | ||
3353 | 3319 | ||
3354 | - //---文字--- | ||
3355 | - context.setFontSize(22 * unit) | ||
3356 | - context.setFillStyle("black") | ||
3357 | - context.fillText("特惠好物,限时秒杀", 40 * unit, 806 * unit); | ||
3358 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); | ||
3359 | - //---二维吗图--- | ||
3360 | - context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); | ||
3361 | - break; | ||
3362 | - | ||
3363 | - case 2: //会员团和商家团的展示 | ||
3364 | - //---画线--- | ||
3365 | - context.setLineWidth(1 * unit) | ||
3366 | - context.moveTo(32 * unit, 670 * unit) | ||
3367 | - context.lineTo(520 * unit, 670 * unit) | ||
3368 | - context.stroke(); | ||
3369 | - //---文字--- | ||
3370 | - context.setFontSize(22 * unit) | ||
3371 | - context.font = 'normal bold'; | ||
3372 | - context.setFillStyle("black") | ||
3373 | - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); | ||
3374 | - | ||
3375 | - //绘制成团图片 | ||
3376 | - var ct_img = "../../../images/share/ct_num.png"; | ||
3377 | - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); | ||
3378 | - var ct_num = th.data.prom_act.ct_num; | ||
3379 | - context.setFontSize(14 * unit) | ||
3380 | - context.font = 'normal'; | ||
3381 | - context.setFillStyle("red") | ||
3382 | - if (ct_num < 10) { | ||
3383 | - context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit); | ||
3384 | - } else { | ||
3385 | - context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit); | ||
3386 | - } | ||
3387 | - context.setFontSize(22 * unit) | ||
3388 | - context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); | ||
3389 | - context.setFillStyle("gray") | ||
3390 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 826 * unit); | ||
3391 | - context.setFillStyle("black") | ||
3392 | - context.font = 'normal bold 18px sans-serif'; | ||
3393 | - context.setFontSize(21.3 * unit) | ||
3394 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit); | ||
3395 | - //---二维吗图--- | ||
3396 | - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); | ||
3397 | - break | ||
3398 | - case 3: //阶梯团的展示 | 3320 | + //-------大图后面就不一样了----------- |
3321 | + // switch (type) { | ||
3322 | + // case 0: //普通商品的展示 | ||
3323 | + //中间的几个字 | ||
3324 | + // var g_path = "../../../images/share/s_gou.png"; | ||
3325 | + // context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3326 | + // context.setFillStyle("red") | ||
3327 | + // context.setFontSize(18 * unit) | ||
3328 | + // context.fillText("正品保证", 84 * unit, 690 * unit); | ||
3329 | + | ||
3330 | + // context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3331 | + // context.setFillStyle("red") | ||
3332 | + // context.setFontSize(18 * unit) | ||
3333 | + // context.fillText("纯实体店", 246 * unit, 690 * unit); | ||
3334 | + | ||
3335 | + // context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
3336 | + // context.setFillStyle("red") | ||
3337 | + // context.setFontSize(18 * unit) | ||
3338 | + // context.fillText("官方验证", 420 * unit, 690 * unit); | ||
3399 | //---画线--- | 3339 | //---画线--- |
3400 | - context.setLineWidth(1 * unit) | ||
3401 | - context.moveTo(32 * unit, 670 * unit) | ||
3402 | - context.lineTo(520 * unit, 670 * unit) | ||
3403 | - context.stroke(); | 3340 | + // context.setLineWidth(1 * unit) |
3341 | + // context.moveTo(32 * unit, 710 * unit) | ||
3342 | + // context.lineTo(520 * unit, 710 * unit) | ||
3343 | + // context.stroke(); | ||
3404 | //---文字--- | 3344 | //---文字--- |
3405 | - context.setFontSize(22 * unit) | ||
3406 | - context.font = 'normal bold'; | ||
3407 | - context.setFillStyle("black") | ||
3408 | - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); | ||
3409 | - //---绘制中间阶梯的价格--- | ||
3410 | - var list = th.data.prom_act.ct_rylist; | ||
3411 | - for (var i = 0; i < list.length; i++) { | ||
3412 | - var item = list[i]; | ||
3413 | - var wi = i * 90 * unit; | ||
3414 | - context.font = 'normal'; | ||
3415 | - context.setFontSize(16 * unit) | ||
3416 | - context.setFillStyle("red") | ||
3417 | - context.fillText("¥", 40 * unit + wi, 756 * unit); | ||
3418 | - context.setFontSize(22 * unit) | ||
3419 | - var pri = parseFloat(item.price).toFixed(2); | ||
3420 | - context.fillText(pri, 56 * unit + wi, 756 * unit); | ||
3421 | - context.setFillStyle("gray") | ||
3422 | - context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); | ||
3423 | - } | ||
3424 | - //----------------下面部分---------------- | ||
3425 | - context.setFillStyle("gray") | ||
3426 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit); | ||
3427 | - context.setFillStyle("black") | ||
3428 | - context.font = 'normal bold 18px sans-serif'; | ||
3429 | - context.setFontSize(22 * unit) | ||
3430 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit); | ||
3431 | - //---二维吗图--- | ||
3432 | - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); | ||
3433 | - | ||
3434 | - break | ||
3435 | - } | 3345 | + // context.setFontSize(22 * unit) |
3346 | + // context.setFillStyle("black") | ||
3347 | + // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit); | ||
3348 | + // context.fillText("长按识别小程序码", 40 * unit, 826 * unit); | ||
3349 | + // //---二维吗图--- | ||
3350 | + // context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); | ||
3351 | + // break; | ||
3352 | + // case 1: //秒杀商品的展示 | ||
3353 | + // //---画线--- | ||
3354 | + // context.setLineWidth(1 * unit) | ||
3355 | + // context.moveTo(32 * unit, 670 * unit) | ||
3356 | + // context.lineTo(520 * unit, 670 * unit) | ||
3357 | + // context.stroke(); | ||
3358 | + | ||
3359 | + // //画秒杀的图片 | ||
3360 | + // var miaos_path = '../../../images/share/miao_share.png'; | ||
3361 | + // context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | ||
3362 | + | ||
3363 | + // //---文字--- | ||
3364 | + // context.setFontSize(22 * unit) | ||
3365 | + // context.setFillStyle("black") | ||
3366 | + // context.fillText("特惠好物,限时秒杀", 40 * unit, 806 * unit); | ||
3367 | + // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); | ||
3368 | + // //---二维吗图--- | ||
3369 | + // context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); | ||
3370 | + // break; | ||
3371 | + | ||
3372 | + // case 2: //会员团和商家团的展示 | ||
3373 | + // //---画线--- | ||
3374 | + // context.setLineWidth(1 * unit) | ||
3375 | + // context.moveTo(32 * unit, 670 * unit) | ||
3376 | + // context.lineTo(520 * unit, 670 * unit) | ||
3377 | + // context.stroke(); | ||
3378 | + // //---文字--- | ||
3379 | + // context.setFontSize(22 * unit) | ||
3380 | + // context.font = 'normal bold'; | ||
3381 | + // context.setFillStyle("black") | ||
3382 | + // context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); | ||
3383 | + | ||
3384 | + // //绘制成团图片 | ||
3385 | + // var ct_img = "../../../images/share/ct_num.png"; | ||
3386 | + // context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); | ||
3387 | + // var ct_num = th.data.prom_act.ct_num; | ||
3388 | + // context.setFontSize(14 * unit) | ||
3389 | + // context.font = 'normal'; | ||
3390 | + // context.setFillStyle("red") | ||
3391 | + // if (ct_num < 10) { | ||
3392 | + // context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit); | ||
3393 | + // } else { | ||
3394 | + // context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit); | ||
3395 | + // } | ||
3396 | + // context.setFontSize(22 * unit) | ||
3397 | + // context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); | ||
3398 | + // context.setFillStyle("gray") | ||
3399 | + // context.fillText("快来和我一起拼团吧!", 40 * unit, 826 * unit); | ||
3400 | + // context.setFillStyle("black") | ||
3401 | + // context.font = 'normal bold 18px sans-serif'; | ||
3402 | + // context.setFontSize(21.3 * unit) | ||
3403 | + // context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit); | ||
3404 | + // //---二维吗图--- | ||
3405 | + // context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); | ||
3406 | + // break | ||
3407 | + // case 3: //阶梯团的展示 | ||
3408 | + // //---画线--- | ||
3409 | + // context.setLineWidth(1 * unit) | ||
3410 | + // context.moveTo(32 * unit, 670 * unit) | ||
3411 | + // context.lineTo(520 * unit, 670 * unit) | ||
3412 | + // context.stroke(); | ||
3413 | + // //---文字--- | ||
3414 | + // context.setFontSize(22 * unit) | ||
3415 | + // context.font = 'normal bold'; | ||
3416 | + // context.setFillStyle("black") | ||
3417 | + // context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); | ||
3418 | + // //---绘制中间阶梯的价格--- | ||
3419 | + // var list = th.data.prom_act.ct_rylist; | ||
3420 | + // for (var i = 0; i < list.length; i++) { | ||
3421 | + // var item = list[i]; | ||
3422 | + // var wi = i * 90 * unit; | ||
3423 | + // context.font = 'normal'; | ||
3424 | + // context.setFontSize(16 * unit) | ||
3425 | + // context.setFillStyle("red") | ||
3426 | + // context.fillText("¥", 40 * unit + wi, 756 * unit); | ||
3427 | + // context.setFontSize(22 * unit) | ||
3428 | + // var pri = parseFloat(item.price).toFixed(2); | ||
3429 | + // context.fillText(pri, 56 * unit + wi, 756 * unit); | ||
3430 | + // context.setFillStyle("gray") | ||
3431 | + // context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); | ||
3432 | + // } | ||
3433 | + // //----------------下面部分---------------- | ||
3434 | + // context.setFillStyle("gray") | ||
3435 | + // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit); | ||
3436 | + // context.setFillStyle("black") | ||
3437 | + // context.font = 'normal bold 18px sans-serif'; | ||
3438 | + // context.setFontSize(22 * unit) | ||
3439 | + // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit); | ||
3440 | + // //---二维吗图--- | ||
3441 | + // context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); | ||
3442 | + | ||
3443 | + // break | ||
3444 | + // } | ||
3436 | 3445 | ||
3437 | //---绘制圆形要放在最后---- | 3446 | //---绘制圆形要放在最后---- |
3438 | context.save(); | 3447 | context.save(); |
pages/justTest/justTest.js
0 → 100644
1 | +// pages/justTest/justTest.js | ||
2 | +// let livePlayer = requirePlugin('live-player-plugin'); | ||
3 | + | ||
4 | + | ||
5 | +var t = require("../../utils/util.js"), | ||
6 | + ut = t, | ||
7 | + e = require("../../utils/common.js"), | ||
8 | + a = require("../../utils/wxParse/wxParse.js"), | ||
9 | + s = getApp(), | ||
10 | + i = s.request, | ||
11 | + rq = i, | ||
12 | + oo = s.globalData, | ||
13 | + o = s.globalData.setting, | ||
14 | + os = o; | ||
15 | +var utils = require('../../utils/util.js'),ut=utils; | ||
16 | +var regeneratorRuntime = require('../../utils/runtime.js'); | ||
17 | + | ||
18 | +Page({ | ||
19 | + | ||
20 | + /** | ||
21 | + * 页面的初始数据 | ||
22 | + */ | ||
23 | + data: { | ||
24 | + gid: "", | ||
25 | + stoid: o.stoid, | ||
26 | + url: o.url, | ||
27 | + resourceUrl: o.resourceUrl, | ||
28 | + iurl: o.imghost, | ||
29 | + defaultAvatar: o.resourceUrl + "/static/images/user68.jpg", | ||
30 | + data: null, | ||
31 | + openSpecModal: !1, | ||
32 | + openPromModal: !1, | ||
33 | + supportPageScroll: !1, | ||
34 | + | ||
35 | + //联系电话 | ||
36 | + mobile: '', | ||
37 | + bconfig:null, | ||
38 | + sales_rules:1, | ||
39 | + | ||
40 | + t_time:null, | ||
41 | + card_field:"", | ||
42 | + dp_price:0, | ||
43 | + cut_price:0, | ||
44 | + open_ind_store:1, | ||
45 | + goodsInputNum:1, | ||
46 | + g_buy_num: null, | ||
47 | + sele_collocation:null, | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + photoUrl: "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1003256280,1176261798&fm=26&gp=0.jpg", | ||
52 | + //(用来控制显示哪个按钮) false表示还没首次进行弹框授权,或者已经授权了;true表示在首次授权弹框时拒绝授权,或者在设置页面还是拒绝了授权 | ||
53 | + isAuthSavePhoto: false | ||
54 | + }, | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + sendRequest: function () { | ||
61 | + | ||
62 | + | ||
63 | + | ||
64 | + //调用接口判断是不是会员 | ||
65 | + getApp().request.promiseGet("/api/weshop/wx/livelist/page",{ | ||
66 | + data:{store_id: 1} | ||
67 | + }).then(res=>{ | ||
68 | + console.log(res); | ||
69 | + // if(res.data.code==0){ | ||
70 | + // getApp().globalData.guide_id=res.data.data.id; | ||
71 | + // } | ||
72 | + }) | ||
73 | + | ||
74 | + }, | ||
75 | + // nav: function () { | ||
76 | + // wx.redirectTo({ | ||
77 | + // url: '/packageA/pages/liveStream/liveStream' | ||
78 | + // }) | ||
79 | + // }, | ||
80 | + /** | ||
81 | + * 生命周期函数--监听页面加载 | ||
82 | + */ | ||
83 | + onLoad: function (options) { | ||
84 | + | ||
85 | + }, | ||
86 | + | ||
87 | + /** | ||
88 | + * 生命周期函数--监听页面初次渲染完成 | ||
89 | + */ | ||
90 | + onReady: function () { | ||
91 | + | ||
92 | + }, | ||
93 | + | ||
94 | + /** | ||
95 | + * 生命周期函数--监听页面显示 | ||
96 | + */ | ||
97 | + onShow: function () { | ||
98 | + | ||
99 | + }, | ||
100 | + | ||
101 | + /** | ||
102 | + * 生命周期函数--监听页面隐藏 | ||
103 | + */ | ||
104 | + onHide: function () { | ||
105 | + | ||
106 | + }, | ||
107 | + | ||
108 | + /** | ||
109 | + * 生命周期函数--监听页面卸载 | ||
110 | + */ | ||
111 | + onUnload: function () { | ||
112 | + | ||
113 | + }, | ||
114 | + | ||
115 | + /** | ||
116 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
117 | + */ | ||
118 | + onPullDownRefresh: function () { | ||
119 | + | ||
120 | + }, | ||
121 | + | ||
122 | + /** | ||
123 | + * 页面上拉触底事件的处理函数 | ||
124 | + */ | ||
125 | + onReachBottom: function () { | ||
126 | + | ||
127 | + }, | ||
128 | + | ||
129 | + /** | ||
130 | + * 用户点击右上角分享 | ||
131 | + */ | ||
132 | + onShareAppMessage: function () { | ||
133 | + | ||
134 | + }, | ||
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | ||
139 | + saveImage() { | ||
140 | + wx.showLoading({ | ||
141 | + title: '保存中...', | ||
142 | + mask: true, | ||
143 | + }); | ||
144 | + wx.downloadFile({ | ||
145 | + url: | ||
146 | + 'http://upload.jianshu.io/admin_banners/web_images/4435/c1d3ca63353c8bd527f0d781605516cb5b266d02.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/1250/h/540', | ||
147 | + success: function(res) { | ||
148 | + if (res.statusCode === 200) { | ||
149 | + let img = res.tempFilePath; | ||
150 | + wx.saveImageToPhotosAlbum({ | ||
151 | + filePath: img, | ||
152 | + success(res) { | ||
153 | + wx.showToast({ | ||
154 | + title: '保存成功', | ||
155 | + icon: 'success', | ||
156 | + duration: 2000 | ||
157 | + }); | ||
158 | + }, | ||
159 | + fail(res) { | ||
160 | + wx.showToast({ | ||
161 | + title: '保存失败', | ||
162 | + icon: 'success', | ||
163 | + duration: 2000 | ||
164 | + }); | ||
165 | + } | ||
166 | + }); | ||
167 | + } | ||
168 | + } | ||
169 | + }); | ||
170 | + }, | ||
171 | + | ||
172 | + | ||
173 | + | ||
174 | + live() {} | ||
175 | + | ||
176 | + | ||
177 | +}) | ||
0 | \ No newline at end of file | 178 | \ No newline at end of file |
pages/justTest/justTest.json
0 → 100644
pages/justTest/justTest.wxml
0 → 100644
1 | +<!--pages/justTest/justTest.wxml--> | ||
2 | +<text>pages/justTest/justTest.wxml</text> | ||
3 | +<navigator url="/packageA/pages/liveStream/liveStream">进入直播</navigator> | ||
4 | +<navigator url="/packageA/pages/liveStreamDetails/liveStreamDetails">进入直播详情页</navigator> | ||
5 | +<button bindtap="sendRequest">发送请求</button> | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | +<button open-type="share" class='iconfont icon-weixin'>分享</button> | ||
11 | +<button bindopensetting="onOpenSetting" open-type="openSetting" > | ||
12 | + 保存图片到手机 | ||
13 | +</button> | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | +<view class="box"> | ||
20 | + <image class="img" src="{{photoUrl}}" bindtap='onPreviewImage'></image> | ||
21 | + <view class="btn"> | ||
22 | + <button bindtap="onSaveToPhone" class="btn button-hover"> | ||
23 | + 保存图片到手机1 | ||
24 | + </button> | ||
25 | + <!-- <button wx:else bind:tap="showModal" class="btn button-hover" > | ||
26 | + 保存图片到手机2 | ||
27 | + </button> --> | ||
28 | + <!-- 我们不使用点击按钮即打开设置页面的方式,而是使用上面那种先显示提示框让用户点确定按钮后再打开设置页面 --> | ||
29 | + <!-- <button wx:else bind:opensetting="onOpenSetting" open-type="openSetting" class="btn button-hover" > | ||
30 | + 保存二维码到手机 | ||
31 | + </button> --> | ||
32 | + </view> | ||
33 | +</view> | ||
34 | + | ||
35 | +<button bindtap="saveImage">savepics</button> | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | +<!-- 直播组件 - --> | ||
40 | +<!-- <subscribe room-id="1"></subscribe> --> | ||
41 | + | ||
42 | +<open-data type="userAvatarUrl"></open-data> | ||
43 | +<open-data type="userNickName"></open-data> | ||
44 | + | ||
45 | + | ||
46 | + |
pages/justTest/justTest.wxss
0 → 100644
1 | +/* pages/justTest/justTest.wxss */ | ||
2 | +page { | ||
3 | + background: #fff; | ||
4 | + text-align: center; | ||
5 | +} | ||
6 | + | ||
7 | +.box { | ||
8 | + padding: 30rpx 80rpx; | ||
9 | +} | ||
10 | + | ||
11 | +.img { | ||
12 | + width: 430rpx; | ||
13 | + height: 430rpx; | ||
14 | + margin: 20rpx 0; | ||
15 | +} | ||
16 | +button { | ||
17 | + width: 100%; | ||
18 | + background: #ffffff; | ||
19 | + border: none; | ||
20 | + border-radius: 0rpx; | ||
21 | + padding: 0; | ||
22 | + margin: 0; | ||
23 | +} | ||
24 | + | ||
25 | +.btn { | ||
26 | + background: green; | ||
27 | + color: #ffffff; | ||
28 | + border-radius: 0; | ||
29 | +} | ||
0 | \ No newline at end of file | 30 | \ No newline at end of file |
utils/myUtils.wxs
0 → 100644
1 | +var myUtils = { | ||
2 | + // 判断直播状态 | ||
3 | + liveStatus: function (statusCode) { | ||
4 | + var statusText; | ||
5 | + switch(statusCode) { | ||
6 | + case '101': { | ||
7 | + statusText = '直播中'; | ||
8 | + break; | ||
9 | + } | ||
10 | + case '102': { | ||
11 | + statusText = '未开始'; | ||
12 | + break; | ||
13 | + } | ||
14 | + case '103': { | ||
15 | + statusText = '已结束'; | ||
16 | + break; | ||
17 | + } | ||
18 | + case '104': { | ||
19 | + statusText = '禁播'; | ||
20 | + break; | ||
21 | + } | ||
22 | + case '105': { | ||
23 | + statusText = '暂停中'; | ||
24 | + break; | ||
25 | + } | ||
26 | + case '106': { | ||
27 | + statusText = '异常'; | ||
28 | + break; | ||
29 | + } | ||
30 | + case '107': { | ||
31 | + statusText = '已过期'; | ||
32 | + break; | ||
33 | + } | ||
34 | + default: break; | ||
35 | + } | ||
36 | + return statusText; | ||
37 | + } | ||
38 | +}; | ||
39 | + | ||
40 | +module.exports = { | ||
41 | + liveStatus: myUtils.liveStatus | ||
42 | +} | ||
0 | \ No newline at end of file | 43 | \ No newline at end of file |