Files
hcb-h5/src/App.vue
T
小鱼开发 fbeccda5a0 init
2025-06-23 18:17:28 +08:00

67 lines
1.8 KiB
Vue

<script setup>
// 路由转发页面无需额外组件引入
import api from './utils/api.js';
// 获取当前URL参数
const urlParams = new URLSearchParams(window.location.search);
// const cfUid = urlParams.get('cfUid');
const friend_account_id = urlParams.get('friend_account_id');
const accountId = urlParams.get('accountId');
// 执行微信授权检查
try {
api.wechatAPI.checkAndLogin(window.location.href, accountId ? accountId : undefined,friend_account_id ? friend_account_id : undefined)
.then(result => {
if (result.redirecting) {
console.log('跳转微信授权中...');
} else if (result.success) {
console.log('微信授权成功,token:', result.token);
}
})
.catch(error => {
console.error('微信授权失败:', error);
});
} catch (error) {
console.error('授权初始化异常:', error);
}
</script>
<template>
<div id="app"
style="--van-button-danger-background:#f84803;--van-button-danger-border-color:#f84803;--van-button-radius:8px;">
<!-- 路由导航链接 -->
<!-- <nav class="nav">
<router-link to="/" class="nav-link">首页</router-link>
<router-link to="/about" class="nav-link">关于</router-link>
</nav> -->
<!-- 路由视图容器 -->
<!-- <transition name="fade" mode="out-in">
<router-view class="view-container" />
</transition> -->
<router-view class="view-container" v-slot="{ Component }">
<transition name="fade">
<component :is="Component" />
</transition>
</router-view>
</div>
</template>
<style scoped lang="scss">
/* 路由切换动画 */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
.fade-enter-to,
.fade-leave-from {
opacity: 1;
}
// @import "./style/pages/h5.scss";</style>