Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-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
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
htoooth
6 years ago
Commit
07208e4fdb9e6f8dcbba8a92f42b476c95054e6d
2 parents
34c8f3d4
f929e397
Merge remote-tracking branch 'origin/feature/ufo' into feature/ufo
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
15 deletions
apps/common/create-api-server.js
apps/components/img-size.vue
apps/entry-client.js
apps/entry-server.js
config/common.js
apps/common/create-api-server.js
View file @
07208e4
...
...
@@ -7,7 +7,7 @@ const apiMaps = require('../../config/api-map');
const
checkApiMap
=
url
=>
{
return
apiMaps
[
url
]
?
apiMaps
[
url
]
:
void
0
;
};
const
request
=
async
({
url
,
method
,
reqParams
,
context
})
=>
{
const
request
=
async
({
url
,
method
,
reqParams
=
{}
,
context
})
=>
{
const
apiInfo
=
checkApiMap
(
url
);
const
{
env
,
user
}
=
context
;
...
...
@@ -26,7 +26,6 @@ const request = async({url, method, reqParams, context}) => {
method
:
apiInfo
.
api
,
});
}
const
params
=
checkParams
.
getParams
(
reqParams
,
apiInfo
);
const
cache
=
method
.
toLowerCase
()
!==
'get'
?
false
:
apiInfo
.
cache
;
const
headers
=
{
...
...
apps/components/img-size.vue
View file @
07208e4
<template>
<img
:src
="currentSrc" :alt="alt">
<img
v-lazy
="currentSrc" :alt="alt">
</template>
<script>
...
...
@@ -17,8 +17,13 @@ export default {
.replace('{width}', this.width)
.replace('{height}', this.height);
}
},
methods: {
onError() {
this.$el.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
}
}
}
}
;
</script>
<style>
...
...
apps/entry-client.js
View file @
07208e4
...
...
@@ -5,6 +5,7 @@ import {
}
from
'store/yoho/types'
;
import
{
createApp
}
from
'./app'
;
import
{
createApi
}
from
'create-api'
;
import
Lazy
from
'vue-lazyload'
;
import
'statics/scss/common.scss'
;
import
'statics/font/iconfont.css'
;
import
'statics/font/ufofont.css'
;
...
...
@@ -17,6 +18,7 @@ if (window.__INITIAL_STATE__) {
// Vue.prop('yoho', yoho);
Vue
.
prop
(
'api'
,
createApi
());
Vue
.
use
(
Lazy
);
router
.
onReady
(()
=>
{
router
.
beforeResolve
((
to
,
from
,
next
)
=>
{
...
...
apps/entry-server.js
View file @
07208e4
...
...
@@ -7,8 +7,8 @@ import {
const
sender
=
global
.
yoho
.
apmSender
;
const
logger
=
global
.
yoho
.
logger
;
const
catchError
=
(
err
,
context
)
=>
{
logger
.
error
(
err
);
const
catchError
=
(
err
,
message
,
context
)
=>
{
logger
.
error
(
message
,
err
);
setImmediate
(()
=>
{
try
{
sender
.
addMessage
({
...
...
@@ -48,7 +48,7 @@ export default context => {
const
matched
=
router
.
getMatchedComponents
();
if
(
matched
.
some
(
m
=>
!
m
))
{
catchError
(
new
Error
(
'导航组件为空'
),
context
);
catchError
(
new
Error
(
'导航组件为空'
),
'[router.onReady]'
,
context
);
router
.
push
({
name
:
'error.500'
});
return
resolve
(
app
);
}
...
...
@@ -62,13 +62,13 @@ export default context => {
context
.
state
=
store
.
state
;
return
resolve
(
app
);
}).
catch
(
e
=>
{
catchError
(
e
,
context
);
catchError
(
e
,
'[asyncData]'
,
context
);
return
resolve
(
app
);
});
});
router
.
onError
(
e
=>
{
catchError
(
e
,
context
);
catchError
(
e
,
'router.onError'
,
context
);
router
.
push
({
name
:
'error.500'
});
return
resolve
(
app
);
});
...
...
config/common.js
View file @
07208e4
...
...
@@ -11,9 +11,9 @@ const isTest = process.env.NODE_ENV === 'test3';
const
domains
=
{
api
:
'http://api.yoho.cn/'
,
service
:
'http://service.yoho.cn/'
,
ufo
:
'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/'
,
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// ufo: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/',
...
...
@@ -24,9 +24,9 @@ const domains = {
// platformApi: 'http://172.16.6.210:8088/',
// api: 'http://api-test3.dev.yohocorp.com/',
// service: 'http://api-test3.dev.yohocorp.com/',
// ufo: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/',
api
:
'http://api-test3.dev.yohocorp.com/'
,
service
:
'http://api-test3.dev.yohocorp.com/'
,
ufo
:
'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/'
,
};
module
.
exports
=
{
...
...
Please
register
or
login
to post a comment