|
|
@@ -518,6 +518,90 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
+ <!-- 账户信息提示弹窗 -->
|
|
|
+ <div
|
|
|
+ v-if="showAccountInfoDialog"
|
|
|
+ class="fixed inset-0 bg-black/50 flex items-center justify-center z-[9999]"
|
|
|
+ @click.self="showAccountInfoDialog = false"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="bg-surface border border-white/10 rounded-2xl p-6 w-full max-w-md mx-4"
|
|
|
+ >
|
|
|
+ <!-- 提示图标 -->
|
|
|
+ <div class="mb-4">
|
|
|
+ <div
|
|
|
+ class="w-12 h-12 mx-auto bg-yellow-500/20 rounded-full flex items-center justify-center"
|
|
|
+ >
|
|
|
+ <svg
|
|
|
+ class="w-6 h-6 text-yellow-400"
|
|
|
+ fill="none"
|
|
|
+ stroke="currentColor"
|
|
|
+ viewBox="0 0 24 24"
|
|
|
+ >
|
|
|
+ <path
|
|
|
+ stroke-linecap="round"
|
|
|
+ stroke-linejoin="round"
|
|
|
+ stroke-width="2"
|
|
|
+ d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
|
|
|
+ />
|
|
|
+ </svg>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 提示信息 -->
|
|
|
+ <h3 class="text-lg font-semibold text-white/90 mb-4 text-center">
|
|
|
+ 重要提示
|
|
|
+ </h3>
|
|
|
+ <div
|
|
|
+ class="bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-4 mb-6"
|
|
|
+ >
|
|
|
+ <p class="text-sm text-yellow-200 mb-3">
|
|
|
+ 您还未成为正式用户,请务必记录以下账户信息:
|
|
|
+ </p>
|
|
|
+ <div class="space-y-2">
|
|
|
+ <div class="flex items-center justify-between">
|
|
|
+ <span class="text-sm text-white/70">用户名:</span>
|
|
|
+ <span class="text-sm font-mono font-semibold text-white/90">
|
|
|
+ {{ userStore.userInfo?.name || "未知" }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="flex items-center justify-between">
|
|
|
+ <span class="text-sm text-white/70">默认密码:</span>
|
|
|
+ <span class="text-sm font-mono font-semibold text-white/90">
|
|
|
+ password123
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="flex flex-col gap-2">
|
|
|
+ <span class="text-sm text-white/70">防丢网址:</span>
|
|
|
+ <div class="space-y-1">
|
|
|
+ <div
|
|
|
+ v-for="(domain, index) in domains"
|
|
|
+ :key="index"
|
|
|
+ class="text-sm font-mono font-semibold text-white/90"
|
|
|
+ >
|
|
|
+ {{ domain }}
|
|
|
+ </div>
|
|
|
+ <div v-if="domains.length === 0" class="text-sm font-mono font-semibold text-white/90">
|
|
|
+ 加载中...
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <p class="text-xs text-yellow-200/80 mt-3">
|
|
|
+ 请妥善保管您的账户信息,建议尽快升级为正式用户并修改密码。
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 确认按钮 -->
|
|
|
+ <button
|
|
|
+ @click="closeAccountInfoDialog"
|
|
|
+ class="w-full px-4 py-2 bg-brand text-slate-900 rounded-lg hover:bg-brand/90 transition"
|
|
|
+ >
|
|
|
+ 我已记录
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<!-- 分享链接弹窗 -->
|
|
|
<ShareDialog
|
|
|
v-model="showShareLinkDialog"
|
|
|
@@ -687,12 +771,15 @@ import {
|
|
|
purchaseMember,
|
|
|
userQueryOrder,
|
|
|
checkSinglePurchase,
|
|
|
+ getSuperDomain,
|
|
|
+ recordPageClick,
|
|
|
} from "@/services/api";
|
|
|
import VideoJSPlayer from "@/components/VideoJSPlayer.vue";
|
|
|
import ShareDialog from "@/components/ShareDialog.vue";
|
|
|
import { useUserStore } from "@/store/user";
|
|
|
import { usePriceStore } from "@/store/price";
|
|
|
import { handleShareLinkAccess } from "@/services/shareApi";
|
|
|
+import { decryptRefParam } from "@/utils/crypto";
|
|
|
|
|
|
// 路由相关
|
|
|
const route = useRoute();
|
|
|
@@ -700,7 +787,7 @@ const router = useRouter();
|
|
|
|
|
|
// 用户信息
|
|
|
const userStore = useUserStore();
|
|
|
-const { isLoginUser, isVipUser } = storeToRefs(userStore);
|
|
|
+const { isLoginUser, isVipUser, isGuestUser } = storeToRefs(userStore);
|
|
|
|
|
|
// 价格配置
|
|
|
const priceStore = usePriceStore();
|
|
|
@@ -769,11 +856,71 @@ const singleCurrentOrderNo = ref("");
|
|
|
const isUserSynced = ref(false);
|
|
|
|
|
|
// 会员购买按钮点击
|
|
|
-const handleMembershipClick = () => {
|
|
|
+const handleMembershipClick = async () => {
|
|
|
// 特殊游览器滚动
|
|
|
specialBrowserScroll();
|
|
|
|
|
|
- // 已登录,显示购买弹窗
|
|
|
+ // 如果用户未登录,先创建账号并获取价格
|
|
|
+ if (!isLoginUser.value) {
|
|
|
+ try {
|
|
|
+ // 获取 URL 参数
|
|
|
+ const urlParams = new URLSearchParams(window.location.search);
|
|
|
+ const inviteCode = urlParams.get("code");
|
|
|
+ const memberCode = urlParams.get("memberCode");
|
|
|
+ const refParam = urlParams.get("ref");
|
|
|
+ const ivParam = urlParams.get("iv");
|
|
|
+
|
|
|
+ // 优先使用URL中的code参数,如果没有则使用memberCode
|
|
|
+ const codeToUse = inviteCode || memberCode || localStorage.getItem("memberCode");
|
|
|
+
|
|
|
+ // 如果存在 ref 参数,尝试解密
|
|
|
+ let decryptedRef: string | null = null;
|
|
|
+ if (refParam) {
|
|
|
+ decryptedRef = await decryptRefParam(refParam, ivParam || undefined);
|
|
|
+ if (!decryptedRef) {
|
|
|
+ // 如果解密失败,可能 ref 参数本身就是未加密的,使用原始值
|
|
|
+ decryptedRef = refParam;
|
|
|
+ }
|
|
|
+ // 保存解密后的 ref 到 localStorage 供注册时使用
|
|
|
+ if (decryptedRef) {
|
|
|
+ localStorage.setItem("ref", decryptedRef);
|
|
|
+ console.log("保存ref到localStorage:", decryptedRef);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取当前落地域名
|
|
|
+ const landingDomain = window.location.hostname;
|
|
|
+
|
|
|
+ // 创建游客账户(会自动获取价格配置)
|
|
|
+ const guestResponse = await userStore.createGuest(
|
|
|
+ codeToUse || undefined,
|
|
|
+ decryptedRef || undefined,
|
|
|
+ landingDomain || undefined
|
|
|
+ );
|
|
|
+
|
|
|
+ if (!guestResponse) {
|
|
|
+ showError("创建账户失败,请重试");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error("创建账户失败:", error);
|
|
|
+ showError("创建账户失败,请重试");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 确保价格配置已加载(团队相关价格可能不同)
|
|
|
+ if (!priceStore.isPriceConfigLoaded) {
|
|
|
+ try {
|
|
|
+ await priceStore.fetchPriceConfig();
|
|
|
+ } catch (error) {
|
|
|
+ console.error("价格配置加载失败:", error);
|
|
|
+ showError("价格配置加载失败,请重试");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 显示购买弹窗
|
|
|
showMembershipPurchaseModal.value = true;
|
|
|
};
|
|
|
|
|
|
@@ -782,8 +929,57 @@ const handleSinglePurchaseClick = async () => {
|
|
|
// 特殊游览器滚动
|
|
|
specialBrowserScroll();
|
|
|
|
|
|
+ // 如果用户未登录,先创建账号并获取价格
|
|
|
+ if (!isLoginUser.value) {
|
|
|
+ try {
|
|
|
+ // 获取 URL 参数
|
|
|
+ const urlParams = new URLSearchParams(window.location.search);
|
|
|
+ const inviteCode = urlParams.get("code");
|
|
|
+ const memberCode = urlParams.get("memberCode");
|
|
|
+ const refParam = urlParams.get("ref");
|
|
|
+ const ivParam = urlParams.get("iv");
|
|
|
+
|
|
|
+ // 优先使用URL中的code参数,如果没有则使用memberCode
|
|
|
+ const codeToUse = inviteCode || memberCode || localStorage.getItem("memberCode");
|
|
|
+
|
|
|
+ // 如果存在 ref 参数,尝试解密
|
|
|
+ let decryptedRef: string | null = null;
|
|
|
+ if (refParam) {
|
|
|
+ decryptedRef = await decryptRefParam(refParam, ivParam || undefined);
|
|
|
+ if (!decryptedRef) {
|
|
|
+ // 如果解密失败,可能 ref 参数本身就是未加密的,使用原始值
|
|
|
+ decryptedRef = refParam;
|
|
|
+ }
|
|
|
+ // 保存解密后的 ref 到 localStorage 供注册时使用
|
|
|
+ if (decryptedRef) {
|
|
|
+ localStorage.setItem("ref", decryptedRef);
|
|
|
+ console.log("保存ref到localStorage:", decryptedRef);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取当前落地域名
|
|
|
+ const landingDomain = window.location.hostname;
|
|
|
+
|
|
|
+ // 创建游客账户(会自动获取价格配置)
|
|
|
+ const guestResponse = await userStore.createGuest(
|
|
|
+ codeToUse || undefined,
|
|
|
+ decryptedRef || undefined,
|
|
|
+ landingDomain || undefined
|
|
|
+ );
|
|
|
+
|
|
|
+ if (!guestResponse) {
|
|
|
+ showError("创建账户失败,请重试");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error("创建账户失败:", error);
|
|
|
+ showError("创建账户失败,请重试");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 确保价格配置已加载(团队相关价格可能不同)
|
|
|
- if (isLoginUser.value && !priceStore.isPriceConfigLoaded) {
|
|
|
+ if (!priceStore.isPriceConfigLoaded) {
|
|
|
try {
|
|
|
await priceStore.fetchPriceConfig();
|
|
|
} catch (error) {
|
|
|
@@ -793,7 +989,7 @@ const handleSinglePurchaseClick = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 已登录,显示购买弹窗
|
|
|
+ // 显示购买弹窗
|
|
|
showSinglePurchaseModal.value = true;
|
|
|
};
|
|
|
|
|
|
@@ -809,7 +1005,16 @@ const handleMembershipPurchase = async () => {
|
|
|
// 未登录用户先创建游客账户
|
|
|
if (!isLoginUser.value) {
|
|
|
try {
|
|
|
- const guestResponse = await userStore.createGuest();
|
|
|
+ // 从 localStorage 读取保存的 code 和 ref 参数
|
|
|
+ const codeToUse = localStorage.getItem("memberCode");
|
|
|
+ const refToUse = localStorage.getItem("ref");
|
|
|
+ // 获取当前落地域名
|
|
|
+ const landingDomain = window.location.hostname;
|
|
|
+ const guestResponse = await userStore.createGuest(
|
|
|
+ codeToUse || undefined,
|
|
|
+ refToUse || undefined,
|
|
|
+ landingDomain || undefined
|
|
|
+ );
|
|
|
if (!guestResponse) {
|
|
|
showError("付费时创建账户失败,请重试");
|
|
|
return;
|
|
|
@@ -867,7 +1072,16 @@ const handleSinglePurchase = async () => {
|
|
|
// 未登录用户先创建游客账户
|
|
|
if (!isLoginUser.value) {
|
|
|
try {
|
|
|
- const guestResponse = await userStore.createGuest();
|
|
|
+ // 从 localStorage 读取保存的 code 和 ref 参数
|
|
|
+ const codeToUse = localStorage.getItem("memberCode");
|
|
|
+ const refToUse = localStorage.getItem("ref");
|
|
|
+ // 获取当前落地域名
|
|
|
+ const landingDomain = window.location.hostname;
|
|
|
+ const guestResponse = await userStore.createGuest(
|
|
|
+ codeToUse || undefined,
|
|
|
+ refToUse || undefined,
|
|
|
+ landingDomain || undefined
|
|
|
+ );
|
|
|
if (!guestResponse) {
|
|
|
showError("付费时创建账户失败,请重试");
|
|
|
return;
|
|
|
@@ -940,10 +1154,35 @@ const handleMembershipQueryOrder = async () => {
|
|
|
if (response.status === 1) {
|
|
|
// 支付成功,停止定时查询
|
|
|
stopMembershipQueryTimer();
|
|
|
+
|
|
|
+ // 保存订单号用于检查
|
|
|
+ const orderNo = currentOrderNo.value;
|
|
|
+
|
|
|
+ // 检查是否已经处理过这个订单
|
|
|
+ if (!orderNo || processedOrderNos.value.has(orderNo)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 标记订单已处理
|
|
|
+ processedOrderNos.value.add(orderNo);
|
|
|
+
|
|
|
await userStore.sync();
|
|
|
showPaymentWaitingDialog.value = false;
|
|
|
- showSuccess("会员购买成功!");
|
|
|
currentOrderNo.value = "";
|
|
|
+
|
|
|
+ // 检查用户是否是游客用户,如果是则显示账户信息提示弹窗
|
|
|
+ if (isGuestUser.value) {
|
|
|
+ // 检查是否已经提示过
|
|
|
+ const shownKey = `accountInfoShown_${userStore.userInfo?.id || 'guest'}`;
|
|
|
+ const hasShown = window.localStorage.getItem(shownKey) === 'true';
|
|
|
+ if (!hasShown) {
|
|
|
+ showAccountInfoDialog.value = true;
|
|
|
+ } else {
|
|
|
+ showSuccess("会员购买成功!");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showSuccess("会员购买成功!");
|
|
|
+ }
|
|
|
} else {
|
|
|
showError(response.msg || "会员购买失败");
|
|
|
}
|
|
|
@@ -969,10 +1208,36 @@ const handleSingleQueryOrder = async () => {
|
|
|
if (response.status === 1) {
|
|
|
// 支付成功,停止定时查询
|
|
|
stopSingleQueryTimer();
|
|
|
+
|
|
|
+ // 保存订单号用于检查
|
|
|
+ const orderNo = singleCurrentOrderNo.value;
|
|
|
+
|
|
|
+ // 检查是否已经处理过这个订单
|
|
|
+ if (!orderNo || processedOrderNos.value.has(orderNo)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 标记订单已处理
|
|
|
+ processedOrderNos.value.add(orderNo);
|
|
|
+
|
|
|
await userStore.sync();
|
|
|
showSinglePaymentWaitingDialog.value = false;
|
|
|
- showSuccess("视频购买成功!");
|
|
|
singleCurrentOrderNo.value = "";
|
|
|
+
|
|
|
+ // 检查用户是否是游客用户,如果是则显示账户信息提示弹窗
|
|
|
+ if (isGuestUser.value) {
|
|
|
+ // 检查是否已经提示过
|
|
|
+ const shownKey = `accountInfoShown_${userStore.userInfo?.id || 'guest'}`;
|
|
|
+ const hasShown = window.localStorage.getItem(shownKey) === 'true';
|
|
|
+ if (!hasShown) {
|
|
|
+ showAccountInfoDialog.value = true;
|
|
|
+ } else {
|
|
|
+ showSuccess("视频购买成功!");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showSuccess("视频购买成功!");
|
|
|
+ }
|
|
|
+
|
|
|
// 重新检查购买状态(已完成支付时的检查)
|
|
|
await checkVideoPurchaseStatus();
|
|
|
} else {
|
|
|
@@ -1005,15 +1270,41 @@ const startMembershipQueryTimer = () => {
|
|
|
try {
|
|
|
const response = await userQueryOrder(currentOrderNo.value);
|
|
|
|
|
|
- if (response.status === 1) {
|
|
|
- // 支付成功
|
|
|
- stopMembershipQueryTimer();
|
|
|
- await userStore.sync();
|
|
|
- showPaymentWaitingDialog.value = false;
|
|
|
+ if (response.status === 1) {
|
|
|
+ // 支付成功
|
|
|
+ stopMembershipQueryTimer();
|
|
|
+
|
|
|
+ // 保存订单号用于检查
|
|
|
+ const orderNo = currentOrderNo.value;
|
|
|
+
|
|
|
+ // 检查是否已经处理过这个订单
|
|
|
+ if (!orderNo || processedOrderNos.value.has(orderNo)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 标记订单已处理
|
|
|
+ processedOrderNos.value.add(orderNo);
|
|
|
+
|
|
|
+ await userStore.sync();
|
|
|
+ showPaymentWaitingDialog.value = false;
|
|
|
+ currentOrderNo.value = "";
|
|
|
+
|
|
|
+ // 检查用户是否是游客用户,如果是则显示账户信息提示弹窗
|
|
|
+ if (isGuestUser.value) {
|
|
|
+ // 检查是否已经提示过
|
|
|
+ const shownKey = `accountInfoShown_${userStore.userInfo?.id || 'guest'}`;
|
|
|
+ const hasShown = window.localStorage.getItem(shownKey) === 'true';
|
|
|
+ if (!hasShown) {
|
|
|
+ showAccountInfoDialog.value = true;
|
|
|
+ } else {
|
|
|
+ showSuccess("会员购买成功!");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
showSuccess("会员购买成功!");
|
|
|
- currentOrderNo.value = "";
|
|
|
- await checkVideoPurchaseStatus();
|
|
|
}
|
|
|
+
|
|
|
+ await checkVideoPurchaseStatus();
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
console.error("定时查询会员订单状态失败:", error);
|
|
|
}
|
|
|
@@ -1054,15 +1345,41 @@ const startSingleQueryTimer = () => {
|
|
|
videoInfo.value.id
|
|
|
);
|
|
|
|
|
|
- if (response.status === 1) {
|
|
|
- // 支付成功
|
|
|
- stopSingleQueryTimer();
|
|
|
- await userStore.sync();
|
|
|
- showSinglePaymentWaitingDialog.value = false;
|
|
|
+ if (response.status === 1) {
|
|
|
+ // 支付成功
|
|
|
+ stopSingleQueryTimer();
|
|
|
+
|
|
|
+ // 保存订单号用于检查
|
|
|
+ const orderNo = singleCurrentOrderNo.value;
|
|
|
+
|
|
|
+ // 检查是否已经处理过这个订单
|
|
|
+ if (!orderNo || processedOrderNos.value.has(orderNo)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 标记订单已处理
|
|
|
+ processedOrderNos.value.add(orderNo);
|
|
|
+
|
|
|
+ await userStore.sync();
|
|
|
+ showSinglePaymentWaitingDialog.value = false;
|
|
|
+ singleCurrentOrderNo.value = "";
|
|
|
+
|
|
|
+ // 检查用户是否是游客用户,如果是则显示账户信息提示弹窗
|
|
|
+ if (isGuestUser.value) {
|
|
|
+ // 检查是否已经提示过
|
|
|
+ const shownKey = `accountInfoShown_${userStore.userInfo?.id || 'guest'}`;
|
|
|
+ const hasShown = window.localStorage.getItem(shownKey) === 'true';
|
|
|
+ if (!hasShown) {
|
|
|
+ showAccountInfoDialog.value = true;
|
|
|
+ } else {
|
|
|
+ showSuccess("视频购买成功!");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
showSuccess("视频购买成功!");
|
|
|
- singleCurrentOrderNo.value = "";
|
|
|
- await checkVideoPurchaseStatus();
|
|
|
}
|
|
|
+
|
|
|
+ await checkVideoPurchaseStatus();
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
console.error("定时查询单片购买订单状态失败:", error);
|
|
|
}
|
|
|
@@ -1102,6 +1419,8 @@ const cancelSinglePayment = () => {
|
|
|
// 支付等待相关
|
|
|
const showPaymentWaitingDialog = ref(false);
|
|
|
const currentOrderNo = ref("");
|
|
|
+// 记录已处理过的订单号,防止重复显示成功弹窗
|
|
|
+const processedOrderNos = ref<Set<string>>(new Set());
|
|
|
|
|
|
// 跳转支付页面
|
|
|
const openPaymentPage = (url: string) => {
|
|
|
@@ -1112,10 +1431,13 @@ const openPaymentPage = (url: string) => {
|
|
|
const showSuccessDialog = ref(false);
|
|
|
// 错误提示弹窗
|
|
|
const showErrorDialog = ref(false);
|
|
|
+// 账户信息提示弹窗
|
|
|
+const showAccountInfoDialog = ref(false);
|
|
|
// 成功提示消息
|
|
|
const successMessage = ref("");
|
|
|
// 错误提示消息
|
|
|
const errorMessage = ref("");
|
|
|
+const domains = ref<string[]>([]);
|
|
|
|
|
|
// 夸克浏览器检测函数
|
|
|
const isQuarkBrowser = () => {
|
|
|
@@ -1185,6 +1507,77 @@ const showError = (message: string) => {
|
|
|
showErrorDialog.value = true;
|
|
|
};
|
|
|
|
|
|
+// 从 URL 中提取域名(处理 https://example.com 格式)
|
|
|
+const extractDomain = (urlOrDomain: string): string => {
|
|
|
+ try {
|
|
|
+ // 如果包含协议,使用 URL 对象解析
|
|
|
+ if (urlOrDomain.includes('://')) {
|
|
|
+ const url = new URL(urlOrDomain);
|
|
|
+ return url.hostname;
|
|
|
+ }
|
|
|
+ // 否则直接返回
|
|
|
+ return urlOrDomain;
|
|
|
+ } catch {
|
|
|
+ // 如果解析失败,返回原值
|
|
|
+ return urlOrDomain;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 获取域名列表
|
|
|
+const fetchDomains = async () => {
|
|
|
+ try {
|
|
|
+ // 获取系统配置中的 super_domain
|
|
|
+ const config = await getSuperDomain();
|
|
|
+ const superDomainValue = config?.value;
|
|
|
+
|
|
|
+ // 从 value 字段提取域名
|
|
|
+ let superDomain: string | undefined;
|
|
|
+ if (superDomainValue && typeof superDomainValue === 'string') {
|
|
|
+ superDomain = extractDomain(superDomainValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取当前访问域名
|
|
|
+ const currentDomain = window.location.hostname;
|
|
|
+
|
|
|
+ // 构建域名列表:第一个是 super_domain,第二个是当前域名
|
|
|
+ const domainList: string[] = [];
|
|
|
+
|
|
|
+ if (superDomain) {
|
|
|
+ domainList.push(superDomain);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果当前域名与 super_domain 不同,则添加当前域名
|
|
|
+ if (currentDomain && currentDomain !== superDomain) {
|
|
|
+ domainList.push(currentDomain);
|
|
|
+ }
|
|
|
+
|
|
|
+ domains.value = domainList.length > 0 ? domainList : [currentDomain || ''];
|
|
|
+ } catch (error) {
|
|
|
+ console.error("获取域名配置失败:", error);
|
|
|
+ // 如果获取失败,至少显示当前域名
|
|
|
+ const currentDomain = window.location.hostname;
|
|
|
+ if (currentDomain) {
|
|
|
+ domains.value = [currentDomain];
|
|
|
+ } else {
|
|
|
+ domains.value = [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 关闭账户信息提示弹窗并记录已提示
|
|
|
+const closeAccountInfoDialog = () => {
|
|
|
+ const shownKey = `accountInfoShown_${userStore.userInfo?.id || 'guest'}`;
|
|
|
+ window.localStorage.setItem(shownKey, 'true');
|
|
|
+ showAccountInfoDialog.value = false;
|
|
|
+};
|
|
|
+
|
|
|
+// 当账户信息对话框打开时获取域名
|
|
|
+watch(() => showAccountInfoDialog.value, (newVal) => {
|
|
|
+ if (newVal && domains.value.length === 0) {
|
|
|
+ fetchDomains();
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
// 生成设备标识
|
|
|
const generateMacAddress = (): string => {
|
|
|
const hex = "0123456789ABCDEF";
|
|
|
@@ -1323,7 +1716,6 @@ const checkVideoPurchaseStatus = async () => {
|
|
|
|
|
|
try {
|
|
|
await loadVideoInfo();
|
|
|
- console.log("showPurchasePrompt:", showPurchasePrompt.value);
|
|
|
} catch (error) {
|
|
|
console.error("检查视频购买状态失败:", error);
|
|
|
isSinglePurchased.value = false;
|
|
|
@@ -1335,7 +1727,6 @@ const loadVideoInfo = async () => {
|
|
|
const videoId = route.params.id || route.query.id;
|
|
|
// 试看视频
|
|
|
if (isFreeVideo.value) {
|
|
|
- console.log("isFreeVideo");
|
|
|
showPurchaseButtonArea.value = false;
|
|
|
showPurchasePrompt.value = false;
|
|
|
|
|
|
@@ -1353,7 +1744,6 @@ const loadVideoInfo = async () => {
|
|
|
};
|
|
|
} else if (!isVipUser.value) {
|
|
|
// 未登录
|
|
|
- console.log("isNotLogin");
|
|
|
if (!isLoginUser.value) {
|
|
|
showPurchasePrompt.value = true;
|
|
|
showPurchaseButtonArea.value = true;
|
|
|
@@ -1371,11 +1761,9 @@ const loadVideoInfo = async () => {
|
|
|
};
|
|
|
} else {
|
|
|
// guest或free用户
|
|
|
- console.log("isNotVipUser");
|
|
|
const response = await checkSinglePurchase(videoId as string);
|
|
|
const wasPurchased = response.status === 1 || response === true;
|
|
|
isSinglePurchased.value = wasPurchased;
|
|
|
- console.log("isSinglePurchased:", response);
|
|
|
if (response) {
|
|
|
// 已购买单片
|
|
|
// 关闭弹窗
|
|
|
@@ -1421,7 +1809,6 @@ const loadVideoInfo = async () => {
|
|
|
} else if (isVipUser.value) {
|
|
|
// 付费用户,从详情接口获取视频信息
|
|
|
const response = await getVideoDetail(device, String(videoId));
|
|
|
- console.log("isVipUser");
|
|
|
if (response.status === 0 && response.data) {
|
|
|
const data = response.data;
|
|
|
videoInfo.value = {
|
|
|
@@ -1556,6 +1943,13 @@ onMounted(async () => {
|
|
|
// 标记用户信息已同步完成,允许路由监听逻辑运行
|
|
|
isUserSynced.value = true;
|
|
|
|
|
|
+ // 记录视频页面访问
|
|
|
+ try {
|
|
|
+ await recordPageClick("video");
|
|
|
+ } catch (error) {
|
|
|
+ console.error("记录视频页面访问失败:", error);
|
|
|
+ }
|
|
|
+
|
|
|
// 初次进入页面时,按顺序执行:购买判断 -> 加载视频 -> 加载相关推荐
|
|
|
await checkVideoPurchaseStatus();
|
|
|
await loadVideoInfo();
|