|
@@ -36,6 +36,7 @@
|
|
class="tab-module"
|
|
class="tab-module"
|
|
:main-model="mainModel"
|
|
:main-model="mainModel"
|
|
:expand-model="expandModel"
|
|
:expand-model="expandModel"
|
|
|
|
+ :before-leave-page="beforeClickArticle"
|
|
:other-model="otherModel"
|
|
:other-model="otherModel"
|
|
/>
|
|
/>
|
|
</view>
|
|
</view>
|
|
@@ -63,7 +64,7 @@ import ToLoginDialog from '@/components/dialog/ToLoginDialog.vue'
|
|
import PopupCustomerQR from '@/components/common/PopupCustomerQR.vue'
|
|
import PopupCustomerQR from '@/components/common/PopupCustomerQR.vue'
|
|
import useContentModel from '@/data-models/modules/article/model/content'
|
|
import useContentModel from '@/data-models/modules/article/model/content'
|
|
import useExpandModel from '@/data-models/modules/article/model/expand'
|
|
import useExpandModel from '@/data-models/modules/article/model/expand'
|
|
-import { getBiddingDetail } from '@/api/modules/search'
|
|
|
|
|
|
+import { getBiddingDetail, checkArticleReadMax } from '@/api/modules/search'
|
|
const { model: mainModel, transformModel: contentTransform } = useContentModel()
|
|
const { model: mainModel, transformModel: contentTransform } = useContentModel()
|
|
const { model: expandModel, transformModel: expandTransform } = useExpandModel()
|
|
const { model: expandModel, transformModel: expandTransform } = useExpandModel()
|
|
import { setTrackLog } from '@/track'
|
|
import { setTrackLog } from '@/track'
|
|
@@ -134,6 +135,7 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
pageContentData: cloneDeep(defaultValueMap),
|
|
pageContentData: cloneDeep(defaultValueMap),
|
|
|
|
+ loading: false,
|
|
popup: {
|
|
popup: {
|
|
customerQrShow: false
|
|
customerQrShow: false
|
|
},
|
|
},
|
|
@@ -307,21 +309,8 @@ export default {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.finishLoading()
|
|
this.finishLoading()
|
|
})
|
|
})
|
|
- } else if (status === -5) {
|
|
|
|
- // 免费用户配置免费可读的是0,直接跳转去购买
|
|
|
|
- this.toBuyVip()
|
|
|
|
- } else if (status === -4) {
|
|
|
|
- // 免费用户查看达到上限,配置的免费可读数量不是0
|
|
|
|
- this.showReadMaxDialog()
|
|
|
|
- } else if (status === -3) {
|
|
|
|
- // 付费用户查看次数用完
|
|
|
|
- this.showVipReadMaxDialog()
|
|
|
|
- } else if (status === -2) {
|
|
|
|
- // 配置错误
|
|
|
|
- // showToast('配置错误')
|
|
|
|
- } else if (status === -1) {
|
|
|
|
- console.log('未登录')
|
|
|
|
- this.dialog.toLogin = true
|
|
|
|
|
|
+ } else {
|
|
|
|
+ this.showNoPowerCallback(status, 'content')
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (res.error_code === 1001) {
|
|
if (res.error_code === 1001) {
|
|
@@ -353,6 +342,72 @@ export default {
|
|
phoneNumber: phone
|
|
phoneNumber: phone
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ async checkArticleReadMax(id) {
|
|
|
|
+ const {
|
|
|
|
+ data,
|
|
|
|
+ error_code: code = 0,
|
|
|
|
+ error_msg: msg
|
|
|
|
+ } = await checkArticleReadMax({
|
|
|
|
+ id,
|
|
|
|
+ type: 1
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ if (code === 1001) {
|
|
|
|
+ return -1
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (data) {
|
|
|
|
+ return data.isView // 0可正常访问。-1:未登录,-2:配置错误,-3:付费次数用完,-4:免费次数用完,-5 免费用户配置可读的是0
|
|
|
|
+ } else {
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // type: list/content
|
|
|
|
+ showNoPowerCallback(status, type = 'content') {
|
|
|
|
+ if (status === -5) {
|
|
|
|
+ // 免费用户配置免费可读的是0,直接跳转去购买
|
|
|
|
+ this.toBuyVip()
|
|
|
|
+ } else if (status === -4) {
|
|
|
|
+ // 免费用户查看达到上限,配置的免费可读数量不是0
|
|
|
|
+ this.showReadMaxDialog(type)
|
|
|
|
+ } else if (status === -3) {
|
|
|
|
+ // 付费用户查看次数用完
|
|
|
|
+ if (type === 'content') {
|
|
|
|
+ this.showVipReadMaxDialog()
|
|
|
|
+ } else {
|
|
|
|
+ showToast('查看标讯数量已达到上限')
|
|
|
|
+ }
|
|
|
|
+ } else if (status === -2) {
|
|
|
|
+ // 配置错误
|
|
|
|
+ showToast('配置错误')
|
|
|
|
+ } else if (status === -1) {
|
|
|
|
+ console.log('未登录')
|
|
|
|
+ this.dialog.toLogin = true
|
|
|
|
+ } else {
|
|
|
|
+ console.log('未知的status')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async beforeClickArticle(item) {
|
|
|
|
+ let id = item.id
|
|
|
|
+ if (this.loading) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.loading = true
|
|
|
|
+ try {
|
|
|
|
+ const status = await this.checkArticleReadMax(id)
|
|
|
|
+ if (status === 0) {
|
|
|
|
+ return true
|
|
|
|
+ } else {
|
|
|
|
+ this.showNoPowerCallback(status, 'list')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ return true
|
|
|
|
+ } finally {
|
|
|
|
+ this.loading = false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
showVipReadMaxDialog() {
|
|
showVipReadMaxDialog() {
|
|
const defaultConf = {
|
|
const defaultConf = {
|
|
title: '',
|
|
title: '',
|
|
@@ -371,7 +426,7 @@ export default {
|
|
this.doBack()
|
|
this.doBack()
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- showReadMaxDialog() {
|
|
|
|
|
|
+ showReadMaxDialog(type) {
|
|
const defaultConf = {
|
|
const defaultConf = {
|
|
title: '免费查看项目数量已达上限',
|
|
title: '免费查看项目数量已达上限',
|
|
message: '您当前免费查看项目数量已达上限,您可购买会员获取更多查看标讯权限。',
|
|
message: '您当前免费查看项目数量已达上限,您可购买会员获取更多查看标讯权限。',
|
|
@@ -388,7 +443,9 @@ export default {
|
|
this.toBuyVip()
|
|
this.toBuyVip()
|
|
}).catch((e) => {
|
|
}).catch((e) => {
|
|
// 如果是分享过来的,则做其他操作
|
|
// 如果是分享过来的,则做其他操作
|
|
- this.doBack()
|
|
|
|
|
|
+ if (type !== 'list') {
|
|
|
|
+ this.doBack()
|
|
|
|
+ }
|
|
})
|
|
})
|
|
},
|
|
},
|
|
toBuyVip() {
|
|
toBuyVip() {
|