Authored by 姜敏

Merge branch 'yohobuy-shop-dev-4.6-20160606' of http://git.yoho.cn/fe/yohobuy-sh…

…op-fe2 into yohobuy-shop-dev-4.6-20160606
... ... @@ -3,7 +3,7 @@
</template>
<script>
import multilevel from '../../../../components/multilevel/index';
import multilevel from '../../../../components/sort/index';
export default {
components:{
... ...
var Vue = require("vue");
Vue.use(require('vue-resource'));
new Vue({
el: 'body',
components: {
app:require("./app1.vue")
app:require("./app.vue")
}
});
\ No newline at end of file
... ...
<style>
.multilevel{position: relative; font-family: 'microsoft yahei'; font-size:14px; color: #585858}
.multilevel a,.multilevel span{cursor: pointer; text-decoration: none; color:#585858}
.picker-data{display: inline-block; width: 250px; height: 34px; border: 1px solid #ccd0d4; padding:6px 12px; position: relative; border-radius: 3px}
.placeholder{display: block}
.select-item a:hover{background: #CCCCCC}
.select-item i{margin: 0 2px}
.arrow{position: absolute; top: 50%; right: 8px; width: 10px; margin-top: -3px; height: 5px; background: url(./drop-arrow.png) -10px -25px no-repeat}
.picker-dropdown{position: absolute; top: 34px; left: 1px;}
.select-wrap{box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5); border-radius: 4px; width: 300px}
.select-tab{background: #f0f0f0; border-bottom: 1px solid #ccc;}
.select-tab a{display: inline-block; padding: 8px 15px; border-left: 1px solid #ccc; border-bottom: 1px solid transparent; margin-bottom: -1px}
.select-tab a:first-child { border-left: none}
.select-tab a.active{background: #FFFFFF; border-bottom: 1px solid #FFFFFF;}
.select-content{background: #FFFFFF;}
.levelContent{clear: both; list-style: none; margin: 0; padding: 10px;}
.levelContent li{display: inline-block; padding: 5px 10px;}
</style>
<template>
<div class="multilevel">
<span class="picker-data">
<span v-show="dataList.length==0" class="placeholder" @click="showDropdown">请选择类目</span>
<span v-show="dataList.length>0" class="data">
<span class="select-item" v-for="data in dataList">
<i v-if="$index>0">/</i>
<a href="javascript:" @click="selectTab($index)">{{data}}</a>
</span>
</span>
<div class="arrow"></div>
</span>
<div class="picker-dropdown" v-show="isShowDropdown">
<div class="select-wrap">
<div class="select-tab">
<a v-for="tab in levelContent" class="level {{$index==activeTab?'active':''}}" @click="selectTab($index)">{{tab.name}}</a>
</div>
<div class="select-content">
<ul v-for="content in levelContent" class="levelContent" v-show="activeTab==$index">
<li v-for="item in content.list"><a href="javascript:" @click="selectItem(item)">{{item}}</a></li>
</ul>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
levelContent:[
{name:"一级目录", list:["a1","a2","a3"]},
{name:"二级目录", list:["b1","b2","b3"]},
{name:"三级目录", list:["c1","c2","c3"]}
],
isShowDropdown:false,
activeTab:0,
maxTab:2,
dataList:[]
}
},
computed:{
dataArray(){
console.log(this.dataList);
return this.dataList.join('/');
}
},
methods: {
showDropdown(){
if(this.isShowDropdown){
this.isShowDropdown = false;
}else{
this.isShowDropdown = true;
}
},
selectTab(index){
this.isShowDropdown = true;
this.activeTab = index;
},
selectItem(item){
this.dataList.$set(this.activeTab,item);
this.dataList.splice(this.activeTab+1, this.dataList.length-this.activeTab-1);
if(this.activeTab < this.maxTab){
this.activeTab ++;
}else{
this.activeTab = 0;
this.isShowDropdown = false;
}
}
}
}
</script>
\ No newline at end of file
<style>
.multilevel{position: relative; font-family: 'microsoft yahei'; font-size:14px; color: #585858}
.multilevel a,.multilevel span{cursor: pointer; text-decoration: none; color:#585858; display: inline-block;}
.picker-data{display: inline-block; height: 34px; border: 1px solid #ccd0d4; padding:6px 12px; position: relative; border-radius: 3px}
.placeholder,.data{display: inline-block; width: 200px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden;}
.placeholder{font-size: 14px; color: #9d9d9d}
.data a{font-size: 12px}
.select-item a{padding: 0 2px}
.select-item a:hover{background: #CCCCCC}
.clearData{display: inline-block; width: 30px; margin-left: 10px; text-overflow:ellipsis; white-space:nowrap; overflow:hidden;}
.clearData em{color: #999999; font-size: 12px; }
.picker-dropdown{position: absolute; top: 34px; left: 1px;}
.select-wrap{box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5); border-radius: 4px; width: 350px}
.select-tab{background: #f0f0f0; border-bottom: 1px solid #ccc;}
.select-tab a{display: inline-block; font-size: 12px; padding: 8px 15px; border-left: 1px solid #ccc; border-bottom: 1px solid transparent; margin-bottom: -1px}
.select-tab a:first-child {border-left: none}
.select-tab a:last-child {border-right: 1px solid #ccc}
.select-tab a.active{background: #FFFFFF; border-bottom: 1px solid #FFFFFF;}
.select-content{background: #FFFFFF;}
.levelContent,.noSort{clear: both; list-style: none; margin: 0; padding: 10px;}
.levelContent li,.noSort li{display: inline-block; padding: 5px 10px;}
.levelContent li.active{background: #5bc0de; border-radius: 4px}
.levelContent li.active a{color:#FFFFFF}
.noSort li span{color: #ff0000}
</style>
<template>
<div class="region-picker">
<!-- <label class="province">
<slot name="province"></slot>
<select class="province-select" v-model="provinceSelected" :required="required" :disabled="disabled">
<option value="" v-text="placeholder.province"></option>
<option v-for="item in provinces" :value="item" v-text="item[1]"></option>
</select>
</label> -->
<template v-for="row in rows">
</template>
<div class="multilevel">
<span class="picker-data">
<span v-show="dataList.length==0" class="placeholder" @click="showDropdown">请选择类目</span>
<span v-show="dataList.length>0" class="data" @click="showDropdown">
<span class="select-item" v-for="data in dataList">
<i v-if="$index>0">-</i>
<a href="javascript:" @click="selectTab($index)">{{data.sortName}}</a>
</span>
</span>
<span class="clearData" @click="destroy">
<em v-show="dataList.length>0">清空</em>
</span>
</span>
<div class="picker-dropdown" v-show="isShowDropdown">
<div class="select-wrap">
<div class="select-tab">
<a v-for="tab in tabList" class="level {{$index==activeTab?'active':''}}" @click="selectTab($index)">{{tab}}</a>
</div>
<div class="select-content">
<ul v-for="(index,content) in levelContent" class="levelContent" v-show="activeTab==index">
<li v-for="(key,item) in content" class="{{item.id==dataList[index].id?'active':''}}">
<a href="javascript:" @click="selectItem(item)">{{item.sortName}}</a>
</li>
</ul>
<ul v-show="activeTab>=levelContent.length" class="noSort">
<li><span>请选择上级类目!</span></li>
</ul>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name:'yoho-sort',
props:{
rows:{
type:Array,
default:[]
dataList: {type: Array, default: []}
},
data() {
return {
tabList:["一级目录","二级目录","三级目录","四级目录"],
levelContent:[],
isShowDropdown:false,
activeTab:0,
maxTab:3
}
},
ready() {
this.fetchAllSortList();
},
methods: {
showDropdown(){
this.isShowDropdown = true;
},
closeDropdown(){
this.activeTab = 0;
this.isShowDropdown = false;
},
selectTab(index){
this.showDropdown();
this.activeTab = index;
},
selectItem(item){
this.dataList.$set(this.activeTab,item);
this.dataList.splice(this.activeTab+1, this.dataList.length-this.activeTab-1);
if(this.activeTab < this.maxTab){
this.activeTab ++;
this.fetchSubSortList(item.id);
}else{
this.closeDropdown();
}
},
destroy(){
this.dataList.splice(0,this.dataList.length);
this.activeTab = 0;
this.levelContent.splice(1, this.levelContent.length-1);
},
fetchAllSortList(){
this.$http.post("/product/class/queryAllProductSortList").then(function (response) {
var rs = response.data;
this.levelContent.$set(0,rs.data);
}, function (response) {
var rs = response.data;
console.log(rs.message);
});
},
fetchSubSortList(sortId){
this.$http.post("/product/class/queryProductSortList",{
param:sortId
}).then(function (response) {
var rs = response.data;
if(rs.data.length>0){
this.levelContent.$set(this.activeTab,rs.data);
}else{
this.closeDropdown();
}
}, function (response) {
var rs = response.data;
console.log(rs.message);
});
}
}
}
... ...
... ... @@ -78,15 +78,15 @@ if(process.env.NODE_ENV!=='development'){
apiCofig.log.src="/Data/logsnode/yohobuy-portal-log/"
}
/*环境配置*/
// if(process.env.NODE_ENV==="test"){
if(process.env.NODE_ENV==="test"){
// apiCofig.MVC={
// Interfacer:path.join(__dirname,"interfaces/0.js").replace(/0/g,'*'),
// Controller:path.join(__dirname,"controllers/0.js").replace(/0/g,'*'),
// filters: path.join(__dirname, "filters.js"),
// views: path.resolve(__dirname,"views", "0", "1")
// }
// apiCofig.EnvConst.domain="http://10.66.100.6:8088/platform";
// apiCofig.EnvConst.bigdata="http://10.66.100.7:8091/bigdata";
// }
apiCofig.MVC={
Interfacer:path.join(__dirname,"interfaces/0.js").replace(/0/g,'*'),
Controller:path.join(__dirname,"controllers/0.js").replace(/0/g,'*'),
filters: path.join(__dirname, "filters.js"),
views: path.resolve(__dirname,"views", "0", "1")
}
apiCofig.EnvConst.domain="http://10.66.100.6:8088/platform";
apiCofig.EnvConst.bigdata="http://10.66.100.7:8091/bigdata";
}
module.exports = require('./libs/App')(apiCofig);
\ No newline at end of file
... ...
... ... @@ -4,6 +4,8 @@ var md5 = require('md5');
var Emitter=require('events');
/*重写控制器*/
var _ = require('lodash');
var fs=require('fs');
var config = JSON.parse(fs.readFileSync('./package.json').toString());
var toString= Object.prototype.toString;
... ... @@ -135,8 +137,16 @@ Controller.prototype.client=function(res,views,model,clientmodel){
model={};
}
ViewModel="<script>var ViewModel="+JSON.stringify(model)+";</script>";
var script=['<script type="text/javascript" src="/static/'+clientmodel+'/libs.js"></script>',
'<script type="text/javascript" src="/static/'+clientmodel+'/'+ views+'.js"></script>'];
var src="";
if(process.env.NODE_ENV==="production"){
src="http://cdn.yoho.cn/yohobuy-shops-fe/"+config.version;
html.replace(/\/static\/index\.min\.css/g,function($1){
return src+$1;
})
}
var script=['<script type="text/javascript" src="'+src+'/static/'+clientmodel+'/libs.js"></script>',
'<script type="text/javascript" src="'+src+'/static/'+clientmodel+'/'+ views+'.js"></script>'];
res.send(html+ViewModel+script.join(''));
}
}
... ...
... ... @@ -42,7 +42,7 @@ var Iaccount = {
var apiCofig = {
//root:__dirname,
EnvConst:{
domain:"http://192.168.102.202:8088/platform",
domain:"http://192.168.102.210:8088/platform",
//bigdata:"http://172.16.6.189:8080/bigdata",//李建
bigdata:"http://192.168.102.210:8091/bigdata",
//bigdata:"http://172.16.6.110:8080",//钟文
... ... @@ -78,15 +78,15 @@ if(process.env.NODE_ENV!=='development'){
apiCofig.log.src="/Data/logsnode/yohobuy-portal-log/"
}
/*环境配置*/
// if(process.env.NODE_ENV==="test"){
if(process.env.NODE_ENV==="test"){
// apiCofig.MVC={
// Interfacer:path.join(__dirname,"interfaces/0.js").replace(/0/g,'*'),
// Controller:path.join(__dirname,"controllers/0.js").replace(/0/g,'*'),
// filters: path.join(__dirname, "filters.js"),
// views: path.resolve(__dirname,"views", "0", "1")
// }
// apiCofig.EnvConst.domain="http://10.66.100.6:8088/platform";
// apiCofig.EnvConst.bigdata="http://10.66.100.7:8091/bigdata";
// }
apiCofig.MVC={
Interfacer:path.join(__dirname,"interfaces/0.js").replace(/0/g,'*'),
Controller:path.join(__dirname,"controllers/0.js").replace(/0/g,'*'),
filters: path.join(__dirname, "filters.js"),
views: path.resolve(__dirname,"views", "0", "1")
}
apiCofig.EnvConst.domain="http://10.66.100.6:8088/platform";
apiCofig.EnvConst.bigdata="http://10.66.100.7:8091/bigdata";
}
module.exports = require('./libs/App')(apiCofig);
\ No newline at end of file
... ...
... ... @@ -37,8 +37,8 @@ module.exports={
namespace:"common",
apis:{
login:function(req,callback){
var user = req.body.user||'wxtest1';
var password = req.body.password||'yoho9646abcdef';
var user = req.body.user;
var password = req.body.password;
var userInfo = {},result={code:400,message:"登录失败"};
//调用登陆
console.log(Iaccount.login);
... ...
... ... @@ -4,6 +4,8 @@ var md5 = require('md5');
var Emitter=require('events');
/*重写控制器*/
var _ = require('lodash');
var fs=require('fs');
var config = JSON.parse(fs.readFileSync('./package.json').toString());
var toString= Object.prototype.toString;
... ... @@ -135,8 +137,16 @@ Controller.prototype.client=function(res,views,model,clientmodel){
model={};
}
ViewModel="<script>var ViewModel="+JSON.stringify(model)+";</script>";
var script=['<script type="text/javascript" src="/static/'+clientmodel+'/libs.js"></script>',
'<script type="text/javascript" src="/static/'+clientmodel+'/'+ views+'.js"></script>'];
var src="";
if(process.env.NODE_ENV==="production"){
src="http://cdn.yoho.cn/yohobuy-shops-fe/"+config.version;
html.replace(/\/static\/index\.min\.css/g,function($1){
return src+$1;
})
}
var script=['<script type="text/javascript" src="'+src+'/static/'+clientmodel+'/libs.js"></script>',
'<script type="text/javascript" src="'+src+'/static/'+clientmodel+'/'+ views+'.js"></script>'];
res.send(html+ViewModel+script.join(''));
}
}
... ...