feat: 测试支付
This commit is contained in:
@@ -25,28 +25,40 @@ const Index = () => {
|
||||
|
||||
// 获取openid
|
||||
const getWxid = () => {
|
||||
let newparams = Taro.getCurrentInstance().router.params;
|
||||
let urlopenid = newparams.openid;
|
||||
// let newparams = Taro.getCurrentInstance().router.params;
|
||||
// let urlopenid = newparams.openid;
|
||||
|
||||
// hash模式
|
||||
// http://192.168.31.245:10086/?openid=o7LFAwR32hWGq9XOpd7ZxK1wZxq8#/pages/index/index
|
||||
let hashopenid=null
|
||||
if(window.location.href.includes('openid')){
|
||||
hashopenid=(window.location.href).split('#')[0].split('?')[1].split('=')[1]
|
||||
let hashopenid = null;
|
||||
if (window.location.href.includes("openid")) {
|
||||
window.alert(window.location.href);
|
||||
|
||||
hashopenid = window.location.href
|
||||
.split("#")[0]
|
||||
.split("?")[1]
|
||||
.split("=")[1];
|
||||
} else {
|
||||
hashopenid = window.localStorage.getItem("openid");
|
||||
}
|
||||
|
||||
// window.alert(urlopenid)
|
||||
|
||||
// window.alert(hashopenid)
|
||||
let newOpenid = window.localStorage.getItem("openid");
|
||||
// window.alert(newOpenid)
|
||||
|
||||
if (!!newOpenid && newOpenid!= 'undefined' || !!hashopenid&& hashopenid!= 'undefined' ) {
|
||||
// window.alert('存在')
|
||||
if (
|
||||
(!!newOpenid && newOpenid != "undefined" &&newOpenid != "null") ||
|
||||
(!!hashopenid && hashopenid != "undefined"&&hashopenid != "null")
|
||||
) {
|
||||
window.alert('存在')
|
||||
window.alert(hashopenid);
|
||||
window.alert(newOpenid);
|
||||
|
||||
window.localStorage.setItem("openid", hashopenid);
|
||||
// window.alert(urlopenid);
|
||||
} else {
|
||||
// window.alert('不存在')
|
||||
window.alert('不存在')
|
||||
let nowUrl = window.location.href;
|
||||
|
||||
|
||||
// window.alert(nowUrl)
|
||||
let payUrl = `https://payjs.cn/api/openid?mchid=1561724891&callback_url=${nowUrl}`;
|
||||
window.location.href = payUrl;
|
||||
@@ -197,11 +209,11 @@ const Index = () => {
|
||||
/>
|
||||
|
||||
<AtCard
|
||||
onClick={() => {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/meetup/Detail/index?id=20231206",
|
||||
});
|
||||
}}
|
||||
onClick={() => {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/meetup/Detail/index?id=20231206",
|
||||
});
|
||||
}}
|
||||
note=""
|
||||
extra=""
|
||||
title="[副业交流] 沙龙茶话会"
|
||||
|
||||
Reference in New Issue
Block a user