Authored by 陈峰

兼容ie

import Vue from 'vue';
import Router from 'vue-router';
import Promise from 'promise-polyfill';
import App from './pages/app';
import Routers from './pages';
import yohoPluginCore from './plugins/yoho-plugin-core';
... ... @@ -8,9 +9,20 @@ import './filters';
import './directives';
import 'iview/dist/styles/iview.css';
import 'font-awesome/css/font-awesome.css';
import Promise from 'promise-polyfill';
// To add to window
// 兼容IE的Function没有name属性为题,为了修复iView的bug
if (!(function f() {}).name) {
Object.defineProperty(Function.prototype, 'name', { //eslint-disable-line
get: function() {
let name = (this.toString().match(/^function\s*([^\s(]+)/) || [])[1];
Object.defineProperty(this, 'name', { value: name });
return name;
}
});
}
// 使用了webpack code spliting IE下需要promise ployfill
if (!window.Promise) {
window.Promise = Promise;
}
... ...
... ... @@ -10,6 +10,8 @@ import Rsa from './rsa';
const plugin = {
updateUser(Vue, user, purviews) {
console.log(user)
// Vue.$cookie.set('shopsId', user)
Vue.$store.set(config.storeKeys.user, Rsa.encrypt(user));
Vue.prop('user', user);
Vue.prop('isLogin', true);
... ...
... ... @@ -30,6 +30,7 @@
"iview": "^2.0.0-rc.12",
"lodash": "^4.17.4",
"moment": "^2.18.1",
"promise-polyfill": "^6.0.2",
"request": "^2.81.0",
"request-promise": "^4.2.0",
"serve-favicon": "^2.4.2",
... ...
... ... @@ -3,8 +3,8 @@ const _ = require('lodash');
// api调用列表
let domainApis = {
erp: {
login: '/erp-gateway-web/account/profile/login',
getPurview: '/erp-gateway-web/account/menu/query_by_pid'
login: '/erp-shop-web/account/profile/login',
getPurview: '/erp-shop-web/account/menu/query_by_pid'
},
platform: {
queryShopsByAdminPid: '/SellerShopController/queryShopsByAdminPid',
... ... @@ -36,7 +36,7 @@ let domainApis = {
// 域名列表
const domains = {
erp: 'http://192.168.13.249',
erp: 'http://192.168.103.82:9098',
platform: 'http://192.168.102.210:8088/platform',
shop: 'http://192.168.102.211:30016'
};
... ...
... ... @@ -66,6 +66,7 @@ class Api extends Context {
options = Object.assign(options, {
resolveWithFullResponse: true
});
console.log(options)
return rp[options.method || 'get'](options).then(response => {
let jsonBody = JSON.parse(response.body);
let req = response.request;
... ...