|
@@ -0,0 +1,288 @@
|
|
|
+<template>
|
|
|
+ <div class="RecommendedBannerlist">
|
|
|
+ <div class="listContent">
|
|
|
+ <div @click="toSubManagePage">
|
|
|
+ <img src="@/assets/image/public/goset.png" alt="" class="topimg" />
|
|
|
+ </div>
|
|
|
+ <ProjectCell
|
|
|
+ v-for="item in list"
|
|
|
+ class="list-item"
|
|
|
+ cardType="simplify"
|
|
|
+ :class="item.className"
|
|
|
+ :detailList="item.detailList"
|
|
|
+ @click="onClickCell(item)"
|
|
|
+ :title="item.title"
|
|
|
+ :time="item.dateTime"
|
|
|
+ :isFile="item.isFile"
|
|
|
+ :keys="item.matchKeys"
|
|
|
+ :leftTopBadgeText="item.leftTopBadgeText"
|
|
|
+ :tags="item.tagList"
|
|
|
+ :pushSource="item.pushSource"
|
|
|
+ :key="item.id"
|
|
|
+ v-visited:subscribe="item._id"
|
|
|
+ >
|
|
|
+ </ProjectCell>
|
|
|
+ <AppEmpty
|
|
|
+ class="center"
|
|
|
+ state="sleep"
|
|
|
+ v-show="list.length === 0"
|
|
|
+ ></AppEmpty>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { mapGetters, mapState } from 'vuex'
|
|
|
+import qs from 'qs'
|
|
|
+import { AppEmpty, ProjectCell } from '@/ui'
|
|
|
+import {
|
|
|
+ getRecList,
|
|
|
+ getUserSubscribeSomeInfo,
|
|
|
+ getUserSubscribeKeywords
|
|
|
+} from '@/api/modules'
|
|
|
+import { LINKS } from '@/data'
|
|
|
+import {
|
|
|
+ openAppOrWxPage,
|
|
|
+ openLinkOfOther,
|
|
|
+ getRandomString,
|
|
|
+ formatMoney
|
|
|
+} from '@/utils'
|
|
|
+export default {
|
|
|
+ name: 'RecommendedBannerlist',
|
|
|
+ components: {
|
|
|
+ [ProjectCell.name]: ProjectCell,
|
|
|
+ [AppEmpty.name]: AppEmpty
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState('user', ['power', 'mySelectEntInfo']),
|
|
|
+ ...mapGetters('user', [
|
|
|
+ 'isLogin',
|
|
|
+ 'restfulApiUserTypeWitchVSwitch',
|
|
|
+ 'vSwitch'
|
|
|
+ ]),
|
|
|
+ isHasKey() {
|
|
|
+ return this.mergedKeywords.length > 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isEntSubscribe: '',
|
|
|
+ mergedKeywords: [],
|
|
|
+ list: [],
|
|
|
+ // 用户其他信息
|
|
|
+ someInfo: {
|
|
|
+ userId: '',
|
|
|
+ hasKey: false, // 是否订阅关键词
|
|
|
+ isInTSguide: false, // 是否进入向导
|
|
|
+ isExpire: 0, // 超级订阅到期提醒
|
|
|
+ isOnTail: false, // 超级订阅试用状态
|
|
|
+ isPassCount: false, // 推送数量达到上限校验
|
|
|
+ otherFlag: false, // 首次用户推送查询“其他”
|
|
|
+ isread: false, // 某个通知??是否已读
|
|
|
+ industry: [] // 会员订阅的行业
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ created() {
|
|
|
+ this.getUserSubscribeSomeInfo()
|
|
|
+ this.getMergedEntSubscribeKeywords()
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ formatMoney,
|
|
|
+ async onClickCell(item) {
|
|
|
+ const { _id, industry } = item
|
|
|
+ const { inWX } = this.$envs
|
|
|
+ const query = {}
|
|
|
+ if (industry) {
|
|
|
+ query.industry = industry
|
|
|
+ }
|
|
|
+ if (item.matchKeys) {
|
|
|
+ query.keywords = item.matchKeys.join(' ')
|
|
|
+ }
|
|
|
+ const targetMap = {
|
|
|
+ wx: `/article/content/${_id}.html?${qs.stringify(query)}`,
|
|
|
+ h5: `/jyapp/article/content/${_id}.html?${qs.stringify(query)}`,
|
|
|
+ app: `/jyapp/article/content/${_id}.html?${qs.stringify(query)}`
|
|
|
+ }
|
|
|
+ if (!this.isLogin) {
|
|
|
+ return openLinkOfOther(LINKS.APP登录页.app, {
|
|
|
+ query: {
|
|
|
+ url: inWX ? targetMap.wx : targetMap.app
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ openAppOrWxPage(targetMap)
|
|
|
+ },
|
|
|
+ // 去订阅页面
|
|
|
+ toSubManagePage() {
|
|
|
+ const { isUpgrade } = this.power
|
|
|
+ const { isInTSguide } = this.someInfo
|
|
|
+ // 打开订阅页面
|
|
|
+ // 商机管理跳转商机管理页面
|
|
|
+ if (this.vSwitch === 's') {
|
|
|
+ openLinkOfOther('/page_entniche_new/page/subsetting/sub_entrance.html')
|
|
|
+ } else if (this.vSwitch === 'v' || this.vSwitch === 'm') {
|
|
|
+ // 超级订阅/大会员
|
|
|
+ openAppOrWxPage(LINKS.订阅管理页面, {
|
|
|
+ query: {
|
|
|
+ vSwitch: this.vSwitch
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // vSwitch === 'f' || vSwitch === ''
|
|
|
+ // 是否是免费用户订阅升级用户 默认true
|
|
|
+ if (isInTSguide) {
|
|
|
+ openAppOrWxPage(LINKS.老关键词列表)
|
|
|
+ } else {
|
|
|
+ if (isUpgrade || !this.isHasKey) {
|
|
|
+ // 无关键词时候,也要跳转订阅管理
|
|
|
+ openAppOrWxPage(LINKS.订阅管理页面)
|
|
|
+ } else {
|
|
|
+ // 老用户订阅用户跳转老订阅管理
|
|
|
+ openAppOrWxPage(LINKS.老关键词列表)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // openLinkOfOther(
|
|
|
+ // '/page_entniche_new/page/sub_management/sub_management_system.html?pagesource=enterprise'
|
|
|
+ // )
|
|
|
+ },
|
|
|
+ // 获取用户订阅信息
|
|
|
+ async getUserSubscribeSomeInfo() {
|
|
|
+ try {
|
|
|
+ const {
|
|
|
+ data = {},
|
|
|
+ error_code: code = 0,
|
|
|
+ // eslint-disable-next-line no-unused-vars
|
|
|
+ error_msg: msg
|
|
|
+ } = await getUserSubscribeSomeInfo(this.restfulApiUserTypeWitchVSwitch)
|
|
|
+ if (code === 0 && data) {
|
|
|
+ Object.assign(this.someInfo, data)
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ // eslint-disable-next-line no-empty
|
|
|
+ } finally {
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getMergedEntSubscribeKeywords() {
|
|
|
+ const {
|
|
|
+ ent_buy_vip: entBuyVip,
|
|
|
+ ent_buy_member: entBuyMember,
|
|
|
+ power_source: powerSource,
|
|
|
+ user_power: userPower
|
|
|
+ } = this.mySelectEntInfo
|
|
|
+ const params = {
|
|
|
+ ent_buy_vip: entBuyVip,
|
|
|
+ ent_buy_member: entBuyMember,
|
|
|
+ powerSource,
|
|
|
+ userPower,
|
|
|
+ isEnt: false
|
|
|
+ }
|
|
|
+ const {
|
|
|
+ data,
|
|
|
+ error_code: code,
|
|
|
+ error_msg: msg
|
|
|
+ } = await getUserSubscribeKeywords(
|
|
|
+ this.restfulApiUserTypeWitchVSwitch,
|
|
|
+ params
|
|
|
+ )
|
|
|
+ if (code === 0) {
|
|
|
+ this.mergedKeywords = data?.items || []
|
|
|
+ } else {
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ console.warn(msg)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getList() {
|
|
|
+ const loading = this.$toast.loading({
|
|
|
+ duration: 0,
|
|
|
+ message: 'loading...'
|
|
|
+ })
|
|
|
+ const {
|
|
|
+ data = {},
|
|
|
+ error_code: code = 0,
|
|
|
+ error_msg: msg
|
|
|
+ } = await getRecList({ spath: '2' }) // 1订阅更多 2模版消息
|
|
|
+ loading.clear()
|
|
|
+ if (code === 0 && data) {
|
|
|
+ const list = data.list
|
|
|
+ if (Array.isArray(list)) {
|
|
|
+ this.preSortList(list)
|
|
|
+ this.list = list
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast(msg || '请求失败')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ preSortList(list = []) {
|
|
|
+ if (!Array.isArray(list)) return
|
|
|
+ list.forEach(this.preSortItem)
|
|
|
+ },
|
|
|
+ // 格式化查询后的每一项数据
|
|
|
+ preSortItem(item) {
|
|
|
+ if (!item) return
|
|
|
+ const { area, collection, projectInfo } = item
|
|
|
+ const {
|
|
|
+ vip_power: vipPower,
|
|
|
+ member_power: memberPower,
|
|
|
+ user_power: userPower
|
|
|
+ } = this.mySelectEntInfo
|
|
|
+ item.star = !!collection
|
|
|
+ // 参标状态
|
|
|
+ item.isCB = {
|
|
|
+ id: '',
|
|
|
+ value: 0
|
|
|
+ }
|
|
|
+ // 是否有附件
|
|
|
+ item.isFile = item?.ca_fileExists || false
|
|
|
+ item.leftTopBadgeText = item.site === '剑鱼信息发布平台' ? '用户发布' : ''
|
|
|
+ // 拟建项目独有参数
|
|
|
+ if (projectInfo) {
|
|
|
+ Object.assign(item, projectInfo)
|
|
|
+ }
|
|
|
+ if (!Array.isArray(item.matchKeys)) {
|
|
|
+ item.matchKeys = []
|
|
|
+ }
|
|
|
+
|
|
|
+ // 个人订阅下, 来自企业分发的信息(企业超级订阅/企业大会员/企业商机管理), 都要添加标签
|
|
|
+ const powerFromEnt =
|
|
|
+ vipPower === 1 || memberPower === 1 || userPower === 1
|
|
|
+ if (powerFromEnt) {
|
|
|
+ item.pushSource = item.source
|
|
|
+ }
|
|
|
+ const buyerClass =
|
|
|
+ item?.buyerClass && item?.buyerClass !== '其它'
|
|
|
+ ? item?.buyerClass
|
|
|
+ : undefined
|
|
|
+ // 标签
|
|
|
+ item.tagList = [
|
|
|
+ area || '全国',
|
|
|
+ buyerClass,
|
|
|
+ item?.type || item?.subtype,
|
|
|
+ // 有中标金额取中标金额,没有取预算,预算没有置空
|
|
|
+ // eslint-disable-next-line prettier/prettier
|
|
|
+ item?.bidAmount ? formatMoney(item?.bidAmount - 0) : item?.budget ? formatMoney(item?.budget - 0) : ''
|
|
|
+ ].filter((v) => v)
|
|
|
+
|
|
|
+ // 添加随机id
|
|
|
+ item.id = `${item._id}--${getRandomString(8).toLowerCase()}`
|
|
|
+ item.dateTime = item.publishTime ? item.publishTime * 1000 : ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.topimg {
|
|
|
+ width: 100%;
|
|
|
+ display: block;
|
|
|
+ // position: fixed;
|
|
|
+ // top: 0;
|
|
|
+ // left: 0;
|
|
|
+}
|
|
|
+.listContent {
|
|
|
+ // padding-top: 0.96rem;
|
|
|
+}
|
|
|
+</style>
|