提交 fb12c19f 作者: 潘亚楠

增加标准库

上级 bf5c4b0b
......@@ -45,6 +45,8 @@ module.exports = {
'element-ui': 'ELEMENT',
// 用户操作埋点包
'buriedPoint':'BuriedPoint',
// 标准库
'common': 'QjMethod'
},
module: {
rules: [
......
......@@ -39,6 +39,8 @@
<!-- production -->
<script src="https://webplugin.allhome.com.cn/libs@1.0.0/BuriedPoint.js"></script>
<!-- 用户操作埋点结束 -->
<!-- 标准库 -->
<script src="https://qjsl.allhome.com.cn/index.js"></script>
</head>
<body>
<div id="app"></div>
......
{
"name": "hello_world",
"name": "QJ_vue_project",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "panyanan <panda_peter@126.com>",
"description": "A QJ vue project",
"author": "qj <qj@allhome.com.cn>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
......
import request from '@/assets/js/axios.js';
const apiList = [
// 正常响应
// {
// url: '/dev/rightServer',
// method: 'post',
// defaultData: {
// a: 1
// },
// name: "rightServerPost"
// },
// 异常响应
{
url: '/user',
method: 'get',
name: 'getUserById'
},
// 查询用户交互日志
// {
// url: '/dev/logLine',
// method: 'get',
// name: 'getLogline',
// }
]
const namespace = 'userApi';
request.add(namespace, apiList);
......
import { Request } from 'buriedPoint';
import token from './controlToken'
const baseURL = {
'development': ' http://mock.allhome.com.cn/mock/5df2ec78d72c6e32062ac4b6/cli',
'lan': ' http://mock.allhome.com.cn/mock/5df2ec78d72c6e32062ac4b6/cli',
......@@ -13,7 +14,7 @@ const request = new Request({
request.interceptors({
// 请求拦截
request: config => {
config.headers.token = window.token;
config.headers.token = token;
return config
},
// 响应拦截
......
import { ControlToken } from 'common';
const controlToken = new ControlToken();
if (!controlToken.getToken()) {
const token = {
'development':
'I16S21xSj+i0vHo0fD/1I+35R4WWbFs6sCtqS9ZhkTWDyu3zSWL91Qsv9y6WOy/LN4rLzTGHu6EsN5ygle3v4FWh1wxJEO63gVhql6b+52XO5FC8JB94oI7RiafOg44nw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JI4h4RbMNZ23vBihcf0f6DwDYMJCpI9pLyzYMWiENFV7QuNO5uv5c2RyuumzAUdn0qQnCmlp0lIhjeg/yXmGKlc0VElOsw+xsqEty7quhpqFVKgqrJll2fExY/6WQqgLBdbLNeyNgbgjnIrrq80OGtm97qEswMxaiWWbKfWDY/w==',
}[process.env.NODE_ENV]
controlToken.setToken("globalToken", token);
}
export default controlToken.getToken();
import { ProxyIframe } from "common";
const globalPath = new Map([
['development', {
domain: "qj.com",
portal: "http://wrp.qj.com"
}],
['lan', {
domain: "qj.com",
portal: "http://wrp.qj.com"
}],
['pred', {
domain: "allhome.com.cn",
portal: "https://dmis.allhome.com.cn"
}],
['production', {
domain: "allhome.com.cn",
portal: "https://mis.allhome.com.cn"
}]
]);
const env = process.env.NODE_ENV;
const proxyIframe = new ProxyIframe({env,type:"child"});
try {
proxyIframe.solve(globalPath);
} catch (error) {
}
proxyIframe.run("token",
() => parent.window.globalToken,
val => parent.window.globalToken = val);
......@@ -13,14 +13,18 @@ import '../src/assets/icon/iconfont.css'
import buriedPoint from 'buriedPoint';
// 引入样式
import './style/index.scss';
import App from './App'
// 引入iframe代理
import './assets/js/iframeProxy';
// 引入token设置
import './assets/js/controlToken';
// 引入icon
import './assets/icon/iconfont'
// 根组件
import App from './App'
Vue.use(buriedPoint);
Vue.use(ElementUI);
Vue.config.productionTip = false;
// token 放这里避免埋点包初始化无法获取token
window.token || (window.token = 'I16S21xSj+i0vHo0fD/1I+35R4WWbFs6sCtqS9ZhkTWDyu3zSWL91Qsv9y6WOy/LN4rLzTGHu6EsN5ygle3v4FWh1wxJEO63gVhql6b+52XO5FC8JB94oI7RiafOg44nwVSM6c+5teiCNqbtYPhOl1Cg5ruesyl1KebWXINJHuAJI4h4RbMNZ23vBihcf0f6DwDYMJCpI9pLyzYMWiENFV7QuNO5uv5c2RyuumzAUdn0qQnCmlp0lIhjeg/yXmGKlc0VElOsw+xsqEty7quhpqFVKgqrJll2fExY/6WQqgLBdbLNeyNgbgjnIrrq80OGtm97qEswMxaiWWbKfWDY/w==');
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论