74 lines
1.9 KiB
Vue
74 lines
1.9 KiB
Vue
<template>
|
||
<view>
|
||
<p style="font-size:16px; text-align: center;" @tap="bugbugbug">正在跳转...</p>
|
||
<view v-if="vdata.showBizData">
|
||
<p style="font-size:12px; text-align: center;">bizData:{{ vdata.bizData }}</p>
|
||
</view>
|
||
</view>
|
||
|
||
</template>
|
||
|
||
<script setup>
|
||
import { onLoad } from '@dcloudio/uni-app'
|
||
import appConfig from '@/config/appConfig.js'
|
||
import { setToken } from '@/util/jeepayTokenUtil.js'
|
||
import { $getChannelUserId } from '@/http/apiManager.js'
|
||
import storageManage from '@/util/storageManage.js'
|
||
import { navigateTo } from "@/util/member.js"
|
||
import { onMounted, reactive } from 'vue'
|
||
|
||
const vdata = reactive({
|
||
showBizData:false,
|
||
bizData: {}
|
||
})
|
||
|
||
// uniapp 的钩子事件(同步), 一般用作获取到页面传参
|
||
// 通用放置token & 如果获取异常 将跳转到错误页面;
|
||
onLoad( (toPageParams) => setToken(toPageParams) )
|
||
|
||
// vue mounted 钩子事件
|
||
onMounted( () => {
|
||
|
||
// 获取userId
|
||
|
||
$getChannelUserId(Object.assign({jeepayResType: 'channelUserJSON'}, searchToObject())).then( ({bizData}) => {
|
||
appConfig.channelUserId = bizData.channelUserId;
|
||
|
||
// 保存到localStorage
|
||
if(bizData.channelUserIdCacheKey){
|
||
storageManage.channelUserId(bizData.channelUserIdCacheKey, bizData.channelUserId)
|
||
}
|
||
navigateTo(bizData.channelUserId)
|
||
|
||
vdata.bizData = bizData
|
||
})
|
||
})
|
||
|
||
function searchToObject() {
|
||
|
||
if(!window.location.search){
|
||
return {};
|
||
}
|
||
|
||
var pairs = window.location.search.substring(1).split("&"),
|
||
result = {},
|
||
pair,
|
||
i;
|
||
for ( i in pairs ) {
|
||
if ( pairs[i] === "" ) continue;
|
||
pair = pairs[i].split("=");
|
||
result[ decodeURIComponent( pair[0] ) ] = decodeURIComponent( pair[1] );
|
||
}
|
||
return result;
|
||
}
|
||
|
||
function bugbugbug() {
|
||
vdata.showBizData = true
|
||
}
|
||
|
||
</script>
|
||
|
||
|
||
<style>
|
||
</style>
|