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/api/qianxian.js b/api/qianxian.js new file mode 100644 index 0000000..12076da --- /dev/null +++ b/api/qianxian.js @@ -0,0 +1,36 @@ +import request from '@/utils/request' + +// 千县名品首页 +export function getCountyFamousIndex() { + return request.get('/countyFamous/index', {}, { login: true }) +} + +// 获取千县名品省-县树形列表 +export function getCountyFamousCityTree(param) { + return request.get('/countyFamous/cityTree', param, { login: true }) +} + +// 获取千县名品县城数据 +export function getCountyFamousCityDetail(id) { + return request.get('/countyFamous/' + id, {}, { login: true }) +} + +// 获取千县名品县城店铺数据 +export function getCountyFamousCityShop(param) { + return request.get('/countyFamous/shop', param, { login: true }) +} + +// 获取千县名品县城资讯数据 +export function getCountyFamousCityNews(param) { + return request.get('/countyFamous/news', param, { login: true }) +} + +// 获取千县名品县城攻略数据 +export function getCountyFamousCityGuide(param) { + return request.get('/countyFamous/guide', param, { login: true }) +} + +// 获取千县名品县城攻略数据 +export function getCountyFamousCityGuideContent(param) { + return request.get('/countyFamous/guide/content', param, { login: true }) +} diff --git a/components/xdd-product-item/index.vue b/components/xdd-product-item/index.vue index 9b84ea9..466ea28 100644 --- a/components/xdd-product-item/index.vue +++ b/components/xdd-product-item/index.vue @@ -23,18 +23,18 @@ - {{ item.storeName }} + {{ item[nameKey] }} - + {{ item.bestContent }} - + {{ item.couponName }} - ¥{{ item.price }} + ¥{{ item[priceKey] }} - - - - - - - - - - - + + + + + + {{ item.provinceName }} + + + + + + + + + + + + + + - - - - - - {{ item.mapTitle }} - + + + + {{ item.title }} + {{ item.description }} + + ¥{{ item.price }} + + + - - - {{ item.provinceName }} - - + - - - - - {{ mapData.recommended.title }} - {{ mapData.recommended.description }} - - - - - - - - {{ item.title }} - - ¥{{ item.price }} - - - - - - - - + + + \ No newline at end of file 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/famousList.vue b/pkg_product/views/famousList.vue index be3da4f..45fe45a 100644 --- a/pkg_product/views/famousList.vue +++ b/pkg_product/views/famousList.vue @@ -1,51 +1,179 @@ diff --git a/pkg_product/views/famousList_bak20240819.vue b/pkg_product/views/famousList_bak20240819.vue new file mode 100644 index 0000000..be3da4f --- /dev/null +++ b/pkg_product/views/famousList_bak20240819.vue @@ -0,0 +1,260 @@ + + + + + diff --git a/pkg_product/views/famousQianxian.vue b/pkg_product/views/famousQianxian.vue new file mode 100644 index 0000000..f357382 --- /dev/null +++ b/pkg_product/views/famousQianxian.vue @@ -0,0 +1,189 @@ + + + + + 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 @@ - - +