剩下兑奖逻辑
This commit is contained in:
@@ -1,44 +1,36 @@
|
||||
import wx from 'weixin-js-sdk';
|
||||
import axios from "axios";
|
||||
import { Toast } from "vant";
|
||||
import {getShareConfig } from '@/api'
|
||||
|
||||
const imgUrl = new URL(`@/assets/images/share.jpg`, import.meta.url).href
|
||||
const linkUrl = import.meta.env.VITE_HOST + import.meta.env.VITE_FOLDER
|
||||
|
||||
export function wxShare(option) {
|
||||
let url = location.href.split('#')[0];
|
||||
axios.get('https://wx.xfhd.net/wxapi/api/jsconfig?appid=wx41d80a1bb01f658d', {
|
||||
params: { url }
|
||||
})
|
||||
let url = location.href.split("#")[0];
|
||||
getShareConfig({url:url})
|
||||
.then((res) => {
|
||||
console.log('分享配置:', {
|
||||
'title': option.title,
|
||||
'desc': option.desc,
|
||||
'link': import.meta.env.VITE_URL
|
||||
'link': url
|
||||
});
|
||||
|
||||
let data = res.data;
|
||||
wx.config({
|
||||
debug: false, // 开启调试模式
|
||||
appId: data.appId, // 必填,公众号的唯一标识
|
||||
appId: 'wxc2bc9f9e8d19b504', // 必填,公众号的唯一标识
|
||||
timestamp: data.timestamp, // 必填,生成签名的时间戳
|
||||
nonceStr: data.nonceStr, // 必填,生成签名的随机串
|
||||
signature: data.signature, // 必填,签名,见附录1
|
||||
jsApiList: [
|
||||
'checkJsApi',
|
||||
'chooseImage',
|
||||
'closeWindow',
|
||||
'chooseWXPay',
|
||||
'scanQRCode',
|
||||
'showMenuItems',
|
||||
'onMenuShareAppMessage',
|
||||
'onMenuShareTimeline',
|
||||
] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
||||
})
|
||||
wx.ready(function () {
|
||||
wx.hideMenuItems({
|
||||
menuList: ["menuItem:copyUrl", "menuItem:share:appMessage", "menuItem:share:timeline"] // 屏蔽复制链接
|
||||
});
|
||||
wx.onMenuShareTimeline({
|
||||
link: import.meta.env.VITE_URL, // 分享链接
|
||||
title: option.title, // 分享标题
|
||||
|
||||
Reference in New Issue
Block a user