Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
xianyu-ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
1
Download as
Email Patches
Plain Diff
Browse Files
Authored by
TaoHuang
5 years ago
Commit
70bf212482b0a98058f2623032b185ad23a35a11
1 parent
371b8632
fix api error
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
23 deletions
apps/common/create-api-server.js
apps/pages/home/indexPage/components/tabs.vue
apps/pages/home/indexPage/index-page.vue
doraemon/middleware/error-handler.js
apps/common/create-api-server.js
View file @
70bf212
...
...
@@ -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
;
...
...
apps/pages/home/indexPage/components/tabs.vue
View file @
70bf212
...
...
@@ -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) {
...
...
apps/pages/home/indexPage/index-page.vue
View file @
70bf212
...
...
@@ -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: {
...
...
doraemon/middleware/error-handler.js
View file @
70bf212
...
...
@@ -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
(
'服务器开小差了~'
);
};
...
...
shuaiguo
@shuaiguo
5 years ago
Owner
mentioned in commit
b7dfd706
Please
register
or
login
to post a comment