Authored by TaoHuang

fix api error

... ... @@ -13,7 +13,7 @@ const checkApiMap = url => {
};
// eslint-disable-next-line space-before-function-paren
const request = async ({ url, method, reqParams = {}, context }) => {
const request = async({ url, method, reqParams = {}, context }) => {
const apiInfo = checkApiMap(url);
const { env, user = {} } = context;
... ...
... ... @@ -11,8 +11,9 @@
<script>
import { createNamespacedHelpers } from 'vuex';
const { mapState, mapActions } = createNamespacedHelpers('home/channel');
import { createNamespacedHelpers, mapState} from 'vuex';
const { mapState: mapChannelState, mapActions } = createNamespacedHelpers('home/channel');
import Widget from './widget';
export default {
... ... @@ -34,16 +35,23 @@ export default {
};
};
},
...mapState(['showMsg'])
...mapChannelState(['showMsg']),
...mapState(['yoho'])
},
activated() {
this.getAllInboxCatInfo();
this.$yoho.getUser().then(user => {
if (user.uid) {
this.getAllInboxCatInfo();
}
});
},
watch: {
'yoho.context.isLogin': function(val) {
if (val) {
this.getAllInboxCatInfo();
}
}
},
// watch: {
// 'showMsg':function(sss) {
// console.log(sss);
// }
// },
methods: {
...mapActions(['getAllInboxCatInfo']),
onClick(index) {
... ...
... ... @@ -24,11 +24,11 @@ export default {
methods: {
onClick(index) {
this.$store.dispatch('reportYas', {
params: {
param: {TAB_ID: index + 1 },
appop: 'XY_UFO_MAIN_TAB'
}
});
params: {
param: { TAB_ID: index + 1 },
appop: 'XY_UFO_MAIN_TAB'
}
});
switch (index) {
case 0: {
this.go('ChannelPage');
... ... @@ -42,20 +42,20 @@ export default {
this.$yoho.auth({
refer: '/xianyu/index/news'
}).then((res) => {
if(res) {
if (res) {
this.go('NewsPage');
}
})
});
break;
}
case 3: {
this.$yoho.auth({
refer: '/xianyu/index/mine'
}).then((res) => {
if(res) {
if (res) {
this.go('MinePage');
}
})
});
break;
}
default: {
... ...
... ... @@ -8,14 +8,13 @@ exports.serverError = (err, req, res, next) => { // eslint-disable-line
logger.error(`error at path: ${req.url}`);
logger.error(`${req.url},${typeof err === 'object' ? JSON.stringify(err) : err}`);
res.status(err.code || 500);
if (req.xhr) {
return res.json({
code: 500,
message: '服务器错误!'
code: err.code || 500,
message: err.message || '服务器错误!'
});
}
res.status(err.code || 500);
return res.send('服务器开小差了~');
};
... ...