Commit 484a0b9d by 胡悦

提交

1 parent cfc5f479
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-07-26 10:46:04 * @Date: 2024-07-26 10:46:04
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2024-07-30 11:38:59 * @LastEditTime: 2024-07-30 14:48:21
--> -->
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, nextTick, toRefs, onBeforeMount } from "vue"; import { reactive, ref, nextTick, toRefs, onBeforeMount } from "vue";
...@@ -13,7 +13,7 @@ import { req, uploadReq, uploadFile } from "../../../utils/request"; ...@@ -13,7 +13,7 @@ import { req, uploadReq, uploadFile } from "../../../utils/request";
import { getImageUrl } from "@/utils/common"; import { getImageUrl } from "@/utils/common";
import { Message } from "@arco-design/web-vue"; import { Message } from "@arco-design/web-vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import * as dayjs from "dayjs"; import dayjs from "dayjs";
let route = useRoute(); let route = useRoute();
const router = useRouter(); const router = useRouter();
let { query } = toRefs(route); let { query } = toRefs(route);
...@@ -80,6 +80,12 @@ const handleSubmit = async () => { ...@@ -80,6 +80,12 @@ const handleSubmit = async () => {
); );
if (data.pass && data.childPass.every((item: boolean) => item)) { if (data.pass && data.childPass.every((item: boolean) => item)) {
console.log("提交成功", form); console.log("提交成功", form);
let timeDifference = true
if (form.systemPublishTime) {
timeDifference = dayjs(form.systemPublishTime).diff(dayjs(), 'minute') > 5
}
if (!timeDifference) return Message.error('定时发布时间需设置于5分钟后')
// return timeDifference > 5;
const invnoticeProductList = getParams(); const invnoticeProductList = getParams();
if (query.value.id) { if (query.value.id) {
const res = await req("gw.api.invnotice.updateInvnoticeProduct", { const res = await req("gw.api.invnotice.updateInvnoticeProduct", {
...@@ -88,13 +94,20 @@ const handleSubmit = async () => { ...@@ -88,13 +94,20 @@ const handleSubmit = async () => {
if (res) { if (res) {
Message.success("修改成功"); Message.success("修改成功");
router.back(); router.back();
} else {
Message.error("修改失败");
} }
} else { } else {
const res = await req("gw.api.invnotice.addInvnoticeProduct", { const res = await req("gw.api.invnotice.addInvnoticeProduct", {
invnoticeProductList, invnoticeProductList,
}); });
console.log(res); console.log(res);
if (res) Message.success("新增成功"); if (res) {
Message.success("新增成功");
router.back();
} else {
Message.error("新增失败");
}
} }
} }
}); });
...@@ -349,6 +362,7 @@ const onBeforeRemove = (fileItem: FileItem, modelName: string) => { ...@@ -349,6 +362,7 @@ const onBeforeRemove = (fileItem: FileItem, modelName: string) => {
<a-date-picker <a-date-picker
:style="{ width }" :style="{ width }"
v-model="form.systemPublishTime" v-model="form.systemPublishTime"
:disabled-date="(current: Date) => dayjs(current).isBefore(dayjs().startOf('day'), 'day')"
show-time show-time
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
/> />
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-07-23 16:43:07 * @Date: 2024-07-23 16:43:07
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2024-07-29 16:57:27 * @LastEditTime: 2024-07-30 15:02:38
--> -->
<!-- <!--
* @Description: * @Description:
...@@ -141,10 +141,29 @@ const changeSize = (size: number) => { ...@@ -141,10 +141,29 @@ const changeSize = (size: number) => {
getTableData() getTableData()
} }
/** 操作类 */ /** 操作类 */
const publish = (record: Partial<TableItem>) => { const publishOrDown = async(record: Partial<TableItem>) => {
const { id, systemPublishStatus } = record
const res = await req("gw.api.invnotice.updateStatus", {
id,
systemPublishStatus: systemPublishStatus === 3 ? 1 : 3
})
getTableData()
} }
const down = (record: Partial<TableItem>) => { const publish = async(record: Partial<TableItem>) => {
const { id } = record
const res = await req("gw.api.invnotice.updateStatus", {
id,
systemPublishStatus: 3
})
getTableData()
}
const down = async(record: Partial<TableItem>) => {
const { id } = record
const res = await req("gw.api.invnotice.updateStatus", {
id,
systemPublishStatus: 1
})
getTableData()
} }
const edit = (record: Partial<TableItem>) => { const edit = (record: Partial<TableItem>) => {
router.push({ router.push({
...@@ -194,8 +213,12 @@ getTableData() ...@@ -194,8 +213,12 @@ getTableData()
</a-tabs> </a-tabs>
<a-table :columns="columns" :data="data.tableData" row-key="id" :expandable="expandable" :pagination="false" :bordered="false"> <a-table :columns="columns" :data="data.tableData" row-key="id" :expandable="expandable" :pagination="false" :bordered="false">
<template #operation="{ record }"> <template #operation="{ record }">
<a-button type="text" @click="publish(record)" v-if="record.systemPublishStatus === 1 || record.systemPublishStatus === 2">发布</a-button> <a-popconfirm :content="`是否确认${record.systemPublishStatus === 3 ? '下架' : '发布'}`" @ok="publishOrDown(record)">
<a-button type="text" @click="down(record)" v-if="record.systemPublishStatus === 3">下架</a-button> <!-- <a-button type="text" v-if="record.systemPublishStatus === 1 || record.systemPublishStatus === 2">发布</a-button> -->
<a-button type="text" v-if="record.systemPublishStatus === 3">下架</a-button>
</a-popconfirm>
<a-button type="text" @click="edit(record)" v-if="record.systemPublishStatus === 1 || record.systemPublishStatus === 2">编辑</a-button> <a-button type="text" @click="edit(record)" v-if="record.systemPublishStatus === 1 || record.systemPublishStatus === 2">编辑</a-button>
<a-button type="text" @click="previewOA(record)">OA截图</a-button> <a-button type="text" @click="previewOA(record)">OA截图</a-button>
<a-image-preview <a-image-preview
......
...@@ -33,4 +33,5 @@ export interface TableItem { ...@@ -33,4 +33,5 @@ export interface TableItem {
externalReleaseDate: String; externalReleaseDate: String;
zhTag: String; zhTag: String;
oaScreenshotUrl: String; oaScreenshotUrl: String;
systemPublishStatus: Number;
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-07-23 16:28:15 * @Date: 2024-07-23 16:28:15
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2024-07-26 10:25:00 * @LastEditTime: 2024-07-30 15:18:44
--> -->
<script lang="ts" setup> <script lang="ts" setup>
import {ref, reactive} from 'vue' import {ref, reactive} from 'vue'
...@@ -24,6 +24,22 @@ const userInfo = reactive({ ...@@ -24,6 +24,22 @@ const userInfo = reactive({
username: 'admin', username: 'admin',
password: '@32%weGL' password: '@32%weGL'
}) })
const usernameValidator = (value: string | undefined, callback: (error?: string) => void) => {
const rule = /^[\w\.\-]{5,20}$/
if (value && !rule.test(value)) {
callback(new Error())
} else {
callback()
}
}
const passwordValidator = (value: string | undefined, callback: (error?: string) => void) => {
const rule = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*])[\w!@#$%^&*]{6,20}$/
if (value && !rule.test(value)) {
callback(new Error())
} else {
}
}
/** /**
* 方法定义 * 方法定义
*/ */
...@@ -56,17 +72,19 @@ const handleLogin = ({values, errors}: { ...@@ -56,17 +72,19 @@ const handleLogin = ({values, errors}: {
<div class="right"> <div class="right">
<div class="title">广联官网管理平台</div> <div class="title">广联官网管理平台</div>
<a-form size="large" :model="userInfo" :style="{ width: '374px' }" @submit="handleLogin"> <a-form size="large" :model="userInfo" :style="{ width: '374px' }" @submit="handleLogin">
<a-form-item field="username" hide-label :rules="[{ required: true, message: '请输入用户名'}]" <a-form-item field="username" max-length="20" hide-label :rules="[{ required: true, message: '请输入用户名' },
{ validator: usernameValidator, message: '用户名必须是5-20个字符,包含字母、数字、下划线和点' }]"
:validate-trigger="['change', 'blur']"> :validate-trigger="['change', 'blur']">
<a-input v-model="userInfo.username" class="input" placeholder="用户名" allow-clear> <a-input v-model="userInfo.username" :max-length="20" class="input" placeholder="用户名" allow-clear>
<template #prefix> <template #prefix>
<icon-user /> <icon-user />
</template> </template>
</a-input> </a-input>
</a-form-item> </a-form-item>
<a-form-item field="password" hide-label :rules="[{ required: true, message: '请输入密码' }]" <a-form-item field="password" hide-label :rules="[{ required: true, message: '请输入密码' },
{ validator: passwordValidator, message: '用户名必须是6-20个字符,包含字母、数字和特殊字符' }]"
:validate-trigger="['change', 'blur']"> :validate-trigger="['change', 'blur']">
<a-input-password v-model="userInfo.password" class="input" placeholder="密码" allow-clear> <a-input-password v-model="userInfo.password" :max-length="20" class="input" placeholder="密码" allow-clear>
<template #prefix> <template #prefix>
<icon-lock /> <icon-lock />
</template> </template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!