update

parent 284fd984
...@@ -7,4 +7,25 @@ const isMobilePhone = (str: string) => { ...@@ -7,4 +7,25 @@ const isMobilePhone = (str: string) => {
const phone84 = /^[84]{2}[0-9]{9,11}$/; const phone84 = /^[84]{2}[0-9]{9,11}$/;
return phoneNot84.test(str) || phone84.test(str); return phoneNot84.test(str) || phone84.test(str);
}; };
export { isEmail, isMobilePhone };
const isUserName = (str: string) => {
const userName = /^\w+$/;
return userName.test(str);
}
const isHasVietnamese = ( str: string) => {
const vn =
'àáạảãâầấậẩẫăằắặẳẵèéẹẻẽêềếệểễìíịỉĩòóọỏõôồốộổỗơờớợởỡùúụủũưừứựửữỳýỵỷỹđ'
const strLower = str.toLowerCase()
let isOK = false
for (let i = 0; i < strLower.length; i++) {
if (vn.indexOf(strLower[i]) >= 0) {
isOK = true
break
}
}
return isOK
}
export { isEmail, isMobilePhone, isUserName, isHasVietnamese };
...@@ -131,7 +131,16 @@ ...@@ -131,7 +131,16 @@
toolbar-toggle-color="yellow-8" toolbar-toggle-color="yellow-8"
toolbar-bg="primary" toolbar-bg="primary"
:spellcheck="false" :spellcheck="false"
:definitions="{
upload: {
tip: 'Upload to cloud',
icon: 'cloud_upload',
label: 'Upload',
handler: selectedFile,
},
}"
:toolbar="[ :toolbar="[
['upload'],
[ [
{ {
label: $q.lang.editor.align, label: $q.lang.editor.align,
...@@ -149,6 +158,7 @@ ...@@ -149,6 +158,7 @@
'subscript', 'subscript',
'superscript', 'superscript',
], ],
['token', 'hr', 'link', 'custom_btn'], ['token', 'hr', 'link', 'custom_btn'],
['print', 'fullscreen'], ['print', 'fullscreen'],
[ [
...@@ -217,7 +227,9 @@ ...@@ -217,7 +227,9 @@
times_new_roman: 'Times New Roman', times_new_roman: 'Times New Roman',
verdana: 'Verdana', verdana: 'Verdana',
}" }"
/> >
</q-editor>
<!-- <q-tabs <!-- <q-tabs
v-model="tabContent" v-model="tabContent"
dense dense
...@@ -381,6 +393,7 @@ export default defineComponent({ ...@@ -381,6 +393,7 @@ export default defineComponent({
required: true, required: true,
}, },
isUpdate: { type: Boolean, default: false }, isUpdate: { type: Boolean, default: false },
image: { type: String, required: true },
namePage: { type: String, required: true }, namePage: { type: String, required: true },
url: { type: String, required: true }, url: { type: String, required: true },
numIndex: { type: String, required: true }, numIndex: { type: String, required: true },
...@@ -416,14 +429,10 @@ export default defineComponent({ ...@@ -416,14 +429,10 @@ export default defineComponent({
(val && val.trim().length) || (val && val.trim().length) ||
i18n.global.t('listConfigSystem.validateMessages.requireUrl'), i18n.global.t('listConfigSystem.validateMessages.requireUrl'),
]; ];
// const nameMenuRules = [
// (val?: Array<unknown>) =>
// val?.length ||
// i18n.global.t('listConfigSystem.validateMessages.requireNameMenu'),
// ];
// const tabNamePage = ref('vi');
// const tabContent = ref('vi');
return { return {
namePageRules, namePageRules,
urlRules, urlRules,
// nameMenuRules, // nameMenuRules,
...@@ -431,6 +440,13 @@ export default defineComponent({ ...@@ -431,6 +440,13 @@ export default defineComponent({
// tabContent, // tabContent,
}; };
}, },
methods: {
selectedFile(file: File) {
const upload = URL.createObjectURL(file);
console.log(upload, 'upload');
},
},
emits: [ emits: [
'update:isOpened', 'update:isOpened',
'update:namePage', 'update:namePage',
...@@ -438,6 +454,7 @@ export default defineComponent({ ...@@ -438,6 +454,7 @@ export default defineComponent({
'update:numIndex', 'update:numIndex',
'update:nameMenu', 'update:nameMenu',
'update:url', 'update:url',
'SetAvatar',
'click:CloseBtn', 'click:CloseBtn',
'addUpdateConfigSystem', 'addUpdateConfigSystem',
], ],
......
import { defineComponent, PropType, Ref, ref, watch } from 'vue'; import { defineComponent, PropType, Ref, ref, watch } from 'vue';
import { i18n } from 'src/boot/i18n'; import { i18n } from 'src/boot/i18n';
import { isEmail } from '../../../boot/functions'; import { isEmail } from '../../../boot/functions';
import { isMobilePhone } from '../../../boot/functions'; import { isMobilePhone, isUserName, isHasVietnamese } from '../../../boot/functions';
import { CustomerLevelType, CustomerType } from 'src/assets/type'; import { CustomerLevelType, CustomerType } from 'src/assets/type';
export default defineComponent({ export default defineComponent({
...@@ -84,6 +84,8 @@ export default defineComponent({ ...@@ -84,6 +84,8 @@ export default defineComponent({
(val?: string) => (val?: string) =>
(val && val.trim().length < 30) || (val && val.trim().length < 30) ||
i18n.global.t('customer.validateMessages.lengthUserName'), i18n.global.t('customer.validateMessages.lengthUserName'),
(val: string) => (isUserName(val) ||
'vui lòng nhập đúng tên đăng nhập'),
]; ];
const passwordRules = [ const passwordRules = [
(val?: string) => (val?: string) =>
...@@ -109,19 +111,19 @@ export default defineComponent({ ...@@ -109,19 +111,19 @@ export default defineComponent({
(val && val.trim().length <= 50) || (val && val.trim().length <= 50) ||
i18n.global.t('customer.validateMessages.lengthCustomerName'), i18n.global.t('customer.validateMessages.lengthCustomerName'),
]; ];
const businessNameRules = [ // const businessNameRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireBusinessName'), // i18n.global.t('customer.validateMessages.requireBusinessName'),
]; // ];
const taxCodeRules = [ // const taxCodeRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireTaxCode'), // i18n.global.t('customer.validateMessages.requireTaxCode'),
(val?: string) => // (val?: string) =>
(val && val.trim().length <= 20) || // (val && val.trim().length <= 20) ||
i18n.global.t('customer.validateMessages.LengthTaxCode'), // i18n.global.t('customer.validateMessages.LengthTaxCode'),
]; // ];
const phoneRules = [ const phoneRules = [
(val?: string) => (val?: string) =>
(val && val.trim().length) || (val && val.trim().length) ||
...@@ -137,48 +139,49 @@ export default defineComponent({ ...@@ -137,48 +139,49 @@ export default defineComponent({
(val: string) => (val: string) =>
isEmail(val) || i18n.global.t('customer.validateMessages.isEmail'), isEmail(val) || i18n.global.t('customer.validateMessages.isEmail'),
]; ];
const addressRules = [ // const addressRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireAddress'), // i18n.global.t('customer.validateMessages.requireAddress'),
]; // ];
const businessTypeRules = [ // const businessTypeRules = [
(val?: string) => // (val?: string) =>
(val && val.trim().length) || // (val && val.trim().length) ||
i18n.global.t('customer.validateMessages.requireBusinessType'), // i18n.global.t('customer.validateMessages.requireBusinessType'),
]; // ];
const levelRules = [
(val?: CustomerLevelType) => // const levelRules = [
val !== null || // (val?: CustomerLevelType) =>
i18n.global.t('customer.validateMessages.requireRatings'), // val !== null ||
]; // i18n.global.t('customer.validateMessages.requireRatings'),
const representativeRules = [ // ];
(val?: string) => // const representativeRules = [
(val && val.trim().length) || // (val?: string) =>
i18n.global.t('customer.validateMessages.requireRepresentative'), // (val && val.trim().length) ||
(val?: string) => // i18n.global.t('customer.validateMessages.requireRepresentative'),
(val && val.trim().length <= 50) || // (val?: string) =>
i18n.global.t('customer.validateMessages.lengthRepresentative'), // (val && val.trim().length <= 50) ||
]; // i18n.global.t('customer.validateMessages.lengthRepresentative'),
const positionRules = [ // ];
(val?: string) => // const positionRules = [
(val && val.trim().length) || // (val?: string) =>
i18n.global.t('customer.validateMessages.requiredPosition'), // (val && val.trim().length) ||
]; // i18n.global.t('customer.validateMessages.requiredPosition'),
// ];
return { return {
isPwd: ref(true), isPwd: ref(true),
userNameRules, userNameRules,
customerNameRules, customerNameRules,
businessNameRules, // businessNameRules,
passwordRules, passwordRules,
codeRules, codeRules,
taxCodeRules, // taxCodeRules,
emailRules, emailRules,
levelRules, // levelRules,
addressRules, // addressRules,
businessTypeRules, // businessTypeRules,
representativeRules, // representativeRules,
positionRules, // positionRules,
phoneRules, phoneRules,
userName, userName,
fullName, fullName,
......
...@@ -333,15 +333,15 @@ export default { ...@@ -333,15 +333,15 @@ export default {
customerName: 'Họ tên *', customerName: 'Họ tên *',
password: 'Mật khẩu *', password: 'Mật khẩu *',
code: 'Mã khách hàng *', code: 'Mã khách hàng *',
businessName: 'Tên doanh nghiệp *', businessName: 'Tên doanh nghiệp ',
taxCode: 'Mã số thuế *', taxCode: 'Mã số thuế ',
email: 'Email *', email: 'Email *',
ratings: 'Xếp hạng *', ratings: 'Xếp hạng ',
address: 'Địa chỉ *', address: 'Địa chỉ ',
businessType: 'Loại doanh nghiệp *', businessType: 'Loại doanh nghiệp ',
representative: 'Người đại diện *', representative: 'Người đại diện ',
position: 'Chức vụ *', position: 'Chức vụ ',
phone: 'Số điện thoại *', phone: 'Số điện thoại ',
status: 'Trạng thái', status: 'Trạng thái',
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment