| | |
| | | import wx from 'weixin-js-sdk' |
| | | import axios from './axios' |
| | | import $qxueyou from '@/config/qxueyou.js' |
| | | import { isWeixin, isMobile } from '@/utils/UA.js' |
| | | import { isWeixin, isMobile, isiOS } from '@/utils/UA.js' |
| | | |
| | | let newFeature = false |
| | | let oldShare = ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareQZone'] |
| | |
| | | |
| | | /** |
| | | * 微信获取签名 |
| | | * @param {*} toRoute 目标路由 |
| | | */ |
| | | function getWxSignature(toRoute) { |
| | | function getWxSignature() { |
| | | if (!weixinFlag) { return false } |
| | | |
| | | let signUrl = getSignUrl() |
| | | |
| | | axios.get('/system/wx/js/signature', { |
| | | params: { url: location.href } |
| | | params: { url: window.location.href } |
| | | }).then(res => { |
| | | if (!res || !res.data) { |
| | | return false |
| | |
| | | }) |
| | | } |
| | | |
| | | function getSignUrl() { |
| | | const currentUrl = window.location.href.split('#')[0] |
| | | |
| | | if (isiOS) { |
| | | const cachedEntryUrl = sessionStorage.getItem('qxyKwWxVerifyEntryUrl') |
| | | if (!cachedEntryUrl) { |
| | | sessionStorage.setItem('qxyKwWxVerifyEntryUrl', currentUrl) |
| | | return currentUrl |
| | | } |
| | | return cachedEntryUrl |
| | | } |
| | | return currentUrl |
| | | } |
| | | |
| | | function chooseImage(){ |
| | | return new Promise((resolve) => { |
| | | wx.chooseImage({ |