提交 08dc1c4a 编写于 作者: tao.wu's avatar tao.wu

优化微信分享组件

上级 adcff4f8
......@@ -9697,9 +9697,9 @@
"integrity": "sha512-gwtKq3QWbXMQpdHf7tFKQWYvknQBU+qJUFxLxskHL10mChguSkyl7CxFND1mafVApTH6N1qgAOKKQLILgaJhTw=="
},
"pica-wx-share": {
"version": "1.1.3",
"resolved": "http://192.168.110.93:4873/pica-wx-share/-/pica-wx-share-1.1.3.tgz",
"integrity": "sha512-iPUiTr4Gj0ndetUViqkNr9tPcJxycVFSMVlWCowQNe3mlZvfrFddKbD6AXLWB9Pc9aducYmYcTwGzX7s8PWspA==",
"version": "1.2.0",
"resolved": "http://192.168.110.93:4873/pica-wx-share/-/pica-wx-share-1.2.0.tgz",
"integrity": "sha512-n3eD91DADLLKzfDAncGSJ1TKZW78aVIQ7n+HivbZMrzC1bzq1+0wfkBrElcBPTCYSE62NMzBFrX6XvDme4eW+w==",
"requires": {
"axios": "^0.18.0",
"weixin-js-sdk": "^1.4.0-test"
......
......@@ -69,7 +69,6 @@ import { Toast } from 'vant';
import { remind, getRemindStatus, checkHospitalStatus, getCnt, checkToken } from '@/service';
import h5header from '@/components/h5header';
import shareContainer from '@/components/share-container';
import { BASE_URL } from '@/utils/enumerate';
export default {
// head() {
......@@ -152,16 +151,8 @@ export default {
this.scrollHandle();
// 微信分享
this.$picaWxShare({
// baseUrl: BASE_URL[process.env.NUXT_ENV_APP],
baseUrl: 'https://test1-sc.yunqueyi.com',
authUrl: window.location.href,
isDebug: false,
type: 15,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage'
]
type: (process.env.NUXT_ENV_APP != 'prod') ? 15 : '',
authUrl: wxShare.shareUrl
},(wx)=>{
const title = this.shareObj.title1;
const desc = this.shareObj.title2;
......
......@@ -55,7 +55,6 @@
<script>
import { getInviteInfo, getCourseById, getCaptchaGet, getAuthCode } from '@/service';
import { wxShare } from '@/configs/wxShare';
import { BASE_URL } from '@/utils/enumerate';
import { Base64 } from 'js-base64';
const queryString = require('query-string');
const TIMEALL = 60000; // 倒计时常量 60 秒
......@@ -73,7 +72,6 @@
time: TIMEALL,
btnMsg: '点击获取',
isReq: false,
shareObj: wxShare,
}
},
async asyncData({ query }){
......@@ -104,23 +102,16 @@
document.querySelector('body').setAttribute('style', 'background: #FE9A51;');
this.checkCache();
// 微信分享
this.shareObj.shareUrl = window.location.href;
window.localStorage.setItem('shareUrl', this.shareObj.shareUrl);
wxShare.shareUrl = window.location.href;
window.localStorage.setItem('shareUrl', wxShare.shareUrl);
this.$picaWxShare({
// baseUrl: BASE_URL[process.env.NUXT_ENV_APP],
baseUrl: 'https://test1-sc.yunqueyi.com',
type: 15,
authUrl: this.shareObj.shareUrl,
isDebug: false,
jsApiList: [
'onMenuShareTimeline',
'onMenuShareAppMessage'
]
type: (process.env.NUXT_ENV_APP != 'prod') ? 15 : '',
authUrl: wxShare.shareUrl,
},(wx)=>{
const title = this.shareObj.title1;
const desc = this.shareObj.title2;
const title = wxShare.title1;
const desc = wxShare.title2;
const link = window.localStorage.getItem('shareUrl') || window.location.href;
const imgUrl = this.shareObj.shareImageUrl;
const imgUrl = wxShare.shareImageUrl;
// 分享给朋友
wx.onMenuShareAppMessage({
title,desc,link,imgUrl
......
......@@ -54,11 +54,9 @@
<script>
import { wxShare } from '@/configs/wxShare';
import { BASE_URL } from '@/utils/enumerate';
export default {
data(){
return {
shareObj: wxShare,
statusTxt: ''
}
},
......@@ -66,22 +64,15 @@
this.statusTxt = (this.$route.query.status.toString()=='true') ? '领取成功' : '您已领取';
document.querySelector('body').setAttribute('style', 'background: "";');
// 微信分享
this.shareObj.shareUrl = window.location.href;
wxShare.shareUrl = window.location.href;
this.$picaWxShare({
// baseUrl: BASE_URL[process.env.NUXT_ENV_APP],
baseUrl: 'https://test1-sc.yunqueyi.com',
type: 15,
authUrl: this.shareObj.shareUrl,
isDebug: false,
jsApiList: [
'onMenuShareTimeline',
'onMenuShareAppMessage'
]
type: (process.env.NUXT_ENV_APP != 'prod') ? 15 : '',
authUrl: wxShare.shareUrl
},(wx)=>{
const title = this.shareObj.title1;
const desc = this.shareObj.title2;
const title = wxShare.title1;
const desc = wxShare.title2;
const link = window.localStorage.getItem('shareUrl') || window.location.href;
const imgUrl = this.shareObj.shareImageUrl;
const imgUrl = wxShare.shareImageUrl;
// 分享给朋友
wx.onMenuShareAppMessage({
title,desc,link,imgUrl
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册