Authored by ccbikai

Merge branch 'develop' into release/1.0

... ... @@ -87,6 +87,7 @@
"vue-swipe": "0.2.6",
"vue-touch": "1.1.0",
"webpack": "^1.13.1",
"webpack-dashboard": "0.0.1",
"webpack-dev-server": "^1.14.1",
"webpack-stream": "^3.1.0",
"yoho-cookie": "1.2.0",
... ...
... ... @@ -18,6 +18,8 @@ const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const webpackConfig = require('./webpack.config.js');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const Dashboard = require('webpack-dashboard');
const DashboardPlugin = require('webpack-dashboard/plugin');
const env = {
dev: Symbol('development'),
... ... @@ -184,6 +186,7 @@ gulp.task('postcss', ['assets'], () => {
// webpack dev server
gulp.task('webpack-dev-server', () => {
const useDashboard = process.platform === 'darwin' || process.platform === 'linux';
const devConfig = Object.assign({}, webpackConfig, {
devtool: '#inline-source-map',
vue: {
... ... @@ -200,10 +203,25 @@ gulp.task('webpack-dev-server', () => {
}
});
devConfig.output.publicPath = 'http://localhost:5004/';
// 开发环境插件
devConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
if (useDashboard) {
const dashboard = new Dashboard(); // webpackDashboardPlugin
devConfig.plugins.push(new DashboardPlugin(dashboard.setData));
}
devConfig.entry.libs.unshift(`webpack-dev-server/client?${devConfig.output.publicPath}`, 'webpack/hot/dev-server');
new WebpackDevServer(webpack(devConfig), {
contentBase: '.',
publicPath: '//localhost:5004/',
publicPath: devConfig.output.publicPath,
hot: true,
inline: true,
quiet: useDashboard,
stats: {
colors: true
},
... ... @@ -214,7 +232,7 @@ gulp.task('webpack-dev-server', () => {
if (err) {
throw new gutil.PluginError('webpack-dev-server', err);
}
gutil.log('[webpack-serve]', 'http://localhost:5004/');
gutil.log('[webpack-serve]', devConfig.output.publicPath);
});
});
... ...
<div class="modal {{styleClass}}">
<h2>{{title}}</h2>
<p>{{text}}</p>
<p>{{{text}}}</p>
<hr>
<div class="button-group">
{{#each buttons}}
... ...
... ... @@ -7,7 +7,6 @@
.edit-logistics {
display: inline-block;
margin-top: 20px;
padding: 0 30px;
width: 100%;
background: #fff;
... ...
... ... @@ -26,7 +26,7 @@
<h2 class="editorial-relate-title">相关品牌</h2>
<ul>
<li v-for="item in brands">
<a :href="item.brandDomain | brandUrl"><img :src="item.thumb"></a>
<a :href="item.url | brandUrl"><img :src="item.thumb"></a>
</li>
</ul>
</div>
... ... @@ -204,7 +204,6 @@
const editorialId = $('#app').data('editorialId');
this.id = editorialId;
let loadDeferred = null;
$.get(`/editorial/editorial_${editorialId}.json`).then(result => {
const article = result[0],
... ... @@ -212,7 +211,7 @@
brands = result[2],
other = result[3];
let goods, prodMap = {};
let goods = {};
if (article && article.code === 200 && article.data) {
this.article = article.data;
... ... @@ -237,27 +236,19 @@
}
// 延时读取商品价格、名称等信息
loadDeferred = () => {
if (!goods || !goods.length) {
return;
}
$.get('/product/search_product.json', {
ids: goods.map((item)=> {
return item.id;
}).join(',')
}).then((data)=> {
if (data.data) {
this.$set('recommendProducts', data.data.productList);
}
});
};
});
$(window).on('scroll', ()=> {
if ($(window).scrollTop() > 100 && loadDeferred) {
loadDeferred();
loadDeferred = null;
if (!goods || !goods.length) {
return;
}
$.get('/product/search_product.json', {
ids: goods.map((item)=> {
return item.id;
}).join(',')
}).then((data) => {
if (data.data) {
this.$set('recommendProducts', data.data.productList);
}
});
});
}
};
... ...
... ... @@ -19,6 +19,7 @@
</div>
</div>
</div>
<div v-if="!scrollDisabled" class="is-loading">loading...</div>
</template>
<style>
.editorial-box {
... ... @@ -76,6 +77,12 @@
}
}
}
.is-loading {
font-size: 32px;
text-align: center;
padding: 16px 0;
}
</style>
<script>
const util = require('common/util');
... ... @@ -116,7 +123,7 @@
channel: this.channel
}
}).done(result => {
if (result.code === 200) {
if (result.code === 200 && result.data.list.length > 0) {
if (this.editorialList.length > 0 && result.data.list.length > 0) {
this.$set('editorialList', this.editorialList.concat(result.data.list));
} else if (result.data.list.length > 0) {
... ...
... ... @@ -3,13 +3,13 @@
<navbar>
<template slot="right">
<a class="right-button no-intercept" href="javascript:void(0);" @click="like()">
<span class="icon" :class="{'icon-like': !isLiked, 'icon-liked': isLiked}"></span>
{{likeCount}}
</a>
<a class="right-button no-intercept" href="javascript:void(0);" @click="favorite()">
<span class="icon" :class="{ 'icon-love': !isFavorite, 'icon-love-solid': isFavorite}"></span>
<span class="icon icon-like" :class=""></span>
{{likeCount ? likeCount : ''}}
</a>
<!--暂时隐藏收藏入口,下个版本使用-->
<!--<a class="right-button no-intercept" href="javascript:void(0);" @click="favorite()">-->
<!--<span class="icon" :class="{ 'icon-love': !isFavorite, 'icon-love-solid': isFavorite}"></span>-->
<!--</a>-->
<a class="right-button no-intercept" href="javascript:void(0);" @click="share()">
<span class="icon icon-share"></span>
... ... @@ -21,7 +21,7 @@
<style>
.top-nav {
.right-button {
margin-left: 30px;
/*margin-left: 30px;*/
}
}
</style>
... ... @@ -65,6 +65,9 @@
if (misc && misc.code === 200) {
this.isLiked = misc.data.isPraise === 'Y';
if (misc.data.isPraise === 'Y') {
tip('点赞成功');
}
}
});
},
... ... @@ -77,7 +80,6 @@
if (result && result.code === 403) {
// 未登录
yoho.goLogin('', () => {
console.log(this);
this.favorite();
}, function() {
tip('登录失败');
... ... @@ -87,12 +89,18 @@
if (misc && misc.code === 200) {
this.isFavorite = misc.data.isFavor === 'Y';
if (misc.data.isFavor === 'Y') {
tip('收藏成功');
} else {
tip('取消收藏');
}
}
});
},
share: function() {
let title = this.article.articleTitle;
title = title.length > 15 ? title.substr(0,15)+'...' : title;
title = title.length > 15 ? title.substr(0, 15) + '...' : title;
yoho.goShare({
title,
... ...
... ... @@ -182,6 +182,12 @@
color: #000;
}
.blk-header-main {
position: absolute;
left: 0;
right: 0;
}
.top-box {
.blk-header {
background-color: transparent;
... ...
... ... @@ -13,7 +13,7 @@
</div>
</li>
</ul>
<div v-if="detail.status == 20"
<div v-if="detail.status == 20 && detail.deliveryTpye != 20"
class="logistics-detail">
<template v-if="detail.notice">
<a href="/me/logistic?order_code={{sourceOrderCode}}&id={{applyid}}&type={{type}}">
... ... @@ -131,6 +131,7 @@
this.show = false;
this.detail = {};
yoho.store.remove('refundStatus');
$.ajax({
url: '/me/return/status-detail',
data: {
... ... @@ -170,7 +171,6 @@
url = '/me/return/exchange/cancel-apply';
}
Modal.confirm('', '确认取消吗?', function() {
this.hide();
$.ajax({
... ... @@ -193,7 +193,7 @@
this.reload();
document.addEventListener('visibilitychange', () => {
if (!document.hidden) {
if (!document.hidden && yoho.store.get('refundStatus')) {
this.reload();
}
});
... ...
<template>
<div class="edit-logistics-page">
<form class="edit-logistics">
<div class="edit-logistics">
<label @click="companylist">
选择快递公司<input class="company-val" type="text" value="{{company_name}}" readonly>
<span class="icon icon-right"></span>
... ... @@ -9,7 +9,7 @@
快递单号
<input class="num" maxlength="20" v-model='num'>
</label>
</form>
</div>
<div class="submit" @click="submit">确认</div>
</div>
</template>
... ... @@ -18,6 +18,7 @@
const $ = require('jquery');
const tip = require('common/tip');
const yoho = require('yoho');
const modal = require('common/modal');
module.exports = {
props: ['applyid', 'type', 'company_id', 'company_name'],
... ... @@ -42,27 +43,34 @@
return false;
}
$.ajax({
method: 'POST',
url: '/me/return/save-logistics',
data: {
applyid: this.applyid,
type: this.type,
expressId: this.company_id,
expressCompany: this.company_name,
expressNumber: this.num
}
}).then(res => {
if ($.type(res) !== 'object') {
res = {};
}
if (res.code !== 200) {
tip(res.message || '网络错误');
} else {
yoho.goBack();
}
const text = `快递公司:${this.company_name} <br>单号:${this.num}`;
const _this = this;
modal.confirm(text, '请确认寄回信息是否正确?', function() {
this.hide();
$.ajax({
url: '/me/return/save-logistics',
type: 'post',
data: {
applyid: _this.applyid,
type: _this.type,
expressId: _this.company_id,
expressCompany: _this.company_name,
expressNumber: _this.num
}
}).then(res => {
if ($.type(res) !== 'object') {
res = {};
}
if (res.code !== 200) {
tip(res.message || '网络错误');
} else {
yoho.goBack();
yoho.store.set('refundStatus', true);
return false;
}
});
});
return false;
}
}
};
... ...
... ... @@ -90,7 +90,8 @@
title: result.shopName,
des: shareSubTitle,
url: shareUrl,
img: result.shopLogo ? result.shopLogo.replace(/{width}/g, 120).replace(/{height}/g, 80) : '',
img: result.shopLogo ? result.shopLogo.split('?')[0] +
'?imageMogr2/thumbnail/300x300/format/jpg/quality/90' : '',
isBlkShop: result.isBlkShop,
domain: locationQuery.domain,
brandName: result.brandName,
... ...