Authored by 陈轩

Merge remote-tracking branch 'origin/develop' into develop

@@ -20,11 +20,11 @@ module.exports = { @@ -20,11 +20,11 @@ module.exports = {
20 domains: { 20 domains: {
21 // api: 'http://192.168.102.202:8080/gateway/', 21 // api: 'http://192.168.102.202:8080/gateway/',
22 // service: 'http://192.168.102.202:8080/gateway/', 22 // service: 'http://192.168.102.202:8080/gateway/',
23 - // api: 'http://testapi.yoho.cn:28078/',  
24 - // service: 'http://testservice.yoho.cn:28077/' 23 + api: 'http://testapi.yoho.cn:28078/',
  24 + service: 'http://testservice.yoho.cn:28077/'
25 25
26 - api: 'http://devapi.yoho.cn:58078/',  
27 - service: 'http://devservice.yoho.cn:58077/' 26 + // api: 'http://devapi.yoho.cn:58078/',
  27 + // service: 'http://devservice.yoho.cn:58077/'
28 }, 28 },
29 subDomains: { 29 subDomains: {
30 host: '.m.yohoblk.com', 30 host: '.m.yohoblk.com',
@@ -42,12 +42,12 @@ const titleMap = { @@ -42,12 +42,12 @@ const titleMap = {
42 action: '' 42 action: ''
43 }, 43 },
44 title: { 44 title: {
45 - des: '标题3', 45 + des: 'BLK',
46 action: '' 46 action: ''
47 }, 47 },
48 right: { 48 right: {
49 des: '提交', 49 des: '提交',
50 - action: '' 50 + action: 'submitForm'
51 } 51 }
52 }, 52 },
53 4: { 53 4: {
@@ -67,16 +67,16 @@ const titleMap = { @@ -67,16 +67,16 @@ const titleMap = {
67 action: '' 67 action: ''
68 }, 68 },
69 ltitle: { 69 ltitle: {
70 - des: '商品5',  
71 - action: '' 70 + des: '商品',
  71 + action: origin + '/favorite'
72 }, 72 },
73 rtitle: { 73 rtitle: {
74 - des: '品牌5',  
75 - action: '' 74 + des: '品牌',
  75 + action: origin + '/favorite?tab=brand'
76 }, 76 },
77 right: { 77 right: {
78 - des: '编辑5',  
79 - action: '' 78 + des: '编辑',
  79 + action: 'editModel'
80 } 80 }
81 }, 81 },
82 6: { 82 6: {
@@ -92,20 +92,15 @@ const matchHeader = (url) => { @@ -92,20 +92,15 @@ const matchHeader = (url) => {
92 let header = { 92 let header = {
93 headerid: '-1' // 默认不显示头部 93 headerid: '-1' // 默认不显示头部
94 }; 94 };
  95 + let path = url.split('?')[0];
95 96
96 - if (/\/brands/.test(url) || /\/cate/.test(url)) {  
97 - header = titleMap[2];  
98 - alert(JSON.stringify(header));  
99 - return header;  
100 - }  
101 -  
102 - if (/\/home\/mydetails/.test(url)) { 97 + if (/\/home\/mydetails$/.test(path)) {
103 header = titleMap[1]; 98 header = titleMap[1];
104 header.title.des = '个人信息'; 99 header.title.des = '个人信息';
105 return header; 100 return header;
106 } 101 }
107 102
108 - if (/\/home\/orders/.test(url)) { 103 + if (/\/home\/orders$/.test(path)) {
109 let des = ''; 104 let des = '';
110 let u = url.split('?')[1]; 105 let u = url.split('?')[1];
111 106
@@ -124,55 +119,38 @@ const matchHeader = (url) => { @@ -124,55 +119,38 @@ const matchHeader = (url) => {
124 return header; 119 return header;
125 } 120 }
126 121
127 - if (/\/home\/order-detail/.test(url)) { 122 + if (/\/home\/order-detail$/.test(path)) {
128 header = titleMap[2]; 123 header = titleMap[2];
129 header.title.des = '订单详情'; 124 header.title.des = '订单详情';
130 header.title.right.action = origin + '/home/service'; 125 header.title.right.action = origin + '/home/service';
131 return header; 126 return header;
132 } 127 }
133 128
134 - if (/\/home\/refund\/orders/.test(url)) { 129 + if (/\/home\/refund\/orders$/.test(path)) {
135 header = titleMap[1]; 130 header = titleMap[1];
136 header.title.des = '退/换货'; 131 header.title.des = '退/换货';
137 return header; 132 return header;
138 } 133 }
139 134
140 - if (/\/home\/favorite/.test(url)) {  
141 - header = titleMap[5];  
142 - header.ltitle = {  
143 - des: '商品',  
144 - action: origin + '/home/favorite'  
145 - };  
146 - header.rtitle = {  
147 - des: '品牌',  
148 - action: origin + '/home/favorite?tab=brand'  
149 - };  
150 - header.right = {  
151 - des: '编辑',  
152 - action: 'editModel'  
153 - };  
154 - return header;  
155 - }  
156 -  
157 - if (/\/home\/mycurrency/.test(url)) { 135 + if (/\/home\/mycurrency$/.test(path)) {
158 header = titleMap[1]; 136 header = titleMap[1];
159 header.title.des = '有货币'; 137 header.title.des = '有货币';
160 return header; 138 return header;
161 } 139 }
162 140
163 - if (/\/home\/help$/.test(url)) { 141 + if (/\/home\/help$/.test(path)) {
164 header = titleMap[1]; 142 header = titleMap[1];
165 header.title.des = '帮助中心'; 143 header.title.des = '帮助中心';
166 return header; 144 return header;
167 } 145 }
168 146
169 - if (/\/home\/service$/.test(url)) { 147 + if (/\/home\/service$/.test(path)) {
170 header = titleMap[1]; 148 header = titleMap[1];
171 header.title.des = 'Yoho!Blk在线客服'; 149 header.title.des = 'Yoho!Blk在线客服';
172 return header; 150 return header;
173 } 151 }
174 152
175 - if (/\/home\/feedback/.test(url)) { 153 + if (/\/home\/feedback$/.test(path)) {
176 header = titleMap[3]; 154 header = titleMap[3];
177 header.title.des = '意见反馈'; 155 header.title.des = '意见反馈';
178 header.right = { 156 header.right = {
@@ -182,7 +160,7 @@ const matchHeader = (url) => { @@ -182,7 +160,7 @@ const matchHeader = (url) => {
182 return header; 160 return header;
183 } 161 }
184 162
185 - if (/\/home\/about/.test(url)) { 163 + if (/\/home\/about$/.test(path)) {
186 header = titleMap[1]; 164 header = titleMap[1];
187 header.title.des = '关于'; 165 header.title.des = '关于';
188 return header; 166 return header;
@@ -194,16 +172,30 @@ const matchHeader = (url) => { @@ -194,16 +172,30 @@ const matchHeader = (url) => {
194 172
195 module.exports = (url) => { 173 module.exports = (url) => {
196 if (yoho.isApp) { 174 if (yoho.isApp) {
197 - // 品牌 品类  
198 - // if (/\/brands/.test(url) || /\/cate/.test(url)) {  
199 - // return yoho.goTab({index: 1});  
200 - // } 175 + let path = url.split('?')[0];
  176 +
  177 + // 个人中心收藏
  178 + if (/\/home\/favorite$/.test(path)) {
  179 + return yoho.goPageView({
  180 + header: titleMap[5]
  181 + });
  182 + }
201 183
202 // 个人中心首页 184 // 个人中心首页
203 - if (/\/home$/.test(url)) { 185 + if (/\/home$/.test(path)) {
204 return yoho.goTab({index: 4}); 186 return yoho.goTab({index: 4});
205 } 187 }
206 188
  189 + // 资讯
  190 + if (/\/news$/.test(path)) {
  191 + return yoho.goTab({index: 3});
  192 + }
  193 +
  194 + // 品牌 品类
  195 + if (/\/brands$/.test(path) || /\/cate$/.test(path)) {
  196 + return yoho.goTab({index: 1});
  197 + }
  198 +
207 yoho.goNewPage({ 199 yoho.goNewPage({
208 header: matchHeader(url), 200 header: matchHeader(url),
209 url: /^(https?:)?\/\//i.test(url) ? url : origin + url 201 url: /^(https?:)?\/\//i.test(url) ? url : origin + url
  1 +/**
  2 + * Created by PhpStorm.
  3 + * User: Targaryen
  4 + * Date: 2016/7/29
  5 + * Time: 16:55
  6 + */
  7 +
  8 +const $ = require('yoho-jquery');
  9 +
  10 +$.ajax({
  11 + url: '//res.wx.qq.com/open/js/jweixin-1.1.0.js',
  12 + dataType: 'script',
  13 + cache: true,
  14 + success: function() {
  15 + $.ajax({
  16 + url: '/api/wechat/share/token',
  17 + data: {
  18 + url: location.href
  19 + },
  20 + success: function(res) {
  21 + if (window.wx) {
  22 + window.wx.config({
  23 + debug: false,
  24 + appId: res.appId,
  25 + timestamp: res.timestamp,
  26 + nonceStr: res.nonceStr,
  27 + signature: res.signature,
  28 + jsApiList: [
  29 + 'checkJsApi',
  30 + 'onMenuShareTimeline',
  31 + 'onMenuShareAppMessage',
  32 + 'onMenuShareQQ',
  33 + 'onMenuShareWeibo',
  34 + 'hideMenuItems',
  35 + 'showMenuItems',
  36 + 'hideAllNonBaseMenuItem',
  37 + 'showAllNonBaseMenuItem',
  38 + 'translateVoice',
  39 + 'startRecord',
  40 + 'stopRecord',
  41 + 'onRecordEnd',
  42 + 'playVoice',
  43 + 'pauseVoice',
  44 + 'stopVoice',
  45 + 'uploadVoice',
  46 + 'downloadVoice',
  47 + 'chooseImage',
  48 + 'previewImage',
  49 + 'uploadImage',
  50 + 'downloadImage',
  51 + 'getNetworkType',
  52 + 'openLocation',
  53 + 'getLocation',
  54 + 'hideOptionMenu',
  55 + 'showOptionMenu',
  56 + 'closeWindow',
  57 + 'scanQRCode',
  58 + 'chooseWXPay',
  59 + 'openProductSpecificView',
  60 + 'addCard',
  61 + 'chooseCard',
  62 + 'openCard'
  63 + ]
  64 + });
  65 + }
  66 + }
  67 + });
  68 + }
  69 +});
  70 +
  71 +module.exports = (shareData) => {
  72 + if (window.wx) {
  73 + window.wx.ready(function() {
  74 + window.wx.onMenuShareAppMessage(shareData);
  75 + window.wx.onMenuShareTimeline(shareData);
  76 + window.wx.onMenuShareQQ(shareData);
  77 + window.wx.onMenuShareWeibo(shareData);
  78 + });
  79 + }
  80 +};
@@ -277,9 +277,12 @@ const yoho = { @@ -277,9 +277,12 @@ const yoho = {
277 * @param callback 回调 277 * @param callback 回调
278 */ 278 */
279 addNativeMethod(name, callback) { 279 addNativeMethod(name, callback) {
  280 + // 延迟 500ms 注入
  281 + setTimeout(function() {
280 if (window.yohoInterface) { 282 if (window.yohoInterface) {
281 window.yohoInterface[name] = callback; 283 window.yohoInterface[name] = callback;
282 } 284 }
  285 + }, 500);
283 } 286 }
284 }; 287 };
285 288
1 <template> 1 <template>
2 <div class="search"> 2 <div class="search">
3 - <input v-if="showInput" type="text" name="">  
4 - <div v-else class="input" @click="changeToInput()"> 3 + <div v-else class="input" @click='yoho.goSearch()'>
5 <span class="icon icon-search"></span> Search 4 <span class="icon icon-search"></span> Search
6 </div> 5 </div>
7 </div> 6 </div>
@@ -26,24 +25,16 @@ @@ -26,24 +25,16 @@
26 padding: 5px 0; 25 padding: 5px 0;
27 } 26 }
28 27
29 - input {  
30 - width: 92%;  
31 - height: 55px;  
32 - padding: 10px;  
33 - }  
34 } 28 }
35 </style> 29 </style>
36 <script> 30 <script>
  31 + const yoho = require('yoho');
  32 +
37 module.exports = { 33 module.exports = {
38 data() { 34 data() {
39 return { 35 return {
40 - showInput: false 36 + yoho
41 }; 37 };
42 - },  
43 - methods: {  
44 - changeToInput() {  
45 - this.showInput = true;  
46 - }  
47 } 38 }
48 }; 39 };
49 </script> 40 </script>
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 <button class="button" @click='yoho.goNewPage({"url":"http://m.yohoblk.com"})'>新页面</button> 10 <button class="button" @click='yoho.goNewPage({"url":"http://m.yohoblk.com"})'>新页面</button>
11 <button class="button" @click="yoho.goPay()">支付</button> 11 <button class="button" @click="yoho.goPay()">支付</button>
12 <button class="button" @click="yoho.goBack()">返回</button> 12 <button class="button" @click="yoho.goBack()">返回</button>
13 - <button class="button" @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com"})'>分享</button> 13 + <button class="button" @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com/product/shop/share?domain=sctest1"})'>分享</button>
14 <button class="button" @click='yoho.goSearch()'>搜索</button> 14 <button class="button" @click='yoho.goSearch()'>搜索</button>
15 <button class="button" @click='yoho.goSetting()'>设置</button> 15 <button class="button" @click='yoho.goSetting()'>设置</button>
16 <button class="button" @click='yoho.goSetAvatar()'>设置头像</button> 16 <button class="button" @click='yoho.goSetAvatar()'>设置头像</button>
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 <div class="bottom clearfix"> 15 <div class="bottom clearfix">
16 <span class="icon time-icon">&#xe612;</span> 16 <span class="icon time-icon">&#xe612;</span>
17 <span class="time">{{news.publishTime}}</span> 17 <span class="time">{{news.publishTime}}</span>
18 - <span class="icon share" @click="share(news.title, news.intro, news.src, news.share.url)">&#xe611;</span> 18 + <span class="icon icon-share share" @click="share(news.title, news.intro, news.src, news.share.url)"></span>
19 </div> 19 </div>
20 </div> 20 </div>
21 </div> 21 </div>
@@ -396,6 +396,7 @@ @@ -396,6 +396,7 @@
396 const app = $('#app'); 396 const app = $('#app');
397 const tip = require('common/tip'); 397 const tip = require('common/tip');
398 const yoho = require('yoho'); 398 const yoho = require('yoho');
  399 + const share = require('common/share');
399 400
400 require('yoho-vue-swipe/dist/vue-swipe.css'); 401 require('yoho-vue-swipe/dist/vue-swipe.css');
401 402
@@ -525,6 +526,21 @@ @@ -525,6 +526,21 @@
525 } 526 }
526 }); 527 });
527 528
  529 + share({
  530 + title: this.entity.productName,
  531 + link: location.href,
  532 + desc: '我在BLK发现了一个不错的商品,快来看看吧!',
  533 + imgUrl: this.firstImage.replace(/(\{width}|\{height}|\{mode})/g, function($0) {
  534 + const dict = {
  535 + '{width}': 300,
  536 + '{height}': 300,
  537 + '{mode}': 2
  538 + };
  539 +
  540 + return dict[$0];
  541 + })
  542 + });
  543 +
528 return result; 544 return result;
529 }).then((result)=> { 545 }).then((result)=> {
530 loadIntroDeferred = () => { 546 loadIntroDeferred = () => {
@@ -52,6 +52,7 @@ @@ -52,6 +52,7 @@
52 const shareBottom = require('component/tool/share-bottom.vue'); 52 const shareBottom = require('component/tool/share-bottom.vue');
53 const qs = require('yoho-qs'); 53 const qs = require('yoho-qs');
54 const tip = require('common/tip'); 54 const tip = require('common/tip');
  55 + const share = require('common/share');
55 56
56 module.exports = { 57 module.exports = {
57 58
@@ -60,6 +61,16 @@ @@ -60,6 +61,16 @@
60 shopInfo: {} 61 shopInfo: {}
61 }; 62 };
62 }, 63 },
  64 + watch: {
  65 + shopInfo() {
  66 + share({
  67 + title: this.shopInfo.brandName,
  68 + link: location.href,
  69 + desc: this.shopInfo.shareSubTitle,
  70 + imgUrl: this.shopInfo.brandBg
  71 + });
  72 + }
  73 + },
63 methods: { 74 methods: {
64 75
65 /* 获取店铺简介相关数据 */ 76 /* 获取店铺简介相关数据 */
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 color: #000; 51 color: #000;
52 height: 120px; 52 height: 120px;
53 top: 0; 53 top: 0;
54 - padding: 70px 20px 10px; 54 + padding: 55px 20px 10px;
55 } 55 }
56 </style> 56 </style>
57 57