@qywh/package 0.0.3-beta04 → 0.0.3-beta05

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,9 +12,7 @@ import { offset } from '../utils'
12
12
  export function getLinkAllUrlParams (urlParams?: any) {
13
13
  const allUrlParams = { ...getUrlParams(), ...urlParams }
14
14
  const notNeedParams = [
15
- 'CUID', 'iOSVersion', 'token', 'channel', 'isGray', 'zbkvc', 'ykvc', 'vc', 'city', 'province',
16
- 'dayivc', 'cuid', 'pvc', 'appId', 'appid', 'os', 'vcname', 'city', 'screensize', 'physicssize', 'H5WebPageV',
17
- 'deviceW', 'deviceH', 'device', 'flowPond', 'hideNativeTitleBar'
15
+ 'tfExtData'
18
16
  ]
19
17
  Object.keys(allUrlParams).map((key: string) => {
20
18
  if (~notNeedParams.indexOf(key)) {
@@ -81,7 +79,7 @@ export function goodsBuy (this: any, params: any) {
81
79
  console.log('[goodsBuy] triggered, params:', params)
82
80
  }
83
81
 
84
- export function jumpXcxToQuestion (this: any, params: any) {
82
+ export async function jumpXcxToQuestion (this: any, params: any) {
85
83
  const pageData = (window as any).__PAGE_DATA__ || {}
86
84
  const actId = (pageData.actInfo && pageData.actInfo.actId) || ''
87
85
 
@@ -89,42 +87,61 @@ export function jumpXcxToQuestion (this: any, params: any) {
89
87
  actId: actId,
90
88
  pageId: params.wxPage || ''
91
89
  })
90
+ const tfExtData = logParamHandle.getUrlTfExtData() || '{}'
91
+
92
+ const fetchWithRetry = async (url: string, init: RequestInit, retryCount = 0): Promise<any> => {
93
+ try {
94
+ const res = await fetch(url, init)
95
+ return await res.json()
96
+ } catch (err) {
97
+ if (retryCount < 3) return fetchWithRetry(url, init, retryCount + 1)
98
+ throw err
99
+ }
100
+ }
101
+
102
+ let obj: Record<string, any> = {
103
+ product_id: params.goodsId || '',
104
+ qId: params.qId || '',
105
+ }
106
+ try {
107
+ const pvRes = await fetch('/common/pvid', {
108
+ method: 'POST',
109
+ headers: { 'Content-Type': 'application/json' },
110
+ body: JSON.stringify({ successInfo, tf_ext_data: tfExtData })
111
+ }).then(res => res.json())
112
+ const pvId = pvRes?.data?.pvId
113
+ if (pvId) {
114
+ obj.pvId = pvId
115
+ } else {
116
+ throw new Error('pvId为空')
117
+ }
118
+ } catch (err) {
119
+ console.warn('[jumpXcxToQuestion] pvid存储失败,降级为明文传参:', err)
120
+ obj.successInfo = successInfo
121
+ obj.tf_ext_data = tfExtData
122
+ }
92
123
 
93
124
  const postData = {
94
125
  path: 'formCollect/index',
95
126
  productId: params.xcxId || '',
96
- obj: {
97
- product_id: params.goodsId || '',
98
- qId: params.qId || '',
99
- successInfo: successInfo,
100
- tf_ext_data: params.tf_ext_data || '{}'
101
- }
127
+ obj
102
128
  }
103
129
 
104
- const doRequest = (retryCount: number) => {
105
- fetch('/common/authNode/wx/miniapp/generate-link', {
130
+ try {
131
+ const linkRes = await fetchWithRetry('/common/authNode/wx/miniapp/generate-link', {
106
132
  method: 'POST',
107
133
  headers: { 'Content-Type': 'application/json' },
108
134
  body: JSON.stringify(postData)
109
- }).then(res => res.json()).then((res: any) => {
110
- const data = res.data || res
111
- if (data && data.openlink) {
112
- location.href = data.openlink
113
- } else if (retryCount < 3) {
114
- setTimeout(() => doRequest(retryCount + 1), 500)
115
- } else {
116
- console.error('[jumpXcxToQuestion] 生成scheme失败')
117
- }
118
- }).catch(() => {
119
- if (retryCount < 3) {
120
- setTimeout(() => doRequest(retryCount + 1), 500)
121
- } else {
122
- console.error('[jumpXcxToQuestion] 生成scheme失败')
123
- }
124
135
  })
136
+ const data = linkRes?.data || linkRes
137
+ if (data?.openlink) {
138
+ location.href = data.openlink
139
+ } else {
140
+ console.error('[jumpXcxToQuestion] 生成scheme失败')
141
+ }
142
+ } catch (err) {
143
+ console.error('[jumpXcxToQuestion] 生成scheme失败:', err)
125
144
  }
126
-
127
- doRequest(0)
128
145
  }
129
146
 
130
147
  export default {
@@ -64,7 +64,7 @@ export function getQueryofKey (key: string, url?: string) {
64
64
  export function getUrlParams () {
65
65
  let allParams = getQueryString() // 获取当前页面url参数
66
66
  let specialPaymentArr: any = {}
67
- const arr1 = ['lastfrom', 'logpath', 'fr', 'orifrom', 'flowPond']
67
+ const arr1 = ['channelType', 'tfExtData']
68
68
  Object.keys(allParams).map(item => {
69
69
  if (arr1.indexOf(item) === -1) {
70
70
  specialPaymentArr[item] = allParams[item]
@@ -4,166 +4,70 @@ import urlExt from './urlExt';
4
4
  import isPlainObject from 'lodash/isPlainObject';
5
5
  import isEmptyObject from 'lodash/isEmpty';
6
6
  import extend from 'lodash/extend';
7
- import cdnUrl from '../cdnUrl'
8
7
 
9
8
  let currentPageURL = location.href // 用于兼容 vue # 号后边的参数getQuery无法获取的问题
10
- // path处理
11
- let urlLogPath = urlExt.getQuery('logpath', currentPageURL) || '';
12
- // lastFrom 处理
13
- let urlLastFrom = urlExt.getQuery('lastfrom', currentPageURL) || '';
14
- // 微信公众号订单授权免登录透传参数 isWxYike
15
- let urlWxYike = urlExt.getQuery('isWxYike', currentPageURL) || '';
16
- // saleChannelId参数透传
17
- let urlSaleChannelId = urlExt.getQuery('saleChannelId', currentPageURL) || '';
9
+ // channelType 处理
10
+ let urlChannelType = urlExt.getQuery('channelType', currentPageURL) || '';
18
11
 
19
- /* fr参数:表示最初经过的渠道位
20
- fr参数要求一直透传下去,如果遇到新的fr参数,不替换。
21
- 因为端内公共参数里面已经用了fr这个key,所以打点时fr会改成orifrom作为key
22
- */
23
- let urlOriFrom = urlExt.getQuery('orifrom', currentPageURL) || urlExt.getQuery('fr', currentPageURL) || '';
24
- let urlFlowPond = urlExt.getQuery('flowPond', currentPageURL) || ''; // ab侧区分用户
12
+ let urlTfExtData = urlExt.getQuery('tfExtData', currentPageURL) || '';
25
13
 
26
-
27
- function toastText(text) {
28
- //toast提示
29
- let toastTimer;
30
- let yikeLogToast = document.getElementById('yike-log-toast');
31
- if (yikeLogToast) {
32
- if (toastTimer) {
33
- clearTimeout(toastTimer);
34
- }
35
- document.body.removeChild(yikeLogToast);
36
- }
37
- let toastHtml = document.createElement('div');
38
- toastHtml.id = 'yike-log-toast';
39
- toastHtml.innerHTML = `
40
- <div style="position: fixed;width:100%;left:0;top: 200px;text-align: center;">
41
- <p style="background: rgba(0,0,0,.7);color: #fff;border-radius: 100px;display: inline-block; padding: 10px 15px;font-size:14px;">${text}</p>
42
- </div>
43
- `;
44
- document.body?.appendChild(toastHtml);
45
- toastTimer = setTimeout(function() {
46
- document.body.removeChild(toastHtml);
47
- },2000);
48
- }
49
- function setLogPath(data) {
50
- if (data && isPlainObject(data) && !isEmptyObject(data)) { // 如果有data参数,且为一个纯粹的对象,且不是一个空对象
51
- var pageId = data.id || '';
52
- try {
53
- delete data.id;
54
- } catch(e) {
55
- // console.log(e);
56
- }
57
- var logPath = getPath(urlLogPath, pageId, data);
58
- urlLogPath = logPath
59
- }
60
- }
61
- function getLogPath() {
62
- return urlLogPath
14
+ function getChannelType() {
15
+ return urlChannelType
63
16
  }
64
17
 
65
- function setLastfrom(lastfrom) {
66
- urlLastFrom = lastfrom
67
- }
68
- function getLastfrom() {
69
- return urlLastFrom
70
- }
71
-
72
- function getOriFrom() {
73
- return urlOriFrom;
74
- }
75
- function setOriFrom(fr) {
76
- urlOriFrom = fr
77
- }
78
- function setFlowPond(flowPond) {
79
- if (isPlainObject(flowPond) && !isEmptyObject(flowPond)) {
18
+ function setTfExtData(tfExtData) {
19
+ if (isPlainObject(tfExtData) && !isEmptyObject(tfExtData)) {
80
20
  try {
81
- let tmpFlowPond = JSON.parse(decodeURIComponent(decodeURIComponent(urlFlowPond)));
82
- urlFlowPond = encodeURIComponent(JSON.stringify(extend(tmpFlowPond, flowPond)))
21
+ let tmpTfExtData = JSON.parse(decodeURIComponent(decodeURIComponent(urlTfExtData)));
22
+ urlTfExtData = encodeURIComponent(JSON.stringify(extend(tmpTfExtData, tfExtData)))
83
23
  } catch (e) {
84
- urlFlowPond = encodeURIComponent(JSON.stringify(flowPond));
24
+ urlTfExtData = encodeURIComponent(JSON.stringify(tfExtData));
85
25
  }
86
26
  }
87
27
  }
88
- function mergeFlowPond(flowPond) {
28
+ function mergeTfExtData(tfExtData) {
89
29
  try {
90
- let targetFlowPond = JSON.parse(decodeURIComponent(decodeURIComponent(flowPond)));
91
- let sourceFlowPond = JSON.parse(decodeURIComponent(decodeURIComponent(urlFlowPond)));
92
- return encodeURIComponent(JSON.stringify(extend(sourceFlowPond, targetFlowPond)));
30
+ let targetTfExtData = JSON.parse(decodeURIComponent(decodeURIComponent(tfExtData)));
31
+ let sourceTfExtData = JSON.parse(decodeURIComponent(decodeURIComponent(urlTfExtData)));
32
+ return encodeURIComponent(JSON.stringify(extend(sourceTfExtData, targetTfExtData)));
93
33
  } catch (e) {
94
- return flowPond;
34
+ return tfExtData;
95
35
  }
96
36
  }
97
37
 
98
- // 重置flowPond
99
- function resetFlowPond() {
100
- urlFlowPond = urlExt.getQuery('flowPond', currentPageURL) || ''; // ab侧区分用户
101
- }
102
-
103
- // 重置lastfrom
104
- function resetLastfrom() {
105
- urlLastFrom = urlExt.getQuery('lastfrom', currentPageURL) || '';
106
- }
107
-
108
- // 重置orifrom
109
- function resetOrifrom() {
110
- urlOriFrom = urlExt.getQuery('orifrom', currentPageURL) || urlExt.getQuery('fr', currentPageURL) || '';
111
- }
112
-
113
- function getUrlFlowPond() {
114
- return encodeURIComponent(decodeURIComponent(decodeURIComponent(urlFlowPond)));
38
+ function getUrlTfExtData() {
39
+ return encodeURIComponent(decodeURIComponent(decodeURIComponent(urlTfExtData)));
115
40
  }
116
- function getFlowPond() {
41
+ function getTfExtData() {
117
42
  try {
118
- let customFlowPond = (window as any).__PAGE_DATA__.pageInfo.customFlowPond // 自定义追加flowPond
119
- let newFlowPond = JSON.parse(decodeURIComponent(urlFlowPond));
43
+ let customTfExtData = (window as any).__PAGE_DATA__.pageInfo.customTfExtData // 自定义追加tfExtData
44
+ let newTfExtData = JSON.parse(decodeURIComponent(urlTfExtData));
120
45
  let paramString = '';
121
- if (customFlowPond && typeof customFlowPond === 'object') {
122
- newFlowPond = {
123
- ...newFlowPond,
124
- ...customFlowPond
46
+ if (customTfExtData && typeof customTfExtData === 'object') {
47
+ newTfExtData = {
48
+ ...newTfExtData,
49
+ ...customTfExtData
125
50
  }
126
51
  }
127
- for(let key in newFlowPond) {
128
- if (typeof newFlowPond[key] === 'number') {
129
- paramString = `${paramString}&${key}=${newFlowPond[key]}`;
52
+ for(let key in newTfExtData) {
53
+ if (typeof newTfExtData[key] === 'number') {
54
+ paramString = `${paramString}&${key}=${newTfExtData[key]}`;
130
55
  } else {
131
- paramString = `${paramString}&${key}=${encodeURIComponent(newFlowPond[key])}`;
56
+ paramString = `${paramString}&${key}=${encodeURIComponent(newTfExtData[key])}`;
132
57
  }
133
58
  }
134
59
  return encodeURIComponent(paramString.replace(/^&/, ''));
135
60
  } catch (e) {
136
- return urlFlowPond;
61
+ return urlTfExtData;
137
62
  }
138
63
  }
139
64
 
140
- function getFlowPondKey(key) {
65
+ function getTfExtDataKey(key) {
141
66
  try {
142
- const urlFlowPondObj = JSON.parse(decodeURIComponent(decodeURIComponent(urlFlowPond)));
143
- return urlFlowPondObj[key] !== undefined ? urlFlowPondObj[key] : urlFlowPond;
67
+ const urlTfExtDataObj = JSON.parse(decodeURIComponent(decodeURIComponent(urlTfExtData)));
68
+ return urlTfExtDataObj[key] !== undefined ? urlTfExtDataObj[key] : urlTfExtData;
144
69
  } catch (e) {
145
- return urlFlowPond;
146
- }
147
- }
148
-
149
- /**
150
- * 按照规则拼接logpath
151
- * @param prePath 原logpath
152
- * @param pageId 页面id
153
- * @param pathParams 页面参数
154
- * @returns {string} 拼好的logpath
155
- */
156
- function getPath(prePath, pageId, pathParams) {
157
- if (!pageId) { // 如果不存在pageId
158
- return '.' // 此处PM文路沟通后说返回.或者?都可以
159
- } else {
160
- var curPath = pageId;
161
- if (isPlainObject(pathParams) && !isEmptyObject(pathParams)) {
162
- for(var p in pathParams) {
163
- curPath = curPath + '(' + p + '!' + pathParams[p] + ')';
164
- }
165
- }
166
- return prePath ? (prePath + '__' + curPath) : curPath;
70
+ return urlTfExtData;
167
71
  }
168
72
  }
169
73
 
@@ -173,7 +77,7 @@ function withBaseURL(jumpUrl) {
173
77
  return jumpUrl;
174
78
  }
175
79
 
176
- let baseURL = cdnUrl;
80
+ let baseURL = host;
177
81
  return `${baseURL}${jumpUrl}`;
178
82
  }
179
83
 
@@ -183,7 +87,6 @@ function withBaseURL(jumpUrl) {
183
87
  * @returns {*}
184
88
  */
185
89
  function urlHandle(url, isMerge = false) {
186
- console.log('urlHandle===========:', url)
187
90
  url = url? withBaseURL(url) : currentPageURL
188
91
  var urlParts = url ? url.split('?') : []
189
92
  var normalUrl = url ? url.split('?')[0] : ''
@@ -199,89 +102,37 @@ function urlHandle(url, isMerge = false) {
199
102
  realParamsUrl = realParamsUrl + item
200
103
  }
201
104
  })
202
- console.log('realParamsUrl===========:', realParamsUrl)
203
105
  paramsUrl = realParamsUrl
204
106
  }
205
107
 
206
108
  paramsUrl = paramsUrl || '';
207
- var tmpWxYike = urlExt.getQuery('isWxYike', url); // 第二个参数如果为空,则自动从当前url中获取参数一的值
208
- if (Object.prototype.toString.call(tmpWxYike) === '[object Array]') {
209
- tmpWxYike = tmpWxYike[0];
210
- }
211
- var tmpSaleChannelId = urlExt.getQuery('saleChannelId', url);
212
- if (Object.prototype.toString.call(tmpSaleChannelId) === '[object Array]') {
213
- tmpSaleChannelId = tmpSaleChannelId[0];
214
- }
215
- var tmpLastFrom = urlExt.getQuery('lastfrom', url); // 第二个参数如果为空,则自动从当前url中获取参数一的值
216
- console.log('urlHandle-传入链接lastfrom的值为:', tmpLastFrom)
217
- if (Object.prototype.toString.call(tmpLastFrom) === '[object Array]') {
218
- tmpLastFrom = tmpLastFrom[0];
109
+ var tmpChannelType = urlExt.getQuery('channelType', url); // 第二个参数如果为空,则自动从当前url中获取参数一的值
110
+ if (Object.prototype.toString.call(tmpChannelType) === '[object Array]') {
111
+ tmpChannelType = tmpChannelType[0];
219
112
  }
220
- var tmpLogPath = urlExt.getQuery('logpath', url);
221
- if (Object.prototype.toString.call(tmpLogPath) === '[object Array]') {
222
- tmpLogPath = tmpLogPath[0];
113
+ var tmpTfExtData = urlExt.getQuery('tfExtData', url);
114
+ if (Object.prototype.toString.call(tmpTfExtData) === '[object Array]') {
115
+ tmpTfExtData = tmpTfExtData[0];
223
116
  }
224
- var tmpFlowPond = urlExt.getQuery('flowPond', url);
225
- console.log('urlHandle-传入链接flowPond的值为:', tmpFlowPond)
226
- if (Object.prototype.toString.call(tmpFlowPond) === '[object Array]') {
227
- tmpFlowPond = tmpFlowPond[0];
117
+ if (!tmpChannelType) { // 如果tmpChannelType为空,则将channelType拼在参数中
118
+ paramsUrl = urlExt.setQuery('channelType', urlChannelType, paramsUrl);
228
119
  }
229
- var tmpOriFrom = urlExt.getQuery('orifrom', url) || urlExt.getQuery('fr', url);
230
- if (Object.prototype.toString.call(tmpOriFrom) === '[object Array]') {
231
- tmpOriFrom = tmpOriFrom[0];
120
+ // 用于处理url里面已有tfExtData,同时需要merge当前页面设置的
121
+ if (tmpTfExtData && isMerge) {
122
+ paramsUrl = urlExt.setQuery('tfExtData', mergeTfExtData(tmpTfExtData), paramsUrl);
232
123
  }
233
- if (!tmpWxYike) { // tmpWxYike,则将isWxYike拼在参数中
234
- paramsUrl = urlExt.setQuery('isWxYike', urlWxYike, paramsUrl);
235
- }
236
- if (!tmpSaleChannelId) { // tmpSaleChannelId,则将saleChannelId拼在参数中
237
- paramsUrl = urlExt.setQuery('saleChannelId', urlSaleChannelId, paramsUrl);
238
- }
239
- if (!tmpLastFrom) { // 如果tmpLastFrom为空,则将lastFrom拼在参数中
240
- paramsUrl = urlExt.setQuery('lastfrom', urlLastFrom, paramsUrl);
241
- }
242
- if (!tmpLogPath) { // 如果tmpLogPath空,则将urlLogPath拼在参数中
243
- paramsUrl = urlExt.setQuery('logpath', urlLogPath, paramsUrl);
244
- }
245
- // 用于处理url里面已有flowPond,同时需要merge当前页面设置的
246
- if (tmpFlowPond && isMerge) {
247
- paramsUrl = urlExt.setQuery('flowPond', mergeFlowPond(tmpFlowPond), paramsUrl);
248
- }
249
- if (!tmpFlowPond) {
250
- paramsUrl = urlExt.setQuery('flowPond', getUrlFlowPond(), paramsUrl);
251
- }
252
- if (Object.prototype.toString.call(urlOriFrom) === '[object Array]') {
253
- urlOriFrom = urlOriFrom[0];
254
- }
255
- if (urlOriFrom) { // 如果当前页的urlOriFrom不为空,则将fr拼进去
256
- paramsUrl = urlExt.setQuery('fr', urlOriFrom, paramsUrl);
257
- paramsUrl = urlExt.setQuery('orifrom', urlOriFrom, paramsUrl);
258
- } else { // 当前页的urlOriFrom为空
259
- paramsUrl = urlExt.setQuery('fr', tmpOriFrom, paramsUrl);
260
- paramsUrl = urlExt.setQuery('orifrom', tmpOriFrom, paramsUrl);
124
+ if (!tmpTfExtData) {
125
+ paramsUrl = urlExt.setQuery('tfExtData', getUrlTfExtData(), paramsUrl);
261
126
  }
262
127
  console.log('最后返回的链接:', normalUrl, paramsUrl)
263
128
  return normalUrl + '?' + paramsUrl;
264
129
  }
265
130
 
266
- // 在模块内隐式调用设置lastfrom
267
- setLastfrom(urlLastFrom);
268
-
269
- // 在模块内隐式调用设置fr
270
- setOriFrom(urlOriFrom);
271
-
272
131
  export default {
273
- getLogPath: getLogPath,
274
- setLogPath: setLogPath,
275
- getLastfrom: getLastfrom,
276
- setLastfrom: setLastfrom,
277
- getOriFrom: getOriFrom,
278
- setOriFrom: setOriFrom,
132
+ getChannelType: getChannelType,
279
133
  urlHandle: urlHandle,
280
- setFlowPond: setFlowPond,
281
- getFlowPond: getFlowPond,
282
- getFlowPondKey: getFlowPondKey,
283
- getUrlFlowPond: getUrlFlowPond,
284
- resetFlowPond: resetFlowPond,
285
- resetLastfrom: resetLastfrom,
286
- resetOrifrom: resetOrifrom,
134
+ setTfExtData: setTfExtData,
135
+ getTfExtData: getTfExtData,
136
+ getTfExtDataKey: getTfExtDataKey,
137
+ getUrlTfExtData: getUrlTfExtData,
287
138
  }
@@ -0,0 +1,580 @@
1
+ /* @see https://github.com/satazor/SparkMD5 */
2
+ /* jshint bitwise:false */
3
+ /* global unescape */
4
+ /*eslint-disable*/
5
+ 'use strict';
6
+
7
+ ////////////////////////////////////////////////////////////////////////////
8
+
9
+ /*
10
+ * Fastest md5 implementation around (JKM md5)
11
+ * Credits: Joseph Myers
12
+ *
13
+ * @see http://www.myersdaily.org/joseph/javascript/md5-text.html
14
+ * @see http://jsperf.com/md5-shootout/7
15
+ */
16
+
17
+ /* this function is much faster,
18
+ so if possible we use it. Some IEs
19
+ are the only ones I know of that
20
+ need the idiotic second function,
21
+ generated by an if clause. */
22
+ var add32 = function (a, b) {
23
+ return (a + b) & 0xFFFFFFFF;
24
+ },
25
+
26
+ cmn = function (q, a, b, x, s, t) {
27
+ a = add32(add32(a, q), add32(x, t));
28
+ return add32((a << s) | (a >>> (32 - s)), b);
29
+ },
30
+
31
+ ff = function (a, b, c, d, x, s, t) {
32
+ return cmn((b & c) | ((~b) & d), a, b, x, s, t);
33
+ },
34
+
35
+ gg = function (a, b, c, d, x, s, t) {
36
+ return cmn((b & d) | (c & (~d)), a, b, x, s, t);
37
+ },
38
+
39
+ hh = function (a, b, c, d, x, s, t) {
40
+ return cmn(b ^ c ^ d, a, b, x, s, t);
41
+ },
42
+
43
+ ii = function (a, b, c, d, x, s, t) {
44
+ return cmn(c ^ (b | (~d)), a, b, x, s, t);
45
+ },
46
+
47
+ md5cycle = function (x, k) {
48
+ var a = x[0],
49
+ b = x[1],
50
+ c = x[2],
51
+ d = x[3];
52
+
53
+ a = ff(a, b, c, d, k[0], 7, -680876936);
54
+ d = ff(d, a, b, c, k[1], 12, -389564586);
55
+ c = ff(c, d, a, b, k[2], 17, 606105819);
56
+ b = ff(b, c, d, a, k[3], 22, -1044525330);
57
+ a = ff(a, b, c, d, k[4], 7, -176418897);
58
+ d = ff(d, a, b, c, k[5], 12, 1200080426);
59
+ c = ff(c, d, a, b, k[6], 17, -1473231341);
60
+ b = ff(b, c, d, a, k[7], 22, -45705983);
61
+ a = ff(a, b, c, d, k[8], 7, 1770035416);
62
+ d = ff(d, a, b, c, k[9], 12, -1958414417);
63
+ c = ff(c, d, a, b, k[10], 17, -42063);
64
+ b = ff(b, c, d, a, k[11], 22, -1990404162);
65
+ a = ff(a, b, c, d, k[12], 7, 1804603682);
66
+ d = ff(d, a, b, c, k[13], 12, -40341101);
67
+ c = ff(c, d, a, b, k[14], 17, -1502002290);
68
+ b = ff(b, c, d, a, k[15], 22, 1236535329);
69
+
70
+ a = gg(a, b, c, d, k[1], 5, -165796510);
71
+ d = gg(d, a, b, c, k[6], 9, -1069501632);
72
+ c = gg(c, d, a, b, k[11], 14, 643717713);
73
+ b = gg(b, c, d, a, k[0], 20, -373897302);
74
+ a = gg(a, b, c, d, k[5], 5, -701558691);
75
+ d = gg(d, a, b, c, k[10], 9, 38016083);
76
+ c = gg(c, d, a, b, k[15], 14, -660478335);
77
+ b = gg(b, c, d, a, k[4], 20, -405537848);
78
+ a = gg(a, b, c, d, k[9], 5, 568446438);
79
+ d = gg(d, a, b, c, k[14], 9, -1019803690);
80
+ c = gg(c, d, a, b, k[3], 14, -187363961);
81
+ b = gg(b, c, d, a, k[8], 20, 1163531501);
82
+ a = gg(a, b, c, d, k[13], 5, -1444681467);
83
+ d = gg(d, a, b, c, k[2], 9, -51403784);
84
+ c = gg(c, d, a, b, k[7], 14, 1735328473);
85
+ b = gg(b, c, d, a, k[12], 20, -1926607734);
86
+
87
+ a = hh(a, b, c, d, k[5], 4, -378558);
88
+ d = hh(d, a, b, c, k[8], 11, -2022574463);
89
+ c = hh(c, d, a, b, k[11], 16, 1839030562);
90
+ b = hh(b, c, d, a, k[14], 23, -35309556);
91
+ a = hh(a, b, c, d, k[1], 4, -1530992060);
92
+ d = hh(d, a, b, c, k[4], 11, 1272893353);
93
+ c = hh(c, d, a, b, k[7], 16, -155497632);
94
+ b = hh(b, c, d, a, k[10], 23, -1094730640);
95
+ a = hh(a, b, c, d, k[13], 4, 681279174);
96
+ d = hh(d, a, b, c, k[0], 11, -358537222);
97
+ c = hh(c, d, a, b, k[3], 16, -722521979);
98
+ b = hh(b, c, d, a, k[6], 23, 76029189);
99
+ a = hh(a, b, c, d, k[9], 4, -640364487);
100
+ d = hh(d, a, b, c, k[12], 11, -421815835);
101
+ c = hh(c, d, a, b, k[15], 16, 530742520);
102
+ b = hh(b, c, d, a, k[2], 23, -995338651);
103
+
104
+ a = ii(a, b, c, d, k[0], 6, -198630844);
105
+ d = ii(d, a, b, c, k[7], 10, 1126891415);
106
+ c = ii(c, d, a, b, k[14], 15, -1416354905);
107
+ b = ii(b, c, d, a, k[5], 21, -57434055);
108
+ a = ii(a, b, c, d, k[12], 6, 1700485571);
109
+ d = ii(d, a, b, c, k[3], 10, -1894986606);
110
+ c = ii(c, d, a, b, k[10], 15, -1051523);
111
+ b = ii(b, c, d, a, k[1], 21, -2054922799);
112
+ a = ii(a, b, c, d, k[8], 6, 1873313359);
113
+ d = ii(d, a, b, c, k[15], 10, -30611744);
114
+ c = ii(c, d, a, b, k[6], 15, -1560198380);
115
+ b = ii(b, c, d, a, k[13], 21, 1309151649);
116
+ a = ii(a, b, c, d, k[4], 6, -145523070);
117
+ d = ii(d, a, b, c, k[11], 10, -1120210379);
118
+ c = ii(c, d, a, b, k[2], 15, 718787259);
119
+ b = ii(b, c, d, a, k[9], 21, -343485551);
120
+
121
+ x[0] = add32(a, x[0]);
122
+ x[1] = add32(b, x[1]);
123
+ x[2] = add32(c, x[2]);
124
+ x[3] = add32(d, x[3]);
125
+ },
126
+
127
+ /* there needs to be support for Unicode here,
128
+ * unless we pretend that we can redefine the MD-5
129
+ * algorithm for multi-byte characters (perhaps
130
+ * by adding every four 16-bit characters and
131
+ * shortening the sum to 32 bits). Otherwise
132
+ * I suggest performing MD-5 as if every character
133
+ * was two bytes--e.g., 0040 0025 = @%--but then
134
+ * how will an ordinary MD-5 sum be matched?
135
+ * There is no way to standardize text to something
136
+ * like UTF-8 before transformation; speed cost is
137
+ * utterly prohibitive. The JavaScript standard
138
+ * itself needs to look at this: it should start
139
+ * providing access to strings as preformed UTF-8
140
+ * 8-bit unsigned value arrays.
141
+ */
142
+ md5blk = function (s) {
143
+ var md5blks = [],
144
+ i; /* Andy King said do it this way. */
145
+
146
+ for (i = 0; i < 64; i += 4) {
147
+ md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
148
+ }
149
+ return md5blks;
150
+ },
151
+
152
+ md5blk_array = function (a) {
153
+ var md5blks = [],
154
+ i; /* Andy King said do it this way. */
155
+
156
+ for (i = 0; i < 64; i += 4) {
157
+ md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
158
+ }
159
+ return md5blks;
160
+ },
161
+
162
+ md51 = function (s) {
163
+ var n = s.length,
164
+ state = [1732584193, -271733879, -1732584194, 271733878],
165
+ i,
166
+ length,
167
+ tail,
168
+ tmp,
169
+ lo,
170
+ hi;
171
+
172
+ for (i = 64; i <= n; i += 64) {
173
+ md5cycle(state, md5blk(s.substring(i - 64, i)));
174
+ }
175
+ s = s.substring(i - 64);
176
+ length = s.length;
177
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
178
+ for (i = 0; i < length; i += 1) {
179
+ tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
180
+ }
181
+ tail[i >> 2] |= 0x80 << ((i % 4) << 3);
182
+ if (i > 55) {
183
+ md5cycle(state, tail);
184
+ for (i = 0; i < 16; i += 1) {
185
+ tail[i] = 0;
186
+ }
187
+ }
188
+
189
+ // Beware that the final length might not fit in 32 bits so we take care of that
190
+ tmp = n * 8;
191
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
192
+ lo = parseInt(tmp[2], 16);
193
+ hi = parseInt(tmp[1], 16) || 0;
194
+
195
+ tail[14] = lo;
196
+ tail[15] = hi;
197
+
198
+ md5cycle(state, tail);
199
+ return state;
200
+ },
201
+
202
+ md51_array = function (a) {
203
+ var n = a.length,
204
+ state = [1732584193, -271733879, -1732584194, 271733878],
205
+ i,
206
+ length,
207
+ tail,
208
+ tmp,
209
+ lo,
210
+ hi;
211
+
212
+ for (i = 64; i <= n; i += 64) {
213
+ md5cycle(state, md5blk_array(a.subarray(i - 64, i)));
214
+ }
215
+
216
+ // Not sure if it is a bug, however IE10 will always produce a sub array of length 1
217
+ // containing the last element of the parent array if the sub array specified starts
218
+ // beyond the length of the parent array - weird.
219
+ // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue
220
+ a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);
221
+
222
+ length = a.length;
223
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
224
+ for (i = 0; i < length; i += 1) {
225
+ tail[i >> 2] |= a[i] << ((i % 4) << 3);
226
+ }
227
+
228
+ tail[i >> 2] |= 0x80 << ((i % 4) << 3);
229
+ if (i > 55) {
230
+ md5cycle(state, tail);
231
+ for (i = 0; i < 16; i += 1) {
232
+ tail[i] = 0;
233
+ }
234
+ }
235
+
236
+ // Beware that the final length might not fit in 32 bits so we take care of that
237
+ tmp = n * 8;
238
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
239
+ lo = parseInt(tmp[2], 16);
240
+ hi = parseInt(tmp[1], 16) || 0;
241
+
242
+ tail[14] = lo;
243
+ tail[15] = hi;
244
+
245
+ md5cycle(state, tail);
246
+
247
+ return state;
248
+ },
249
+
250
+ hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'],
251
+
252
+ rhex = function (n) {
253
+ var s = '',
254
+ j;
255
+ for (j = 0; j < 4; j += 1) {
256
+ s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];
257
+ }
258
+ return s;
259
+ },
260
+
261
+ hex = function (x) {
262
+ var i;
263
+ for (i = 0; i < x.length; i += 1) {
264
+ x[i] = rhex(x[i]);
265
+ }
266
+ return x.join('');
267
+ },
268
+
269
+ md5 = function (s) {
270
+ return hex(md51(s));
271
+ },
272
+
273
+
274
+
275
+ ////////////////////////////////////////////////////////////////////////////
276
+
277
+ /**
278
+ * SparkMD5 OOP implementation.
279
+ *
280
+ * Use this class to perform an incremental md5, otherwise use the
281
+ * static methods instead.
282
+ */
283
+ SparkMD5 = function () {
284
+ // call reset to init the instance
285
+ this.reset();
286
+ };
287
+
288
+
289
+ // In some cases the fast add32 function cannot be used..
290
+ if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') {
291
+ add32 = function (x, y) {
292
+ var lsw = (x & 0xFFFF) + (y & 0xFFFF),
293
+ msw = (x >> 16) + (y >> 16) + (lsw >> 16);
294
+ return (msw << 16) | (lsw & 0xFFFF);
295
+ };
296
+ }
297
+
298
+
299
+ /**
300
+ * Appends a string.
301
+ * A conversion will be applied if an utf8 string is detected.
302
+ *
303
+ * @param {String} str The string to be appended
304
+ *
305
+ * @return {SparkMD5} The instance itself
306
+ */
307
+ SparkMD5.prototype.append = function (str) {
308
+ // converts the string to utf8 bytes if necessary
309
+ if (/[\u0080-\uFFFF]/.test(str)) {
310
+ str = unescape(encodeURIComponent(str));
311
+ }
312
+
313
+ // then append as binary
314
+ this.appendBinary(str);
315
+
316
+ return this;
317
+ };
318
+
319
+ /**
320
+ * Appends a binary string.
321
+ *
322
+ * @param {String} contents The binary string to be appended
323
+ *
324
+ * @return {SparkMD5} The instance itself
325
+ */
326
+ SparkMD5.prototype.appendBinary = function (contents) {
327
+ this._buff += contents;
328
+ this._length += contents.length;
329
+
330
+ var length = this._buff.length,
331
+ i;
332
+
333
+ for (i = 64; i <= length; i += 64) {
334
+ md5cycle(this._state, md5blk(this._buff.substring(i - 64, i)));
335
+ }
336
+
337
+ this._buff = this._buff.substr(i - 64);
338
+
339
+ return this;
340
+ };
341
+
342
+ /**
343
+ * Finishes the incremental computation, reseting the internal state and
344
+ * returning the result.
345
+ * Use the raw parameter to obtain the raw result instead of the hex one.
346
+ *
347
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
348
+ *
349
+ * @return {String|Array} The result
350
+ */
351
+ SparkMD5.prototype.end = function (raw) {
352
+ var buff = this._buff,
353
+ length = buff.length,
354
+ i,
355
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
356
+ ret;
357
+
358
+ for (i = 0; i < length; i += 1) {
359
+ tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);
360
+ }
361
+
362
+ this._finish(tail, length);
363
+ ret = !!raw ? this._state : hex(this._state);
364
+
365
+ this.reset();
366
+
367
+ return ret;
368
+ };
369
+
370
+ /**
371
+ * Finish the final calculation based on the tail.
372
+ *
373
+ * @param {Array} tail The tail (will be modified)
374
+ * @param {Number} length The length of the remaining buffer
375
+ */
376
+ SparkMD5.prototype._finish = function (tail, length) {
377
+ var i = length,
378
+ tmp,
379
+ lo,
380
+ hi;
381
+
382
+ tail[i >> 2] |= 0x80 << ((i % 4) << 3);
383
+ if (i > 55) {
384
+ md5cycle(this._state, tail);
385
+ for (i = 0; i < 16; i += 1) {
386
+ tail[i] = 0;
387
+ }
388
+ }
389
+
390
+ // Do the final computation based on the tail and length
391
+ // Beware that the final length may not fit in 32 bits so we take care of that
392
+ tmp = this._length * 8;
393
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
394
+ lo = parseInt(tmp[2], 16);
395
+ hi = parseInt(tmp[1], 16) || 0;
396
+
397
+ tail[14] = lo;
398
+ tail[15] = hi;
399
+ md5cycle(this._state, tail);
400
+ };
401
+
402
+ /**
403
+ * Resets the internal state of the computation.
404
+ *
405
+ * @return {SparkMD5} The instance itself
406
+ */
407
+ SparkMD5.prototype.reset = function () {
408
+ this._buff = "";
409
+ this._length = 0;
410
+ this._state = [1732584193, -271733879, -1732584194, 271733878];
411
+
412
+ return this;
413
+ };
414
+
415
+ /**
416
+ * Releases memory used by the incremental buffer and other aditional
417
+ * resources. If you plan to use the instance again, use reset instead.
418
+ */
419
+ SparkMD5.prototype.destroy = function () {
420
+ delete this._state;
421
+ delete this._buff;
422
+ delete this._length;
423
+ };
424
+
425
+
426
+ /**
427
+ * Performs the md5 hash on a string.
428
+ * A conversion will be applied if utf8 string is detected.
429
+ *
430
+ * @param {String} str The string
431
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
432
+ *
433
+ * @return {String|Array} The result
434
+ */
435
+ SparkMD5.hash = function (str, raw) {
436
+ // converts the string to utf8 bytes if necessary
437
+ if (/[\u0080-\uFFFF]/.test(str)) {
438
+ str = unescape(encodeURIComponent(str));
439
+ }
440
+
441
+ var hash = md51(str);
442
+
443
+ return !!raw ? hash : hex(hash);
444
+ };
445
+
446
+ /**
447
+ * Performs the md5 hash on a binary string.
448
+ *
449
+ * @param {String} content The binary string
450
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
451
+ *
452
+ * @return {String|Array} The result
453
+ */
454
+ SparkMD5.hashBinary = function (content, raw) {
455
+ var hash = md51(content);
456
+
457
+ return !!raw ? hash : hex(hash);
458
+ };
459
+
460
+ /**
461
+ * SparkMD5 OOP implementation for array buffers.
462
+ *
463
+ * Use this class to perform an incremental md5 ONLY for array buffers.
464
+ */
465
+ SparkMD5.ArrayBuffer = function () {
466
+ // call reset to init the instance
467
+ this.reset();
468
+ };
469
+
470
+ ////////////////////////////////////////////////////////////////////////////
471
+
472
+ /**
473
+ * Appends an array buffer.
474
+ *
475
+ * @param {ArrayBuffer} arr The array to be appended
476
+ *
477
+ * @return {SparkMD5.ArrayBuffer} The instance itself
478
+ */
479
+ SparkMD5.ArrayBuffer.prototype.append = function (arr) {
480
+ // TODO: we could avoid the concatenation here but the algorithm would be more complex
481
+ // if you find yourself needing extra performance, please make a PR.
482
+ var buff = this._concatArrayBuffer(this._buff, arr),
483
+ length = buff.length,
484
+ i;
485
+
486
+ this._length += arr.byteLength;
487
+
488
+ for (i = 64; i <= length; i += 64) {
489
+ md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i)));
490
+ }
491
+
492
+ // Avoids IE10 weirdness (documented above)
493
+ this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0);
494
+
495
+ return this;
496
+ };
497
+
498
+ /**
499
+ * Finishes the incremental computation, reseting the internal state and
500
+ * returning the result.
501
+ * Use the raw parameter to obtain the raw result instead of the hex one.
502
+ *
503
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
504
+ *
505
+ * @return {String|Array} The result
506
+ */
507
+ SparkMD5.ArrayBuffer.prototype.end = function (raw) {
508
+ var buff = this._buff,
509
+ length = buff.length,
510
+ tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
511
+ i,
512
+ ret;
513
+
514
+ for (i = 0; i < length; i += 1) {
515
+ tail[i >> 2] |= buff[i] << ((i % 4) << 3);
516
+ }
517
+
518
+ this._finish(tail, length);
519
+ ret = !!raw ? this._state : hex(this._state);
520
+
521
+ this.reset();
522
+
523
+ return ret;
524
+ };
525
+
526
+ SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;
527
+
528
+ /**
529
+ * Resets the internal state of the computation.
530
+ *
531
+ * @return {SparkMD5.ArrayBuffer} The instance itself
532
+ */
533
+ SparkMD5.ArrayBuffer.prototype.reset = function () {
534
+ this._buff = new Uint8Array(0);
535
+ this._length = 0;
536
+ this._state = [1732584193, -271733879, -1732584194, 271733878];
537
+
538
+ return this;
539
+ };
540
+
541
+ /**
542
+ * Releases memory used by the incremental buffer and other aditional
543
+ * resources. If you plan to use the instance again, use reset instead.
544
+ */
545
+ SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;
546
+
547
+ /**
548
+ * Concats two array buffers, returning a new one.
549
+ *
550
+ * @param {ArrayBuffer} first The first array buffer
551
+ * @param {ArrayBuffer} second The second array buffer
552
+ *
553
+ * @return {ArrayBuffer} The new array buffer
554
+ */
555
+ SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) {
556
+ var firstLength = first.length,
557
+ result = new Uint8Array(firstLength + second.byteLength);
558
+
559
+ result.set(first);
560
+ result.set(new Uint8Array(second), firstLength);
561
+
562
+ return result;
563
+ };
564
+
565
+ /**
566
+ * Performs the md5 hash on an array buffer.
567
+ *
568
+ * @param {ArrayBuffer} arr The array buffer
569
+ * @param {Boolean} raw True to get the raw result, false to get the hex result
570
+ *
571
+ * @return {String|Array} The result
572
+ */
573
+ SparkMD5.ArrayBuffer.hash = function (arr, raw) {
574
+ var hash = md51_array(new Uint8Array(arr));
575
+
576
+ return !!raw ? hash : hex(hash);
577
+ };
578
+
579
+ export default SparkMD5;
580
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qywh/package",
3
- "version": "0.0.3-beta04",
3
+ "version": "0.0.3-beta05",
4
4
  "description": "钦煜文化低代码可视化组件库",
5
5
  "main": "index.ts",
6
6
  "typings": "typings/index.d.ts",
@@ -351,7 +351,7 @@ export default class QyOutFormSubmitButton extends Mixins(StickyMixin) {
351
351
  }
352
352
  const { actionType, params, uid } = this.actions[0]
353
353
  if (actionType) {
354
- this.setFormToFlowPond()
354
+ this.setFormToTfExtData()
355
355
  this.$nextTick(() => {
356
356
  Bus.uid(uid || this.uid).emit(actionType, params, {})
357
357
  })
@@ -369,8 +369,8 @@ export default class QyOutFormSubmitButton extends Mixins(StickyMixin) {
369
369
  return flag
370
370
  }
371
371
 
372
- // 存储端外表单数据到flowPond里面去
373
- setFormToFlowPond () {
372
+ // 存储端外表单数据到tfExtData里面去
373
+ setFormToTfExtData () {
374
374
  const form: any[] = []
375
375
  Object.keys(this.qyOutFormData).forEach((item: any) => {
376
376
  form.push({
@@ -380,8 +380,8 @@ export default class QyOutFormSubmitButton extends Mixins(StickyMixin) {
380
380
  required: this.qyOutFormData[item].required
381
381
  })
382
382
  })
383
- console.log('setFormToFlowPond', form)
384
- logParamHandle.setFlowPond({ QyOutFormContent: JSON.stringify(form) })
383
+ console.log('setFormToTfExtData', form)
384
+ logParamHandle.setTfExtData({ QyOutFormContent: JSON.stringify(form) })
385
385
  }
386
386
 
387
387
  created () {