From 55784e489dc4e98c45dd61975f757a6578c6c7b5 Mon Sep 17 00:00:00 2001 From: lifizer <913626195@qq.com> Date: Wed, 20 Mar 2024 11:14:57 +0800 Subject: [PATCH] =?UTF-8?q?Style(=E5=BA=97=E9=93=BA):=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/GooSkeleton/README.md | 62 +++ components/GooSkeleton/index.vue | 145 ++++++ pagesInn/inn/innHome.vue | 853 ++++++++++++++++--------------- 3 files changed, 653 insertions(+), 407 deletions(-) create mode 100644 components/GooSkeleton/README.md create mode 100644 components/GooSkeleton/index.vue diff --git a/components/GooSkeleton/README.md b/components/GooSkeleton/README.md new file mode 100644 index 0000000..140fff1 --- /dev/null +++ b/components/GooSkeleton/README.md @@ -0,0 +1,62 @@ +# skeleton +uni-app 骨架屏组件,用于数据加载时显示占位元素 + +## 属性说明 + +|属性名|类型|默认值|说明| +| -- | -- | --|--| +| loading | Boolean | true | 是否显示占位图 | +| showAvatar | Boolean | true | 是否显示头像占位图 | +| AvatarSize | String | 50px | 头像站占位图大小 | +| AvatarShape | String | round | 头像形状,可选值:round, square | +| showTitle | Boolean | true | 是否显示标题占位图 | +| titleWidth | String | 40% | 标题占位图宽度 | +| row | Number| 3 | 段落占位图行数 | +| animate | Boolean | true | 是否开启动画 | + +## 使用示例 + +```html + + 我是段落1 + +``` + +```javascript +import Skeleton from '../components/skeleton/index.vue' +export default { + components: { + Skeleton + }, + data() { + return { + loading: true, + skeleton1 : { + avatarSize: '52px', + row: 3, + showTitle: true, + } + } + }, + created() { + this.reloadData() + }, + methods: { + reloadData() { + this.loading = true + setTimeout(() => { + this.loading = false + }, 3000) + }, + }, +} +``` + +## 效果图 + +![](http://images.alisali.cn/img_20191014113211.png) diff --git a/components/GooSkeleton/index.vue b/components/GooSkeleton/index.vue new file mode 100644 index 0000000..a7e3669 --- /dev/null +++ b/components/GooSkeleton/index.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/pagesInn/inn/innHome.vue b/pagesInn/inn/innHome.vue index 2b84405..9592f8c 100644 --- a/pagesInn/inn/innHome.vue +++ b/pagesInn/inn/innHome.vue @@ -10,244 +10,321 @@ transparent="auto" color='#ffffff' /> - - - - - - - - {{ inn.name }} + + + + {{ inn.name }} + + + {{ inn.cityName }} + + + + + + + {{ inn.ownerName }}/店主 + + 保证金:{{ inn.guaranteeValue }}元 + + + + + + + + + + {{ favoriteCount }} + + + + + + + + + {{ inn.content }} + + + + + + + + + + + + + + {{ inn.address }} + + + + + 导航 + + + + 客服 + + + + + + + + {{ item.text }} + + + + + + + - {{ inn.cityName }} - - - - - - - {{ inn.ownerName }}/店主 - - 保证金:{{ inn.guaranteeValue }}元 - - - - - + + {{ item.storeName }} + + + ¥{{ item.price }} + - + - - {{ favoriteCount }} + {{ item.sales }}人已购买 - - - - - - {{ inn.content }} - - - - - - - - - - - - - - - {{ inn.address }} - - - - - 导航 - - - - 客服 - - - - - - - 企业文化 - - - - 最新资讯 - - - - 商家资质 - - - - 商品 - - - - - - - - - - - - - - - - - {{ info.monthDay }} - {{ info.year }} - - - - - - - - - - {{ info.name }} - - - - - - - - {{ info.pv }} + + + + + + + + {{ item.name }} + + + {{ item.intro }} + - - - {{ info.zan }} + + + + + + + + + + {{ item.createdTime ? item.createdTime.replace(/-/g, '.').substr(0, 10) : '' }} + + + + + {{ item.pv }} + + + + {{ item.zan }} + + + + + + + 置顶动态 + + + + 删除动态 + + + + - {{ info.time }} - - - - - - - - - - - - {{ item.storeName }} - - - ¥{{ item.price }} + + + + + + - - - {{ item.sales }}人已购买 + + + + + + + 发布动态 + + + + 修改资料 + - - 发布动态 - 修改资料 - + { const { success, data } = res if (success) { + that.isLoad = true that.inn = data that.isLike = data.zanVo !== null that.isFavorite = data.hasFavorite that.favoriteCount = data.favoriteCount that.inn.latitude = that.inn.latitude ? parseFloat(that.inn.latitude) : 24.993587 that.inn.longitude = that.inn.longitude ? parseFloat(that.inn.longitude) : 102.779656 + // 该店铺无商品则不显示“精选商品” + if (data.hasProduct <= 0) { + that.activeIndex = 1 + that.tabList[0].isShow = false + } // coverType: 1-图片,2-视频 if (data.coverType === 2) { uni.getSystemInfo({ @@ -773,6 +867,9 @@ export default { this.favoriteCount = res.data.favoriteCount } } + }, + toggleMoreHandle(index) { + this.$set(this.infoArray[index], 'showMore', !this.infoArray[index].showMore) } } } @@ -811,7 +908,9 @@ export default {