Authored by 姜敏

代码审查修复

... ... @@ -8,53 +8,11 @@
const helpModel = require('../models/help');
/**
* 主界面
*/
const index = (req, res) => {
let id = req.query.id || "11";
helpModel.getHelpDetail("81", 1, 15, "").then(result=> {
let content = {content: result.helpdetail_list[0].content};
let data = Object.assign(content, helpModel.menuData());
let nav = [
{
link: global.yoho.config.sitUrl,
name: 'YOHO!BLK首页'
},
{
name: '帮助中心'
}
];
nav = nav.concat(getNav(id));
res.display('detail', {
module: 'help',
page: 'help',
content: Object.assign({nav}, data)
});
});
/* let data = Object.assign(getData(id), helpModel.menuData());
let nav = [
{
link: global.yoho.config.sitUrl,
name: 'YOHO!BLK首页'
},
{
name: '帮助中心'
}
];
nav = nav.concat(getNav(id));
res.display('detail', {
module: 'help',
page: 'help',
content: Object.assign({nav}, data)
});*/
};
/**
* 根据id获取文章数据
* @param id
* @returns {*}
*/
const getData = (id)=> {
/* const getData = (id)=> {
let contentData = helpModel.contentData().content;
for (var i = 0; i < contentData.length; i++) {
... ... @@ -62,7 +20,7 @@ const getData = (id)=> {
return contentData[i]
}
}
};
};*/
/**
* 根据id获取当前所在位置,拼接面包屑
... ... @@ -81,7 +39,7 @@ const getNav = (id)=> {
}, {
name: menuData[i].subsets[j].text
}
]
];
}
}
} else {
... ... @@ -90,12 +48,59 @@ const getNav = (id)=> {
{
name: menuData[i].text
}
]
];
}
}
}
};
/**
* 主界面
*/
const index = (req, res) => {
let id = req.query.id || '11';
helpModel.getHelpDetail('81', 1, 15, '').then(result=> {
let content = {content: result.helpdetail_list[0].content};
let data = Object.assign(content, helpModel.menuData());
let nav = [
{
link: global.yoho.config.sitUrl,
name: 'YOHO!BLK首页'
},
{
name: '帮助中心'
}
];
nav = nav.concat(getNav(id));
res.display('detail', {
module: 'help',
page: 'help',
content: Object.assign({nav}, data)
});
});
/* let data = Object.assign(getData(id), helpModel.menuData());
let nav = [
{
link: global.yoho.config.sitUrl,
name: 'YOHO!BLK首页'
},
{
name: '帮助中心'
}
];
nav = nav.concat(getNav(id));
res.display('detail', {
module: 'help',
page: 'help',
content: Object.assign({nav}, data)
});*/
};
module.exports = {
index
};
... ...
... ... @@ -7,6 +7,7 @@
'use strict';
const api = global.yoho.API;
/**
* 分类数据
* @returns {{}}
... ... @@ -15,47 +16,47 @@ const menuData = ()=> {
return {
menuData: [
{
id: "1",
text: "购物指南"
id: '1',
text: '购物指南'
},
{
id: "2",
text: "支付方式"
id: '2',
text: '支付方式'
},
{
id: "3",
text: "配送方式",
id: '3',
text: '配送方式',
subsets: [
{
id: "31",
parendId: "3",
text: "配送时间与范围"
id: '31',
parendId: '3',
text: '配送时间与范围'
},
{
id: "32",
parendId: "3",
text: "商品验收与签收"
id: '32',
parendId: '3',
text: '商品验收与签收'
}
]
},
{
id: "4",
text: "售后服务",
id: '4',
text: '售后服务',
subsets: [
{
id: "41",
parendId: "4",
text: "投诉与建议"
id: '41',
parendId: '4',
text: '投诉与建议'
},
{
id: "42",
parendId: "4",
text: "退换货流程"
id: '42',
parendId: '4',
text: '退换货流程'
},
{
id: "43",
parendId: "4",
text: "退换货政策"
id: '43',
parendId: '4',
text: '退换货政策'
}
]
}
... ... @@ -71,19 +72,19 @@ const contentData = ()=> {
return {
content: [
{
id: "11",
content: "<h1>你好</h1><p>测试11</p>"
id: '11',
content: '<h1>你好</h1><p>测试11</p>'
},
{
id: "12",
content: "<h1>你好</h1><p>测试12</p>"
id: '12',
content: '<h1>你好</h1><p>测试12</p>'
},
{
id: "13",
content: "<h1>你好</h1><p>测试13</p>"
id: '13',
content: '<h1>你好</h1><p>测试13</p>'
}
]
}
};
};
/**
... ...
... ... @@ -15,6 +15,7 @@ const help = require(`${cRoot}/help`);
// 帮助中心
router.get('/', help.index);
// router.get('/search', help.search);
... ...
... ... @@ -367,7 +367,7 @@ function getfilePath(req, res, next) {
req.filePath = filePath;
req.pipe(uploadStream);
uploadStream.on('finish', function () {
uploadStream.on('finish', function() {
next();
});
}
... ...
... ... @@ -4,36 +4,31 @@
* @date: 2016/07/25
*/
var queryId = location.search.split("=")[1] || "1";
var $cate = $(".cateId-" + queryId);//当前分类
var $subsets=$(".subsets");
var queryId = location.search.split('=')[1] || '1';
var $cate = $('.cateId-' + queryId);// 当前分类
var $subsets = $('.subsets');
var parentID = queryId.substr(0, 1);// 一级分类id
/**
* 目录切换
*/
$subsets.click(function () {
$subsets.click(function() {
var $this = $(this);
var className = $this.attr("class").split(" ")[1];
var parentId = "parentId-" + className.split("-")[1];
var $child = $this.parent().find("." + parentId);//当前子分类
var className = $this.attr('class').split(' ')[1];
var parentId = 'parentId-' + className.split('-')[1];
var $child = $this.parent().find('.' + parentId);// 当前子分类
if ($this.hasClass("open")) {
if ($this.hasClass('open')) {
$child.hide();
$this.removeClass("open").children('.plus').css("background-image", "url('../img/help/plus.png')");
$this.removeClass('open').children('.plus').css('background-image', 'url(\'../img/help/plus.png\')');
} else {
$child.show();
$this.addClass("open").children('.plus').css("background-image", "url('../img/help/minus.png')");
$this.addClass('open').children('.plus').css('background-image', 'url(\'../img/help/minus.png\')');
}
});
if (!$cate.hasClass("big-category")) {
var parentId = queryId.substr(0, 1);
$(".parentId-" + parentId).show();
$(".cateId-" + parentId).find(".plus").css("background-image", "url('../img/help/minus.png')");
if (!$cate.hasClass('big-category')) {
$('.parentId-' + parentID).show();
$('.cateId-' + parentID).find('.plus').css('background-image', 'url(\'../img/help/minus.png\')');
}
... ...
... ... @@ -21,6 +21,9 @@ var reg = new RegExp(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57
require('./me');
require('../plugins/check');
require('yoho-jquery-placeholder');
$('[placeholder]').placeholder();
$(function() {
var address = cascadingAddress({el: '#address'});
... ...
... ... @@ -50,6 +50,7 @@ var Bll = {
require('./me');
require('../plugins/check');
require('yoho-jquery-placeholder');
// 第一步:身份验证
require('../me/setting/validate');
... ... @@ -57,6 +58,7 @@ require('../me/setting/validate');
// 第二步:操作
require('../me/setting/operate');
$('[placeholder]').placeholder();
// 编辑头像移入移出切换效果
$('.user-icon').hover(function() {
... ...
... ... @@ -41,6 +41,10 @@ var validatePhoneNumLocal = function(phoneNum) {
}
};
require('yoho-jquery-placeholder');
$('[placeholder]').placeholder();
/**
* 绑定手机号码部分
*/
... ...
... ... @@ -28,6 +28,10 @@ var disableSMSBtn = function() {
}
};
require('yoho-jquery-placeholder');
$('[placeholder]').placeholder();
// 发送手机验证码
$sms.click(function() {
var mobile = $('#real-mobile').val();
... ...
... ... @@ -13,6 +13,34 @@
text-align: center;
background: #fff;
}
.nav {
li {
cursor: pointer;
padding: 10px 15px;
width: 200px;
font-size: 14px;
.plus {
cursor: pointer;
margin-right: 10px;
height: 14px;
width: 14px;
background-repeat: no-repeat;
background-image: resolve('help/plus.png');
background-size: 14px 14px;
}
.mult {
margin-right: 26px;
height: 14px;
width: 14px;
}
}
.smll-category {
display: none;
}
}
}
.help-main {
... ... @@ -22,5 +50,3 @@
}
}
@import "menu";
... ...
.nav {
li {
cursor: pointer;
padding: 10px 15px;
width: 200px;
font-size: 14px;
.plus {
cursor: pointer;
margin-right: 10px;
height: 14px;
width: 14px;
background-repeat: no-repeat;
background-image: resolve('help/plus.png');
background-size: 14px 14px;
}
}
.smll-category {
display: none;
}
}
.mult {
margin-right: 26px;
height: 14px;
width: 14px;
}