Authored by 陈轩

save

... ... @@ -14,13 +14,13 @@ const component = {
index: (req, res, next) => {
var testData = {
isLogin: false,
head_ico: "",
profile_name: "XXX",
signinUrl: "/home",
head_ico: '',
profile_name: 'XXX',
signinUrl: '/home',
wait_pay_num: 1,
wait_cargo_num: 2,
send_cargo_num: 3
}
};
res.render('index', _.merge({
module: 'home',
page: 'index'
... ... @@ -28,4 +28,4 @@ const component = {
}
};
module.exports = component;
\ No newline at end of file
module.exports = component;
... ...
... ... @@ -30,4 +30,4 @@ app.engine('.hbs', hbs({
// router
app.use(require('./router'));
module.exports = app;
\ No newline at end of file
module.exports = app;
... ...
... ... @@ -13,4 +13,4 @@ const home = require(cRoot);
// Your controller here
router.get('/', home.index); // 个人中心主页
module.exports = router;
\ No newline at end of file
module.exports = router;
... ...
... ... @@ -14,7 +14,7 @@ Vue.filter('resize', (value, width, height, model)=>{
const dict = {
'{width}': width,
'{height}': height,
'{model}': model || 2
'{mode}': model || 2
};
return dict[$0];
... ...
console.log("test");
\ No newline at end of file
console.log('test');
... ...
... ... @@ -2,6 +2,8 @@ const Vue = require('yoho-vue');
const Sort = require('component/sort.vue');
const List = require('component/list.vue');
require('common/vue-filter');
new Vue({
el: '#product-list',
components: {
... ...
<template>
<div class="goods-box">
<ul class="cardlist card-large">
<li class="card" v-for="item in items">
<li class="card" v-for="item in products">
<div class="card-pic">
<a href="">
<img :src="item.img" alt="{{item.name}}">
<img :src="item.goodsList[0].imagesUrl | resize 372 499" alt="{{item.productName}}">
</a>
</div>
<div class="card-bd">
<h2 class="card-label">
<a href="">{{item.label}}</a>
<a href="">{{item.productName}}</a>
</h2>
<span class="good-price" :class="{'old-price': item.market_price}" v-if="item.market_price">¥ {{item.market_price}}</span>
<span class="good-price" :class="{'sale-price': item.market_price}">¥ {{item.sale_price}}</span>
<span class="good-price" :class="{'old-price': item.marketPrice}" v-if="item.marketPrice">¥ {{item.marketPrice}}</span>
<span class="good-price" :class="{'sale-price': item.marketPrice}">¥ {{item.salesPrice}}</span>
</div>
</li>
</ul>
... ... @@ -23,38 +23,39 @@ let $ = require('yoho-jquery');
module.exports = {
props: {
//请求 地址
/* 请求地址 */
url: {
type: String,
required: true
},
//请求参数
query: Object
query: Object /* 请求参数 */
},
data: function() {
return {
items: []
}
products: []
};
},
methods: {
fetch: function() {
let self = this;
$.ajax({
url: this.url,
type: 'POST',
})
.then(data=>{
console.log(data)
})
.then(result => {
self.$set('products', self.products.concat(result.data.productList));
});
}
},
ready: function() {
this.fetch()
this.fetch();
},
}
};
</script>
<style>
@import '../../scss/common/color';
@import "../../scss/common/color";
.cardlist {
list-style: none;
margin: 0;
... ... @@ -69,7 +70,6 @@ module.exports = {
&:nth-child(2n) {
margin-right: 0;
}
;
}
.card-pic {
width: 100%;
... ... @@ -90,7 +90,7 @@ module.exports = {
font-size: 24px;
}
.card-label {
margin: 0 0 10px 0;
margin: 0 0 10px;
font-size: inherit;
font-weight: normal;
}
... ...