【更新】更新前端部分代码的换行格式

pull/256/MERGE
俞宝山 2025-05-13 00:30:46 +08:00
parent 17da615cea
commit d8bf602f74
3 changed files with 43 additions and 39 deletions

View File

@ -61,7 +61,7 @@
</a-upload> </a-upload>
<!-- 文件预览 --> <!-- 文件预览 -->
<a-modal :open="previewVisible" :title="previewTitle" :footer="null" :destroyOnClose="true" @cancel="handleCancel"> <a-modal :open="previewVisible" :title="previewTitle" :footer="null" :destroyOnClose="true" @cancel="handleCancel">
<template v-if="props.uploadMode === 'image'"> <template v-if="props.uploadMode === 'image'">
<img alt="example" style="width: 100%" :src="previewObj" /> <img alt="example" style="width: 100%" :src="previewObj" />
</template> </template>
@ -70,13 +70,11 @@
<source :src="previewObj" type="video/mp4" /> <source :src="previewObj" type="video/mp4" />
<object :data="previewObj" width="100%"> <object :data="previewObj" width="100%">
<embed :src="previewObj" width="100%" /> <embed :src="previewObj" width="100%" />
</object> </object>
您的浏览器不支持video标签哦请联系管理员 您的浏览器不支持video标签哦请联系管理员
</video> </video>
</template>
<template v-else>
暂不支持该文件预览
</template> </template>
<template v-else> </template>
</a-modal> </a-modal>
<a-upload-dragger <a-upload-dragger
@ -305,8 +303,7 @@
message.warning('只能上传图片类型文件') message.warning('只能上传图片类型文件')
} }
return isPNG || Upload.LIST_IGNORE return isPNG || Upload.LIST_IGNORE
} } else if (props.uploadMode == 'video') {
else if (props.uploadMode == 'video') {
const isVideo = file.type.startsWith('video/') const isVideo = file.type.startsWith('video/')
if (!isVideo) { if (!isVideo) {
message.warning('只能上传视频类型文件') message.warning('只能上传视频类型文件')
@ -348,7 +345,7 @@
data.response.data + (resultIntervalValue.value ? ',' + resultIntervalValue.value : '') data.response.data + (resultIntervalValue.value ? ',' + resultIntervalValue.value : '')
}) })
emit('update:value', resultIntervalValue) emit('update:value', resultIntervalValue)
emit('onSuccessful',resultIntervalValue) emit('onSuccessful', resultIntervalValue)
emit('onChange', resultIntervalValue) emit('onChange', resultIntervalValue)
} else if (props.uploadResultCategory === 'array') { } else if (props.uploadResultCategory === 'array') {
if (props.completeResult) { if (props.completeResult) {
@ -360,16 +357,15 @@
} }
}) })
emit('update:value', newResult) emit('update:value', newResult)
emit('onSuccessful',newResult) emit('onSuccessful', newResult)
emit('onChange', newResult) emit('onChange', newResult)
} } else {
else {
const resultArrayValue = ref([]) const resultArrayValue = ref([])
result.forEach((data) => { result.forEach((data) => {
resultArrayValue.value.push(data.response.data) resultArrayValue.value.push(data.response.data)
}) })
emit('update:value', resultArrayValue) emit('update:value', resultArrayValue)
emit('onSuccessful',resultArrayValue) emit('onSuccessful', resultArrayValue)
emit('onChange', resultArrayValue) emit('onChange', resultArrayValue)
} }
} }

View File

@ -179,39 +179,41 @@ tool.generateString = (length = 8) => {
tool.parseTime = (time, cFormat) => { tool.parseTime = (time, cFormat) => {
if (time == null || time.length === 0) { if (time == null || time.length === 0) {
return '' return ''
} }
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date let date
if (typeof time === 'object') { if (typeof time === 'object') {
date = time date = time
} else { } else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { if (typeof time === 'string' && /^[0-9]+$/.test(time)) {
time = parseInt(time) time = parseInt(time)
} }
if ((typeof time === 'number') && (time.toString().length === 10)) { if (typeof time === 'number' && time.toString().length === 10) {
time = time * 1000 time = time * 1000
} }
date = new Date(time) date = new Date(time)
} }
const formatObj = { const formatObj = {
y: date.getFullYear(), y: date.getFullYear(),
m: date.getMonth() + 1, m: date.getMonth() + 1,
d: date.getDate(), d: date.getDate(),
h: date.getHours(), h: date.getHours(),
i: date.getMinutes(), i: date.getMinutes(),
s: date.getSeconds(), s: date.getSeconds(),
a: date.getDay() a: date.getDay()
} }
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key] let value = formatObj[key]
// Note: getDay() returns 0 on Sunday // Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] } if (key === 'a') {
if (result.length > 0 && value < 10) { return ['日', '一', '二', '三', '四', '五', '六'][value]
value = '0' + value }
} if (result.length > 0 && value < 10) {
return value || 0 value = '0' + value
}
return value || 0
}) })
return time_str return time_str
} }

View File

@ -14,7 +14,13 @@
<a-textarea v-model:value="formData.remark" placeholder="请输入备注" :auto-size="{ minRows: 3, maxRows: 5 }" /> <a-textarea v-model:value="formData.remark" placeholder="请输入备注" :auto-size="{ minRows: 3, maxRows: 5 }" />
</a-form-item> </a-form-item>
<a-form-item label="排序码:" name="sortCode"> <a-form-item label="排序码:" name="sortCode">
<a-input-number v-model:value="formData.sortCode" placeholder="请输入排序码" :min="1" :max="10000" style="width: 100%" /> <a-input-number
v-model:value="formData.sortCode"
placeholder="请输入排序码"
:min="1"
:max="10000"
style="width: 100%"
/>
</a-form-item> </a-form-item>
</a-form> </a-form>
<template #footer> <template #footer>
@ -53,7 +59,7 @@
// //
const formRules = { const formRules = {
name: [required('请输入名称')], name: [required('请输入名称')],
sortCode: [required('请输入排序码')], sortCode: [required('请输入排序码')]
} }
// //
const onSubmit = () => { const onSubmit = () => {