Authored by baoss

优化资源位展示,我的增加绑定入口

@@ -55,7 +55,15 @@ export default { @@ -55,7 +55,15 @@ export default {
55 confirm() { 55 confirm() {
56 this.bindAliPayAccount({account: this.account, name: this.name}).then((data) => { 56 this.bindAliPayAccount({account: this.account, name: this.name}).then((data) => {
57 this.dialogShow = false; 57 this.dialogShow = false;
58 - this.$router.back() 58 + if (data.code === 200) {
  59 + this.$router.back()
  60 + } else {
  61 + this.$createToast({
  62 + txt: data.message,
  63 + time: 1500,
  64 + type: 'txt'
  65 + }).show();
  66 + }
59 }) 67 })
60 }, 68 },
61 69
@@ -11,7 +11,10 @@ const {mapState, mapActions} = createNamespacedHelpers('home/bindAccount'); @@ -11,7 +11,10 @@ const {mapState, mapActions} = createNamespacedHelpers('home/bindAccount');
11 export default { 11 export default {
12 name: 'bind', 12 name: 'bind',
13 props: { 13 props: {
14 - 14 + data: {
  15 + type: Object,
  16 + default: {}
  17 + }
15 }, 18 },
16 data() { 19 data() {
17 return { 20 return {
@@ -28,7 +31,7 @@ export default { @@ -28,7 +31,7 @@ export default {
28 methods: { 31 methods: {
29 ...mapActions(['fetchUserAliPayAccount']), 32 ...mapActions(['fetchUserAliPayAccount']),
30 goBind() { 33 goBind() {
31 - this.$router.push({name:'bindAccount'}) 34 + this.$router.push({name:this.data.page})
32 } 35 }
33 } 36 }
34 37
1 <template> 1 <template>
2 <div class="single-image"> 2 <div class="single-image">
3 - <LayoutLink :href="data.url" class="link"> 3 + <LayoutLink :href="data.url" class="link" v-if="data.src">
4 <img :src="data.src" :alt="data.title" class="img" :style="style"> 4 <img :src="data.src" :alt="data.title" class="img" :style="style">
5 </LayoutLink> 5 </LayoutLink>
6 </div> 6 </div>
@@ -16,9 +16,10 @@ @@ -16,9 +16,10 @@
16 <div v-else-if="key === 'sale'" class="bg-top"> 16 <div v-else-if="key === 'sale'" class="bg-top">
17 <tab-item :data="value" noLine titleBold titleSmall></tab-item> 17 <tab-item :data="value" noLine titleBold titleSmall></tab-item>
18 </div> 18 </div>
  19 + <bind v-else-if="key === 'bindAccount'" :data="value"></bind>
19 <tab-item v-else :data="value"></tab-item> 20 <tab-item v-else :data="value"></tab-item>
20 </div> 21 </div>
21 - <bind></bind> 22 +
22 </div> 23 </div>
23 </LayoutApp> 24 </LayoutApp>
24 </template> 25 </template>
@@ -35,11 +35,8 @@ export default function() { @@ -35,11 +35,8 @@ export default function() {
35 certName: name 35 certName: name
36 }); 36 });
37 37
38 - if (result.code === 200) {  
39 - // commit('addUserAliPayAccount', result.data);  
40 - return result;  
41 - }  
42 - 38 + // commit('addUserAliPayAccount', result.data);
  39 + return result;
43 }, 40 },
44 }, 41 },
45 }; 42 };
@@ -102,6 +102,7 @@ export default function() { @@ -102,6 +102,7 @@ export default function() {
102 resource1: { name: 'resource1', data: state.resource1 }, 102 resource1: { name: 'resource1', data: state.resource1 },
103 income: { 103 income: {
104 title: '我的收入', 104 title: '我的收入',
  105 +
105 // num: state.userWalletInfo.walletAmount, // 钱包余额 106 // num: state.userWalletInfo.walletAmount, // 钱包余额
106 num: state.assetData.totalIncome, 107 num: state.assetData.totalIncome,
107 page: 'tradeIncome', 108 page: 'tradeIncome',
@@ -135,6 +136,10 @@ export default function() { @@ -135,6 +136,10 @@ export default function() {
135 title: '我的客服', 136 title: '我的客服',
136 page: 'service' 137 page: 'service'
137 }, 138 },
  139 + bindAccount: {
  140 + name: 'bindAccount',
  141 + page: 'bindAccount'
  142 + },
138 resource2: { name: 'resource2', data: state.resource2 }, 143 resource2: { name: 'resource2', data: state.resource2 },
139 144
140 }; 145 };
@@ -312,24 +317,31 @@ export default function() { @@ -312,24 +317,31 @@ export default function() {
312 }); 317 });
313 318
314 if (result.code === 200) { 319 if (result.code === 200) {
315 - let src = getImgUrl(  
316 - get(result, 'data[0].data[0].src') || '',  
317 - 1000,  
318 - 240,  
319 - );  
320 -  
321 - set(result, 'data[0].data[0].src', src);  
322 - commit('addResource', { resource1: result.data[0] }); 320 + if (result.data.length !== 0) {
  321 + let src = getImgUrl(
  322 + get(result, 'data[0].data[0].src') || '',
  323 + 1000,
  324 + 240,
  325 + );
  326 +
  327 + set(result, 'data[0].data[0].src', src);
  328 + commit('addResource', {
  329 + resource1: result.data[0]
  330 + });
  331 + }
  332 +
323 } 333 }
324 if (result1.code === 200) { 334 if (result1.code === 200) {
325 - let src = getImgUrl(  
326 - get(result1, 'data[0].data[0].src') || '',  
327 - 1000,  
328 - 240,  
329 - );  
330 -  
331 - set(result1, 'data[0].data[0].src', src);  
332 - commit('addResource', { resource2: result1.data[0] }); 335 + if (result.data.length !== 0) {
  336 + let src = getImgUrl(
  337 + get(result1, 'data[0].data[0].src') || '',
  338 + 1000,
  339 + 240,
  340 + );
  341 +
  342 + set(result1, 'data[0].data[0].src', src);
  343 + commit('addResource', { resource2: result1.data[0] });
  344 + }
333 } 345 }
334 }, 346 },
335 async fetchSellerOrder({ commit }) { 347 async fetchSellerOrder({ commit }) {
@@ -382,7 +394,7 @@ export default function() { @@ -382,7 +394,7 @@ export default function() {
382 let page = isRefresh ? 1 : currentPage + 1; 394 let page = isRefresh ? 1 : currentPage + 1;
383 const result = await this.$api.get('/api/ufo/mine/assets', { 395 const result = await this.$api.get('/api/ufo/mine/assets', {
384 page, 396 page,
385 - limit: pageSize 397 + limit: pageSize
386 }); 398 });
387 399
388 // commit('assetFetching', {isFetching: false}); 400 // commit('assetFetching', {isFetching: false});