@@ -495,7 +452,8 @@
@@ -531,7 +489,8 @@ const searchForm = reactive({
maxInventory: 999999,
minSelling: 0,
maxSelling: 999999,
- hasImage: null
+ hasImage: null,
+ category: undefined
})
const currentPreviewImg = ref('') // 仅存储当前点击的图片
@@ -541,20 +500,20 @@ const currentPreviewIndex = ref(0)
// 处理图片预览
const handlePreview = (row) => {
- // 收集所有有效的图片URL
- previewList.value = tableData.value
- .filter(item => item.bookPic && item.bookPic !== '0')
- .map(item => getBookImageUrl(item))
-
- // 设置当前预览图片的索引
- currentPreviewIndex.value = previewList.value.findIndex(url => url === getBookImageUrl(row))
+ // 收集所有有效的图片URL
+ previewList.value = tableData.value
+ .filter(item => item.bookPic && item.bookPic !== '0')
+ .map(item => getBookImageUrl(item))
+
+ // 设置当前预览图片的索引
+ currentPreviewIndex.value = previewList.value.findIndex(url => url === getBookImageUrl(row))
}
// 获取预览索引
const getPreviewIndex = (row) => {
- if (!row.bookPic || row.bookPic === '0') return 0
- const imageUrl = getBookImageUrl(row)
- return previewList.value.findIndex(url => url === imageUrl)
+ if (!row.bookPic || row.bookPic === '0') return 0
+ const imageUrl = getBookImageUrl(row)
+ return previewList.value.findIndex(url => url === imageUrl)
}
// 日期快捷选项
@@ -678,7 +637,7 @@ onMounted(() => {
// 处理普通搜索
const handleNormalSearch = () => {
pagination.current = 1 // 重置到第一页
-
+
// 清空高级搜索相关参数
searchForm.inventoryType = null
searchForm.saleSelect = null
@@ -686,7 +645,7 @@ const handleNormalSearch = () => {
searchForm.maxInventory = 999999
searchForm.minSelling = 0
searchForm.maxSelling = 999999
-
+
// 使用普通搜索模式
fetchData(false)
}
@@ -721,20 +680,21 @@ const fetchData = async (isAdvancedSearch = false) => {
bookSet: 0,
onenumMbooks: 0,
illPublisher: 0,
- illAuthor: 0
+ illAuthor: 0,
+ category: searchForm.category || undefined
}
-
+
// 添加时间范围参数
if (searchForm.timeRange && searchForm.timeRange.length === 2) {
params.startTime = searchForm.timeRange[0]
params.endTime = searchForm.timeRange[1]
}
-
+
// 添加图片筛选条件
if (searchForm.hasImage !== null) {
params.bookPic = searchForm.hasImage
}
-
+
// 添加违规类型
if (searchForm.violationTypes.length > 0) {
const violationMap = {
@@ -748,17 +708,17 @@ const fetchData = async (isAdvancedSearch = false) => {
params[violationMap[type]] = 1
})
}
-
+
// 只在高级搜索模式下添加销量、已售和在售筛选条件
if (isAdvancedSearch) {
// 添加销量筛选条件
if (searchForm.inventoryType !== null) {
params.inventoryType = searchForm.inventoryType
params.saleSelect = searchForm.saleSelect !== null ? searchForm.saleSelect : searchForm.inventoryType
-
+
}
- // 添加已售数量范围 - 映射到BookNumberRageBo的min1和max1
+ // 添加已售数量范围 - 映射到BookNumberRageBo的min1和max1
if (searchForm.minInventory > 0 || searchForm.maxInventory < 999999) {
params.min1 = searchForm.minInventory.toString()
params.max1 = searchForm.maxInventory.toString()
@@ -769,9 +729,9 @@ const fetchData = async (isAdvancedSearch = false) => {
params.max2 = searchForm.maxSelling.toString()
}
}
-
+
const res = await bookBaseInfoApi.getBookBaseInfoList(params)
-
+
if (res.code === 200 && res.data) {
tableData.value = res.data.list || []
pagination.total = res.data.total || 0
@@ -834,22 +794,22 @@ const handleAdd = () => {
const handleEdit = (row) => {
resetForm()
dialogType.value = 'edit'
-
+
// 创建一个深拷贝,避免直接引用原对象
const rowCopy = JSON.parse(JSON.stringify(row))
-
+
// 特殊处理价格字段 - 后端存储为分,界面显示为元
if (rowCopy.fixPrice) {
rowCopy.fixPrice = rowCopy.fixPrice / 100
}
-
+
// 将数据赋值给表单
Object.keys(formData).forEach(key => {
if (key in rowCopy) {
formData[key] = rowCopy[key]
}
})
-
+
dialogVisible.value = true
}
@@ -868,7 +828,7 @@ const handleBatchDelete = () => {
ElMessage.warning('请至少选择一条记录')
return
}
-
+
ElMessageBox.confirm(`确定要删除选中的${multipleSelection.value.length}条记录吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@@ -883,7 +843,7 @@ const handleBatchDelete = () => {
console.error('删除失败:', error)
ElMessage.error('删除失败')
}
- }).catch(() => {})
+ }).catch(() => { })
}
// 删除
@@ -901,7 +861,7 @@ const handleDelete = (row) => {
console.error('删除失败:', error)
ElMessage.error('删除失败')
}
- }).catch(() => {})
+ }).catch(() => { })
}
// 配置违规
@@ -910,12 +870,12 @@ const handleConfig = () => {
ElMessage.warning('请至少选择一条记录')
return
}
-
+
// 重置违规配置
Object.keys(violationConfig).forEach(key => {
violationConfig[key] = false
})
-
+
configDialogVisible.value = true
}
@@ -924,7 +884,7 @@ const handleViolationSubmit = async () => {
configSubmitLoading.value = true
try {
const ids = multipleSelection.value.map(item => item.id)
-
+
// 将布尔值转换为0/1
const params = {
ids: ids,
@@ -934,7 +894,7 @@ const handleViolationSubmit = async () => {
illPublisher: violationConfig.illPublisher ? 1 : 0,
illAuthor: violationConfig.illAuthor ? 1 : 0
}
-
+
// 调用API更新违规设置
await bookBaseInfoApi.updateViolationConfig(params)
ElMessage.success('违规设置更新成功')
@@ -988,20 +948,20 @@ const handleUploadSuccess = (res, file) => {
// 处理提交表单
const handleSubmit = async () => {
if (!formRef.value) return
-
+
await formRef.value.validate(async (valid) => {
if (valid) {
submitLoading.value = true
-
+
try {
// 创建一个新对象用于提交
const submitData = JSON.parse(JSON.stringify(formData))
-
+
// 特殊处理价格 - 转换为分
if (submitData.fixPrice) {
submitData.fixPrice = Math.round(submitData.fixPrice * 100)
}
-
+
if (dialogType.value === 'add') {
await bookBaseInfoApi.addBookBaseInfo(submitData)
ElMessage.success('添加成功')
@@ -1009,7 +969,7 @@ const handleSubmit = async () => {
await bookBaseInfoApi.updateBookBaseInfo(submitData)
ElMessage.success('更新成功')
}
-
+
dialogVisible.value = false
fetchData()
} catch (error) {
@@ -1053,48 +1013,48 @@ const resetForm = () => {
// 判断是否有违规标记
const hasViolation = (row) => {
- return row.vioBook === 1 || row.bookSet === 1 || row.onenumMbooks === 1 ||
- row.illPublisher === 1 || row.illAuthor === 1
+ return row.vioBook === 1 || row.bookSet === 1 || row.onenumMbooks === 1 ||
+ row.illPublisher === 1 || row.illAuthor === 1
}
// 获取违规类型文本
const getViolationText = (row) => {
- const types = [];
- if (row.vioBook === 1) types.push('违规书号');
- if (row.bookSet === 1) types.push('套装书');
- if (row.onenumMbooks === 1) types.push('一号多书');
- if (row.illPublisher === 1) types.push('违规出版社');
- if (row.illAuthor === 1) types.push('违规作者');
- return types.join(',');
+ const types = [];
+ if (row.vioBook === 1) types.push('违规书号');
+ if (row.bookSet === 1) types.push('套装书');
+ if (row.onenumMbooks === 1) types.push('一号多书');
+ if (row.illPublisher === 1) types.push('违规出版社');
+ if (row.illAuthor === 1) types.push('违规作者');
+ return types.join(',');
}
// 图片获取函数
const getBookImageUrl = (row) => {
- if (!row.bookPic) return '';
-
- // 校验图片地址 - 同步实现
- const imageUrlOne = 'https://static.buzhiyushu.cn/images/';
- const imageUrlTwo = 'https://book.goods.img.buzhiyushu.cn/';
-
- // 直接返回拼接的图片URL,不再做存在性检查
- if (row.bookPic) {
- const image = imageUrlOne + row.bookPic;
- return image;
- } else if (row.bookName && row.isbn) {
- // 使用书名md5和isbn拼接备用URL
- const hashedTitle = md5(row.bookName);
- return imageUrlTwo + hashedTitle.charAt(0) + "/" + row.isbn + "_01.jpg";
- }
-
- return '';
+ if (!row.bookPic) return '';
+
+ // 校验图片地址 - 同步实现
+ const imageUrlOne = 'https://static.buzhiyushu.cn/images/';
+ const imageUrlTwo = 'https://book.goods.img.buzhiyushu.cn/';
+
+ // 直接返回拼接的图片URL,不再做存在性检查
+ if (row.bookPic) {
+ const image = row.bookPic;
+ return image;
+ } else if (row.bookName && row.isbn) {
+ // 使用书名md5和isbn拼接备用URL
+ const hashedTitle = md5(row.bookName);
+ return imageUrlTwo + hashedTitle.charAt(0) + "/" + row.isbn + "_01.jpg";
+ }
+
+ return '';
}
// 检测文本是否溢出
const isTextEllipsis = (event) => {
- if (!event || !event.target) return false
-
- const element = event.target
- return element.scrollWidth > element.offsetWidth
+ if (!event || !event.target) return false
+
+ const element = event.target
+ return element.scrollWidth > element.offsetWidth
}
@@ -1234,208 +1194,208 @@ const isTextEllipsis = (event) => {
/* 单行省略文本 */
.ellipsis-text {
- display: inline-block;
- width: 100%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
+ display: inline-block;
+ width: 100%;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
}
/* 表格样式 */
:deep(.el-table) {
- border-radius: 4px;
- overflow: hidden;
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
+ border-radius: 4px;
+ overflow: hidden;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
:deep(.el-table__body-wrapper) {
- overflow-y: auto;
- scrollbar-width: thin;
+ overflow-y: auto;
+ scrollbar-width: thin;
}
:deep(.el-table__body-wrapper::-webkit-scrollbar) {
- width: 6px;
- height: 6px;
+ width: 6px;
+ height: 6px;
}
:deep(.el-table__body-wrapper::-webkit-scrollbar-thumb) {
- border-radius: 3px;
- background: #c0c4cc;
+ border-radius: 3px;
+ background: #c0c4cc;
}
:deep(.el-table__body-wrapper::-webkit-scrollbar-track) {
- border-radius: 3px;
- background: #f5f7fa;
+ border-radius: 3px;
+ background: #f5f7fa;
}
:deep(.el-table--scrollable-y .el-table__body-wrapper) {
- overflow-y: auto;
+ overflow-y: auto;
}
:deep(.el-table th) {
- height: 40px;
- padding: 8px 0;
- font-weight: 500;
+ height: 40px;
+ padding: 8px 0;
+ font-weight: 500;
}
:deep(.el-table td) {
- padding: 8px;
- height: 50px;
+ padding: 8px;
+ height: 50px;
}
/* 无图片样式 */
.no-image {
- color: #909399;
- font-size: 12px;
+ color: #909399;
+ font-size: 12px;
}
/* 操作按钮样式 */
:deep(.el-button.is-text) {
- margin: 0 4px;
- padding: 0 6px;
+ margin: 0 4px;
+ padding: 0 6px;
}
/* 正常文本样式 */
.normal-text {
- color: #67C23A;
+ color: #67C23A;
}
/* 修改表格斑马纹颜色 */
:deep(.el-table--striped .el-table__body tr.el-table__row--striped td) {
- background-color: #fafafa;
+ background-color: #fafafa;
}
/* 适配图片布局 */
:deep(.el-table .cell) {
- padding: 0 8px;
+ padding: 0 8px;
}
/* 调整按钮区域 */
.action-bar {
- margin-bottom: 15px;
- background-color: #fff;
- padding: 10px;
- border-radius: 4px;
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
+ margin-bottom: 15px;
+ background-color: #fff;
+ padding: 10px;
+ border-radius: 4px;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
/* 分页容器样式 */
.pagination-container {
- margin-top: 15px;
- background-color: #fff;
- padding: 10px;
- border-radius: 4px;
- box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
+ margin-top: 15px;
+ background-color: #fff;
+ padding: 10px;
+ border-radius: 4px;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
/* 增加图片预览时的z-index确保在最顶层 */
:deep(.el-image-viewer__wrapper) {
- z-index: 2100 !important;
+ z-index: 2100 !important;
}
/* 销量详情弹出框样式 */
.sales-detail {
- padding: 5px 0;
+ padding: 5px 0;
}
.sales-item {
- display: flex;
- justify-content: space-between;
- margin: 4px 0;
- font-size: 13px;
+ display: flex;
+ justify-content: space-between;
+ margin: 4px 0;
+ font-size: 13px;
}
.sales-label {
- color: #606266;
- margin-right: 10px;
+ color: #606266;
+ margin-right: 10px;
}
.sales-trigger {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 5px;
- cursor: pointer;
- color: #409EFF;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 5px;
+ cursor: pointer;
+ color: #409EFF;
}
/* 为弹出框添加自定义样式 */
:deep(.sales-popover) {
- max-width: 220px;
- padding: 8px 12px;
- box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08);
+ max-width: 220px;
+ padding: 8px 12px;
+ box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08);
}
.disabled-uploader {
- background-color: #f5f7fa;
- cursor: not-allowed !important;
- color: #c0c4cc !important;
- border-color: #e4e7ed !important;
+ background-color: #f5f7fa;
+ cursor: not-allowed !important;
+ color: #c0c4cc !important;
+ border-color: #e4e7ed !important;
}
.disabled-uploader:hover {
- border-color: #e4e7ed !important;
+ border-color: #e4e7ed !important;
}
/* 编辑模式下的上传区域样式 */
:deep(.el-upload.is-disabled) {
- cursor: not-allowed;
+ cursor: not-allowed;
}
:deep(.el-upload.is-disabled:hover) {
- border-color: #e4e7ed !important;
+ border-color: #e4e7ed !important;
}
.edit-disabled-tip {
- font-size: 12px;
- color: #909399;
- margin-top: 5px;
+ font-size: 12px;
+ color: #909399;
+ margin-top: 5px;
}
/* 违规设置对话框样式 */
.violation-config {
- padding: 20px 0;
+ padding: 20px 0;
}
.violation-item {
- margin-bottom: 15px;
- display: flex;
- align-items: center;
+ margin-bottom: 15px;
+ display: flex;
+ align-items: center;
}
.violation-label {
- font-size: 14px;
- margin-left: 4px;
+ font-size: 14px;
+ margin-left: 4px;
}
:deep(.violation-dialog .el-dialog__header) {
- padding: 20px;
- margin: 0;
- border-bottom: 1px solid #f0f0f0;
- background-color: #f9f9f9;
+ padding: 20px;
+ margin: 0;
+ border-bottom: 1px solid #f0f0f0;
+ background-color: #f9f9f9;
}
:deep(.violation-dialog .el-dialog__body) {
- padding: 20px 25px;
+ padding: 20px 25px;
}
:deep(.violation-dialog .el-dialog__footer) {
- padding: 15px 20px;
- border-top: 1px solid #f0f0f0;
- background-color: #f9f9f9;
+ padding: 15px 20px;
+ border-top: 1px solid #f0f0f0;
+ background-color: #f9f9f9;
}
:deep(.violation-dialog .el-checkbox__inner) {
- border-color: #dcdfe6;
+ border-color: #dcdfe6;
}
:deep(.violation-dialog .el-checkbox__input.is-checked .el-checkbox__inner) {
- background-color: #409EFF;
- border-color: #409EFF;
+ background-color: #409EFF;
+ border-color: #409EFF;
}
:deep(.violation-dialog .el-checkbox__label) {
- font-weight: normal;
+ font-weight: normal;
}
/* 高级搜索相关样式 */
@@ -1454,4 +1414,4 @@ const isTextEllipsis = (event) => {
transform: rotate(180deg);
transition: transform 0.3s;
}
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/vite.config.mjs b/vite.config.mjs
index 0b8a53d..0c949fd 100644
--- a/vite.config.mjs
+++ b/vite.config.mjs
@@ -51,6 +51,14 @@ export default defineConfig({
rewrite: (path) => path.replace(/^\/api/,''),
// 如需处理WebSocket
ws: true
+ },
+ '/auth': {
+ target: 'https://api.buzhiyushu.cn',
+ // target: 'http://localhost:8080',
+ changeOrigin: true,
+ secure: true,
+ // 重写路径,保持 /auth 前缀
+ rewrite: (path) => path
}
}
}