mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-11 02:46:45 +08:00
【海报分享链接时效问题】-处理二维码为金掌桂页面链接 --提交人:白金岩
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
//保全 定义相关组件
|
||||
const posterList = () => import('@/views/ebiz/poster/PosterList')
|
||||
const posterPreview = () => import('@/views/ebiz/poster/PosterPreview')
|
||||
const posterLoading = () => import('@/views/ebiz/poster/PosterLoading')
|
||||
|
||||
export default [
|
||||
{
|
||||
@@ -20,5 +21,14 @@ export default [
|
||||
title: '海报预览',
|
||||
index: 2
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/poster/posterLoading',
|
||||
name: 'posterLoading',
|
||||
component: posterLoading,
|
||||
meta: {
|
||||
title: '跳转链接',
|
||||
index: 2
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
84
src/views/ebiz/poster/PosterLoading.vue
Normal file
84
src/views/ebiz/poster/PosterLoading.vue
Normal 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>
|
||||
@@ -29,6 +29,8 @@
|
||||
import { getPosterInfo, shareUrl, shareUrlWithQR } from '@/api/ebiz/poster/poster'
|
||||
import { getAgentInfo } from '@/api/ebiz/my/my'
|
||||
import config from '@/config'
|
||||
import { getShareParam } from '@/api/ebiz/cardList/cardList.js'
|
||||
import { saveShareRecord } from '@/api/ebiz/manpower/manpower'
|
||||
export default {
|
||||
name: 'posterPreview',
|
||||
data() {
|
||||
@@ -51,7 +53,8 @@ export default {
|
||||
schoolName:"",
|
||||
className:"",
|
||||
isShareLimit:'',
|
||||
shareLimitDesc:''
|
||||
shareLimitDesc:'',
|
||||
redisKey:''
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
@@ -65,22 +68,38 @@ export default {
|
||||
await this.getShareImg()
|
||||
},
|
||||
methods: {
|
||||
shareFriends() {
|
||||
async shareFriends() {
|
||||
if(this.isShareLimit=='1'){
|
||||
this.$toast(this.shareLimitDesc)
|
||||
}else{
|
||||
console.log('分享图片url');
|
||||
console.log(this.imgUrl);
|
||||
// eslint-disable-next-line no-undef
|
||||
EWebBridge.webCallAppInJs('bridge', {
|
||||
flag: 'share',
|
||||
extra: {
|
||||
shareType: '1',
|
||||
img: this.imgUrl
|
||||
if (this.posterType == 'product') {
|
||||
let linkType = 'poster_'+this.id+'_'+this.posterInfo.posterName
|
||||
await this.saveShareRecord('0',this.redisKey,linkType)
|
||||
}
|
||||
})
|
||||
// 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() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$toast.loading({
|
||||
@@ -133,6 +152,12 @@ export default {
|
||||
},
|
||||
// 获取分享图片
|
||||
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) => {
|
||||
this.$toast.loading({
|
||||
duration: 0, // 持续展示 toast
|
||||
@@ -152,6 +177,7 @@ export default {
|
||||
|
||||
}
|
||||
if (this.posterType == 'product') {
|
||||
params.redisKey = this.redisKey
|
||||
shareUrlWithQR(params).then(res => {
|
||||
window.localStorage.removeItem('schoolName')
|
||||
window.localStorage.removeItem('className')
|
||||
@@ -242,6 +268,7 @@ export default {
|
||||
className:this.className
|
||||
|
||||
}
|
||||
params.redisKey = this.redisKey
|
||||
shareUrlWithQR(params).then(res => {
|
||||
this.$toast.clear()
|
||||
if (res.result == 0) {
|
||||
|
||||
Reference in New Issue
Block a user