Authored by baoss

个人中心页优化并增加跳转

1 <template> 1 <template>
2 <div class="orders"> 2 <div class="orders">
3 - <div v-for="(value, key) in getOrderNums" :key="key" class="order-cell"> 3 + <div v-for="(value, key) in getOrderNums" :key="key" @click="goPage(value.page)" class="order-cell">
4 <p class="order-num">{{value.num}}</p> 4 <p class="order-num">{{value.num}}</p>
5 <p class="order-text">{{value.name}}</p> 5 <p class="order-text">{{value.name}}</p>
6 </div> 6 </div>
@@ -29,7 +29,15 @@ export default { @@ -29,7 +29,15 @@ export default {
29 29
30 }, 30 },
31 methods: { 31 methods: {
32 - ...mapActions([]), 32 + goPage({name, status}) {
  33 + this.$router.push({
  34 + name,
  35 + params: {
  36 + owner: 'buy',
  37 + status
  38 + }
  39 + })
  40 + }
33 } 41 }
34 42
35 }; 43 };
1 <template> 1 <template>
2 - <div class="tab-item" :class="itemClass"> 2 + <div class="tab-item" :class="itemClass" @click="goPage(data.page)">
3 <div class="title" :class="titleClass">{{data.title}}</div> 3 <div class="title" :class="titleClass">{{data.title}}</div>
4 <slot><div class="text">{{data.num}}</div></slot> 4 <slot><div class="text">{{data.num}}</div></slot>
5 <i class="cubeic-arrow"></i> 5 <i class="cubeic-arrow"></i>
@@ -63,7 +63,12 @@ export default { @@ -63,7 +63,12 @@ export default {
63 63
64 }, 64 },
65 methods: { 65 methods: {
66 - ...mapActions([]), 66 + goPage(pagename) {
  67 + if(!pagename) {
  68 + return
  69 + }
  70 + this.$router.push({ name: pagename})
  71 + }
67 } 72 }
68 73
69 }; 74 };
1 <template> 1 <template>
2 <LayoutApp :show-back="true"> 2 <LayoutApp :show-back="true">
3 <div class="body" ref="body"> 3 <div class="body" ref="body">
4 - <template v-for="(value, key) in getMineList">  
5 - <tab-item :key="key" v-if="key === 'board'" :data="value" noLine titleBold titleSmall small grey> 4 + <div v-for="(value, key) in getMineList" :key="key">
  5 + <tab-item v-if="key === 'board'" :data="value" noLine titleBold titleSmall small grey>
6 <scroll></scroll> 6 <scroll></scroll>
7 </tab-item> 7 </tab-item>
8 <template v-else-if="key === 'resource1' || key === 'resource2'"> 8 <template v-else-if="key === 'resource1' || key === 'resource2'">
9 - <div :key="key" v-if="value.data.template_name ==='single_image'"> 9 + <div v-if="value.data.template_name ==='single_image'">
10 <singleImage :data="value.data.data[0]"></singleImage> 10 <singleImage :data="value.data.data[0]"></singleImage>
11 </div> 11 </div>
12 </template> 12 </template>
13 13
14 - <order :key="key" v-else-if="key === 'order'"></order>  
15 - <tab-item :key="key" v-else-if="key === 'sale'" :data="value" noLine titleBold></tab-item>  
16 - <tab-item :key="key" v-else :data="value"></tab-item>  
17 - </template> 14 + <order v-else-if="key === 'order'"></order>
  15 + <tab-item v-else-if="key === 'sale'" :data="value" noLine titleBold></tab-item>
  16 + <tab-item v-else :data="value"></tab-item>
  17 + </div>
18 </div> 18 </div>
19 </LayoutApp> 19 </LayoutApp>
20 </template> 20 </template>
1 export default [{ 1 export default [{
2 name: 'tradeIncome', 2 name: 'tradeIncome',
3 - path: '/xianyu/home/mine/tradeIncome', 3 + path: '/xianyu/home/mine/tradeIncome.html',
4 component: () => import(/* webpackChunkName: "mine" */ './tradeIncome') 4 component: () => import(/* webpackChunkName: "mine" */ './tradeIncome')
5 }]; 5 }];
@@ -37,24 +37,24 @@ export default function() { @@ -37,24 +37,24 @@ export default function() {
37 getters: { 37 getters: {
38 getOrderNums(state) { 38 getOrderNums(state) {
39 let orderSum = { 39 let orderSum = {
40 - ready: {name: '待发货', num: state.readyNum},  
41 - sent: {name: '已发货', num: state.sentNum},  
42 - finish: {name: '交易成功', num: state.finishNum},  
43 - fail: {name: '交易失败', num: state.failNum} 40 + ready: {name: '待发货', num: state.readyNum, page: {name: 'OrderList', status: 0} },
  41 + sent: {name: '已发货', num: state.sentNum, page: {name: 'OrderList', status: 1}},
  42 + finish: {name: '交易成功', num: state.finishNum, page: {name: 'OrderList', status: 2}},
  43 + fail: {name: '交易失败', num: state.failNum, page: {name: 'OrderList', status: 3}}
44 }; 44 };
45 45
46 return orderSum; 46 return orderSum;
47 }, 47 },
48 getMineList(state) { 48 getMineList(state) {
49 let tabList = { 49 let tabList = {
50 - board: { title: '公告栏'},  
51 - sale: { title: '出售中', num: state.sellerNum}, 50 + board: { title: '公告栏', page: 'noticeList'},
  51 + sale: { title: '出售中', num: state.sellerNum, page: ''},
52 order: {name: 'order'}, 52 order: {name: 'order'},
53 resource1: {name: 'resource1', data: state.resource1}, 53 resource1: {name: 'resource1', data: state.resource1},
54 - income: {title: '交易收入', num: state.assetData.totalIncome},  
55 - buyOrder: {title: '我购买的订单', num: state.buyNum},  
56 - buy: {name: 'buy', title: '我的求购', num: state.askBuyNum},  
57 - collect: {name: 'collect', title: '我的收藏', num: state.favoriteNum}, 54 + income: {title: '交易收入', num: state.assetData.totalIncome, page: 'tradeIncome'},
  55 + buyOrder: {title: '我购买的订单', num: state.buyNum, page: ''},
  56 + buy: {name: 'buy', title: '我的求购', num: state.askBuyNum, page: ''},
  57 + collect: {name: 'collect', title: '我的收藏', num: state.favoriteNum, page: 'favorite'},
58 resource2: {name: 'resource2', data: state.resource2} 58 resource2: {name: 'resource2', data: state.resource2}
59 }; 59 };
60 60