Authored by 陈峰

commit

... ... @@ -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 = {
... ...
<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>
... ...
... ... @@ -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) => {
... ...
... ... @@ -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);
});
... ...
... ... @@ -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 = {
... ...