完成首发
15
.editorconfig
Normal file
@ -0,0 +1,15 @@
|
||||
# @see: http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*] # 表示所有文件适用
|
||||
charset = utf-8 # 设置文件字符集为 utf-8
|
||||
end_of_line = lf # 控制换行类型(lf | cr | crlf)
|
||||
insert_final_newline = true # 始终在文件末尾插入一个新行
|
||||
indent_style = space # 缩进风格[tab | space]
|
||||
indent_size = 2 # 缩进大小
|
||||
max_line_length = 130 # 最大行长度
|
||||
|
||||
[*.md] # 表示仅对 md 文件适用以下规则
|
||||
max_line_length = off # 关闭最大行长度限制
|
||||
trim_trailing_whitespace = false # 关闭末尾空格修剪
|
13
.env.development
Normal file
@ -0,0 +1,13 @@
|
||||
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
|
||||
VITE_ENV = 'development'
|
||||
VITE_WEB_TITLE = '今日固始电子版'
|
||||
VITE_WEB_EN_TITLE = 'GUSHI-NEWSPAPER'
|
||||
VITE_LOGIN_TITLE = '今日固始电子版 管理平台'
|
||||
VITE_LOGIN_EN_TITLE = 'GuShi Platform'
|
||||
VITE_WEB_BASE_API = '/api'
|
||||
# 本地Mock地址
|
||||
VITE_SERVER = 'https://jinrigushitwo.gushitv.com/'
|
||||
# 路由模式[哈希模式 AND WEB模式 [hash | history, 这两个模式是固定死的,不能乱改值]
|
||||
VITE_ROUTER_MODE = hash
|
||||
# 是否使用全部去除console和debugger
|
||||
VITE_DROP_CONSOLE = false
|
13
.env.production
Normal file
@ -0,0 +1,13 @@
|
||||
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
|
||||
VITE_ENV = 'production'
|
||||
VITE_WEB_TITLE = '今日固始电子版'
|
||||
VITE_WEB_EN_TITLE = 'GUSHI-NEWSPAPER'
|
||||
VITE_LOGIN_TITLE = '今日固始电子版 管理平台'
|
||||
VITE_LOGIN_EN_TITLE = 'GuShi Platform'
|
||||
VITE_WEB_BASE_API = ''
|
||||
# 后端接口地址
|
||||
VITE_SERVER = 'https://jinrigushitwo.gushitv.com/'
|
||||
# 路由模式[哈希模式 AND WEB模式 [hash | history, 这两个模式是固定死的,不能乱改值]
|
||||
VITE_ROUTER_MODE = hash
|
||||
# 是否使用全部去除console和debugger
|
||||
VITE_DROP_CONSOLE = true
|
15
.eslintignore
Normal file
@ -0,0 +1,15 @@
|
||||
*.sh
|
||||
node_modules
|
||||
*.md
|
||||
*.woff
|
||||
*.ttf
|
||||
.vscode
|
||||
.idea
|
||||
dist
|
||||
/public
|
||||
/docs
|
||||
.husky
|
||||
.local
|
||||
/bin
|
||||
/src/mock/*
|
||||
stats.html
|
61
.eslintrc.cjs
Normal file
@ -0,0 +1,61 @@
|
||||
// @see: http://eslint.cn
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
es6: true
|
||||
},
|
||||
// 指定如何解析语法
|
||||
parser: "vue-eslint-parser",
|
||||
// 优先级低于 parse 的语法解析配置
|
||||
parserOptions: {
|
||||
parser: "@typescript-eslint/parser",
|
||||
ecmaVersion: 2020,
|
||||
sourceType: "module",
|
||||
jsxPragma: "React",
|
||||
ecmaFeatures: {
|
||||
jsx: true
|
||||
}
|
||||
},
|
||||
// 继承某些已有的规则
|
||||
extends: ["plugin:vue/vue3-recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
|
||||
/**
|
||||
* "off" 或 0 ==> 关闭规则
|
||||
* "warn" 或 1 ==> 打开的规则作为警告[不影响代码执行]
|
||||
* "error" 或 2 ==> 规则作为一个错误[代码不能执行,界面报错]
|
||||
*/
|
||||
rules: {
|
||||
// eslint (http://eslint.cn/docs/rules)
|
||||
"no-var": "error", // 要求使用 let 或 const 而不是 var
|
||||
"no-multiple-empty-lines": ["error", { max: 1 }], // 不允许多个空行
|
||||
"prefer-const": "off", // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const
|
||||
"no-use-before-define": "off", // 禁止在 函数/类/变量 定义之前使用它们
|
||||
|
||||
// typeScript (https://typescript-eslint.io/rules)
|
||||
"@typescript-eslint/no-unused-vars": "error", // 禁止定义未使用的变量
|
||||
"@typescript-eslint/no-empty-function": "error", // 禁止空函数
|
||||
"@typescript-eslint/prefer-ts-expect-error": "error", // 禁止使用 @ts-ignore
|
||||
"@typescript-eslint/ban-ts-comment": "error", // 禁止 @ts-<directive> 使用注释或要求在指令后进行描述
|
||||
"@typescript-eslint/no-inferrable-types": "off", // 可以轻松推断的显式类型可能会增加不必要的冗长
|
||||
"@typescript-eslint/no-namespace": "off", // 禁止使用自定义 TypeScript 模块和命名空间
|
||||
"@typescript-eslint/no-explicit-any": "off", // 禁止使用 any 类型
|
||||
"@typescript-eslint/ban-types": "off", // 禁止使用特定类型
|
||||
"@typescript-eslint/no-var-requires": "off", // 允许使用 require() 函数导入模块
|
||||
"@typescript-eslint/no-non-null-assertion": "off", // 不允许使用后缀运算符的非空断言(!)
|
||||
|
||||
// vue (https://eslint.vuejs.org/rules)
|
||||
"vue/script-setup-uses-vars": "error", // 防止<script setup>使用的变量<template>被标记为未使用,此规则仅在启用该 no-unused-vars 规则时有效
|
||||
"vue/v-slot-style": "error", // 强制执行 v-slot 指令样式
|
||||
"vue/no-mutating-props": "error", // 不允许改变组件 prop
|
||||
"vue/custom-event-name-casing": "error", // 为自定义事件名称强制使用特定大小写
|
||||
"vue/html-closing-bracket-newline": "error", // 在标签的右括号之前要求或禁止换行
|
||||
"vue/attribute-hyphenation": "error", // 对模板中的自定义组件强制执行属性命名样式:my-prop="prop"
|
||||
"vue/attributes-order": "off", // vue api使用顺序,强制执行属性顺序
|
||||
"vue/no-v-html": "off", // 禁止使用 v-html
|
||||
"vue/require-default-prop": "off", // 此规则要求为每个 prop 为必填时,必须提供默认值
|
||||
"vue/multi-word-component-names": "off", // 要求组件名称始终为 “-” 链接的单词
|
||||
"vue/no-setup-props-destructure": "off" // 禁止解构 props 传递给 setup
|
||||
}
|
||||
};
|
14
.eslintrc.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:vue/vue3-essential"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint", "vue"],
|
||||
"rules": {}
|
||||
}
|
25
.gitignore
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
352
.history/src/components/KoiUpload/Files_20241218172222.vue
Normal file
@ -0,0 +1,352 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 注意:只能通过 on-change 钩子函数来对上传文件的列表进行控制。 -->
|
||||
<el-upload
|
||||
:file-list="fileList"
|
||||
:multiple="props.isMultiple"
|
||||
:limit="props.limit"
|
||||
:accept="props.acceptType"
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
:disabled="disabled"
|
||||
:on-exceed="handleExceed"
|
||||
:on-change="handleChange"
|
||||
:folderName="folderName"
|
||||
:fileParam="fileParam"
|
||||
>
|
||||
<div class="el-upload-text hover:bg-[--el-color-primary-light-9]">
|
||||
<el-icon size="16"><Upload /></el-icon>
|
||||
<span>上传文件</span>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div style="margin-top: 6px">
|
||||
<div
|
||||
class="template-file text-#555 m-t-2px rounded-6px dark:text-#CFD3DC hover:bg-[--el-color-primary-light-9]"
|
||||
v-for="item in fileList"
|
||||
:key="item.url"
|
||||
>
|
||||
<el-icon size="16" style="margin-right: 5px"><Link /></el-icon>
|
||||
<el-tooltip :content="item.name" placement="top">
|
||||
<div class="document-name hover:text-[--el-color-primary]">{{ item.name }}</div>
|
||||
</el-tooltip>
|
||||
<el-icon class="hover:text-[--el-color-primary]" v-if="!props.disabled" size="16" @click="handleRemove(item.url)">
|
||||
<Close />
|
||||
</el-icon>
|
||||
<!-- 默认不显示下载 -->
|
||||
<el-icon
|
||||
v-if="isDownload"
|
||||
class="p-l-5px hover:text-[--el-color-primary]"
|
||||
size="16"
|
||||
@click="handleDownLoad(item.url, item.name)"
|
||||
><Download
|
||||
/></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<span class="file-tips">
|
||||
<slot name="tip">
|
||||
支持{{ acceptTypes }};
|
||||
<div class="h-20px"></div>
|
||||
文件大小不能超过{{ props.fileSize }}M;最多上传{{ props.limit }}个;
|
||||
</slot>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch, inject } from "vue";
|
||||
import { ElLoading, formContextKey, formItemContextKey } from "element-plus";
|
||||
import { koiNoticeSuccess, koiNoticeError, koiMsgWarning, koiMsgError } from "@/utils/koi.ts";
|
||||
import koi from "@/utils/axios.ts";
|
||||
|
||||
const emits = defineEmits(["fileSuccess", "fileRemove", "update:fileList"]);
|
||||
interface IUploadFilesProps {
|
||||
acceptType?: string; // 上传文件类型
|
||||
acceptTypes?: string; // 描述 - 上传文件类型
|
||||
isMultiple?: boolean; // 是否可批量上传
|
||||
limit?: number; // 允许上传文件的最大数量
|
||||
disabled?: boolean; // 是否禁用上传
|
||||
fileSize?: number; // 文件大小
|
||||
action?: string;
|
||||
fileList?: any; // 回显的文件
|
||||
isDownload?: boolean; // 是否可以下载
|
||||
folderName?: string; // 后端文件夹名称
|
||||
fileParam?: string; // 文件类型[可向后端传递参数]
|
||||
}
|
||||
// 接收父组件传递过来的参数
|
||||
const props = withDefaults(defineProps<IUploadFilesProps>(), {
|
||||
acceptType: ".png,.jpg,.jpeg,.webp,.gif,.mp3,.mp4,.xls,.xlsx,.pdf,.log,.doc,.docx,.txt,.jar,.zip",
|
||||
acceptTypes: "图片[png/jpg/webp/gif]、文件[txt/xls/xlsx]",
|
||||
isMultiple: true,
|
||||
limit: 1,
|
||||
disabled: false,
|
||||
fileSize: 10,
|
||||
action: "/api/common/upload",
|
||||
fileList: [],
|
||||
isDownload: false,
|
||||
folderName: "files",
|
||||
fileParam: "-1"
|
||||
});
|
||||
|
||||
// 获取 el-form 组件上下文
|
||||
const formContext = inject(formContextKey, void 0);
|
||||
// 获取 el-form-item 组件上下文
|
||||
const formItemContext = inject(formItemContextKey, void 0);
|
||||
// 判断是否禁用上传和删除
|
||||
const disabled = computed(() => {
|
||||
return props.disabled || formContext?.disabled;
|
||||
});
|
||||
|
||||
let fileList = ref<any>([]);
|
||||
// 父组件传递回显数据
|
||||
fileList.value = props.fileList;
|
||||
// 修改进行回显的时候使用
|
||||
watch(
|
||||
() => [props.fileList],
|
||||
() => {
|
||||
// 父组件传递回显数据
|
||||
fileList.value = props.fileList;
|
||||
}
|
||||
);
|
||||
|
||||
const handleExceed = () => {
|
||||
koiMsgWarning(`当前最多只能上传 ${props.limit} 个,请移除后上传!`);
|
||||
};
|
||||
/**
|
||||
* 文件变化handleChange 这里监听上传文件的变化上传一个,执行一下后端上传单个文件请求方法。
|
||||
*/
|
||||
const handleChange = async (file: any) => {
|
||||
// 防止多次执行change
|
||||
const rawFile = file.raw;
|
||||
const list = props.acceptTypes.split("/");
|
||||
let acceptTypeList = list.map((item: string) => {
|
||||
return getType(item);
|
||||
});
|
||||
// 如果要检索的字符串值没有出现,则该方法返回 -1
|
||||
const isString = acceptTypeList.filter((item: string) => {
|
||||
return rawFile.type.indexOf(item) > -1;
|
||||
});
|
||||
// 用于校验是否符合上传条件
|
||||
const type = props.acceptTypes.replace("/", ", ");
|
||||
if (isString.length < 1) {
|
||||
koiMsgWarning(`仅支持格式为${type}的文件`);
|
||||
return false;
|
||||
} else if (rawFile.size / 1024 / 1024 > props.fileSize) {
|
||||
koiMsgWarning(`文件大小不能超过${props.fileSize}MB!`);
|
||||
const arr = [...fileList.value];
|
||||
fileList.value = arr.filter((item: any) => {
|
||||
return item.uid != rawFile.uid;
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
let formData = new FormData();
|
||||
formData.append("file", rawFile);
|
||||
formData.append("fileType", "2");
|
||||
const loadingInstance = ElLoading.service({
|
||||
text: "正在上传",
|
||||
background: "rgba(0,0,0,.2)"
|
||||
});
|
||||
// 上传到服务器上面
|
||||
const requestURL: string = props.action;
|
||||
if (props.fileParam == "-1" || props.fileParam == "") {
|
||||
props.fileParam === "-1";
|
||||
}
|
||||
// 文件上传
|
||||
koi
|
||||
.post(requestURL + "/" + props.fileSize + "/" + props.folderName + "/" + props.fileParam, formData)
|
||||
.then((res: any) => {
|
||||
loadingInstance.close();
|
||||
let fileMap = res.data;
|
||||
fileList.value.push({
|
||||
name: rawFile.name,
|
||||
url: fileMap.fullurl
|
||||
});
|
||||
emits("update:fileList", fileList.value);
|
||||
emits("fileSuccess", fileMap);
|
||||
// 调用 el-form 内部的校验方法[可自动校验]
|
||||
formItemContext?.prop && formContext?.validateField([formItemContext.prop as string]);
|
||||
koiNoticeSuccess("文件上传成功🌻");
|
||||
})
|
||||
.catch(error => {
|
||||
console.log("文件上传", error);
|
||||
// 移除失败的文件
|
||||
const arr = [...fileList.value];
|
||||
fileList.value = arr.filter((item: any) => {
|
||||
return item.uid != rawFile.uid;
|
||||
});
|
||||
emits("update:fileList", fileList.value);
|
||||
loadingInstance.close();
|
||||
koiNoticeError("上传失败,亲,您的文件不支持上传🌻");
|
||||
});
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// 校验上传文件格式
|
||||
// const getType = (acceptType: string) => {
|
||||
// let val = "";
|
||||
// switch (acceptType) {
|
||||
// case "xls":
|
||||
// val = "excel";
|
||||
// break;
|
||||
// case "doc":
|
||||
// val = "word";
|
||||
// break;
|
||||
// case "pdf":
|
||||
// val = "pdf";
|
||||
// break;
|
||||
// case "zip":
|
||||
// val = "zip";
|
||||
// break;
|
||||
// case "xlsx":
|
||||
// val = "sheet";
|
||||
// break;
|
||||
// case "pptx":
|
||||
// val = "presentation";
|
||||
// break;
|
||||
// case "docx":
|
||||
// val = "document";
|
||||
// break;
|
||||
// case "text":
|
||||
// val = "text";
|
||||
// break;
|
||||
// }
|
||||
// return val;
|
||||
// };
|
||||
|
||||
// 文件类型映射表
|
||||
const fileTypeMap: any = {
|
||||
xls: "excel",
|
||||
xlsx: "sheet",
|
||||
doc: "word",
|
||||
docx: "document",
|
||||
pdf: "pdf",
|
||||
zip: "zip",
|
||||
pptx: "presentation",
|
||||
text: "text",
|
||||
log: "text",
|
||||
png: "image/png",
|
||||
jpg: "image/jpeg",
|
||||
jpeg: "image/jpeg",
|
||||
gif: "image/gif",
|
||||
svg: "image/svg+xml",
|
||||
mp3: "audio/mpeg",
|
||||
wav: "audio/wav",
|
||||
ogg: "audio/ogg",
|
||||
mp4: "video/mp4",
|
||||
avi: "video/x-msvideo",
|
||||
mov: "video/quicktime",
|
||||
webm: "video/webm",
|
||||
json: "application/json",
|
||||
xml: "application/xml",
|
||||
yaml: "application/yaml",
|
||||
js: "application/javascript",
|
||||
css: "text/css",
|
||||
html: "text/html",
|
||||
txt: "text/plain",
|
||||
csv: "text/csv",
|
||||
md: "text/markdown",
|
||||
sql: "application/sql",
|
||||
sh: "application/x-sh",
|
||||
py: "text/x-python",
|
||||
rb: "text/x-ruby",
|
||||
java: "text/x-java",
|
||||
c: "text/x-csrc",
|
||||
h: "text/x-chdr",
|
||||
cpp: "text/x-c++src",
|
||||
hpp: "text/x-c++hdr",
|
||||
ts: "application/typescript",
|
||||
sass: "text/x-sass",
|
||||
scss: "text/x-scss",
|
||||
less: "text/x-less"
|
||||
};
|
||||
|
||||
// 校验上传文件格式
|
||||
const getType = (acceptType: string) => {
|
||||
const lowerCaseExt = acceptType.toLowerCase();
|
||||
return fileTypeMap[lowerCaseExt] || "";
|
||||
};
|
||||
|
||||
// 移除文件
|
||||
const handleRemove = (url: string) => {
|
||||
fileList.value = fileList.value.filter((item: any) => item.url !== url);
|
||||
emits("update:fileList", fileList.value);
|
||||
emits("fileRemove", url);
|
||||
};
|
||||
|
||||
// 下载文件
|
||||
const handleDownLoad = async (url: string, name: string) => {
|
||||
if (!url && !name) {
|
||||
koiMsgError("文件获取失败,请刷新重试🌻");
|
||||
}
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
koiMsgError("网络异常,请刷新重试🌻");
|
||||
return;
|
||||
}
|
||||
// 创建 Blob 对象
|
||||
const blob = await response.blob();
|
||||
// 创建对象 URL
|
||||
const downloadUrl = window.URL.createObjectURL(blob);
|
||||
// 创建一个隐藏的下载链接
|
||||
const link = document.createElement("a");
|
||||
link.href = downloadUrl;
|
||||
link.download = name; // 设置下载文件名
|
||||
link.style.display = "none";
|
||||
// 添加到 DOM 中
|
||||
document.body.appendChild(link);
|
||||
// 触发点击事件
|
||||
link.click();
|
||||
// 清理
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(downloadUrl);
|
||||
} catch (error) {
|
||||
console.error("下载失败:", error);
|
||||
koiNoticeError("下载失败,请刷新重试🌻");
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-upload-text {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 106px;
|
||||
height: 32px;
|
||||
color: var(--el-color-primary);
|
||||
|
||||
/* 设置用户禁止选中 */
|
||||
user-select: none;
|
||||
border: 2px dashed var(--el-color-primary);
|
||||
border-radius: 6px;
|
||||
span {
|
||||
padding-left: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
.template-file {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 18px;
|
||||
border-radius: 4px;
|
||||
padding: 3px 6px;
|
||||
max-width: 360px;
|
||||
.document-name {
|
||||
margin-right: 12px;
|
||||
font-size: 14px;
|
||||
line-height: 16px;
|
||||
height: 16px;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
line-clamp: 1;
|
||||
}
|
||||
}
|
||||
.file-tips {
|
||||
font-size: 12px;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
</style>
|
352
.history/src/components/KoiUpload/Files_20250626092320.vue
Normal file
@ -0,0 +1,352 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 注意:只能通过 on-change 钩子函数来对上传文件的列表进行控制。 -->
|
||||
<el-upload
|
||||
:file-list="fileList"
|
||||
:multiple="props.isMultiple"
|
||||
:limit="props.limit"
|
||||
:accept="props.acceptType"
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
:disabled="disabled"
|
||||
:on-exceed="handleExceed"
|
||||
:on-change="handleChange"
|
||||
:folderName="folderName"
|
||||
:fileParam="fileParam"
|
||||
>
|
||||
<div class="el-upload-text hover:bg-[--el-color-primary-light-9]">
|
||||
<el-icon size="16"><Upload /></el-icon>
|
||||
<span>上传文件</span>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div style="margin-top: 6px">
|
||||
<div
|
||||
class="template-file text-#555 m-t-2px rounded-6px dark:text-#CFD3DC hover:bg-[--el-color-primary-light-9]"
|
||||
v-for="item in fileList"
|
||||
:key="item.url"
|
||||
>
|
||||
<el-icon size="16" style="margin-right: 5px"><Link /></el-icon>
|
||||
<el-tooltip :content="item.name" placement="top">
|
||||
<div class="document-name hover:text-[--el-color-primary]">{{ item.name }}</div>
|
||||
</el-tooltip>
|
||||
<el-icon class="hover:text-[--el-color-primary]" v-if="!props.disabled" size="16" @click="handleRemove(item.url)">
|
||||
<Close />
|
||||
</el-icon>
|
||||
<!-- 默认不显示下载 -->
|
||||
<el-icon
|
||||
v-if="isDownload"
|
||||
class="p-l-5px hover:text-[--el-color-primary]"
|
||||
size="16"
|
||||
@click="handleDownLoad(item.url, item.name)"
|
||||
><Download
|
||||
/></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<span class="file-tips">
|
||||
<slot name="tip">
|
||||
支持{{ acceptTypes }};
|
||||
<div class="h-20px"></div>
|
||||
文件大小不能超过{{ props.fileSize }}M;最多上传{{ props.limit }}个;
|
||||
</slot>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch, inject } from "vue";
|
||||
import { ElLoading, formContextKey, formItemContextKey } from "element-plus";
|
||||
import { koiNoticeSuccess, koiNoticeError, koiMsgWarning, koiMsgError } from "@/utils/koi.ts";
|
||||
import koi from "@/utils/axios.ts";
|
||||
|
||||
const emits = defineEmits(["fileSuccess", "fileRemove", "update:fileList"]);
|
||||
interface IUploadFilesProps {
|
||||
acceptType?: string; // 上传文件类型
|
||||
acceptTypes?: string; // 描述 - 上传文件类型
|
||||
isMultiple?: boolean; // 是否可批量上传
|
||||
limit?: number; // 允许上传文件的最大数量
|
||||
disabled?: boolean; // 是否禁用上传
|
||||
fileSize?: number; // 文件大小
|
||||
action?: string;
|
||||
fileList?: any; // 回显的文件
|
||||
isDownload?: boolean; // 是否可以下载
|
||||
folderName?: string; // 后端文件夹名称
|
||||
fileParam?: string; // 文件类型[可向后端传递参数]
|
||||
}
|
||||
// 接收父组件传递过来的参数
|
||||
const props = withDefaults(defineProps<IUploadFilesProps>(), {
|
||||
acceptType: ".png,.jpg,.jpeg,.webp,.gif,.mp3,.mp4,.xls,.xlsx,.pdf,.log,.doc,.docx,.txt,.jar,.zip",
|
||||
acceptTypes: "图片[png/jpg/webp/gif]、文件[txt/xls/xlsx]",
|
||||
isMultiple: true,
|
||||
limit: 1,
|
||||
disabled: false,
|
||||
fileSize: 10,
|
||||
action: "/api/common/upload",
|
||||
fileList: [],
|
||||
isDownload: false,
|
||||
folderName: "files",
|
||||
fileParam: "-1"
|
||||
});
|
||||
|
||||
// 获取 el-form 组件上下文
|
||||
const formContext = inject(formContextKey, void 0);
|
||||
// 获取 el-form-item 组件上下文
|
||||
const formItemContext = inject(formItemContextKey, void 0);
|
||||
// 判断是否禁用上传和删除
|
||||
const disabled = computed(() => {
|
||||
return props.disabled || formContext?.disabled;
|
||||
});
|
||||
|
||||
let fileList = ref<any>([]);
|
||||
// 父组件传递回显数据
|
||||
fileList.value = props.fileList;
|
||||
// 修改进行回显的时候使用
|
||||
watch(
|
||||
() => [props.fileList],
|
||||
() => {
|
||||
// 父组件传递回显数据
|
||||
fileList.value = props.fileList;
|
||||
}
|
||||
);
|
||||
|
||||
const handleExceed = () => {
|
||||
koiMsgWarning(`当前最多只能上传 ${props.limit} 个,请移除后上传!`);
|
||||
};
|
||||
/**
|
||||
* 文件变化handleChange 这里监听上传文件的变化上传一个,执行一下后端上传单个文件请求方法。
|
||||
*/
|
||||
const handleChange = async (file: any) => {
|
||||
// 防止多次执行change
|
||||
const rawFile = file.raw;
|
||||
const list = props.acceptTypes.split("/");
|
||||
let acceptTypeList = list.map((item: string) => {
|
||||
return getType(item);
|
||||
});
|
||||
// 如果要检索的字符串值没有出现,则该方法返回 -1
|
||||
const isString = acceptTypeList.filter((item: string) => {
|
||||
return rawFile.type.indexOf(item) > -1;
|
||||
});
|
||||
// 用于校验是否符合上传条件
|
||||
const type = props.acceptTypes.replace("/", ", ");
|
||||
if (isString.length < 1) {
|
||||
koiMsgWarning(`仅支持格式为${type}的文件`);
|
||||
return false;
|
||||
} else if (rawFile.size / 1024 / 1024 > props.fileSize) {
|
||||
koiMsgWarning(`文件大小不能超过${props.fileSize}MB!`);
|
||||
const arr = [...fileList.value];
|
||||
fileList.value = arr.filter((item: any) => {
|
||||
return item.uid != rawFile.uid;
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
let formData = new FormData();
|
||||
formData.append("file", rawFile);
|
||||
formData.append("fileType", "2");
|
||||
const loadingInstance = ElLoading.service({
|
||||
text: "正在上传",
|
||||
background: "rgba(0,0,0,.2)"
|
||||
});
|
||||
// 上传到服务器上面
|
||||
const requestURL: string = props.action;
|
||||
if (props.fileParam == "-1" || props.fileParam == "") {
|
||||
props.fileParam === "-1";
|
||||
}
|
||||
// 文件上传
|
||||
koi
|
||||
.post(requestURL + "/" + props.fileSize + "/" + props.folderName + "/" + props.fileParam, formData)
|
||||
.then((res: any) => {
|
||||
loadingInstance.close();
|
||||
let fileMap = res.data;
|
||||
fileList.value.push({
|
||||
name: rawFile.name,
|
||||
url: fileMap.fullurl
|
||||
});
|
||||
emits("update:fileList", fileList.value);
|
||||
emits("fileSuccess", fileMap);
|
||||
// 调用 el-form 内部的校验方法[可自动校验]
|
||||
formItemContext?.prop && formContext?.validateField([formItemContext.prop as string]);
|
||||
koiNoticeSuccess("文件上传成功🌻");
|
||||
})
|
||||
.catch(error => {
|
||||
console.log("文件上传", error);
|
||||
// 移除失败的文件
|
||||
const arr = [...fileList.value];
|
||||
fileList.value = arr.filter((item: any) => {
|
||||
return item.uid != rawFile.uid;
|
||||
});
|
||||
emits("update:fileList", fileList.value);
|
||||
loadingInstance.close();
|
||||
koiNoticeError("上传失败,亲,您的文件不支持上传🌻");
|
||||
});
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// 校验上传文件格式
|
||||
// const getType = (acceptType: string) => {
|
||||
// let val = "";
|
||||
// switch (acceptType) {
|
||||
// case "xls":
|
||||
// val = "excel";
|
||||
// break;
|
||||
// case "doc":
|
||||
// val = "word";
|
||||
// break;
|
||||
// case "pdf":
|
||||
// val = "pdf";
|
||||
// break;
|
||||
// case "zip":
|
||||
// val = "zip";
|
||||
// break;
|
||||
// case "xlsx":
|
||||
// val = "sheet";
|
||||
// break;
|
||||
// case "pptx":
|
||||
// val = "presentation";
|
||||
// break;
|
||||
// case "docx":
|
||||
// val = "document";
|
||||
// break;
|
||||
// case "text":
|
||||
// val = "text";
|
||||
// break;
|
||||
// }
|
||||
// return val;
|
||||
// };
|
||||
|
||||
// 文件类型映射表
|
||||
const fileTypeMap: any = {
|
||||
xls: "excel",
|
||||
xlsx: "sheet",
|
||||
doc: "word",
|
||||
docx: "document",
|
||||
pdf: "pdf",
|
||||
zip: "zip",
|
||||
pptx: "presentation",
|
||||
text: "text",
|
||||
log: "text",
|
||||
png: "image/png",
|
||||
jpg: "image/jpeg",
|
||||
jpeg: "image/jpeg",
|
||||
gif: "image/gif",
|
||||
svg: "image/svg+xml",
|
||||
mp3: "audio/mpeg",
|
||||
wav: "audio/wav",
|
||||
ogg: "audio/ogg",
|
||||
mp4: "video/mp4",
|
||||
avi: "video/x-msvideo",
|
||||
mov: "video/quicktime",
|
||||
webm: "video/webm",
|
||||
json: "application/json",
|
||||
xml: "application/xml",
|
||||
yaml: "application/yaml",
|
||||
js: "application/javascript",
|
||||
css: "text/css",
|
||||
html: "text/html",
|
||||
txt: "text/plain",
|
||||
csv: "text/csv",
|
||||
md: "text/markdown",
|
||||
sql: "application/sql",
|
||||
sh: "application/x-sh",
|
||||
py: "text/x-python",
|
||||
rb: "text/x-ruby",
|
||||
java: "text/x-java",
|
||||
c: "text/x-csrc",
|
||||
h: "text/x-chdr",
|
||||
cpp: "text/x-c++src",
|
||||
hpp: "text/x-c++hdr",
|
||||
ts: "application/typescript",
|
||||
sass: "text/x-sass",
|
||||
scss: "text/x-scss",
|
||||
less: "text/x-less"
|
||||
};
|
||||
|
||||
// 校验上传文件格式
|
||||
const getType = (acceptType: string) => {
|
||||
const lowerCaseExt = acceptType.toLowerCase();
|
||||
return fileTypeMap[lowerCaseExt] || "";
|
||||
};
|
||||
|
||||
// 移除文件
|
||||
const handleRemove = (url: string) => {
|
||||
fileList.value = fileList.value.filter((item: any) => item.url !== url);
|
||||
emits("update:fileList", fileList.value);
|
||||
emits("fileRemove", url);
|
||||
};
|
||||
|
||||
// 下载文件
|
||||
const handleDownLoad = async (url: string, name: string) => {
|
||||
if (!url && !name) {
|
||||
koiMsgError("文件获取失败,请刷新重试🌻");
|
||||
}
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
koiMsgError("网络异常,请刷新重试🌻");
|
||||
return;
|
||||
}
|
||||
// 创建 Blob 对象
|
||||
const blob = await response.blob();
|
||||
// 创建对象 URL
|
||||
const downloadUrl = window.URL.createObjectURL(blob);
|
||||
// 创建一个隐藏的下载链接
|
||||
const link = document.createElement("a");
|
||||
link.href = downloadUrl;
|
||||
link.download = name; // 设置下载文件名
|
||||
link.style.display = "none";
|
||||
// 添加到 DOM 中
|
||||
document.body.appendChild(link);
|
||||
// 触发点击事件
|
||||
link.click();
|
||||
// 清理
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(downloadUrl);
|
||||
} catch (error) {
|
||||
console.error("下载失败:", error);
|
||||
koiNoticeError("下载失败,请刷新重试🌻");
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-upload-text {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 106px;
|
||||
height: 32px;
|
||||
color: var(--el-color-primary);
|
||||
|
||||
/* 设置用户禁止选中 */
|
||||
user-select: none;
|
||||
border: 2px dashed var(--el-color-primary);
|
||||
border-radius: 6px;
|
||||
span {
|
||||
padding-left: 6px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
.template-file {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 18px;
|
||||
border-radius: 4px;
|
||||
padding: 3px 6px;
|
||||
max-width: 360px;
|
||||
.document-name {
|
||||
margin-right: 12px;
|
||||
font-size: 14px;
|
||||
line-height: 16px;
|
||||
height: 16px;
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
line-clamp: 1;
|
||||
}
|
||||
}
|
||||
.file-tips {
|
||||
font-size: 12px;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
</style>
|
189
.history/src/utils/axios_20241223175537.ts
Normal file
@ -0,0 +1,189 @@
|
||||
import axios, {AxiosInstance, AxiosRequestConfig, AxiosResponse} from "axios";
|
||||
|
||||
import {koiMsgError} from "@/utils/koi.ts";
|
||||
import {LOGIN_URL} from "@/config/index.ts";
|
||||
import useUserStore from "@/stores/modules/user.ts";
|
||||
import {getToken} from "@/utils/storage.ts";
|
||||
import router from "@/routers/index.ts";
|
||||
|
||||
// axios配置
|
||||
const config = {
|
||||
// 接口请求的地址
|
||||
baseURL: import.meta.env.VITE_WEB_BASE_API,
|
||||
timeout: 10000,
|
||||
//contentType: "application/json",
|
||||
};
|
||||
|
||||
// 返回值类型
|
||||
export interface Result<T = any> {
|
||||
code: number;
|
||||
msg: string;
|
||||
data: T;
|
||||
}
|
||||
|
||||
// 只有请求封装用的Yu,方便简写
|
||||
class Yu {
|
||||
private instance: AxiosInstance;
|
||||
|
||||
// 初始化
|
||||
constructor(config: AxiosRequestConfig) {
|
||||
// 实例化axios
|
||||
this.instance = axios.create(config);
|
||||
// 配置拦截器
|
||||
this.interceptors();
|
||||
}
|
||||
|
||||
// 拦截器
|
||||
private interceptors() {
|
||||
// 请求发送之前的拦截器:携带token
|
||||
// @ts-ignore
|
||||
this.instance.interceptors.request.use(
|
||||
config => {
|
||||
// 获取token
|
||||
const token = getToken();
|
||||
// 如果实现挤下线功能,需要用户绑定一个uuid,uuid发生变化,后端将数据进行处理[直接使用Sa-Token框架也阔以]
|
||||
if (token) {
|
||||
config.headers!["token"] = token;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
(error: any) => {
|
||||
error.data = {};
|
||||
error.data.msg = "服务器异常,请联系管理员🌻";
|
||||
return error;
|
||||
}
|
||||
);
|
||||
// 请求返回之后的拦截器:数据或者状态
|
||||
this.instance.interceptors.response.use(
|
||||
(res: AxiosResponse) => {
|
||||
// console.log("axios返回数据:", res);
|
||||
// console.log("服务器状态",res.status);
|
||||
const status = res.data.status || res.data.code; // 后端返回数据状态
|
||||
if (status == 200 || status == 1) {
|
||||
// 服务器连接状态,非后端返回的status 或者 code
|
||||
// 这里的后端可能是code OR status 和 msg OR message需要看后端传递的是什么?
|
||||
// console.log("200状态", status);
|
||||
return res.data;
|
||||
} else if (status == 99) {
|
||||
// console.log("401状态", status);
|
||||
const userStore = useUserStore();
|
||||
userStore.setToken(""); // 清空token必须使用这个,不能使用session清空,因为登录的时候js会获取一遍token还会存在。
|
||||
koiMsgError("登录身份过期,请重新登录!");
|
||||
router.replace(LOGIN_URL);
|
||||
return Promise.reject(res.data);
|
||||
} else {
|
||||
// console.log("后端返回数据:",res.data.msg)
|
||||
koiMsgError(res.data.msg || "系统错误-1");
|
||||
return Promise.reject(res.data.msg || "系统错误-1"); // 可以将异常信息延续到页面中处理,使用try{}catch(error){};
|
||||
}
|
||||
},
|
||||
(error: any) => {
|
||||
// 处理网络错误,不是服务器响应的数据
|
||||
// console.log("进入错误",error);
|
||||
error.data = {};
|
||||
if (error && error.response) {
|
||||
switch (error.response.status) {
|
||||
case 400:
|
||||
error.data.msg = "错误请求🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 401:
|
||||
error.data.msg = "未授权,请重新登录🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 403:
|
||||
error.data.msg = "对不起,您没有权限访问🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 404:
|
||||
error.data.msg = "请求错误,未找到请求路径🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 405:
|
||||
error.data.msg = "请求方法未允许🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 408:
|
||||
error.data.msg = "请求超时🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 500:
|
||||
error.data.msg = "服务器又偷懒了,请重试🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 501:
|
||||
error.data.msg = "网络未实现🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 502:
|
||||
error.data.msg = "网络错误🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 503:
|
||||
error.data.msg = "服务不可用🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 504:
|
||||
error.data.msg = "网络超时🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 505:
|
||||
error.data.msg = "http版本不支持该请求🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
default:
|
||||
error.data.msg = `连接错误${error.response.status}`;
|
||||
koiMsgError(error.data.msg);
|
||||
}
|
||||
} else {
|
||||
error.data.msg = "连接到服务器失败🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
}
|
||||
return Promise.reject(error); // 将错误返回给 try{} catch(){} 中进行捕获,就算不进行捕获,上方 res.data.status != 200也会抛出提示。
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Get请求
|
||||
get<T = Result>(url: string, params?: object): Promise<T> {
|
||||
return this.instance.get(url, {params});
|
||||
}
|
||||
|
||||
// Post请求
|
||||
post<T = Result>(url: string, data?: object): Promise<T> {
|
||||
return this.instance.post(url, data);
|
||||
}
|
||||
|
||||
// Put请求
|
||||
put<T = Result>(url: string, data?: object): Promise<T> {
|
||||
return this.instance.put(url, data);
|
||||
}
|
||||
|
||||
// Delete请求 /yu/role/1
|
||||
delete<T = Result>(url: string): Promise<T> {
|
||||
return this.instance.delete(url);
|
||||
}
|
||||
|
||||
// 图片上传
|
||||
upload<T = Result>(url: string, params?: object): Promise<T> {
|
||||
return this.instance.post(url, params, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 导出Excel
|
||||
exportExcel<T = Result>(url: string, params?: object): Promise<T> {
|
||||
return axios.get(import.meta.env.VITE_SERVER + url, {
|
||||
params,
|
||||
headers: {
|
||||
Accept: "application/vnd.ms-excel",
|
||||
Authorization: "Bearer " + getToken()
|
||||
},
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new Yu(config);
|
189
.history/src/utils/axios_20250626092804.ts
Normal file
@ -0,0 +1,189 @@
|
||||
import axios, {AxiosInstance, AxiosRequestConfig, AxiosResponse} from "axios";
|
||||
|
||||
import {koiMsgError} from "@/utils/koi.ts";
|
||||
import {LOGIN_URL} from "@/config/index.ts";
|
||||
import useUserStore from "@/stores/modules/user.ts";
|
||||
import {getToken} from "@/utils/storage.ts";
|
||||
import router from "@/routers/index.ts";
|
||||
|
||||
// axios配置
|
||||
const config = {
|
||||
// 接口请求的地址
|
||||
baseURL: import.meta.env.VITE_WEB_BASE_API,
|
||||
timeout: 100000,
|
||||
//contentType: "application/json",
|
||||
};
|
||||
|
||||
// 返回值类型
|
||||
export interface Result<T = any> {
|
||||
code: number;
|
||||
msg: string;
|
||||
data: T;
|
||||
}
|
||||
|
||||
// 只有请求封装用的Yu,方便简写
|
||||
class Yu {
|
||||
private instance: AxiosInstance;
|
||||
|
||||
// 初始化
|
||||
constructor(config: AxiosRequestConfig) {
|
||||
// 实例化axios
|
||||
this.instance = axios.create(config);
|
||||
// 配置拦截器
|
||||
this.interceptors();
|
||||
}
|
||||
|
||||
// 拦截器
|
||||
private interceptors() {
|
||||
// 请求发送之前的拦截器:携带token
|
||||
// @ts-ignore
|
||||
this.instance.interceptors.request.use(
|
||||
config => {
|
||||
// 获取token
|
||||
const token = getToken();
|
||||
// 如果实现挤下线功能,需要用户绑定一个uuid,uuid发生变化,后端将数据进行处理[直接使用Sa-Token框架也阔以]
|
||||
if (token) {
|
||||
config.headers!["token"] = token;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
(error: any) => {
|
||||
error.data = {};
|
||||
error.data.msg = "服务器异常,请联系管理员🌻";
|
||||
return error;
|
||||
}
|
||||
);
|
||||
// 请求返回之后的拦截器:数据或者状态
|
||||
this.instance.interceptors.response.use(
|
||||
(res: AxiosResponse) => {
|
||||
// console.log("axios返回数据:", res);
|
||||
// console.log("服务器状态",res.status);
|
||||
const status = res.data.status || res.data.code; // 后端返回数据状态
|
||||
if (status == 200 || status == 1) {
|
||||
// 服务器连接状态,非后端返回的status 或者 code
|
||||
// 这里的后端可能是code OR status 和 msg OR message需要看后端传递的是什么?
|
||||
// console.log("200状态", status);
|
||||
return res.data;
|
||||
} else if (status == 99) {
|
||||
// console.log("401状态", status);
|
||||
const userStore = useUserStore();
|
||||
userStore.setToken(""); // 清空token必须使用这个,不能使用session清空,因为登录的时候js会获取一遍token还会存在。
|
||||
koiMsgError("登录身份过期,请重新登录!");
|
||||
router.replace(LOGIN_URL);
|
||||
return Promise.reject(res.data);
|
||||
} else {
|
||||
// console.log("后端返回数据:",res.data.msg)
|
||||
koiMsgError(res.data.msg || "系统错误-1");
|
||||
return Promise.reject(res.data.msg || "系统错误-1"); // 可以将异常信息延续到页面中处理,使用try{}catch(error){};
|
||||
}
|
||||
},
|
||||
(error: any) => {
|
||||
// 处理网络错误,不是服务器响应的数据
|
||||
// console.log("进入错误",error);
|
||||
error.data = {};
|
||||
if (error && error.response) {
|
||||
switch (error.response.status) {
|
||||
case 400:
|
||||
error.data.msg = "错误请求🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 401:
|
||||
error.data.msg = "未授权,请重新登录🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 403:
|
||||
error.data.msg = "对不起,您没有权限访问🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 404:
|
||||
error.data.msg = "请求错误,未找到请求路径🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 405:
|
||||
error.data.msg = "请求方法未允许🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 408:
|
||||
error.data.msg = "请求超时🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 500:
|
||||
error.data.msg = "服务器又偷懒了,请重试🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 501:
|
||||
error.data.msg = "网络未实现🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 502:
|
||||
error.data.msg = "网络错误🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 503:
|
||||
error.data.msg = "服务不可用🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 504:
|
||||
error.data.msg = "网络超时🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 505:
|
||||
error.data.msg = "http版本不支持该请求🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
default:
|
||||
error.data.msg = `连接错误${error.response.status}`;
|
||||
koiMsgError(error.data.msg);
|
||||
}
|
||||
} else {
|
||||
error.data.msg = "连接到服务器失败🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
}
|
||||
return Promise.reject(error); // 将错误返回给 try{} catch(){} 中进行捕获,就算不进行捕获,上方 res.data.status != 200也会抛出提示。
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Get请求
|
||||
get<T = Result>(url: string, params?: object): Promise<T> {
|
||||
return this.instance.get(url, {params});
|
||||
}
|
||||
|
||||
// Post请求
|
||||
post<T = Result>(url: string, data?: object): Promise<T> {
|
||||
return this.instance.post(url, data);
|
||||
}
|
||||
|
||||
// Put请求
|
||||
put<T = Result>(url: string, data?: object): Promise<T> {
|
||||
return this.instance.put(url, data);
|
||||
}
|
||||
|
||||
// Delete请求 /yu/role/1
|
||||
delete<T = Result>(url: string): Promise<T> {
|
||||
return this.instance.delete(url);
|
||||
}
|
||||
|
||||
// 图片上传
|
||||
upload<T = Result>(url: string, params?: object): Promise<T> {
|
||||
return this.instance.post(url, params, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 导出Excel
|
||||
exportExcel<T = Result>(url: string, params?: object): Promise<T> {
|
||||
return axios.get(import.meta.env.VITE_SERVER + url, {
|
||||
params,
|
||||
headers: {
|
||||
Accept: "application/vnd.ms-excel",
|
||||
Authorization: "Bearer " + getToken()
|
||||
},
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new Yu(config);
|
189
.history/src/utils/axios_20250626092807.ts
Normal file
@ -0,0 +1,189 @@
|
||||
import axios, {AxiosInstance, AxiosRequestConfig, AxiosResponse} from "axios";
|
||||
|
||||
import {koiMsgError} from "@/utils/koi.ts";
|
||||
import {LOGIN_URL} from "@/config/index.ts";
|
||||
import useUserStore from "@/stores/modules/user.ts";
|
||||
import {getToken} from "@/utils/storage.ts";
|
||||
import router from "@/routers/index.ts";
|
||||
|
||||
// axios配置
|
||||
const config = {
|
||||
// 接口请求的地址
|
||||
baseURL: import.meta.env.VITE_WEB_BASE_API,
|
||||
timeout: 500000,
|
||||
//contentType: "application/json",
|
||||
};
|
||||
|
||||
// 返回值类型
|
||||
export interface Result<T = any> {
|
||||
code: number;
|
||||
msg: string;
|
||||
data: T;
|
||||
}
|
||||
|
||||
// 只有请求封装用的Yu,方便简写
|
||||
class Yu {
|
||||
private instance: AxiosInstance;
|
||||
|
||||
// 初始化
|
||||
constructor(config: AxiosRequestConfig) {
|
||||
// 实例化axios
|
||||
this.instance = axios.create(config);
|
||||
// 配置拦截器
|
||||
this.interceptors();
|
||||
}
|
||||
|
||||
// 拦截器
|
||||
private interceptors() {
|
||||
// 请求发送之前的拦截器:携带token
|
||||
// @ts-ignore
|
||||
this.instance.interceptors.request.use(
|
||||
config => {
|
||||
// 获取token
|
||||
const token = getToken();
|
||||
// 如果实现挤下线功能,需要用户绑定一个uuid,uuid发生变化,后端将数据进行处理[直接使用Sa-Token框架也阔以]
|
||||
if (token) {
|
||||
config.headers!["token"] = token;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
(error: any) => {
|
||||
error.data = {};
|
||||
error.data.msg = "服务器异常,请联系管理员🌻";
|
||||
return error;
|
||||
}
|
||||
);
|
||||
// 请求返回之后的拦截器:数据或者状态
|
||||
this.instance.interceptors.response.use(
|
||||
(res: AxiosResponse) => {
|
||||
// console.log("axios返回数据:", res);
|
||||
// console.log("服务器状态",res.status);
|
||||
const status = res.data.status || res.data.code; // 后端返回数据状态
|
||||
if (status == 200 || status == 1) {
|
||||
// 服务器连接状态,非后端返回的status 或者 code
|
||||
// 这里的后端可能是code OR status 和 msg OR message需要看后端传递的是什么?
|
||||
// console.log("200状态", status);
|
||||
return res.data;
|
||||
} else if (status == 99) {
|
||||
// console.log("401状态", status);
|
||||
const userStore = useUserStore();
|
||||
userStore.setToken(""); // 清空token必须使用这个,不能使用session清空,因为登录的时候js会获取一遍token还会存在。
|
||||
koiMsgError("登录身份过期,请重新登录!");
|
||||
router.replace(LOGIN_URL);
|
||||
return Promise.reject(res.data);
|
||||
} else {
|
||||
// console.log("后端返回数据:",res.data.msg)
|
||||
koiMsgError(res.data.msg || "系统错误-1");
|
||||
return Promise.reject(res.data.msg || "系统错误-1"); // 可以将异常信息延续到页面中处理,使用try{}catch(error){};
|
||||
}
|
||||
},
|
||||
(error: any) => {
|
||||
// 处理网络错误,不是服务器响应的数据
|
||||
// console.log("进入错误",error);
|
||||
error.data = {};
|
||||
if (error && error.response) {
|
||||
switch (error.response.status) {
|
||||
case 400:
|
||||
error.data.msg = "错误请求🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 401:
|
||||
error.data.msg = "未授权,请重新登录🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 403:
|
||||
error.data.msg = "对不起,您没有权限访问🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 404:
|
||||
error.data.msg = "请求错误,未找到请求路径🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 405:
|
||||
error.data.msg = "请求方法未允许🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 408:
|
||||
error.data.msg = "请求超时🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 500:
|
||||
error.data.msg = "服务器又偷懒了,请重试🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 501:
|
||||
error.data.msg = "网络未实现🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 502:
|
||||
error.data.msg = "网络错误🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 503:
|
||||
error.data.msg = "服务不可用🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 504:
|
||||
error.data.msg = "网络超时🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
case 505:
|
||||
error.data.msg = "http版本不支持该请求🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
break;
|
||||
default:
|
||||
error.data.msg = `连接错误${error.response.status}`;
|
||||
koiMsgError(error.data.msg);
|
||||
}
|
||||
} else {
|
||||
error.data.msg = "连接到服务器失败🌻";
|
||||
koiMsgError(error.data.msg);
|
||||
}
|
||||
return Promise.reject(error); // 将错误返回给 try{} catch(){} 中进行捕获,就算不进行捕获,上方 res.data.status != 200也会抛出提示。
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Get请求
|
||||
get<T = Result>(url: string, params?: object): Promise<T> {
|
||||
return this.instance.get(url, {params});
|
||||
}
|
||||
|
||||
// Post请求
|
||||
post<T = Result>(url: string, data?: object): Promise<T> {
|
||||
return this.instance.post(url, data);
|
||||
}
|
||||
|
||||
// Put请求
|
||||
put<T = Result>(url: string, data?: object): Promise<T> {
|
||||
return this.instance.put(url, data);
|
||||
}
|
||||
|
||||
// Delete请求 /yu/role/1
|
||||
delete<T = Result>(url: string): Promise<T> {
|
||||
return this.instance.delete(url);
|
||||
}
|
||||
|
||||
// 图片上传
|
||||
upload<T = Result>(url: string, params?: object): Promise<T> {
|
||||
return this.instance.post(url, params, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 导出Excel
|
||||
exportExcel<T = Result>(url: string, params?: object): Promise<T> {
|
||||
return axios.get(import.meta.env.VITE_SERVER + url, {
|
||||
params,
|
||||
headers: {
|
||||
Accept: "application/vnd.ms-excel",
|
||||
Authorization: "Bearer " + getToken()
|
||||
},
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new Yu(config);
|
201
.history/src/views/paper/add/index_20250427090014.vue
Normal file
@ -0,0 +1,201 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
214
.history/src/views/paper/add/index_20250626091612.vue
Normal file
@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
218
.history/src/views/paper/add/index_20250626091635.vue
Normal file
@ -0,0 +1,218 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
218
.history/src/views/paper/add/index_20250626091639.vue
Normal file
@ -0,0 +1,218 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
218
.history/src/views/paper/add/index_20250626091801.vue
Normal file
@ -0,0 +1,218 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
219
.history/src/views/paper/add/index_20250626091822.vue
Normal file
@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
console.log(backArr.value);
|
||||
return;
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
219
.history/src/views/paper/add/index_20250626091848.vue
Normal file
@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
console.log(backArr.value);
|
||||
return;
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
219
.history/src/views/paper/add/index_20250626092146.vue
Normal file
@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileSize="100" :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
console.log(backArr.value);
|
||||
return;
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
219
.history/src/views/paper/add/index_20250626092148.vue
Normal file
@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileSize="100" :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
console.log(backArr.value);
|
||||
return;
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
219
.history/src/views/paper/add/index_20250626092322.vue
Normal file
@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileSize="100" :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
console.log(backArr.value);
|
||||
return;
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
220
.history/src/views/paper/add/index_20250626092503.vue
Normal file
@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileSize="100" :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [],video:[] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [],video:[] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
console.log(backArr.value);
|
||||
return;
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
218
.history/src/views/paper/add/index_20250626092900.vue
Normal file
@ -0,0 +1,218 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="form.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="form.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="addBlack" class="mt-2">新增版面</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8" v-for="(item, index) in backArr">
|
||||
<el-card class="m-b-5" shadow="hover">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<div>{{ item.bm_name ? item.bm_name : '版面' }}</div>
|
||||
<div>
|
||||
<el-space wrap :size="30">
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('l',index)">-->
|
||||
<!-- <ArrowLeftBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- <el-icon class="cursor-pointer" @click="left_right('r',index)">-->
|
||||
<!-- <ArrowRightBold/>-->
|
||||
<!-- </el-icon>-->
|
||||
<el-icon class="cursor-pointer" @click="del(index)">
|
||||
<DeleteFilled />
|
||||
</el-icon>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form :model="form" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="item.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input @blur="addSort" type="number" v-model="item.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="item.pdf" acceptType=".pdf"
|
||||
@update:fileList="(file) => updateFileList(file, index)"
|
||||
@fileSuccess="(file) => getFileList(file, index)">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileSize="100" :fileList="item.video" acceptType=".mp4"
|
||||
@update:fileList="(file) => updateVideoList(file, index)"
|
||||
@fileSuccess="(file) => getVideoList(file, index)">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="item.bm_img" @update:imageUrl="(file) => getImgList(file, index)"
|
||||
width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="text-center p-10">
|
||||
<el-button type="primary" class="w-80" plain @click="handleMineSave">保存报刊</el-button>
|
||||
</div>
|
||||
</KoiCard>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { bmAdd, getList } from "@/api/system/post/index.ts";
|
||||
import {
|
||||
koiMsgSuccess,
|
||||
koiNoticeSuccess,
|
||||
koiNoticeError,
|
||||
koiMsgError,
|
||||
koiMsgWarning,
|
||||
koiMsgBox,
|
||||
koiMsgInfo
|
||||
} from "@/utils/koi.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElLoading } from 'element-plus'
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabsStore = useTabsStore();
|
||||
|
||||
const getFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl;
|
||||
}
|
||||
const updateFileList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_pdf = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
const getImgList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_img = d;
|
||||
}
|
||||
const getVideoList = (d, index) => {
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl;
|
||||
}
|
||||
const updateVideoList =(d, index) =>{
|
||||
console.log(d);
|
||||
console.log(index);
|
||||
backArr.value[index].bm_video = d.fullurl ? d.fullurl : '';
|
||||
}
|
||||
|
||||
const backArr = ref([
|
||||
{ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: 0, pdf: [],video:[] }
|
||||
]);
|
||||
const form = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const addBlack = () => {
|
||||
// 找到当前 backArr 数组中最大的 weight 值
|
||||
const maxWeight = Math.max(...backArr.value.map(item => item.weight), 0);
|
||||
|
||||
// 添加新的版面,weight 设置为 maxWeight + 1
|
||||
backArr.value.push({ bm_name: '', bm_img: '',bm_video:'', bm_pdf: '', weight: maxWeight + 1, pdf: [],video:[] });
|
||||
}
|
||||
const addSort = () => {
|
||||
//根据数组中的weight排序数组
|
||||
backArr.value.sort((a, b) => a.weight - b.weight);
|
||||
}
|
||||
onMounted(() => {
|
||||
//getTypelist();
|
||||
})
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const handleMineSave = async () => {
|
||||
if (form.datetime == '') {
|
||||
koiMsgError('请选择报纸日期');
|
||||
return;
|
||||
}
|
||||
if (form.periods == '' || form.periods == null) {
|
||||
koiMsgError('请输入期刊');
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < backArr.value.length; i++) {
|
||||
if (backArr.value[i].bm_name == '' || backArr.value[i].bm_img == '' || backArr.value[i].bm_pdf == '') {
|
||||
koiMsgError('请完善版面[' + (i + 1) + ']信息');
|
||||
return;
|
||||
}
|
||||
}
|
||||
const data = { date: form, bm: backArr.value };
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '保存中...',
|
||||
background: 'rgba(0, 0, 0, 0.1)',
|
||||
})
|
||||
try {
|
||||
await bmAdd(data);
|
||||
koiNoticeSuccess("保存成功!");
|
||||
loading.close();
|
||||
tabsStore.removeTab(route.fullPath);
|
||||
router.push('/paper/list');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("保存失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const left_right = (type, index) => {
|
||||
const arr = backArr.value;
|
||||
if (type === 'l' && index > 0) {
|
||||
// 向左移动
|
||||
[arr[index], arr[index - 1]] = [arr[index - 1], arr[index]];
|
||||
} else if (type === 'r' && index < arr.length - 1) {
|
||||
// 向右移动
|
||||
[arr[index], arr[index + 1]] = [arr[index + 1], arr[index]];
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
const del = (index) => {
|
||||
const arr = backArr.value;
|
||||
if (arr.length <= 1) {
|
||||
koiMsgError('至少保留一个版面');
|
||||
return;
|
||||
}
|
||||
if (index >= 0 && index < arr.length) {
|
||||
arr.splice(index, 1);
|
||||
}
|
||||
// 重置下标数组(这里假设重置下标数组的意思是重新排序或更新)
|
||||
backArr.value = [...arr];
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
525
.history/src/views/paper/list/index_20250427091346.vue
Normal file
@ -0,0 +1,525 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<!-- 表格头部按钮 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5" v-auth="['system:role:add']">
|
||||
<el-button type="primary" icon="plus" plain @click="handleAdd()">新增</el-button>
|
||||
<el-button type="success" icon="microphone" plain @click="Mp3Check()">生成语音文件</el-button>
|
||||
</el-col>
|
||||
<!-- @click="handleExpend()" -->
|
||||
</el-row>
|
||||
|
||||
<div class="h-20px"></div>
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-if="refreshTreeTable" v-loading="loading" border :indent="30" :data="tableList"
|
||||
:default-expand-all="isExpandAll" row-key="uuid" @row-click="rowClick" :lazy="true" :load="load"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" empty-text="暂时没有数据哟🌻">
|
||||
<el-table-column label="报纸期刊" prop="datetime" align="left" :show-overflow-tooltip="true" width="400px">
|
||||
<template #default="scope">
|
||||
<el-input @blur="addSort(scope.row)" v-if="scope.row.level == 2" :maxlength="2" class="center-input"
|
||||
style="max-width: 50px;margin-right: 10px" v-model="scope.row.weight"></el-input>
|
||||
<span class="cursor-pointer">{{ scope.row.datetime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status" width="250px" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status == 0" type="danger">已隐藏</el-tag>
|
||||
<el-tag v-if="scope.row.status == 1" type="success">显示中</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="bm_count" width="350px" align="center">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.level == 1">版面数量:{{ scope.row.bm_count }}</div>
|
||||
<div v-if="scope.row.level == 2">新闻数量:{{ scope.row.new_count }}</div>
|
||||
<div v-if="scope.row.level == 3">
|
||||
<audio v-if="scope.row.mp_url != null && scope.row.mp_url != ''" controls
|
||||
:src="'https://jinrigushitwo.gushitv.com/' + scope.row.mp_url"></audio>
|
||||
<span v-if="scope.row.mp_url == null || scope.row.mp_url == ''">语音生成中...</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="450px" fixed="right">
|
||||
<template #default="{ row }">
|
||||
|
||||
<el-button v-if="row.level == 1" type="info" @click="openA(row)">预览
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 1 && row.status == 1" type="primary" @click="statusUpdate(row, 0)">隐藏
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1 && row.status == 0" type="success" @click="statusUpdate(row, 1)">显示
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="warning" @click="handleAddDate(row)">添加版面
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="success" @click="handleUpdateDate(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="danger" @click="handleDeleteDate(row)">删除
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 2" type="info" plain @click="openUrl('/paper/article/index/' + row.id)">添加新闻
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="warning" plain @click="handleUpdateBm(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="danger" plain @click="handleDeleteBm(row)">删除
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 3" type="primary" icon="Edit" circle plain
|
||||
@click="openUrl('/paper/article/update/' + row.id)"></el-button>
|
||||
<el-button v-if="row.level == 3" type="danger" icon="Delete" circle plain
|
||||
@click="handleDeleteNews(row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="h-20px"></div>
|
||||
<!-- {{ searchParams.pageNo }} --- {{ searchParams.pageSize }} -->
|
||||
<!-- 分页 -->
|
||||
<el-pagination background v-model:current-page="pageNumber.page" v-model:page-size="pageNumber.size"
|
||||
:page-sizes="[10, 20, 50]" layout="total, sizes, prev, pager, next, jumper" :total="total"
|
||||
@size-change="handleListPageSize" @current-change="handleListPage" />
|
||||
</KoiCard>
|
||||
<KoiDialog ref="koiDrawerDate" :width="500" :height="100" title="期刊编辑" @koiConfirm="handleConfirmDateDo"
|
||||
@koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Dateform" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="Dateform.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="Dateform.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</KoiDialog>
|
||||
<KoiDialog ref="koiDrawerBm" :width="500" :height="400" :title="Bmform.id == 0 ? '添加版面' : '修改版面'"
|
||||
@koiConfirm="handleConfirmBmDo" @koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Bmform" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="Bmform.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input type="number" v-model="Bmform.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="Bmform.pdf" acceptType=".pdf" @update:fileList="updateFileList"
|
||||
@fileSuccess="getFileList">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="Bmform.bm_img" @update:imageUrl="getImgList" width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</template>
|
||||
</KoiDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="menuPage">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { koiNoticeSuccess, koiNoticeError, koiMsgError, koiMsgWarning, koiMsgBox, koiMsgInfo } from "@/utils/koi.ts";
|
||||
import { generateUUID } from "@/utils/index.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {
|
||||
bmDel,
|
||||
bmList,
|
||||
bmListNews,
|
||||
bmListNext,
|
||||
bmUpdate,
|
||||
dateDel,
|
||||
dateUpdate,
|
||||
getList,
|
||||
newsDel,
|
||||
bmOneAdd, getMp3
|
||||
} from "@/api/system/post/index.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
|
||||
const tabsStore = useTabsStore();
|
||||
const router = useRouter();
|
||||
// 表格加载动画Loading
|
||||
const loading = ref(false);
|
||||
// 是否显示搜索表单[默认显示]
|
||||
const showSearch = ref<boolean>(true); // 默认显示搜索条件
|
||||
|
||||
// 表格数据
|
||||
const tableList = ref([]);
|
||||
// 查询参数
|
||||
const searchParams = ref({
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
});
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const Dateform = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const total = ref(0);
|
||||
const pageNumber = reactive({ page: 1, size: 10 });
|
||||
/** 重置搜索参数 */
|
||||
const resetSearchParams = () => {
|
||||
searchParams.value = {
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
};
|
||||
};
|
||||
/*PDF删除*/
|
||||
const updateFileList = (d) => {
|
||||
console.log(d);
|
||||
//console.log(index);
|
||||
//backArr.value[index].bm_pdf = d.fullurl?d.fullurl:'';
|
||||
}
|
||||
const Mp3Check = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await getMp3('');
|
||||
koiNoticeSuccess("语音生成成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const openA = (item) => {
|
||||
console.log(item);
|
||||
var url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime;
|
||||
if (item.status == 0) {
|
||||
url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime + "&status=1";
|
||||
}
|
||||
window.open(url);
|
||||
}
|
||||
/*PDF上传*/
|
||||
const getFileList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_pdf = d.fullurl;
|
||||
}
|
||||
/*IMG上传*/
|
||||
const getImgList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_img = d;
|
||||
}
|
||||
/*获取PDF文件名称*/
|
||||
const getFileNameFromUrl = (url) => {
|
||||
// 使用最后一个斜杠的位置来分割路径
|
||||
const lastSlashIndex = url.lastIndexOf('/');
|
||||
if (lastSlashIndex === -1) {
|
||||
return 'pdf.pdf'; // 如果没有找到斜杠,则返回空字符串
|
||||
}
|
||||
// 提取文件名部分
|
||||
const fileName = url.substring(lastSlashIndex + 1);
|
||||
return fileName;
|
||||
}
|
||||
/** 搜索 */
|
||||
const handleSearch = () => {
|
||||
console.log("搜索");
|
||||
};
|
||||
const load = async (row, treeNode, resolve) => {
|
||||
console.log(row)
|
||||
console.log(treeNode)
|
||||
|
||||
try {
|
||||
if (row.level == 1) {
|
||||
var res: any = await bmListNext({ date_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.bm_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
} else {
|
||||
var res: any = await bmListNews({ bm_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.new_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
}
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
|
||||
resolve(res.data)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const Bmform = reactive({
|
||||
bm_img: "",
|
||||
bm_name: "",
|
||||
bm_pdf: "",
|
||||
id: 0,
|
||||
pdf: [],
|
||||
weight: 0,
|
||||
})
|
||||
/*版面修改*/
|
||||
const handleUpdateBm = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = row.datetime;
|
||||
Bmform.bm_img = row.bm_img;
|
||||
Bmform.bm_pdf = row.bm_pdf;
|
||||
Bmform.id = row.id;
|
||||
Bmform.pdf = [{ 'url': row.bm_pdf, 'name': getFileNameFromUrl(row.bm_pdf) }];
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*添加版面*/
|
||||
const handleAddDate = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = "";
|
||||
Bmform.bm_img = "";
|
||||
Bmform.bm_pdf = "";
|
||||
Bmform.weight = 0;
|
||||
Bmform.id = 0;
|
||||
Bmform.pdf = [];
|
||||
Bmform.date_id = row.id;
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*版面排序修改*/
|
||||
const addSort = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await bmUpdate({ id: row.id, weight: row.weight });
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const statusUpdate = async (row, type) => {
|
||||
try {
|
||||
const res: any = await dateUpdate({ status: type, id: row.id });
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
/*版面修改/添加*/
|
||||
const handleConfirmBmDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
if (Bmform.id == 0) {
|
||||
const res: any = await bmOneAdd(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("添加成功!");
|
||||
} else {
|
||||
const res: any = await bmUpdate(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
}
|
||||
confirmLoading.value = false;
|
||||
koiDrawerBm.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleListPageSize = (size) => {
|
||||
pageNumber.size = size;
|
||||
pageNumber.page = 1;
|
||||
handleTreeList();
|
||||
}
|
||||
const handleListPage = (page) => {
|
||||
console.log(page);
|
||||
pageNumber.page = page;
|
||||
handleTreeList();
|
||||
};
|
||||
/** 重置 */
|
||||
const resetSearch = () => {
|
||||
console.log("重置搜索");
|
||||
resetSearchParams();
|
||||
handleTreeList();
|
||||
};
|
||||
|
||||
/** 树形表格查询 */
|
||||
const handleTreeList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
tableList.value = []; // 重置表格数据
|
||||
const res: any = await bmList(pageNumber);
|
||||
console.log("菜单数据表格数据->", res.data.data);
|
||||
|
||||
res.data.data = res.data.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
};
|
||||
});
|
||||
|
||||
tableList.value = res.data.data;
|
||||
loading.value = false;
|
||||
total.value = res.data.count;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// 获取表格数据
|
||||
handleTreeList();
|
||||
getTypelist();
|
||||
// let index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// console.log(index)
|
||||
// while (typeof (index) !='undefined') {
|
||||
// tabsStore.removeTab(index.path);
|
||||
// index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// }
|
||||
});
|
||||
|
||||
const rowClick = (row, column, e) => {
|
||||
console.log(column);
|
||||
if (column?.property == "datetime") {
|
||||
if (e.currentTarget.querySelector(".el-table__expand-icon")) {
|
||||
const expandIcon = e.currentTarget.querySelector(".el-table__expand-icon");
|
||||
if (expandIcon) {
|
||||
expandIcon.style.cursor = "pointer";
|
||||
// 如果你需要点击展开图标,也可以在这里添加点击事件
|
||||
expandIcon.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重新渲染表格状态
|
||||
const refreshTreeTable = ref(true);
|
||||
// 是否展开[默认折叠]
|
||||
const isExpandAll = ref(true);
|
||||
|
||||
/** 添加 */
|
||||
const handleAdd = () => {
|
||||
router.push("/paper/add");
|
||||
};
|
||||
|
||||
/** 修改 */
|
||||
const handleUpdateDate = (row) => {
|
||||
console.log(row);
|
||||
Dateform.datetime = row.datetime;
|
||||
Dateform.type_id = row.type_id;
|
||||
Dateform.periods = row.periods;
|
||||
Dateform.id = row.id;
|
||||
koiDrawerDate.value.koiOpen();
|
||||
};
|
||||
/** 修改 */
|
||||
const handleConfirmDateDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
const res: any = await dateUpdate(Dateform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
confirmLoading.value = false;
|
||||
koiDrawerDate.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleCancel = () => {
|
||||
koiDrawerDate.value.koiClose();
|
||||
koiDrawerBm.value.koiClose();
|
||||
};
|
||||
// 添加 OR 修改对话框Ref
|
||||
const koiDrawerDate = ref();
|
||||
const koiDrawerBm = ref();
|
||||
// 确定按钮是否显示Loading
|
||||
const confirmLoading = ref(false);
|
||||
|
||||
const openUrl = (url) => {
|
||||
router.push(url);
|
||||
}
|
||||
|
||||
/** 删除期刊*/
|
||||
const handleDeleteDate = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除期刊[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await dateDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除版面*/
|
||||
const handleDeleteBm = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除版面[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await bmDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除新闻*/
|
||||
const handleDeleteNews = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除新闻[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await newsDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep(.center-input .el-input__inner) {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
537
.history/src/views/paper/list/index_20250626093303.vue
Normal file
@ -0,0 +1,537 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<!-- 表格头部按钮 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5" v-auth="['system:role:add']">
|
||||
<el-button type="primary" icon="plus" plain @click="handleAdd()">新增</el-button>
|
||||
<el-button type="success" icon="microphone" plain @click="Mp3Check()">生成语音文件</el-button>
|
||||
</el-col>
|
||||
<!-- @click="handleExpend()" -->
|
||||
</el-row>
|
||||
|
||||
<div class="h-20px"></div>
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-if="refreshTreeTable" v-loading="loading" border :indent="30" :data="tableList"
|
||||
:default-expand-all="isExpandAll" row-key="uuid" @row-click="rowClick" :lazy="true" :load="load"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" empty-text="暂时没有数据哟🌻">
|
||||
<el-table-column label="报纸期刊" prop="datetime" align="left" :show-overflow-tooltip="true" width="400px">
|
||||
<template #default="scope">
|
||||
<el-input @blur="addSort(scope.row)" v-if="scope.row.level == 2" :maxlength="2" class="center-input"
|
||||
style="max-width: 50px;margin-right: 10px" v-model="scope.row.weight"></el-input>
|
||||
<span class="cursor-pointer">{{ scope.row.datetime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status" width="250px" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status == 0" type="danger">已隐藏</el-tag>
|
||||
<el-tag v-if="scope.row.status == 1" type="success">显示中</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="bm_count" width="350px" align="center">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.level == 1">版面数量:{{ scope.row.bm_count }}</div>
|
||||
<div v-if="scope.row.level == 2">新闻数量:{{ scope.row.new_count }}</div>
|
||||
<div v-if="scope.row.level == 3">
|
||||
<audio v-if="scope.row.mp_url != null && scope.row.mp_url != ''" controls
|
||||
:src="'https://jinrigushitwo.gushitv.com/' + scope.row.mp_url"></audio>
|
||||
<span v-if="scope.row.mp_url == null || scope.row.mp_url == ''">语音生成中...</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="450px" fixed="right">
|
||||
<template #default="{ row }">
|
||||
|
||||
<el-button v-if="row.level == 1" type="info" @click="openA(row)">预览
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 1 && row.status == 1" type="primary" @click="statusUpdate(row, 0)">隐藏
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1 && row.status == 0" type="success" @click="statusUpdate(row, 1)">显示
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="warning" @click="handleAddDate(row)">添加版面
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="success" @click="handleUpdateDate(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="danger" @click="handleDeleteDate(row)">删除
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 2" type="info" plain @click="openUrl('/paper/article/index/' + row.id)">添加新闻
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="warning" plain @click="handleUpdateBm(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="danger" plain @click="handleDeleteBm(row)">删除
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 3" type="primary" icon="Edit" circle plain
|
||||
@click="openUrl('/paper/article/update/' + row.id)"></el-button>
|
||||
<el-button v-if="row.level == 3" type="danger" icon="Delete" circle plain
|
||||
@click="handleDeleteNews(row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="h-20px"></div>
|
||||
<!-- {{ searchParams.pageNo }} --- {{ searchParams.pageSize }} -->
|
||||
<!-- 分页 -->
|
||||
<el-pagination background v-model:current-page="pageNumber.page" v-model:page-size="pageNumber.size"
|
||||
:page-sizes="[10, 20, 50]" layout="total, sizes, prev, pager, next, jumper" :total="total"
|
||||
@size-change="handleListPageSize" @current-change="handleListPage" />
|
||||
</KoiCard>
|
||||
<KoiDialog ref="koiDrawerDate" :width="500" :height="100" title="期刊编辑" @koiConfirm="handleConfirmDateDo"
|
||||
@koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Dateform" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="Dateform.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="Dateform.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</KoiDialog>
|
||||
<KoiDialog ref="koiDrawerBm" :width="500" :height="400" :title="Bmform.id == 0 ? '添加版面' : '修改版面'"
|
||||
@koiConfirm="handleConfirmBmDo" @koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Bmform" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="Bmform.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input type="number" v-model="Bmform.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="Bmform.pdf" acceptType=".pdf" @update:fileList="updateFileList"
|
||||
@fileSuccess="getFileList">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileList="Bmform.video" acceptType=".mp4" @update:fileList="updateVideoList"
|
||||
@fileSuccess="getVideoList">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="Bmform.bm_img" @update:imageUrl="getImgList" width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</template>
|
||||
</KoiDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="menuPage">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { koiNoticeSuccess, koiNoticeError, koiMsgError, koiMsgWarning, koiMsgBox, koiMsgInfo } from "@/utils/koi.ts";
|
||||
import { generateUUID } from "@/utils/index.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {
|
||||
bmDel,
|
||||
bmList,
|
||||
bmListNews,
|
||||
bmListNext,
|
||||
bmUpdate,
|
||||
dateDel,
|
||||
dateUpdate,
|
||||
getList,
|
||||
newsDel,
|
||||
bmOneAdd, getMp3
|
||||
} from "@/api/system/post/index.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
|
||||
const tabsStore = useTabsStore();
|
||||
const router = useRouter();
|
||||
// 表格加载动画Loading
|
||||
const loading = ref(false);
|
||||
// 是否显示搜索表单[默认显示]
|
||||
const showSearch = ref<boolean>(true); // 默认显示搜索条件
|
||||
|
||||
// 表格数据
|
||||
const tableList = ref([]);
|
||||
// 查询参数
|
||||
const searchParams = ref({
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
});
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const Dateform = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const total = ref(0);
|
||||
const pageNumber = reactive({ page: 1, size: 10 });
|
||||
/** 重置搜索参数 */
|
||||
const resetSearchParams = () => {
|
||||
searchParams.value = {
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
};
|
||||
};
|
||||
/*PDF删除*/
|
||||
const updateFileList = (d) => {
|
||||
console.log(d);
|
||||
//console.log(index);
|
||||
//backArr.value[index].bm_pdf = d.fullurl?d.fullurl:'';
|
||||
}
|
||||
const Mp3Check = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await getMp3('');
|
||||
koiNoticeSuccess("语音生成成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const openA = (item) => {
|
||||
console.log(item);
|
||||
var url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime;
|
||||
if (item.status == 0) {
|
||||
url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime + "&status=1";
|
||||
}
|
||||
window.open(url);
|
||||
}
|
||||
/*PDF上传*/
|
||||
const getFileList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_pdf = d.fullurl;
|
||||
}
|
||||
/*IMG上传*/
|
||||
const getImgList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_img = d;
|
||||
}
|
||||
/*获取PDF文件名称*/
|
||||
const getFileNameFromUrl = (url) => {
|
||||
// 使用最后一个斜杠的位置来分割路径
|
||||
const lastSlashIndex = url.lastIndexOf('/');
|
||||
if (lastSlashIndex === -1) {
|
||||
return 'pdf.pdf'; // 如果没有找到斜杠,则返回空字符串
|
||||
}
|
||||
// 提取文件名部分
|
||||
const fileName = url.substring(lastSlashIndex + 1);
|
||||
return fileName;
|
||||
}
|
||||
/** 搜索 */
|
||||
const handleSearch = () => {
|
||||
console.log("搜索");
|
||||
};
|
||||
const load = async (row, treeNode, resolve) => {
|
||||
console.log(row)
|
||||
console.log(treeNode)
|
||||
|
||||
try {
|
||||
if (row.level == 1) {
|
||||
var res: any = await bmListNext({ date_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.bm_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
} else {
|
||||
var res: any = await bmListNews({ bm_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.new_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
}
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
|
||||
resolve(res.data)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const Bmform = reactive({
|
||||
bm_img: "",
|
||||
bm_name: "",
|
||||
bm_pdf: "",
|
||||
bm_video:"",
|
||||
id: 0,
|
||||
pdf: [],
|
||||
video:[],
|
||||
weight: 0,
|
||||
})
|
||||
/*版面修改*/
|
||||
const handleUpdateBm = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = row.datetime;
|
||||
Bmform.bm_img = row.bm_img;
|
||||
Bmform.bm_pdf = row.bm_pdf;
|
||||
Bmform.bm_video = row.bm_video;
|
||||
Bmform.id = row.id;
|
||||
Bmform.pdf = [{ 'url': row.bm_pdf, 'name': getFileNameFromUrl(row.bm_pdf) }];
|
||||
Bmform.video = [{ 'url': row.bm_video, 'name': getFileNameFromUrl(row.bm_video) }];
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*添加版面*/
|
||||
const handleAddDate = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = "";
|
||||
Bmform.bm_img = "";
|
||||
Bmform.bm_pdf = "";
|
||||
Bmform.bm_video = "";
|
||||
Bmform.weight = 0;
|
||||
Bmform.id = 0;
|
||||
Bmform.pdf = [];
|
||||
Bmform.video = [];
|
||||
Bmform.date_id = row.id;
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*版面排序修改*/
|
||||
const addSort = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await bmUpdate({ id: row.id, weight: row.weight });
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const statusUpdate = async (row, type) => {
|
||||
try {
|
||||
const res: any = await dateUpdate({ status: type, id: row.id });
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
/*版面修改/添加*/
|
||||
const handleConfirmBmDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
if (Bmform.id == 0) {
|
||||
const res: any = await bmOneAdd(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("添加成功!");
|
||||
} else {
|
||||
const res: any = await bmUpdate(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
}
|
||||
confirmLoading.value = false;
|
||||
koiDrawerBm.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleListPageSize = (size) => {
|
||||
pageNumber.size = size;
|
||||
pageNumber.page = 1;
|
||||
handleTreeList();
|
||||
}
|
||||
const handleListPage = (page) => {
|
||||
console.log(page);
|
||||
pageNumber.page = page;
|
||||
handleTreeList();
|
||||
};
|
||||
/** 重置 */
|
||||
const resetSearch = () => {
|
||||
console.log("重置搜索");
|
||||
resetSearchParams();
|
||||
handleTreeList();
|
||||
};
|
||||
|
||||
/** 树形表格查询 */
|
||||
const handleTreeList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
tableList.value = []; // 重置表格数据
|
||||
const res: any = await bmList(pageNumber);
|
||||
console.log("菜单数据表格数据->", res.data.data);
|
||||
|
||||
res.data.data = res.data.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
};
|
||||
});
|
||||
|
||||
tableList.value = res.data.data;
|
||||
loading.value = false;
|
||||
total.value = res.data.count;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// 获取表格数据
|
||||
handleTreeList();
|
||||
getTypelist();
|
||||
// let index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// console.log(index)
|
||||
// while (typeof (index) !='undefined') {
|
||||
// tabsStore.removeTab(index.path);
|
||||
// index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// }
|
||||
});
|
||||
|
||||
const rowClick = (row, column, e) => {
|
||||
console.log(column);
|
||||
if (column?.property == "datetime") {
|
||||
if (e.currentTarget.querySelector(".el-table__expand-icon")) {
|
||||
const expandIcon = e.currentTarget.querySelector(".el-table__expand-icon");
|
||||
if (expandIcon) {
|
||||
expandIcon.style.cursor = "pointer";
|
||||
// 如果你需要点击展开图标,也可以在这里添加点击事件
|
||||
expandIcon.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重新渲染表格状态
|
||||
const refreshTreeTable = ref(true);
|
||||
// 是否展开[默认折叠]
|
||||
const isExpandAll = ref(true);
|
||||
|
||||
/** 添加 */
|
||||
const handleAdd = () => {
|
||||
router.push("/paper/add");
|
||||
};
|
||||
|
||||
/** 修改 */
|
||||
const handleUpdateDate = (row) => {
|
||||
console.log(row);
|
||||
Dateform.datetime = row.datetime;
|
||||
Dateform.type_id = row.type_id;
|
||||
Dateform.periods = row.periods;
|
||||
Dateform.id = row.id;
|
||||
koiDrawerDate.value.koiOpen();
|
||||
};
|
||||
/** 修改 */
|
||||
const handleConfirmDateDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
const res: any = await dateUpdate(Dateform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
confirmLoading.value = false;
|
||||
koiDrawerDate.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleCancel = () => {
|
||||
koiDrawerDate.value.koiClose();
|
||||
koiDrawerBm.value.koiClose();
|
||||
};
|
||||
// 添加 OR 修改对话框Ref
|
||||
const koiDrawerDate = ref();
|
||||
const koiDrawerBm = ref();
|
||||
// 确定按钮是否显示Loading
|
||||
const confirmLoading = ref(false);
|
||||
|
||||
const openUrl = (url) => {
|
||||
router.push(url);
|
||||
}
|
||||
|
||||
/** 删除期刊*/
|
||||
const handleDeleteDate = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除期刊[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await dateDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除版面*/
|
||||
const handleDeleteBm = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除版面[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await bmDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除新闻*/
|
||||
const handleDeleteNews = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除新闻[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await newsDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep(.center-input .el-input__inner) {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
544
.history/src/views/paper/list/index_20250626093346.vue
Normal file
@ -0,0 +1,544 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<!-- 表格头部按钮 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5" v-auth="['system:role:add']">
|
||||
<el-button type="primary" icon="plus" plain @click="handleAdd()">新增</el-button>
|
||||
<el-button type="success" icon="microphone" plain @click="Mp3Check()">生成语音文件</el-button>
|
||||
</el-col>
|
||||
<!-- @click="handleExpend()" -->
|
||||
</el-row>
|
||||
|
||||
<div class="h-20px"></div>
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-if="refreshTreeTable" v-loading="loading" border :indent="30" :data="tableList"
|
||||
:default-expand-all="isExpandAll" row-key="uuid" @row-click="rowClick" :lazy="true" :load="load"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" empty-text="暂时没有数据哟🌻">
|
||||
<el-table-column label="报纸期刊" prop="datetime" align="left" :show-overflow-tooltip="true" width="400px">
|
||||
<template #default="scope">
|
||||
<el-input @blur="addSort(scope.row)" v-if="scope.row.level == 2" :maxlength="2" class="center-input"
|
||||
style="max-width: 50px;margin-right: 10px" v-model="scope.row.weight"></el-input>
|
||||
<span class="cursor-pointer">{{ scope.row.datetime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status" width="250px" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status == 0" type="danger">已隐藏</el-tag>
|
||||
<el-tag v-if="scope.row.status == 1" type="success">显示中</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="bm_count" width="350px" align="center">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.level == 1">版面数量:{{ scope.row.bm_count }}</div>
|
||||
<div v-if="scope.row.level == 2">新闻数量:{{ scope.row.new_count }}</div>
|
||||
<div v-if="scope.row.level == 3">
|
||||
<audio v-if="scope.row.mp_url != null && scope.row.mp_url != ''" controls
|
||||
:src="'https://jinrigushitwo.gushitv.com/' + scope.row.mp_url"></audio>
|
||||
<span v-if="scope.row.mp_url == null || scope.row.mp_url == ''">语音生成中...</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="450px" fixed="right">
|
||||
<template #default="{ row }">
|
||||
|
||||
<el-button v-if="row.level == 1" type="info" @click="openA(row)">预览
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 1 && row.status == 1" type="primary" @click="statusUpdate(row, 0)">隐藏
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1 && row.status == 0" type="success" @click="statusUpdate(row, 1)">显示
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="warning" @click="handleAddDate(row)">添加版面
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="success" @click="handleUpdateDate(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="danger" @click="handleDeleteDate(row)">删除
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 2" type="info" plain @click="openUrl('/paper/article/index/' + row.id)">添加新闻
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="warning" plain @click="handleUpdateBm(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="danger" plain @click="handleDeleteBm(row)">删除
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 3" type="primary" icon="Edit" circle plain
|
||||
@click="openUrl('/paper/article/update/' + row.id)"></el-button>
|
||||
<el-button v-if="row.level == 3" type="danger" icon="Delete" circle plain
|
||||
@click="handleDeleteNews(row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="h-20px"></div>
|
||||
<!-- {{ searchParams.pageNo }} --- {{ searchParams.pageSize }} -->
|
||||
<!-- 分页 -->
|
||||
<el-pagination background v-model:current-page="pageNumber.page" v-model:page-size="pageNumber.size"
|
||||
:page-sizes="[10, 20, 50]" layout="total, sizes, prev, pager, next, jumper" :total="total"
|
||||
@size-change="handleListPageSize" @current-change="handleListPage" />
|
||||
</KoiCard>
|
||||
<KoiDialog ref="koiDrawerDate" :width="500" :height="100" title="期刊编辑" @koiConfirm="handleConfirmDateDo"
|
||||
@koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Dateform" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="Dateform.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="Dateform.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</KoiDialog>
|
||||
<KoiDialog ref="koiDrawerBm" :width="500" :height="400" :title="Bmform.id == 0 ? '添加版面' : '修改版面'"
|
||||
@koiConfirm="handleConfirmBmDo" @koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Bmform" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="Bmform.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input type="number" v-model="Bmform.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="Bmform.pdf" acceptType=".pdf" @update:fileList="updateFileList"
|
||||
@fileSuccess="getFileList">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileList="Bmform.video" acceptType=".mp4" @update:fileList="updateVideoList"
|
||||
@fileSuccess="getVideoList">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="Bmform.bm_img" @update:imageUrl="getImgList" width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</template>
|
||||
</KoiDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="menuPage">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { koiNoticeSuccess, koiNoticeError, koiMsgError, koiMsgWarning, koiMsgBox, koiMsgInfo } from "@/utils/koi.ts";
|
||||
import { generateUUID } from "@/utils/index.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {
|
||||
bmDel,
|
||||
bmList,
|
||||
bmListNews,
|
||||
bmListNext,
|
||||
bmUpdate,
|
||||
dateDel,
|
||||
dateUpdate,
|
||||
getList,
|
||||
newsDel,
|
||||
bmOneAdd, getMp3
|
||||
} from "@/api/system/post/index.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
|
||||
const tabsStore = useTabsStore();
|
||||
const router = useRouter();
|
||||
// 表格加载动画Loading
|
||||
const loading = ref(false);
|
||||
// 是否显示搜索表单[默认显示]
|
||||
const showSearch = ref<boolean>(true); // 默认显示搜索条件
|
||||
|
||||
// 表格数据
|
||||
const tableList = ref([]);
|
||||
// 查询参数
|
||||
const searchParams = ref({
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
});
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const Dateform = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const total = ref(0);
|
||||
const pageNumber = reactive({ page: 1, size: 10 });
|
||||
/** 重置搜索参数 */
|
||||
const resetSearchParams = () => {
|
||||
searchParams.value = {
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
};
|
||||
};
|
||||
/*PDF删除*/
|
||||
const updateFileList = (d) => {
|
||||
console.log(d);
|
||||
//console.log(index);
|
||||
//backArr.value[index].bm_pdf = d.fullurl?d.fullurl:'';
|
||||
}
|
||||
const Mp3Check = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await getMp3('');
|
||||
koiNoticeSuccess("语音生成成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const openA = (item) => {
|
||||
console.log(item);
|
||||
var url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime;
|
||||
if (item.status == 0) {
|
||||
url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime + "&status=1";
|
||||
}
|
||||
window.open(url);
|
||||
}
|
||||
/*PDF上传*/
|
||||
const getFileList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_pdf = d.fullurl;
|
||||
}
|
||||
|
||||
/*视频上传*/
|
||||
const getVideoList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_video = d.fullurl;
|
||||
}
|
||||
|
||||
/*IMG上传*/
|
||||
const getImgList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_img = d;
|
||||
}
|
||||
/*获取PDF文件名称*/
|
||||
const getFileNameFromUrl = (url) => {
|
||||
// 使用最后一个斜杠的位置来分割路径
|
||||
const lastSlashIndex = url.lastIndexOf('/');
|
||||
if (lastSlashIndex === -1) {
|
||||
return 'pdf.pdf'; // 如果没有找到斜杠,则返回空字符串
|
||||
}
|
||||
// 提取文件名部分
|
||||
const fileName = url.substring(lastSlashIndex + 1);
|
||||
return fileName;
|
||||
}
|
||||
/** 搜索 */
|
||||
const handleSearch = () => {
|
||||
console.log("搜索");
|
||||
};
|
||||
const load = async (row, treeNode, resolve) => {
|
||||
console.log(row)
|
||||
console.log(treeNode)
|
||||
|
||||
try {
|
||||
if (row.level == 1) {
|
||||
var res: any = await bmListNext({ date_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.bm_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
} else {
|
||||
var res: any = await bmListNews({ bm_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.new_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
}
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
|
||||
resolve(res.data)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const Bmform = reactive({
|
||||
bm_img: "",
|
||||
bm_name: "",
|
||||
bm_pdf: "",
|
||||
bm_video:"",
|
||||
id: 0,
|
||||
pdf: [],
|
||||
video:[],
|
||||
weight: 0,
|
||||
})
|
||||
/*版面修改*/
|
||||
const handleUpdateBm = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = row.datetime;
|
||||
Bmform.bm_img = row.bm_img;
|
||||
Bmform.bm_pdf = row.bm_pdf;
|
||||
Bmform.bm_video = row.bm_video;
|
||||
Bmform.id = row.id;
|
||||
Bmform.pdf = [{ 'url': row.bm_pdf, 'name': getFileNameFromUrl(row.bm_pdf) }];
|
||||
Bmform.video = [{ 'url': row.bm_video, 'name': getFileNameFromUrl(row.bm_video) }];
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*添加版面*/
|
||||
const handleAddDate = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = "";
|
||||
Bmform.bm_img = "";
|
||||
Bmform.bm_pdf = "";
|
||||
Bmform.bm_video = "";
|
||||
Bmform.weight = 0;
|
||||
Bmform.id = 0;
|
||||
Bmform.pdf = [];
|
||||
Bmform.video = [];
|
||||
Bmform.date_id = row.id;
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*版面排序修改*/
|
||||
const addSort = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await bmUpdate({ id: row.id, weight: row.weight });
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const statusUpdate = async (row, type) => {
|
||||
try {
|
||||
const res: any = await dateUpdate({ status: type, id: row.id });
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
/*版面修改/添加*/
|
||||
const handleConfirmBmDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
if (Bmform.id == 0) {
|
||||
const res: any = await bmOneAdd(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("添加成功!");
|
||||
} else {
|
||||
const res: any = await bmUpdate(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
}
|
||||
confirmLoading.value = false;
|
||||
koiDrawerBm.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleListPageSize = (size) => {
|
||||
pageNumber.size = size;
|
||||
pageNumber.page = 1;
|
||||
handleTreeList();
|
||||
}
|
||||
const handleListPage = (page) => {
|
||||
console.log(page);
|
||||
pageNumber.page = page;
|
||||
handleTreeList();
|
||||
};
|
||||
/** 重置 */
|
||||
const resetSearch = () => {
|
||||
console.log("重置搜索");
|
||||
resetSearchParams();
|
||||
handleTreeList();
|
||||
};
|
||||
|
||||
/** 树形表格查询 */
|
||||
const handleTreeList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
tableList.value = []; // 重置表格数据
|
||||
const res: any = await bmList(pageNumber);
|
||||
console.log("菜单数据表格数据->", res.data.data);
|
||||
|
||||
res.data.data = res.data.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
};
|
||||
});
|
||||
|
||||
tableList.value = res.data.data;
|
||||
loading.value = false;
|
||||
total.value = res.data.count;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// 获取表格数据
|
||||
handleTreeList();
|
||||
getTypelist();
|
||||
// let index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// console.log(index)
|
||||
// while (typeof (index) !='undefined') {
|
||||
// tabsStore.removeTab(index.path);
|
||||
// index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// }
|
||||
});
|
||||
|
||||
const rowClick = (row, column, e) => {
|
||||
console.log(column);
|
||||
if (column?.property == "datetime") {
|
||||
if (e.currentTarget.querySelector(".el-table__expand-icon")) {
|
||||
const expandIcon = e.currentTarget.querySelector(".el-table__expand-icon");
|
||||
if (expandIcon) {
|
||||
expandIcon.style.cursor = "pointer";
|
||||
// 如果你需要点击展开图标,也可以在这里添加点击事件
|
||||
expandIcon.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重新渲染表格状态
|
||||
const refreshTreeTable = ref(true);
|
||||
// 是否展开[默认折叠]
|
||||
const isExpandAll = ref(true);
|
||||
|
||||
/** 添加 */
|
||||
const handleAdd = () => {
|
||||
router.push("/paper/add");
|
||||
};
|
||||
|
||||
/** 修改 */
|
||||
const handleUpdateDate = (row) => {
|
||||
console.log(row);
|
||||
Dateform.datetime = row.datetime;
|
||||
Dateform.type_id = row.type_id;
|
||||
Dateform.periods = row.periods;
|
||||
Dateform.id = row.id;
|
||||
koiDrawerDate.value.koiOpen();
|
||||
};
|
||||
/** 修改 */
|
||||
const handleConfirmDateDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
const res: any = await dateUpdate(Dateform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
confirmLoading.value = false;
|
||||
koiDrawerDate.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleCancel = () => {
|
||||
koiDrawerDate.value.koiClose();
|
||||
koiDrawerBm.value.koiClose();
|
||||
};
|
||||
// 添加 OR 修改对话框Ref
|
||||
const koiDrawerDate = ref();
|
||||
const koiDrawerBm = ref();
|
||||
// 确定按钮是否显示Loading
|
||||
const confirmLoading = ref(false);
|
||||
|
||||
const openUrl = (url) => {
|
||||
router.push(url);
|
||||
}
|
||||
|
||||
/** 删除期刊*/
|
||||
const handleDeleteDate = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除期刊[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await dateDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除版面*/
|
||||
const handleDeleteBm = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除版面[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await bmDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除新闻*/
|
||||
const handleDeleteNews = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除新闻[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await newsDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep(.center-input .el-input__inner) {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
544
.history/src/views/paper/list/index_20250626093409.vue
Normal file
@ -0,0 +1,544 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<!-- 表格头部按钮 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5" v-auth="['system:role:add']">
|
||||
<el-button type="primary" icon="plus" plain @click="handleAdd()">新增</el-button>
|
||||
<el-button type="success" icon="microphone" plain @click="Mp3Check()">生成语音文件</el-button>
|
||||
</el-col>
|
||||
<!-- @click="handleExpend()" -->
|
||||
</el-row>
|
||||
|
||||
<div class="h-20px"></div>
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-if="refreshTreeTable" v-loading="loading" border :indent="30" :data="tableList"
|
||||
:default-expand-all="isExpandAll" row-key="uuid" @row-click="rowClick" :lazy="true" :load="load"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" empty-text="暂时没有数据哟🌻">
|
||||
<el-table-column label="报纸期刊" prop="datetime" align="left" :show-overflow-tooltip="true" width="400px">
|
||||
<template #default="scope">
|
||||
<el-input @blur="addSort(scope.row)" v-if="scope.row.level == 2" :maxlength="2" class="center-input"
|
||||
style="max-width: 50px;margin-right: 10px" v-model="scope.row.weight"></el-input>
|
||||
<span class="cursor-pointer">{{ scope.row.datetime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status" width="250px" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status == 0" type="danger">已隐藏</el-tag>
|
||||
<el-tag v-if="scope.row.status == 1" type="success">显示中</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="bm_count" width="350px" align="center">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.level == 1">版面数量:{{ scope.row.bm_count }}</div>
|
||||
<div v-if="scope.row.level == 2">新闻数量:{{ scope.row.new_count }}</div>
|
||||
<div v-if="scope.row.level == 3">
|
||||
<audio v-if="scope.row.mp_url != null && scope.row.mp_url != ''" controls
|
||||
:src="'https://jinrigushitwo.gushitv.com/' + scope.row.mp_url"></audio>
|
||||
<span v-if="scope.row.mp_url == null || scope.row.mp_url == ''">语音生成中...</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="450px" fixed="right">
|
||||
<template #default="{ row }">
|
||||
|
||||
<el-button v-if="row.level == 1" type="info" @click="openA(row)">预览
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 1 && row.status == 1" type="primary" @click="statusUpdate(row, 0)">隐藏
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1 && row.status == 0" type="success" @click="statusUpdate(row, 1)">显示
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="warning" @click="handleAddDate(row)">添加版面
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="success" @click="handleUpdateDate(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="danger" @click="handleDeleteDate(row)">删除
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 2" type="info" plain @click="openUrl('/paper/article/index/' + row.id)">添加新闻
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="warning" plain @click="handleUpdateBm(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="danger" plain @click="handleDeleteBm(row)">删除
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 3" type="primary" icon="Edit" circle plain
|
||||
@click="openUrl('/paper/article/update/' + row.id)"></el-button>
|
||||
<el-button v-if="row.level == 3" type="danger" icon="Delete" circle plain
|
||||
@click="handleDeleteNews(row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="h-20px"></div>
|
||||
<!-- {{ searchParams.pageNo }} --- {{ searchParams.pageSize }} -->
|
||||
<!-- 分页 -->
|
||||
<el-pagination background v-model:current-page="pageNumber.page" v-model:page-size="pageNumber.size"
|
||||
:page-sizes="[10, 20, 50]" layout="total, sizes, prev, pager, next, jumper" :total="total"
|
||||
@size-change="handleListPageSize" @current-change="handleListPage" />
|
||||
</KoiCard>
|
||||
<KoiDialog ref="koiDrawerDate" :width="500" :height="100" title="期刊编辑" @koiConfirm="handleConfirmDateDo"
|
||||
@koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Dateform" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="Dateform.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="Dateform.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</KoiDialog>
|
||||
<KoiDialog ref="koiDrawerBm" :width="500" :height="400" :title="Bmform.id == 0 ? '添加版面' : '修改版面'"
|
||||
@koiConfirm="handleConfirmBmDo" @koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Bmform" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="Bmform.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input type="number" v-model="Bmform.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="Bmform.pdf" acceptType=".pdf" @update:fileList="updateFileList"
|
||||
@fileSuccess="getFileList">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileSize="100" :fileList="Bmform.video" acceptType=".mp4" @update:fileList="updateVideoList"
|
||||
@fileSuccess="getVideoList">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="Bmform.bm_img" @update:imageUrl="getImgList" width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</template>
|
||||
</KoiDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="menuPage">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { koiNoticeSuccess, koiNoticeError, koiMsgError, koiMsgWarning, koiMsgBox, koiMsgInfo } from "@/utils/koi.ts";
|
||||
import { generateUUID } from "@/utils/index.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {
|
||||
bmDel,
|
||||
bmList,
|
||||
bmListNews,
|
||||
bmListNext,
|
||||
bmUpdate,
|
||||
dateDel,
|
||||
dateUpdate,
|
||||
getList,
|
||||
newsDel,
|
||||
bmOneAdd, getMp3
|
||||
} from "@/api/system/post/index.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
|
||||
const tabsStore = useTabsStore();
|
||||
const router = useRouter();
|
||||
// 表格加载动画Loading
|
||||
const loading = ref(false);
|
||||
// 是否显示搜索表单[默认显示]
|
||||
const showSearch = ref<boolean>(true); // 默认显示搜索条件
|
||||
|
||||
// 表格数据
|
||||
const tableList = ref([]);
|
||||
// 查询参数
|
||||
const searchParams = ref({
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
});
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const Dateform = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const total = ref(0);
|
||||
const pageNumber = reactive({ page: 1, size: 10 });
|
||||
/** 重置搜索参数 */
|
||||
const resetSearchParams = () => {
|
||||
searchParams.value = {
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
};
|
||||
};
|
||||
/*PDF删除*/
|
||||
const updateFileList = (d) => {
|
||||
console.log(d);
|
||||
//console.log(index);
|
||||
//backArr.value[index].bm_pdf = d.fullurl?d.fullurl:'';
|
||||
}
|
||||
const Mp3Check = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await getMp3('');
|
||||
koiNoticeSuccess("语音生成成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const openA = (item) => {
|
||||
console.log(item);
|
||||
var url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime;
|
||||
if (item.status == 0) {
|
||||
url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime + "&status=1";
|
||||
}
|
||||
window.open(url);
|
||||
}
|
||||
/*PDF上传*/
|
||||
const getFileList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_pdf = d.fullurl;
|
||||
}
|
||||
|
||||
/*视频上传*/
|
||||
const getVideoList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_video = d.fullurl;
|
||||
}
|
||||
|
||||
/*IMG上传*/
|
||||
const getImgList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_img = d;
|
||||
}
|
||||
/*获取PDF文件名称*/
|
||||
const getFileNameFromUrl = (url) => {
|
||||
// 使用最后一个斜杠的位置来分割路径
|
||||
const lastSlashIndex = url.lastIndexOf('/');
|
||||
if (lastSlashIndex === -1) {
|
||||
return 'pdf.pdf'; // 如果没有找到斜杠,则返回空字符串
|
||||
}
|
||||
// 提取文件名部分
|
||||
const fileName = url.substring(lastSlashIndex + 1);
|
||||
return fileName;
|
||||
}
|
||||
/** 搜索 */
|
||||
const handleSearch = () => {
|
||||
console.log("搜索");
|
||||
};
|
||||
const load = async (row, treeNode, resolve) => {
|
||||
console.log(row)
|
||||
console.log(treeNode)
|
||||
|
||||
try {
|
||||
if (row.level == 1) {
|
||||
var res: any = await bmListNext({ date_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.bm_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
} else {
|
||||
var res: any = await bmListNews({ bm_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.new_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
}
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
|
||||
resolve(res.data)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const Bmform = reactive({
|
||||
bm_img: "",
|
||||
bm_name: "",
|
||||
bm_pdf: "",
|
||||
bm_video:"",
|
||||
id: 0,
|
||||
pdf: [],
|
||||
video:[],
|
||||
weight: 0,
|
||||
})
|
||||
/*版面修改*/
|
||||
const handleUpdateBm = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = row.datetime;
|
||||
Bmform.bm_img = row.bm_img;
|
||||
Bmform.bm_pdf = row.bm_pdf;
|
||||
Bmform.bm_video = row.bm_video;
|
||||
Bmform.id = row.id;
|
||||
Bmform.pdf = [{ 'url': row.bm_pdf, 'name': getFileNameFromUrl(row.bm_pdf) }];
|
||||
Bmform.video = [{ 'url': row.bm_video, 'name': getFileNameFromUrl(row.bm_video) }];
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*添加版面*/
|
||||
const handleAddDate = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = "";
|
||||
Bmform.bm_img = "";
|
||||
Bmform.bm_pdf = "";
|
||||
Bmform.bm_video = "";
|
||||
Bmform.weight = 0;
|
||||
Bmform.id = 0;
|
||||
Bmform.pdf = [];
|
||||
Bmform.video = [];
|
||||
Bmform.date_id = row.id;
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*版面排序修改*/
|
||||
const addSort = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await bmUpdate({ id: row.id, weight: row.weight });
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const statusUpdate = async (row, type) => {
|
||||
try {
|
||||
const res: any = await dateUpdate({ status: type, id: row.id });
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
/*版面修改/添加*/
|
||||
const handleConfirmBmDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
if (Bmform.id == 0) {
|
||||
const res: any = await bmOneAdd(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("添加成功!");
|
||||
} else {
|
||||
const res: any = await bmUpdate(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
}
|
||||
confirmLoading.value = false;
|
||||
koiDrawerBm.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleListPageSize = (size) => {
|
||||
pageNumber.size = size;
|
||||
pageNumber.page = 1;
|
||||
handleTreeList();
|
||||
}
|
||||
const handleListPage = (page) => {
|
||||
console.log(page);
|
||||
pageNumber.page = page;
|
||||
handleTreeList();
|
||||
};
|
||||
/** 重置 */
|
||||
const resetSearch = () => {
|
||||
console.log("重置搜索");
|
||||
resetSearchParams();
|
||||
handleTreeList();
|
||||
};
|
||||
|
||||
/** 树形表格查询 */
|
||||
const handleTreeList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
tableList.value = []; // 重置表格数据
|
||||
const res: any = await bmList(pageNumber);
|
||||
console.log("菜单数据表格数据->", res.data.data);
|
||||
|
||||
res.data.data = res.data.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
};
|
||||
});
|
||||
|
||||
tableList.value = res.data.data;
|
||||
loading.value = false;
|
||||
total.value = res.data.count;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// 获取表格数据
|
||||
handleTreeList();
|
||||
getTypelist();
|
||||
// let index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// console.log(index)
|
||||
// while (typeof (index) !='undefined') {
|
||||
// tabsStore.removeTab(index.path);
|
||||
// index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// }
|
||||
});
|
||||
|
||||
const rowClick = (row, column, e) => {
|
||||
console.log(column);
|
||||
if (column?.property == "datetime") {
|
||||
if (e.currentTarget.querySelector(".el-table__expand-icon")) {
|
||||
const expandIcon = e.currentTarget.querySelector(".el-table__expand-icon");
|
||||
if (expandIcon) {
|
||||
expandIcon.style.cursor = "pointer";
|
||||
// 如果你需要点击展开图标,也可以在这里添加点击事件
|
||||
expandIcon.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重新渲染表格状态
|
||||
const refreshTreeTable = ref(true);
|
||||
// 是否展开[默认折叠]
|
||||
const isExpandAll = ref(true);
|
||||
|
||||
/** 添加 */
|
||||
const handleAdd = () => {
|
||||
router.push("/paper/add");
|
||||
};
|
||||
|
||||
/** 修改 */
|
||||
const handleUpdateDate = (row) => {
|
||||
console.log(row);
|
||||
Dateform.datetime = row.datetime;
|
||||
Dateform.type_id = row.type_id;
|
||||
Dateform.periods = row.periods;
|
||||
Dateform.id = row.id;
|
||||
koiDrawerDate.value.koiOpen();
|
||||
};
|
||||
/** 修改 */
|
||||
const handleConfirmDateDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
const res: any = await dateUpdate(Dateform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
confirmLoading.value = false;
|
||||
koiDrawerDate.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleCancel = () => {
|
||||
koiDrawerDate.value.koiClose();
|
||||
koiDrawerBm.value.koiClose();
|
||||
};
|
||||
// 添加 OR 修改对话框Ref
|
||||
const koiDrawerDate = ref();
|
||||
const koiDrawerBm = ref();
|
||||
// 确定按钮是否显示Loading
|
||||
const confirmLoading = ref(false);
|
||||
|
||||
const openUrl = (url) => {
|
||||
router.push(url);
|
||||
}
|
||||
|
||||
/** 删除期刊*/
|
||||
const handleDeleteDate = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除期刊[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await dateDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除版面*/
|
||||
const handleDeleteBm = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除版面[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await bmDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除新闻*/
|
||||
const handleDeleteNews = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除新闻[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await newsDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep(.center-input .el-input__inner) {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
544
.history/src/views/paper/list/index_20250626095129.vue
Normal file
@ -0,0 +1,544 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<!-- 表格头部按钮 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5" v-auth="['system:role:add']">
|
||||
<el-button type="primary" icon="plus" plain @click="handleAdd()">新增</el-button>
|
||||
<el-button type="success" icon="microphone" plain @click="Mp3Check()">生成语音文件</el-button>
|
||||
</el-col>
|
||||
<!-- @click="handleExpend()" -->
|
||||
</el-row>
|
||||
|
||||
<div class="h-20px"></div>
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-if="refreshTreeTable" v-loading="loading" border :indent="30" :data="tableList"
|
||||
:default-expand-all="isExpandAll" row-key="uuid" @row-click="rowClick" :lazy="true" :load="load"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" empty-text="暂时没有数据哟🌻">
|
||||
<el-table-column label="报纸期刊" prop="datetime" align="left" :show-overflow-tooltip="true" width="400px">
|
||||
<template #default="scope">
|
||||
<el-input @blur="addSort(scope.row)" v-if="scope.row.level == 2" :maxlength="2" class="center-input"
|
||||
style="max-width: 50px;margin-right: 10px" v-model="scope.row.weight"></el-input>
|
||||
<span class="cursor-pointer">{{ scope.row.datetime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status" width="250px" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status == 0" type="danger">已隐藏</el-tag>
|
||||
<el-tag v-if="scope.row.status == 1" type="success">显示中</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="bm_count" width="350px" align="center">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.level == 1">版面数量:{{ scope.row.bm_count }}</div>
|
||||
<div v-if="scope.row.level == 2">新闻数量:{{ scope.row.new_count }}</div>
|
||||
<div v-if="scope.row.level == 3">
|
||||
<audio v-if="scope.row.mp_url != null && scope.row.mp_url != ''" controls
|
||||
:src="'https://jinrigushitwo.gushitv.com/' + scope.row.mp_url"></audio>
|
||||
<span v-if="scope.row.mp_url == null || scope.row.mp_url == ''">语音生成中...</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="450px" fixed="right">
|
||||
<template #default="{ row }">
|
||||
|
||||
<el-button v-if="row.level == 1" type="info" @click="openA(row)">预览
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 1 && row.status == 1" type="primary" @click="statusUpdate(row, 0)">隐藏
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1 && row.status == 0" type="success" @click="statusUpdate(row, 1)">显示
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="warning" @click="handleAddDate(row)">添加版面
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="success" @click="handleUpdateDate(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="danger" @click="handleDeleteDate(row)">删除
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 2" type="info" plain @click="openUrl('/paper/article/index/' + row.id)">添加新闻
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="warning" plain @click="handleUpdateBm(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="danger" plain @click="handleDeleteBm(row)">删除
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 3" type="primary" icon="Edit" circle plain
|
||||
@click="openUrl('/paper/article/update/' + row.id)"></el-button>
|
||||
<el-button v-if="row.level == 3" type="danger" icon="Delete" circle plain
|
||||
@click="handleDeleteNews(row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="h-20px"></div>
|
||||
<!-- {{ searchParams.pageNo }} --- {{ searchParams.pageSize }} -->
|
||||
<!-- 分页 -->
|
||||
<el-pagination background v-model:current-page="pageNumber.page" v-model:page-size="pageNumber.size"
|
||||
:page-sizes="[10, 20, 50]" layout="total, sizes, prev, pager, next, jumper" :total="total"
|
||||
@size-change="handleListPageSize" @current-change="handleListPage" />
|
||||
</KoiCard>
|
||||
<KoiDialog ref="koiDrawerDate" :width="500" :height="100" title="期刊编辑" @koiConfirm="handleConfirmDateDo"
|
||||
@koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Dateform" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="Dateform.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="Dateform.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</KoiDialog>
|
||||
<KoiDialog ref="koiDrawerBm" :width="500" :height="400" :title="Bmform.id == 0 ? '添加版面' : '修改版面'"
|
||||
@koiConfirm="handleConfirmBmDo" @koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Bmform" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="Bmform.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input type="number" v-model="Bmform.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="Bmform.pdf" acceptType=".pdf" @update:fileList="updateFileList"
|
||||
@fileSuccess="getFileList">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileSize="100" :fileList="Bmform.video" acceptType=".mp4"
|
||||
@fileSuccess="getVideoList">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="Bmform.bm_img" @update:imageUrl="getImgList" width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</template>
|
||||
</KoiDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="menuPage">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { koiNoticeSuccess, koiNoticeError, koiMsgError, koiMsgWarning, koiMsgBox, koiMsgInfo } from "@/utils/koi.ts";
|
||||
import { generateUUID } from "@/utils/index.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {
|
||||
bmDel,
|
||||
bmList,
|
||||
bmListNews,
|
||||
bmListNext,
|
||||
bmUpdate,
|
||||
dateDel,
|
||||
dateUpdate,
|
||||
getList,
|
||||
newsDel,
|
||||
bmOneAdd, getMp3
|
||||
} from "@/api/system/post/index.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
|
||||
const tabsStore = useTabsStore();
|
||||
const router = useRouter();
|
||||
// 表格加载动画Loading
|
||||
const loading = ref(false);
|
||||
// 是否显示搜索表单[默认显示]
|
||||
const showSearch = ref<boolean>(true); // 默认显示搜索条件
|
||||
|
||||
// 表格数据
|
||||
const tableList = ref([]);
|
||||
// 查询参数
|
||||
const searchParams = ref({
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
});
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const Dateform = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const total = ref(0);
|
||||
const pageNumber = reactive({ page: 1, size: 10 });
|
||||
/** 重置搜索参数 */
|
||||
const resetSearchParams = () => {
|
||||
searchParams.value = {
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
};
|
||||
};
|
||||
/*PDF删除*/
|
||||
const updateFileList = (d) => {
|
||||
console.log(d);
|
||||
//console.log(index);
|
||||
//backArr.value[index].bm_pdf = d.fullurl?d.fullurl:'';
|
||||
}
|
||||
const Mp3Check = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await getMp3('');
|
||||
koiNoticeSuccess("语音生成成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const openA = (item) => {
|
||||
console.log(item);
|
||||
var url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime;
|
||||
if (item.status == 0) {
|
||||
url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime + "&status=1";
|
||||
}
|
||||
window.open(url);
|
||||
}
|
||||
/*PDF上传*/
|
||||
const getFileList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_pdf = d.fullurl;
|
||||
}
|
||||
|
||||
/*视频上传*/
|
||||
const getVideoList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_video = d.fullurl;
|
||||
}
|
||||
|
||||
/*IMG上传*/
|
||||
const getImgList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_img = d;
|
||||
}
|
||||
/*获取PDF文件名称*/
|
||||
const getFileNameFromUrl = (url) => {
|
||||
// 使用最后一个斜杠的位置来分割路径
|
||||
const lastSlashIndex = url.lastIndexOf('/');
|
||||
if (lastSlashIndex === -1) {
|
||||
return 'pdf.pdf'; // 如果没有找到斜杠,则返回空字符串
|
||||
}
|
||||
// 提取文件名部分
|
||||
const fileName = url.substring(lastSlashIndex + 1);
|
||||
return fileName;
|
||||
}
|
||||
/** 搜索 */
|
||||
const handleSearch = () => {
|
||||
console.log("搜索");
|
||||
};
|
||||
const load = async (row, treeNode, resolve) => {
|
||||
console.log(row)
|
||||
console.log(treeNode)
|
||||
|
||||
try {
|
||||
if (row.level == 1) {
|
||||
var res: any = await bmListNext({ date_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.bm_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
} else {
|
||||
var res: any = await bmListNews({ bm_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.new_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
}
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
|
||||
resolve(res.data)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const Bmform = reactive({
|
||||
bm_img: "",
|
||||
bm_name: "",
|
||||
bm_pdf: "",
|
||||
bm_video:"",
|
||||
id: 0,
|
||||
pdf: [],
|
||||
video:[],
|
||||
weight: 0,
|
||||
})
|
||||
/*版面修改*/
|
||||
const handleUpdateBm = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = row.datetime;
|
||||
Bmform.bm_img = row.bm_img;
|
||||
Bmform.bm_pdf = row.bm_pdf;
|
||||
Bmform.bm_video = row.bm_video;
|
||||
Bmform.id = row.id;
|
||||
Bmform.pdf = [{ 'url': row.bm_pdf, 'name': getFileNameFromUrl(row.bm_pdf) }];
|
||||
Bmform.video = [{ 'url': row.bm_video, 'name': getFileNameFromUrl(row.bm_video) }];
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*添加版面*/
|
||||
const handleAddDate = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = "";
|
||||
Bmform.bm_img = "";
|
||||
Bmform.bm_pdf = "";
|
||||
Bmform.bm_video = "";
|
||||
Bmform.weight = 0;
|
||||
Bmform.id = 0;
|
||||
Bmform.pdf = [];
|
||||
Bmform.video = [];
|
||||
Bmform.date_id = row.id;
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*版面排序修改*/
|
||||
const addSort = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await bmUpdate({ id: row.id, weight: row.weight });
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const statusUpdate = async (row, type) => {
|
||||
try {
|
||||
const res: any = await dateUpdate({ status: type, id: row.id });
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
/*版面修改/添加*/
|
||||
const handleConfirmBmDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
if (Bmform.id == 0) {
|
||||
const res: any = await bmOneAdd(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("添加成功!");
|
||||
} else {
|
||||
const res: any = await bmUpdate(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
}
|
||||
confirmLoading.value = false;
|
||||
koiDrawerBm.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleListPageSize = (size) => {
|
||||
pageNumber.size = size;
|
||||
pageNumber.page = 1;
|
||||
handleTreeList();
|
||||
}
|
||||
const handleListPage = (page) => {
|
||||
console.log(page);
|
||||
pageNumber.page = page;
|
||||
handleTreeList();
|
||||
};
|
||||
/** 重置 */
|
||||
const resetSearch = () => {
|
||||
console.log("重置搜索");
|
||||
resetSearchParams();
|
||||
handleTreeList();
|
||||
};
|
||||
|
||||
/** 树形表格查询 */
|
||||
const handleTreeList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
tableList.value = []; // 重置表格数据
|
||||
const res: any = await bmList(pageNumber);
|
||||
console.log("菜单数据表格数据->", res.data.data);
|
||||
|
||||
res.data.data = res.data.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
};
|
||||
});
|
||||
|
||||
tableList.value = res.data.data;
|
||||
loading.value = false;
|
||||
total.value = res.data.count;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// 获取表格数据
|
||||
handleTreeList();
|
||||
getTypelist();
|
||||
// let index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// console.log(index)
|
||||
// while (typeof (index) !='undefined') {
|
||||
// tabsStore.removeTab(index.path);
|
||||
// index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// }
|
||||
});
|
||||
|
||||
const rowClick = (row, column, e) => {
|
||||
console.log(column);
|
||||
if (column?.property == "datetime") {
|
||||
if (e.currentTarget.querySelector(".el-table__expand-icon")) {
|
||||
const expandIcon = e.currentTarget.querySelector(".el-table__expand-icon");
|
||||
if (expandIcon) {
|
||||
expandIcon.style.cursor = "pointer";
|
||||
// 如果你需要点击展开图标,也可以在这里添加点击事件
|
||||
expandIcon.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重新渲染表格状态
|
||||
const refreshTreeTable = ref(true);
|
||||
// 是否展开[默认折叠]
|
||||
const isExpandAll = ref(true);
|
||||
|
||||
/** 添加 */
|
||||
const handleAdd = () => {
|
||||
router.push("/paper/add");
|
||||
};
|
||||
|
||||
/** 修改 */
|
||||
const handleUpdateDate = (row) => {
|
||||
console.log(row);
|
||||
Dateform.datetime = row.datetime;
|
||||
Dateform.type_id = row.type_id;
|
||||
Dateform.periods = row.periods;
|
||||
Dateform.id = row.id;
|
||||
koiDrawerDate.value.koiOpen();
|
||||
};
|
||||
/** 修改 */
|
||||
const handleConfirmDateDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
const res: any = await dateUpdate(Dateform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
confirmLoading.value = false;
|
||||
koiDrawerDate.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleCancel = () => {
|
||||
koiDrawerDate.value.koiClose();
|
||||
koiDrawerBm.value.koiClose();
|
||||
};
|
||||
// 添加 OR 修改对话框Ref
|
||||
const koiDrawerDate = ref();
|
||||
const koiDrawerBm = ref();
|
||||
// 确定按钮是否显示Loading
|
||||
const confirmLoading = ref(false);
|
||||
|
||||
const openUrl = (url) => {
|
||||
router.push(url);
|
||||
}
|
||||
|
||||
/** 删除期刊*/
|
||||
const handleDeleteDate = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除期刊[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await dateDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除版面*/
|
||||
const handleDeleteBm = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除版面[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await bmDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除新闻*/
|
||||
const handleDeleteNews = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除新闻[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await newsDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep(.center-input .el-input__inner) {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
544
.history/src/views/paper/list/index_20250626095132.vue
Normal file
@ -0,0 +1,544 @@
|
||||
<template>
|
||||
<div class="koi-flex">
|
||||
<KoiCard>
|
||||
<!-- 表格头部按钮 -->
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5" v-auth="['system:role:add']">
|
||||
<el-button type="primary" icon="plus" plain @click="handleAdd()">新增</el-button>
|
||||
<el-button type="success" icon="microphone" plain @click="Mp3Check()">生成语音文件</el-button>
|
||||
</el-col>
|
||||
<!-- @click="handleExpend()" -->
|
||||
</el-row>
|
||||
|
||||
<div class="h-20px"></div>
|
||||
<!-- 数据表格 -->
|
||||
<el-table v-if="refreshTreeTable" v-loading="loading" border :indent="30" :data="tableList"
|
||||
:default-expand-all="isExpandAll" row-key="uuid" @row-click="rowClick" :lazy="true" :load="load"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" empty-text="暂时没有数据哟🌻">
|
||||
<el-table-column label="报纸期刊" prop="datetime" align="left" :show-overflow-tooltip="true" width="400px">
|
||||
<template #default="scope">
|
||||
<el-input @blur="addSort(scope.row)" v-if="scope.row.level == 2" :maxlength="2" class="center-input"
|
||||
style="max-width: 50px;margin-right: 10px" v-model="scope.row.weight"></el-input>
|
||||
<span class="cursor-pointer">{{ scope.row.datetime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status" width="250px" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status == 0" type="danger">已隐藏</el-tag>
|
||||
<el-tag v-if="scope.row.status == 1" type="success">显示中</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="bm_count" width="350px" align="center">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.level == 1">版面数量:{{ scope.row.bm_count }}</div>
|
||||
<div v-if="scope.row.level == 2">新闻数量:{{ scope.row.new_count }}</div>
|
||||
<div v-if="scope.row.level == 3">
|
||||
<audio v-if="scope.row.mp_url != null && scope.row.mp_url != ''" controls
|
||||
:src="'https://jinrigushitwo.gushitv.com/' + scope.row.mp_url"></audio>
|
||||
<span v-if="scope.row.mp_url == null || scope.row.mp_url == ''">语音生成中...</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="450px" fixed="right">
|
||||
<template #default="{ row }">
|
||||
|
||||
<el-button v-if="row.level == 1" type="info" @click="openA(row)">预览
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 1 && row.status == 1" type="primary" @click="statusUpdate(row, 0)">隐藏
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1 && row.status == 0" type="success" @click="statusUpdate(row, 1)">显示
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="warning" @click="handleAddDate(row)">添加版面
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="success" @click="handleUpdateDate(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 1" type="danger" @click="handleDeleteDate(row)">删除
|
||||
</el-button>
|
||||
|
||||
<el-button v-if="row.level == 2" type="info" plain @click="openUrl('/paper/article/index/' + row.id)">添加新闻
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="warning" plain @click="handleUpdateBm(row)">修改
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 2" type="danger" plain @click="handleDeleteBm(row)">删除
|
||||
</el-button>
|
||||
<el-button v-if="row.level == 3" type="primary" icon="Edit" circle plain
|
||||
@click="openUrl('/paper/article/update/' + row.id)"></el-button>
|
||||
<el-button v-if="row.level == 3" type="danger" icon="Delete" circle plain
|
||||
@click="handleDeleteNews(row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="h-20px"></div>
|
||||
<!-- {{ searchParams.pageNo }} --- {{ searchParams.pageSize }} -->
|
||||
<!-- 分页 -->
|
||||
<el-pagination background v-model:current-page="pageNumber.page" v-model:page-size="pageNumber.size"
|
||||
:page-sizes="[10, 20, 50]" layout="total, sizes, prev, pager, next, jumper" :total="total"
|
||||
@size-change="handleListPageSize" @current-change="handleListPage" />
|
||||
</KoiCard>
|
||||
<KoiDialog ref="koiDrawerDate" :width="500" :height="100" title="期刊编辑" @koiConfirm="handleConfirmDateDo"
|
||||
@koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Dateform" label-width="auto">
|
||||
<el-form-item label="报刊日期">
|
||||
<el-date-picker v-model="Dateform.datetime" type="date" value-format="YYYY-MM-DD" placeholder="选择报刊日期"
|
||||
style="width: 100%"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="期刊">
|
||||
<el-input v-model="Dateform.periods" placeholder="输入期刊" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</KoiDialog>
|
||||
<KoiDialog ref="koiDrawerBm" :width="500" :height="400" :title="Bmform.id == 0 ? '添加版面' : '修改版面'"
|
||||
@koiConfirm="handleConfirmBmDo" @koiCancel="handleCancel" :loading="confirmLoading">
|
||||
<template #content>
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-form :model="Bmform" label-width="auto">
|
||||
<el-form-item label="版面名称">
|
||||
<el-input v-model="Bmform.bm_name" placeholder="输入版面名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面排序">
|
||||
<el-input type="number" v-model="Bmform.weight" placeholder="输入版面排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版面PDF">
|
||||
<KoiUploadFiles :fileList="Bmform.pdf" acceptType=".pdf" @update:fileList="updateFileList"
|
||||
@fileSuccess="getFileList">
|
||||
<template #tip>PDF最大为 10M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面视频">
|
||||
<KoiUploadFiles :fileSize="100" :fileList="Bmform.video" acceptType=".mp4"
|
||||
@fileSuccess="getVideoList">
|
||||
<template #tip>视频最大为 100M</template>
|
||||
</KoiUploadFiles>
|
||||
</el-form-item>
|
||||
<el-form-item label="版面图片" prop="avatar">
|
||||
<KoiUploadImage :imageUrl="Bmform.bm_img" @update:imageUrl="getImgList" width="150px" height="150px">
|
||||
<template #content>
|
||||
<el-icon>
|
||||
<Picture />
|
||||
</el-icon>
|
||||
<span>请上传版面图片</span>
|
||||
</template>
|
||||
<template #tip>图片最大为 3M</template>
|
||||
</KoiUploadImage>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</template>
|
||||
</KoiDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="menuPage">
|
||||
import { nextTick, ref, reactive, onMounted } from "vue";
|
||||
import { koiNoticeSuccess, koiNoticeError, koiMsgError, koiMsgWarning, koiMsgBox, koiMsgInfo } from "@/utils/koi.ts";
|
||||
import { generateUUID } from "@/utils/index.ts";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {
|
||||
bmDel,
|
||||
bmList,
|
||||
bmListNews,
|
||||
bmListNext,
|
||||
bmUpdate,
|
||||
dateDel,
|
||||
dateUpdate,
|
||||
getList,
|
||||
newsDel,
|
||||
bmOneAdd, getMp3
|
||||
} from "@/api/system/post/index.ts";
|
||||
import useTabsStore from "@/stores/modules/tabs.ts";
|
||||
|
||||
const tabsStore = useTabsStore();
|
||||
const router = useRouter();
|
||||
// 表格加载动画Loading
|
||||
const loading = ref(false);
|
||||
// 是否显示搜索表单[默认显示]
|
||||
const showSearch = ref<boolean>(true); // 默认显示搜索条件
|
||||
|
||||
// 表格数据
|
||||
const tableList = ref([]);
|
||||
// 查询参数
|
||||
const searchParams = ref({
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
});
|
||||
const typeList = ref();
|
||||
const getTypelist = async () => {
|
||||
try {
|
||||
const res: any = await getList([]);
|
||||
typeList.value = res.data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试!");
|
||||
}
|
||||
}
|
||||
const Dateform = reactive({
|
||||
datetime: "",
|
||||
type_id: "",
|
||||
periods:""
|
||||
});
|
||||
const total = ref(0);
|
||||
const pageNumber = reactive({ page: 1, size: 10 });
|
||||
/** 重置搜索参数 */
|
||||
const resetSearchParams = () => {
|
||||
searchParams.value = {
|
||||
menuName: "",
|
||||
auth: "",
|
||||
menuStatus: ""
|
||||
};
|
||||
};
|
||||
/*PDF删除*/
|
||||
const updateFileList = (d) => {
|
||||
console.log(d);
|
||||
//console.log(index);
|
||||
//backArr.value[index].bm_pdf = d.fullurl?d.fullurl:'';
|
||||
}
|
||||
const Mp3Check = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await getMp3('');
|
||||
koiNoticeSuccess("语音生成成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const openA = (item) => {
|
||||
console.log(item);
|
||||
var url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime;
|
||||
if (item.status == 0) {
|
||||
url = "https://jinrigushitwo.gushitv.com/#/?date=" + item.datetime + "&status=1";
|
||||
}
|
||||
window.open(url);
|
||||
}
|
||||
/*PDF上传*/
|
||||
const getFileList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_pdf = d.fullurl;
|
||||
}
|
||||
|
||||
/*视频上传*/
|
||||
const getVideoList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_video = d.fullurl;
|
||||
}
|
||||
|
||||
/*IMG上传*/
|
||||
const getImgList = (d) => {
|
||||
console.log(d);
|
||||
Bmform.bm_img = d;
|
||||
}
|
||||
/*获取PDF文件名称*/
|
||||
const getFileNameFromUrl = (url) => {
|
||||
// 使用最后一个斜杠的位置来分割路径
|
||||
const lastSlashIndex = url.lastIndexOf('/');
|
||||
if (lastSlashIndex === -1) {
|
||||
return 'pdf.pdf'; // 如果没有找到斜杠,则返回空字符串
|
||||
}
|
||||
// 提取文件名部分
|
||||
const fileName = url.substring(lastSlashIndex + 1);
|
||||
return fileName;
|
||||
}
|
||||
/** 搜索 */
|
||||
const handleSearch = () => {
|
||||
console.log("搜索");
|
||||
};
|
||||
const load = async (row, treeNode, resolve) => {
|
||||
console.log(row)
|
||||
console.log(treeNode)
|
||||
|
||||
try {
|
||||
if (row.level == 1) {
|
||||
var res: any = await bmListNext({ date_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.bm_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
} else {
|
||||
var res: any = await bmListNews({ bm_id: row.id });
|
||||
res.data = res.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
datetime: item.new_name,
|
||||
bm_name: undefined // 或者删除该项
|
||||
};
|
||||
});
|
||||
}
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
|
||||
resolve(res.data)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const Bmform = reactive({
|
||||
bm_img: "",
|
||||
bm_name: "",
|
||||
bm_pdf: "",
|
||||
bm_video:"",
|
||||
id: 0,
|
||||
pdf: [],
|
||||
video:[],
|
||||
weight: 0,
|
||||
})
|
||||
/*版面修改*/
|
||||
const handleUpdateBm = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = row.datetime;
|
||||
Bmform.bm_img = row.bm_img;
|
||||
Bmform.bm_pdf = row.bm_pdf;
|
||||
Bmform.bm_video = row.bm_video;
|
||||
Bmform.id = row.id;
|
||||
Bmform.pdf = [{ 'url': row.bm_pdf, 'name': getFileNameFromUrl(row.bm_pdf) }];
|
||||
Bmform.video = [{ 'url': row.bm_video, 'name': getFileNameFromUrl(row.bm_video) }];
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*添加版面*/
|
||||
const handleAddDate = (row) => {
|
||||
console.log(row);
|
||||
Bmform.bm_name = "";
|
||||
Bmform.bm_img = "";
|
||||
Bmform.bm_pdf = "";
|
||||
Bmform.bm_video = "";
|
||||
Bmform.weight = 0;
|
||||
Bmform.id = 0;
|
||||
Bmform.pdf = [];
|
||||
Bmform.video = [];
|
||||
Bmform.date_id = row.id;
|
||||
koiDrawerBm.value.koiOpen();
|
||||
}
|
||||
/*版面排序修改*/
|
||||
const addSort = async (row) => {
|
||||
//console.log(row);
|
||||
try {
|
||||
const res: any = await bmUpdate({ id: row.id, weight: row.weight });
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
|
||||
}
|
||||
const statusUpdate = async (row, type) => {
|
||||
try {
|
||||
const res: any = await dateUpdate({ status: type, id: row.id });
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
/*版面修改/添加*/
|
||||
const handleConfirmBmDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
if (Bmform.id == 0) {
|
||||
const res: any = await bmOneAdd(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("添加成功!");
|
||||
} else {
|
||||
const res: any = await bmUpdate(Bmform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
}
|
||||
confirmLoading.value = false;
|
||||
koiDrawerBm.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据修改失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleListPageSize = (size) => {
|
||||
pageNumber.size = size;
|
||||
pageNumber.page = 1;
|
||||
handleTreeList();
|
||||
}
|
||||
const handleListPage = (page) => {
|
||||
console.log(page);
|
||||
pageNumber.page = page;
|
||||
handleTreeList();
|
||||
};
|
||||
/** 重置 */
|
||||
const resetSearch = () => {
|
||||
console.log("重置搜索");
|
||||
resetSearchParams();
|
||||
handleTreeList();
|
||||
};
|
||||
|
||||
/** 树形表格查询 */
|
||||
const handleTreeList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
tableList.value = []; // 重置表格数据
|
||||
const res: any = await bmList(pageNumber);
|
||||
console.log("菜单数据表格数据->", res.data.data);
|
||||
|
||||
res.data.data = res.data.data.map(item => {
|
||||
return {
|
||||
...item,
|
||||
uuid: generateUUID(),
|
||||
};
|
||||
});
|
||||
|
||||
tableList.value = res.data.data;
|
||||
loading.value = false;
|
||||
total.value = res.data.count;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// 获取表格数据
|
||||
handleTreeList();
|
||||
getTypelist();
|
||||
// let index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// console.log(index)
|
||||
// while (typeof (index) !='undefined') {
|
||||
// tabsStore.removeTab(index.path);
|
||||
// index = tabsStore.tabList.find(tab => tab.path.includes('/paper/article/update/'));
|
||||
// }
|
||||
});
|
||||
|
||||
const rowClick = (row, column, e) => {
|
||||
console.log(column);
|
||||
if (column?.property == "datetime") {
|
||||
if (e.currentTarget.querySelector(".el-table__expand-icon")) {
|
||||
const expandIcon = e.currentTarget.querySelector(".el-table__expand-icon");
|
||||
if (expandIcon) {
|
||||
expandIcon.style.cursor = "pointer";
|
||||
// 如果你需要点击展开图标,也可以在这里添加点击事件
|
||||
expandIcon.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 重新渲染表格状态
|
||||
const refreshTreeTable = ref(true);
|
||||
// 是否展开[默认折叠]
|
||||
const isExpandAll = ref(true);
|
||||
|
||||
/** 添加 */
|
||||
const handleAdd = () => {
|
||||
router.push("/paper/add");
|
||||
};
|
||||
|
||||
/** 修改 */
|
||||
const handleUpdateDate = (row) => {
|
||||
console.log(row);
|
||||
Dateform.datetime = row.datetime;
|
||||
Dateform.type_id = row.type_id;
|
||||
Dateform.periods = row.periods;
|
||||
Dateform.id = row.id;
|
||||
koiDrawerDate.value.koiOpen();
|
||||
};
|
||||
/** 修改 */
|
||||
const handleConfirmDateDo = async () => {
|
||||
confirmLoading.value = true;
|
||||
try {
|
||||
const res: any = await dateUpdate(Dateform);
|
||||
console.log("菜单数据表格数据->", res.data);
|
||||
koiNoticeSuccess("修改成功!");
|
||||
confirmLoading.value = false;
|
||||
koiDrawerDate.value.koiQuickClose();
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
koiNoticeError("数据查询失败,请刷新重试🌻");
|
||||
}
|
||||
}
|
||||
const handleCancel = () => {
|
||||
koiDrawerDate.value.koiClose();
|
||||
koiDrawerBm.value.koiClose();
|
||||
};
|
||||
// 添加 OR 修改对话框Ref
|
||||
const koiDrawerDate = ref();
|
||||
const koiDrawerBm = ref();
|
||||
// 确定按钮是否显示Loading
|
||||
const confirmLoading = ref(false);
|
||||
|
||||
const openUrl = (url) => {
|
||||
router.push(url);
|
||||
}
|
||||
|
||||
/** 删除期刊*/
|
||||
const handleDeleteDate = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除期刊[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await dateDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除版面*/
|
||||
const handleDeleteBm = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除版面[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await bmDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
/** 删除新闻*/
|
||||
const handleDeleteNews = (row: any) => {
|
||||
const id = row.id;
|
||||
koiMsgBox("您确认需要删除新闻[ " + row.datetime + " ]么?")
|
||||
.then(async () => {
|
||||
try {
|
||||
await newsDel({ 'id': id });
|
||||
koiNoticeSuccess("删除成功!");
|
||||
handleTreeList();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep(.center-input .el-input__inner) {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
41
.prettierrc.cjs
Normal file
@ -0,0 +1,41 @@
|
||||
// @see: https://www.prettier.cn
|
||||
|
||||
module.exports = {
|
||||
// 指定最大换行长度
|
||||
printWidth: 130,
|
||||
// 缩进制表符宽度 | 空格数
|
||||
tabWidth: 2,
|
||||
// 使用制表符而不是空格缩进行 (true:制表符,false:空格)
|
||||
useTabs: false,
|
||||
// 结尾不用分号 (true:有,false:没有)
|
||||
semi: true,
|
||||
// 使用单引号 (true:单引号,false:双引号)
|
||||
singleQuote: false,
|
||||
// 在对象字面量中决定是否将属性名用引号括起来 可选值 "<as-needed|consistent|preserve>"
|
||||
quoteProps: "as-needed",
|
||||
// 在JSX中使用单引号而不是双引号 (true:单引号,false:双引号)
|
||||
jsxSingleQuote: false,
|
||||
// 多行时尽可能打印尾随逗号 可选值"<none|es5|all>"
|
||||
trailingComma: "none",
|
||||
// 在对象,数组括号与文字之间加空格 "{ foo: bar }" (true:有,false:没有)
|
||||
bracketSpacing: true,
|
||||
// 将 > 多行元素放在最后一行的末尾,而不是单独放在下一行 (true:放末尾,false:单独一行)
|
||||
bracketSameLine: false,
|
||||
// (x) => {} 箭头函数参数只有一个时是否要有小括号 (avoid:省略括号,always:不省略括号)
|
||||
arrowParens: "avoid",
|
||||
// 指定要使用的解析器,不需要写文件开头的 @prettier
|
||||
requirePragma: false,
|
||||
// 可以在文件顶部插入一个特殊标记,指定该文件已使用 Prettier 格式化
|
||||
insertPragma: false,
|
||||
// 用于控制文本是否应该被换行以及如何进行换行
|
||||
proseWrap: "preserve",
|
||||
// 在html中空格是否是敏感的 "css" - 遵守 CSS 显示属性的默认值, "strict" - 空格被认为是敏感的 ,"ignore" - 空格被认为是不敏感的
|
||||
htmlWhitespaceSensitivity: "css",
|
||||
// 控制在 Vue 单文件组件中 <script> 和 <style> 标签内的代码缩进方式
|
||||
vueIndentScriptAndStyle: false,
|
||||
// 换行符使用 lf 结尾是 可选值 "<auto|lf|crlf|cr>"
|
||||
endOfLine: "auto",
|
||||
// 这两个选项可用于格式化以给定字符偏移量[分别包括和不包括]开始和结束的代码 (rangeStart:开始,rangeEnd:结束)
|
||||
rangeStart: 0,
|
||||
rangeEnd: Infinity
|
||||
};
|
4
.stylelintignore
Normal file
@ -0,0 +1,4 @@
|
||||
/node_modules/*
|
||||
/dist/*
|
||||
/html/*
|
||||
/public/*
|
40
.stylelintrc.cjs
Normal file
@ -0,0 +1,40 @@
|
||||
// @see: https://stylelint.io
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
// 继承某些已有的规则
|
||||
extends: [
|
||||
"stylelint-config-standard", // 配置 stylelint 拓展插件
|
||||
"stylelint-config-html/vue", // 配置 vue 中 template 样式格式化
|
||||
"stylelint-config-standard-scss", // 配置 stylelint scss 插件
|
||||
"stylelint-config-recommended-vue/scss", // 配置 vue 中 scss 样式格式化
|
||||
"stylelint-config-recess-order" // 配置 stylelint css 属性书写顺序插件,
|
||||
],
|
||||
overrides: [
|
||||
// 扫描 .vue/html 文件中的 <style> 标签内的样式
|
||||
{
|
||||
files: ["**/*.{vue,html}"],
|
||||
customSyntax: "postcss-html"
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
"function-url-quotes": "always", // URL 的引号 "always(必须加上引号)"|"never(没有引号)"
|
||||
"color-hex-length": "long", // 指定 16 进制颜色的简写或扩写 "short(16进制简写)"|"long(16进制扩写)"
|
||||
"rule-empty-line-before": "never", // 要求或禁止在规则之前的空行 "always(规则之前必须始终有一个空行)"|"never(规则前绝不能有空行)"|"always-multi-line(多行规则之前必须始终有一个空行)"|"never-multi-line(多行规则之前绝不能有空行)"
|
||||
"font-family-no-missing-generic-family-keyword": null, // 禁止在字体族名称列表中缺少通用字体族关键字
|
||||
"scss/at-import-partial-extension": null, // 解决不能使用 @import 引入 scss 文件
|
||||
"property-no-unknown": null, // 禁止未知的属性
|
||||
"no-empty-source": null, // 禁止空源码
|
||||
"selector-class-pattern": null, // 强制选择器类名的格式
|
||||
"value-no-vendor-prefix": null, // 关闭 vendor-prefix (为了解决多行省略 -webkit-box)
|
||||
"no-descending-specificity": null, // 不允许较低特异性的选择器出现在覆盖较高特异性的选择器
|
||||
"value-keyword-case": null, // 解决在 scss 中使用 v-bind 大写单词报错
|
||||
"selector-pseudo-class-no-unknown": [
|
||||
true,
|
||||
{
|
||||
ignorePseudoClasses: ["global", "v-deep", "deep"]
|
||||
}
|
||||
]
|
||||
},
|
||||
ignoreFiles: ["**/*.js", "**/*.jsx", "**/*.tsx", "**/*.ts"]
|
||||
};
|
674
LICENSE
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
42
README.md
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
<h1 align="center">KOI-UI🌻</h1>
|
||||
|
||||
<p align="center">一款<b>开箱即用</b>的 Vue3 中后台管理系统框架[纯前端]</p>
|
||||
|
||||
## 2、特点
|
||||
|
||||
- 🎯 使用 Element Plus + Vite + Vue3 + TypeScript + Uncoss + Pinia 等主流技术。
|
||||
- 🍊 多种布局和丰富的主题适配移动端、IPad和PC端。
|
||||
- 🐼 内置权限管理页面,进行二次开发可直接对接后端接口即可。
|
||||
- 🌸 集成登陆、注销及权限验证。
|
||||
- 🎃 封装按钮和Input框的防抖、限流和背景水印以及左侧无限递归菜单。
|
||||
- 🍀 集成 `pinia`,vuex 的替代方案,轻量、简单、易用,并且配置pinia持久化插件。
|
||||
- 😍 二次封装Dialog对话框、Drawer抽屉、Notification通知、Message消息提示和Popconfirm确认框,操作更加方便快捷。
|
||||
- 🍓 二次封装axios,方便接口更好的统一管理。
|
||||
- 🌍 集成Echarts图表。
|
||||
- 🌈 集成 `unocss`,antfu 开源的原子 css 解决方案,非常轻量。
|
||||
- 🐟 集成多环境配置,dev、测试、生产环境。
|
||||
- 🌼 集成 `eslint + prettier`,代码约束和格式化统一。
|
||||
- 🌻 集成 `stylelint`,代码约束scss、less、css规范化。
|
||||
- 👻 集成 `mock` 接口服务。
|
||||
- 🏡 集成 `iconify` 图标,支持自定义 svg 图标, 优雅使用icon。
|
||||
|
||||
## 6、快速开始
|
||||
|
||||
```properties
|
||||
# 若未配置pnpm,请先下载并配置镜像
|
||||
npm install pnpm -g --registry=https://registry.npmmirror.com
|
||||
# 下载依赖
|
||||
pnpm install
|
||||
# 启动
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
## 7、打包发布
|
||||
|
||||
```properties
|
||||
# 构建环境
|
||||
pnpm build
|
||||
# 生产环境
|
||||
pnpm build:prod
|
||||
```
|
1
admin/assets/403-C5O4o5Ej.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";#box[data-v-dab07528]{overflow:hidden}#banner[data-v-dab07528]{margin-top:60px;background:url(/admin/assets/403-CUQbA87J.png) no-repeat;background-size:100%}.koi-top[data-v-dab07528]{width:600px;height:500px;margin:0 auto}.koi-bottom[data-v-dab07528]{height:300px;margin-top:20px;text-align:center}.koi-text1[data-v-dab07528]{font-size:46px;font-weight:700}.koi-text2[data-v-dab07528]{padding-top:30px;font-family:YouYuan;font-size:24px;font-weight:600}
|
BIN
admin/assets/403-CUQbA87J.png
Normal file
After Width: | Height: | Size: 44 KiB |
1
admin/assets/403-dL5tnOOD.js
Normal file
@ -0,0 +1 @@
|
||||
import{d as a,a as i,c as d,i as o,x as l,y as r,C as p,H as u,G as _,J as m,_ as x}from"./index-BRRhBORR.js";const v={id:"box"},c={class:"koi-bottom"},k=a({__name:"403",setup(b){const s=m(),e=()=>{s.push({path:u})};return(f,t)=>{const n=_("el-button");return i(),d("div",v,[t[4]||(t[4]=o("div",{class:"koi-top",id:"banner"},null,-1)),o("div",c,[t[1]||(t[1]=o("div",{class:"koi-text1"},"403",-1)),t[2]||(t[2]=o("div",{class:"koi-text2"},"对不起,您没有权限访问👻",-1)),t[3]||(t[3]=o("div",{class:"h-20px"},null,-1)),l(n,{type:"primary",plain:"",onClick:e},{default:r(()=>t[0]||(t[0]=[p("返回首页")])),_:1})])])}}}),y=x(k,[["__scopeId","data-v-dab07528"]]);export{y as default};
|
1
admin/assets/404-CMsRbGgV.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";#box[data-v-7ac834d1]{overflow:hidden}#banner[data-v-7ac834d1]{margin-top:60px;background:url(/admin/assets/404-CwMLa_Zl.png) no-repeat;background-size:100%}.koi-top[data-v-7ac834d1]{width:600px;height:500px;margin:0 auto}.koi-bottom[data-v-7ac834d1]{height:300px;margin-top:20px;text-align:center}.koi-text1[data-v-7ac834d1]{font-size:46px;font-weight:700}.koi-text2[data-v-7ac834d1]{padding-top:30px;font-family:YouYuan;font-size:24px;font-weight:600}
|
1
admin/assets/404-CuDfmflR.js
Normal file
@ -0,0 +1 @@
|
||||
import{d as a,a as i,c as d,i as o,x as l,y as r,C as p,H as u,G as _,J as m,_ as x}from"./index-BRRhBORR.js";const c={id:"box"},v={class:"koi-bottom"},k=a({__name:"404",setup(f){const s=m(),e=()=>{s.push({path:u})};return(b,t)=>{const n=_("el-button");return i(),d("div",c,[t[4]||(t[4]=o("div",{class:"koi-top",id:"banner"},null,-1)),o("div",v,[t[1]||(t[1]=o("div",{class:"koi-text1"},"404",-1)),t[2]||(t[2]=o("div",{class:"koi-text2"},"您想看的页面不存在哟🤐",-1)),t[3]||(t[3]=o("div",{class:"h-20px"},null,-1)),l(n,{type:"primary",plain:"",onClick:e},{default:r(()=>t[0]||(t[0]=[p("返回首页")])),_:1})])])}}}),y=x(k,[["__scopeId","data-v-7ac834d1"]]);export{y as default};
|
BIN
admin/assets/404-CwMLa_Zl.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
admin/assets/500-CM9wJmPF.png
Normal file
After Width: | Height: | Size: 41 KiB |
1
admin/assets/500-C_b6YfOj.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";#box[data-v-deb7768c]{overflow:hidden}#banner[data-v-deb7768c]{margin-top:60px;background:url(/admin/assets/500-CM9wJmPF.png) no-repeat;background-size:100%}.koi-top[data-v-deb7768c]{width:600px;height:500px;margin:0 auto}.koi-bottom[data-v-deb7768c]{height:300px;margin-top:20px;text-align:center}.koi-text1[data-v-deb7768c]{font-size:46px;font-weight:700}.koi-text2[data-v-deb7768c]{padding-top:30px;font-family:YouYuan;font-size:24px;font-weight:600}
|
1
admin/assets/500-Cbi7TCGq.js
Normal file
@ -0,0 +1 @@
|
||||
import{d as a,a as i,c as d,i as o,x as l,y as r,C as p,H as u,G as _,J as m,_ as x}from"./index-BRRhBORR.js";const c={id:"box"},v={class:"koi-bottom"},k=a({__name:"500",setup(b){const s=m(),e=()=>{s.push({path:u})};return(f,t)=>{const n=_("el-button");return i(),d("div",c,[t[4]||(t[4]=o("div",{class:"koi-top",id:"banner"},null,-1)),o("div",v,[t[1]||(t[1]=o("div",{class:"koi-text1"},"500",-1)),t[2]||(t[2]=o("div",{class:"koi-text2"},"服务器好像开小差了!请稍后试试...😱",-1)),t[3]||(t[3]=o("div",{class:"h-20px"},null,-1)),l(n,{type:"primary",plain:"",onClick:e},{default:r(()=>t[0]||(t[0]=[p("返回首页")])),_:1})])])}}}),y=x(k,[["__scopeId","data-v-deb7768c"]]);export{y as default};
|
BIN
admin/assets/632-01-oXtBX_UN.jpg
Normal file
After Width: | Height: | Size: 721 KiB |
1
admin/assets/KoiCard-Dh8yYLn4.js
Normal file
1
admin/assets/KoiDark-BTBD40BU.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";::view-transition-old(root),::view-transition-new(root){mix-blend-mode:normal;animation:none}::view-transition-old(root){z-index:9999}::view-transition-new(root){z-index:1}.dark::view-transition-old(root){z-index:1}.dark::view-transition-new(root){z-index:9999}
|
1
admin/assets/KoiDark-Bqp3Yc-l.js
Normal file
@ -0,0 +1 @@
|
||||
import{_ as m}from"./KoiDark.vue_vue_type_style_index_0_lang-0Uy9L8Ev.js";import"./index-BRRhBORR.js";export{m as default};
|
@ -0,0 +1 @@
|
||||
import{d as k,l as g,V as b,a as i,c as x,u as l,h as d,y as p,x as m,W as u,G as h}from"./index-BRRhBORR.js";const f=k({__name:"KoiDark",props:{size:{type:Number,default:22}},setup(_){const e=g(),{switchDark:r}=b(),s=async n=>{const o=n.clientX,t=n.clientY,a=Math.hypot(Math.max(o,innerWidth-o),Math.max(t,innerHeight-t));if(document.startViewTransition==null)e.setGlobalState("isDark",!e.isDark),r();else{await document.startViewTransition(()=>{e.setGlobalState("isDark",!e.isDark),r()}).ready;const c=[`circle(0px at ${o}px ${t}px)`,`circle(${a}px at ${o}px ${t}px)`];document.documentElement.animate({clipPath:e.isDark?c:[...c].reverse()},{duration:300,easing:"ease-in",pseudoElement:e.isDark?"::view-transition-new(root)":"::view-transition-old(root)"})}};return(n,o)=>{const t=h("KoiSvgIcon"),a=h("el-tooltip");return i(),x("div",null,[l(e).isDark?u("",!0):(i(),d(a,{key:0,content:n.$t("header.lightMode")},{default:p(()=>[m(t,{name:"koi-menu-sun",width:"20",height:"20",class:"rounded-full p-6px bg-[rgba(50,50,50,0.06)] dark:bg-[rgba(255,255,255,0.06)] m-r-10px border-none outline-none",onClick:s})]),_:1},8,["content"])),l(e).isDark?(i(),d(a,{key:1,content:n.$t("header.darkMode")},{default:p(()=>[m(t,{name:"koi-menu-moon",width:"20",height:"20",class:"rounded-full p-6px bg-[rgba(50,50,50,0.06)] dark:bg-[rgba(255,255,255,0.06)] m-r-10px border-none outline-none",onClick:s})]),_:1},8,["content"])):u("",!0)])}}});export{f as _};
|
BIN
admin/assets/KoiFont-D8fBFwAi.woff2
Normal file
1
admin/assets/KoiLanguage-C75J2wBF.js
Normal file
@ -0,0 +1 @@
|
||||
import{d as b,X as w,l as f,g as C,r as S,o as k,w as x,G as e,a as u,c as r,x as t,y as a,N as L,M as y,h as B,C as I,t as K}from"./index-BRRhBORR.js";const G=b({__name:"KoiLanguage",setup(N){const c=w(),n=f(),g=C(()=>n.language),s=S([]);k(()=>{d()});const d=()=>{n.language==="en"?s.value=[{label:"Chinese",value:"zh"},{label:"English",value:"en"}]:s.value=[{label:"简体中文",value:"zh"},{label:"英文",value:"en"}]};x(()=>n.language,()=>{d()});const i=o=>{c.locale.value=o,n.setGlobalState("language",o)};return(o,z)=>{const p=e("KoiSvgIcon"),_=e("el-dropdown-item"),m=e("el-dropdown-menu"),h=e("el-dropdown"),v=e("el-tooltip");return u(),r("div",null,[t(v,{content:o.$t("header.language")},{default:a(()=>[t(h,{onCommand:i,style:{"vertical-align":"baseline"}},{dropdown:a(()=>[t(m,null,{default:a(()=>[(u(!0),r(L,null,y(s.value,l=>(u(),B(_,{key:l.value,command:l.value,disabled:g.value===l.value},{default:a(()=>[I(K(l.label),1)]),_:2},1032,["command","disabled"]))),128))]),_:1})]),default:a(()=>[t(p,{name:"koi-menu-earth",width:"20",height:"20",class:"rounded-full p-6px bg-[rgba(50,50,50,0.06)] dark:bg-[rgba(255,255,255,0.06)] m-r-10px border-none outline-none"})]),_:1})]),_:1},8,["content"])])}}});export{G as default};
|
1
admin/assets/KoiLeftChart-BZ9Sop-v.js
Normal file
@ -0,0 +1 @@
|
||||
import{i as A,L as E}from"./index-06v0hgpB.js";import{d as w,r as n,o as b,e as L,a as S,c as _}from"./index-BRRhBORR.js";const k=w({__name:"KoiLeftChart",setup(g){const c=n(),a=n(),u=n([{name:"河南",value:366},{name:"郑州",value:356},{name:"广东",value:335},{name:"福建",value:320},{name:"浙江",value:302},{name:"上海",value:280},{name:"北京",value:256},{name:"江苏",value:236},{name:"四川",value:290},{name:"重庆",value:195},{name:"陕西",value:160},{name:"湖南",value:140},{name:"河北",value:170},{name:"辽宁",value:152},{name:"湖北",value:120},{name:"江西",value:99},{name:"天津",value:107},{name:"吉林",value:90},{name:"青海",value:69},{name:"山东",value:266},{name:"山西",value:65},{name:"云南",value:87},{name:"安徽",value:79}]),s=n(),p=n(-1),i=n(9);b(()=>{x(),f(),d(),h(),window.addEventListener("resize",d)}),L(()=>{a.value.dispose(),a.value=null,clearInterval(s.value),s.value=null,window.removeEventListener("resize",d)});const x=()=>{var t;a.value=A(c.value);const e={grid:{top:"12%",left:"0",right:"0",bottom:"0",containLabel:!0},tooltip:{show:!0},xAxis:{type:"category"},yAxis:{type:"value",splitLine:{show:!1}},series:[{type:"bar",label:{color:"#077EF8",show:!0,position:"top"}}]};(t=a.value)==null||t.setOption(e),a.value.on("mouseover",()=>{clearInterval(s.value)}),a.value.on("mouseout",()=>{h()})},f=()=>{u.value=u.value.sort((e,t)=>t.value-e.value),p.value++,i.value++,i.value>u.value.length-1&&(p.value=0,i.value=9),y()},y=()=>{var r;const e=[["#0BA82C","#4FF778"],["#2E72BF","#23E5E5"],["#5052EE","#AB6EE5"],["hotpink","lightsalmon"]],t=u.value.map(l=>l.name),v=u.value.map(l=>l.value),m={xAxis:{data:t},series:[{data:v,itemStyle:{label:{show:!0,position:"top"},color:l=>{let o="lightpink";return l.value>300?o=e[0]:l.value>200?o=e[1]:l.value>100?o=e[2]:o=e[3],new E(0,0,0,1,[{offset:0,color:o[0]},{offset:1,color:o[1]}])}}}],dataZoom:{show:!1,startValue:p.value,endValue:i.value}};(r=a.value)==null||r.setOption(m)},d=()=>{var v,m,r;const e=n(Math.round(((v=c.value)==null?void 0:v.offsetWidth)/50)),t={title:{textStyle:{fontSize:e.value}},series:[{barWidth:Math.round(e.value*2),itemStyle:{label:{textStyle:{fontSize:Math.round(e.value*.8)}}}}],xAxis:{axisLabel:{fontSize:Math.round(e.value*.8)}},yAxis:{axisLabel:{fontSize:Math.round(e.value*.8)}}};(m=a.value)==null||m.setOption(t),(r=a.value)==null||r.resize()},h=()=>{s.value=setInterval(()=>{f()},2e3)};return(e,t)=>(S(),_("div",{ref_key:"refChart",ref:c,style:{height:"350px"}},null,512))}});export{k as default};
|
6
admin/assets/KoiLoading-BmwBw8rz.js
Normal file
@ -0,0 +1,6 @@
|
||||
import{d as l,r,o as c,a as s,c as t,x as d,y as u,i as e,N as _,M as f,n as p,Y as m,_ as g}from"./index-BRRhBORR.js";const v=["transition-style"],x={class:"loading"},y=l({__name:"KoiLoading",setup(B){const n=r(!0);c(()=>{o()});const o=()=>{setTimeout(()=>{n.value=!1},1500)};return(L,a)=>(s(),t("div",null,[d(m,{name:"el-fade-in-linear"},{default:u(()=>[e("div",{class:"loading-box","transition-style":n.value?"":"out:circle:center"},[e("div",x,[(s(),t(_,null,f(7,i=>e("span",{style:p(`--i: ${i}`)},null,4)),64))]),a[0]||(a[0]=e("svg",null,[e("filter",{id:"gooey"},[e("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"10"}),e("feColorMatrix",{values:`
|
||||
1 0 0 0 0
|
||||
0 1 0 0 0
|
||||
0 0 1 0 0
|
||||
0 0 0 20 -10
|
||||
`})])],-1))],8,v)]),_:1})]))}}),C=g(y,[["__scopeId","data-v-97ffc5cd"]]);export{C as default};
|
1
admin/assets/KoiLoading-PdyIjiFI.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";.loading-box[data-v-97ffc5cd]{position:fixed;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100vw;height:100vh;background:#0009;border:1px solid rgba(255,255,255,.2);animation-duration:2.5s;animation-timing-function:cubic-bezier(.25,1,.3,1);animation-delay:0;will-change:clip-path;animation-fill-mode:both}.loading-box svg[data-v-97ffc5cd]{width:0;height:0}.loading-box .loading[data-v-97ffc5cd]{position:relative;width:300px;height:300px;filter:url(#gooey)}.loading-box .loading span[data-v-97ffc5cd]{position:absolute;top:0;left:0;display:block;width:100%;height:100%;animation:loading-97ffc5cd 3s ease-in-out infinite;animation-delay:calc(.2s * var(--i))}.loading-box .loading span[data-v-97ffc5cd]:before{position:absolute;top:0;left:calc(50% - 28px);width:56px;height:56px;content:"";background-image:linear-gradient(to right,#92fe9d,#00c9ff);border-radius:50%;box-shadow:0 0 30px #00c9ff}@keyframes loading-97ffc5cd{0%{transform:rotate(0)}50%,to{transform:rotate(360deg)}}@keyframes circle-out-center-97ffc5cd{0%{clip-path:circle(125% at 50% calc(50vh - 122px))}to{clip-path:circle(0% at 50% calc(50vh - 122px))}}.loading-box[transition-style="out:circle:center"][data-v-97ffc5cd]{animation-name:circle-out-center-97ffc5cd}
|
1
admin/assets/KoiPieChart-B31gUQ8P.js
Normal file
@ -0,0 +1 @@
|
||||
import{i as p}from"./index-06v0hgpB.js";import{d as f,r as o,o as m,e as h,a as x,c as C}from"./index-BRRhBORR.js";const b=f({__name:"KoiPieChart",setup(g){const i=o(),a=o(),l=o([{value:5,name:"AABB故障"},{value:6,name:"CCDD故障"},{value:7,name:"TTZZ故障"},{value:8,name:"GGHH故障"},{value:9,name:"YYXX故障"}]),n=o();m(()=>{d(),c(),r(),window.addEventListener("resize",r),s()}),h(()=>{a.value.dispose(),a.value=null,clearInterval(n.value),n.value=null,window.removeEventListener("resize",r)});const d=()=>{var e;a.value=p(i.value);const t={tooltip:{confine:!0,trigger:"item"},legend:{orient:"vertical",left:"left",extraCssText:"z-index: 999"},series:[{name:"模块故障",type:"pie",radius:["45%","70%"],center:["60%","50%"],avoidLabelOverlap:!1,itemStyle:{borderRadius:10,borderColor:"#fff",borderWidth:2},label:{show:!1,position:"center",formatter:"{d}%"},emphasis:{label:{show:!0,fontSize:"16",fontWeight:"bold"}},labelLine:{show:!1}}]};(e=a.value)==null||e.setOption(t),a.value.on("mouseover",()=>{clearInterval(n.value)}),a.value.on("mouseout",()=>{s()})},c=()=>{v()},v=()=>{var e;const t={series:[{data:l.value}]};(e=a.value)==null||e.setOption(t)},r=()=>{var e,u;const t={legend:{textStyle:{fontSize:12}}};(e=a.value)==null||e.setOption(t),(u=a.value)==null||u.resize()},s=()=>{let t=0;n.value=setInterval(()=>{a.value.dispatchAction({type:"showTip",position:function(e){return{left:e[0]+10,top:e[1]-10}},seriesIndex:0,dataIndex:t}),t++,t>l.value.length&&(t=0)},2e3)};return(t,e)=>(x(),C("div",{ref_key:"refChart",ref:i,style:{width:"100%",height:"350px"}},null,512))}});export{b as default};
|
1
admin/assets/KoiRightChart-Bfzlw4Si.js
Normal file
@ -0,0 +1 @@
|
||||
import{i as g,L as w}from"./index-06v0hgpB.js";import{d as A,r as u,o as C,e as z,a as _,c as b}from"./index-BRRhBORR.js";function r(i,s){var o=Math.floor(Math.random()*(i-s)+s);return o}for(let i=0;i<=15;i++)i.toString(16);const L=A({__name:"KoiRightChart",setup(i){const s=u(),o=u(),v=u(),c=u(),p=u();C(()=>{f(),m(),d(),window.addEventListener("resize",d),x()}),z(()=>{o.value.dispose(),o.value=null,clearInterval(p.value),p.value=null,window.removeEventListener("resize",d)});const f=()=>{var n;o.value=g(s.value);const e={grid:{top:"12%",left:"6%",bottom:"6%",right:"0"},tooltip:{show:!0},legend:{data:["柱形订单量","折线订单量"],right:"5%"},xAxis:[{type:"category",axisPointer:{type:"shadow"}}],yAxis:[{type:"value",splitLine:{show:!1}}],series:[{name:"柱形订单量",type:"bar",tooltip:{valueFormatter:function(t){return t+" V"}},label:{color:"#077EF8",show:!0,position:"top"}},{name:"折线订单量",type:"line",tooltip:{valueFormatter:function(t){return t+" V"}},smooth:!0,itemStyle:{color:"#00f2f1"}}]};(n=o.value)==null||n.setOption(e)},m=()=>{v.value=[],c.value=[];let e=r(100,200),n=r(200,500),t=r(200,500),l=r(500,700),a=r(500,700),y=r(700,800),S=r(800,900),E=r(900,1e3);v.value=["20240903","20240904","20240905","20240906","20240907","20240908","20240909","20240910"],c.value.push(e,n,t,l,a,y,S,E),h()},h=()=>{var t;const e=[["#0BA82C","#4FF778"],["#2E72BF","#23E5E5"],["#5052EE","#AB6EE5"],["hotpink","lightsalmon"]],n={xAxis:{data:v.value},series:[{data:c.value,itemStyle:{label:{show:!0,position:"top",textStyle:{color:"#077EF8"}},color:l=>{let a=null;return l.value>700?a=e[0]:l.value>500?a=e[1]:l.value>200?a=e[2]:a=e[3],new w(0,0,0,1,[{offset:0,color:a[0]},{offset:1,color:a[1]}])}}},{data:c.value}]};(t=o.value)==null||t.setOption(n)},d=()=>{var t,l,a;const e=u(Math.round(((t=s.value)==null?void 0:t.offsetWidth)/50)),n={title:{textStyle:{fontSize:e.value}},legend:{textStyle:{fontSize:e.value*.8}},xAxis:{axisLabel:{fontSize:Math.round(e.value*.8)}},yAxis:{axisLabel:{fontSize:Math.round(e.value*.8)}},series:[{barWidth:Math.round(e.value*1.8),itemStyle:{label:{textStyle:{fontSize:Math.round(e.value*.8)}}}}]};(l=o.value)==null||l.setOption(n),(a=o.value)==null||a.resize()},x=()=>{p.value=setInterval(()=>{m()},3e3)};return(e,n)=>(_(),b("div",{ref_key:"refChart",ref:s,style:{"max-width":"800px",height:"350px"}},null,512))}});export{L as default};
|
1
admin/assets/KoiTimeline1-BEzbBMpb.js
Normal file
@ -0,0 +1 @@
|
||||
import{d as p,G as t,a as n,h as r,y as a,c,N as l,M as _,x as u,C as y,t as d}from"./index-BRRhBORR.js";const C=p({__name:"KoiTimeline1",setup(f){const s=[{content:"KOI-ADMIN🌻 开启了崭新的人生!",timestamp:"2023-11-23 18:00:00",type:"primary"},{content:"企业级中后台管理平台",timestamp:"2023-11-23 18:00:00",type:"success"},{content:"四种布局方式,多种主题",timestamp:"2023-11-23 18:00:00",type:"warning"},{content:"ElementPlus + Vue3 + TypeScript + Pinia",timestamp:"2023-11-23 18:00:00",type:"info"},{content:"欢迎大家star和fork,喜欢的可以捐献哟🌻",timestamp:"2023-11-23 18:00:00",type:"danger"},{content:"欢迎大家star和fork,喜欢的可以捐献哟🌻",timestamp:"2023-11-23 18:00:00",type:"danger"}];return(k,g)=>{const m=t("el-timeline-item"),o=t("el-timeline");return n(),r(o,null,{default:a(()=>[(n(),c(l,null,_(s,(e,i)=>u(m,{key:i,type:e.type,timestamp:e.timestamp},{default:a(()=>[y(d(e.content),1)]),_:2},1032,["type","timestamp"])),64))]),_:1})}}});export{C as default};
|
1
admin/assets/KoiTimeline2-WxiDd-pu.js
Normal file
@ -0,0 +1 @@
|
||||
import{d as p,G as t,a as n,h as c,y as a,c as r,N as l,M as _,x as u,C as y,t as d}from"./index-BRRhBORR.js";const C=p({__name:"KoiTimeline2",setup(f){const m=[{content:"舔狗日记🌻",timestamp:"2023-11-23 18:00:00",type:"primary"},{content:"你好像从来没有对我说过晚安,我在我们的聊天记录里搜索了关键字:“晚安”,你说过一次:我早晚安排人弄死你!",timestamp:"2023-11-23 18:00:00",type:"success"},{content:"今天发工资了,我一个月工资1500,你猜我会给你多少?是不是觉得我会给你1200,自己留300吃饭?哈哈,我1500都给你,因为厂里包吃包住。",timestamp:"2023-11-23 18:00:00",type:"warning"},{content:"听说你想要一套化妆品,我算了算,明天我去公司里面扫一天厕所,就可以拿到200块钱,再加上我上个月攒下来的零花钱,刚好给你买一套迪奥。",timestamp:"2023-11-23 18:00:00",type:"info"},{content:"今天晚上有点冷,本来以为街上没人,结果刚刚偷电瓶的时候被抓了,本来想反抗,结果警察说了一句老实点别动,我立刻就放弃了抵抗,因为我记得你说过你喜欢老实人。",timestamp:"2023-11-23 18:00:00",type:"danger"}];return(x,g)=>{const s=t("el-timeline-item"),o=t("el-timeline");return n(),c(o,null,{default:a(()=>[(n(),r(l,null,_(m,(e,i)=>u(s,{key:i,type:e.type,timestamp:e.timestamp},{default:a(()=>[y(d(e.content),1)]),_:2},1032,["type","timestamp"])),64))]),_:1})}}});export{C as default};
|
1
admin/assets/KoiTradeChart-DZjUhRrp.js
Normal file
@ -0,0 +1 @@
|
||||
import{i as y}from"./index-06v0hgpB.js";import{d as h,r as n,o as g,e as _,G as C,a as S,c as w,i as p,x as z,N as O}from"./index-BRRhBORR.js";const A={class:"flex justify-center"},k=h({__name:"KoiTradeChart",setup(L){const l=n("边牧"),v=["边牧","金毛","萨摩耶"],u=n(),t=n(),s=n(),a=n(),c=n();g(()=>{f(),d(),i(),window.addEventListener("resize",i)}),_(()=>{t.value.dispose(),t.value=null,clearInterval(c.value),c.value=null,window.removeEventListener("resize",i)});const f=()=>{var e;t.value=y(u.value);const o={grid:{top:"20%",left:"0",bottom:"18%",right:"0"},tooltip:{show:!0},legend:{right:"5%"},xAxis:[{type:"category",axisPointer:{type:"shadow"},axisLabel:{interval:0,rotate:"70"}}],yAxis:[{type:"value",splitLine:{show:!1}}],series:[{name:"折线订单量",type:"line",tooltip:{valueFormatter:function(r){return r+"笔"}},smooth:!0,itemStyle:{color:"#2992ff"},markPoint:{data:[{type:"max",name:"最大值"},{type:"min",name:"最小值"}]},areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#3e9dff"},{offset:1,color:"#d4e9ff"}],global:!1}}}]};(e=t.value)==null||e.setOption(o)},d=()=>{s.value=[],a.value=[],s.value=["20240901","20240902","20240903","20240904","20240905","20240906","20240907","20240908","20240909","20240910","20240911","20240912","20240913","20240914","20240915"],m()},m=()=>{var e;a.value=[],l.value=="边牧"&&(a.value=[72,33,66,26,77,36,59,35,62,27,55,33,69,37,52]),l.value=="金毛"&&(a.value=[66,52,36,55,75,48,59,73,56,66,45,62,70,63,65]),l.value==="萨摩耶"&&(a.value=[70,62,56,60,72,55,61,46,58,52,60,54,52,59,57]);const o={xAxis:{data:s.value},series:[{name:"交易笔数",type:"line",data:a.value}]};(e=t.value)==null||e.setOption(o)},i=()=>{var e;const o={title:{textStyle:{fontSize:16}},legend:{textStyle:{fontSize:12}},xAxis:{axisLabel:{fontSize:12}},yAxis:{axisLabel:{fontSize:12}}};(e=t.value)==null||e.setOption(o),t.value.resize()};return(o,e)=>{const r=C("el-segmented");return S(),w(O,null,[p("div",A,[z(r,{modelValue:l.value,"onUpdate:modelValue":e[0]||(e[0]=x=>l.value=x),options:v,onChange:d},null,8,["modelValue"])]),p("div",{ref_key:"refChart",ref:u,style:{width:"100%",height:"360px"}},null,512)],64)}}});export{k as default};
|
1
admin/assets/KoiTwoLineChart-D7tESj-k.js
Normal file
@ -0,0 +1 @@
|
||||
import{i as m}from"./index-06v0hgpB.js";import{d as y,r as a,o as d,e as v,a as x,c as h}from"./index-BRRhBORR.js";const C=y({__name:"KoiTwoLineChart",setup(S){const i=a(),t=a(),n=a(),c=a(),s=a();d(()=>{p(),u(),r(),window.addEventListener("resize",r)}),v(()=>{t.value.dispose(),t.value=null,clearInterval(s.value),s.value=null,window.removeEventListener("resize",r)});const p=()=>{var e;t.value=m(i.value);const o={grid:{top:"20%",left:"0",bottom:"18%",right:"0"},tooltip:{show:!0},legend:{right:"5%"},xAxis:[{type:"category",axisPointer:{type:"shadow"},axisLabel:{interval:0,rotate:"70"}}],yAxis:[{type:"value",splitLine:{show:!1}}],series:[{name:"折线订单量",type:"line",tooltip:{valueFormatter:function(l){return l+"笔"}},smooth:!0,itemStyle:{color:"#1CE0FE"},areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#1CE0FE"},{offset:1,color:"#3DF8E5"}],global:!1}}},{name:"折线订单量",type:"line",tooltip:{valueFormatter:function(l){return l+"笔"}},smooth:!0,itemStyle:{color:"#7E37F7"},markPoint:{data:[{type:"max",name:"最大值"},{type:"min",name:"最小值"}]},areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#7E37F7"},{offset:1,color:"#F1EBFB"}],global:!1}}}]};(e=t.value)==null||e.setOption(o)},u=()=>{n.value=[],c.value=[],n.value=["20240901","20240902","20240903","20240904","20240905","20240906","20240907","20240908","20240909","20240910","20240911","20240912","20240913","20240914","20240915"],f()},f=()=>{var e;const o={xAxis:{data:n.value},series:[{name:"上月同期交易笔数",type:"line",data:[320,266,245,199,278,298,312,365,378,299,287,256,276,288,281]},{name:"昨日交易笔数",type:"line",data:[188,166,100,234,256,278,300,166,156,246,220,188,210,234,290]}]};(e=t.value)==null||e.setOption(o)},r=()=>{var e;const o={title:{textStyle:{fontSize:16}},legend:{textStyle:{fontSize:12}},xAxis:{axisLabel:{fontSize:12}},yAxis:{axisLabel:{fontSize:12}}};(e=t.value)==null||e.setOption(o),t.value.resize()};return(o,e)=>(x(),h("div",{ref_key:"refChart",ref:i,style:{width:"100%",height:"360px"}},null,512))}});export{C as default};
|
1
admin/assets/add-_jdywr-F.js
Normal file
@ -0,0 +1 @@
|
||||
import{T as y,E as V}from"./index.esm-CNG9ag4U.js";import{d as N,O as S,J as E,p as R,f as B,P as I,Q as O,G as n,a as T,c as U,x as e,y as l,u as m,C as F,R as r,S as K}from"./index-BRRhBORR.js";import{k as L}from"./index-5uX73ANp.js";const M={class:"koi-flex"},Q=N({__name:"add",setup(P){const c=S(),f=E(),_=R(),a=B({zsk_explain:"",zsk_name:""}),p=async()=>{if(a.zsk_name==""){r("请输入关键字!");return}if(a.zsk_explain==""){r("请输入关键字解释!");return}try{await L(a),K("添加成功!"),_.removeTab(c.fullPath),f.push("/knowledge/list")}catch{r("添加失败,请刷新重试!")}},k={showLinkImg:!1,uploadImgShowBase64:!0,excludeKeys:["insertVideo","uploadVideo","group-video","insertImage","insertLink","insertTable","codeBlock"]},x={placeholder:"",readOnly:!1,autoFocus:!0,MENU_CONF:{uploadImage:{maxFileSize:1*1024*1024,server:"/api/common/upload",fieldName:"file",meta:{association_id:0},customInsert(t,o){o(t.data.fullurl,"","")},onError:(t,o,u)=>{o.message.indexOf("exceeds maximum allowed size")!==-1&&r("图片限制为1M,请调整好再上传!")}}}};I(()=>{const t=s.value;t!=null&&t.destroy()});const s=O(),b=t=>{s.value=t};return(t,o)=>{const u=n("el-input"),d=n("el-form-item"),g=n("el-card"),C=n("el-button"),w=n("el-form"),h=n("el-col"),z=n("el-row"),v=n("KoiCard");return T(),U("div",M,[e(v,null,{default:l(()=>[e(z,{gutter:20},{default:l(()=>[e(h,{span:12},{default:l(()=>[e(w,{ref:"formRef",model:a,"label-width":"80px","status-icon":""},{default:l(()=>[e(d,{label:"关键字",prop:"roleName"},{default:l(()=>[e(u,{modelValue:a.zsk_name,"onUpdate:modelValue":o[0]||(o[0]=i=>a.zsk_name=i),size:"large",placeholder:"请输入类型名称",clearable:""},null,8,["modelValue"])]),_:1}),e(d,{label:"解释",prop:"roleName"},{default:l(()=>[e(g,{shadow:"hover"},{default:l(()=>[e(m(y),{style:{"border-bottom":"1px solid #ccc"},editor:s.value,defaultConfig:k},null,8,["editor"]),e(m(V),{style:{height:"300px","overflow-y":"hidden"},modelValue:a.zsk_explain,"onUpdate:modelValue":o[1]||(o[1]=i=>a.zsk_explain=i),defaultConfig:x,onOnCreated:b},null,8,["modelValue"])]),_:1})]),_:1}),e(d,{label:" "},{default:l(()=>[e(C,{type:"primary",onClick:p,size:"large"},{default:l(()=>o[2]||(o[2]=[F("保存")])),_:1})]),_:1})]),_:1},8,["model"])]),_:1})]),_:1})]),_:1})])}}});export{Q as default};
|
BIN
admin/assets/b-_REdm2z7.cur
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
admin/assets/bg-BMHLGnO3.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
admin/assets/c-pVYK96dp.cur
Normal file
After Width: | Height: | Size: 4.2 KiB |
60
admin/assets/index-06v0hgpB.js
Normal file
1
admin/assets/index-5uX73ANp.js
Normal file
@ -0,0 +1 @@
|
||||
import{a8 as n}from"./index-BRRhBORR.js";const s=t=>n.post("/api/admin/login/login",t),e=t=>n.post("/api/admin/type/index ",t),d=t=>n.post("/api/admin/type/add",t),p=t=>n.post("/api/admin/type/update",t),i=t=>n.post("/api/admin/type/del",t),o=t=>n.post("/api/admin/bm/add",t),r=t=>n.post("/api/admin/bm/index",t),m=t=>n.post("/api/admin/bm/bm",t),u=t=>n.post("/api/admin/bm/news",t),c=t=>n.post("/api/admin/date/update",t),b=t=>n.post("/api/admin/bm/update",t),l=t=>n.post("/api/admin/date/del",t),w=t=>n.post("/api/admin/bm/del",t),g=t=>n.post("/api/admin/news/del",t),k=t=>n.post("/api/admin/bm/find",t),f=t=>n.post("/api/admin/news/add",t),L=t=>n.post("/api/admin/news/update",t),x=t=>n.post("/api/admin/news/find",t),y=t=>n.post("/api/admin/bm/addfind",t),z=t=>n.post("/api/admin/zsk/index",t),A=t=>n.post("/api/admin/zsk/add",t),D=t=>n.post("/api/admin/zsk/update",t),U=t=>n.post("/api/admin/zsk/del",t),h=t=>n.post("/api/admin/scheduled_tasks/generateRecording",t);export{s as L,z as a,D as b,U as c,o as d,k as e,x as f,L as g,e as h,h as i,m as j,A as k,u as l,b as m,f as n,c as o,y as p,r as q,l as r,w as s,g as t,p as u,d as v,i as w};
|
1
admin/assets/index-B5RZK56y.js
Normal file
102
admin/assets/index-BRRhBORR.js
Normal file
1
admin/assets/index-BhJFe-VE.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";#box[data-v-4729307c]{overflow:hidden}.koi-top[data-v-4729307c]{width:600px;height:300px;margin:0 auto}.koi-bottom[data-v-4729307c]{height:300px;margin-top:20px;text-align:center}.koi-text1[data-v-4729307c]{font-size:46px;font-weight:700}.koi-text2[data-v-4729307c]{padding-top:30px;font-family:YouYuan;font-size:24px;font-weight:600}
|
1
admin/assets/index-CHE3ySq0.js
Normal file
@ -0,0 +1 @@
|
||||
import{d as L,r as s,f as w,o as Y,G as o,K as R,a as x,c as Z,x as t,y as a,B as _,h as U,C as ee,i as V,R as g,S,F as E,E as te,U as oe}from"./index-BRRhBORR.js";import{h as ae,u as le,v as ne,w as se}from"./index-5uX73ANp.js";const re={class:"koi-flex"},ie=L({name:"postPage"}),de=L({...ie,setup(ue){const v=s(!1),N=s(!0),h=s(),z=s(0),p=w({pageNo:1,pageSize:10}),r=async()=>{try{v.value=!0,h.value=[];const l=await ae(p);h.value=l.data,z.value=l.data.length,v.value=!1}catch{g("数据查询失败,请刷新重试!")}};Y(()=>{r()});const M=()=>{c.value.koiOpen(),m(),y.value="新增类型"},d=s(0),P=l=>{c.value.koiOpen(),m(),y.value="岗位修改",d.value=l.id,i.type=l.type},c=s(),y=s("岗位类型管理"),k=s(),i=w({type:""}),m=()=>{i.type=""},T=w({postName:[{required:!0,message:"请输入岗位名字",trigger:"blur"}],postCode:[{required:!0,message:"请输入岗位编码",trigger:"blur"}],postStatus:[{required:!0,message:"请输入选择岗位状态",trigger:"blur"}]}),u=s(!1),q=()=>{k.value&&(u.value=!0,k.value.validate(async l=>{if(l)if(d.value!=null&&d.value!=0)try{i.id=d.value,await le(i),S("修改成功!"),u.value=!1,c.value.koiQuickClose(),m(),r()}catch{u.value=!1,g("修改失败,请刷新重试!")}else try{await ne(i),S("添加成功!"),u.value=!1,c.value.koiQuickClose(),m(),r()}catch{u.value=!1,g("添加失败,请刷新重试🌻")}else E("验证失败,请检查填写内容🌻"),u.value=!1}))},$=()=>{c.value.koiClose()},F=l=>{const e=l.id;if(e==null||e==""){te("请选中需要删除的数据!");return}oe("您确认需要删除["+l.type+"]么?").then(async()=>{try{await se({id:e}),r(),S("删除成功🌻")}catch{r(),g("删除失败,请刷新重试🌻")}}).catch(()=>{E("已取消🌻")})};return(l,e)=>{const f=o("el-button"),D=o("el-col"),I=o("KoiToolbar"),K=o("el-row"),C=o("el-table-column"),B=o("el-tooltip"),O=o("el-table"),Q=o("el-pagination"),j=o("el-input"),A=o("el-form-item"),G=o("el-form"),W=o("KoiDialog"),H=o("KoiCard"),b=R("auth"),J=R("loading");return x(),Z("div",re,[t(H,null,{default:a(()=>[t(K,{gutter:10},{default:a(()=>[_((x(),U(D,{span:1.5},{default:a(()=>[t(f,{type:"primary",icon:"plus",plain:"",onClick:e[0]||(e[0]=n=>M())},{default:a(()=>e[5]||(e[5]=[ee("新增")])),_:1})]),_:1})),[[b,["system:role:add"]]]),t(I,{showSearch:N.value,"onUpdate:showSearch":e[1]||(e[1]=n=>N.value=n),onRefreshTable:r},null,8,["showSearch"])]),_:1}),e[6]||(e[6]=V("div",{class:"h-20px"},null,-1)),_((x(),U(O,{border:"",data:h.value,"empty-text":"暂时没有数据哟"},{default:a(()=>[t(C,{label:"ID",prop:"id",width:"80px",align:"center",type:"index"}),t(C,{label:"类型名称",prop:"type",width:"180px",align:"center","show-overflow-tooltip":!0}),t(C,{label:"操作",align:"center",width:"120",fixed:"right"},{default:a(({row:n})=>[t(B,{content:"修改",placement:"top"},{default:a(()=>[_(t(f,{type:"primary",icon:"Edit",circle:"",plain:"",onClick:X=>P(n)},null,8,["onClick"]),[[b,["system:role:update"]]])]),_:2},1024),t(B,{content:"删除",placement:"top"},{default:a(()=>[_(t(f,{type:"danger",icon:"Delete",circle:"",plain:"",onClick:X=>F(n)},null,8,["onClick"]),[[b,["system:role:delete"]]])]),_:2},1024)]),_:1})]),_:1},8,["data"])),[[J,v.value]]),e[7]||(e[7]=V("div",{class:"h-20px"},null,-1)),t(Q,{background:"","current-page":p.pageNo,"onUpdate:currentPage":e[2]||(e[2]=n=>p.pageNo=n),"page-size":p.pageSize,"onUpdate:pageSize":e[3]||(e[3]=n=>p.pageSize=n),"page-sizes":[10,20,50,100,200],layout:"total, sizes, prev, pager, next, jumper",total:z.value,onSizeChange:r,onCurrentChange:r},null,8,["current-page","page-size","total"]),t(W,{ref_key:"koiDrawerRef",ref:c,width:500,height:100,title:y.value,onKoiConfirm:q,onKoiCancel:$,loading:u.value},{content:a(()=>[t(G,{ref_key:"formRef",ref:k,rules:T,model:i,"label-width":"80px","status-icon":""},{default:a(()=>[t(K,null,{default:a(()=>[t(D,{sm:{span:20},xs:{span:24}},{default:a(()=>[t(A,{label:"类型名称",prop:"roleName"},{default:a(()=>[t(j,{modelValue:i.type,"onUpdate:modelValue":e[4]||(e[4]=n=>i.type=n),placeholder:"请输入类型名称",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1},8,["title","loading"])]),_:1})])}}});export{de as default};
|
1
admin/assets/index-DOOqh-XN.js
Normal file
@ -0,0 +1 @@
|
||||
import{d as A}from"./index-5uX73ANp.js";import{d as $,O as j,J as z,p as G,r as k,f as J,o as O,G as a,a as b,c as V,x as l,y as t,C as c,N as W,M as q,h as H,i as m,t as Q,F as _,a3 as X,S as Z,R as ee}from"./index-BRRhBORR.js";const le={class:"koi-flex"},te={class:"flex justify-between items-center"},oe={class:"text-center p-10"},de=$({__name:"index",setup(ae){const y=j(),F=z(),C=G(),x=(o,e)=>{n.value[e].bm_pdf=o.fullurl},L=(o,e)=>{n.value[e].bm_pdf=o.fullurl?o.fullurl:""},M=(o,e)=>{n.value[e].bm_img=o},n=k([{bm_name:"",bm_img:"",bm_pdf:"",weight:0,pdf:[]}]),d=J({datetime:"",type_id:"",periods:""}),S=()=>{const o=Math.max(...n.value.map(e=>e.weight),0);n.value.push({bm_name:"",bm_img:"",bm_pdf:"",weight:o+1,pdf:[]})},D=()=>{n.value.sort((o,e)=>o.weight-e.weight)};O(()=>{}),k();const B=async()=>{if(d.datetime==""){_("请选择报纸日期");return}if(d.periods==""||d.periods==null){_("请输入期刊");return}for(let u=0;u<n.value.length;u++)if(n.value[u].bm_name==""||n.value[u].bm_img==""||n.value[u].bm_pdf==""){_("请完善版面["+(u+1)+"]信息");return}const o={date:d,bm:n.value},e=X.service({lock:!0,text:"保存中...",background:"rgba(0, 0, 0, 0.1)"});try{await A(o),Z("保存成功!"),e.close(),C.removeTab(y.fullPath),F.push("/paper/list")}catch{ee("保存失败,请刷新重试!")}},K=o=>{const e=n.value;if(e.length<=1){_("至少保留一个版面");return}o>=0&&o<e.length&&e.splice(o,1),n.value=[...e]};return(o,e)=>{const u=a("el-date-picker"),i=a("el-form-item"),f=a("el-input"),g=a("el-button"),v=a("el-form"),h=a("el-col"),w=a("el-row"),N=a("DeleteFilled"),U=a("el-icon"),P=a("el-space"),E=a("KoiUploadFiles"),Y=a("Picture"),I=a("KoiUploadImage"),R=a("el-card"),T=a("KoiCard");return b(),V("div",le,[l(T,null,{default:t(()=>[l(w,null,{default:t(()=>[l(h,{span:9},{default:t(()=>[l(v,{model:d,"label-width":"auto"},{default:t(()=>[l(i,{label:"报刊日期"},{default:t(()=>[l(u,{modelValue:d.datetime,"onUpdate:modelValue":e[0]||(e[0]=s=>d.datetime=s),type:"date","value-format":"YYYY-MM-DD",placeholder:"选择报刊日期",style:{width:"100%"}},null,8,["modelValue"])]),_:1}),l(i,{label:"期刊"},{default:t(()=>[l(f,{modelValue:d.periods,"onUpdate:modelValue":e[1]||(e[1]=s=>d.periods=s),placeholder:"输入期刊"},null,8,["modelValue"])]),_:1}),l(i,null,{default:t(()=>[l(g,{onClick:S,class:"mt-2"},{default:t(()=>e[2]||(e[2]=[c("新增版面")])),_:1})]),_:1})]),_:1},8,["model"])]),_:1})]),_:1}),l(w,{gutter:20},{default:t(()=>[(b(!0),V(W,null,q(n.value,(s,p)=>(b(),H(h,{span:8},{default:t(()=>[l(R,{class:"m-b-5",shadow:"hover"},{header:t(()=>[m("div",te,[m("div",null,Q(s.bm_name?s.bm_name:"版面"),1),m("div",null,[l(P,{wrap:"",size:30},{default:t(()=>[l(U,{class:"cursor-pointer",onClick:r=>K(p)},{default:t(()=>[l(N)]),_:2},1032,["onClick"])]),_:2},1024)])])]),default:t(()=>[l(v,{model:d,"label-width":"auto"},{default:t(()=>[l(i,{label:"版面名称"},{default:t(()=>[l(f,{modelValue:s.bm_name,"onUpdate:modelValue":r=>s.bm_name=r,placeholder:"输入版面名称"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),l(i,{label:"版面排序"},{default:t(()=>[l(f,{onBlur:D,type:"number",modelValue:s.weight,"onUpdate:modelValue":r=>s.weight=r,placeholder:"输入版面排序"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),l(i,{label:"版面PDF"},{default:t(()=>[l(E,{fileList:s.pdf,acceptType:".pdf","onUpdate:fileList":r=>L(r,p),onFileSuccess:r=>x(r,p)},{tip:t(()=>e[3]||(e[3]=[c("PDF最大为 10M")])),_:2},1032,["fileList","onUpdate:fileList","onFileSuccess"])]),_:2},1024),l(i,{label:"版面图片",prop:"avatar"},{default:t(()=>[l(I,{imageUrl:s.bm_img,"onUpdate:imageUrl":r=>M(r,p),width:"150px",height:"150px"},{content:t(()=>[l(U,null,{default:t(()=>[l(Y)]),_:1}),e[4]||(e[4]=m("span",null,"请上传版面图片",-1))]),tip:t(()=>e[5]||(e[5]=[c("图片最大为 3M")])),_:2},1032,["imageUrl","onUpdate:imageUrl"])]),_:2},1024)]),_:2},1032,["model"])]),_:2},1024)]),_:2},1024))),256))]),_:1}),m("div",oe,[l(g,{type:"primary",class:"w-80",plain:"",onClick:B},{default:t(()=>e[6]||(e[6]=[c("保存报刊")])),_:1})])]),_:1})])}}});export{de as default};
|
1
admin/assets/index-DifYnazR.js
Normal file
@ -0,0 +1 @@
|
||||
import{d as t,o as d,a as o,c as e,b as s,_ as c}from"./index-BRRhBORR.js";const i={class:"overflow-x-hidden"},n=t({name:"homePage"}),v=t({...n,setup(_){return d(()=>{}),(r,a)=>(o(),e("div",i,a[0]||(a[0]=[s('<div id="box" data-v-4729307c><div class="koi-top" id="banner" data-v-4729307c></div><div class="koi-bottom" data-v-4729307c><div class="koi-text1" data-v-4729307c>今日固始电子报 管理后台</div><div class="h-20px" data-v-4729307c></div></div></div>',1)])))}}),p=c(v,[["__scopeId","data-v-4729307c"]]);export{p as default};
|
1
admin/assets/index-DogPoCUT.js
Normal file
1
admin/assets/index-DrxwDvXp.js
Normal file
1
admin/assets/index-FtYF3tMW.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";[data-v-111ec772] .el-transfer-panel__body{height:400px}
|
1
admin/assets/index-S4XdJOes.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";[data-v-ad76958e] .center-input .el-input__inner{text-align:center}
|
7
admin/assets/index-U2EIj2YI.css
Normal file
1
admin/assets/index-b7bz7d96.js
Normal file
1
admin/assets/index-mfhJ7B4m.css
Normal file
1
admin/assets/index-nHDhGvq6.css
Normal file
1
admin/assets/index-uvBumCKy.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";
|
BIN
admin/assets/index-yXI3qzBz.cur
Normal file
After Width: | Height: | Size: 4.2 KiB |
183
admin/assets/index.esm-CNG9ag4U.js
Normal file
1
admin/assets/index2-BOUst6zg.css
Normal file
@ -0,0 +1 @@
|
||||
@charset "UTF-8";.beianhao[data-v-34e33b00]{position:absolute;bottom:10px;left:45%;font-size:12px;font-weight:700}.bigBox[data-v-34e33b00]{display:flex;height:100vh;overflow-x:hidden;background:linear-gradient(to right,#f7d1d7,#bfe3f1)}.box[data-v-34e33b00]{position:relative;z-index:2;display:flex;min-width:720px;min-height:400px;margin:auto;border:1px solid rgba(255,255,255,.6);border-radius:8px;box-shadow:2px 1px 19px #0000001a}.slide-box[data-v-34e33b00]{position:absolute;top:0;left:0;z-index:10;width:50%;height:100%;font-size:16px;background-color:#edd4dc;border-radius:4px;box-shadow:2px 1px 19px #0000001a;transition:.5s ease-in-out}.slide-box h1[data-v-34e33b00]{margin-top:50px;font-weight:700;text-align:center;text-shadow:4px 4px 3px rgba(0,0,0,.1);letter-spacing:2px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slide-box p[data-v-34e33b00]{height:30px;margin:20px 0;font-weight:700;line-height:30px;text-align:center;text-shadow:4px 4px 3px rgba(0,0,0,.1);-webkit-user-select:none;-moz-user-select:none;user-select:none}.slide-title[data-v-34e33b00]{font-size:20px;color:var(--63069bb6)}.img-box[data-v-34e33b00]{width:80px;height:80px;margin:30px auto auto;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:50%;box-shadow:4px 4px 3px #0000001a}.img-box img[data-v-34e33b00]{width:100%;transition:.5s ease-in-out}.slide-button[data-v-34e33b00]{width:160px;padding:8px 16px;margin:60px auto auto;font-size:14px;line-height:14px;color:#fff;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:var(--63069bb6);border:1px solid rgb(255,255,255);border-radius:20px;box-shadow:4px 4px 3px #0000001a}.slide-button[data-v-34e33b00]:hover{background:var(--5a2be0cd)}.login-form[data-v-34e33b00],.register-form[data-v-34e33b00]{flex:1;height:100%}.login-title[data-v-34e33b00]{height:90px;line-height:90px}.login-title h1[data-v-34e33b00]{font-size:24px;font-weight:700;color:#409eff;text-align:center;text-shadow:4px 4px 3px rgba(0,0,0,.1);letter-spacing:5px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.el-form[data-v-34e33b00]{display:flex;flex-direction:column;align-items:center}.el-form-item[data-v-34e33b00]{width:60%}.el-select[data-v-34e33b00]{width:100%}.login-btn-box[data-v-34e33b00]{display:flex}.login-btn[data-v-34e33b00]{height:32px;padding:8px 16px;margin:auto;font-size:14px;line-height:14px;color:#fff;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#409eff;border:1px solid rgb(255,255,255);border-radius:20px;box-shadow:4px 4px 3px #0000001a}.login-btn[data-v-34e33b00]:hover{background:#67aff7}.login-disabled-btn[data-v-34e33b00]{height:32px;padding:8px 16px;margin:auto;font-size:14px;line-height:14px;color:#fff;pointer-events:none;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#67aff7;border:1px solid rgb(255,255,255);border-radius:20px;box-shadow:4px 4px 3px #0000001a}.register-title[data-v-34e33b00]{height:98px;line-height:98px}.register-title h1[data-v-34e33b00]{font-size:22px;font-weight:700;color:#fe3e7c;text-align:center;text-shadow:4px 4px 3px rgba(0,0,0,.1);letter-spacing:5px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.register-btn-box[data-v-34e33b00]{display:flex}.register-btn[data-v-34e33b00]{height:32px;padding:8px 16px;margin:auto;font-size:14px;line-height:14px;color:#fff;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#fe3e7c;border:1px solid rgb(255,255,255);border-radius:20px;box-shadow:4px 4px 3px #0000001a}.register-btn[data-v-34e33b00]:hover{background:#f9739e}.register-disabled-btn[data-v-34e33b00]{height:32px;padding:8px 16px;margin:auto;font-size:14px;line-height:14px;color:#fff;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;background:#f9739e;border:1px solid rgb(255,255,255);border-radius:20px;box-shadow:4px 4px 3px #0000001a}.dark [data-v-34e33b00] .el-input__wrapper{--un-bg-opacity:1;background-color:rgb(29 30 31 / var(--un-bg-opacity))}
|
1
admin/assets/index2-DM6t1kE0.js
Normal file
1
admin/assets/koi-menu-earth-BNmY6sEV.svg
Normal file
After Width: | Height: | Size: 5.3 KiB |
1
admin/assets/koi-menu-earth-BsoXWq_B.js
Normal file
@ -0,0 +1 @@
|
||||
const s="/admin/assets/koi-menu-earth-BNmY6sEV.svg";export{s as default};
|
1
admin/assets/koi-menu-left-yGsaAxWr.js
Normal file
@ -0,0 +1 @@
|
||||
const e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M3,21H21V19H3M3,12L7,16V8M11,17H21V15H11V17Z'%20/%3e%3c/svg%3e";export{e as default};
|
1
admin/assets/koi-menu-moon-Cym42V6H.js
Normal file
@ -0,0 +1 @@
|
||||
const c="data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1710850353810'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='8349'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='128'%20height='128'%3e%3cpath%20d='M551.41%20326.72h-74.14c-10.24%200-18.56-8.3-18.56-18.54%200-10.24%208.31-18.54%2018.56-18.54h74.14c10.24%200%2018.56%208.3%2018.56%2018.54%200%2010.24-8.32%2018.54-18.56%2018.54z'%20fill='%23F6BB42'%20p-id='8350'%3e%3c/path%3e%3cpath%20d='M773.93%20697.54c-245.78%200-445.01-199.23-445.01-445%200-55.23%2010.08-108.13%2028.48-156.94C189.08%20159.05%2069.34%20321.61%2069.34%20512.14c0%20245.76%20199.23%20445%20445.01%20445%20190.51%200%20353.07-119.74%20416.51-288.07-48.8%2018.4-101.7%2028.47-156.93%2028.47z'%20fill='%23FFCE54'%20p-id='8351'%3e%3c/path%3e%3cpath%20d='M551.41%20920.05c-245.75%200-444.98-199.23-444.98-445%200-113.41%2042.44-216.91%20112.26-295.48-91.61%2081.5-149.35%20200.28-149.35%20332.57%200%20245.76%20199.23%20445%20445.01%20445%20132.26%200%20251.05-57.74%20332.55-149.37-78.57%2069.85-182.08%20112.28-295.49%20112.28z'%20fill='%23F6BB42'%20p-id='8352'%3e%3c/path%3e%3cpath%20d='M736.84%20308.17c0%2010.24-8.31%2018.54-18.55%2018.54-10.22%200-18.53-8.3-18.53-18.54%200-10.24%208.32-18.54%2018.53-18.54%2010.24%200%2018.55%208.3%2018.55%2018.54z'%20fill='%234A89DC'%20p-id='8353'%3e%3c/path%3e%3cpath%20d='M644.14%20493.59c0%2010.23-8.31%2018.54-18.56%2018.54-10.24%200-18.53-8.32-18.53-18.54%200-10.24%208.29-18.54%2018.53-18.54%2010.25%200%2018.56%208.3%2018.56%2018.54z'%20fill='%2348CFAD'%20p-id='8354'%3e%3c/path%3e%3cpath%20d='M959.33%20270.79c0%2010.24-8.31%2018.54-18.53%2018.54-10.24%200-18.56-8.3-18.56-18.54%200-10.24%208.31-18.54%2018.56-18.54%2010.22%200%2018.53%208.29%2018.53%2018.54z'%20fill='%23ED5564'%20p-id='8355'%3e%3c/path%3e%3cpath%20d='M625.58%2085.37c0%2010.24-8.29%2018.54-18.53%2018.54-10.24%200-18.56-8.3-18.56-18.54%200-10.23%208.31-18.53%2018.56-18.53%2010.25%200%2018.53%208.3%2018.53%2018.53z'%20fill='%23AC92EB'%20p-id='8356'%3e%3c/path%3e%3cpath%20d='M514.35%20234c-10.24%200-18.56%208.31-18.56%2018.54V363.8c0%2010.23%208.31%2018.53%2018.56%2018.53%2010.22%200%2018.53-8.3%2018.53-18.53V252.54c0-10.23-8.31-18.54-18.53-18.54z'%20fill='%23FFCE54'%20p-id='8357'%3e%3c/path%3e%3cpath%20d='M829.55%20437.96c-10.24%200-18.53%208.3-18.53%2018.54v111.24c0%2010.24%208.29%2018.54%2018.53%2018.54%2010.24%200%2018.53-8.3%2018.53-18.54V456.51c-0.01-10.25-8.29-18.55-18.53-18.55z'%20fill='%23F6BB42'%20p-id='8358'%3e%3c/path%3e%3cpath%20d='M866.63%20530.67h-74.17c-10.24%200-18.53-8.3-18.53-18.53%200-10.24%208.29-18.54%2018.53-18.54h74.17c10.24%200%2018.53%208.3%2018.53%2018.54%200%2010.22-8.28%2018.53-18.53%2018.53z'%20fill='%23FFCE54'%20p-id='8359'%3e%3c/path%3e%3c/svg%3e";export{c as default};
|
1
admin/assets/koi-menu-right-D3nNoeeA.js
Normal file
@ -0,0 +1 @@
|
||||
const H="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M11,13H21V11H11M11,9H21V7H11M3,3V5H21V3M11,17H21V15H11M3,8V16L7,12M3,21H21V19H3V21Z'%20/%3e%3c/svg%3e";export{H as default};
|
1
admin/assets/koi-menu-sun-C0ZGjPTA.js
Normal file
@ -0,0 +1 @@
|
||||
const a="data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1710850426744'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='20657'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='128'%20height='128'%3e%3cpath%20d='M752.64%20887.552a64%2064%200%201%201-115.008%2056.128%2064%2064%200%200%201%20115.008-56.128z%20m-418.176-29.44a64%2064%200%201%201-56.128%20115.072%2064%2064%200%200%201%2056.128-115.072z%20m617.472-308.8a64%2064%200%201%201-28.8%20124.736%2064%2064%200%200%201%2028.8-124.736z%20m-825.6%2048a64%2064%200%201%201-124.672%2028.8%2064%2064%200%200%201%20124.672-28.8z%20m774.4-404.928a64%2064%200%201%201-99.456%2080.576%2064%2064%200%200%201%2099.456-80.576zM190.784%20182.912a64%2064%200%201%201-80.576%2099.52%2064%2064%200%200%201%2080.576-99.52zM500.736%200a64%2064%200%201%201%200%20128%2064%2064%200%200%201%200-128zM500.736%20192a320%20320%200%201%201%200%20640%20320%20320%200%200%201%200-640z'%20fill='%23F5A623'%20p-id='20658'%3e%3c/path%3e%3cpath%20d='M500.736%20256a256%20256%200%201%200%200%20512%20256%20256%200%200%200%200-512z'%20fill='%23F8E71C'%20p-id='20659'%3e%3c/path%3e%3c/svg%3e";export{a as default};
|
1
admin/assets/koi-mobile-menu-DJvzN4YO.js
Normal file
@ -0,0 +1 @@
|
||||
const l="data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1700662317665'%20class='icon'%20viewBox='0%200%201034%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='17831'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='129.25'%20height='128'%3e%3cpath%20d='M735.857778%20759.523556H153.543111a153.6%20153.6%200%200%201-153.6-153.6v-374.044445a153.6%20153.6%200%200%201%20153.6-153.6h582.314667a154.908444%20154.908444%200%200%201%20137.557333%2085.333333%2030.72%2030.72%200%200%201-55.011555%2027.363556%2093.013333%2093.013333%200%200%200-82.545778-51.2H153.543111a92.216889%2092.216889%200%200%200-92.103111%2092.103111v374.044445a92.216889%2092.216889%200%200%200%2092.103111%2092.103111h582.314667a92.216889%2092.216889%200%200%200%2084.878222-56.433778%2030.72%2030.72%200%200%201%2056.547556%2024.007111%20153.6%20153.6%200%200%201-141.425778%2093.923556z'%20fill='%230A71EF'%20p-id='17832'%3e%3c/path%3e%3cpath%20d='M413.980444%20731.761778m30.72%200l-0.056888%200q30.72%200%2030.72%2030.72l0%20144.668444q0%2030.72-30.72%2030.72l0.056888%200q-30.72%200-30.72-30.72l0-144.668444q0-30.72%2030.72-30.72Z'%20fill='%230A71EF'%20p-id='17833'%3e%3c/path%3e%3cpath%20d='M199.054222%20884.110222m30.72%200l429.852445%200q30.72%200%2030.72%2030.72l0-0.056889q0%2030.72-30.72%2030.72l-429.852445%200q-30.72%200-30.72-30.72l0%200.056889q0-30.72%2030.72-30.72Z'%20fill='%230A71EF'%20p-id='17834'%3e%3c/path%3e%3cpath%20d='M199.054222%20299.576889m30.72%200l240.355556%200q30.72%200%2030.72%2030.72l0-0.056889q0%2030.72-30.72%2030.72l-240.355556%200q-30.72%200-30.72-30.72l0%200.056889q0-30.72%2030.72-30.72Z'%20fill='%2389BAF7'%20p-id='17835'%3e%3c/path%3e%3cpath%20d='M199.054222%20484.124444m30.72%200l119.068445%200q30.72%200%2030.72%2030.72l0-0.056888q0%2030.72-30.72%2030.72l-119.068445%200q-30.72%200-30.72-30.72l0%200.056888q0-30.72%2030.72-30.72Z'%20fill='%2389BAF7'%20p-id='17836'%3e%3c/path%3e%3cpath%20d='M1018.709333%20428.088889l-83.285333%20150.983111a33.678222%2033.678222%200%200%201-29.468444%2017.521778h-165.205334a33.678222%2033.678222%200%200%201-29.468444-17.521778l-83.285334-150.983111a34.133333%2034.133333%200%200%201%200-33.166222l83.285334-150.983111a33.678222%2033.678222%200%200%201%2029.468444-17.521778h165.376a33.678222%2033.678222%200%200%201%2029.468445%2017.521778l83.285333%20150.983111a34.133333%2034.133333%200%200%201-0.170667%2033.166222z%20m-25.543111-14.222222a4.892444%204.892444%200%200%200%200-4.721778l-83.114666-150.983111a4.778667%204.778667%200%200%200-4.209778-2.503111h-164.977778a4.778667%204.778667%200%200%200-4.209778%202.503111l-83.114666%20151.210666a4.892444%204.892444%200%200%200%200%204.721778l83.114666%20150.983111a4.778667%204.778667%200%200%200%204.209778%202.503111h164.977778a4.778667%204.778667%200%200%200%204.209778-2.503111z%20m-171.121778%2073.955555a77.937778%2077.937778%200%201%201%2077.937778-77.937778%2077.937778%2077.937778%200%200%201-77.824%2077.710223z%20m0-29.240889a48.696889%2048.696889%200%201%200-48.696888-48.696889%2048.696889%2048.696889%200%200%200%2048.810666%2048.469334z'%20fill='%23FF7733'%20p-id='17837'%3e%3c/path%3e%3c/svg%3e";export{l as default};
|
1
admin/assets/list-CqgLjkD-.js
Normal file
BIN
admin/assets/logo-DB8VLObx.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
1
admin/assets/update-CKjhk4NG.js
Normal file
BIN
admin/assets/waoku-2Sqi2HOF.jpg
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
admin/assets/wuwu-T1rfgmq-.jpg
Normal file
After Width: | Height: | Size: 60 KiB |
160
admin/index.html
Normal file
@ -0,0 +1,160 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/admin/assets/logo-DB8VLObx.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>今日固始电子版</title>
|
||||
<!-- 加载第一步开始 -->
|
||||
<style>
|
||||
.preloader {
|
||||
background: #5838fc;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.loader-inner {
|
||||
width: 70px;
|
||||
height: 60px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.mask {
|
||||
position: absolute;
|
||||
border-radius: 2px;
|
||||
overflow: hidden;
|
||||
perspective: 1000;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.plane {
|
||||
background: #fff;
|
||||
width: 400%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
transform: translate3d(0px, 0, 0);
|
||||
/*transition: all 0.8s ease; */
|
||||
z-index: 100;
|
||||
perspective: 1000;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.animation {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
#top .plane {
|
||||
z-index: 2000;
|
||||
animation: trans1 1.3s ease-in infinite 0s backwards;
|
||||
}
|
||||
|
||||
#middle .plane {
|
||||
transform: translate3d(0px, 0, 0);
|
||||
background: #fff;
|
||||
animation: trans2 1.3s linear infinite 0.3s backwards;
|
||||
}
|
||||
|
||||
#bottom .plane {
|
||||
z-index: 2000;
|
||||
animation: trans3 1.3s ease-out infinite 0.7s backwards;
|
||||
}
|
||||
|
||||
#top {
|
||||
width: 53px;
|
||||
height: 20px;
|
||||
left: 20px;
|
||||
transform: skew(-15deg, 0);
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
#middle {
|
||||
width: 33px;
|
||||
height: 20px;
|
||||
left: 20px;
|
||||
top: 15px;
|
||||
transform: skew(-15deg, 40deg);
|
||||
}
|
||||
|
||||
#bottom {
|
||||
width: 53px;
|
||||
height: 20px;
|
||||
top: 30px;
|
||||
transform: skew(-15deg, 0);
|
||||
}
|
||||
|
||||
.preloader p {
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
left: -50px;
|
||||
top: 60px;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
font-style: italic;
|
||||
letter-spacing: 0.5px;
|
||||
text-transform: uppercase;
|
||||
margin: 0;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
@keyframes trans1 {
|
||||
from {
|
||||
transform: translate3d(53px, 0, 0);
|
||||
}
|
||||
to {
|
||||
transform: translate3d(-250px, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes trans2 {
|
||||
from {
|
||||
transform: translate3d(-160px, 0, 0);
|
||||
}
|
||||
to {
|
||||
transform: translate3d(53px, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes trans3 {
|
||||
from {
|
||||
transform: translate3d(53px, 0, 0);
|
||||
}
|
||||
to {
|
||||
transform: translate3d(-220px, 0, 0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!-- 加载第一步结束 -->
|
||||
<script type="module" crossorigin src="/admin/assets/index-BRRhBORR.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/admin/assets/index-U2EIj2YI.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<!-- 第二步开始 -->
|
||||
<div class="preloader">
|
||||
<div class="loader-inner">
|
||||
<div id="top" class="mask">
|
||||
<div class="plane"></div>
|
||||
</div>
|
||||
<div id="middle" class="mask">
|
||||
<div class="plane"></div>
|
||||
</div>
|
||||
<div id="bottom" class="mask">
|
||||
<div class="plane"></div>
|
||||
</div>
|
||||
<p>页面加载中,请耐心等待...</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 第二步结束 -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
BIN
admin/vite.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
164
commitlint.config.cjs
Normal file
@ -0,0 +1,164 @@
|
||||
// @see: https://cz-git.qbenben.com/zh/guide
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const scopes = fs
|
||||
.readdirSync(path.resolve(__dirname, "src"), { withFileTypes: true })
|
||||
.filter(dirent => dirent.isDirectory())
|
||||
.map(dirent => dirent.name.replace(/s$/, ""));
|
||||
|
||||
/** @type {import('cz-git').UserConfig} */
|
||||
module.exports = {
|
||||
ignores: [commit => commit.includes("init")],
|
||||
extends: ["@commitlint/config-conventional"],
|
||||
rules: {
|
||||
// @see: https://commitlint.js.org/#/reference-rules
|
||||
"body-leading-blank": [2, "always"],
|
||||
"footer-leading-blank": [1, "always"],
|
||||
"header-max-length": [2, "always", 108],
|
||||
"subject-empty": [2, "never"],
|
||||
"type-empty": [2, "never"],
|
||||
"subject-case": [0],
|
||||
"type-enum": [
|
||||
2,
|
||||
"always",
|
||||
[
|
||||
"feat",
|
||||
"fix",
|
||||
"docs",
|
||||
"style",
|
||||
"refactor",
|
||||
"perf",
|
||||
"test",
|
||||
"build",
|
||||
"ci",
|
||||
"chore",
|
||||
"revert",
|
||||
"wip",
|
||||
"workflow",
|
||||
"types",
|
||||
"release"
|
||||
]
|
||||
]
|
||||
},
|
||||
prompt: {
|
||||
messages: {
|
||||
// 英文版
|
||||
// type: "Select the type of change that you're committing:",
|
||||
// scope: "Denote the SCOPE of this change (optional):",
|
||||
// customScope: "Denote the SCOPE of this change:",
|
||||
// subject: "Write a SHORT, IMPERATIVE tense description of the change:\n",
|
||||
// body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
|
||||
// breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
|
||||
// footerPrefixsSelect: "Select the ISSUES type of changeList by this change (optional):",
|
||||
// customFooterPrefixs: "Input ISSUES prefix:",
|
||||
// footer: "List any ISSUES by this change. E.g.: #31, #34:\n",
|
||||
// confirmCommit: "Are you sure you want to proceed with the commit above?"
|
||||
// 中文版
|
||||
type: "选择你要提交的类型 :",
|
||||
scope: "选择一个提交范围[可选]:",
|
||||
customScope: "请输入自定义的提交范围 :",
|
||||
subject: "填写简短精炼的变更描述 :\n",
|
||||
body: '填写更加详细的变更描述[可选]。使用 "|" 换行 :\n',
|
||||
breaking: '列举非兼容性重大的变更[可选]。使用 "|" 换行 :\n',
|
||||
footerPrefixsSelect: "选择关联issue前缀[可选]:",
|
||||
customFooterPrefixs: "输入自定义issue前缀 :",
|
||||
footer: "列举关联issue [可选] 例如: #31, #I3244 :\n",
|
||||
confirmCommit: "是否提交或修改commit ?"
|
||||
},
|
||||
types: [
|
||||
// 英文版
|
||||
// {
|
||||
// value: "feat",
|
||||
// name: "feat: 👻 A new feature",
|
||||
// emoji: "👻"
|
||||
// },
|
||||
// {
|
||||
// value: "fix",
|
||||
// name: "fix: 🌈 A bug fix",
|
||||
// emoji: "🌈"
|
||||
// },
|
||||
// {
|
||||
// value: "docs",
|
||||
// name: "docs: 🍊 Documentation only changes",
|
||||
// emoji: "🍊"
|
||||
// },
|
||||
// {
|
||||
// value: "style",
|
||||
// name: "style: 🌻 Changes that do not affect the meaning of the code",
|
||||
// emoji: "🌻"
|
||||
// },
|
||||
// {
|
||||
// value: "refactor",
|
||||
// name: "refactor: 🎃 A code change that neither fixes a bug nor adds a feature",
|
||||
// emoji: "🎃"
|
||||
// },
|
||||
// {
|
||||
// value: "perf",
|
||||
// name: "perf: ⚡️ A code change that improves performance",
|
||||
// emoji: "⚡️"
|
||||
// },
|
||||
// {
|
||||
// value: "test",
|
||||
// name: "test: ✅ Adding missing tests or correcting existing tests",
|
||||
// emoji: "✅"
|
||||
// },
|
||||
// {
|
||||
// value: "build",
|
||||
// name: "build: 📦️ Changes that affect the build system or external dependencies",
|
||||
// emoji: "📦️"
|
||||
// },
|
||||
// {
|
||||
// value: "ci",
|
||||
// name: "ci: 🍀 Changes to our CI configuration files and scripts",
|
||||
// emoji: "🍀"
|
||||
// },
|
||||
// {
|
||||
// value: "chore",
|
||||
// name: "chore: 🔨 Other changes that don't modify src or test files",
|
||||
// emoji: "🔨"
|
||||
// },
|
||||
// {
|
||||
// value: "revert",
|
||||
// name: "revert: 🌍 Reverts a previous commit",
|
||||
// emoji: "🌍"
|
||||
// },
|
||||
// {
|
||||
// value: "wip",
|
||||
// name: "wip: 🕔 work in process",
|
||||
// emoji: "🕔"
|
||||
// },
|
||||
// {
|
||||
// value: "workflow",
|
||||
// name: "workflow: 🎯 workflow improvements",
|
||||
// emoji: "🎯"
|
||||
// },
|
||||
// {
|
||||
// value: "type",
|
||||
// name: "type: 🏡 type definition file changes",
|
||||
// emoji: "🏡"
|
||||
// }
|
||||
// 中文版
|
||||
{ value: "feat", name: "特性: 👻 新增功能", emoji: "👻" },
|
||||
{ value: "fix", name: "修复: 🌈 修复缺陷", emoji: "🌈" },
|
||||
{ value: "docs", name: "文档: 🍊 文档变更", emoji: "🍊" },
|
||||
{ value: "style", name: "格式: 🌻 代码格式[不影响功能,例如空格、分号等格式修正]", emoji: "🌻" },
|
||||
{ value: "refactor", name: "重构: 🎃 代码重构[不包括 bug 修复、功能新增]", emoji: "🎃" },
|
||||
{ value: "perf", name: "性能: ⚡️ 性能优化", emoji: "⚡️" },
|
||||
{ value: "test", name: "测试: ✅ 添加疏漏测试或已有测试改动", emoji: "✅" },
|
||||
{ value: "build", name: "构建: 📦️ 构建流程、外部依赖变更[如升级 npm 包、修改 webpack 配置等]", emoji: "📦️" },
|
||||
{ value: "ci", name: "集成: 🍀 修改 CI 配置、脚本", emoji: "🍀" },
|
||||
{ value: "revert", name: "回退: 🌍 回滚 commit", emoji: "🌍" },
|
||||
{ value: "chore", name: "其他: 🔨 对构建过程或辅助工具和库的更改[不影响源文件、测试用例]", emoji: "🔨" },
|
||||
{ value: "wip", name: "开发: 🕔 正在开发中", emoji: "🕔" },
|
||||
{ value: "workflow", name: "工作流: 🎯 工作流程改进", emoji: "🎯" },
|
||||
{ value: "types", name: "类型: 🏡 类型定义文件修改", emoji: "🏡" }
|
||||
],
|
||||
useEmoji: true,
|
||||
scopes: [...scopes],
|
||||
customScopesAlign: "bottom",
|
||||
emptyScopesAlias: "empty",
|
||||
customScopesAlias: "custom",
|
||||
allowBreakingChanges: ["feat", "fix"]
|
||||
}
|
||||
};
|