diff --git a/api/product.js b/api/product.js
index 3214618..dd0886b 100644
--- a/api/product.js
+++ b/api/product.js
@@ -78,6 +78,10 @@ export function getHomestay(id) {
return request.get(`/contentHomestay/${id}`, {}, {login: false})
}
+export function getHomestayV2(id) {
+ return request.get(`/contentHomestay/v2/${id}`, {}, {login: false})
+}
+
/**
* 节日专题
* */
@@ -85,6 +89,10 @@ export function getFestival() {
return request.get('/contentFestival', {}, {login: false})
}
+export function getFestivalV2() {
+ return request.get('/contentFestival/v2', {}, {login: false})
+}
+
/**
* 尖货专题
* */
diff --git a/pages/home/index.vue b/pages/home/index.vue
index b084b0c..437952c 100644
--- a/pages/home/index.vue
+++ b/pages/home/index.vue
@@ -367,8 +367,8 @@ export default {
_this.$set(_this, 'landmarkGoodsImage', data.landmarkGoodsImage)
_this.$set(_this, 'countyFamousImage', data.countyFamousImage)
_this.$set(_this, 'oldUserPopup', data.oldUserPopup)
- _this.$set(_this, 'contentHomestay', data.contentHomestay)
- _this.$set(_this, 'contentFestival', data.contentFestival)
+ _this.$set(_this, 'contentHomestay', data.contentHomestayV2)
+ _this.$set(_this, 'contentFestival', data.contentFestivalV2)
_this.bastLeftList = []
_this.bastRightList = []
for (let i = 0; i < data.bastList.length; i++) {
@@ -418,27 +418,53 @@ export default {
this.isOldUser = state
},
// 民宿专题
- goHomeStay(stay) {
- if (stay.uniappUrl) {
- this.$global.commonJump(stay.uniappUrl)
+ goHomeStay(item) {
+ if (item.type === 1) {
+ uni.navigateTo({ url: '/pkg_product/views/homestay?id=' + item.id })
return
}
- if (stay.type === 2 && stay.isLinkToProduct) {
- this.$yrouter.push({
- path: '/pages/shop/GoodsCon/index',
- query: {
- id: stay.productId
- }
- })
- return
- }
- if (stay.type === 1) {
- uni.navigateTo({url: '/pkg_product/views/homestay?id=' + stay.id})
- }
+ this.linkToThemePage(item)
},
// 节日专题
goFestival() {
- uni.navigateTo({url: '/pkg_product/views/festival'})
+ if (this.contentFestival.type === 1) {
+ uni.navigateTo({ url: '/pkg_product/views/festival' })
+ return
+ }
+ this.linkToThemePage(this.contentFestival)
+ },
+ // 尖货专题
+ productSwiperItemClickHandle(item) {
+ if (item.type === 1) {
+ uni.navigateTo({ url: `/pkg_product/views/festival?id=${item.id}&from=index&theme=best` })
+ return
+ }
+ this.linkToThemePage(item)
+ },
+ linkToThemePage(item) {
+ /**
+ * type:1-专题页,2-商品,3-时令尝鲜
+ * 当type=2,且uniappUrl有值,以跳转界面地址为准
+ */
+ const type = item.type
+ // 链接到特定页面
+ if (type === 2 && item.uniappUrl) {
+ this.$global.commonJump(item.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' })
+ }
},
tapOld() {
this.isOldUser = false
@@ -493,31 +519,6 @@ export default {
hotelItemClickHandle(item) {
uni.navigateTo({ url: `/pagesInn/inn/innHome?id=${item.id}&from=index` })
},
- // 尖货专题
- productSwiperItemClickHandle(item) {
- // 类型: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() {
uni.pageScrollTo({
scrollTop: 0,
diff --git a/pkg_product/components/ThemePageTemplate1.vue b/pkg_product/components/ThemePageTemplate1.vue
new file mode 100644
index 0000000..770eac7
--- /dev/null
+++ b/pkg_product/components/ThemePageTemplate1.vue
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pkg_product/components/ThemePageTemplate2.vue b/pkg_product/components/ThemePageTemplate2.vue
new file mode 100644
index 0000000..eef970e
--- /dev/null
+++ b/pkg_product/components/ThemePageTemplate2.vue
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pkg_product/components/ThemePageTemplate3.vue b/pkg_product/components/ThemePageTemplate3.vue
new file mode 100644
index 0000000..9e3182d
--- /dev/null
+++ b/pkg_product/components/ThemePageTemplate3.vue
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pkg_product/components/ThemePageTemplate4.vue b/pkg_product/components/ThemePageTemplate4.vue
new file mode 100644
index 0000000..a494abe
--- /dev/null
+++ b/pkg_product/components/ThemePageTemplate4.vue
@@ -0,0 +1,140 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pkg_product/mixins/themeTemplateMixins.js b/pkg_product/mixins/themeTemplateMixins.js
new file mode 100644
index 0000000..c1a3d29
--- /dev/null
+++ b/pkg_product/mixins/themeTemplateMixins.js
@@ -0,0 +1,19 @@
+export const themeTemplateMixins = {
+ props: {
+ topImage: {
+ type: String,
+ default: ''
+ },
+ templateProperties: {
+ type: Object,
+ default: () => {
+ return {}
+ }
+ }
+ },
+ methods: {
+ itemClick(item) {
+ this.$emit('view', item)
+ }
+ }
+}
\ No newline at end of file
diff --git a/pkg_product/views/festival.vue b/pkg_product/views/festival.vue
index 04b21ff..e7662f0 100644
--- a/pkg_product/views/festival.vue
+++ b/pkg_product/views/festival.vue
@@ -9,36 +9,66 @@
color='#ffffff'
/>
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -48,17 +78,30 @@
* 节日专题&尖货推荐初始模板
* options.theme:best-尖货,''-节日
*/
-import { getFestival, getContentBest } from '@/api/product'
+import { getFestivalV2, getContentBest } from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
+import ThemePageTemplate1 from '../components/ThemePageTemplate1.vue'
+import ThemePageTemplate2 from '../components/ThemePageTemplate2.vue'
+import ThemePageTemplate3 from '../components/ThemePageTemplate3.vue'
+import ThemePageTemplate4 from '../components/ThemePageTemplate4.vue'
export default {
name: 'FestivalPage',
+ components: {
+ ThemePageTemplate1,
+ ThemePageTemplate2,
+ ThemePageTemplate3,
+ ThemePageTemplate4
+ },
mixins: [pageListenMixins],
data() {
return {
isLoad: false,
topImage: '',
- contents: {},
- pageKeyId: ''
+ contents: [],
+ pageKeyId: '',
+ templateKey: '',
+ // 模板数据
+ templateProperties: {}
}
},
onLoad(options) {
@@ -67,13 +110,41 @@ export default {
// 尖货
if (theme === 'best') {
this.pageKeyId = `appContentBest_id_${id}`
- getContentBest(id).then(({data}) => {
+ this.getContentBestReq(id)
+ } else {
+ this.pageKeyId = 'appContentFestival'
+ this.getFestivalReq()
+ }
+ },
+ methods: {
+ getFestivalReq() {
+ /*旧接口
+ getFestival().then(({data}) => {
this.isLoad = true
- const contents = []
- if (data.templateProperties) {
- const temp = data.templateProperties
- // 第一页图片
- this.topImage = temp.page1Image
+ this.topImage = data.topImage
+ this.contents = data.contents
+ })
+ */
+ getFestivalV2().then(res => {
+ const { data } = res
+ this.renderTemplateData(data)
+ })
+ },
+ getContentBestReq(id) {
+ getContentBest(id).then(res => {
+ const { data } = res
+ this.renderTemplateData(data)
+ })
+ },
+ renderTemplateData(data) {
+ const contents = []
+ if (data.templateProperties) {
+ const templateKey = data.templateKey
+ const temp = data.templateProperties
+ // 第一页图片
+ this.topImage = temp.page1Image
+ // 默认模板
+ if (templateKey === 'default_template') {
// 第二页数据
contents.push({
backgroundImage: temp.page2BackgroundImage,
@@ -85,22 +156,27 @@ export default {
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: {
- goGoods(id) {
- uni.navigateTo({
- url: `/pages/shop/GoodsCon/index?id=${id}&from=festival`
- })
+ // 模板1
+ if (['template_1', 'template_2', 'template_3', 'template_4'].includes(templateKey)) {
+ this.templateProperties = temp
+ }
+ }
+ this.templateKey = data.templateKey
+ this.contents = contents
+ this.isLoad = true
+ },
+ goGoodsOrShop(item) {
+ const id = item.linkId
+ const type = item.type || 1
+ if (type === 1) {
+ uni.navigateTo({
+ url: `/pages/shop/GoodsCon/index?id=${id}&from=festival`
+ })
+ } else {
+ uni.navigateTo({
+ url: `/pagesInn/inn/innHome?id=${id}&from=festival`
+ })
+ }
}
}
}
diff --git a/pkg_product/views/homestay.vue b/pkg_product/views/homestay.vue
index 4675038..f866cd0 100644
--- a/pkg_product/views/homestay.vue
+++ b/pkg_product/views/homestay.vue
@@ -1,38 +1,3 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+