Authored by 郭成尧

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

... ... @@ -54,13 +54,15 @@ module.exports = {
infoFile: {
name: 'info',
level: 'info',
filename: 'logs/info.log'
filename: 'logs/info.log',
maxFiles: 7
},
errorFile: {
name: 'error',
level: 'error',
filename: 'logs/error.log',
handleExceptions: true
handleExceptions: true,
maxFiles: 7
},
udp: { // send by udp
level: 'debug', // logger level
... ... @@ -99,7 +101,7 @@ if (isProduction) {
useOneapm: true,
useCache: true,
interfaceShunt: {
useInterfaceShunt: true,
useInterfaceShunt: false,
tencentServers: {
api: ['123.206.1.98', '123.206.2.80'],
service: ['123.206.1.98', '123.206.2.80']
... ...
/**
* 内容码配置文件
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2016/06/23
*/
'use strict';
const channel = {
men: '9ee58aadd9559d07207fe4a98843eaac',
women: '3ad8826fc89fb0d023a4cd06a6991219',
lifestyle: 'aa8d34c85934c2ccc16e2babd3eb5e47'
};
const brand = {
men: '9ee58aadd9559d07207fe4a98843eaac',
women: 'aa8d34c85934c2ccc16e2babd3eb5e47',
lifestyle: '3ad8826fc89fb0d023a4cd06a6991219'
};
const cate = {
men: '9ee58aadd9559d07207fe4a98843eaac',
women: 'aa8d34c85934c2ccc16e2babd3eb5e47',
lifestyle: '3ad8826fc89fb0d023a4cd06a6991219'
};
module.exports = {
channel,
brand,
cate
};
# blk-wap项目中的一些注意点
## 框架结构
首先,我们先说一下blk-wap项目的架构,这样便于后面的人能够快速上手
1. 服务端:node的express框架
2. ui端:vue + gulp + webpack
## 目录结构
apps: node服务端业务代码
config: 配置信息
doraemon:express中全局的一些中间件,以及views目录下的一些模版文件
public: 前段ui代码(css,js,vue等)以及打包工具(gulp,webpack)
utils:辅助工具方法
app.js: node服务入口文件
dispatch.js :路由分发文件
## vue
关于vue部分,如果不熟悉的话,大家可以查看一下官方文档
http://cn.vuejs.org/guide/
这里面主要是组件方面知识,用的比较多。
## 与app端的交互
混合模式下,比较麻烦的地方是与app原生端的交互。因为有些业务处理需要app端配合处理。
... ...
... ... @@ -6,8 +6,8 @@
const channel = {
men: '9ee58aadd9559d07207fe4a98843eaac',
women: 'aa8d34c85934c2ccc16e2babd3eb5e47',
lifestyle: '3ad8826fc89fb0d023a4cd06a6991219'
women: '3ad8826fc89fb0d023a4cd06a6991219',
lifestyle: 'aa8d34c85934c2ccc16e2babd3eb5e47'
};
/* 品牌一览资源位 */
... ...
... ... @@ -23,6 +23,8 @@ const yoho = {
* 判断是否是 APP
*/
isApp: /yh_blk/i.test(navigator.userAgent || ''),
isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''),
isAndroid: /Android/i.test(navigator.userAgent || ''),
/**
* store
... ...
... ... @@ -89,7 +89,7 @@ ul {
}
img[lazy] {
transition: all 200ms;
transition: all 100ms;
}
img[lazy=loading] {
... ...
... ... @@ -7,7 +7,8 @@
</div>
</template>
<a class="item ellipsis" href="{{item.sortUrl}}">
{{(item.sortNameEn || '').trim()}}{{item.sortName}}
<span class="en">{{(item.sortNameEn || '').trim()}}</span>
<span class="cn">{{item.sortName}}</span>
</a>
</template>
</div>
... ... @@ -54,6 +55,7 @@
left: 0;
overflow-x: hidden;
overflow-y: auto;
background: #f6f6f6;
}
.sidebar {
... ... @@ -65,11 +67,20 @@
padding: 0 30px;
height: 124px;
line-height: 124px;
font-size: 36px;
font-size: 30px;
font-weight: bold;
font-family: "BrownStd-Bold", "PingFang SC", Helvetica, Roboto, "Heiti SC", "黑体", Arial;
.en {
font-size: 36px;
}
.cn {
margin-left: -6px;
}
&:first-child {
font-size: 36px;
height: 142px;
line-height: 142px;
font-family: "PingFang SC", Helvetica, Roboto, "Heiti SC", "黑体", Arial;
... ... @@ -85,8 +96,12 @@
border-bottom: 1px solid #eee;
}
&:last-child:after {
content: none;
&:last-child {
border-bottom: 1px solid #eee;
&:after {
content: none;
}
}
}
... ... @@ -99,6 +114,7 @@
border-bottom: 1px solid #eee;
& + .item {
font-size: 36px;
height: 142px;
line-height: 142px;
font-family: "PingFang SC", Helvetica, Roboto, "Heiti SC", "黑体", Arial;
... ...
... ... @@ -56,7 +56,7 @@
<button v-if="order.isSupportRefund == 'Y' || order.isSupportExchange == 'Y'" class="normal" @click="applyRefund()">申请售后</button>
</template>
</div>
<select id="cancel-reason" class="cancel-reason" @blur="reasonChange" @change="reasonChange" v-model="selected">
<select id="cancel-reason" class="cancel-reason" @change="reasonChange" v-model="selected">
<option v-for="option in options" :value="{id:option.id,reason:option.reason}">{{option.reason}}</option>
</select>
</template>
... ... @@ -79,8 +79,7 @@
order: {},
options: [],
selected: {},
genderSel: {},
cancelbusy: false
genderSel: {}
};
},
created() {
... ... @@ -113,7 +112,6 @@
this.show = false;
this.order = {};
this.selected = {};
this.cancelbusy = false;
this.getOrderData();
},
... ... @@ -158,31 +156,34 @@
});
},
reasonChange() {
if (this.cancelbusy) {
return false;
}
setTimeout(() => {
if (!this.selected.id || document.hidden) {
return false;
}
this.cancelbusy = true;
this.orderDetail().cancel({
orderCode: this.order.orderCode,
reasonId: this.selected.id || this.options[0].id,
reason: this.selected.reason || this.options[0].reason
}, (result) => {
if (result.code === 200) {
tip('取消成功');
this.orderDetail().cancel({
orderCode: this.order.orderCode,
reasonId: this.selected.id,
reason: this.selected.reason
}, (result) => {
if (result.code === 200) {
tip({
delay: 500,
txt: '取消成功'
});
setTimeout(() => {
this.reload();
}, 1000);
setTimeout(() => {
this.reload();
}, 300);
yoho.store.set('orderReload', true);
} else if (result.code !== 500) {
tip(result.message);
}
this.cancelbusy = false;
}, () => {
tip('操作失败');
});
yoho.store.set('orderReload', true);
} else if (result.code !== 500) {
tip(result.message);
}
}, () => {
tip('操作失败');
});
}, 700);
},
getCancelReason() {
$.ajax({
... ... @@ -190,6 +191,12 @@
}).then(result => {
if (result.data.length > 0) {
this.options = result.data;
if (yoho.isiOS) {
this.options.unshift({
id: 0,
reason: '请选择'
});
}
}
}).fail(() => {
tip('操作失败');
... ... @@ -208,10 +215,21 @@
},
autoCancel(code) {
return () => {
let reasonId;
let reason;
if (yoho.isiOS && this.options.length > 1) {
reasonId = this.options[1].id;
reason = this.options[1].reason;
} else if (this.options.length) {
reasonId = this.options[0].id;
reason = this.options[0].reason;
}
this.orderDetail().cancel({
orderCode: code,
reasonId: this.options.length ? this.options[0].id : null,
reason: this.options.length ? this.options[0].reason : null
reasonId: reasonId,
reason: reason
}, (result) => {
if (result.code === 200) {
this.reload();
... ... @@ -285,7 +303,7 @@
orderid: order.orderCode,
amount: order.amount,
orderDesc: orderDesc.join(','),
type: "orderDetail"
type: 'orderDetail'
}, () => {
this.reload();
yoho.store.set('orderReload', true);
... ...
... ... @@ -54,7 +54,7 @@
<p>Your do not have an order <br>for the time being</p>
<a href="/product/new">随便逛逛</a>
</div>
<select id="cancel-reason" class="cancel-reason" @blur="reasonChange" @change="reasonChange" v-model="selected">
<select id="cancel-reason" class="cancel-reason" @change="reasonChange" v-model="selected">
<option v-for="option in options" :value="{id:option.id,reason:option.reason}">{{option.reason}}</option>
</select>
</template>
... ... @@ -75,7 +75,6 @@
pageTotal: 1,
type: this.$parent.$data.type,
busy: false,
cancelbusy: false,
emptybox: 'hide',
currentCode: '',
selected: {},
... ... @@ -98,7 +97,6 @@
this.page = 0;
this.pageTotal = 1;
this.busy = false;
this.cancelbusy = false;
this.emptybox = 'hide';
this.currentCode = '';
this.selected = {};
... ... @@ -135,28 +133,31 @@
});
},
reasonChange() {
if (this.cancelbusy) {
return false;
}
this.cancelbusy = true;
this.order().cancel({
orderCode: this.currentCode,
reasonId: this.selected.id || this.options[0].id,
reason: this.selected.reason || this.options[0].reason
}, (result) => {
if (result.code === 200) {
tip('取消成功');
setTimeout(() => {
this.reload();
}, 1000);
} else if (result.code !== 500) {
tip(result.message);
setTimeout(() => {
if (!this.selected.id || document.hidden) {
return false;
}
this.cancelbusy = false;
}, () => {
tip('操作失败');
});
this.order().cancel({
orderCode: this.currentCode,
reasonId: this.selected.id,
reason: this.selected.reason
}, (result) => {
if (result.code === 200) {
tip({
delay: 500,
txt: '取消成功'
});
setTimeout(() => {
this.reload();
}, 300);
} else if (result.code !== 500) {
tip(result.message);
}
}, () => {
tip('操作失败');
});
}, 700);
},
getCancelReason() {
$.ajax({
... ... @@ -164,6 +165,13 @@
}).then(result => {
if (result && result.data) {
this.options = result.data;
if (yoho.isiOS) {
this.options.unshift({
id: 0,
reason: '请选择'
});
}
}
}).fail(() => {
tip('操作失败');
... ... @@ -171,10 +179,21 @@
},
autoCancel(code) {
return () => {
let reasonId;
let reason;
if (yoho.isiOS && this.options.length > 1) {
reasonId = this.options[1].id;
reason = this.options[1].reason;
} else if (this.options.length) {
reasonId = this.options[0].id;
reason = this.options[0].reason;
}
this.order().cancel({
orderCode: code,
reasonId: this.options.length ? this.options[0].id : null,
reason: this.options.length ? this.options[0].reason : null
reasonId: reasonId,
reason: reason
}, (result) => {
if (result.code === 200) {
this.reload();
... ... @@ -261,7 +280,7 @@
orderid: order.orderCode,
amount: order.amount,
orderDesc: orderDesc.join(','),
type: "orderList"
type: 'orderList'
}, () => {
this.reload();
});
... ...