diff --git a/common/server/getReservationList.json b/common/server/getReservationList.json index b8b0a2d..b1f021d 100644 --- a/common/server/getReservationList.json +++ b/common/server/getReservationList.json @@ -4,7 +4,7 @@ "id": 7, "reservation_id": 3, "user_id": 3796, - "role": 1, + "role": 1, // 角色 1 发起者 0 参与者 "join_time": "2025/09/03 04:05:40", "status": 0, "userName": "闪光大帕鲁", @@ -13,11 +13,11 @@ } ], "id": 3, - "title": "测试1", + "title": "测试1", //祖居名称 "room_id": 3, - "room_name": "306小包间", - "start_time": "2025/09/13 21:09:43", - "end_time": "2025/09/13 21:34:43", + "room_name": "306小包间",// 房间名称 + "start_time": "2025/09/13 21:09:43", //开始时间 + "end_time": "2025/09/13 21:34:43",//结束时间 "duration_minutes": 25, "player_count": 4, "game_type": "扑克", diff --git a/common/server/index.js b/common/server/index.js index 65dafd0..2e265ce 100644 --- a/common/server/index.js +++ b/common/server/index.js @@ -74,28 +74,7 @@ const shouldUseCache = () => { export const getReservation = async (index = 1, size = 20) => { const res = await getReservationList(index, size); if (res != null && res.length > 0) { - // { - // id: '', - // status: '', - // description: '', - // time: '', - // room: '', - // requirements: '', - // personCount: 4, //总人数 - // joinPerson: [{ - // id: 1, - // name: '张三', - // avatar: '', - // phone: '', - // }], //已加入人 - // } - //[{"participants":[{"id":7,"reservation_id":3,"user_id":3796,"role":1,"join_time":"2025/09/03 04:05:40", - // "status":0,"userName":"闪光大帕鲁","avatarImage":"https://admin-1308826010.cos.ap-shanghai.myqcloud.com/ - // users20250908/20250908152502_6366.png","userBlackStatus":0}], - // "id":3,"title":"测试1","room_id":3,"room_name":"306小包间", - // "start_time":"2025/09/13 21:09:43","end_time":"2025/09/13 21:34:43", - // "duration_minutes":25,"player_count":4,"game_type":"扑克","game_rule":"跑得快", - // "extra_info":"11","is_smoking":1,"gender_limit":2,"credit_limit":0.0,"min_age":0,"max_age":0,"deposit_fee":0.00,"status":0,"created_at":"2025/09/03 00:21:16","updated_at":"2025/09/03 21:10:21","remarks":""}] + console.log("记录", res); var list = res.map(item => { let start_time = parseTimeString(item.start_time); @@ -127,6 +106,7 @@ export const getReservation = async (index = 1, size = 20) => { let requirements = requirementsList.join(","); return { id: item.id, + data: item, status: item.status, description: item.title, dateStr: formatTime(start_time, "yyyy-MM-dd"), @@ -150,6 +130,7 @@ export const getReservation = async (index = 1, size = 20) => { }); return list; + // return []; } return []; } diff --git a/common/server/interface/sq.js b/common/server/interface/sq.js index 0a12a79..4bd6989 100644 --- a/common/server/interface/sq.js +++ b/common/server/interface/sq.js @@ -9,7 +9,7 @@ import request from '@/common/system/request'; export const getReservationList = async (index = 1, size = 20) => { console.log('getReservationList', index, size); - const res = await request.get("sq/GetReservationList", { pageIndex: index, pageSize: size }); + const res = await request.getOrCache("sq/GetReservationList", { pageIndex: index, pageSize: size }, 5); if (res.code == 0) { return res.data; } diff --git a/common/utils.js b/common/utils.js index 299f28e..df26397 100644 --- a/common/utils.js +++ b/common/utils.js @@ -60,6 +60,33 @@ export function showModal(options = {}) { }); } +/** + * + * @param {String} title + * @param {String} content + * @returns + */ +export function showModalConfirm(title, content) { + return new Promise((resolve) => { + uni.showModal({ + title: title || '提示', + content: content || '', + confirmText: '确定', + cancelText: '取消', + showCancelButton: true, + showConfirmButton: true, + confirmColor: '#1989FA', + cancelColor: '#9F9F9F', + success: function (res) { + if (res.confirm) { + resolve(true); + } else if (res.cancel) { + resolve(false); + } + } + }); + }); +} /** * 显示提示信息 * @param {*} title 提示信息 diff --git a/components.d.ts b/components.d.ts index 00a4aca..75dbe14 100644 --- a/components.d.ts +++ b/components.d.ts @@ -11,6 +11,8 @@ declare module 'vue' { Container: typeof import('./components/com/page/container.vue')['default'] MahjongCard: typeof import('./components/index/MahjongCard.vue')['default'] NoData: typeof import('./components/com/page/no-data.vue')['default'] + NoEmpty: typeof import('./components/com/index/NoEmpty.vue')['default'] + ReservationPopup: typeof import('./components/com/index/ReservationPopup.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] UniNavBar: typeof import('./components/uni-nav-bar/uni-nav-bar.vue')['default'] diff --git a/components/com/index/NoEmpty.vue b/components/com/index/NoEmpty.vue new file mode 100644 index 0000000..f3b2f82 --- /dev/null +++ b/components/com/index/NoEmpty.vue @@ -0,0 +1,53 @@ + + + + + \ No newline at end of file diff --git a/components/com/index/ReservationPopup.vue b/components/com/index/ReservationPopup.vue new file mode 100644 index 0000000..4a9f364 --- /dev/null +++ b/components/com/index/ReservationPopup.vue @@ -0,0 +1,259 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue index de733a3..9c9ac5a 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -11,6 +11,9 @@ + - - - - - 预约信息 - - - - 发起者 - - 苏家辉 - - - 参与者 - - - - - - - - 黑名单 - - - - 树下的胖子 - - - - - - - - - - - 开始时间 - 2025/08/27 15:30 - - - 结束时间 - 2025/08/27 17:30 - - - 合计:2小时 - - - - - 房间号:304号-大包,30元/小时 - 人数:3人 - 玩法类型:扑克 - 具体规则:斗地主 - 补充信息:无 - - - - 是否禁烟:禁烟 - 性别:不限 - 信誉:≧4.0 - - - - 鸽子费:0元 - 组局成功后若有牌友未赴约,其鸽子费平均分给其他牌友。组局成功或失败后鸽子费将全额返还。 - - - - - 关闭 - - - 参与组局 - - - - + + - + @@ -185,6 +98,7 @@ import { } from 'vue' import zPaging from '@/uni_modules/z-paging/components/z-paging/z-paging.vue' import MahjongCard from '@/components/index/MahjongCard.vue' +import ReservationPopup from '@/components/com/index/ReservationPopup.vue' import { homeData, preloadHomeData, @@ -195,6 +109,7 @@ import { getConfigData, preloadConfigData } from '@/common/server/config' +import { userInfo, loadUserInfo } from '@/common/server/user' const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight); const getBackgroundImg = () => { return { @@ -217,8 +132,8 @@ const mockData = ref([]) // 模拟数据源 // 组件引用 const pagePaging = ref(null) -const cardInfo = ref(null) -const userInfo = ref(null) +const reservationPopup = ref(null) +const userInfo_popup = ref(null) // 初始化模拟数据 const initMockData = () => { @@ -277,20 +192,16 @@ const clearData = () => { } // 弹窗相关方法 -const openPop = () => { - cardInfo.value.open() -} - -const clasePop = () => { - cardInfo.value.close() +const openPop = (item) => { + reservationPopup.value.show(item.data) } const openUserPop = () => { - userInfo.value.open() + userInfo_popup.value.open() } const closeUserPop = () => { - userInfo.value.close() + userInfo_popup.value.close() } const onChange = (e) => { @@ -306,6 +217,8 @@ const handleJoin = (item) => { icon: 'success', duration: 1500 }) + // 关闭弹窗 + reservationPopup.value.close() } // 生命周期 @@ -317,6 +230,7 @@ onMounted(() => { onLoad(async () => { if (!homeData.value) preloadHomeData(); if (!configData.value) preloadConfigData(); + await loadUserInfo(); // initMockData(); // initMockData(); }); diff --git a/pages/me/login.vue b/pages/me/login.vue index e61a95d..32f50bf 100644 --- a/pages/me/login.vue +++ b/pages/me/login.vue @@ -1,58 +1,34 @@