Feat(首页):尖货专题对接完成
This commit is contained in:
@@ -85,6 +85,13 @@ export function getFestival() {
|
|||||||
return request.get('/contentFestival', {}, {login: false})
|
return request.get('/contentFestival', {}, {login: false})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 尖货专题
|
||||||
|
* */
|
||||||
|
export function getContentBest(id) {
|
||||||
|
return request.get(`/contentBest/${id}`, {}, {login: false})
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 非遗文化
|
* 非遗文化
|
||||||
* */
|
* */
|
||||||
|
|||||||
+32
-17
@@ -187,7 +187,7 @@
|
|||||||
:key="swiperIndex"
|
:key="swiperIndex"
|
||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
:src="swiperItem.image"
|
:src="swiperItem.indexImage"
|
||||||
mode="scaleToFill"
|
mode="scaleToFill"
|
||||||
class="swiper-img"
|
class="swiper-img"
|
||||||
@click="productSwiperItemClickHandle(swiperItem)"
|
@click="productSwiperItemClickHandle(swiperItem)"
|
||||||
@@ -373,6 +373,7 @@ export default {
|
|||||||
_this.bastRightList = []
|
_this.bastRightList = []
|
||||||
for (let i = 0; i < data.bastList.length; i++) {
|
for (let i = 0; i < data.bastList.length; i++) {
|
||||||
if (i % 2 === 0) {
|
if (i % 2 === 0) {
|
||||||
|
// 店铺排名
|
||||||
if (i === 4 && data.hotelList.length > 0) {
|
if (i === 4 && data.hotelList.length > 0) {
|
||||||
_this.bastLeftList.push({
|
_this.bastLeftList.push({
|
||||||
type: 'hotel',
|
type: 'hotel',
|
||||||
@@ -382,23 +383,11 @@ export default {
|
|||||||
_this.bastLeftList.push(data.bastList[i])
|
_this.bastLeftList.push(data.bastList[i])
|
||||||
}
|
}
|
||||||
if (i % 2 === 1) {
|
if (i % 2 === 1) {
|
||||||
if (i === 3) {
|
// 尖货专题
|
||||||
|
if (i === 3 && data.contentBest.length > 0) {
|
||||||
_this.bastRightList.push({
|
_this.bastRightList.push({
|
||||||
type: 'swiper',
|
type: 'swiper',
|
||||||
list: [
|
list: data.contentBest
|
||||||
{
|
|
||||||
image: 'http://resource.xdd618.com/19/20240722/1721615384602_入口图8.jpg',
|
|
||||||
id: 5781
|
|
||||||
},
|
|
||||||
{
|
|
||||||
image: 'http://resource.xdd618.com/19/20240715/1721006994007_微信图片_20240715092549.jpg',
|
|
||||||
id: 5781
|
|
||||||
},
|
|
||||||
{
|
|
||||||
image: 'http://resource.xdd618.com/19/20240722/1721615384602_入口图8.jpg',
|
|
||||||
id: 5781
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_this.bastRightList.push(data.bastList[i])
|
_this.bastRightList.push(data.bastList[i])
|
||||||
@@ -428,6 +417,7 @@ export default {
|
|||||||
changeOldPopup(state) {
|
changeOldPopup(state) {
|
||||||
this.isOldUser = state
|
this.isOldUser = state
|
||||||
},
|
},
|
||||||
|
// 民宿专题
|
||||||
goHomeStay(stay) {
|
goHomeStay(stay) {
|
||||||
if (stay.uniappUrl) {
|
if (stay.uniappUrl) {
|
||||||
this.$global.commonJump(stay.uniappUrl)
|
this.$global.commonJump(stay.uniappUrl)
|
||||||
@@ -446,6 +436,7 @@ export default {
|
|||||||
uni.navigateTo({url: '/pkg_product/views/homestay?id=' + stay.id})
|
uni.navigateTo({url: '/pkg_product/views/homestay?id=' + stay.id})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 节日专题
|
||||||
goFestival() {
|
goFestival() {
|
||||||
uni.navigateTo({url: '/pkg_product/views/festival'})
|
uni.navigateTo({url: '/pkg_product/views/festival'})
|
||||||
},
|
},
|
||||||
@@ -487,6 +478,7 @@ export default {
|
|||||||
this.$global.levelJump(pageLevel, url, params)
|
this.$global.levelJump(pageLevel, url, params)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 千县名品和地标好物
|
||||||
landAndFamousItemClickHandle(item) {
|
landAndFamousItemClickHandle(item) {
|
||||||
const url = item.url
|
const url = item.url
|
||||||
if (!url) return
|
if (!url) return
|
||||||
@@ -497,11 +489,34 @@ export default {
|
|||||||
uni.navigateTo({ url })
|
uni.navigateTo({ url })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 店铺排名
|
||||||
hotelItemClickHandle(item) {
|
hotelItemClickHandle(item) {
|
||||||
uni.navigateTo({ url: `/pagesInn/inn/innHome?id=${item.id}&from=index` })
|
uni.navigateTo({ url: `/pagesInn/inn/innHome?id=${item.id}&from=index` })
|
||||||
},
|
},
|
||||||
|
// 尖货专题
|
||||||
productSwiperItemClickHandle(item) {
|
productSwiperItemClickHandle(item) {
|
||||||
uni.navigateTo({url: '/pkg_product/views/homestay?id=' + item.id})
|
// 类型:1-专题页 2-商品详情 3-时令尝鲜
|
||||||
|
const type = item.type
|
||||||
|
if (type === 1) {
|
||||||
|
uni.navigateTo({ url: `/pkg_product/views/festival?id=${item.id}&from=index&theme=best` })
|
||||||
|
}
|
||||||
|
// 链接到特定页面
|
||||||
|
if (type === 2 && item.uniappUrl) {
|
||||||
|
this.$global.commonJump(stay.uniappUrl)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 商品详情
|
||||||
|
if (type === 2 && item.productId) {
|
||||||
|
this.$yrouter.push({
|
||||||
|
path: '/pages/shop/GoodsCon/index',
|
||||||
|
query: {
|
||||||
|
id: item.productId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (type === 3) {
|
||||||
|
uni.navigateTo({ url: '/pkg_product/views/seasonList' })
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setTopHandle() {
|
setTopHandle() {
|
||||||
uni.pageScrollTo({
|
uni.pageScrollTo({
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
/>
|
/>
|
||||||
<view
|
<view
|
||||||
v-for="(content,cIndex) in contents"
|
v-for="(content, cIndex) in contents"
|
||||||
:key="cIndex"
|
:key="cIndex"
|
||||||
class="section"
|
class="section"
|
||||||
>
|
>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
:class="cIndex === 0 ? 'span12' : 'span8'"
|
:class="cIndex === 0 ? 'span12' : 'span8'"
|
||||||
:src="item.image"
|
:src="item.image"
|
||||||
mode="scaleToFill"
|
mode="scaleToFill"
|
||||||
@click="goGoods(item.id)"
|
@click="goGoods(item.id || item.linkId)"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -44,8 +44,11 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// 节日专题
|
/**
|
||||||
import { getFestival } from '@/api/product'
|
* 节日专题&尖货推荐初始模板
|
||||||
|
* options.theme:best-尖货,''-节日
|
||||||
|
*/
|
||||||
|
import { getFestival, getContentBest } from '@/api/product'
|
||||||
import { pageListenMixins } from '@/mixins/pageListenMixins'
|
import { pageListenMixins } from '@/mixins/pageListenMixins'
|
||||||
export default {
|
export default {
|
||||||
name: 'FestivalPage',
|
name: 'FestivalPage',
|
||||||
@@ -54,16 +57,44 @@ export default {
|
|||||||
return {
|
return {
|
||||||
isLoad: false,
|
isLoad: false,
|
||||||
topImage: '',
|
topImage: '',
|
||||||
contents: [],
|
contents: {},
|
||||||
pageKeyId: Object.freeze('appContentFestival')
|
pageKeyId: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(options) {
|
||||||
getFestival().then(({data}) => {
|
const theme = options.theme || ''
|
||||||
this.isLoad = true
|
const id = options.id
|
||||||
this.topImage = data.topImage
|
// 尖货
|
||||||
this.contents = data.contents
|
if (theme === 'best') {
|
||||||
})
|
this.pageKeyId = `appContentBest_id_${id}`
|
||||||
|
getContentBest(id).then(({data}) => {
|
||||||
|
this.isLoad = true
|
||||||
|
const contents = []
|
||||||
|
if (data.templateProperties) {
|
||||||
|
const temp = data.templateProperties
|
||||||
|
// 第一页图片
|
||||||
|
this.topImage = temp.page1Image
|
||||||
|
// 第二页数据
|
||||||
|
contents.push({
|
||||||
|
backgroundImage: temp.page2BackgroundImage,
|
||||||
|
products: temp.page2Links
|
||||||
|
})
|
||||||
|
// 第三页数据
|
||||||
|
contents.push({
|
||||||
|
backgroundImage: temp.page3BackgroundImage,
|
||||||
|
products: temp.page3Links
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.contents = contents
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.pageKeyId = 'appContentFestival'
|
||||||
|
getFestival().then(({data}) => {
|
||||||
|
this.isLoad = true
|
||||||
|
this.topImage = data.topImage
|
||||||
|
this.contents = data.contents
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goGoods(id) {
|
goGoods(id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user