diff --git a/src/App.vue b/src/App.vue index c360fd0..6a5e664 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,23 +1,58 @@ diff --git a/src/components/BindPhoneDialog.vue b/src/components/BindPhoneDialog.vue index 9dcb808..73dfe54 100644 --- a/src/components/BindPhoneDialog.vue +++ b/src/components/BindPhoneDialog.vue @@ -95,10 +95,20 @@ async function handleBind() { localStorage.setItem('refreshAfter', data.value.data.refreshAfter) localStorage.setItem('accessExpire', data.value.data.accessExpire) closeDialog(); - agentStore.fetchAgentStatus(); - userStore.fetchUserInfo(); + await Promise.all([ + agentStore.fetchAgentStatus(), + userStore.fetchUserInfo() + ]); + // 发出绑定成功的事件 - emit('bind-success') + emit('bind-success'); + + // 延迟执行路由检查,确保状态已更新 + setTimeout(() => { + // 重新触发路由检查 + const currentRoute = router.currentRoute.value; + router.replace(currentRoute.path); + }, 100); } else { showToast(data.value.msg); } diff --git a/src/components/GaugeChart.vue b/src/components/GaugeChart.vue index 8a5a3ed..4331751 100644 --- a/src/components/GaugeChart.vue +++ b/src/components/GaugeChart.vue @@ -1,9 +1,9 @@ @@ -18,10 +18,10 @@ const props = defineProps({ }, }); -// 根据分数计算风险等级和颜色 +// 根据分数计算风险等级和颜色(分数越高越安全) const riskLevel = computed(() => { const score = props.score; - if (score >= 0 && score <= 25) { + if (score >= 75 && score <= 100) { return { level: "无任何风险", color: "#52c41a", @@ -30,7 +30,7 @@ const riskLevel = computed(() => { { offset: 1, color: "#7fdb42" } ] }; - } else if (score > 25 && score <= 50) { + } else if (score >= 50 && score < 75) { return { level: "风险指数较低", color: "#faad14", @@ -39,7 +39,7 @@ const riskLevel = computed(() => { { offset: 1, color: "#ffc53d" } ] }; - } else if (score > 50 && score <= 75) { + } else if (score >= 25 && score < 50) { return { level: "风险指数较高", color: "#fa8c16", @@ -60,14 +60,14 @@ const riskLevel = computed(() => { } }); -// 评分解释文本 +// 评分解释文本(分数越高越安全) const riskDescription = computed(() => { const score = props.score; - if (score >= 0 && score <= 25) { + if (score >= 75 && score <= 100) { return "根据综合分析,当前报告未检测到明显风险因素,各项指标表现正常,总体状况良好。"; - } else if (score > 25 && score <= 50) { + } else if (score >= 50 && score < 75) { return "根据综合分析,当前报告存在少量风险信号,建议关注相关指标变化,保持警惕。"; - } else if (score > 50 && score <= 75) { + } else if (score >= 25 && score < 50) { return "根据综合分析,当前报告风险指数较高,多项指标显示异常,建议进一步核实相关情况。"; } else { return "根据综合分析,当前报告显示高度风险状态,多项重要指标严重异常,请立即采取相应措施。"; @@ -104,8 +104,8 @@ const updateChart = () => { center: ["50%", "80%"], itemStyle: { color: new echarts.graphic.LinearGradient(0, 0, 1, 0, risk.gradient), - shadowBlur: 10, - shadowColor: 'rgba(0, 0, 0, 0.2)', + shadowBlur: 6, + shadowColor: risk.color, }, progress: { show: true, @@ -121,39 +121,40 @@ const updateChart = () => { [1, new echarts.graphic.LinearGradient(0, 0, 1, 0, [ { offset: 0, - color: "rgba(0, 0, 0, 0.1)" + color: risk.color + "30" // 使用风险颜色,透明度20% }, { offset: 1, - color: "rgba(0, 0, 0, 0.05)" + color: risk.color + "25" // 使用风险颜色,透明度10% } ])] ] } }, axisTick: { - show: false + show: true, + distance: -30, + length: 6, + splitNumber: 10, // 每1分一个小刻度 + lineStyle: { + color: risk.color, + width: 1, + opacity: 0.5 + } }, splitLine: { show: true, - distance: -26, - length: 5, + distance: -36, + length: 12, + splitNumber: 9, // 9个大刻度,100分分成9个区间 lineStyle: { - color: "#999", - width: 2 + color: risk.color, + width: 2, + opacity: 0.5 } }, axisLabel: { - show: true, - distance: -8, - fontSize: 12, - color: "#999", - formatter: function (value) { - if (value % 20 === 0) { - return value; - } - return ""; - } + show: false, }, anchor: { show: false @@ -243,11 +244,9 @@ onUnmounted(() => { \ No newline at end of file diff --git a/src/components/QRcode.vue b/src/components/QRcode.vue index 0ac25e6..b978bdb 100644 --- a/src/components/QRcode.vue +++ b/src/components/QRcode.vue @@ -1,66 +1,86 @@ diff --git a/src/components/RealNameAuthDialog.vue b/src/components/RealNameAuthDialog.vue index 8f8cd43..95b51ac 100644 --- a/src/components/RealNameAuthDialog.vue +++ b/src/components/RealNameAuthDialog.vue @@ -155,172 +155,118 @@ function toPrivacyPolicy() { diff --git a/src/components/SectionTitle.vue b/src/components/SectionTitle.vue new file mode 100644 index 0000000..41a7fb2 --- /dev/null +++ b/src/components/SectionTitle.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/components/ShareReportButton.vue b/src/components/ShareReportButton.vue index 9ae9eab..a40d671 100644 --- a/src/components/ShareReportButton.vue +++ b/src/components/ShareReportButton.vue @@ -15,6 +15,10 @@ const props = defineProps({ type: Boolean, default: false, }, + disabled: { + type: Boolean, + default: false, + }, }); const isLoading = ref(false); @@ -29,7 +33,7 @@ const copyToClipboard = async (text) => { }; const handleShare = async () => { - if (isLoading.value) return; + if (isLoading.value || props.disabled) return; // 如果是示例模式,直接分享当前URL if (props.isExample) { @@ -115,26 +119,15 @@ const handleShare = async () => { diff --git a/src/components/StyledTabs.vue b/src/components/StyledTabs.vue new file mode 100644 index 0000000..96a2e42 --- /dev/null +++ b/src/components/StyledTabs.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/src/components/TitleBanner.vue b/src/components/TitleBanner.vue new file mode 100644 index 0000000..e606d21 --- /dev/null +++ b/src/components/TitleBanner.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/src/components/VerificationCard.vue b/src/components/VerificationCard.vue new file mode 100644 index 0000000..135a650 --- /dev/null +++ b/src/components/VerificationCard.vue @@ -0,0 +1,180 @@ + + + + + diff --git a/src/composables/useRiskNotifier.js b/src/composables/useRiskNotifier.js new file mode 100644 index 0000000..631874e --- /dev/null +++ b/src/composables/useRiskNotifier.js @@ -0,0 +1,18 @@ +import { watch } from "vue"; + +/** + * 风险评分通知 composable + * 用于组件向父组件通知自己的风险评分(0-100分,分数越高越安全) + */ +export function useRiskNotifier(props, riskScore) { + // 监听 riskScore 变化,通知父组件 + watch( + riskScore, + (newValue) => { + if (props.apiId && props.notifyRiskStatus) { + props.notifyRiskStatus(props.apiId, props.index, newValue); + } + }, + { immediate: true } + ); +} diff --git a/src/composables/useWeixinShare.js b/src/composables/useWeixinShare.js new file mode 100644 index 0000000..69836ba --- /dev/null +++ b/src/composables/useWeixinShare.js @@ -0,0 +1,234 @@ +import { ref } from "vue"; +import { useEnv } from "./useEnv"; + +export function useWeixinShare() { + const { isWeChat } = useEnv(); + const wxConfigReady = ref(false); + const signMap = new Map(); // 存储各个链接的签名信息 + + /** + * 从后端获取签名信息 + * @param {string} url - 需要签名的URL + * @returns {Promise} 签名信息 + */ + const getWxSignature = async (url) => { + try { + const { data, error } = await useApiFetch("/wechat/getSignature") + .post({ url }) + .json(); + + if (error.value || data.value?.code !== 200) { + console.error("获取微信签名失败:", error.value || data.value); + return null; + } + + return data.value.data; + } catch (err) { + console.error("获取微信签名异常:", err); + return null; + } + }; + + /** + * 配置微信SDK + * @param {Object} signature - 签名信息 + * @param {Object} shareConfig - 分享配置 + */ + const wxConfigJSSDK = (signature, shareConfig) => { + const { title, desc, link, imgUrl } = shareConfig; + + window.jWeixin.config({ + debug: false, // 生产环境设为false,开发时可设为true查看错误 + appId: signature.appId, + timestamp: signature.timestamp, + nonceStr: signature.nonceStr, + signature: signature.signature, + jsApiList: [ + "updateAppMessageShareData", + "updateTimelineShareData", + "onMenuShareAppMessage", + "onMenuShareTimeline", + ], + }); + + window.jWeixin.ready(() => { + console.log("微信SDK配置成功"); + + const shareData = { + title, + desc, + link, + imgUrl, + }; + + // 新版分享接口 - 分享给朋友 + window.jWeixin.updateAppMessageShareData({ + ...shareData, + success: function (res) { + console.log("分享给朋友配置成功", res); + }, + fail: function (err) { + console.error("分享给朋友配置失败", err); + }, + }); + + // 新版分享接口 - 分享到朋友圈 + window.jWeixin.updateTimelineShareData({ + ...shareData, + success: function (res) { + console.log("分享到朋友圈配置成功", res); + }, + fail: function (err) { + console.error("分享到朋友圈配置失败", err); + }, + }); + + // 兼容旧版微信 - 分享给朋友 + window.jWeixin.onMenuShareAppMessage({ + ...shareData, + success: function (res) { + console.log("分享给朋友成功", res); + }, + fail: function (err) { + console.error("分享给朋友失败", err); + }, + cancel: function () { + console.log("用户取消分享"); + }, + }); + + // 兼容旧版微信 - 分享到朋友圈 + window.jWeixin.onMenuShareTimeline({ + ...shareData, + success: function (res) { + console.log("分享到朋友圈成功", res); + }, + fail: function (err) { + console.error("分享到朋友圈失败", err); + }, + cancel: function () { + console.log("用户取消分享"); + }, + }); + + wxConfigReady.value = true; + }); + + window.jWeixin.error((res) => { + console.error("微信SDK配置失败:", res); + // 常见错误: + // 1. invalid url domain - 当前域名未在公众号后台配置 + // 2. invalid signature - 签名错误 + // 3. permission denied - 没有权限使用该接口 + }); + }; + + /** + * 配置微信分享 + * @param {Object} shareConfig - 分享配置 + * @param {string} shareConfig.title - 分享标题 + * @param {string} shareConfig.desc - 分享描述 + * @param {string} shareConfig.link - 分享链接 + * @param {string} shareConfig.imgUrl - 分享图标URL + */ + const configWeixinShare = async (shareConfig = {}) => { + console.log("configWeixinShare", shareConfig); + console.log("isWeChat", isWeChat.value); + console.log("window.jWeixin", window.jWeixin); + // 只在微信环境中配置 + if (!isWeChat.value || !window.jWeixin) { + console.log("非微信环境或微信SDK未加载"); + return; + } + + const defaultConfig = { + title: "天远数据|大数据风险报告查询与代理平台,支持个人和企业多场景风控应用", + desc: "提供个人信用评估、人事背调、信贷风控、企业风险监测等服务", + link: window.location.href.split("#")[0], // 获取当前页面URL,不包括hash + imgUrl: "https://www.tianyuandb.com/logo.jpg", + }; + + const config = { ...defaultConfig, ...shareConfig }; + + // 获取当前页面的完整URL(不包括hash) + const currentUrl = window.location.href.split("#")[0]; + + // 检查是否已有该URL的签名 + if (signMap.has(currentUrl)) { + console.log("使用缓存的签名信息"); + wxConfigJSSDK(signMap.get(currentUrl), config); + return; + } + + // 从后端获取签名 + console.log("正在获取微信签名..."); + const signature = await getWxSignature(currentUrl); + + if (!signature) { + console.error("获取微信签名失败,无法配置分享"); + return; + } + + // 缓存签名信息 + signMap.set(currentUrl, signature); + + // 配置微信SDK + wxConfigJSSDK(signature, config); + }; + + /** + * 动态更新分享配置 + * @param {Object} shareConfig - 分享配置 + */ + const updateShareConfig = (shareConfig) => { + configWeixinShare(shareConfig); + }; + + /** + * 根据当前页面动态设置分享内容 + */ + const setDynamicShare = async () => { + const route = window.location.pathname; + let shareConfig = {}; + + // 根据不同的路由设置不同的分享内容 + if (route.includes("/example")) { + shareConfig = { + title: "天远数据 - 大数据风险报告示例", + desc: "查看完整的大数据风险报告示例,了解个人信用评估等服务", + link: window.location.href.split("#")[0], + imgUrl: "https://www.tianyuandb.com/logo.jpg", + }; + } else if (route.includes("/agent")) { + shareConfig = { + title: "天远数据 - 免费开通代理权限", + desc: "免费开通代理权限,享受大数据风险报告查询服务代理收益", + link: window.location.href.split("#")[0], + imgUrl: "https://www.tianyuandb.com/logo.jpg", + }; + } else if (route.includes("/help")) { + shareConfig = { + title: "天远数据 - 帮助中心", + desc: "详细的使用指南、常见问题解答、操作教程", + link: window.location.href.split("#")[0], + imgUrl: "https://www.tianyuandb.com/logo.jpg", + }; + } else { + shareConfig = { + title: "天远数据|大数据风险报告查询与代理平台,支持个人和企业多场景风控应用", + desc: "提供个人信用评估、人事背调、信贷风控、企业风险监测等服务", + link: window.location.href.split("#")[0], + imgUrl: "https://www.tianyuandb.com/logo.jpg", + }; + } + + await configWeixinShare(shareConfig); + }; + + return { + wxConfigReady, + configWeixinShare, + updateShareConfig, + setDynamicShare, + }; +} diff --git a/src/layouts/HomeLayout.vue b/src/layouts/HomeLayout.vue index 127f6a6..f014db5 100644 --- a/src/layouts/HomeLayout.vue +++ b/src/layouts/HomeLayout.vue @@ -21,8 +21,8 @@
- - 投诉 + 投诉 + 投诉
@@ -98,7 +98,7 @@ const toComplaint = () => { diff --git a/src/ui/CDWBG8B4D/components/LeasingRiskSection.vue b/src/ui/CDWBG8B4D/components/LeasingRiskSection.vue index 81d74aa..1e2d44d 100644 --- a/src/ui/CDWBG8B4D/components/LeasingRiskSection.vue +++ b/src/ui/CDWBG8B4D/components/LeasingRiskSection.vue @@ -1,459 +1,335 @@ diff --git a/src/ui/CDWBG8B4D/components/LoanEvaluationSection.vue b/src/ui/CDWBG8B4D/components/LoanEvaluationSection.vue index 502835e..6fab3aa 100644 --- a/src/ui/CDWBG8B4D/components/LoanEvaluationSection.vue +++ b/src/ui/CDWBG8B4D/components/LoanEvaluationSection.vue @@ -1,336 +1,301 @@ diff --git a/src/ui/CDWBG8B4D/components/OverdueRiskSection.vue b/src/ui/CDWBG8B4D/components/OverdueRiskSection.vue index 7a55364..35af1de 100644 --- a/src/ui/CDWBG8B4D/components/OverdueRiskSection.vue +++ b/src/ui/CDWBG8B4D/components/OverdueRiskSection.vue @@ -1,292 +1,301 @@ - diff --git a/src/ui/CDWBG8B4D/components/ReportOverview.vue b/src/ui/CDWBG8B4D/components/ReportOverview.vue index 4ec4c1f..8d0d02e 100644 --- a/src/ui/CDWBG8B4D/components/ReportOverview.vue +++ b/src/ui/CDWBG8B4D/components/ReportOverview.vue @@ -1,26 +1,20 @@ - + diff --git a/src/ui/CDWBG8B4D/components/RiskSupervisionSection.vue b/src/ui/CDWBG8B4D/components/RiskSupervisionSection.vue index 6180e67..f5f48b1 100644 --- a/src/ui/CDWBG8B4D/components/RiskSupervisionSection.vue +++ b/src/ui/CDWBG8B4D/components/RiskSupervisionSection.vue @@ -1,76 +1,91 @@ diff --git a/src/ui/CDWBG8B4D/components/RiskWarning.vue b/src/ui/CDWBG8B4D/components/RiskWarning.vue index 9c3cc6f..211cb48 100644 --- a/src/ui/CDWBG8B4D/components/RiskWarning.vue +++ b/src/ui/CDWBG8B4D/components/RiskWarning.vue @@ -1,117 +1,116 @@ diff --git a/src/ui/CDWBG8B4D/components/RiskWarningSection.vue b/src/ui/CDWBG8B4D/components/RiskWarningSection.vue index fea97b5..4367111 100644 --- a/src/ui/CDWBG8B4D/components/RiskWarningSection.vue +++ b/src/ui/CDWBG8B4D/components/RiskWarningSection.vue @@ -9,7 +9,9 @@
- + +
总风险统计 @@ -19,7 +21,7 @@
总风险点数量
- +
@@ -46,7 +48,8 @@
- +
要素核查 @@ -78,7 +81,8 @@
- +
运营商核验 @@ -110,7 +114,9 @@
- + +
公安重点人员核验 @@ -142,7 +148,9 @@
- + +
逾期风险 @@ -174,7 +182,9 @@
- + +
法院曝光台信息 @@ -206,7 +216,8 @@
- +
借贷评估 @@ -238,7 +249,9 @@
- + +
租赁风险评估 @@ -265,24 +278,38 @@
- + - + diff --git a/src/ui/CFLXG3D56.vue b/src/ui/CFLXG3D56.vue index 8a65730..1a358e6 100644 --- a/src/ui/CFLXG3D56.vue +++ b/src/ui/CFLXG3D56.vue @@ -1,12 +1,25 @@