free-fe-core-modules 0.0.6 → 0.0.8

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.
package/index.js CHANGED
@@ -27,17 +27,17 @@ const filters = {
27
27
 
28
28
  return url ? `${config.imageUrlBase}${url}` : '';
29
29
  },
30
- serverVideo: (url) => {
30
+ serverVideo: (url) => {
31
31
  if (typeof url === 'string' && url.startsWith('@')) return url.substring(1);
32
32
 
33
33
  return url ? `${config.videoUrlBase}${url}` : '';
34
34
  },
35
- serverThumb: (url) => {
35
+ serverThumb: (url) => {
36
36
  if (typeof url === 'string' && url.startsWith('@')) return url.substring(1);
37
37
 
38
38
  return url ? `${config.thumbUrlBase}${url}` : '';
39
39
  },
40
- serverDocument: (url) => {
40
+ serverDocument: (url) => {
41
41
  if (typeof url === 'string' && url.startsWith('@')) return url.substring(1);
42
42
 
43
43
  return url ? `${config.documentUrlBase}${url}` : '';
@@ -125,7 +125,8 @@ const filters = {
125
125
  let diff = quasarDate.getDateDiff(date1, date2, 'seconds');
126
126
  if (diff < 1) {
127
127
  return diff + Vue.prototype.$t('justNow');
128
- } if (diff < 60) {
128
+ }
129
+ if (diff < 60) {
129
130
  return diff + Vue.prototype.$t('secondsAgo');
130
131
  }
131
132
 
@@ -161,8 +162,7 @@ export default (app, root) => {
161
162
  return {
162
163
  config: {
163
164
  backendDependencies: ["core-modules"],
164
- dictFields: [
165
- {
165
+ dictFields: [{
166
166
  Type: 'Category',
167
167
  Label: '字典数据信息',
168
168
  },
@@ -191,17 +191,14 @@ export default (app, root) => {
191
191
  Type: 'Tabs',
192
192
  Label: '显示内容',
193
193
  DataType: 'Array',
194
- Default: [
195
- {
196
- Locale: appStore.locale || app.config.defaultLocale,
197
- },
198
- ],
194
+ Default: [{
195
+ Locale: appStore.locale || app.config.defaultLocale,
196
+ }, ],
199
197
  Options: {
200
198
  Dense: true,
201
199
  LabelField: 'Name',
202
200
  ValueField: 'Locale',
203
- List: [
204
- {
201
+ List: [{
205
202
  Name: 'Locale',
206
203
  Label: '语言',
207
204
  Type: 'String',
@@ -242,7 +239,11 @@ export default (app, root) => {
242
239
  Label: '图片/图标/文件',
243
240
  Type: 'File',
244
241
  MaxValue: '100m',
245
- Options: { Dense: false, AsLink: false, Ext: 'jpg,png,pdf,doc,docx,zip' },
242
+ Options: {
243
+ Dense: false,
244
+ AsLink: false,
245
+ Ext: 'jpg,png,pdf,doc,docx,zip'
246
+ },
246
247
  Tips: [{
247
248
  Text: '文件不可超过100M。格式支持:PNG、JPG、PDF、DOC、DOCX、ZIP。',
248
249
  }],
@@ -255,9 +256,9 @@ export default (app, root) => {
255
256
  Name: 'Info',
256
257
  Label: '附加信息',
257
258
  Type: 'Text',
258
- }],
259
- menuFields: [
260
- {
259
+ }
260
+ ],
261
+ menuFields: [{
261
262
  Type: "Category",
262
263
  Label: "菜单信息",
263
264
  },
@@ -306,6 +307,10 @@ export default (app, root) => {
306
307
  NoDataScope: true,
307
308
  },
308
309
  ],
310
+
311
+ defaultInputFieldPlaceholder: '',
312
+ defaultSelectFieldPlaceholder: '',
313
+ defaultSearchFieldPlaceholder: '',
309
314
  },
310
315
  routers,
311
316
  filters,
@@ -326,25 +331,12 @@ export default (app, root) => {
326
331
  fieldComponents: FieldComponents.fieldComponents,
327
332
 
328
333
  validators: {
329
- validatorNotEmpty: (d) =>
330
- d && d.length > 0 && d.trim().length > 0,
331
- validatorMobilePhone: (d) =>
332
- !d || /^(0|86|17951)?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$/.test(
333
- d
334
- ),
335
- validatorEmail: (d) =>
336
- !d || /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
337
- d
338
- ),
339
- validatorPhoneOrEmail: (d) =>
340
- d !== void 0 &&
341
- d.length > 0 &&
342
- (this.validatorMobilePhone(d) || this.validatorEmail(d)),
334
+ validatorNotEmpty: (d) => d !== void 0 && d.length > 0 && d.trim().length > 0,
335
+ validatorMobilePhone: (d) => !d || /^(0|86|17951)?(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$/.test(d),
336
+ validatorEmail: (d) => !d || /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(d),
337
+ validatorPhoneOrEmail: (d) => d !== void 0 && d.length > 0 && (this.validatorMobilePhone(d) || this.validatorEmail(d)),
343
338
  // validatorMinLength: (d, len = 0) => d !== undefined && d.length >= len,
344
- validatorChinaIDNumber: (d) =>
345
- !d || /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(
346
- d
347
- ),
339
+ validatorChinaIDNumber: (d) => !d || /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(d),
348
340
  // validatorSame: (d, to) => d === to,
349
341
  // validatorDifferent: (d, to) => d !== to,
350
342
  // validatorGT: (d, to) => d > to,
@@ -369,26 +361,16 @@ export default (app, root) => {
369
361
  validatorOnlyNIZ: (d) => /^([0]|-[1-9][0-9]+)$/.test(d.toString()),
370
362
 
371
363
  //
372
- validatorUrl: (d) =>
373
- /^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?/.test(
374
- d
375
- ),
364
+ validatorUrl: (d) => /^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?/.test(d),
376
365
  validatorOfficePhone: (d) => /^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{8}$/.test(d),
377
366
  validatorChinaZip: (d) => /^[1-9]{1}(\d+){5}$/.test(d),
378
367
 
379
368
  // password
380
369
  validatorPwd0: (d) => /^.*(?=.{6,16}).*$/.test(d),
381
370
  validatorPwd1: (d) => /^.{6,16}$/.test(d),
382
- validatorPwd2: (d) =>
383
- /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z]).*$/.test(d),
384
- validatorPwd3: (d) =>
385
- /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?\(\)]).*$/.test(
386
- d
387
- ),
388
- validatorPwd4: (d) =>
389
- /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z]{2,})(?=.*[a-z]{2,})(?=.*[!@#$%^&*?\(\)]).*$/.test(
390
- d
391
- ),
371
+ validatorPwd2: (d) => /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z]).*$/.test(d),
372
+ validatorPwd3: (d) => /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?\(\)]).*$/.test(d),
373
+ validatorPwd4: (d) => /^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z]{2,})(?=.*[a-z]{2,})(?=.*[!@#$%^&*?\(\)]).*$/.test(d),
392
374
  },
393
375
  }
394
- };
376
+ };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "free-fe-core-modules",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "main": "index.js",
5
- "repository": "git@gitlab.com:eis-base/modules/free-fe-core-modules.git",
5
+ "repository": "https://github.com/freeeis/free-fe-core-modules.git",
6
6
  "author": "zhiquan",
7
7
  "license": "UNLICENSED",
8
8
  "dependencies": {
@@ -1,11 +1,8 @@
1
- // import Vue from 'vue';
2
1
  import {
3
2
  getDict,
4
3
  createDict, updateDict, deleteDict,
5
4
  } from './api';
6
5
 
7
- // const bus = new Vue();
8
-
9
6
  const CHINA_NUMBERS = ' 一二三四五六七八九十';
10
7
 
11
8
  export default {
@@ -43,6 +40,5 @@ export default {
43
40
  addDict: (d) => createDict(d),
44
41
  editDict: (d) => updateDict(d),
45
42
  deleteDict: (d) => deleteDict(d),
46
- // Bus: bus,
47
43
  }),
48
44
  };
@@ -1,11 +1,8 @@
1
- // import Vue from 'vue';
2
1
  import { getErrorCode } from './api';
3
2
 
4
3
  import { i18n } from '@/boot/i18n';
5
4
  const {global:{t}} = i18n;
6
5
 
7
- // const bus = new Vue();
8
-
9
6
  export default {
10
7
  list: (app) => () => ({
11
8
  GetData: (o) => getErrorCode(o).then((data) => {
@@ -31,6 +28,5 @@ export default {
31
28
 
32
29
  return d;
33
30
  }),
34
- // Bus: bus,
35
31
  }),
36
32
  };
@@ -1,11 +1,8 @@
1
- // import Vue from 'vue';
2
1
  import {
3
2
  getMenus,
4
3
  createMenu, updateMenu, deleteMenu,
5
4
  } from './api';
6
5
 
7
- // const bus = new Vue();
8
-
9
6
  const CHINA_NUMBERS = ' 一二三四五六七八九十';
10
7
 
11
8
  export default {
@@ -80,6 +77,5 @@ export default {
80
77
  addMenu: (d) => createMenu(d),
81
78
  editMenu: (d) => updateMenu(d),
82
79
  deleteMenu: (d) => deleteMenu(d),
83
- // Bus: bus,
84
80
  }),
85
81
  };
@@ -1,7 +1,7 @@
1
- // import Vue from 'vue';
2
1
  import { getConfig } from './api';
2
+ import { i18n } from '@/boot/i18n';
3
3
 
4
- // const bus = new Vue();
4
+ const {global:{t}} = i18n;
5
5
 
6
6
  export default {
7
7
  systemConfig: () => ({
@@ -28,7 +28,7 @@ export default {
28
28
  Index: i + 1,
29
29
  Actions: [
30
30
  {
31
- Label: '保存',
31
+ Label: t('保存'),
32
32
  Action: 'save',
33
33
  },
34
34
  ],
@@ -41,6 +41,5 @@ export default {
41
41
 
42
42
  return data;
43
43
  }),
44
- // Bus: bus,
45
44
  }),
46
45
  };
@@ -53,6 +53,7 @@
53
53
  v-if="field.Name !== 'Name' || !selectedDictNode.Parent"
54
54
  :values="editingDict"
55
55
  :Field="field"
56
+ ref="fieldsToValidate"
56
57
  ></free-field>
57
58
  </div>
58
59
 
@@ -98,10 +99,11 @@
98
99
  </template>
99
100
 
100
101
  <script>
101
- import { defineComponent } from 'vue';
102
+ import { defineComponent, watch } from 'vue';
102
103
  import { copyToClipboard } from 'quasar';
103
104
  import { requests } from '@/boot/axios';
104
105
  import { useObjectData, objectDataProps } from '../../composible/useObjectData';
106
+ import { useFormValidator} from '../../composible/useFormValidator';
105
107
 
106
108
  export default defineComponent({
107
109
  name: 'DictionaryPage',
@@ -127,9 +129,16 @@ export default defineComponent({
127
129
  refreshData,
128
130
  } = useObjectData(props, ctx);
129
131
 
132
+ const { validate } = useFormValidator('fieldsToValidate');
133
+
134
+ watch(() => data, () => {
135
+ console.log(data)
136
+ })
137
+
130
138
  return {
131
- data,
139
+ data,
132
140
  refreshData,
141
+ validate,
133
142
  };
134
143
  },
135
144
  watch: {
@@ -243,6 +252,9 @@ export default defineComponent({
243
252
  },
244
253
  onSaveClick() {
245
254
  if (Object.keys(this.editingDict) <= 0) return;
255
+
256
+ if (!this.validate()) return;
257
+
246
258
  // if is adding new
247
259
  if (this.selectedDictNode.addingNew) {
248
260
  this.editingDict = {
@@ -338,9 +338,6 @@ export default defineComponent({
338
338
  this.onCancelClick();
339
339
  }
340
340
  },
341
- fieldInput(e) {
342
- console.log(e)
343
- }
344
341
  },
345
342
  });
346
343
  </script>