diff --git a/README.md b/README.md index 7e8bdbc..d56f4cb 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,6 @@ 六维志愿小程序 -## 平台兼容性 - -| H5 | IOS | 安卓 | 微信小程序 | 字节小程序 | 快手小程序 | 支付宝小程序 | 钉钉小程序 | 百度小程序 | -| --- | --- | ---- | ---------- | ---------- | ---------- | ------------ | ---------- | ---------- | -| √ | √ | √ | √ | √ | √ | √ | √ | √ | - -注意每种 `UI框架` 支持的平台有所不同,详情请看各 `UI框架` 的官网,也可以看 `unibest` 文档。 - ## ⚙️ 环境 - node>=18 diff --git a/src/pages-sub/components/dragSort/DragSort.vue b/src/pages-sub/components/dragSort/DragSort.vue index 4d6e1b3..90e8e4d 100644 --- a/src/pages-sub/components/dragSort/DragSort.vue +++ b/src/pages-sub/components/dragSort/DragSort.vue @@ -330,55 +330,102 @@ const getPosition = (index: number, list = cloneList.value): [number, number] => } // 初始化 -const initList = (list: ItemType[] = [], changeheight: boolean = false) => { - const newList = deepCopy(list) - showList.value = newList.map((item, index) => { - const [x, y] = getPosition(index) - let data = { - ...item, - x, - y, - dropId: index + 1, - } - let key = 'slot' + Math.random() + index - // 如果x轴和y轴没变,那么不用更新key来刷新状态 - if (x === item?.x && y === item?.y) { - if (activeIndex.value !== index) { - // 非当前点击的下标和目标下标的下标不需要生成新的key - key = item.key +const initList = (list: ItemType[] = [], changeheight: boolean = false): Promise => { + return new Promise((resolve) => { + const newList = deepCopy(list) + // 给每个item添加一x,y和key + showList.value = newList.map((item, index) => { + const [x, y] = getPosition(index) + let data = { + ...item, + x, + y, + dropId: index + 1, } - } - data.key = key - return data - }) - cloneList.value = deepCopy(showList.value) - nextTick(() => { - showArea.value = true - }) - if (changeheight && props.itemHeight === 'auto') { - const query = uni.createSelectorQuery().in(instance.proxy) - query - .selectAll('.slotContent') - .boundingClientRect((data) => { - let domList = JSON.parse(JSON.stringify(data)) - let max = 0 - let _viewMaxHeight = 0 - for (let i = 0; i < domList.length; i++) { - let height = domList[i].height - if (isList.value) { - cloneList.value[i].height = height - } - _viewMaxHeight += height - if (height > max) { - max = height - } + let key = 'slot' + Math.random() + index + // 如果x轴和y轴没变,那么不用更新key来刷新状态 + if (x === item?.x && y === item?.y) { + if (activeIndex.value !== index) { + // 非当前点击的下标和目标下标的下标不需要生成新的key + key = item.key } - viewMaxHeight.value = _viewMaxHeight // 内容区域总高度 - itemMaxHeight.value = max + 'px' - initList(cloneList.value) - }) - .exec() - } + } + // 判断拖动位置的元素是那个 + data.key = key + return data + }) + cloneList.value = deepCopy(showList.value) + nextTick(() => { + showArea.value = true + }) + + if (changeheight && props.itemHeight === 'auto') { + // 获取到最高的item + setTimeout(async () => { + // #ifdef APP-NVUE + showArea.value = false + + const calculateHeights = async () => { + let max = 0 + let viewMaxHeightVal = 0 + + const promises = slotContent.value.map((content, index) => { + return new Promise((resolve) => { + dom.getComponentRect(content, (res: any) => { + let size = res.size + if (isList.value) { + cloneList.value[index].height = size.height + } + viewMaxHeightVal += size.height + if (size.height > max) { + max = size.height + } + resolve() + }) + }) + }) + + await Promise.all(promises) + viewMaxHeight.value = viewMaxHeightVal + itemMaxHeight.value = max + 'px' + nextTick(() => { + initList(cloneList.value).then(resolve) + }) + } + + await calculateHeights() + // #endif + + // #ifndef APP-NVUE + const query = uni.createSelectorQuery().in(instance.proxy) + query + .selectAll('.slotContent') + .boundingClientRect((data) => { + let domList = JSON.parse(JSON.stringify(data)) + let max = 0 + let viewMaxHeightVal = 0 + + for (let i = 0; i < domList.length; i++) { + let height = domList[i].height + if (isList.value) { + cloneList.value[i].height = height + } + viewMaxHeightVal += height + if (height > max) { + max = height + } + } + viewMaxHeight.value = viewMaxHeightVal // 内容区域总高度 + itemMaxHeight.value = max + 'px' + initList(cloneList.value).then(resolve) + }) + .exec() + // #endif + }, 0) + } else { + resolve() + } + }) } // 方法 diff --git a/src/pages-sub/home/wishesList/wishesList.vue b/src/pages-sub/home/wishesList/wishesList.vue index d4f5181..b4164fc 100644 --- a/src/pages-sub/home/wishesList/wishesList.vue +++ b/src/pages-sub/home/wishesList/wishesList.vue @@ -100,21 +100,23 @@ const handleMove = (index) => { myDrop.value.handleLongpress(index) } -const handleDelete = (index) => { +const handleDelete = async (index) => { // 如果新增或者删除了数据,请调用此函数 wishList.value.splice(index, 1) - myDrop.value.initList(wishList.value) + await myDrop.value.initList(wishList.value) } -const handleUpdateHeight = () => { +const handleUpdateHeight = async () => { // 调用 DragSort 组件的重新计算高度方法 - myDrop.value?.initList(wishList.value, true) + await myDrop.value?.initList(wishList.value, true) } const handleDeleteMajor = async (index, majorIndex) => { wishList.value[index].vItems.splice(majorIndex, 1) userStore.sortWishMajorList({ list: wishList.value[index].vItems, uIndex: index }) - myDrop.value?.initList(wishList.value, true) + myDrop.value?.initList(wishList.value, true).then(() => { + myDrop.value?.initList(wishList.value, true) + }) } const handleSave = () => { diff --git a/src/pages-sub/ucenter/appointment/appointment.vue b/src/pages-sub/ucenter/appointment/appointment.vue index 5f79024..2a1431e 100644 --- a/src/pages-sub/ucenter/appointment/appointment.vue +++ b/src/pages-sub/ucenter/appointment/appointment.vue @@ -7,43 +7,61 @@ + + diff --git a/src/service/index/api.ts b/src/service/index/api.ts index 95df800..e071eb8 100644 --- a/src/service/index/api.ts +++ b/src/service/index/api.ts @@ -384,3 +384,28 @@ export const saveBusScaleAnswer = (params: { }) => { return http.post('/api/busScale/CustomBusScale/v2', params) } + +export const getBusSpecialListGroup = (params?: { Code: number }) => { + return http.get('/api/busSpecialistGroup/list', params) +} + +export const addSpecial = (params: { + openId: string + sId: number + appointmentTime: string + isDelete?: boolean +}) => { + return http.post('/api/specialistReservation/add', params) +} + +export const getMySpecialList = (params: { openId: string }) => { + return http.get('/api/specialistReservation/reservation', params) +} + +export const getMyBusReports = (params: { CustomId: number }) => { + return http.get('/api/busScale/GetBusCustomReports', params) +} + +export const deleteMyAppointment = (params: { id: number }) => { + return http.post('/api/specialistReservation/delete', params) +}