|
|
@@ -1,8 +1,14 @@
|
|
|
import { FormSchema } from '/@/components/Table';
|
|
|
import { getBaiduAdd, getSprotProject } from '/@/api/common/api';
|
|
|
-import { h } from 'vue';
|
|
|
+import { h, ref } from 'vue';
|
|
|
import { JAreaSelect } from '/@/components/Form';
|
|
|
import { InputGroup, Input, Button, message } from 'ant-design-vue';
|
|
|
+import { useUserStore } from '/@/store/modules/user';
|
|
|
+import { storeToRefs } from 'pinia';
|
|
|
+import { getEsignURL } from './shopInfo.api';
|
|
|
+import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+const { createWarningModal } = useMessage();
|
|
|
+const confirmLoading = ref(false);
|
|
|
export const formSchema: FormSchema[] = [
|
|
|
{
|
|
|
label: '',
|
|
|
@@ -112,7 +118,64 @@ export const formSchema: FormSchema[] = [
|
|
|
placeholder: '输入详细地址后点击定位,自动填充',
|
|
|
},
|
|
|
},
|
|
|
-
|
|
|
+ {
|
|
|
+ field: 'isCertified',
|
|
|
+ label: '企业认证',
|
|
|
+ component: 'RadioButtonGroup',
|
|
|
+ required: true,
|
|
|
+ defaultValue: false,
|
|
|
+ render: ({ model, field }) => {
|
|
|
+ return h(
|
|
|
+ Button,
|
|
|
+ {
|
|
|
+ onClick: async () => {
|
|
|
+ if (!model[field]) {
|
|
|
+ createWarningModal({
|
|
|
+ title: '请输入手机号接受验证码',
|
|
|
+ okText: '确认',
|
|
|
+ cancelText: '取消',
|
|
|
+ okCancel: true,
|
|
|
+ okButtonProps: { loading: confirmLoading.value },
|
|
|
+ content: () => {
|
|
|
+ return h(Input, {
|
|
|
+ placeholder: '请输入手机号',
|
|
|
+ value: model['phoneNumber'],
|
|
|
+ onChange: (e) => {
|
|
|
+ model['phoneNumber'] = e.target.value;
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onOk: async () => {
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
+ if (!model['phoneNumber']) {
|
|
|
+ reject(false);
|
|
|
+ return message.error('请输入手机号');
|
|
|
+ }
|
|
|
+ confirmLoading.value = true;
|
|
|
+ const { userInfo } = storeToRefs(useUserStore());
|
|
|
+ const res = await getEsignURL({ orgCode: userInfo.value?.orgCode, phoneNumber: model['phoneNumber'] });
|
|
|
+ console.log(res);
|
|
|
+ confirmLoading.value = false;
|
|
|
+ resolve(true);
|
|
|
+ window.open(res, '_blank');
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onCancel: () => {},
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ disabled: model[field],
|
|
|
+ },
|
|
|
+ () => '去认证'
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'phoneNumber',
|
|
|
+ label: '',
|
|
|
+ component: 'RangePicker',
|
|
|
+ ifShow: false,
|
|
|
+ },
|
|
|
{
|
|
|
field: 'title1',
|
|
|
colSlot: 'title1',
|
|
|
@@ -238,8 +301,13 @@ export const formSchema: FormSchema[] = [
|
|
|
component: 'JImageUpload',
|
|
|
colProps: { xl: 12 },
|
|
|
componentProps: {
|
|
|
- isProportion: true,
|
|
|
- tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
|
|
|
+ tipText: '支持单张上传;宽高2048*2048,大小5M以内。',
|
|
|
+ beforeUpload: async (file) => {
|
|
|
+ const Verification = await getImgWidthHeight(file);
|
|
|
+ if (Verification) return Verification;
|
|
|
+ message.error('图片宽高不符合要求');
|
|
|
+ return false;
|
|
|
+ },
|
|
|
},
|
|
|
ifShow(renderCallbackParams) {
|
|
|
return renderCallbackParams.model.type == 1;
|
|
|
@@ -251,10 +319,13 @@ export const formSchema: FormSchema[] = [
|
|
|
component: 'JImageUpload',
|
|
|
colProps: { xl: 12 },
|
|
|
componentProps: {
|
|
|
- isProportion: true,
|
|
|
- tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
|
|
|
- aspectRatioW: 1,
|
|
|
- aspectRatioH: 1,
|
|
|
+ tipText: '支持单张上传;宽高2048*2048,大小5M以内。',
|
|
|
+ beforeUpload: async (file) => {
|
|
|
+ const Verification = await getImgWidthHeight(file);
|
|
|
+ if (Verification) return Verification;
|
|
|
+ message.error('图片宽高不符合要求');
|
|
|
+ return false;
|
|
|
+ },
|
|
|
},
|
|
|
ifShow(renderCallbackParams) {
|
|
|
return renderCallbackParams.model.type == 1;
|
|
|
@@ -266,10 +337,13 @@ export const formSchema: FormSchema[] = [
|
|
|
component: 'JImageUpload',
|
|
|
colProps: { xl: 12 },
|
|
|
componentProps: {
|
|
|
- isProportion: true,
|
|
|
- tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
|
|
|
- aspectRatioW: 1,
|
|
|
- aspectRatioH: 1,
|
|
|
+ beforeUpload: async (file) => {
|
|
|
+ const Verification = await getImgWidthHeight(file);
|
|
|
+ if (Verification) return Verification;
|
|
|
+ message.error('图片宽高不符合要求');
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+ tipText: '支持单张上传;宽高2048*2048,大小5M以内。',
|
|
|
},
|
|
|
ifShow(renderCallbackParams) {
|
|
|
return renderCallbackParams.model.type == 1;
|
|
|
@@ -280,10 +354,13 @@ export const formSchema: FormSchema[] = [
|
|
|
label: '图片(右)',
|
|
|
component: 'JImageUpload',
|
|
|
componentProps: {
|
|
|
- isProportion: true,
|
|
|
- tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
|
|
|
- aspectRatioW: 1,
|
|
|
- aspectRatioH: 1,
|
|
|
+ beforeUpload: async (file) => {
|
|
|
+ const Verification = await getImgWidthHeight(file);
|
|
|
+ if (Verification) return Verification;
|
|
|
+ message.error('图片宽高不符合要求');
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+ tipText: '支持单张上传;宽高2048*2048,大小5M以内。',
|
|
|
},
|
|
|
colProps: { xl: 12 },
|
|
|
ifShow(renderCallbackParams) {
|
|
|
@@ -295,10 +372,13 @@ export const formSchema: FormSchema[] = [
|
|
|
label: '图片(上)',
|
|
|
component: 'JImageUpload',
|
|
|
componentProps: {
|
|
|
- isProportion: true,
|
|
|
- tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
|
|
|
- aspectRatioW: 1,
|
|
|
- aspectRatioH: 1,
|
|
|
+ tipText: '支持单张上传;宽高2048*2048,大小5M以内。',
|
|
|
+ beforeUpload: async (file) => {
|
|
|
+ const Verification = await getImgWidthHeight(file);
|
|
|
+ if (Verification) return Verification;
|
|
|
+ message.error('图片宽高不符合要求');
|
|
|
+ return false;
|
|
|
+ },
|
|
|
},
|
|
|
colProps: { xl: 12 },
|
|
|
ifShow(renderCallbackParams) {
|
|
|
@@ -310,10 +390,13 @@ export const formSchema: FormSchema[] = [
|
|
|
label: '图片(下)',
|
|
|
component: 'JImageUpload',
|
|
|
componentProps: {
|
|
|
- isProportion: true,
|
|
|
- tipText: '支持单张上传;宽高比为1:1,大小5M以内。',
|
|
|
- aspectRatioW: 1,
|
|
|
- aspectRatioH: 1,
|
|
|
+ tipText: '支持单张上传;宽高2048*2048,大小5M以内。',
|
|
|
+ beforeUpload: async (file) => {
|
|
|
+ const Verification = await getImgWidthHeight(file);
|
|
|
+ if (Verification) return Verification;
|
|
|
+ message.error('图片宽高不符合要求');
|
|
|
+ return false;
|
|
|
+ },
|
|
|
},
|
|
|
colProps: { xl: 12 },
|
|
|
ifShow(renderCallbackParams) {
|
|
|
@@ -321,3 +404,16 @@ export const formSchema: FormSchema[] = [
|
|
|
},
|
|
|
},
|
|
|
];
|
|
|
+
|
|
|
+function getImgWidthHeight(file) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const img = new Image();
|
|
|
+ img.src = URL.createObjectURL(file);
|
|
|
+ if (!img.src) reject('找不到图片');
|
|
|
+ img.onload = () => {
|
|
|
+ const { width, height } = img;
|
|
|
+ if (width != 2048 || height != 2048) resolve(false);
|
|
|
+ resolve(true);
|
|
|
+ };
|
|
|
+ });
|
|
|
+}
|