Authored by 陈轩

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

... ... @@ -20,11 +20,11 @@ module.exports = {
domains: {
// api: 'http://192.168.102.202:8080/gateway/',
// service: 'http://192.168.102.202:8080/gateway/',
// api: 'http://testapi.yoho.cn:28078/',
// service: 'http://testservice.yoho.cn:28077/'
api: 'http://testapi.yoho.cn:28078/',
service: 'http://testservice.yoho.cn:28077/'
api: 'http://devapi.yoho.cn:58078/',
service: 'http://devservice.yoho.cn:58077/'
// api: 'http://devapi.yoho.cn:58078/',
// service: 'http://devservice.yoho.cn:58077/'
},
subDomains: {
host: '.m.yohoblk.com',
... ...
... ... @@ -42,12 +42,12 @@ const titleMap = {
action: ''
},
title: {
des: '标题3',
des: 'BLK',
action: ''
},
right: {
des: '提交',
action: ''
action: 'submitForm'
}
},
4: {
... ... @@ -67,16 +67,16 @@ const titleMap = {
action: ''
},
ltitle: {
des: '商品5',
action: ''
des: '商品',
action: origin + '/favorite'
},
rtitle: {
des: '品牌5',
action: ''
des: '品牌',
action: origin + '/favorite?tab=brand'
},
right: {
des: '编辑5',
action: ''
des: '编辑',
action: 'editModel'
}
},
6: {
... ... @@ -92,20 +92,15 @@ const matchHeader = (url) => {
let header = {
headerid: '-1' // 默认不显示头部
};
let path = url.split('?')[0];
if (/\/brands/.test(url) || /\/cate/.test(url)) {
header = titleMap[2];
alert(JSON.stringify(header));
return header;
}
if (/\/home\/mydetails/.test(url)) {
if (/\/home\/mydetails$/.test(path)) {
header = titleMap[1];
header.title.des = '个人信息';
return header;
}
if (/\/home\/orders/.test(url)) {
if (/\/home\/orders$/.test(path)) {
let des = '';
let u = url.split('?')[1];
... ... @@ -124,55 +119,38 @@ const matchHeader = (url) => {
return header;
}
if (/\/home\/order-detail/.test(url)) {
if (/\/home\/order-detail$/.test(path)) {
header = titleMap[2];
header.title.des = '订单详情';
header.title.right.action = origin + '/home/service';
return header;
}
if (/\/home\/refund\/orders/.test(url)) {
if (/\/home\/refund\/orders$/.test(path)) {
header = titleMap[1];
header.title.des = '退/换货';
return header;
}
if (/\/home\/favorite/.test(url)) {
header = titleMap[5];
header.ltitle = {
des: '商品',
action: origin + '/home/favorite'
};
header.rtitle = {
des: '品牌',
action: origin + '/home/favorite?tab=brand'
};
header.right = {
des: '编辑',
action: 'editModel'
};
return header;
}
if (/\/home\/mycurrency/.test(url)) {
if (/\/home\/mycurrency$/.test(path)) {
header = titleMap[1];
header.title.des = '有货币';
return header;
}
if (/\/home\/help$/.test(url)) {
if (/\/home\/help$/.test(path)) {
header = titleMap[1];
header.title.des = '帮助中心';
return header;
}
if (/\/home\/service$/.test(url)) {
if (/\/home\/service$/.test(path)) {
header = titleMap[1];
header.title.des = 'Yoho!Blk在线客服';
return header;
}
if (/\/home\/feedback/.test(url)) {
if (/\/home\/feedback$/.test(path)) {
header = titleMap[3];
header.title.des = '意见反馈';
header.right = {
... ... @@ -182,7 +160,7 @@ const matchHeader = (url) => {
return header;
}
if (/\/home\/about/.test(url)) {
if (/\/home\/about$/.test(path)) {
header = titleMap[1];
header.title.des = '关于';
return header;
... ... @@ -194,16 +172,30 @@ const matchHeader = (url) => {
module.exports = (url) => {
if (yoho.isApp) {
// 品牌 品类
// if (/\/brands/.test(url) || /\/cate/.test(url)) {
// return yoho.goTab({index: 1});
// }
let path = url.split('?')[0];
// 个人中心收藏
if (/\/home\/favorite$/.test(path)) {
return yoho.goPageView({
header: titleMap[5]
});
}
// 个人中心首页
if (/\/home$/.test(url)) {
if (/\/home$/.test(path)) {
return yoho.goTab({index: 4});
}
// 资讯
if (/\/news$/.test(path)) {
return yoho.goTab({index: 3});
}
// 品牌 品类
if (/\/brands$/.test(path) || /\/cate$/.test(path)) {
return yoho.goTab({index: 1});
}
yoho.goNewPage({
header: matchHeader(url),
url: /^(https?:)?\/\//i.test(url) ? url : origin + url
... ...
/**
* Created by PhpStorm.
* User: Targaryen
* Date: 2016/7/29
* Time: 16:55
*/
const $ = require('yoho-jquery');
$.ajax({
url: '//res.wx.qq.com/open/js/jweixin-1.1.0.js',
dataType: 'script',
cache: true,
success: function() {
$.ajax({
url: '/api/wechat/share/token',
data: {
url: location.href
},
success: function(res) {
if (window.wx) {
window.wx.config({
debug: false,
appId: res.appId,
timestamp: res.timestamp,
nonceStr: res.nonceStr,
signature: res.signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
}
}
});
}
});
module.exports = (shareData) => {
if (window.wx) {
window.wx.ready(function() {
window.wx.onMenuShareAppMessage(shareData);
window.wx.onMenuShareTimeline(shareData);
window.wx.onMenuShareQQ(shareData);
window.wx.onMenuShareWeibo(shareData);
});
}
};
... ...
... ... @@ -277,9 +277,12 @@ const yoho = {
* @param callback 回调
*/
addNativeMethod(name, callback) {
if (window.yohoInterface) {
window.yohoInterface[name] = callback;
}
// 延迟 500ms 注入
setTimeout(function() {
if (window.yohoInterface) {
window.yohoInterface[name] = callback;
}
}, 500);
}
};
... ...
<template>
<div class="search">
<input v-if="showInput" type="text" name="">
<div v-else class="input" @click="changeToInput()">
<div v-else class="input" @click='yoho.goSearch()'>
<span class="icon icon-search"></span> Search
</div>
</div>
... ... @@ -26,24 +25,16 @@
padding: 5px 0;
}
input {
width: 92%;
height: 55px;
padding: 10px;
}
}
</style>
<script>
const yoho = require('yoho');
module.exports = {
data() {
return {
showInput: false
yoho
};
},
methods: {
changeToInput() {
this.showInput = true;
}
}
};
</script>
... ...
... ... @@ -10,7 +10,7 @@
<button class="button" @click='yoho.goNewPage({"url":"http://m.yohoblk.com"})'>新页面</button>
<button class="button" @click="yoho.goPay()">支付</button>
<button class="button" @click="yoho.goBack()">返回</button>
<button class="button" @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com"})'>分享</button>
<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>
<button class="button" @click='yoho.goSearch()'>搜索</button>
<button class="button" @click='yoho.goSetting()'>设置</button>
<button class="button" @click='yoho.goSetAvatar()'>设置头像</button>
... ...
... ... @@ -15,7 +15,7 @@
<div class="bottom clearfix">
<span class="icon time-icon">&#xe612;</span>
<span class="time">{{news.publishTime}}</span>
<span class="icon share" @click="share(news.title, news.intro, news.src, news.share.url)">&#xe611;</span>
<span class="icon icon-share share" @click="share(news.title, news.intro, news.src, news.share.url)"></span>
</div>
</div>
</div>
... ...
... ... @@ -396,6 +396,7 @@
const app = $('#app');
const tip = require('common/tip');
const yoho = require('yoho');
const share = require('common/share');
require('yoho-vue-swipe/dist/vue-swipe.css');
... ... @@ -525,6 +526,21 @@
}
});
share({
title: this.entity.productName,
link: location.href,
desc: '我在BLK发现了一个不错的商品,快来看看吧!',
imgUrl: this.firstImage.replace(/(\{width}|\{height}|\{mode})/g, function($0) {
const dict = {
'{width}': 300,
'{height}': 300,
'{mode}': 2
};
return dict[$0];
})
});
return result;
}).then((result)=> {
loadIntroDeferred = () => {
... ...
... ... @@ -52,6 +52,7 @@
const shareBottom = require('component/tool/share-bottom.vue');
const qs = require('yoho-qs');
const tip = require('common/tip');
const share = require('common/share');
module.exports = {
... ... @@ -60,6 +61,16 @@
shopInfo: {}
};
},
watch: {
shopInfo() {
share({
title: this.shopInfo.brandName,
link: location.href,
desc: this.shopInfo.shareSubTitle,
imgUrl: this.shopInfo.brandBg
});
}
},
methods: {
/* 获取店铺简介相关数据 */
... ...
... ... @@ -51,7 +51,7 @@
color: #000;
height: 120px;
top: 0;
padding: 70px 20px 10px;
padding: 55px 20px 10px;
}
</style>
... ...