|
@@ -2,22 +2,19 @@
|
|
<BasicModal
|
|
<BasicModal
|
|
v-bind="$attrs"
|
|
v-bind="$attrs"
|
|
@register="register"
|
|
@register="register"
|
|
|
|
+ title="编辑"
|
|
:confirmLoading="loading"
|
|
:confirmLoading="loading"
|
|
- title="编辑版本"
|
|
|
|
@visible-change="handleVisibleChange"
|
|
@visible-change="handleVisibleChange"
|
|
@cancel="resetFields"
|
|
@cancel="resetFields"
|
|
|
|
+ :width="550"
|
|
|
|
+ :min-height="680"
|
|
@ok="handleSubmit"
|
|
@ok="handleSubmit"
|
|
>
|
|
>
|
|
- <div class="pt-2px pr-3px">
|
|
|
|
|
|
+ <div class="pt-2px pr-3px" style="width:600px">
|
|
<BasicForm @register="registerForm" :model="model" >
|
|
<BasicForm @register="registerForm" :model="model" >
|
|
<template #text="{ model, field }">
|
|
<template #text="{ model, field }">
|
|
{{ model[field] }}
|
|
{{ model[field] }}
|
|
</template>
|
|
</template>
|
|
- <template #Checkbox="{ model, field }">
|
|
|
|
- <div>
|
|
|
|
- <Checkbox v-model:checked="model[field]">(勾选此项,将在四维看看官网置顶)</Checkbox>
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
</BasicForm>
|
|
</BasicForm>
|
|
</div>
|
|
</div>
|
|
</BasicModal>
|
|
</BasicModal>
|
|
@@ -26,15 +23,14 @@
|
|
import { defineComponent, ref, nextTick, onMounted, reactive } from 'vue';
|
|
import { defineComponent, ref, nextTick, onMounted, reactive } from 'vue';
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
- import { Checkbox } from 'ant-design-vue';
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
|
+ import { uploadApi, tipUpdata } from '/@/api/product/index';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
- import { uploadApi, SpaceSdkUpdate } from '/@/api/product/index';
|
|
|
|
|
|
+ import dayjs from 'dayjs';
|
|
import { isEmojiCharacter } from '/@/utils';
|
|
import { isEmojiCharacter } from '/@/utils';
|
|
-
|
|
|
|
const { t } = useI18n();
|
|
const { t } = useI18n();
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
- components: { BasicModal, BasicForm, Checkbox },
|
|
|
|
|
|
+ components: { BasicModal, BasicForm },
|
|
props: {
|
|
props: {
|
|
userData: { type: Object },
|
|
userData: { type: Object },
|
|
},
|
|
},
|
|
@@ -43,50 +39,81 @@
|
|
const modelRef = ref({});
|
|
const modelRef = ref({});
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
const fileFlow = reactive({
|
|
const fileFlow = reactive({
|
|
- file:null
|
|
|
|
|
|
+ type:null
|
|
})
|
|
})
|
|
const { createMessage } = useMessage();
|
|
const { createMessage } = useMessage();
|
|
const schemas: FormSchema[] = [
|
|
const schemas: FormSchema[] = [
|
|
{
|
|
{
|
|
- field: 'fileUrl',
|
|
|
|
- component: 'Input',
|
|
|
|
- label: t('routes.product.types'),
|
|
|
|
- show: false,
|
|
|
|
- colProps: {
|
|
|
|
- span: 24,
|
|
|
|
- },
|
|
|
|
- },{
|
|
|
|
field: 'id',
|
|
field: 'id',
|
|
component: 'Input',
|
|
component: 'Input',
|
|
- label: t('routes.product.types'),
|
|
|
|
|
|
+ label: 'id',
|
|
show: false,
|
|
show: false,
|
|
- colProps: {
|
|
|
|
- span: 24,
|
|
|
|
- },
|
|
|
|
- },{
|
|
|
|
- field: 'platformType',
|
|
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'version',
|
|
component: 'Input',
|
|
component: 'Input',
|
|
- label: t('routes.product.types'),
|
|
|
|
- show: false,
|
|
|
|
|
|
+ label: '版本号',
|
|
|
|
+ required: true,
|
|
|
|
+ componentProps: {
|
|
|
|
+ maxLength: 15,
|
|
|
|
+ },
|
|
colProps: {
|
|
colProps: {
|
|
- span: 24,
|
|
|
|
|
|
+ span: 20,
|
|
},
|
|
},
|
|
},{
|
|
},{
|
|
- field: 'type',
|
|
|
|
|
|
+ field: 'timeList',
|
|
|
|
+ label: '提示时段',
|
|
|
|
+ component: 'RangePicker',
|
|
|
|
+ required: true,
|
|
|
|
+ componentProps: {
|
|
|
|
+ format: 'YYYY-MM-DD',
|
|
|
|
+ valueFormat:'YYYY-MM-DD',
|
|
|
|
+ width:100,
|
|
|
|
+ },
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 20,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'title',
|
|
component: 'Input',
|
|
component: 'Input',
|
|
- label: t('routes.product.types'),
|
|
|
|
- slot: 'text',
|
|
|
|
|
|
+ label: '中文标题',
|
|
|
|
+ required: true,
|
|
colProps: {
|
|
colProps: {
|
|
- span: 24,
|
|
|
|
|
|
+ span: 20,
|
|
|
|
+ },
|
|
|
|
+ rules: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ validator: async (rule, value) => {
|
|
|
|
+ if (!value?.trim()) {
|
|
|
|
+ return Promise.reject(t('common.inputText')+'中文标题');
|
|
|
|
+ }
|
|
|
|
+ if(/.*[\u4e00-\u9fa5]+.*$/.test(value)){
|
|
|
|
+ /* eslint-disable-next-line */
|
|
|
|
+ return Promise.reject('不支持中文字符');
|
|
|
|
+ }
|
|
|
|
+ if(isEmojiCharacter(value)){
|
|
|
|
+ /* eslint-disable-next-line */
|
|
|
|
+ return Promise.reject('不支持emoji表情');
|
|
|
|
+ }
|
|
|
|
+ return Promise.resolve();
|
|
|
|
+ },
|
|
|
|
+ trigger: 'change',
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ componentProps: {
|
|
|
|
+ maxLength: 50,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- field: 'version',
|
|
|
|
|
|
+ field: 'titleEn',
|
|
component: 'Input',
|
|
component: 'Input',
|
|
- label: t('routes.product.version'),
|
|
|
|
|
|
+ label: '英文标题',
|
|
required: true,
|
|
required: true,
|
|
colProps: {
|
|
colProps: {
|
|
- span: 24,
|
|
|
|
|
|
+ span: 20,
|
|
},
|
|
},
|
|
rules: [
|
|
rules: [
|
|
{
|
|
{
|
|
@@ -94,7 +121,7 @@
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
validator: async (rule, value) => {
|
|
validator: async (rule, value) => {
|
|
if (!value?.trim()) {
|
|
if (!value?.trim()) {
|
|
- return Promise.reject(t('common.inputText')+t('routes.product.version'));
|
|
|
|
|
|
+ return Promise.reject(t('common.inputText')+'英文标题');
|
|
}
|
|
}
|
|
if(/.*[\u4e00-\u9fa5]+.*$/.test(value)){
|
|
if(/.*[\u4e00-\u9fa5]+.*$/.test(value)){
|
|
/* eslint-disable-next-line */
|
|
/* eslint-disable-next-line */
|
|
@@ -110,49 +137,117 @@
|
|
},
|
|
},
|
|
],
|
|
],
|
|
componentProps: {
|
|
componentProps: {
|
|
- disabled:true,
|
|
|
|
- maxLength: 15,
|
|
|
|
- onChange: (data) => {
|
|
|
|
- console.log('data', data);
|
|
|
|
- },
|
|
|
|
|
|
+ maxLength: 50,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- field: 'imprintCh',
|
|
|
|
|
|
+ field: 'description',
|
|
component: 'InputTextArea',
|
|
component: 'InputTextArea',
|
|
- // required: true,
|
|
|
|
|
|
+ required: true,
|
|
label: t('routes.product.description_zh'),
|
|
label: t('routes.product.description_zh'),
|
|
componentProps: {
|
|
componentProps: {
|
|
rows:4,
|
|
rows:4,
|
|
|
|
+ maxLength:500,
|
|
},
|
|
},
|
|
colProps: {
|
|
colProps: {
|
|
- span: 24,
|
|
|
|
|
|
+ span: 20,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- field: 'imprintEn',
|
|
|
|
|
|
+ field: 'descriptionEn',
|
|
component: 'InputTextArea',
|
|
component: 'InputTextArea',
|
|
- // required: true,
|
|
|
|
|
|
+ required: true,
|
|
label: t('routes.product.description_en'),
|
|
label: t('routes.product.description_en'),
|
|
componentProps: {
|
|
componentProps: {
|
|
rows:4,
|
|
rows:4,
|
|
|
|
+ maxLength:500,
|
|
},
|
|
},
|
|
colProps: {
|
|
colProps: {
|
|
- span: 24,
|
|
|
|
|
|
+ span: 20,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- field: 'isTop',
|
|
|
|
- component: 'CheckboxGroup',
|
|
|
|
- label: '官网置顶',
|
|
|
|
- slot:'Checkbox',
|
|
|
|
|
|
+ field: 'imageUrl',
|
|
|
|
+ component: 'Upload',
|
|
|
|
+ label: '中文图片/视频',
|
|
|
|
+ // helpMessage: t('routes.corporation.uploadHelp'),
|
|
|
|
+ itemProps: {
|
|
|
|
+ validateTrigger: 'onBlur',
|
|
|
|
+ },
|
|
componentProps: {
|
|
componentProps: {
|
|
- options: [
|
|
|
|
- { label: '(勾选此项,将在四维看看官网置顶)', value: 1 },
|
|
|
|
- ],
|
|
|
|
|
|
+ api: uploadApi,
|
|
|
|
+ maxNumber: 1,
|
|
|
|
+ maxSize: 1000,
|
|
|
|
+ accept: ['jpeg','jpg','png','mp4'],
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 20,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'imageUrlEn',
|
|
|
|
+ component: 'Upload',
|
|
|
|
+ label: '英文图片/视频',
|
|
|
|
+ // helpMessage: t('routes.corporation.uploadHelp'),
|
|
|
|
+ itemProps: {
|
|
|
|
+ validateTrigger: 'onBlur',
|
|
|
|
+ },
|
|
|
|
+ componentProps: {
|
|
|
|
+ api: uploadApi,
|
|
|
|
+ maxNumber: 1,
|
|
|
|
+ maxSize: 1000,
|
|
|
|
+ accept: ['jpeg','jpg','png','mp4'],
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 20,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'infoUrl',
|
|
|
|
+ component: 'Input',
|
|
|
|
+ required: true,
|
|
|
|
+ label: '中文详情链接',
|
|
|
|
+ rules: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ validator: async (rule, value) => {
|
|
|
|
+ var reg=/(http|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#\u4e00-\u9fa5]*[\w\-\@?^=%&/~\+#])/;
|
|
|
|
+ if (!reg.test(value)) {
|
|
|
|
+ return Promise.reject(t('common.inputText')+'正确的地址');
|
|
|
|
+ }
|
|
|
|
+ return Promise.resolve();
|
|
|
|
+ },
|
|
|
|
+ trigger: 'change',
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ colProps: {
|
|
|
|
+ span: 20,
|
|
},
|
|
},
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ field: 'infoUrlEn',
|
|
|
|
+ component: 'Input',
|
|
|
|
+ required: true,
|
|
|
|
+ label: '英文详情链接',
|
|
|
|
+ rules: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ validator: async (rule, value) => {
|
|
|
|
+ var reg=/(http|https):\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#\u4e00-\u9fa5]*[\w\-\@?^=%&/~\+#])/;
|
|
|
|
+ if (!reg.test(value)) {
|
|
|
|
+ return Promise.reject(t('common.inputText')+'正确的地址');
|
|
|
|
+ }
|
|
|
|
+ return Promise.resolve();
|
|
|
|
+ },
|
|
|
|
+ trigger: 'change',
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
colProps: {
|
|
colProps: {
|
|
- span: 24,
|
|
|
|
|
|
+ span: 20,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
];
|
|
];
|
|
@@ -167,7 +262,6 @@
|
|
onMounted(() => {});
|
|
onMounted(() => {});
|
|
let addListFunc = () => {};
|
|
let addListFunc = () => {};
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
const [register, { closeModal }] = useModalInner((data) => {
|
|
- console.log('useModalInner',data)
|
|
|
|
data && onDataReceive(data);
|
|
data && onDataReceive(data);
|
|
});
|
|
});
|
|
function renderOwnTypeLabel(type: number): string {
|
|
function renderOwnTypeLabel(type: number): string {
|
|
@@ -199,27 +293,28 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function onDataReceive(data) {
|
|
function onDataReceive(data) {
|
|
- modelRef.value = data
|
|
|
|
- let setData = {
|
|
|
|
- ...data,
|
|
|
|
- type:renderOwnTypeLabel(Number(data.type)),
|
|
|
|
- }
|
|
|
|
- console.log('onDataReceive',data,setData)
|
|
|
|
|
|
+ fileFlow.type = data.type
|
|
|
|
+ console.log('onDataReceive',data)
|
|
resetFields();
|
|
resetFields();
|
|
- setFieldsValue(setData);
|
|
|
|
|
|
+ setFieldsValue({
|
|
|
|
+ ...data,
|
|
|
|
+ imageUrl:data.imageUrl?[data.imageUrl]:[],
|
|
|
|
+ imageUrlEn:data.imageUrlEn?[data.imageUrlEn]:[],
|
|
|
|
+ });
|
|
}
|
|
}
|
|
const handleSubmit = async () => {
|
|
const handleSubmit = async () => {
|
|
loading.value = true
|
|
loading.value = true
|
|
try {
|
|
try {
|
|
const params = await validate();
|
|
const params = await validate();
|
|
- console.log('modelRef',params)
|
|
|
|
const apiData = {
|
|
const apiData = {
|
|
- // ...modelRef.value,
|
|
|
|
- ...params as any,
|
|
|
|
- isTop:params.isTop?1:0
|
|
|
|
|
|
+ ...params,
|
|
|
|
+ type:fileFlow.type,
|
|
|
|
+ timeList:params.timeList.map(ele => dayjs(ele).format('YYYY-MM-DD')),
|
|
|
|
+ imageUrl:params.imageUrl?.[0],
|
|
|
|
+ imageUrlEn:params.imageUrlEn?.[0],
|
|
}
|
|
}
|
|
console.log('res', apiData);
|
|
console.log('res', apiData);
|
|
- const res = await SpaceSdkUpdate(apiData);
|
|
|
|
|
|
+ const res = await tipUpdata(apiData);
|
|
console.log('res', res);
|
|
console.log('res', res);
|
|
closeModal();
|
|
closeModal();
|
|
resetFields();
|
|
resetFields();
|
|
@@ -244,11 +339,16 @@
|
|
fileFlow,
|
|
fileFlow,
|
|
handleVisibleChange,
|
|
handleVisibleChange,
|
|
handleSubmit,
|
|
handleSubmit,
|
|
|
|
+ loading,
|
|
addListFunc,
|
|
addListFunc,
|
|
resetFields,
|
|
resetFields,
|
|
- loading,
|
|
|
|
t,
|
|
t,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
});
|
|
});
|
|
</script>
|
|
</script>
|
|
|
|
+<style lang="less">
|
|
|
|
+.ant-calendar-picker-input.ant-input{
|
|
|
|
+ width: 300px;
|
|
|
|
+}
|
|
|
|
+</style>
|