Authored by 郭成尧

'添加一些数据校验'

@@ -23,7 +23,7 @@ const model = { @@ -23,7 +23,7 @@ const model = {
23 const content = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getArticleContent', params); 23 const content = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getArticleContent', params);
24 const brands = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getBrand', params); 24 const brands = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getBrand', params);
25 const other = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getOtherArticle', Object.assign({ 25 const other = yield serviceAPI.get(URI_PACKAGE_ARTICLE + 'getOtherArticle', Object.assign({
26 - tags: article.data.tag, 26 + tags: article.data ? article.data.tag : {},
27 offset: 0, 27 offset: 0,
28 limit: 3 28 limit: 3
29 }, params)); 29 }, params));
@@ -60,11 +60,11 @@ @@ -60,11 +60,11 @@
60 }, (results)=> { 60 }, (results)=> {
61 const result = results[0], misc = results[1]; 61 const result = results[0], misc = results[1];
62 62
63 - if (result.code === 200) { 63 + if (result && result.code === 200) {
64 this.likeCount = result.data; 64 this.likeCount = result.data;
65 } 65 }
66 66
67 - if (misc.code === 200) { 67 + if (misc && misc.code === 200) {
68 this.isLiked = misc.data.isPraise === 'Y'; 68 this.isLiked = misc.data.isPraise === 'Y';
69 } 69 }
70 }); 70 });
@@ -75,9 +75,9 @@ @@ -75,9 +75,9 @@
75 }, (results)=> { 75 }, (results)=> {
76 const result = results[0], misc = results[1]; 76 const result = results[0], misc = results[1];
77 77
78 - if (result.code === 200) { 78 + if (result && result.code === 200) {
79 // TODO: 79 // TODO:
80 - } if (result.code === 403) { 80 + } if (result && result.code === 403) {
81 // 未登录 81 // 未登录
82 yoho.goLogin('', function() { 82 yoho.goLogin('', function() {
83 this.toggleFavorite(); 83 this.toggleFavorite();
@@ -86,7 +86,7 @@ @@ -86,7 +86,7 @@
86 }); 86 });
87 } 87 }
88 88
89 - if (misc.code === 200) { 89 + if (misc && misc.code === 200) {
90 this.isFavorite = misc.data.isFavor === 'Y'; 90 this.isFavorite = misc.data.isFavor === 'Y';
91 } 91 }
92 }); 92 });
@@ -109,7 +109,7 @@ @@ -109,7 +109,7 @@
109 }, 109 },
110 created() { 110 created() {
111 $.get(`/editorial/misc_${this.id}.json`).then(result => { 111 $.get(`/editorial/misc_${this.id}.json`).then(result => {
112 - if (result.code === 200) { 112 + if (result && result.code === 200) {
113 this.isFavorite = result.data.isFavor === 'Y'; 113 this.isFavorite = result.data.isFavor === 'Y';
114 this.isLiked = result.data.isPraise === 'Y'; 114 this.isLiked = result.data.isPraise === 'Y';
115 } 115 }