Authored by 李奇

Merge branch 'feature/menuShare' into 'master'

Feature/menu share



See merge request !10
1 -import { postFormId } from '../../libs/formIdCollectRequest';  
2 -  
3 -  
4 -Component({  
5 - options: {  
6 - multipleSlots: true // 在组件定义时的选项中启用多slot支持  
7 - },  
8 - /**  
9 - * 组件的属性列表  
10 - * 用于组件自定义设置  
11 - */  
12 - properties: {  
13 - isShowIndicator: { //是否展示返回顶部按钮  
14 - type: Boolean,  
15 - value: false,  
16 - observer: "_indicatorChange"  
17 - },  
18 -  
19 - isShowShopCart: { //是否展示购物车  
20 - type: Boolean,  
21 - value: true  
22 - },  
23 -  
24 - marginBottom: { //底部边距  
25 - type: Number,  
26 - value: 100  
27 - },  
28 -  
29 - isShowMenu: {  
30 - type: Boolean,  
31 - value: true  
32 - },  
33 -  
34 - isShare: { // 是否显示分享  
35 - type: Boolean,  
36 - value: false  
37 - },  
38 - isUnionShare: {// 是否显示创建联盟分享按钮  
39 - type: Boolean,  
40 - value: false  
41 - },  
42 - isGoApp: { // 是否显示取app按钮  
43 - type: Boolean,  
44 - value: false  
45 - },  
46 - appParameter: {  
47 - type: String,  
48 - value: ''  
49 - }  
50 - },  
51 -  
52 - /**  
53 - * 私有数据,组件的初始数据  
54 - * 可用于模版渲染  
55 - */  
56 - data: {  
57 - // 弹窗显示控制  
58 - isShow: true,  
59 - isExpand: false,  
60 - menuOpacity: 0,  
61 - funcItemAnimation: {},  
62 - indicatorAnimation: {},  
63 - isAnimation: false,  
64 - },  
65 -  
66 - /**  
67 - * 组件的方法列表  
68 - * 更新属性和数据的方法与更新页面数据的方法类似  
69 - */  
70 - methods: {  
71 - //上报formid  
72 - formSubmit: function (e) {  
73 - let formId = e.detail.formId;  
74 - postFormId(formId)  
75 - },  
76 -  
77 - /*  
78 - * 公有方法  
79 - */  
80 - //隐藏  
81 - hide() {  
82 - this.setData({  
83 - isShow: !this.data.isShow  
84 - })  
85 - },  
86 -  
87 - //展示  
88 - show() {  
89 - this.setData({  
90 - isShow: !this.data.isShow  
91 - })  
92 - },  
93 -  
94 - switchMenu() {  
95 - if(this.data.isAnimation){  
96 - return;  
97 - }  
98 - var time = 150;  
99 - if(this.data.isExpand){  
100 - this.takeback(time);  
101 - }else {  
102 - this.popout(time);  
103 - }  
104 -  
105 - this.setData({  
106 - isAnimation: true  
107 - });  
108 -  
109 - var delayTime = time;  
110 - setTimeout(function () {  
111 - this.setData({  
112 - isAnimation: false  
113 - })  
114 - }.bind(this), delayTime);  
115 -  
116 -  
117 - this.setData({  
118 - isExpand: !this.data.isExpand,  
119 - })  
120 - },  
121 -  
122 - _indicatorChange: function(newVal, oldVal) {  
123 - var animtionIndicator = wx.createAnimation({  
124 - duration: 300,  
125 - timingFunction: 'linear',  
126 - });  
127 -  
128 - if(newVal){  
129 - animtionIndicator.opacity(1).height(44).width(44).step();  
130 - }else {  
131 - animtionIndicator.opacity(0).height(0).width(0).step();  
132 - }  
133 -  
134 - this.setData({  
135 - indicatorAnimation: animtionIndicator.export(),  
136 - })  
137 - },  
138 -  
139 - // 动画  
140 - popout(time) {  
141 - var funcItemAnimation = wx.createAnimation({  
142 - duration: time,  
143 - timingFunction: 'ease-in-out'  
144 - });  
145 -  
146 - funcItemAnimation.opacity(1).width(44).height(44).step({ duration: time });  
147 - this.setData({  
148 - funcItemAnimation: funcItemAnimation.export(),  
149 - });  
150 - },  
151 -  
152 - takeback(time) {  
153 - var funcItemAnimation = wx.createAnimation({  
154 - duration: time,  
155 - timingFunction: 'ease-in-out'  
156 - });  
157 -  
158 - funcItemAnimation.opacity(0).width(0).height(0).step({ duration: time });  
159 - this.setData({  
160 - funcItemAnimation: funcItemAnimation.export(),  
161 - });  
162 - },  
163 -  
164 - jumpToHome() {  
165 - },  
166 -  
167 - jumpToSearch() {  
168 - },  
169 -  
170 - jumpToShopCart() {  
171 - },  
172 -  
173 - backToTop() {  
174 - this.triggerEvent("backToTop");  
175 - },  
176 -  
177 - unionShare() {  
178 - this.triggerEvent("unionShare");  
179 - },  
180 -  
181 - goApp: function (e) {  
182 -  
183 - var pages = getCurrentPages()  
184 - var currentPage = pages[pages.length - 1]  
185 - var url = currentPage.route  
186 -  
187 - let params = {  
188 - PAGE_PATH: url,  
189 - };  
190 - },  
191 -  
192 - launchAppError: function (e) {  
193 - wx.showToast({  
194 - title: '打开失败!您可能未安装Yoho!Buy官方APP,请下载后再尝试。',  
195 - icon: 'none',  
196 - duration: 3000  
197 - })  
198 - }  
199 - }  
200 -})  
1 -{  
2 - "component": true,  
3 - "usingComponents": {}  
4 -}  
1 -<!--pages/quickNavigation/quickNavigation.wxml-->  
2 -<view class="quicknavigation" style="display: {{isShow ? 'block':'none'}};bottom:{{marginBottom}}rpx">  
3 - <view class="quicknavigation-content">  
4 - <view class="quicknavigation-menu" wx:if="{{isShowMenu}}">  
5 - <view class="quicknavigation-menu-func">  
6 - <navigator target="miniProgram" app-id="wx084ab813d88c594b" path="/pages/index/index" version="develop" >  
7 - <image class="img" id="home" animation="{{funcItemAnimation}}" src="/pages/quickNavigation/images/home@3x.png"> </image>  
8 - </navigator>  
9 -  
10 - <navigator target="miniProgram" app-id="wx084ab813d88c594b" path="/pages/search/search" version="develop" >  
11 - <image class="img" id="search" animation="{{funcItemAnimation}}" src="/pages/quickNavigation/images/search_ic@3x.png"> </image>  
12 - </navigator>  
13 -  
14 - <image class="img" id="shopcart" wx:if="{{isShowShopCart}}" animation="{{funcItemAnimation}}" bindtap="jumpToShopCart" src="/pages/quickNavigation/images/shopcart_ic@3x.png"> </image>  
15 - <button class="appBtn" bindtap='goApp' id="appBtn" type="default" hover-class="none" open-type="launchApp" app-parameter="{{appParameter}}" binderror="launchAppError" wx:if="{{isGoApp}}" animation="{{funcItemAnimation}}">  
16 - <image class="appImg" src="/pages/quickNavigation/images/APP@3x.png" animation="{{funcItemAnimation}}"></image>  
17 - </button>  
18 - </view>  
19 -  
20 - <image class="img-switch" id="switch" bindtap="switchMenu" src="{{isExpand ?'/pages/quickNavigation/images/close_menu@3x.png' : '/pages/quickNavigation/images/open_menu@3x.png'}}"></image>  
21 - <form bindsubmit="formSubmit" report-submit='true'>  
22 - <button class="img-switch-btn" bindtap="switchMenu" formType="submit" wx:if="{{!isExpand}}"></button>  
23 - </form>  
24 - </view>  
25 - <button class="share-btn" type="default" hover-class="none" open-type="share" wx:if="{{isShare}}">  
26 - <image class="img-share" src="/pages/quickNavigation/images/share@3x.png"></image>  
27 - </button>  
28 -  
29 - <image class="union_share" wx:if="{{isUnionShare}}" src="/pages/quickNavigation/images/share@3x.png" bindtap="unionShare"></image>  
30 -  
31 -  
32 -  
33 - <image class="img-back" animation="{{indicatorAnimation}}" id="backtop" bindtap="backToTop" src="/pages/quickNavigation/images/backtop@3x.png"></image>  
34 - </view>  
35 -</view>  
1 -/* pages/quickNavigation/quickNavigation.wxss */  
2 -.quicknavigation {  
3 - position: fixed;  
4 - display: flex;  
5 - flex-direction: column;  
6 - width: 44px;  
7 - right: 15px;  
8 - bottom: 100rpx;  
9 - z-index: 1300;  
10 -}  
11 -  
12 -.quicknavigation-content {  
13 - display: flex;  
14 - flex-direction: column;  
15 - width: 44px;  
16 - justify-content: flex-end;  
17 - align-self: center;  
18 - align-items: center;  
19 - /* background-color: red; */  
20 -}  
21 -  
22 -.quicknavigation-menu {  
23 - display: flex;  
24 - flex-direction: column;  
25 - width: 100%;  
26 - align-self: center;  
27 -}  
28 -  
29 -.quicknavigation-menu-func {  
30 - display: flex;  
31 - flex-direction: column;  
32 - width: 100%;  
33 - justify-content: flex-end;  
34 - margin-bottom: 5px;  
35 -}  
36 -  
37 -.appBtn {  
38 - width: 44px;  
39 - height: 44px;  
40 - opacity: 0;  
41 - padding: 0;  
42 - align-self: center;  
43 - border-radius: 50%;  
44 - margin-top: 5px;  
45 - background-color: transparent !important;  
46 -}  
47 -  
48 -.appBtn .appImg {  
49 - width: 44px;  
50 - height: 44px;  
51 - bottom: 0px;  
52 - margin-bottom: 5px;  
53 -}  
54 -  
55 -.img {  
56 - width: 0px;  
57 - height: 0px;  
58 - opacity: 0;  
59 - align-self: center;  
60 - margin-top: 5px;  
61 -}  
62 -  
63 -.img-switch,  
64 -.share-btn image {  
65 - width: 44px;  
66 - height: 44px;  
67 - bottom: 0px;  
68 - margin-bottom: 5px;  
69 -}  
70 -  
71 -.img-switch-btn {  
72 - width: 44px;  
73 - height: 44px;  
74 - background-color: red;  
75 - opacity: 0;  
76 - position: absolute;  
77 - top: 35rpx;  
78 -}  
79 -  
80 -.img-back {  
81 - width: 0px;  
82 - height: 0px;  
83 - opacity: 0;  
84 - margin-bottom: 5px;  
85 -}  
86 -  
87 -.share-btn {  
88 - margin: 0;  
89 - padding: 0;  
90 - line-height: 0;  
91 - border-radius: 50%;  
92 - background-color: transparent !important;  
93 -}  
94 -  
95 -.union_share {  
96 - width: 44px;  
97 - height: 44px;  
98 - bottom: 0px;  
99 - margin-bottom: 5px;  
100 -}  
@@ -40,9 +40,6 @@ Component({ @@ -40,9 +40,6 @@ Component({
40 type: text.miniappType || 0 40 type: text.miniappType || 0
41 }) 41 })
42 }, 42 },
43 - goShare() {  
44 - this.triggerEvent('share', this.properties.item);  
45 - },  
46 onOk() { 43 onOk() {
47 this.setData({ 44 this.setData({
48 show: false 45 show: false
@@ -267,12 +267,13 @@ Page(Object.assign({ @@ -267,12 +267,13 @@ Page(Object.assign({
267 }) 267 })
268 setTimeout(function () { 268 setTimeout(function () {
269 wx.createSelectorQuery().select('.code-list-item-container').boundingClientRect().exec((r) => { 269 wx.createSelectorQuery().select('.code-list-item-container').boundingClientRect().exec((r) => {
270 - animation.height(r[0].height - 65 * sys.screenWidth / 375).step();  
271 - this.setData({  
272 - animation: animation.export()  
273 - }) 270 + if (r && r[0] && r[0].height) {
  271 + animation.height(r[0].height - 65 * sys.screenWidth / 375).step();
  272 + this.setData({
  273 + animation: animation.export()
  274 + });
  275 + }
274 }) 276 })
275 -  
276 }.bind(this), 800); 277 }.bind(this), 800);
277 } 278 }
278 }); 279 });
@@ -12,7 +12,6 @@ @@ -12,7 +12,6 @@
12 "help": "./components/help", 12 "help": "./components/help",
13 "fellow-bar": "./components/fellow-bar", 13 "fellow-bar": "./components/fellow-bar",
14 "action-bar": "./components/action-bar", 14 "action-bar": "./components/action-bar",
15 - "quickNavigation": "/pages/quickNavigation/quickNavigation",  
16 "zero-alert": "./components/alert", 15 "zero-alert": "./components/alert",
17 "group-recommend": "./components/group-recommend" 16 "group-recommend": "./components/group-recommend"
18 } 17 }
@@ -86,8 +86,6 @@ @@ -86,8 +86,6 @@
86 <import src="../../vendors/toast/wetoast.wxml"/> 86 <import src="../../vendors/toast/wetoast.wxml"/>
87 <template is="wetoast" data="{{...__wetoast__}}"/> 87 <template is="wetoast" data="{{...__wetoast__}}"/>
88 88
89 -<!-- <quickNavigation id="quickNavigation" isShowIndicator="{{false}}" isShowShopCart="{{false}}" marginBottom="{{190}}"></quickNavigation> -->  
90 -  
91 <zero-alert wx:if="{{showAuth}}"> 89 <zero-alert wx:if="{{showAuth}}">
92 <view class="auth-content">OOPS 用户尚未授权登录</view> 90 <view class="auth-content">OOPS 用户尚未授权登录</view>
93 <button class="auth-foot action-item confirm" open-type="{{!hasUnionID ? 'getUserInfo':'getPhoneNumber'}}" 91 <button class="auth-foot action-item confirm" open-type="{{!hasUnionID ? 'getUserInfo':'getPhoneNumber'}}"
@@ -517,13 +517,6 @@ Page(Object.assign({ @@ -517,13 +517,6 @@ Page(Object.assign({
517 }); 517 });
518 }, 518 },
519 519
520 - share({detail}) {  
521 - this.setData({  
522 - 'actionsheet.show': true,  
523 - 'shareProduct': detail  
524 - })  
525 - },  
526 -  
527 handleZanActionsheetCancel({componentId}) { 520 handleZanActionsheetCancel({componentId}) {
528 this.setData({ 521 this.setData({
529 'actionsheet.show': false 522 'actionsheet.show': false
@@ -552,37 +545,7 @@ Page(Object.assign({ @@ -552,37 +545,7 @@ Page(Object.assign({
552 } 545 }
553 ; 546 ;
554 }, 547 },
555 - onShareAppMessage(res) {  
556 - let params = {  
557 - TITLE: `【0元抽奖】点一下,免费拿走${this.data.shareProduct.name}`,  
558 - DESC: '我在YO!LUCK发现一个不错的商品赶快来看看吧!'  
559 - };  
560 -  
561 - if (res.from === 'menu') {  
562 - // 用户点击右上角分享  
563 - return {  
564 - title: params.TITLE, // 分享标题  
565 - desc: params.DESC, // 分享描述  
566 - path: `pages/zeroSell/detail?actPrizeId=${this.data.shareProduct.act_prize_id}`,  
567 - imageUrl: this.data.shareProduct.cover_img,  
568 - success: function () {  
569 - },  
570 - fail: function () {  
571 - }  
572 - };  
573 - } else if (res.from === 'button') {  
574 - // 用户点击分享按钮  
575 -  
576 - return {  
577 - title: params.TITLE, // 分享标题  
578 - desc: params.DESC, // 分享描述  
579 - path: `/pages/zeroSell/detail?actPrizeId=${this.data.shareProduct.act_prize_id}&shareUid=${app.getUid()}`,  
580 - imageUrl: this.data.shareProduct.cover_img,  
581 - success: function () {  
582 - },  
583 - fail: function () {  
584 - }  
585 - };  
586 - } 548 + onShareAppMessage() {
  549 + // 默认分享
587 } 550 }
588 }, Toast, Actionsheet)); 551 }, Toast, Actionsheet));
@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 "backgroundTextStyle": "light", 5 "backgroundTextStyle": "light",
6 "usingComponents": { 6 "usingComponents": {
7 "product-item": "./components/product-item", 7 "product-item": "./components/product-item",
8 - "quickNavigation": "/pages/quickNavigation/quickNavigation",  
9 "tabs": "./components/tabs", 8 "tabs": "./components/tabs",
10 "tabs-pane": "./components/tabs-pane", 9 "tabs-pane": "./components/tabs-pane",
11 "dialog": "/components/dialog/dialog", 10 "dialog": "/components/dialog/dialog",
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 </block> 38 </block>
39 <block wx:else> 39 <block wx:else>
40 <block wx:for="{{my_zero_list[0].data}}" wx:key="{{index}}"> 40 <block wx:for="{{my_zero_list[0].data}}" wx:key="{{index}}">
41 - <prize-item item="{{item}}" bindshare="share" tab-idx="{{tabIndex}}"></prize-item> 41 + <prize-item item="{{item}}" tab-idx="{{tabIndex}}"></prize-item>
42 </block> 42 </block>
43 </block> 43 </block>
44 <view class="title-view"> 44 <view class="title-view">
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 </block> 51 </block>
52 <block wx:else> 52 <block wx:else>
53 <block wx:for="{{my_zero_list[1].data}}" wx:key="{{index}}"> 53 <block wx:for="{{my_zero_list[1].data}}" wx:key="{{index}}">
54 - <prize-item item="{{item}}" bindshare="share" tab-idx="{{tabIndex}}"></prize-item> 54 + <prize-item item="{{item}}" tab-idx="{{tabIndex}}"></prize-item>
55 </block> 55 </block>
56 </block> 56 </block>
57 </block> 57 </block>
@@ -22,7 +22,6 @@ function jumpFn(name, qs) { @@ -22,7 +22,6 @@ function jumpFn(name, qs) {
22 url: `${path}?${stringify(qs)}` 22 url: `${path}?${stringify(qs)}`
23 }; 23 };
24 24
25 - console.log(`page => ${params.url}`);  
26 wx.navigateTo(params); 25 wx.navigateTo(params);
27 } 26 }
28 27