mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 16:13:26 +08:00
Merge branch 'dev' into 'master'
uniapp【修复】:自定义表单手机,邮箱格式验证 See merge request jianweie/coreshoppro!115
This commit is contained in:
@@ -35,3 +35,21 @@ export enum FormTypeEnum {
|
||||
/** 定位 */
|
||||
coordinate = 'coordinate',
|
||||
}
|
||||
|
||||
/** 表单里的字段类型 */
|
||||
export enum FormValidationTypeEnum {
|
||||
/** 字符串 */
|
||||
string = 'string',
|
||||
/** 数字 */
|
||||
number = 'number',
|
||||
/** 整数 */
|
||||
integer = 'integer',
|
||||
/** 价格 */
|
||||
price = 'price',
|
||||
/** 邮箱 */
|
||||
email = 'email',
|
||||
/** 手机号 */
|
||||
mobile = 'mobile',
|
||||
/** 多数据 */
|
||||
array = 'array',
|
||||
}
|
||||
@@ -144,8 +144,9 @@
|
||||
import { queryAreas } from '@/core/api';
|
||||
import { useLoginStore } from '@/core/store';
|
||||
import { UserToken, shareUrl } from '@/core/consts';
|
||||
import { FormHeadEnum, ShareClientEnum, ShareEnum, ShareModelEnum, FormTypeEnum, PaymentTypeEnum } from '@/core/enum';
|
||||
import { FormHeadEnum, ShareClientEnum, ShareEnum, ShareModelEnum, FormTypeEnum, PaymentTypeEnum , FormValidationTypeEnum} from '@/core/enum';
|
||||
import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
|
||||
import { mobile,email } from '@/uni_modules/uv-ui-tools/libs/function/test.js';
|
||||
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
|
||||
|
||||
interface QueryParams {
|
||||
@@ -371,6 +372,17 @@
|
||||
/** 按钮提交 */
|
||||
const handleSubmit = () => {
|
||||
_useLoginStore.checkLogin(async () => {
|
||||
/** 验证手机号 */
|
||||
let mobileData = state.formInfo.items.find((item : any) => item.validationType == FormValidationTypeEnum.mobile && item.required && !mobile(item.defaultValue));
|
||||
if (mobileData) {
|
||||
handleShowToast(`请输入正确的${mobileData.name}`); return;
|
||||
}
|
||||
|
||||
/** 验证邮箱 */
|
||||
let emailData = state.formInfo.items.find((item : any) => item.validationType == FormValidationTypeEnum.email && item.required && !email(item.defaultValue));
|
||||
if (emailData) {
|
||||
handleShowToast(`请输入正确的${emailData.name}`); return;
|
||||
}
|
||||
|
||||
let data = state.formInfo.items.find((item : any) => item.required && !item.defaultValue);
|
||||
if (data) {
|
||||
|
||||
Reference in New Issue
Block a user