diff --git a/order-app/src/pages/index/index.vue b/order-app/src/pages/index/index.vue index 3c9855c..4975cc9 100644 --- a/order-app/src/pages/index/index.vue +++ b/order-app/src/pages/index/index.vue @@ -91,12 +91,13 @@ flowList.value = res.data; } } - //跳转详情 + //跳转详情 - 修改后的函数 const toDetails = (item) => { console.log(item) - //在起始页面跳转到details.vue页面并传递参数 + // 对参数进行编码 + const encodedGoods = encodeURIComponent(JSON.stringify(item)) uni.navigateTo({ - url: '../detail/detail?goods=' + JSON.stringify(item) + url: '../detail/detail?goods=' + encodedGoods }); } onLoad(() => { diff --git a/order-system/src/compositions/comment/useCommentTable.ts b/order-system/src/compositions/comment/useCommentTable.ts index 3c31fb2..ce9a51d 100644 --- a/order-system/src/compositions/comment/useCommentTable.ts +++ b/order-system/src/compositions/comment/useCommentTable.ts @@ -1,65 +1,67 @@ import type { CommentListParm } from "../../api/comment/CommentModel"; -import { reactive ,ref,onMounted,nextTick} from "vue"; -import {getListApi,deleteApi} from '../../api/comment/index' +import { reactive, ref, onMounted, nextTick } from "vue"; +import { getListApi, deleteApi } from '../../api/comment/index' import useInstance from "@/hooks/useInstance"; import { ElMessage } from "element-plus"; -export default function useCommentTable(){ - const {global} = useInstance() +export default function useCommentTable() { + const { global } = useInstance() //表格高度 const tableHeight = ref(0) //接收表格数据 const tableList = ref([]) + //列表查询的参数 const listParm = reactive({ - currentPage:1, - pageSize:10, - total:0 + currentPage: 1, + pageSize: 10, + total: 0 }) //列表 - const getList = async()=>{ + const getList = async () => { let res = await getListApi(listParm) - if(res && res.code == 200){ + if (res && res.code == 200) { tableList.value = res.data.records; listParm.total = res.data.total; } } //删除 - const deleteBtn = async(commentId:string)=>{ + const deleteBtn = async (commentId: string) => { const confirm = await global.$myconfirm('确定删除吗?') - if(confirm){ + if (confirm) { let res = await deleteApi(commentId) - if(res && res.code == 200){ + if (res && res.code == 200) { ElMessage.success(res.msg) getList() } } } //搜索 - const searchBtn = ()=>{ + const searchBtn = () => { getList() } //重置 - const resetBtn = ()=>{ + const resetBtn = () => { listParm.currentPage = 1; getList() } //页容量改变时触发 - const sizeChange = (size:number)=>{ + const sizeChange = (size: number) => { listParm.pageSize = size; getList() } //页数改变触发 - const currentChange = (page:number)=>{ + const currentChange = (page: number) => { listParm.currentPage = page; getList() } - onMounted(()=>{ + onMounted(() => { getList() - nextTick(()=>{ + nextTick(() => { tableHeight.value = window.innerHeight - 180 }) }) - return{ + + return { listParm, getList, searchBtn, @@ -68,6 +70,6 @@ export default function useCommentTable(){ sizeChange, currentChange, tableHeight, - deleteBtn + deleteBtn, } } \ No newline at end of file diff --git a/order-system/src/compositions/order/useOrderTable.ts b/order-system/src/compositions/order/useOrderTable.ts index eae2e98..6c6cace 100644 --- a/order-system/src/compositions/order/useOrderTable.ts +++ b/order-system/src/compositions/order/useOrderTable.ts @@ -86,6 +86,7 @@ export default function useOrderTable() { tableHeight.value = window.innerHeight - 220 }) }) + return { tableList, sendOrder, diff --git a/order-system/src/views/comment/Index.vue b/order-system/src/views/comment/Index.vue index 61336fd..f784850 100644 --- a/order-system/src/views/comment/Index.vue +++ b/order-system/src/views/comment/Index.vue @@ -1,19 +1,30 @@