[锶源昆仑-寺庙捐赠活动]

This commit is contained in:
2023-05-15 13:53:32 +08:00
parent 1b6eb2668c
commit c9b18c9074
284 changed files with 9505 additions and 3822 deletions

View File

@@ -8,6 +8,11 @@
import { RouterMount, createRouter } from 'uni-simple-router';
import store from '../store/index'
import { jsdkInfo } from '@/apis/interfaces/user.js'
import { authFollow } from '@/apis/interfaces/authUrl'
const wx = require('jweixin-module')
const router = createRouter({
h5: {
paramsToQuery: true
@@ -23,6 +28,22 @@ const router = createRouter({
// 全局路由前置守卫
router.beforeEach((to, from, next) => {
const token = store.getters.getToken || uni.getStorageSync('token')
const openId = store.getters.getOpenId || uni.getStorageSync('openId')
// 检查是否需要微信授权
// if(to.name != 'weChatIndex' && openId === ''){
// authFollow({
// url: '/wechat?pageName=' + to.name
// }).then(res => {
// window.location.href = res
// }).catch(err => {
// uni.showToast({
// title: err.message,
// icon: "none"
// })
// })
// return
// }
// 检查是否需要登录
if(to.auth && token === ''){
next({
@@ -35,6 +56,26 @@ router.beforeEach((to, from, next) => {
return
}
next();
// 微信鉴权
jsdkInfo(window.location.href).then(res => {
let wxConfig = JSON.parse(res)
wx.config({
debug: false,
appId: wxConfig.appId,
timestamp: wxConfig.timestamp,
nonceStr: wxConfig.nonceStr,
signature: wxConfig.signature,
jsApiList: ['updateAppMessageShareData']
})
wx.ready(() => {
wx.updateAppMessageShareData({
title: '助力修缮庙宇,分享功德无量',
desc: '和我一起为西安禅经寺修缮添砖加瓦',
link: 'http://web.temple.siyuankunlun.cn/' + '?invite=' + store.getters.getIntive,
imgUrl: 'http://web.temple.siyuankunlun.cn/photo.png'
})
})
})
})
// 全局路由后置守卫