公寓详情加收藏和附近学校

This commit is contained in:
A1300399510
2024-04-16 19:12:36 +08:00
parent 3f2f641be0
commit 5a4e6e79cd
8 changed files with 653 additions and 91 deletions

View File

@@ -50,6 +50,7 @@ import { useRoute, useRouter } from "vue-router"
import backToTop from "@/components/public/backToTop.vue"
import store from "../../store/index"
import api from "../../utils/api"
import { ElMessage } from "element-plus"
const { proxy } = getCurrentInstance()
@@ -214,13 +215,27 @@ const getMoreScroll = () => {
}
// 处理列表的点击收藏
const handlecollect = item => {
console.log("item", item)
const targetData = JSON.parse(JSON.stringify(list.value))
console.log("targetData", targetData);
targetData.forEach(element => {
console.log();
});
const handlecollect = uniqid => {
console.log("uniqid", uniqid)
let targetData = {}
let targetIndex = 0
let token = ""
list.value.forEach((element, index) => {
if (element.uniqid == uniqid) {
targetData = element
targetIndex = index
token = element.token || ""
}
})
api.apartmentCollection({ token }).then(res => {
if (res.code != 200) return
const data = res.data
console.log("data", data)
list.value[targetIndex]["iscollect"] = data.status
ElMessage.success(res.message)
})
}
</script>
<style lang="less" scoped>