feat: 首页开发
This commit is contained in:
parent
a77fda44db
commit
34a861fc36
@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<view class="diy-banner"
|
||||
:style="{ padding: `${itemStyle.paddingTop * 2}rpx ${itemStyle.paddingLeft * 2}rpx`, background: itemStyle.background, height: `${imgHeights[swiperIndex]}px` }">
|
||||
:style="{ padding: `${itemStyle.paddingTop * 2}rpx ${itemStyle.paddingLeft * 2}rpx`, background: itemStyle.background, height: `${bannerHeight}px` }">
|
||||
<!-- 图片轮播 -->
|
||||
<swiper :autoplay="autoplay" class="swiper-box" :duration="duration" :circular="true" :interval="itemStyle.interval * 1000"
|
||||
@change="onChangeItem" :style="{ borderRadius: `${itemStyle.borderRadius * 2}rpx` }">
|
||||
<swiper-item class="swiper-item" v-for="(dataItem, index) in dataList" :key="index">
|
||||
<image mode="widthFix" class="slide-image" :src="dataItem.imgUrl" @click="onLink(dataItem.link)" @load="onLoadImage" />
|
||||
<image mode="widthFix" class="slide-image" :src="dataItem.imgUrl" @click="onLink(dataItem.link)" @load="onLoadImage($event, index)" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<!-- 指示点 -->
|
||||
@ -38,6 +38,18 @@
|
||||
swiperIndex: 0 // 当前banne所在滑块指针
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 计算banner容器高度
|
||||
bannerHeight() {
|
||||
// 如果已计算出当前图片的高度,使用计算出的高度
|
||||
if (this.imgHeights[this.swiperIndex]) {
|
||||
return this.imgHeights[this.swiperIndex]
|
||||
}
|
||||
// 否则使用默认高度(假设宽高比为2.5:1,这是常见的banner比例)
|
||||
const paddingLeft = (this.itemStyle.paddingLeft || 0) * 2
|
||||
return (this.windowWidth - paddingLeft) / 2.5
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const { windowWidth } = uni.getWindowInfo()
|
||||
this.windowWidth = windowWidth > 750 ? 750 : windowWidth
|
||||
@ -48,14 +60,14 @@
|
||||
},
|
||||
methods: {
|
||||
// 计算图片高度
|
||||
onLoadImage({ detail }) {
|
||||
onLoadImage({ detail }, index) {
|
||||
const app = this
|
||||
// 图片的宽高比
|
||||
const ratio = detail.width / detail.height
|
||||
// 计算容器高度值
|
||||
const viewHeight = (app.windowWidth - (app.itemStyle.paddingLeft * 2)) / ratio
|
||||
// 每张图片对应的容器高度
|
||||
app.imgHeights.push(viewHeight + (app.itemStyle.paddingTop * 2))
|
||||
const viewHeight = (app.windowWidth - (app.itemStyle.paddingLeft || 0) * 2) / ratio
|
||||
// 根据图片索引设置对应的高度(使用Vue.set确保响应式)
|
||||
this.$set(this.imgHeights, index, viewHeight + ((app.itemStyle.paddingTop || 0) * 2))
|
||||
},
|
||||
|
||||
// 记录当前指针
|
||||
|
||||
@ -6,24 +6,24 @@
|
||||
:style="{ padding: `${itemStyle.paddingY * 2}rpx ${itemStyle.paddingX * 2}rpx` }">
|
||||
<view class="goods-item" v-for="(dataItm, dataIdx) in dataList" :key="dataIdx" :class="[`display-${itemStyle.cardType}`]"
|
||||
:style="{ marginBottom: `${itemStyle.itemMargin * 2}rpx`, borderRadius: `${itemStyle.borderRadius * 2}rpx` }"
|
||||
@click="handleGoodsItem(dataItm.goods_id)">
|
||||
@click="handleGoodsItem(dataItm.id)">
|
||||
<!-- 单列商品 -->
|
||||
<template v-if="itemStyle.column === 1">
|
||||
<view class="flex">
|
||||
<view class="goods-item-left">
|
||||
<image class="image" :src="dataItm.goods_image"></image>
|
||||
<image class="image" :src="dataItm.mainImageUrl"></image>
|
||||
</view>
|
||||
<view class="goods-item-right">
|
||||
<view class="goods-info">
|
||||
<view v-if="inArray('goodsName', itemStyle.show)" class="goods-name"
|
||||
:class="[ itemStyle.goodsNameRows == 'two' ? 'twoline-hide' : 'oneline-hide', `row-${itemStyle.goodsNameRows}` ]">
|
||||
{{ dataItm.goods_name }}
|
||||
{{ dataItm.title }}
|
||||
</view>
|
||||
<view v-if="inArray('sellingPoint', itemStyle.show)" class="goods-selling">
|
||||
<text class="selling oneline-hide" :style="{ color: itemStyle.sellingColor }">{{ dataItm.selling_point }}</text>
|
||||
</view>
|
||||
<view v-if="inArray('goodsSales', itemStyle.show)" class="goods-sales oneline-hide">
|
||||
<text class="sales">已售{{ dataItm.goods_sales }}</text>
|
||||
<text class="sales">已售{{ dataItm.showSaleCount }}</text>
|
||||
<!-- <text class="line">|</text>
|
||||
<text>惊艳度100%</text>-->
|
||||
</view>
|
||||
@ -31,17 +31,17 @@
|
||||
<view class="goods-price oneline-hide" :style="{ color: itemStyle.priceColor }">
|
||||
<template v-if="inArray('goodsPrice', itemStyle.show)">
|
||||
<text class="unit">¥</text>
|
||||
<text class="value">{{ dataItm.goods_price_min }}</text>
|
||||
<text class="value">{{ dataItm.showPromotionPrice }}</text>
|
||||
<!-- <text class="unit2">到手价</text> -->
|
||||
</template>
|
||||
<text v-if="inArray('linePrice', itemStyle.show) && dataItm.line_price_min > 0" class="line-price">
|
||||
<text v-if="inArray('linePrice', itemStyle.show) && dataItm.showSalePrice > 0" class="line-price">
|
||||
<text class="unit">¥</text>
|
||||
<text class="value">{{ dataItm.line_price_min }}</text>
|
||||
<text class="value">{{ dataItm.showSalePrice }}</text>
|
||||
</text>
|
||||
</view>
|
||||
<view v-show="inArray('cartBtn', itemStyle.show) && itemStyle.column < 3" class="action">
|
||||
<view class="action">
|
||||
<view class="btn-cart" :style="{ color: itemStyle.btnCartColor }" @click.stop="handleAddCart(dataItm)">
|
||||
<text class="cart-icon iconfont" :class="[`icon-jiagou${itemStyle.btnCartStyle}`]"></text>
|
||||
<text class="cart-icon iconfont" :class="[`icon-jiagou${itemStyle.btnCartStyle || 1}`]"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -52,18 +52,18 @@
|
||||
<!-- 两列/三列 -->
|
||||
<template v-else>
|
||||
<view class="goods-image">
|
||||
<image class="image" mode="aspectFill" :src="dataItm.goods_image"></image>
|
||||
<image class="image" mode="aspectFill" :src="dataItm.mainImageUrl"></image>
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
<view v-if="inArray('goodsName', itemStyle.show)" class="goods-name"
|
||||
:class="[ itemStyle.goodsNameRows == 'two' ? 'twoline-hide' : 'oneline-hide', `row-${itemStyle.goodsNameRows}` ]">
|
||||
{{ dataItm.goods_name }}
|
||||
{{ dataItm.title }}
|
||||
</view>
|
||||
<view v-if="inArray('sellingPoint', itemStyle.show)" class="goods-selling">
|
||||
<text class="selling oneline-hide" :style="{ color: itemStyle.sellingColor }">{{ dataItm.selling_point }}</text>
|
||||
</view>
|
||||
<view v-if="inArray('goodsSales', itemStyle.show)" class="goods-sales oneline-hide">
|
||||
<text class="sales">已售{{ dataItm.goods_sales }}</text>
|
||||
<text class="sales">已售{{ dataItm.showSaleCount }}</text>
|
||||
<!-- <text class="line">|</text>
|
||||
<text>惊艳度100%</text>-->
|
||||
</view>
|
||||
@ -71,16 +71,16 @@
|
||||
<view v-if="inArray('goodsPrice', itemStyle.show)" class="goods-price oneline-hide"
|
||||
:style="{ color: itemStyle.priceColor }">
|
||||
<text class="unit">¥</text>
|
||||
<text class="value">{{ dataItm.goods_price_min }}</text>
|
||||
<text class="value">{{ dataItm.showPromotionPrice }}</text>
|
||||
<!-- <text class="unit2">到手价</text> -->
|
||||
<text v-if="inArray('linePrice', itemStyle.show) && dataItm.line_price_min > 0" class="line-price">
|
||||
<text v-if="inArray('linePrice', itemStyle.show) && dataItm.showSalePrice > 0" class="line-price">
|
||||
<text class="unit">¥</text>
|
||||
<text class="value">{{ dataItm.line_price_min }}</text>
|
||||
<text class="value">{{ dataItm.showSalePrice }}</text>
|
||||
</text>
|
||||
</view>
|
||||
<view v-show="inArray('cartBtn', itemStyle.show) && itemStyle.column < 3" class="action">
|
||||
<view class="action">
|
||||
<view class="btn-cart" :style="{ color: itemStyle.btnCartColor }" @click.stop="handleAddCart(dataItm)">
|
||||
<text class="cart-icon iconfont" :class="[`icon-jiagou${itemStyle.btnCartStyle}`]"></text>
|
||||
<text class="cart-icon iconfont" :class="[`icon-jiagou${itemStyle.btnCartStyle || 1}`]"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<!-- 单图组 -->
|
||||
<view class="diy-imageSingle"
|
||||
:style="{ padding: `${itemStyle.paddingTop * 2}rpx ${itemStyle.paddingLeft * 2}rpx`, background: itemStyle.background }">
|
||||
:style="{ padding: `${imageStyle.paddingTop * 2}rpx ${itemStyle.paddingLeft * 2}rpx`, background: itemStyle.background }">
|
||||
<view class="item-image" v-for="(dataItem, index) in dataList" :key="index"
|
||||
:style="{ marginBottom: `${itemStyle.itemMargin * 2}rpx`, borderRadius: `${itemStyle.borderRadius * 2}rpx` }">
|
||||
<view class="nav-to" @click="onLink(dataItem.link)">
|
||||
@ -16,14 +16,19 @@
|
||||
|
||||
export default {
|
||||
props: {
|
||||
itemIndex: String,
|
||||
itemStyle: Object,
|
||||
params: Object,
|
||||
dataList: Array
|
||||
dataList: Array,
|
||||
imageStyle: Object
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
itemStyle: {
|
||||
"paddingLeft": 0,
|
||||
"background": "#ffffff"
|
||||
},
|
||||
}
|
||||
},
|
||||
mixins: [mixin],
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
<template>
|
||||
<!-- 搜索框 -->
|
||||
<view class="diy-search" :class="{ sticky: params.sticky }"
|
||||
:style="{ background: itemStyle.background, padding: `${itemStyle.paddingY * 2}rpx ${itemStyle.paddingX * 2}rpx` }">
|
||||
<view class="inner" :class="itemStyle.searchStyle" @click="onTargetSearch">
|
||||
<view class="diy-search" :class="style.sticky">
|
||||
<view class="inner" :class="style.searchStyle" @click="onTargetSearch">
|
||||
<view class="search-input"
|
||||
:style="{ textAlign: itemStyle.textAlign, background: itemStyle.searchBg, color: itemStyle.searchFontColor }">
|
||||
:style="{ textAlign: style.textAlign }">
|
||||
<text class="search-icon iconfont icon-search"></text>
|
||||
<text> {{ params.placeholder }}</text>
|
||||
<text>请输入关键字进行搜索</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -14,32 +13,20 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
* 用于组件自定义设置
|
||||
*/
|
||||
props: {
|
||||
itemIndex: String,
|
||||
itemStyle: Object,
|
||||
params: Object
|
||||
data() {
|
||||
return {
|
||||
style: {
|
||||
sticky: true,
|
||||
searchStyle: 'round',
|
||||
textAlign: 'left',
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
* 更新属性和数据的方法与更新页面数据的方法类似
|
||||
*/
|
||||
methods: {
|
||||
|
||||
/**
|
||||
* 跳转到搜索页面
|
||||
*/
|
||||
onTargetSearch() {
|
||||
this.$navTo('pages/search/index')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -1,30 +1,27 @@
|
||||
<template>
|
||||
<view class="page-items">
|
||||
<Search />
|
||||
<block v-for="(item, index) in items" :key="index">
|
||||
<!-- 搜索框 -->
|
||||
<block v-if="item.type === 'search'">
|
||||
<Search :itemStyle="item.style" :params="item.params" />
|
||||
</block>
|
||||
<!-- 图片组 -->
|
||||
<block v-if="item.type === 'image'">
|
||||
<Images :itemStyle="item.style" :params="item.params" :dataList="item.data" />
|
||||
<Images :dataList="item.data" :imageStyle="item.style" />
|
||||
</block>
|
||||
<!-- 轮播图 -->
|
||||
<block v-if="item.type === 'banner'">
|
||||
<Banner :itemStyle="item.style" :params="item.params" :dataList="item.data" />
|
||||
</block>
|
||||
<!-- 图片橱窗 -->
|
||||
<block v-if="item.type === 'window'">
|
||||
<!-- <block v-if="item.type === 'window'">
|
||||
<Window :itemStyle="item.style" :params="item.params" :dataList="item.data" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 视频组 -->
|
||||
<block v-if="item.type === 'video'">
|
||||
<!-- <block v-if="item.type === 'video'">
|
||||
<Videos :itemStyle="item.style" :params="item.params" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 文章组 -->
|
||||
<block v-if="item.type === 'article'">
|
||||
<!-- <block v-if="item.type === 'article'">
|
||||
<Article :params="item.params" :dataList="item.data" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 店铺公告 -->
|
||||
<block v-if="item.type === 'notice'">
|
||||
<Notice :itemStyle="item.style" :params="item.params" />
|
||||
@ -38,45 +35,45 @@
|
||||
<Goods :itemStyle="item.style" :params="item.params" :dataList="item.data" />
|
||||
</block>
|
||||
<!-- 在线客服 -->
|
||||
<block v-if="item.type === 'service'">
|
||||
<!-- <block v-if="item.type === 'service'">
|
||||
<Service :itemStyle="item.style" :params="item.params" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 辅助空白 -->
|
||||
<block v-if="item.type === 'blank'">
|
||||
<!-- <block v-if="item.type === 'blank'">
|
||||
<Blank :itemStyle="item.style" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 辅助线 -->
|
||||
<block v-if="item.type === 'guide'">
|
||||
<!-- <block v-if="item.type === 'guide'">
|
||||
<Guide :itemStyle="item.style" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 富文本 -->
|
||||
<block v-if="item.type === 'richText'">
|
||||
<!-- <block v-if="item.type === 'richText'">
|
||||
<RichText :itemStyle="item.style" :params="item.params" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 头条快报 -->
|
||||
<block v-if="item.type === 'special'">
|
||||
<!-- <block v-if="item.type === 'special'">
|
||||
<Special :itemStyle="item.style" :params="item.params" :dataList="item.data" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 关注公众号 -->
|
||||
<block v-if="item.type === 'officialAccount'">
|
||||
<!-- <block v-if="item.type === 'officialAccount'">
|
||||
<DiyOfficialAccount />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 优惠券 -->
|
||||
<block v-if="item.type === 'coupon'">
|
||||
<!-- <block v-if="item.type === 'coupon'">
|
||||
<Coupon :itemStyle="item.style" :params="item.params" :dataList="item.data" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 图片组 -->
|
||||
<block v-if="item.type === 'hotZone'">
|
||||
<!-- <block v-if="item.type === 'hotZone'">
|
||||
<HotZone :itemStyle="item.style" :params="item.params" :data="item.data" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 备案号 -->
|
||||
<block v-if="item.type === 'ICPLicense'">
|
||||
<!-- <block v-if="item.type === 'ICPLicense'">
|
||||
<ICPLicense :itemStyle="item.style" :params="item.params" />
|
||||
</block>
|
||||
</block> -->
|
||||
<!-- 文字标题 -->
|
||||
<block v-if="item.type === 'title'">
|
||||
<!-- <block v-if="item.type === 'title'">
|
||||
<Title :itemStyle="item.style" :params="item.params" />
|
||||
</block>
|
||||
</block> -->
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -10,127 +10,108 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { setCartTabBadge } from '@/core/app'
|
||||
import * as Api from '@/api/page'
|
||||
import Page from '@/components/page'
|
||||
import PrivacyPopup from '@/components/privacy-popup'
|
||||
import { setCartTabBadge } from "@/core/app";
|
||||
import Page from "@/components/page";
|
||||
import PrivacyPopup from "@/components/privacy-popup";
|
||||
import mockData from "./mock-data";
|
||||
import { apiGetCommodityList } from "@/api/goods";
|
||||
|
||||
const App = getApp()
|
||||
const App = getApp();
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Page,
|
||||
PrivacyPopup
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 页面参数
|
||||
options: {},
|
||||
// 页面属性
|
||||
page: {},
|
||||
// 页面元素
|
||||
items: []
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
// 当前页面参数
|
||||
this.options = options
|
||||
// 加载页面数据
|
||||
this.getPageData()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 更新购物车角标
|
||||
setCartTabBadge()
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
/**
|
||||
* 加载页面数据
|
||||
* @param {Object} callback
|
||||
*/
|
||||
getPageData(callback) {
|
||||
const app = this
|
||||
const pageId = app.options.pageId || 0
|
||||
Api.detail(pageId)
|
||||
.then(result => {
|
||||
// 设置页面数据
|
||||
const { data: { pageData } } = result
|
||||
app.page = pageData.page
|
||||
app.items = pageData.items
|
||||
// 设置顶部导航栏栏
|
||||
app.setPageBar()
|
||||
})
|
||||
.finally(() => callback && callback())
|
||||
export default {
|
||||
components: {
|
||||
Page,
|
||||
PrivacyPopup,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
page: {
|
||||
title: "购de着商城",
|
||||
name: "商城首页",
|
||||
shareTitle: "购de着商城",
|
||||
style: { titleTextColor: "#000000", titleBackgroundColor: "#ffffff" },
|
||||
},
|
||||
|
||||
/**
|
||||
* 设置顶部导航栏
|
||||
*/
|
||||
setPageBar() {
|
||||
const { page } = this
|
||||
// 设置页面标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: page.params.title
|
||||
items: [],
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.getPageData();
|
||||
},
|
||||
onShow() {
|
||||
setCartTabBadge(); // 更新购物车角标
|
||||
},
|
||||
methods: {
|
||||
async getPageData(callback) {
|
||||
const app = this;
|
||||
app.setPageBar()
|
||||
console.warn('----- my data is 22: ', 22)
|
||||
app.items = await this.handleGetHomeData().finally(() => callback && callback());
|
||||
},
|
||||
async handleGetHomeData() {
|
||||
console.warn('----- my data is 33: ', 33)
|
||||
const res = await apiGetCommodityList({});
|
||||
console.warn('----- my data is res.data: ', res.data)
|
||||
return mockData.map(item => {
|
||||
if (item.type === 'goods') {
|
||||
item.data = res.data.rows
|
||||
}
|
||||
return item
|
||||
})
|
||||
// 设置navbar标题、颜色
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: page.style.titleTextColor === 'white' ? '#ffffff' : '#000000',
|
||||
backgroundColor: page.style.titleBackgroundColor
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 下拉刷新
|
||||
* 设置顶部导航栏
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取首页数据
|
||||
this.getPageData(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
setPageBar() {
|
||||
const { page } = this;
|
||||
// 设置页面标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: page.title,
|
||||
});
|
||||
// 设置navbar标题、颜色
|
||||
uni.setNavigationBarColor({
|
||||
frontColor: page.style.titleTextColor,
|
||||
backgroundColor: page.style.titleBackgroundColor,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 分享当前页面
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
const app = this
|
||||
const { page } = app
|
||||
return {
|
||||
title: page.params.shareTitle,
|
||||
path: "/pages/index/index?" + app.$getShareUrlParams()
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 分享到朋友圈
|
||||
* 本接口为 Beta 版本,暂只在 Android 平台支持,详见分享到朋友圈 (Beta)
|
||||
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
|
||||
*/
|
||||
onShareTimeline() {
|
||||
const app = this
|
||||
const { page } = app
|
||||
return {
|
||||
title: page.params.shareTitle,
|
||||
path: "/pages/index/index?" + app.$getShareUrlParams()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 下拉刷新
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取首页数据
|
||||
this.getPageData(() => {
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 分享当前页面
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
const app = this;
|
||||
const { page } = app;
|
||||
return {
|
||||
title: page.shareTitle,
|
||||
path: "/pages/index/index?" + app.$getShareUrlParams(),
|
||||
};
|
||||
},
|
||||
/**
|
||||
* 分享到朋友圈
|
||||
* 本接口为 Beta 版本,暂只在 Android 平台支持,详见分享到朋友圈 (Beta)
|
||||
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
|
||||
*/
|
||||
onShareTimeline() {
|
||||
const app = this;
|
||||
const { page } = app;
|
||||
return {
|
||||
title: page.shareTitle,
|
||||
path: "/pages/index/index?" + app.$getShareUrlParams(),
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
.container {
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
491
pages/index/mock-data.js
Normal file
491
pages/index/mock-data.js
Normal file
@ -0,0 +1,491 @@
|
||||
export default [
|
||||
{
|
||||
"name": "图片轮播",
|
||||
"type": "banner",
|
||||
"style": {
|
||||
"btnColor": "#d5a988",
|
||||
"btnShape": "round",
|
||||
"interval": 20
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"imgUrl": "https://heyuimage.ihzhy.com/prd/202512/3d307a19be1a539a.png",
|
||||
"link": {
|
||||
"title": "商品详情页",
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"path": "pages/goods/detail",
|
||||
"query": {
|
||||
"goodsId": "73"
|
||||
}
|
||||
},
|
||||
},
|
||||
"imgName": "banner02.png"
|
||||
},
|
||||
{
|
||||
"imgUrl": "https://heyuimage.ihzhy.com/prd/202512/4507a08c19520bfb.png",
|
||||
"link": null,
|
||||
"imgName": "未标题-1.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "店铺公告",
|
||||
"type": "notice",
|
||||
"params": {
|
||||
"text": "购de着商城致力于通过产品和服务,服务买家",
|
||||
"link": null,
|
||||
"showIcon": true,
|
||||
"scrollable": true
|
||||
},
|
||||
"style": {
|
||||
"paddingTop": 1,
|
||||
"background": "#fffbe8",
|
||||
"textColor": "#de8c17"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "类目组",
|
||||
"type": "navBar",
|
||||
"style": {
|
||||
"rowsNum": 4,
|
||||
"background": "#ffffff",
|
||||
"paddingTop": 3,
|
||||
"textColor": "#666666"
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"imgUrl": "https://heyuimage.ihzhy.com/prd/202512/f377422a4bf2982c.png",
|
||||
"imgName": "icon-2.jpg",
|
||||
"link": {
|
||||
"title": "商品列表页",
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"path": "pages/goods/list",
|
||||
"query": {
|
||||
"categoryId": "10085",
|
||||
"search": ""
|
||||
}
|
||||
},
|
||||
},
|
||||
"text": "发饰饰品"
|
||||
},
|
||||
{
|
||||
"imgUrl": "https://heyuimage.ihzhy.com/prd/202512/a29b7b8d2c94a6c5.png",
|
||||
"imgName": "icon-3.jpg",
|
||||
"link": {
|
||||
"title": "商品列表页",
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"path": "pages/goods/list",
|
||||
"query": {
|
||||
"categoryId": "10001",
|
||||
"search": ""
|
||||
}
|
||||
},
|
||||
},
|
||||
"text": "颈部饰品"
|
||||
},
|
||||
{
|
||||
"imgUrl": "https://heyuimage.ihzhy.com/prd/202512/076083dffbf723e3.png",
|
||||
"imgName": "icon-1.png",
|
||||
"link": {
|
||||
"title": "领券中心",
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"path": "pages/coupon/index"
|
||||
}
|
||||
},
|
||||
"text": "耳部饰品"
|
||||
},
|
||||
{
|
||||
"imgUrl": "https://heyuimage.ihzhy.com/prd/202512/d60d74363bdd1e6e.png",
|
||||
"imgName": "icon-4.jpg",
|
||||
"link": {
|
||||
"title": "商品列表页",
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"path": "pages/goods/list",
|
||||
"query": {
|
||||
"categoryId": "10088",
|
||||
"search": ""
|
||||
}
|
||||
},
|
||||
},
|
||||
"text": "手部饰品"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "分类下的banner",
|
||||
"type": "image",
|
||||
"style": { "paddingTop": 3 },
|
||||
"data": [
|
||||
{
|
||||
"imgUrl": "https://heyuimage.ihzhy.com/prd/202512/0cb3ac1d31d2795d.png",
|
||||
"imgName": "店长推荐标题",
|
||||
"link": {
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"title": "商品列表页",
|
||||
"path": "pages/goods/list",
|
||||
"query": {
|
||||
"categoryId": "10085"
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
"imgUrl": "https://heyuimage.ihzhy.com/prd/202512/f320e4ab3b6f1b59.png",
|
||||
"imgName": "一张banner海报",
|
||||
"link": {
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"title": "商品列表页",
|
||||
"path": "pages/goods/list",
|
||||
"query": {
|
||||
"categoryId": "10085"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
/* {
|
||||
"name": "纯展示图片、不跳转",
|
||||
"type": "image",
|
||||
"style": { "paddingTop": 2 },
|
||||
"data": [
|
||||
{
|
||||
"imgUrl": "http://static.yoshop.xany6.com/10001/20210314/0607338b08e9845b6db6b90d83da0f58.png",
|
||||
"imgName": "纯banner图片",
|
||||
"link": null
|
||||
}
|
||||
]
|
||||
}, */
|
||||
/* {
|
||||
"name": "图片",
|
||||
"type": "image",
|
||||
"style": {
|
||||
"paddingTop": 0,
|
||||
"paddingLeft": 0,
|
||||
"background": "#ffffff"
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"imgUrl": "http://static.yoshop.xany6.com/10001/20210314/d16e7e7bd8735e4bf04cc5a463c65016.png",
|
||||
"imgName": "华为.png",
|
||||
"link": {
|
||||
"id": "995bf1c",
|
||||
"title": "商品列表页",
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"path": "pages/goods/list",
|
||||
"query": {
|
||||
"categoryId": "10011"
|
||||
}
|
||||
},
|
||||
"form": [
|
||||
{
|
||||
"key": "query.categoryId",
|
||||
"lable": "分类ID",
|
||||
"tips": "商品管理 -> 商品分类",
|
||||
"value": "10011"
|
||||
},
|
||||
{
|
||||
"key": "query.search",
|
||||
"lable": "关键词",
|
||||
"tips": "搜索的关键词,用于匹配商品名称",
|
||||
"value": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}, */
|
||||
/* {
|
||||
"name": "图片橱窗",
|
||||
"type": "window",
|
||||
"style": {
|
||||
"paddingTop": 0,
|
||||
"paddingLeft": 0,
|
||||
"background": "#ffffff",
|
||||
"layout": 2
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"imgUrl": "http://static.yoshop.xany6.com/10001/20210314/6e25a66132754fe4cad0ae88b7a8544c.png",
|
||||
"link": {
|
||||
"id": "995bf1c",
|
||||
"title": "商品列表页",
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"path": "pages/goods/list",
|
||||
"query": {
|
||||
"categoryId": "10010"
|
||||
}
|
||||
},
|
||||
"form": [
|
||||
{
|
||||
"key": "query.categoryId",
|
||||
"lable": "分类ID",
|
||||
"tips": "商品管理 -> 商品分类",
|
||||
"value": "10010"
|
||||
},
|
||||
{
|
||||
"key": "query.search",
|
||||
"lable": "关键词",
|
||||
"tips": "搜索的关键词,用于匹配商品名称",
|
||||
"value": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"imgName": "小米.png"
|
||||
},
|
||||
{
|
||||
"imgUrl": "http://static.yoshop.xany6.com/10001/20210314/e4d48985f825c73f82ad9690424e1db1.png",
|
||||
"link": {
|
||||
"id": "995bf1c",
|
||||
"title": "商品列表页",
|
||||
"type": "PAGE",
|
||||
"param": {
|
||||
"path": "pages/goods/list",
|
||||
"query": {
|
||||
"categoryId": "10012"
|
||||
}
|
||||
},
|
||||
"form": [
|
||||
{
|
||||
"key": "query.categoryId",
|
||||
"lable": "分类ID",
|
||||
"tips": "商品管理 -> 商品分类",
|
||||
"value": "10012"
|
||||
},
|
||||
{
|
||||
"key": "query.search",
|
||||
"lable": "关键词",
|
||||
"tips": "搜索的关键词,用于匹配商品名称",
|
||||
"value": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"imgName": "苹果.png"
|
||||
}
|
||||
],
|
||||
"dataNum": 4
|
||||
}, */
|
||||
{
|
||||
"name": "标题图",
|
||||
"type": "image",
|
||||
"style": { "paddingTop": 1 },
|
||||
"data": [
|
||||
{
|
||||
"imgUrl": "https://heyuimage.ihzhy.com/prd/202512/af6e66a900c83789.png",
|
||||
"imgName": "标题图片",
|
||||
"link": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "商品组",
|
||||
"type": "goods",
|
||||
"params": {
|
||||
"source": "auto",
|
||||
"auto": {
|
||||
"category": 0,
|
||||
"goodsSort": "all",
|
||||
"showNum": 40
|
||||
}
|
||||
},
|
||||
"style": {
|
||||
"background": "#F6F6F6",
|
||||
"display": "list",
|
||||
"column": 2,
|
||||
"show": [
|
||||
"goodsName",
|
||||
"goodsPrice",
|
||||
"linePrice",
|
||||
"sellingPoint",
|
||||
"goodsSales"
|
||||
]
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"goods_id": 10022,
|
||||
"goods_name": "测试商品【不发货】",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/10001/20210316/5c37d15bdbaaf8a7d8d4f96b1ecce89c.jpg",
|
||||
"goods_price_min": "1.00",
|
||||
"goods_price_max": "1.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 11
|
||||
},
|
||||
{
|
||||
"goods_id": 10020,
|
||||
"goods_name": "耐克 男子 NIKE AIR FORCE 1'07 运动鞋",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/10001/20210315/b72822760ccc4bb892cc658b33af939e.jpg",
|
||||
"goods_price_min": "749.00",
|
||||
"goods_price_max": "749.00",
|
||||
"line_price_min": "799.00",
|
||||
"line_price_max": "799.00",
|
||||
"goods_sales": 17
|
||||
},
|
||||
{
|
||||
"goods_id": 10019,
|
||||
"goods_name": "清野の木 56L灰色特大号 塑料收纳箱整理箱环保加厚储物箱",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/10001/20210314/2a6e0c0ea7d1e5f0f2ac3e406198850c.jpg",
|
||||
"goods_price_min": "32.80",
|
||||
"goods_price_max": "32.80",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 174
|
||||
},
|
||||
{
|
||||
"goods_id": 10018,
|
||||
"goods_name": "简约风条纹客厅沙发卧室床头抱枕靠垫套",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/10001/20210316/41cdb778199f99ebebb6090680f382fc.png",
|
||||
"goods_price_min": "99.00",
|
||||
"goods_price_max": "99.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 137
|
||||
},
|
||||
{
|
||||
"goods_id": 10017,
|
||||
"goods_name": "三星 Galaxy S21 5G(SM-G9910)双模5G 骁龙888 超高清专业摄像 120Hz护目屏 游戏手机 8G+128G",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/10001/20210313/b51b4840c24250a67210d59e345e206d.jpg",
|
||||
"goods_price_min": "4969.00",
|
||||
"goods_price_max": "4969.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
},
|
||||
{
|
||||
"goods_id": 10016,
|
||||
"goods_name": "【舒尔健动感单车】大型健身器械 减肥神器",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/20190610131953961df5569.PNG",
|
||||
"goods_price_min": "1556.00",
|
||||
"goods_price_max": "1556.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 33
|
||||
},
|
||||
{
|
||||
"goods_id": 10015,
|
||||
"goods_name": "荣耀 V10全网通 标配版 4GB+64GB 魅丽红 移动联通电信4G全面屏手机 双卡双待",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/2018071718294208f086786.jpg",
|
||||
"goods_price_min": "1899.00",
|
||||
"goods_price_max": "2199.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
},
|
||||
{
|
||||
"goods_id": 10014,
|
||||
"goods_name": "三星 Galaxy S9+(SM-G9650/DS)6GB+128GB 谜夜黑 移动联通电信4G 游戏手机 双卡双待",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/20180717182009cb6bf4951.jpg",
|
||||
"goods_price_min": "6999.00",
|
||||
"goods_price_max": "7199.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
},
|
||||
{
|
||||
"goods_id": 10013,
|
||||
"goods_name": "OPPO R15 直降300◆星云版新品手机 6G+128G R15梦境版 A3同款 R11S升级版 星云版 6+128G 官方标配",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/2018071718130695f254464.jpg",
|
||||
"goods_price_min": "2699.00",
|
||||
"goods_price_max": "2799.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
},
|
||||
{
|
||||
"goods_id": 10012,
|
||||
"goods_name": "vivo Z1 新一代全面屏 双摄拍照手机 移动联通电信4G 双卡双待 6GB+128GB 瓷釉黑",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/20180717180357119b95367.jpg",
|
||||
"goods_price_min": "2198.00",
|
||||
"goods_price_max": "2198.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
},
|
||||
{
|
||||
"goods_id": 10011,
|
||||
"goods_name": "Apple iPhone X (A1903) 64GB 深空灰色 移动联通4G手机",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/20180717175657d4f120465.jpg",
|
||||
"goods_price_min": "7099.00",
|
||||
"goods_price_max": "7299.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
},
|
||||
{
|
||||
"goods_id": 10010,
|
||||
"goods_name": "Apple iPhone 8 Plus (A1864) 64GB 深空灰色 移动联通电信4G手机",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/20180717174543802b79332.jpg",
|
||||
"goods_price_min": "5099.00",
|
||||
"goods_price_max": "5599.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
},
|
||||
{
|
||||
"goods_id": 10009,
|
||||
"goods_name": "荣耀9i 4GB+64GB 幻夜黑 移动联通电信4G全面屏手机 双卡双待",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/2018071717370507f183424.jpg",
|
||||
"goods_price_min": "1399.00",
|
||||
"goods_price_max": "1499.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
},
|
||||
{
|
||||
"goods_id": 10008,
|
||||
"goods_name": "华为 HUAWEI nova 3全面屏高清四摄游戏手机 6GB+128GB 浅艾蓝限量款 全网通移动联通电信4G手机 双卡双待",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/20180717172606d9aee7835.jpg",
|
||||
"goods_price_min": "2788.00",
|
||||
"goods_price_max": "2788.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
},
|
||||
{
|
||||
"goods_id": 10007,
|
||||
"goods_name": "小米6X 全网通 4GB+32GB 流沙金 移动联通电信4G手机 双卡双待 智能手机",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/2018071716542894aea9466.jpg",
|
||||
"goods_price_min": "1399.00",
|
||||
"goods_price_max": "1699.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 363
|
||||
},
|
||||
{
|
||||
"goods_id": 10006,
|
||||
"goods_name": "小米(MI) 红米6 流沙金 全网通(3G RAM+32G ROM)",
|
||||
"selling_point": "",
|
||||
"goods_image": "https://static.yoshop.xany6.com/2018071716364761fab9153.jpg",
|
||||
"goods_price_min": "739.00",
|
||||
"goods_price_max": "999.00",
|
||||
"line_price_min": "0.00",
|
||||
"line_price_max": "0.00",
|
||||
"goods_sales": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
Loading…
x
Reference in New Issue
Block a user