【海报分享链接时效问题】-处理二维码为金掌桂页面链接 --提交人:白金岩

This commit is contained in:
bai.jinyan
2021-09-17 14:26:24 +08:00
parent a7a95cccc2
commit b5ad6d910a
3 changed files with 132 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
//保全 定义相关组件 //保全 定义相关组件
const posterList = () => import('@/views/ebiz/poster/PosterList') const posterList = () => import('@/views/ebiz/poster/PosterList')
const posterPreview = () => import('@/views/ebiz/poster/PosterPreview') const posterPreview = () => import('@/views/ebiz/poster/PosterPreview')
const posterLoading = () => import('@/views/ebiz/poster/PosterLoading')
export default [ export default [
{ {
@@ -20,5 +21,14 @@ export default [
title: '海报预览', title: '海报预览',
index: 2 index: 2
} }
},
{
path: '/poster/posterLoading',
name: 'posterLoading',
component: posterLoading,
meta: {
title: '跳转链接',
index: 2
}
} }
] ]

View File

@@ -0,0 +1,84 @@
<template>
<div class="loading-content flex justify-content-c align-items-c">
<div class="context-core text-center line-height">
</div>
</div>
</template>
<script>
import { Image, Lazyload, Grid, GridItem, Toast } from 'vant'
import { saveShareRecord } from '@/api/ebiz/manpower/manpower'
export default {
components: {
[Toast.name]: Toast,
[Image.name]: Image,
[Grid.name]: Grid,
[GridItem.name]: GridItem,
[Lazyload.name]: Lazyload
},
data() {
return {
herfUrl: '',
time: 9,
requestRes: ''
}
},
mounted() {
Toast.loading({
message: '加载中...',
forbidClick: true,
duration: 0,
loadingType: 'spinner'
})
console.log(this.$route.query);
debugger
if (this.$route.query.token && this.$route.query.redirectUrl && this.$route.query.agentCode) {
this.herfUrl = this.$route.query.redirectUrl
this.$CacheUtils.setLocItem('token',this.$route.query.token);
this.initThisPage()
}
},
methods: {
// 初始化页面
async initThisPage() {
let res = await this.saveShareRecord('1',this.$route.query.token,this.$route.query.linkType)
if (this.herfUrl && res) {
window.location.href = this.herfUrl
}
},
/**
* 保存产品海报打开记录
* flag 0-分享 1-打开
* key redisKey
* linkType 类型
*/
saveShareRecord(flag,key,linkType) {
let data = {
linkType: linkType,
flag: flag,
redisKey: key
}
return new Promise((resolve) => {
saveShareRecord(data).then((res) => {
this.$toast.clear()
resolve(true)
})
})
}
}
}
</script>
<style lang="scss" scoped>
.loading-content {
width: 100vw;
height: 100vh;
flex-direction: column;
}
.next-step {
text-decoration: underline;
color: #5ca5ea;
}
</style>

View File

@@ -29,6 +29,8 @@
import { getPosterInfo, shareUrl, shareUrlWithQR } from '@/api/ebiz/poster/poster' import { getPosterInfo, shareUrl, shareUrlWithQR } from '@/api/ebiz/poster/poster'
import { getAgentInfo } from '@/api/ebiz/my/my' import { getAgentInfo } from '@/api/ebiz/my/my'
import config from '@/config' import config from '@/config'
import { getShareParam } from '@/api/ebiz/cardList/cardList.js'
import { saveShareRecord } from '@/api/ebiz/manpower/manpower'
export default { export default {
name: 'posterPreview', name: 'posterPreview',
data() { data() {
@@ -51,7 +53,8 @@ export default {
schoolName:"", schoolName:"",
className:"", className:"",
isShareLimit:'', isShareLimit:'',
shareLimitDesc:'' shareLimitDesc:'',
redisKey:''
} }
}, },
async created() { async created() {
@@ -65,22 +68,38 @@ export default {
await this.getShareImg() await this.getShareImg()
}, },
methods: { methods: {
shareFriends() { async shareFriends() {
if(this.isShareLimit=='1'){ if(this.isShareLimit=='1'){
this.$toast(this.shareLimitDesc) this.$toast(this.shareLimitDesc)
}else{ }else{
console.log('分享图片url'); if (this.posterType == 'product') {
console.log(this.imgUrl); let linkType = 'poster_'+this.id+'_'+this.posterInfo.posterName
// eslint-disable-next-line no-undef await this.saveShareRecord('0',this.redisKey,linkType)
EWebBridge.webCallAppInJs('bridge', {
flag: 'share',
extra: {
shareType: '1',
img: this.imgUrl
} }
}) // eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('bridge', {
flag: 'share',
extra: {
shareType: '1',
img: this.imgUrl
}
})
} }
}, },
/**
* 保存产品海报分享记录
* flag 0-分享 1-打开
* key redisKey
* linkType 'poster_'+海报id+海报名称
*/
saveShareRecord(flag,key,linkType) {
let data = {
linkType: linkType,
flag: flag,
redisKey: key
}
saveShareRecord(data)
},
async getPosterDetail() { async getPosterDetail() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.$toast.loading({ this.$toast.loading({
@@ -133,6 +152,12 @@ export default {
}, },
// 获取分享图片 // 获取分享图片
async getShareImg() { async getShareImg() {
if (this.posterType == 'product') {
let res = await getShareParam({shareType: 'card_poster'});
if (res.result == '0') {
this.redisKey = res.content
}
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.$toast.loading({ this.$toast.loading({
duration: 0, // 持续展示 toast duration: 0, // 持续展示 toast
@@ -152,6 +177,7 @@ export default {
} }
if (this.posterType == 'product') { if (this.posterType == 'product') {
params.redisKey = this.redisKey
shareUrlWithQR(params).then(res => { shareUrlWithQR(params).then(res => {
window.localStorage.removeItem('schoolName') window.localStorage.removeItem('schoolName')
window.localStorage.removeItem('className') window.localStorage.removeItem('className')
@@ -242,6 +268,7 @@ export default {
className:this.className className:this.className
} }
params.redisKey = this.redisKey
shareUrlWithQR(params).then(res => { shareUrlWithQR(params).then(res => {
this.$toast.clear() this.$toast.clear()
if (res.result == 0) { if (res.result == 0) {