Browse Source

fix: Purchase增加登录校验

周玉环 1 day ago
parent
commit
df4d7ed5fa
2 changed files with 16 additions and 6 deletions
  1. 1 1
      xinkeaboard-web/composables/common.js
  2. 15 5
      xinkeaboard-web/pages/home/contact.vue

+ 1 - 1
xinkeaboard-web/composables/common.js

@@ -176,7 +176,7 @@ export function checkSmsCode(val) {
 * */
 export function checkEmail(email) {
   let tarLang = getCurLanguage();
-  let reg = /^([a-zA-Z0-9]+[-_.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[-_.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,6}$/;
+  let reg = /^([a-zA-Z0-9_-]+[-_.]?)*[a-zA-Z0-9_-]+@([a-zA-Z0-9.-]+[-_.]?)*[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
   if (!email) {
       return tarLang['请输入邮箱'];
   } else if (!reg.test(email)) {

+ 15 - 5
xinkeaboard-web/pages/home/contact.vue

@@ -262,13 +262,23 @@ const submitForm = async (formEl) => {
   if (!formEl) return;
   await formEl.validate((valid, fields) => {
     if (valid) {
-      loading.value = true;
-      let url = "";
+      const url = apiUrl + "v3/member/front/enquiry/save";
       if (!filtersStore.getLoginFlag) {
-        url = apiUrl + "v3/member/front/enquiry/add";
-      } else {
-        url = apiUrl + "v3/member/front/enquiry/save";
+        //未登录提示登录
+        return openLoginDialog({
+          onRegister: () => {
+            router.push({
+              path: "/register",
+            });
+          },
+          onForgot: () => {
+            router.push({
+              path: "/member/login/forget",
+            });
+          },
+        });
       }
+      loading.value = true;
       let d = {}
       d = Object.assign({},form) 
       d.pageUrl = window.location.href;