ui-process-h5 0.1.40 → 1.0.6

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.
Files changed (89) hide show
  1. package/README.md +171 -18
  2. package/package.json +21 -51
  3. package/build/configure/README.md +0 -171
  4. package/build/configure/package.json +0 -27
  5. package/index.html +0 -12
  6. package/src/App.vue +0 -151
  7. package/src/assets/font-icon/iconfont.scss +0 -57
  8. package/src/assets/font-icon/iconfont.ttf +0 -0
  9. package/src/assets/img/add-file.png +0 -0
  10. package/src/assets/img/arrow-right.png +0 -0
  11. package/src/assets/img/arrow.png +0 -0
  12. package/src/assets/img/check.png +0 -0
  13. package/src/assets/img/del.png +0 -0
  14. package/src/assets/img/doc.png +0 -0
  15. package/src/assets/img/file.png +0 -0
  16. package/src/assets/img/image.png +0 -0
  17. package/src/assets/img/pdf.png +0 -0
  18. package/src/assets/img/xls.png +0 -0
  19. package/src/assets/img/zip.png +0 -0
  20. package/src/assets/js/auth.js +0 -41
  21. package/src/assets/js/errorCode.js +0 -6
  22. package/src/assets/js/message.js +0 -352
  23. package/src/assets/js/request.js +0 -90
  24. package/src/assets/js/toast.js +0 -239
  25. package/src/assets/js/top.js +0 -229
  26. package/src/assets/js/utils.js +0 -82
  27. package/src/assets/js/vuePopper.js +0 -123
  28. package/src/assets/query.png +0 -0
  29. package/src/assets/status/error.png +0 -0
  30. package/src/assets/status/loading.png +0 -0
  31. package/src/assets/status/success.png +0 -0
  32. package/src/main.js +0 -15
  33. package/src/packages/attchUpload/index.js +0 -371
  34. package/src/packages/attchUpload/index.scss +0 -136
  35. package/src/packages/attchUpload/index.vue +0 -173
  36. package/src/packages/downSelect/index.js +0 -81
  37. package/src/packages/downSelect/index.scss +0 -82
  38. package/src/packages/downSelect/index.vue +0 -54
  39. package/src/packages/index.js +0 -6
  40. package/src/packages/popup/index.js +0 -61
  41. package/src/packages/popup/index.scss +0 -174
  42. package/src/packages/popup/index.vue +0 -79
  43. package/src/packages/preview/index.js +0 -36
  44. package/src/packages/preview/index.vue +0 -15
  45. package/src/packages/previewImage/index.js +0 -158
  46. package/src/packages/previewImage/index.scss +0 -59
  47. package/src/packages/previewImage/index.vue +0 -32
  48. package/src/packages/process/index.js +0 -679
  49. package/src/packages/process/index.scss +0 -164
  50. package/src/packages/process/index.vue +0 -189
  51. package/src/packages/process/operation/backNode.vue +0 -393
  52. package/src/packages/process/operation/cancel.vue +0 -399
  53. package/src/packages/process/operation/ccTask.vue +0 -461
  54. package/src/packages/process/operation/complete.vue +0 -488
  55. package/src/packages/process/operation/counterSign.vue +0 -485
  56. package/src/packages/process/operation/delegateTask.vue +0 -480
  57. package/src/packages/process/operation/index.js +0 -9
  58. package/src/packages/process/operation/restart.vue +0 -305
  59. package/src/packages/submitPopup/index.js +0 -296
  60. package/src/packages/submitPopup/index.scss +0 -83
  61. package/src/packages/submitPopup/index.vue +0 -138
  62. package/src/packages/tab/index.js +0 -207
  63. package/src/packages/tab/index.scss +0 -176
  64. package/src/packages/tab/index.vue +0 -155
  65. package/src/packages/tip/index.js +0 -74
  66. package/src/packages/tip/index.scss +0 -82
  67. package/src/packages/tip/index.vue +0 -57
  68. package/src/packages/viewAttchList/index.js +0 -132
  69. package/src/packages/viewAttchList/index.scss +0 -76
  70. package/src/packages/viewAttchList/index.vue +0 -112
  71. package/src/style.css +0 -80
  72. package/ui-process-h5/README.md +0 -171
  73. package/ui-process-h5/package.json +0 -27
  74. package/ui-process-h5/scripts/postinstall.mjs +0 -14
  75. package/ui-process-h5/scripts/switch-cli.mjs +0 -4
  76. package/ui-process-h5/scripts/utils.mjs +0 -60
  77. package/vite.config.ts +0 -78
  78. /package/{build/scripts → scripts}/postinstall.mjs +0 -0
  79. /package/{build/scripts → scripts}/switch-cli.mjs +0 -0
  80. /package/{build/scripts → scripts}/utils.mjs +0 -0
  81. /package/{ui-process-h5/v2 → v2}/style.css +0 -0
  82. /package/{ui-process-h5/v2 → v2}/ui-process-h5.js +0 -0
  83. /package/{ui-process-h5/v2 → v2}/ui-process-h5.umd.cjs +0 -0
  84. /package/{ui-process-h5/v2.7 → v2.7}/style.css +0 -0
  85. /package/{ui-process-h5/v2.7 → v2.7}/ui-process-h5.js +0 -0
  86. /package/{ui-process-h5/v2.7 → v2.7}/ui-process-h5.umd.cjs +0 -0
  87. /package/{ui-process-h5/v3 → v3}/style.css +0 -0
  88. /package/{ui-process-h5/v3 → v3}/ui-process-h5.js +0 -0
  89. /package/{ui-process-h5/v3 → v3}/ui-process-h5.umd.cjs +0 -0
@@ -1,239 +0,0 @@
1
-
2
-
3
-
4
-
5
-
6
- // 创建DOM
7
- const createDom = ({ isId = false, name = '', tag = 'div' }) => {
8
- if (!tag) {
9
- return null
10
- }
11
- const ele = document.createElement(tag)
12
- if (name) {
13
- if (isId) {
14
- ele.id = name
15
- } else {
16
- ele.className = name
17
- }
18
- }
19
- return ele
20
- }
21
-
22
-
23
- const createMessage = ({ type, content, duration, delay, againBtn, minWidth, maxWidth }, mainContainer) => {
24
- if (!mainContainer) {
25
- console.error('主容器不存在,查看调用流程,确保doucument.body已生成!')
26
- return
27
- }
28
- /**随机的key */
29
- const randomKey = Math.floor(Math.random() * (99999 - 10002)) + 10002
30
-
31
- /**属性配置 */
32
- const config = {
33
- isRemove: false, // 是否被移除了
34
- content: content || '', // 提示内容
35
- duration: duration || 3000, // 显示时间
36
- delay: delay || 0, // 弹出延迟
37
- timeout: null, // 计时器事件
38
- againBtn: againBtn || false // 是否需要显示 不再提示 按钮
39
- }
40
- // #region 生成DOM、样式、关系
41
- const messageContainer = createDom({ name: `message-${randomKey}`, tag: 'div' })
42
- messageContainer.style = `
43
- min-width: 100px;
44
- max-width:70%;
45
- padding: 8px 12px;
46
- border-radius: 4px;
47
- background:rgba(0,0,0,0.7);
48
- color:#fff;
49
- font-size:14px;
50
- transform: translateY(-50%);
51
-
52
- display: flex;
53
- flex-direction: column;
54
- align-items: center;
55
- justify-content: center;
56
- position: absolute;
57
- text-align: center;
58
- `
59
-
60
- messageContainer.innerHTML = config.content
61
- if (config.againBtn) {
62
- const messageAgainDiv = createDom({ name: 'message-again-btn', tag: 'div' })
63
- messageAgainDiv.style = `margin-top: 5px;text-align: right;`
64
- const messageAgainBtnText = createDom({ name: 'message-again-text', tag: 'span' })
65
- messageAgainBtnText.innerHTML = '不再提示'
66
- messageAgainBtnText.style = `
67
- font-size: 12px;
68
- color: rgb(204, 201, 201);
69
- border-bottom: 1px solid rgb(204, 201, 201);
70
- cursor: pointer;
71
- `
72
- // 鼠标移入
73
- messageAgainBtnText.onmouseover = () => {
74
- messageAgainBtnText.style.color = '#fdb906'
75
- messageAgainBtnText.style.borderBottom = '1px solid #fdb906'
76
- }
77
- // 鼠标移出
78
- messageAgainBtnText.onmouseout = () => {
79
- messageAgainBtnText.style.color = 'rgb(204, 201, 201)'
80
- messageAgainBtnText.style.borderBottom = '1px solid rgb(204, 201, 201)'
81
- }
82
- messageAgainDiv.appendChild(messageAgainBtnText)
83
- messageContainer.appendChild(messageAgainDiv)
84
- config.elsAgainBtn = messageAgainBtnText
85
- }
86
- mainContainer.appendChild(messageContainer)
87
- /**绑定DOM、销毁事件,以便进行控制内容与状态 */
88
- config.els = messageContainer
89
- config.destory = destory.bind(this)
90
- function destory(mainContainer, isClick) {
91
- if (!config.els || !mainContainer || config.isRemove) {
92
- // 不存在,或已经移除,则不再继续
93
- return
94
- }
95
- config.els.style.marginTop = '-20px' // 为了过渡效果
96
- config.els.style.opacity = '0' // 为了过渡效果
97
- config.isRemove = true
98
- if (isClick) {
99
- mainContainer.removeChild(messageContainer)
100
- _resetMianPosition(mainContainer)
101
- free()
102
- } else {
103
- setTimeout(() => {
104
- mainContainer.removeChild(messageContainer)
105
- _resetMianPosition(mainContainer)
106
- free()
107
- }, 400)
108
- }
109
- }
110
-
111
- // 销毁重置绑定
112
- function free() {
113
- config.els = null
114
- config.elsAgainBtn = null
115
- config.destory = null
116
- }
117
-
118
- return config
119
- }
120
-
121
- function _toBindEvents(domConfig, _self) {
122
- if (!domConfig) {
123
- return
124
- }
125
- // 不再提示按钮的事件绑定
126
- if (domConfig.againBtn && domConfig.elsAgainBtn) {
127
- // 鼠标点击:将内容记录下来,下次就不显示同内容的弹框
128
- domConfig.elsAgainBtn.onclick = () => {
129
- clearTimeout(domConfig.timeout)
130
- let sessionJson = sessionStorage.getItem('MESSAGE_DONT_REMIND_AGAIN')
131
- let tempArr = sessionJson ? JSON.parse(sessionJson) : []
132
- let dontRemindAgainList = Array.isArray(tempArr) ? tempArr : []
133
- dontRemindAgainList.push(domConfig.content)
134
- sessionStorage.setItem(_self.sessionStorageName, JSON.stringify(dontRemindAgainList))
135
- domConfig.destory(_self.mainContainer, true)
136
- }
137
- }
138
-
139
- // 鼠标移入:对销毁计时器进行销毁
140
- domConfig.els.onmouseover = () => {
141
- clearTimeout(domConfig.timeout)
142
- }
143
- // 鼠标移出: 一秒后销毁当前message
144
- domConfig.els.onmouseout = () => {
145
- domConfig.timeout = setTimeout(() => {
146
- domConfig.destory(_self.mainContainer)
147
- clearTimeout(domConfig.timeout)
148
- }, 1000)
149
- }
150
-
151
- // 延时隐藏
152
- domConfig.timeout = setTimeout(() => {
153
- domConfig.destory(_self.mainContainer)
154
- clearTimeout(domConfig.timeout)
155
- }, domConfig.duration)
156
- }
157
-
158
- function _resetMianPosition(mainContainer) {
159
- if (!mainContainer) {
160
- return
161
- }
162
- mainContainer.style.left = `calc(50vw - ${mainContainer.scrollWidth / 2}px)`
163
- }
164
-
165
- class toastBox {
166
- constructor() {
167
- this.minWidth = 380 // 内容显示宽度:最小值
168
- this.maxWidth = 800 // 内容显示宽度:最大值
169
- this.top = 45 // 整体的最顶部距离
170
- this.zIndex = 99999 // 层级
171
- this.mainContainerIdName = 'selfDefine-message-box' // 主体DOM的id名
172
- this.sessionStorageName = 'MESSAGE_DONT_REMIND_AGAIN' // 存储session信息的key
173
- /**生成主体DOM、样式容器 */
174
- let mainDom = document.getElementById(this.mainContainerIdName)
175
- if (mainDom) {
176
- document.body.removeChild(mainDom)
177
- }
178
- this.mainContainer = createDom({ isId: true, name: this.mainContainerIdName, tag: 'div' })
179
- this.mainContainer.style = `
180
- pointer-events:none;
181
- position:fixed;
182
- z-index:${this.zIndex};
183
- display: flex;
184
- flex-direction: column;
185
- align-items:center;
186
- top:50%;
187
- left:0;
188
- right:0;
189
- margin: 0 auto;
190
- `
191
- document.body.appendChild(this.mainContainer)
192
- }
193
-
194
- /**
195
- * 消息提示
196
- * @param {String} type 类型 | 必传 | 可选值:message success error warning
197
- * @param {String} content 内容 | 必传 | ''
198
- * @param {Number} duration 显示时间 | 非必传 | 默认3000毫秒
199
- * @param {Number} delay 出现的延时 | 非必传 | 默认0
200
- * @param {Boolean} againBtn 是否显示 不再提示 按钮 | 非必传 | 默认false
201
- */
202
- message(config = {}) {
203
- // 不再提示(相同文字内容)的存储与判断逻辑待优化
204
- let sessionJson = sessionStorage.getItem(this.sessionStorageName)
205
- let dontRemindAgainList = sessionJson ? JSON.parse(sessionJson) : null
206
- // 需要显示不再提示按钮,且内容有效,且不再提示的记录数组中包含本次内容,则不提示
207
- if (config.againBtn && config.content && dontRemindAgainList && Array.isArray(dontRemindAgainList) && dontRemindAgainList.includes(config.content)) {
208
- return
209
- }
210
-
211
- const domConfig = createMessage(
212
- {
213
- type: config.type,
214
- content: config.content,
215
- duration: config.duration,
216
- delay: config.delay,
217
- againBtn: config.againBtn,
218
- minWidth: this.minWidth,
219
- maxWidth: this.maxWidth
220
- },
221
- this.mainContainer
222
- )
223
- this.mainContainer.appendChild(domConfig.els)
224
- // domConfig.els.style.marginTop = '20px' // 为了过渡效果
225
- _resetMianPosition(this.mainContainer)
226
- _toBindEvents(domConfig, this)
227
- }
228
-
229
- beforeDestory() {
230
- if (this.mainContainer && this.mainContainer.remove) {
231
- this.mainContainer.remove()
232
- } else {
233
- document.body.removeChild(this.mainContainer)
234
- }
235
- this.mainContainer = null
236
- }
237
- }
238
-
239
- export { toastBox }
@@ -1,229 +0,0 @@
1
- /**
2
- * 通用js方法封装处理
3
- * Copyright (c) 2019 top
4
- */
5
-
6
-
7
- // 日期格式化
8
- export function parseTime(time, pattern) {
9
- if (arguments.length === 0 || !time) {
10
- return null
11
- }
12
- const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
13
- let date
14
- if (typeof time === 'object') {
15
- date = time
16
- } else {
17
- if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
18
- time = parseInt(time)
19
- } else if (typeof time === 'string') {
20
- time = time.replace(new RegExp(/-/gm), '/');
21
- }
22
- if ((typeof time === 'number') && (time.toString().length === 10)) {
23
- time = time * 1000
24
- }
25
- date = new Date(time)
26
- }
27
- const formatObj = {
28
- y: date.getFullYear(),
29
- m: date.getMonth() + 1,
30
- d: date.getDate(),
31
- h: date.getHours(),
32
- i: date.getMinutes(),
33
- s: date.getSeconds(),
34
- a: date.getDay()
35
- }
36
- const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
37
- let value = formatObj[key]
38
- // Note: getDay() returns 0 on Sunday
39
- if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
40
- if (result.length > 0 && value < 10) {
41
- value = '0' + value
42
- }
43
- return value || 0
44
- })
45
- return time_str
46
- }
47
-
48
- // 表单重置
49
- export function resetForm(refName) {
50
- if (this.$refs[refName]) {
51
- this.$refs[refName].resetFields();
52
- }
53
- }
54
-
55
- // 添加日期范围
56
- export function addDateRange(params, dateRange, propName) {
57
- var search = params;
58
- search.params = {};
59
- if (null != dateRange && '' != dateRange) {
60
- if (typeof (propName) === "undefined") {
61
- search.params["beginTime"] = dateRange[0];
62
- search.params["endTime"] = dateRange[1];
63
- } else {
64
- search.params["begin" + propName] = dateRange[0];
65
- search.params["end" + propName] = dateRange[1];
66
- }
67
- }
68
- return search;
69
- }
70
-
71
- // 回显数据字典
72
- export function selectDictLabel(datas, value) {
73
- var actions = [];
74
- Object.keys(datas).some((key) => {
75
- if (datas[key].dictValue == ('' + value)) {
76
- actions.push(datas[key].dictLabel);
77
- return true;
78
- }
79
- })
80
- return actions.join('');
81
- }
82
-
83
- // 回显数据字典(字符串数组)
84
- export function selectDictLabels(datas, value, separator) {
85
- var actions = [];
86
- var currentSeparator = undefined === separator ? "," : separator;
87
- var temp = value.split(currentSeparator);
88
- Object.keys(value.split(currentSeparator)).some((val) => {
89
- Object.keys(datas).some((key) => {
90
- if (datas[key].dictValue == ('' + temp[val])) {
91
- actions.push(datas[key].dictLabel + currentSeparator);
92
- }
93
- })
94
- })
95
- return actions.join('').substring(0, actions.join('').length - 1);
96
- }
97
-
98
-
99
-
100
- // 字符串格式化(%s )
101
- export function sprintf(str) {
102
- var args = arguments, flag = true, i = 1;
103
- str = str.replace(/%s/g, function () {
104
- var arg = args[i++];
105
- if (typeof arg === 'undefined') {
106
- flag = false;
107
- return '';
108
- }
109
- return arg;
110
- });
111
- return flag ? str : '';
112
- }
113
-
114
- // 转换字符串,undefined,null等转化为""
115
- export function praseStrEmpty(str) {
116
- if (!str || str == "undefined" || str == "null") {
117
- return "";
118
- }
119
- return str;
120
- }
121
-
122
- /**
123
- * 构造树型结构数据
124
- * @param {*} data 数据源
125
- * @param {*} id id字段 默认 'id'
126
- * @param {*} parentId 父节点字段 默认 'parentId'
127
- * @param {*} children 孩子节点字段 默认 'children'
128
- */
129
- export function handleTree(data, id, parentId, children) {
130
- let config = {
131
- id: id || 'id',
132
- parentId: parentId || 'parentId',
133
- childrenList: children || 'children'
134
- };
135
-
136
- var childrenListMap = {};
137
- var nodeIds = {};
138
- var tree = [];
139
-
140
- for (let d of data) {
141
- let parentId = d[config.parentId];
142
- if (childrenListMap[parentId] == null) {
143
- childrenListMap[parentId] = [];
144
- }
145
- nodeIds[d[config.id]] = d;
146
- childrenListMap[parentId].push(d);
147
- }
148
-
149
- for (let d of data) {
150
- let parentId = d[config.parentId];
151
- if (nodeIds[parentId] == null) {
152
- tree.push(d);
153
- }
154
- }
155
-
156
- for (let t of tree) {
157
- adaptToChildrenList(t);
158
- }
159
-
160
- function adaptToChildrenList(o) {
161
- if (childrenListMap[o[config.id]] !== null) {
162
- o[config.childrenList] = childrenListMap[o[config.id]];
163
- }
164
- if (o[config.childrenList]) {
165
- for (let c of o[config.childrenList]) {
166
- adaptToChildrenList(c);
167
- }
168
- }
169
- }
170
- return tree;
171
- }
172
-
173
- /**
174
- * 参数处理
175
- * @param {*} params 参数
176
- */
177
- export function tansParams(params) {
178
- let result = ''
179
- for (const propName of Object.keys(params)) {
180
- const value = params[propName];
181
- var part = encodeURIComponent(propName) + "=";
182
- if (value !== null && typeof (value) !== "undefined") {
183
- if (typeof value === 'object') {
184
- for (const key of Object.keys(value)) {
185
- if (value[key] !== null && typeof (value[key]) !== 'undefined') {
186
- let params = propName + '[' + key + ']';
187
- var subPart = encodeURIComponent(params) + "=";
188
- result += subPart + encodeURIComponent(value[key]) + "&";
189
- }
190
- }
191
- } else {
192
- result += part + encodeURIComponent(value) + "&";
193
- }
194
- }
195
- }
196
- return result
197
- }
198
-
199
-
200
- export function digitUppercase(n) {
201
- let fraction = ['角', '分'];
202
- let digit = [
203
- '零', '壹', '贰', '叁', '肆',
204
- '伍', '陆', '柒', '捌', '玖'
205
- ];
206
- let unit = [
207
- ['元', '万', '亿'],
208
- ['', '拾', '佰', '仟']
209
- ];
210
- let head = n < 0 ? '欠' : '';
211
- n = Math.abs(n);
212
- let s = '';
213
- for (let i = 0; i < fraction.length; i++) {
214
- s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
215
- }
216
- s = s || '整';
217
- n = Math.floor(n);
218
- for (let i = 0; i < unit[0].length && n > 0; i++) {
219
- var p = '';
220
- for (let j = 0; j < unit[1].length && n > 0; j++) {
221
- p = digit[n % 10] + unit[1][j] + p;
222
- n = Math.floor(n / 10);
223
- }
224
- s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
225
- }
226
- return head + s.replace(/(零.)*零元/, '元')
227
- .replace(/(零.)+/g, '零')
228
- .replace(/^整$/, '零元整');
229
- }
@@ -1,82 +0,0 @@
1
- export function getScrollOffset() {
2
- if (window.pageXOffset) {
3
- return {
4
- left: window.pageXOffset,
5
- top: window.pageYOffset
6
- };
7
- } else {
8
- // 问题: 为什么要相加
9
- // 因为这两个属性只有一个有用, 另一个肯定是0, 索性直接相加
10
- return {
11
- left: document.body.scrollLeft + document.documentElement.scrollLeft,
12
- top: document.body.scrollTop + document.documentElement.scrollTop
13
- };
14
- }
15
- }
16
- // 添加事件, element-ui判断是不是服务器环境
17
- export function on(element, event, handler) {
18
- if (element && event && handler) {
19
- element.addEventListener(event, handler, false);
20
- }
21
- }
22
- // 移除事件
23
- export function off(element, event, handler) {
24
- if (element && event) {
25
- element.removeEventListener(event, handler, false);
26
- }
27
- }
28
-
29
- export function isTooltip(el) {
30
- if (el.scrollWidth > el.offsetWidth) {
31
- el.addEventListener('mouseenter', (e) => {
32
- const vcTooltipDom = document.createElement("div");
33
- vcTooltipDom.className = "dc-tooltip"
34
- vcTooltipDom.setAttribute("id", "vc-tooltip");
35
- document.body.appendChild(vcTooltipDom);
36
-
37
- const tooltip = document.getElementById("vc-tooltip")
38
- const client = e.currentTarget.getBoundingClientRect()
39
- const top = client.top + 30
40
- const left = client.left + 20 - tooltip.offsetWidth / 2
41
- tooltip.style.cssText = ` top: ${top}px; left:${left}px; `;
42
- tooltip.innerHTML = e.currentTarget.getAttribute('tips')
43
- });
44
- el.addEventListener('mouseleave', function () {
45
- const vcTooltipDom = document.getElementById("vc-tooltip");
46
- vcTooltipDom && document.body.removeChild(vcTooltipDom);
47
- });
48
- }
49
- }
50
- // 判断是否为空
51
- function isNull(str) {
52
- if (str === null) return true;
53
- if (str === undefined) return true;
54
- if (str === "null") return true;
55
- if (str === "NaN") return true;
56
- if (str === "undefined") return true;
57
- if (str.length === 0) return true;
58
- // if (/^\s*$/i.test(str)) return true;
59
- return false;
60
- }
61
- // 隐藏手机号码中间四位
62
- function phoneNumberHiding(mobile) {
63
- if (isNull(mobile)) {
64
- return '';
65
- } else {
66
- if (!mobile) return;
67
- return (mobile + '').replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2")
68
- }
69
- }
70
- // 获取string最后几位
71
- function lastNumber(str, number) {
72
- return isNull(str) ? '' : str.substring(str.length - number)
73
- }
74
- // 获取最后一个指定字符之后的字符
75
- export function lastString(str, unit) {
76
- if (isNull(str)) return ''
77
- return str.slice(str.lastIndexOf(unit) + 1)
78
- }
79
- const baseConfig = {
80
- apiUrl: '/stage-api'
81
- }
82
- export { lastNumber, phoneNumberHiding, isNull, baseConfig }
@@ -1,123 +0,0 @@
1
- // 流体bug未解决, 需要多次获取dom, 感觉完全没必要
2
- import { getScrollOffset } from './utils';
3
- export function getPopoverPosition(popover, content, direction, CONTANT) {
4
- // 只负责启动, 自己去检测
5
- // 优化一些, 参数获取函数
6
- let result = { show: true };
7
- getOptions(result, popover, content, direction, CONTANT);
8
- let { left, top } = getScrollOffset();
9
- result.left += left;
10
- result.top += top;
11
- return result;
12
- }
13
- // 手打比 循环省性能
14
- const list = [
15
- 'top-end',
16
- 'left-end',
17
- 'top-start',
18
- 'right-end',
19
- 'top-middle',
20
- 'bottom-end',
21
- 'left-start',
22
- 'right-start',
23
- 'left-middle',
24
- 'right-middle',
25
- 'bottom-start',
26
- 'bottom-middle'
27
- ];
28
- // 只要获取一次就行, 不要浪费性能
29
- function getOptions(result, popover, content, direction, CONTANT = 10) {
30
- let myList = list.concat(),
31
- client = popover.getBoundingClientRect();
32
-
33
- // 判断 当前点击的内容区域是否在可视区域内 不在的话就自动按top显示
34
- const array = direction.split('-');
35
- let height = popover.offsetTop + popover.offsetHeight
36
- const clientHeight = popover.parentElement.clientHeight
37
- const scrollTop = popover.parentNode.scrollTop
38
- height = height - scrollTop
39
- if (height > clientHeight && array[0] === 'bottom') direction = 'top-' + array[1]
40
-
41
- myList.splice(list.indexOf(direction), 1);
42
- getDirection(result, {
43
- myList,
44
- direction,
45
- CONTANT,
46
- top: client.top,
47
- left: client.left,
48
- popoverWidth: popover.offsetWidth,
49
- contentWidth: content.offsetWidth,
50
- popoverHeight: popover.offsetHeight,
51
- contentHeight: content.offsetHeight
52
- });
53
- }
54
- function getDirection(result, options) {
55
- let {
56
- top,
57
- left,
58
- CONTANT,
59
- direction,
60
- contentWidth,
61
- popoverWidth,
62
- contentHeight,
63
- popoverHeight
64
- } = options;
65
- result.options = options;
66
- let main = direction.split('-')[0],
67
- around = direction.split('-')[1];
68
-
69
-
70
- if (main === 'top' || main === 'bottom') {
71
- if (around === 'start') {
72
- result.left = left;
73
- } else if (around === 'end') {
74
- result.left = left + popoverWidth - contentWidth;
75
- } else if (around === 'middle') {
76
- result.left = left + popoverWidth / 2 - contentWidth / 2;
77
- }
78
- if (main === 'top') {
79
- result.top = top - contentHeight - CONTANT;
80
- } else {
81
- result.top = top + popoverHeight + CONTANT;
82
- }
83
- } else if (main === 'left' || main === 'right') {
84
- if (around === 'start') {
85
- result.top = top;
86
- } else if (around === 'end') {
87
- result.top = top + popoverHeight - contentHeight;
88
- } else if (around === 'middle') {
89
- result.top = top + popoverHeight / 2 - contentHeight / 2;
90
- }
91
- if (main === 'left') {
92
- result.left = left - contentWidth - CONTANT;
93
- } else {
94
- result.left = left + popoverWidth + CONTANT;
95
- }
96
- }
97
-
98
- testDirection(result, options);
99
- }
100
-
101
- function testDirection(result, options) {
102
- let { left, top } = result,
103
- width = document.documentElement.clientWidth,
104
- height = document.documentElement.clientHeight;
105
- if (
106
- top < 0 ||
107
- left < 0 ||
108
- top + options.contentHeight > height ||
109
- left + options.contentWidth > width
110
- ) {
111
- // 还有可以循环的
112
- if (options.myList.length) {
113
- options.direction = options.myList.shift();
114
- getDirection(result, options);
115
- } else {
116
- // 实在不行就在父级身上
117
- result.left = options.left;
118
- result.right = options.right;
119
- }
120
- } else {
121
- result.show = true;
122
- }
123
- }
Binary file
Binary file
Binary file
Binary file
package/src/main.js DELETED
@@ -1,15 +0,0 @@
1
- import { version } from 'vue-demi'
2
- import App from './App.vue'
3
- import { createApp } from 'vue3'
4
- import Vue2 from 'vue2'
5
- import Vue27 from 'vue2.7'
6
- if (version.startsWith('2.7.')) {
7
- new Vue2({ render: (h) => h(App) }).$mount('#app')
8
- }
9
- else if (version.startsWith('2.')) {
10
- new Vue27({ render: (h) => h(App) }).$mount('#app')
11
- } else {
12
- const app = createApp(App)
13
- app.mount('#app')
14
- }
15
-