@truenewx/tnxvue3 2.6.0

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 (60) hide show
  1. package/README.md +3 -0
  2. package/package.json +76 -0
  3. package/sample/App.vue +19 -0
  4. package/sample/main.js +11 -0
  5. package/sample/pages/index.vue +79 -0
  6. package/sample/pages/info.vue +28 -0
  7. package/sample/tnx.js +31 -0
  8. package/src/aj-captcha/Verify/VerifyPoints.vue +258 -0
  9. package/src/aj-captcha/Verify/VerifySlide.vue +379 -0
  10. package/src/aj-captcha/Verify.vue +375 -0
  11. package/src/aj-captcha/api/index.js +19 -0
  12. package/src/aj-captcha/utils/ase.js +11 -0
  13. package/src/aj-captcha/utils/util.js +35 -0
  14. package/src/ant-design/tnxad-theme.css +5 -0
  15. package/src/ant-design/tnxad.css +8 -0
  16. package/src/ant-design/tnxad.js +23 -0
  17. package/src/element-plus/alert/Alert.vue +112 -0
  18. package/src/element-plus/avatar/Avatar.vue +124 -0
  19. package/src/element-plus/button/Button.vue +184 -0
  20. package/src/element-plus/check-icon/CheckIcon.vue +61 -0
  21. package/src/element-plus/close-error-button/CloseErrorButton.vue +45 -0
  22. package/src/element-plus/curd/Curd.vue +224 -0
  23. package/src/element-plus/date-picker/DatePicker.vue +206 -0
  24. package/src/element-plus/date-range/DateRange.vue +78 -0
  25. package/src/element-plus/datetime-picker/DateTimePicker.vue +129 -0
  26. package/src/element-plus/detail-form/DetailForm.vue +88 -0
  27. package/src/element-plus/dialog/Dialog.vue +259 -0
  28. package/src/element-plus/dialog/DialogContent.vue +13 -0
  29. package/src/element-plus/drawer/Drawer.vue +175 -0
  30. package/src/element-plus/dropdown-item/DropdownItem.vue +30 -0
  31. package/src/element-plus/enum-select/EnumSelect.vue +125 -0
  32. package/src/element-plus/fetch-cascader/FetchCascader.vue +138 -0
  33. package/src/element-plus/fetch-select/FetchSelect.vue +166 -0
  34. package/src/element-plus/fetch-tags/FetchTags.vue +122 -0
  35. package/src/element-plus/fss-upload/FssUpload.vue +306 -0
  36. package/src/element-plus/fss-view/FssView.vue +163 -0
  37. package/src/element-plus/icon/Icon.vue +221 -0
  38. package/src/element-plus/input-number/InputNumber.vue +150 -0
  39. package/src/element-plus/paged/Paged.vue +76 -0
  40. package/src/element-plus/permission-tree/PermissionTree.vue +184 -0
  41. package/src/element-plus/query-form/QueryForm.vue +138 -0
  42. package/src/element-plus/query-table/QueryTable.vue +402 -0
  43. package/src/element-plus/region-cascader/RegionCascader.vue +108 -0
  44. package/src/element-plus/select/Select.vue +446 -0
  45. package/src/element-plus/slider/Slider.vue +88 -0
  46. package/src/element-plus/steps-nav/StepsNav.vue +57 -0
  47. package/src/element-plus/submit-form/SubmitForm.vue +236 -0
  48. package/src/element-plus/table-column/TableColumn.vue +32 -0
  49. package/src/element-plus/tabs/Tabs.vue +93 -0
  50. package/src/element-plus/tnxel.css +890 -0
  51. package/src/element-plus/tnxel.js +528 -0
  52. package/src/element-plus/transfer/Transfer.vue +117 -0
  53. package/src/element-plus/upload/Upload.vue +856 -0
  54. package/src/percent/Percent.vue +12 -0
  55. package/src/text/Text.vue +33 -0
  56. package/src/tnxvue-cli.js +64 -0
  57. package/src/tnxvue-router.js +161 -0
  58. package/src/tnxvue-validator.js +365 -0
  59. package/src/tnxvue.css +12 -0
  60. package/src/tnxvue.js +343 -0
@@ -0,0 +1,375 @@
1
+ <template>
2
+ <div :class="mode === 'pop' ? 'mask' : ''" v-show="showBox">
3
+ <div :class="mode === 'pop' ? 'verifybox' : ''" :style="{'max-width':parseInt(imgSize.width)+30+'px'}">
4
+ <div class="verifybox-top" v-if="mode === 'pop'">
5
+ 请完成安全验证
6
+ <span class="verifybox-close" @click="closeBox">
7
+ <el-icon :size="20">
8
+ <icon-close/>
9
+ </el-icon>
10
+ </span>
11
+ </div>
12
+ <div class="verifybox-bottom" :style="{padding:mode === 'pop'?'15px':'0'}">
13
+ <!-- 验证码容器 -->
14
+ <component v-if="componentType"
15
+ :is="componentType"
16
+ :captchaType="captchaType"
17
+ :type="verifyType"
18
+ :figure="figure"
19
+ :arith="arith"
20
+ :mode="mode"
21
+ :vSpace="vSpace"
22
+ :explain="explain"
23
+ :imgSize="imgSize"
24
+ :blockSize="blockSize"
25
+ :barSize="barSize"
26
+ ref="instance"></component>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </template>
31
+ <script type="text/babel">
32
+ /**
33
+ * Verify 验证码组件
34
+ * @description 分发验证码使用
35
+ * */
36
+ import VerifySlide from './Verify/VerifySlide.vue'
37
+ import VerifyPoints from './Verify/VerifyPoints.vue'
38
+ import {computed, ref, toRefs, watchEffect} from 'vue';
39
+ import {Close} from '@element-plus/icons-vue';
40
+
41
+ export default {
42
+ name: 'CaptchaVerify',
43
+ components: {
44
+ VerifySlide,
45
+ VerifyPoints,
46
+ 'icon-close': Close,
47
+ },
48
+ props: {
49
+ captchaType: {
50
+ type: String,
51
+ default() {
52
+ return Math.random() < 0.5 ? 'blockPuzzle' : 'clickWord';
53
+ },
54
+ },
55
+ figure: {
56
+ type: Number
57
+ },
58
+ arith: {
59
+ type: Number
60
+ },
61
+ mode: {
62
+ type: String,
63
+ default: 'pop'
64
+ },
65
+ vSpace: {
66
+ type: Number
67
+ },
68
+ explain: {
69
+ type: String
70
+ },
71
+ imgSize: {
72
+ type: Object,
73
+ default() {
74
+ return {
75
+ width: '310px',
76
+ height: '155px'
77
+ }
78
+ }
79
+ },
80
+ blockSize: {
81
+ type: Object
82
+ },
83
+ barSize: {
84
+ type: Object
85
+ },
86
+ },
87
+ setup(props) {
88
+ const {captchaType, figure, arith, mode, vSpace, explain, imgSize, blockSize, barSize} = toRefs(props)
89
+ const clickShow = ref(false)
90
+ const verifyType = ref(undefined)
91
+ const componentType = ref(undefined)
92
+
93
+ const instance = ref({})
94
+
95
+ const showBox = computed(() => {
96
+ if (mode.value === 'pop') {
97
+ return clickShow.value
98
+ } else {
99
+ return true;
100
+ }
101
+ })
102
+ /**
103
+ * refresh
104
+ * @description 刷新
105
+ * */
106
+ const refresh = () => {
107
+ console.log(instance.value);
108
+ if (instance.value.refresh) {
109
+ instance.value.refresh()
110
+ }
111
+ }
112
+ const closeBox = () => {
113
+ clickShow.value = false;
114
+ refresh();
115
+ }
116
+ const show = () => {
117
+ if (mode.value === "pop") {
118
+ clickShow.value = true;
119
+ }
120
+ }
121
+ watchEffect(() => {
122
+ switch (captchaType.value) {
123
+ case 'blockPuzzle':
124
+ verifyType.value = '2'
125
+ componentType.value = 'VerifySlide'
126
+ break
127
+ case 'clickWord':
128
+ verifyType.value = ''
129
+ componentType.value = 'VerifyPoints'
130
+ break
131
+ }
132
+ })
133
+
134
+ return {
135
+ clickShow,
136
+ verifyType,
137
+ componentType,
138
+ instance,
139
+ showBox,
140
+ closeBox,
141
+ show
142
+ }
143
+ },
144
+ }
145
+ </script>
146
+ <style>
147
+ .verifybox {
148
+ position: relative;
149
+ box-sizing: border-box;
150
+ border-radius: 2px;
151
+ border: 1px solid #e4e7eb;
152
+ background-color: #fff;
153
+ box-shadow: 0 0 10px rgba(0, 0, 0, .3);
154
+ left: 50%;
155
+ top: 50%;
156
+ transform: translate(-50%, -50%);
157
+ }
158
+
159
+ .verifybox-top {
160
+ padding: 0 15px;
161
+ height: 50px;
162
+ line-height: 50px;
163
+ text-align: left;
164
+ font-size: 16px;
165
+ color: #45494c;
166
+ border-bottom: 1px solid #e4e7eb;
167
+ box-sizing: border-box;
168
+ }
169
+
170
+ .verifybox-bottom {
171
+ padding: 15px;
172
+ box-sizing: border-box;
173
+ }
174
+
175
+ .verifybox-close {
176
+ position: absolute;
177
+ top: 13px;
178
+ right: 9px;
179
+ width: 24px;
180
+ height: 24px;
181
+ text-align: center;
182
+ cursor: pointer;
183
+ }
184
+
185
+ .verifybox-close i {
186
+ position: absolute;
187
+ right: 4px;
188
+ }
189
+
190
+ .mask {
191
+ position: fixed;
192
+ top: 0;
193
+ left: 0;
194
+ z-index: 1001;
195
+ width: 100%;
196
+ height: 100vh;
197
+ background: rgba(0, 0, 0, .3);
198
+ transition: all .5s;
199
+ }
200
+
201
+ .verify-tips {
202
+ position: absolute;
203
+ left: 0px;
204
+ bottom: 0px;
205
+ width: 100%;
206
+ height: 30px;
207
+ line-height: 30px;
208
+ color: #fff;
209
+ padding-left: 8px;
210
+ }
211
+
212
+ .suc-bg {
213
+ background-color: rgba(92, 184, 92, .5);
214
+ filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7f5CB85C, endcolorstr=#7f5CB85C);
215
+ }
216
+
217
+ .err-bg {
218
+ background-color: rgba(217, 83, 79, .5);
219
+ filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#7fD9534F, endcolorstr=#7fD9534F);
220
+ }
221
+
222
+ .tips-enter, .tips-leave-to {
223
+ bottom: -30px;
224
+ }
225
+
226
+ .tips-enter-active, .tips-leave-active {
227
+ transition: bottom .5s;
228
+ }
229
+
230
+ /* ---------------------------- */
231
+ /*常规验证码*/
232
+ .verify-code {
233
+ font-size: 20px;
234
+ text-align: center;
235
+ cursor: pointer;
236
+ margin-bottom: 5px;
237
+ border: 1px solid var(--el-border-color);
238
+ }
239
+
240
+ .cerify-code-panel {
241
+ height: 100%;
242
+ overflow: hidden;
243
+ }
244
+
245
+ .verify-code-area {
246
+ float: left;
247
+ }
248
+
249
+ .verify-input-area {
250
+ float: left;
251
+ width: 60%;
252
+ padding-right: 10px;
253
+
254
+ }
255
+
256
+ .verify-change-area {
257
+ line-height: 30px;
258
+ float: left;
259
+ }
260
+
261
+ .varify-input-code {
262
+ display: inline-block;
263
+ width: 100%;
264
+ height: 25px;
265
+ }
266
+
267
+ .verify-change-code {
268
+ color: var(--el-color-primary);
269
+ cursor: pointer;
270
+ }
271
+
272
+ .verify-btn {
273
+ width: 200px;
274
+ height: 30px;
275
+ background-color: var(--el-color-primary);
276
+ color: #FFFFFF;
277
+ border: none;
278
+ margin-top: 10px;
279
+ }
280
+
281
+
282
+ /*滑动验证码*/
283
+ .verify-bar-area {
284
+ position: relative;
285
+ background: #FFFFFF;
286
+ text-align: center;
287
+ -webkit-box-sizing: content-box;
288
+ -moz-box-sizing: content-box;
289
+ box-sizing: content-box;
290
+ border: 1px solid var(--el-border-color);
291
+ -webkit-border-radius: 4px;
292
+ border-radius: 0;
293
+ }
294
+
295
+ .verify-bar-area .verify-move-block {
296
+ position: absolute;
297
+ top: 0px;
298
+ left: 0;
299
+ background: #fff;
300
+ cursor: pointer;
301
+ -webkit-box-sizing: content-box;
302
+ -moz-box-sizing: content-box;
303
+ box-sizing: content-box;
304
+ box-shadow: 0 0 2px #888888;
305
+ -webkit-border-radius: 1px;
306
+ }
307
+
308
+ .verify-bar-area .verify-move-block:hover {
309
+ background-color: var(--el-color-primary);
310
+ color: #FFFFFF;
311
+ }
312
+
313
+ .verify-bar-area .verify-left-bar {
314
+ position: absolute;
315
+ top: -1px;
316
+ left: -1px;
317
+ background: #f0fff0;
318
+ cursor: pointer;
319
+ -webkit-box-sizing: content-box;
320
+ -moz-box-sizing: content-box;
321
+ box-sizing: content-box;
322
+ border: 1px solid var(--el-border-color);
323
+ }
324
+
325
+ .verify-img-panel {
326
+ margin: 0;
327
+ -webkit-box-sizing: content-box;
328
+ -moz-box-sizing: content-box;
329
+ box-sizing: content-box;
330
+ position: relative;
331
+ }
332
+
333
+ .verify-img-panel .verify-refresh {
334
+ width: 24px;
335
+ height: 24px;
336
+ text-align: center;
337
+ padding: 4px;
338
+ cursor: pointer;
339
+ position: absolute;
340
+ top: 0;
341
+ right: 0;
342
+ z-index: 2;
343
+ background-color: rgba(0, 0, 0, 0.2);
344
+ }
345
+
346
+ .verify-img-panel .verify-refresh i {
347
+ color: white;
348
+ position: absolute;
349
+ right: 4px;
350
+ }
351
+
352
+ .verify-img-panel .verify-gap {
353
+ background-color: #fff;
354
+ position: relative;
355
+ z-index: 2;
356
+ border: 1px solid #fff;
357
+ }
358
+
359
+ .verify-bar-area .verify-move-block .verify-sub-block {
360
+ position: absolute;
361
+ text-align: center;
362
+ z-index: 3;
363
+ /* border: 1px solid #fff; */
364
+ }
365
+
366
+ .verify-bar-area .verify-move-block .verify-icon {
367
+ position: absolute;
368
+ top: 11px;
369
+ right: 11px;
370
+ }
371
+
372
+ .verify-bar-area .verify-msg {
373
+ z-index: 3;
374
+ }
375
+ </style>
@@ -0,0 +1,19 @@
1
+ // 获取验证图片以及token
2
+ export function reqGet(data) {
3
+ return new Promise(resolve => {
4
+ window.tnx.app.rpc.post('/captcha/generate', data, function(res) {
5
+ resolve(res);
6
+ });
7
+ });
8
+ }
9
+
10
+ // 滑动或者点选验证
11
+ export function reqCheck(data) {
12
+ return new Promise(resolve => {
13
+ window.tnx.app.rpc.post('/captcha/check', data, function(res) {
14
+ resolve(res);
15
+ });
16
+ });
17
+ }
18
+
19
+
@@ -0,0 +1,11 @@
1
+ import CryptoJS from 'crypto-js'
2
+ /**
3
+ * @word 要加密的内容
4
+ * @keyWord String 服务器随机返回的关键字
5
+ * */
6
+ export function aesEncrypt(word,keyWord="XwKsGlMcdPMEhR1B"){
7
+ let key = CryptoJS.enc.Utf8.parse(keyWord);
8
+ let srcs = CryptoJS.enc.Utf8.parse(word);
9
+ let encrypted = CryptoJS.AES.encrypt(srcs, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
10
+ return encrypted.toString();
11
+ }
@@ -0,0 +1,35 @@
1
+ export function resetSize(vm) {
2
+ let img_width, img_height, bar_width, bar_height; //图片的宽度、高度,移动条的宽度、高度
3
+
4
+ let parentWidth = vm.$el.parentNode.offsetWidth || window.offsetWidth
5
+ let parentHeight = vm.$el.parentNode.offsetHeight || window.offsetHeight
6
+ if (vm.imgSize.width.indexOf('%') != -1) {
7
+ img_width = parseInt(vm.imgSize.width) / 100 * parentWidth + 'px'
8
+ } else {
9
+ img_width = vm.imgSize.width;
10
+ }
11
+
12
+ if (vm.imgSize.height.indexOf('%') != -1) {
13
+ img_height = parseInt(vm.imgSize.height) / 100 * parentHeight + 'px'
14
+ } else {
15
+ img_height = vm.imgSize.height
16
+ }
17
+
18
+ if (vm.barSize.width.indexOf('%') != -1) {
19
+ bar_width = parseInt(vm.barSize.width) / 100 * parentWidth + 'px'
20
+ } else {
21
+ bar_width = vm.barSize.width
22
+ }
23
+
24
+ if (vm.barSize.height.indexOf('%') != -1) {
25
+ bar_height = parseInt(vm.barSize.height) / 100 * parentHeight + 'px'
26
+ } else {
27
+ bar_height = vm.barSize.height
28
+ }
29
+
30
+ return {imgWidth: img_width, imgHeight: img_height, barWidth: bar_width, barHeight: bar_height}
31
+ }
32
+
33
+ export const _code_chars = [1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
34
+ export const _code_color1 = ['#fffff0', '#f0ffff', '#f0fff0', '#fff0f0']
35
+ export const _code_color2 = ['#FF0033', '#006699', '#993366', '#FF9900', '#66CC66', '#FF33CC']
@@ -0,0 +1,5 @@
1
+ /**
2
+ * tnxad-theme.css
3
+ * 对Ant Design颜色主题相关CSS的调整。
4
+ * 从通用调整中拆分出来的原因是,工程可能使用定制颜色主题的样式库,本主题样式库应在工程定制颜色主题的样式库之前引入。
5
+ */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * tnxad.css
3
+ * 对Ant Design CSS的通用调整
4
+ */
5
+ body {
6
+ margin: 0;
7
+ color: #303133;
8
+ }
@@ -0,0 +1,23 @@
1
+ // tnxad.js
2
+ /**
3
+ * 基于AntDesign 2的扩展支持
4
+ */
5
+ import tnxvue from '../tnxvue.js';
6
+ import AntDesign from 'ant-design-vue';
7
+ import './tnxad.css';
8
+
9
+ const components = Object.assign({}, tnxvue.components, {});
10
+
11
+ const tnxad = Object.assign({}, tnxvue, {
12
+ libs: Object.assign({}, tnxvue.libs, {AntDesign}),
13
+ components,
14
+ });
15
+
16
+ tnxad.install = tnxad.util.function.around(tnxad.install, function(install, vm) {
17
+ vm.use(AntDesign);
18
+ install.call(window.tnx, vm);
19
+ });
20
+
21
+ window.tnx = tnxad;
22
+
23
+ export default tnxad;
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <div role="alert" class="el-alert" :class="[typeClass, effectClass]">
3
+ <tnxel-icon :value="iconValue" class="el-alert__icon flex-center" :style="iconStyle" @click="iconClick"
4
+ v-if="showIcon"/>
5
+ <div class="el-alert__content" :class="contentClass">
6
+ <div class="el-alert__title" :style="titleStyle">
7
+ <slot></slot>
8
+ </div>
9
+ </div>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import Icon from '../icon/Icon.vue';
15
+
16
+ export default {
17
+ name: 'TnxelAlert',
18
+ components: {
19
+ 'tnxel-icon': Icon,
20
+ },
21
+ props: {
22
+ type: {
23
+ type: String,
24
+ default: () => 'info'
25
+ },
26
+ effect: {
27
+ type: String,
28
+ default: () => 'light'
29
+ },
30
+ showIcon: {
31
+ type: Boolean,
32
+ default: () => true
33
+ },
34
+ icon: String,
35
+ iconSize: {
36
+ type: [Number, String],
37
+ default: 14,
38
+ },
39
+ iconClick: Function,
40
+ titleSize: [Number, String],
41
+ contentClass: String,
42
+ },
43
+ computed: {
44
+ alertType() {
45
+ if (this.type === 'danger') {
46
+ return 'error';
47
+ }
48
+ if (this.type === 'error' || this.type === 'warning' || this.type === 'success') {
49
+ return this.type;
50
+ }
51
+ return 'info';
52
+ },
53
+ typeClass() {
54
+ return 'el-alert--' + this.alertType;
55
+ },
56
+ effectClass() {
57
+ return 'is-' + this.effect;
58
+ },
59
+ iconValue() {
60
+ if (this.icon) {
61
+ return this.icon;
62
+ }
63
+ switch (this.alertType) {
64
+ case 'error':
65
+ return 'CircleCloseFilled';
66
+ case 'warning':
67
+ return 'WarningFilled';
68
+ case 'success':
69
+ return 'CircleCheckFilled';
70
+ default:
71
+ return 'InfoFilled';
72
+ }
73
+ },
74
+ iconStyle() {
75
+ let style = {};
76
+ if (this.iconSize) {
77
+ let size = this.iconSize;
78
+ if (typeof size === 'number') {
79
+ size += 'px';
80
+ }
81
+ style.fontSize = size;
82
+ style.width = size;
83
+ }
84
+ if (this.iconClick) {
85
+ style.cursor = 'pointer';
86
+ }
87
+ return style;
88
+ },
89
+ titleStyle() {
90
+ let style = {};
91
+ if (this.titleSize) {
92
+ let size = this.titleSize;
93
+ if (typeof size === 'number') {
94
+ size += 'px';
95
+ }
96
+ style.fontSize = size;
97
+ }
98
+ return style;
99
+ }
100
+ },
101
+ }
102
+ </script>
103
+
104
+ <style>
105
+ tnxel-alert {
106
+ visibility: hidden;
107
+ }
108
+
109
+ .el-alert__title {
110
+ text-align: left;
111
+ }
112
+ </style>