Fix(专题页):[#4096]专题页领取优惠券后,再次点击专题页图片提示“undefine”
This commit is contained in:
@@ -0,0 +1,87 @@
|
|||||||
|
import { getCouponReceive } from '@/api/user'
|
||||||
|
export const themeMixins = {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isLoad: false,
|
||||||
|
pageData: {},
|
||||||
|
topImage: '',
|
||||||
|
contents: [],
|
||||||
|
pageKeyId: '',
|
||||||
|
templateKey: '',
|
||||||
|
// 模板数据
|
||||||
|
templateProperties: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShareAppMessage() {
|
||||||
|
if (this.pageData.forwardTitle && this.pageData.forwardImage) {
|
||||||
|
return {
|
||||||
|
title: this.pageData.forwardTitle,
|
||||||
|
path: `/pkg_product/views/homestay?id=${this.pageData.id}`,
|
||||||
|
imageUrl: this.pageData.forwardImage
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
title: this.share.title,
|
||||||
|
path: this.share.path,
|
||||||
|
imageUrl: this.share.imageUrl,
|
||||||
|
desc: this.share.desc,
|
||||||
|
content: this.share.content,
|
||||||
|
success(res){
|
||||||
|
uni.showToast({
|
||||||
|
title:'分享成功'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail(res){
|
||||||
|
uni.showToast({
|
||||||
|
title:'分享失败',
|
||||||
|
icon:'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
topImageClick() {
|
||||||
|
if (this.templateProperties.page1CouponEnable === 1 && this.templateProperties.page1CouponId) {
|
||||||
|
getCouponReceive(this.templateProperties.page1CouponId).then(res => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '领取成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.msg + '',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (type === 2) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pagesInn/inn/innHome?id=${id}&from=festival`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (type === 3) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/town/index?id=${id}&from=festival`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (type === 4) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pkg_product/views/famousQianxianShop?id=${id}&from=festival`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ export const themeTemplateMixins = {
|
|||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err.data.msg + '',
|
title: err.msg + '',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -80,8 +80,8 @@
|
|||||||
* options.theme:best-尖货,''-节日
|
* options.theme:best-尖货,''-节日
|
||||||
*/
|
*/
|
||||||
import { getFestivalV2, getContentBest } from '@/api/product'
|
import { getFestivalV2, getContentBest } from '@/api/product'
|
||||||
import { getCouponReceive } from '@/api/user'
|
|
||||||
import { pageListenMixins } from '@/mixins/pageListenMixins'
|
import { pageListenMixins } from '@/mixins/pageListenMixins'
|
||||||
|
import { themeMixins } from '../mixins/themeMixins'
|
||||||
import ThemePageTemplate1 from '../components/ThemePageTemplate1.vue'
|
import ThemePageTemplate1 from '../components/ThemePageTemplate1.vue'
|
||||||
import ThemePageTemplate2 from '../components/ThemePageTemplate2.vue'
|
import ThemePageTemplate2 from '../components/ThemePageTemplate2.vue'
|
||||||
import ThemePageTemplate3 from '../components/ThemePageTemplate3.vue'
|
import ThemePageTemplate3 from '../components/ThemePageTemplate3.vue'
|
||||||
@@ -94,20 +94,7 @@ export default {
|
|||||||
ThemePageTemplate3,
|
ThemePageTemplate3,
|
||||||
ThemePageTemplate4
|
ThemePageTemplate4
|
||||||
},
|
},
|
||||||
mixins: [pageListenMixins],
|
mixins: [pageListenMixins, themeMixins],
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isLoad: false,
|
|
||||||
theme: '',
|
|
||||||
pageData: {},
|
|
||||||
topImage: '',
|
|
||||||
contents: [],
|
|
||||||
pageKeyId: '',
|
|
||||||
templateKey: '',
|
|
||||||
// 模板数据
|
|
||||||
templateProperties: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const theme = options.theme || ''
|
const theme = options.theme || ''
|
||||||
const id = options.id
|
const id = options.id
|
||||||
@@ -121,34 +108,6 @@ export default {
|
|||||||
this.getFestivalReq()
|
this.getFestivalReq()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShareAppMessage() {
|
|
||||||
if (this.pageData.forwardTitle && this.pageData.forwardImage) {
|
|
||||||
return {
|
|
||||||
title: this.pageData.forwardTitle,
|
|
||||||
path: `/pkg_product/views/festival?id=${this.pageData.id}&from=index&theme=${this.theme}`,
|
|
||||||
imageUrl: this.pageData.forwardImage
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
title: this.share.title,
|
|
||||||
path: this.share.path,
|
|
||||||
imageUrl: this.share.imageUrl,
|
|
||||||
desc: this.share.desc,
|
|
||||||
content: this.share.content,
|
|
||||||
success(res){
|
|
||||||
uni.showToast({
|
|
||||||
title:'分享成功'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
fail(res){
|
|
||||||
uni.showToast({
|
|
||||||
title:'分享失败',
|
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
getFestivalReq() {
|
getFestivalReq() {
|
||||||
/*旧接口
|
/*旧接口
|
||||||
@@ -195,48 +154,6 @@ export default {
|
|||||||
this.templateKey = data.templateKey
|
this.templateKey = data.templateKey
|
||||||
this.contents = contents
|
this.contents = contents
|
||||||
this.isLoad = true
|
this.isLoad = true
|
||||||
},
|
|
||||||
topImageClick() {
|
|
||||||
if (this.templateProperties.page1CouponEnable === 1 && this.templateProperties.page1CouponId) {
|
|
||||||
getCouponReceive(this.templateProperties.page1CouponId).then(res => {
|
|
||||||
if (res.status === 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '领取成功',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch((err) => {
|
|
||||||
uni.showToast({
|
|
||||||
title: err.data.msg + '',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 3000
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
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`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (type === 2) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pagesInn/inn/innHome?id=${id}&from=festival`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (type === 3) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/town/index?id=${id}&from=festival`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (type === 4) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pkg_product/views/famousQianxianShop?id=${id}&from=festival`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,8 +77,8 @@
|
|||||||
<script>
|
<script>
|
||||||
// 民宿专题
|
// 民宿专题
|
||||||
import { getHomestayV2 } from '@/api/product'
|
import { getHomestayV2 } from '@/api/product'
|
||||||
import { getCouponReceive } from '@/api/user'
|
|
||||||
import { pageListenMixins } from '@/mixins/pageListenMixins'
|
import { pageListenMixins } from '@/mixins/pageListenMixins'
|
||||||
|
import { themeMixins } from '../mixins/themeMixins'
|
||||||
import ThemePageTemplate1 from '../components/ThemePageTemplate1.vue'
|
import ThemePageTemplate1 from '../components/ThemePageTemplate1.vue'
|
||||||
import ThemePageTemplate2 from '../components/ThemePageTemplate2.vue'
|
import ThemePageTemplate2 from '../components/ThemePageTemplate2.vue'
|
||||||
import ThemePageTemplate3 from '../components/ThemePageTemplate3.vue'
|
import ThemePageTemplate3 from '../components/ThemePageTemplate3.vue'
|
||||||
@@ -91,52 +91,12 @@ export default {
|
|||||||
ThemePageTemplate3,
|
ThemePageTemplate3,
|
||||||
ThemePageTemplate4
|
ThemePageTemplate4
|
||||||
},
|
},
|
||||||
mixins: [pageListenMixins],
|
mixins: [pageListenMixins, themeMixins],
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isLoad: false,
|
|
||||||
pageData: {},
|
|
||||||
topImage: '',
|
|
||||||
contents: [],
|
|
||||||
pageKeyId: '',
|
|
||||||
templateKey: '',
|
|
||||||
// 模板数据
|
|
||||||
templateProperties: {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const id = options.id
|
const id = options.id
|
||||||
this.pageKeyId = `appContentHomestay_id_${id}`
|
this.pageKeyId = `appContentHomestay_id_${id}`
|
||||||
this.getHomestayReq(id)
|
this.getHomestayReq(id)
|
||||||
},
|
},
|
||||||
onShareAppMessage() {
|
|
||||||
if (this.pageData.forwardTitle && this.pageData.forwardImage) {
|
|
||||||
return {
|
|
||||||
title: this.pageData.forwardTitle,
|
|
||||||
path: `/pkg_product/views/homestay?id=${this.pageData.id}`,
|
|
||||||
imageUrl: this.pageData.forwardImage
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
title: this.share.title,
|
|
||||||
path: this.share.path,
|
|
||||||
imageUrl: this.share.imageUrl,
|
|
||||||
desc: this.share.desc,
|
|
||||||
content: this.share.content,
|
|
||||||
success(res){
|
|
||||||
uni.showToast({
|
|
||||||
title:'分享成功'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
fail(res){
|
|
||||||
uni.showToast({
|
|
||||||
title:'分享失败',
|
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
getHomestayReq(id) {
|
getHomestayReq(id) {
|
||||||
/*旧接口
|
/*旧接口
|
||||||
@@ -181,48 +141,6 @@ export default {
|
|||||||
this.templateKey = data.templateKey
|
this.templateKey = data.templateKey
|
||||||
this.contents = contents
|
this.contents = contents
|
||||||
this.isLoad = true
|
this.isLoad = true
|
||||||
},
|
|
||||||
topImageClick() {
|
|
||||||
if (this.templateProperties.page1CouponEnable === 1 && this.templateProperties.page1CouponId) {
|
|
||||||
getCouponReceive(this.templateProperties.page1CouponId).then(res => {
|
|
||||||
if (res.status === 200) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '领取成功',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch((err) => {
|
|
||||||
uni.showToast({
|
|
||||||
title: err.data.msg + '',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 3000
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
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`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (type === 2) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pagesInn/inn/innHome?id=${id}&from=festival`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (type === 3) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/town/index?id=${id}&from=festival`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (type === 4) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pkg_product/views/famousQianxianShop?id=${id}&from=festival`
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-8
@@ -87,11 +87,12 @@ function baseRequest(options) {
|
|||||||
// 发起请求
|
// 发起请求
|
||||||
return http[options.method](url, _params).then(res => {
|
return http[options.method](url, _params).then(res => {
|
||||||
const resData = res.data || {}
|
const resData = res.data || {}
|
||||||
|
const resDataMsg = resData.msg || ''
|
||||||
// AI对话某个请求返回为空需要处理这种情况
|
// AI对话某个请求返回为空需要处理这种情况
|
||||||
if (['get', 'GET'].includes(options.method) && _params.params.isNoNeedPublicErrorNotification === 1) {
|
if (['get', 'GET'].includes(options.method) && _params.params.isNoNeedPublicErrorNotification === 1) {
|
||||||
console.log('----')
|
console.log('----')
|
||||||
if (resData.status === 500) {
|
if (resData.status === 500) {
|
||||||
return Promise.reject({msg: resData.msg, res, data})
|
return Promise.reject({ msg: resDataMsg, res, data })
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve({})
|
return Promise.resolve({})
|
||||||
}
|
}
|
||||||
@@ -99,11 +100,11 @@ function baseRequest(options) {
|
|||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: resData.msg,
|
title: resDataMsg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
})
|
})
|
||||||
return Promise.reject({msg: "请求失败", res, resData})
|
return Promise.reject({ msg: "请求失败", res, resData })
|
||||||
}
|
}
|
||||||
if (resData.status === 401) {
|
if (resData.status === 401) {
|
||||||
const whiteApiList = [
|
const whiteApiList = [
|
||||||
@@ -124,24 +125,24 @@ function baseRequest(options) {
|
|||||||
return Promise.resolve({ ...resData, isNoLogin: true }, res)
|
return Promise.resolve({ ...resData, isNoLogin: true }, res)
|
||||||
} else {
|
} else {
|
||||||
handleLoginFailure();
|
handleLoginFailure();
|
||||||
return Promise.reject({msg: '未登录', res, resData, toLogin: true})
|
return Promise.reject({ msg: '未登录', res, resData, toLogin: true })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ([403].indexOf(resData.status) !== -1) {
|
if ([403].indexOf(resData.status) !== -1) {
|
||||||
handleLoginFailure();
|
handleLoginFailure()
|
||||||
return Promise.reject({msg: res.data.msg, res, resData, toLogin: true})
|
return Promise.reject({ msg: resDataMsg, res, resData, toLogin: true })
|
||||||
} else if (resData.status === 200) {
|
} else if (resData.status === 200) {
|
||||||
return Promise.resolve(resData, res)
|
return Promise.resolve(resData, res)
|
||||||
} else {
|
} else {
|
||||||
// 埋点数据推送、获取店铺分享图片
|
// 埋点数据推送、获取店铺分享图片
|
||||||
if (url.indexOf('api/systemStats/push') < 0 && url.indexOf('api/hotelMain/shareImage') < 0) {
|
if (url.indexOf('api/systemStats/push') < 0 && url.indexOf('api/hotelMain/shareImage') < 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: resData.msg,
|
title: resDataMsg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return Promise.reject({msg: resData.msg, res, data})
|
return Promise.reject({ msg: resDataMsg, res, data })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user