diff --git a/src/views/carousel/index.vue b/src/views/carousel/index.vue index 4361361..2ca2102 100644 --- a/src/views/carousel/index.vue +++ b/src/views/carousel/index.vue @@ -1,7 +1,7 @@ @@ -152,6 +173,7 @@ const state = reactive({ fileList: [], name:"", path:"", + url: '', orderNum: "", loading: false }, @@ -193,18 +215,20 @@ const getTableData = async() => { }; // 重置 -const reset = () =>{ - state.tableData.param = { - name: '', - current: 1, - size: 10, - } - getTableData(); -} +// const reset = () =>{ +// state.tableData.param = { +// name: '', +// current: 1, +// size: 10, +// } +// getTableData(); +// } // 图片基本路径 const viteUrl = import.meta.env.VITE_API_URL; + + // 图片链接格式化 const jpgFormatter = (row: any) => { console.log("44444444444",row); @@ -221,7 +245,26 @@ const jpgFormatter = (row: any) => { newPath = newPath.includes('http://localhost:8888/') ? newPath : viteUrl + newPath console.log("22222222222222222",newPath); return `${newPath}`; -} + // window.open(newPath); +}; + +//轮播图跳转 +const jpgJump = (row:any) =>{ + // console.log("44444444444",row); + // let newPath; + // if (row?.data) { + // newPath = row.data.path.replaceAll('\\', '/') + // console.log("11111111111",newPath); + + // } else { + // newPath = row.path.replaceAll('\\\\', '/') + // console.log("333333333333",newPath); + + // } + // newPath = newPath.includes('http://localhost:8888/') ? newPath : viteUrl + newPath + // console.log("22222222222222222",newPath); + window.open(row.url); +}; // 日期格式化 const dateFormatter = (row: any, column: TableColumnCtx) => { @@ -230,16 +273,16 @@ const dateFormatter = (row: any, column: TableColumnCtx) => { } // 分页改变 -const onHandleSizeChange = (val: number) => { - state.tableData.param.size = val; - getTableData(); -}; +// const onHandleSizeChange = (val: number) => { +// state.tableData.param.size = val; +// getTableData(); +// }; -// 分页改变 -const onHandleCurrentChange = (val: number) => { - state.tableData.param.current = val; - getTableData(); -}; +// // 分页改变 +// const onHandleCurrentChange = (val: number) => { +// state.tableData.param.current = val; +// getTableData(); +// }; // #endregion // #region @@ -297,8 +340,8 @@ const handleChange: UploadProps['onChange'] = async (file: uploadFile, uploadFil console.log("result", res); console.log("state.formData", state.formData); if(res?.success){ - state.formData.url = jpgFormatter(res); - state.formData.path = jpgFormatter(res); + // state.formData.url = jpgFormatter(res); + state.formData.path = res.data.path; ElMessage({ message: '图片上传成功!', type: 'success', @@ -454,17 +497,73 @@ onMounted(() => {