version temp2
59
src/App.vue
@@ -1,23 +1,58 @@
|
||||
<script setup>
|
||||
import { RouterLink, RouterView } from "vue-router";
|
||||
import { RouterLink, RouterView, useRouter } from "vue-router";
|
||||
const { isWeChat } = useEnv();
|
||||
import { useAgentStore } from "@/stores/agentStore";
|
||||
import { useUserStore } from "@/stores/userStore";
|
||||
import { useDialogStore } from "@/stores/dialogStore";
|
||||
import { useAuthStore } from "@/stores/authStore";
|
||||
import { useWeixinShare } from "@/composables/useWeixinShare";
|
||||
|
||||
const router = useRouter();
|
||||
const agentStore = useAgentStore();
|
||||
const userStore = useUserStore();
|
||||
const dialogStore = useDialogStore();
|
||||
const authStore = useAuthStore();
|
||||
const { configWeixinShare, setDynamicShare } = useWeixinShare();
|
||||
|
||||
onMounted(() => {
|
||||
// 检查token版本,如果版本不匹配则清除旧token
|
||||
checkTokenVersion()
|
||||
|
||||
// 恢复微信授权状态(页面刷新后)
|
||||
authStore.restoreFromStorage();
|
||||
|
||||
// 检查是否是微信授权回调
|
||||
const url = new URL(window.location.href);
|
||||
const hasWeixinCode = url.searchParams.has('code') && url.searchParams.has('state');
|
||||
|
||||
if (hasWeixinCode) {
|
||||
// 如果是授权回调,标记为正在授权
|
||||
authStore.startWeixinAuth();
|
||||
}
|
||||
|
||||
RefreshToken();
|
||||
const token = localStorage.getItem("token");
|
||||
if (token) {
|
||||
agentStore.fetchAgentStatus();
|
||||
userStore.fetchUserInfo();
|
||||
}
|
||||
|
||||
// 配置微信分享
|
||||
// 延迟执行,确保微信SDK已加载
|
||||
setTimeout(async () => {
|
||||
if (isWeChat.value && window.jWeixin) {
|
||||
await setDynamicShare();
|
||||
}
|
||||
}, 500);
|
||||
|
||||
// 监听路由变化,更新微信分享配置
|
||||
router.afterEach(() => {
|
||||
setTimeout(async () => {
|
||||
if (isWeChat.value && window.jWeixin) {
|
||||
await setDynamicShare();
|
||||
}
|
||||
}, 300);
|
||||
});
|
||||
});
|
||||
|
||||
const checkTokenVersion = () => {
|
||||
@@ -105,7 +140,9 @@ const h5WeixinLogin = async () => {
|
||||
// 获取特定参数值
|
||||
const code = params.get("code");
|
||||
const state = params.get("state");
|
||||
|
||||
if (code && state) {
|
||||
// 这是微信授权回调,处理授权结果
|
||||
const { data, error } = await useApiFetch("/user/wxh5Auth")
|
||||
.post({ code })
|
||||
.json();
|
||||
@@ -130,11 +167,27 @@ const h5WeixinLogin = async () => {
|
||||
}?${params.toString()}`;
|
||||
window.history.replaceState({}, "", newUrl);
|
||||
|
||||
agentStore.fetchAgentStatus();
|
||||
userStore.fetchUserInfo();
|
||||
// 标记微信授权完成
|
||||
authStore.completeWeixinAuth();
|
||||
|
||||
// 获取用户和代理信息
|
||||
await Promise.all([
|
||||
agentStore.fetchAgentStatus(),
|
||||
userStore.fetchUserInfo()
|
||||
]);
|
||||
|
||||
// 如果有待处理的路由,跳转到该路由
|
||||
if (authStore.pendingRoute) {
|
||||
router.replace(authStore.pendingRoute);
|
||||
authStore.clearPendingRoute();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 没有授权参数,需要开始微信授权
|
||||
// 保存当前路由作为授权完成后的目标路由
|
||||
const currentRoute = router.currentRoute.value;
|
||||
authStore.startWeixinAuth(currentRoute);
|
||||
h5WeixinGetCode();
|
||||
}
|
||||
};
|
||||
|
||||
BIN
src/assets/images/homelayout/index.png
Normal file
|
After Width: | Height: | Size: 435 B |
BIN
src/assets/images/homelayout/index_active.png
Normal file
|
After Width: | Height: | Size: 397 B |
BIN
src/assets/images/homelayout/me.png
Normal file
|
After Width: | Height: | Size: 473 B |
BIN
src/assets/images/homelayout/me_active.png
Normal file
|
After Width: | Height: | Size: 509 B |
BIN
src/assets/images/homelayout/promote.png
Normal file
|
After Width: | Height: | Size: 566 B |
BIN
src/assets/images/homelayout/promote_active.png
Normal file
|
After Width: | Height: | Size: 590 B |
BIN
src/assets/images/homelayout/ts.png
Normal file
|
After Width: | Height: | Size: 311 B |
BIN
src/assets/images/index/Frame (1).png
Normal file
|
After Width: | Height: | Size: 272 B |
BIN
src/assets/images/index/banner.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
src/assets/images/index/bg_icon.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/assets/images/index/bzzx.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
src/assets/images/index/company_bg.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
src/assets/images/index/cwhy.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src/assets/images/index/go_icon.png
Normal file
|
After Width: | Height: | Size: 272 B |
BIN
src/assets/images/index/loan_check_bg.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
src/assets/images/index/lxkf.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
src/assets/images/index/personal_data_bg.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
src/assets/images/index/right.png
Normal file
|
After Width: | Height: | Size: 413 B |
BIN
src/assets/images/index/srmx.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
src/assets/images/index/tgbg.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src/assets/images/index/wdbg.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
src/assets/images/index/wytx.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
src/assets/images/index/yqhy.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
src/assets/images/me/bg.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
src/assets/images/me/ckjlmx.png
Normal file
|
After Width: | Height: | Size: 320 B |
BIN
src/assets/images/me/cksymx.png
Normal file
|
After Width: | Height: | Size: 298 B |
BIN
src/assets/images/me/ckwdxj.png
Normal file
|
After Width: | Height: | Size: 367 B |
BIN
src/assets/images/me/cwbg.png
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
src/assets/images/me/djje.png
Normal file
|
After Width: | Height: | Size: 428 B |
BIN
src/assets/images/me/dlbgpz.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src/assets/images/me/hyxjjl.png
Normal file
|
After Width: | Height: | Size: 317 B |
BIN
src/assets/images/me/jt.png
Normal file
|
After Width: | Height: | Size: 211 B |
BIN
src/assets/images/me/login_bg.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
src/assets/images/me/logout.png
Normal file
|
After Width: | Height: | Size: 363 B |
BIN
src/assets/images/me/lxkf.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/images/me/right.png
Normal file
|
After Width: | Height: | Size: 241 B |
BIN
src/assets/images/me/sy.png
Normal file
|
After Width: | Height: | Size: 332 B |
BIN
src/assets/images/me/tx.png
Normal file
|
After Width: | Height: | Size: 328 B |
BIN
src/assets/images/me/txjl.png
Normal file
|
After Width: | Height: | Size: 283 B |
BIN
src/assets/images/me/user.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
src/assets/images/me/wdbg.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/assets/images/me/xfhy.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src/assets/images/me/xjtgjl.png
Normal file
|
After Width: | Height: | Size: 409 B |
BIN
src/assets/images/me/xjzhjl.png
Normal file
|
After Width: | Height: | Size: 460 B |
BIN
src/assets/images/me/xzhyjl.png
Normal file
|
After Width: | Height: | Size: 397 B |
BIN
src/assets/images/me/ye.png
Normal file
|
After Width: | Height: | Size: 430 B |
BIN
src/assets/images/me/yhxy.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/assets/images/me/yszc.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
src/assets/images/me/yxbg.png
Normal file
|
After Width: | Height: | Size: 298 B |
BIN
src/assets/images/me/ztbgsy.png
Normal file
|
After Width: | Height: | Size: 459 B |
BIN
src/assets/images/report/Frame (44).png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
src/assets/images/report/dqfx_inquire_bg.png
Normal file
|
After Width: | Height: | Size: 147 KiB |
BIN
src/assets/images/report/dqfx_report_bg.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
src/assets/images/report/dwtz.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/assets/images/report/fqzgz.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/assets/images/report/fqzpf.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src/assets/images/report/fx.png
Normal file
|
After Width: | Height: | Size: 286 B |
BIN
src/assets/images/report/gazdry.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
src/assets/images/report/gfx.png
Normal file
|
After Width: | Height: | Size: 504 B |
BIN
src/assets/images/report/gl.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
src/assets/images/report/glsfz.png
Normal file
|
After Width: | Height: | Size: 619 B |
BIN
src/assets/images/report/glsjh.png
Normal file
|
After Width: | Height: | Size: 493 B |
BIN
src/assets/images/report/grdsj_inquire_bg.png
Normal file
|
After Width: | Height: | Size: 152 KiB |
BIN
src/assets/images/report/grdsj_report_bg.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
src/assets/images/report/hktj.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/assets/images/report/ip.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src/assets/images/report/jd.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
src/assets/images/report/jd2.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
src/assets/images/report/jdpg.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/assets/images/report/jyyc.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
src/assets/images/report/qsgg.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
src/assets/images/report/rzls.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/assets/images/report/sdsz.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
src/assets/images/report/sffx.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/assets/images/report/sfz.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
src/assets/images/report/shjy.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src/assets/images/report/sjh.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/assets/images/report/slbg_inquire_icon.png
Normal file
|
After Width: | Height: | Size: 366 B |
BIN
src/assets/images/report/srbq.png
Normal file
|
After Width: | Height: | Size: 414 B |
BIN
src/assets/images/report/sswf.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
src/assets/images/report/swfx.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
src/assets/images/report/title.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/images/report/title_inquire_bg.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src/assets/images/report/wmz.png
Normal file
|
After Width: | Height: | Size: 656 B |
BIN
src/assets/images/report/wxts.png
Normal file
|
After Width: | Height: | Size: 657 B |
BIN
src/assets/images/report/wxts_icon.png
Normal file
|
After Width: | Height: | Size: 957 B |
BIN
src/assets/images/report/xwqy_inquire_bg.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
src/assets/images/report/xwqy_report_bg.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
src/assets/images/report/xypf.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/assets/images/report/xzcf.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/assets/images/report/yj.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/assets/images/report/yqfx.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/assets/images/report/yshc.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
src/assets/images/report/ywlx.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/assets/images/report/yzgz.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/assets/images/report/zfx.png
Normal file
|
After Width: | Height: | Size: 499 B |
BIN
src/assets/images/report/zk.png
Normal file
|
After Width: | Height: | Size: 564 B |
BIN
src/assets/images/report/zlfx.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
src/assets/images/report/zq.png
Normal file
|
After Width: | Height: | Size: 664 B |