|
@@ -42,7 +42,7 @@ import { useRouter } from 'vue-router';
|
|
|
import CountrySelct from '@/components/CountrySelct.vue';
|
|
|
import ProductDescription from '@/components/ProductDescription.vue';
|
|
|
import CompetitorWebsite from '@/components/CompetitorWebsite.vue';
|
|
|
-import Logo from '@/assets/images/logo.svg';
|
|
|
+import Logo from '@/assets/images/logo.png';
|
|
|
|
|
|
import { showMessage } from '@/utils/common';
|
|
|
const mainStore = useMainStore();
|
|
@@ -112,8 +112,19 @@ const getFormData = () => {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
+const isValidUrl = (url: string) => {
|
|
|
+ const pattern = /^(https?:\/\/|ftp:\/\/)([a-zA-Z0-9.-]+)(:[0-9]+)?(\/[^\s]*)?$/;
|
|
|
+ return pattern.test(url);
|
|
|
+};
|
|
|
+
|
|
|
+const validateCompetitorWebsite = (site: string) => {
|
|
|
+ if (!site.trim()) return true;
|
|
|
+ const list = site.split(',');
|
|
|
+ return list.every((item) => isValidUrl(item));
|
|
|
+};
|
|
|
+
|
|
|
const acceptRecod = async () => {
|
|
|
- btnLoading.value = true;
|
|
|
+ btnLoading.value = true;
|
|
|
|
|
|
const { allowed, remaining } = await checkLimit();
|
|
|
if (!allowed) {
|
|
@@ -125,13 +136,17 @@ const acceptRecod = async () => {
|
|
|
return;
|
|
|
}
|
|
|
const formData = getFormData();
|
|
|
- // const { competitorWebsite } = formData;
|
|
|
- // if (!competitorWebsite) {
|
|
|
- // return showMessage({
|
|
|
- // type: 'error',
|
|
|
- // message: '请输入竞品网站'
|
|
|
- // });
|
|
|
- // }
|
|
|
+ const { competitorWebsite } = formData;
|
|
|
+ const result = validateCompetitorWebsite(competitorWebsite);
|
|
|
+
|
|
|
+ if (!result) {
|
|
|
+ showMessage({
|
|
|
+ type: 'error',
|
|
|
+ message: '请输入正确的竞品网站'
|
|
|
+ });
|
|
|
+ btnLoading.value = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
mainStore.setFormData(formData);
|
|
|
mainStore.setClearCache(true);
|
|
|
|
|
@@ -151,7 +166,7 @@ const acceptRecod = async () => {
|
|
|
|
|
|
&-logo {
|
|
|
position: absolute;
|
|
|
- width: 194px;
|
|
|
+ width: 320px;
|
|
|
height: 88px;
|
|
|
left: 260px;
|
|
|
top: 32px;
|