index.html
6.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<!--
* @Description:
* @Date: 2021-07-02 13:58:43
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bi报告</title>
<style>
* {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="app">
<xrk-bi use-scale="1" mobile="1" :project-type="projectType" :get-base-info="config.getBaseInfo"
:get-fixed-info="config.getFixedInfo" :get-topic-info="config.getTopicInfo" :get-group-info="config.getGroupInfo">
</xrk-bi>
</div>
</body>
<!--<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.5.0/vue.min.js"></script>-->
<!--<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>-->
<script src="https://cdn.yxvzb.com/WEB/SaaS/bi/0.1.0/static/js/es6-sham.min.js"></script>
<script src="https://cdn.yxvzb.com/WEB/SaaS/bi/0.1.0/static/js/es7-shim.js"></script>
<script src="https://cdn.yxvzb.com/WEB/SaaS/bi/0.1.0/static/js/json3.js"></script>
<script src="https://cdn.yxvzb.com/WEB/SaaS/bi/0.1.0/static/js/polyfill.min.js"></script>
<script src="https://cdn.yxvzb.com/WEB/SaaS/bi/0.1.0/static/js/es5-sham.min.js"></script>
<script src="https://cdn.yxvzb.com/WEB/SaaS/bi/0.1.0/static/js/vue.js"></script>
<script src="https://cdn.yxvzb.com/WEB/SaaS/bi/0.1.0/static/js/qs.js"></script>
<script src="https://cdn.yxvzb.com/WEB/SaaS/bi/0.1.0/static/js/axios.js"></script>
<script src="http://127.0.0.1:8080/dist/bundler.js"></script>
<script>
//加参数
// const query = '?fenpeiIds=9335188&userId=2771&type=person&projectType=20&id=42&url=http://saas-cso-pc-1.jimijiayuan.cn'
const query = '?fenpeiIds=9335188&userId=2771&type=person&projectType=6&id=42&url=http://yapi.jimijiayuan.cn/mock/657'
if (window.location.search!== query){
//对应参数说明:http://bug.yxvzb.com/zentao/task-view-353.html
window.location.search = query
}
/**
* fenpeiIds 分配id 可能有多个
/**
* @desc 输入一个字段名 返回 query 字段名对应的字段值 或者 false
* @param variable
* @return {string|boolean}
*/
var getQueryVariable = function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (pair[0] == variable) {
return pair[1];
}
}
return false;
};
var baseUrl = getQueryVariable('url') + '/rest/cso/saas/';
var service = axios.create({
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
}
});
service.interceptors.request.use(function (config) {
config.data = Qs.stringify(config.data);
return config;
});
// 创建场景BI相关接口
var makeSceneBi = {
baseInfo: function baseInfo(data) {
return service.post(''.concat(baseUrl,'/bi/person/base/info'),data);
},
fixedInfo: function fixedInfo(data) {
return service.post(''.concat(baseUrl,'/bi/data/fixed/info'),data);
},
topicInfo: function topicInfo(data) {
return service.post(''.concat(baseUrl,'/bi/data/topic/info'),data);
},
groupInfo: function groupInfo(data) {
return service.post(''.concat(baseUrl,'/bi/data/group/info'),data);
}
};
// 线上推广
var hgtgBi = {
baseInfo: function baseInfo(data) {
return service.post(
''.concat(baseUrl,'bi/person/base/info'),
data
);
},
fixedInfo: function fixedInfo(data) {
return service.post(
''.concat(baseUrl,'/bi/hgtgData/getStyleConfigureFixed'),
data
);
},
topicInfo: function topicInfo(data) {
return service.post(
''.concat(baseUrl,'/bi/hgtgData/getStyleConfigureHgtg'),
data
);
},
groupInfo: function groupInfo(data) {
return service.post(
''.concat(baseUrl,'/bi/hgtgData/ListsingleContent'),
data
);
}
};
</script>
<script>
'use strict';
function _defineProperty(obj,key,value) {
if (key in obj) {
Object.defineProperty(obj,key,{
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
new Vue({
el: '#app',
components: _defineProperty({},Xrk.Bi.name,Xrk.Bi),
data: function data() {
return {
s: Xrk.Bi.name,
projectType: 0
};
},
computed: {
config: function config() {
var _this = this;
var makeSceneAndSurvey = {
getBaseInfo: function getBaseInfo(data) {
return _this.addAuthToAjax(makeSceneBi.baseInfo,data)();
},
getFixedInfo: function getFixedInfo(data) {
return _this.addAuthToAjax(makeSceneBi.fixedInfo,data)();
},
getTopicInfo: function getTopicInfo(data) {
return _this.addAuthToAjax(makeSceneBi.topicInfo,data)();
},
getGroupInfo: function getGroupInfo(data) {
return _this.addAuthToAjax(makeSceneBi.groupInfo,data)();
}
};
return {
20: makeSceneAndSurvey,
5: makeSceneAndSurvey,
7: makeSceneAndSurvey,
6: {
getBaseInfo: function getBaseInfo(data) {
return _this.addAuthToAjax(hgtgBi.baseInfo,data)();
},
getFixedInfo: function getFixedInfo(data) {
return _this.addAuthToAjax(hgtgBi.fixedInfo,data)();
},
getTopicInfo: function getTopicInfo(data) {
return _this.addAuthToAjax(hgtgBi.topicInfo,data)();
},
getGroupInfo: function getGroupInfo(data) {
return _this.addAuthToAjax(hgtgBi.groupInfo,data)();
}
}
}[this.projectType];
}
},
methods: {
getTemplateList: function getTemplateList(data) {
console.log('makeSceneBi.templateList')
console.log(makeSceneBi.templateList)
return this.addAuthToAjax(makeSceneBi.templateList,data)();
},
/**
* @desc 添加入参 id ,biInfoId
* @param ajax service.post(''.concat(baseUrl, '/bi/data/base/info'), data);
* @param data 请求参数
* @return {*}
*/
addAuthToAjax: function addAuthToAjax(ajax,data) {
var id = getQueryVariable('id');
var _data = JSON.parse(JSON.stringify(data || {}));
_data['id'] = id;
_data['biInfoId'] = id;
_data['auth'] = '94A08DA1FECBB6E8B46990538C7B50B2';
return ajax.bind(null,_data);
}
},
created: function created() {
this.projectType = getQueryVariable('projectType');
this.id = getQueryVariable('id');
}
});
</script>
</html>