Authored by 陈峰

Merge branch 'feature/brand-multi-shops' into 'gray'

Feature/brand multi shops



See merge request !90
1 { 1 {
2 "name": "yohoblk-wap", 2 "name": "yohoblk-wap",
3 - "version": "2.0.40", 3 + "version": "2.0.41",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -24,11 +24,12 @@ function BrandHrefBinding(el, binding) { @@ -24,11 +24,12 @@ function BrandHrefBinding(el, binding) {
24 return; 24 return;
25 } 25 }
26 if (binding.modifiers.shop) { 26 if (binding.modifiers.shop) {
27 - let href = `/product/shop/${binding.value.domain}`; 27 + let href = `/product/shop/${binding.value.domain || binding.value.name}`;
28 let shopId = binding.value.shopId; 28 let shopId = binding.value.shopId;
29 29
30 if (yoho.isYohoBuy && shopId) { 30 if (yoho.isYohoBuy && shopId) {
31 let { shopName, shopTemplateType, isRedShop } = binding.value; 31 let { shopName, shopTemplateType, isRedShop } = binding.value;
  32 +
32 let goParams = { 33 let goParams = {
33 action: 'go.shop', 34 action: 'go.shop',
34 params: { 35 params: {
@@ -40,6 +41,30 @@ function BrandHrefBinding(el, binding) { @@ -40,6 +41,30 @@ function BrandHrefBinding(el, binding) {
40 }; 41 };
41 42
42 href += `?openby:yohobuy=${JSON.stringify(goParams)}`; 43 href += `?openby:yohobuy=${JSON.stringify(goParams)}`;
  44 + el.href = href;
  45 + return;
  46 + }
  47 +
  48 + if (yoho.isYohoBuy && !shopId) {
  49 + yoho.ready(function () {
  50 + yoho.getAppVersion({}, (version) => {
  51 + if (version >= '6.5.5') {
  52 + let { name } = binding.value;
  53 + let goParams = {
  54 + action: 'go.searchlist',
  55 + params: {
  56 + keyword: name
  57 + }
  58 + };
  59 +
  60 + href += `?openby:yohobuy=${JSON.stringify(goParams)}`;
  61 + el.href = href;
  62 + } else {
  63 + el.href = href;
  64 + }
  65 + });
  66 + });
  67 + return;
43 } 68 }
44 69
45 el.href = href; 70 el.href = href;
@@ -67,7 +67,7 @@ const yoho = { @@ -67,7 +67,7 @@ const yoho = {
67 }, 67 },
68 68
69 ready(callback) { 69 ready(callback) {
70 - if (this.isApp) { 70 + if (this.isApp || this.isYohoBuy) {
71 document.addEventListener('deviceready', callback); 71 document.addEventListener('deviceready', callback);
72 } else { 72 } else {
73 return callback(); 73 return callback();
@@ -118,7 +118,7 @@ const yoho = { @@ -118,7 +118,7 @@ const yoho = {
118 * @param fail 118 * @param fail
119 */ 119 */
120 getAppVersion(args, success, fail) { 120 getAppVersion(args, success, fail) {
121 - if (this.isApp && window.yohoInterface) { 121 + if (window.yohoInterface) {
122 window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, { 122 window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
123 method: 'get.appversion', 123 method: 'get.appversion',
124 arguments: args 124 arguments: args