diff --git a/components/ShowShopListItem/ShowShopListItem.vue b/components/ShowShopListItem/ShowShopListItem.vue index c7d1fcd..f2a2c1a 100644 --- a/components/ShowShopListItem/ShowShopListItem.vue +++ b/components/ShowShopListItem/ShowShopListItem.vue @@ -5,7 +5,7 @@ - + @@ -142,9 +142,22 @@ }, computed: { + }, + watch: { + shopInfo(newVal, oldVal) { + if (newVal.pics.includes(",")) { + this.leftImage = this.$api.imgUrl + newVal.pics.split(',')[0] + } else { + this.leftImage = this.$api.imgUrl + newVal.pics + } + } }, created() { - this.leftImage = this.$api.imgUrl + this.shopInfo.pics.split(',')[0] + if (this.shopInfo.pics.includes(",")) { + this.leftImage = this.$api.imgUrl + this.shopInfo.pics.split(',')[0] + } else { + this.leftImage = this.$api.imgUrl + this.shopInfo.pics + } }, methods: { handleEdit(shopid) { @@ -157,7 +170,7 @@ this.$emit('delItem', shopid) }, enterDetail() { - // console.log("进入详情页面"); + console.log("进入详情页面", this.shopInfo.id, this.shopInfo.type); const query = this.$u.queryParams({ id: this.shopInfo.id, type: this.shopInfo.type @@ -205,7 +218,8 @@ flex-direction: column; justify-content: space-between; - >text, >u-text { + >text, + >u-text { font-size: 14px; } diff --git a/pages/index/map/map.vue b/pages/index/map/map.vue index e3b429b..c1a75cd 100644 --- a/pages/index/map/map.vue +++ b/pages/index/map/map.vue @@ -118,21 +118,7 @@ // alpha: 1 // } ], - shopList: { - shopid: 1, - imageUrl: 'https://alifei01.cfp.cn/creative/vcg/800/new/VCG41175510742.jpg', - title: '琴行铺面转让', - promotionNum: 23, - price: 6000, - date: '2023-11-02', - pos: '锦江区', - exactPos: '锦江区-汇源南路366号', - sqr: 100, - zrfText: "转让费:20万", - category: '餐饮美食', - uname: "张先生", - phoneNum: 13348946108, - } + shopList: {} } }, onShow() { @@ -189,24 +175,10 @@ console.log('详情', res); const data = res.data.data if (res.data.code == 1) { - this.shopList = data - // { - // shopid: 1, - // pics: this.$api.imgUrl + data.pics, - // tt: data.tt, - // num: data.num, - // zujin: data.zujin, - // date: data.update_time, - // area1: data.area1, - // address: data.address, - // mianji: data.mianji, - // zhuanrangfei: "转让费:" + data.zhuanrangfei, - // trade: data.trade, - // lianxiren: data.lianxiren, - // mobile: data.mobile, - // } - // data.pics = [this.$api.imgUrl + data.pics] - // this.shopInfo = data + this.shopList = { + ...data, + id: id + } } }) },