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

优化微信分享组件

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