|
|
@@ -1118,15 +1118,6 @@ const onVideoPlay = () => {};
|
|
|
// 视频播放进度更新处理
|
|
|
const onVideoTimeUpdate = () => {};
|
|
|
|
|
|
-// 登录成功处理
|
|
|
-const onLoginSuccess = async () => {
|
|
|
- // 登录成功后刷新用户信息
|
|
|
- await userStore.sync();
|
|
|
-
|
|
|
- // 检查单片购买状态
|
|
|
- await checkVideoPurchaseStatus();
|
|
|
-};
|
|
|
-
|
|
|
// 格式化时长
|
|
|
const formatDuration = (duration: string | number): string => {
|
|
|
const seconds = parseInt(String(duration));
|
|
|
@@ -1255,38 +1246,11 @@ const loadVideoInfo = async () => {
|
|
|
taginfo: [],
|
|
|
};
|
|
|
} else if (!isVipUser) {
|
|
|
- // 未登录或guest或free用户
|
|
|
- console.log("isNotVipUser");
|
|
|
- const response = await checkSinglePurchase(videoId as string);
|
|
|
- console.log("checkVideoPurchaseStatus", response);
|
|
|
- const wasPurchased = response.status === 1 || response === true;
|
|
|
- isSinglePurchased.value = wasPurchased;
|
|
|
- if (response) {
|
|
|
- // 关闭弹窗
|
|
|
- showSinglePurchaseModal.value = false;
|
|
|
- showMembershipPurchaseModal.value = false;
|
|
|
- showPurchasePrompt.value = false;
|
|
|
- const response = await getVideoDetail(device, String(videoId));
|
|
|
- if (response.status === 0 && response.data) {
|
|
|
- const data = response.data;
|
|
|
- videoInfo.value = {
|
|
|
- id: videoId,
|
|
|
- name: data.name || "",
|
|
|
- cover: data.cover || "",
|
|
|
- m3u8: data.m3u8 || "",
|
|
|
- duration: data.duration || 0,
|
|
|
- view: data.view || 0,
|
|
|
- like: data.like || 0,
|
|
|
- time: data.time || 0,
|
|
|
- taginfo: data.tags
|
|
|
- ? data.tags
|
|
|
- .split(",")
|
|
|
- .map((tag: string) => ({ name: tag.trim(), hash: tag.trim() }))
|
|
|
- : [],
|
|
|
- };
|
|
|
- }
|
|
|
- } else {
|
|
|
- const { name, cover, m3u8, duration, view, like } = route.query;
|
|
|
+ // 未登录
|
|
|
+ console.log("isNotLogin");
|
|
|
+ if (!isLoginUser) {
|
|
|
+ showPurchasePrompt.value = true;
|
|
|
+ const { name, cover, duration, view, like } = route.query;
|
|
|
videoInfo.value = {
|
|
|
id: videoId,
|
|
|
name: name as string,
|
|
|
@@ -1298,6 +1262,52 @@ const loadVideoInfo = async () => {
|
|
|
time: 0,
|
|
|
taginfo: [],
|
|
|
};
|
|
|
+ } else {
|
|
|
+ // guest或free用户
|
|
|
+ console.log("isNotVipUser");
|
|
|
+ const response = await checkSinglePurchase(videoId as string);
|
|
|
+ console.log("checkVideoPurchaseStatus", response);
|
|
|
+ const wasPurchased = response.status === 1 || response === true;
|
|
|
+ isSinglePurchased.value = wasPurchased;
|
|
|
+ if (response) {
|
|
|
+ // 已购买单片
|
|
|
+ // 关闭弹窗
|
|
|
+ showPurchasePrompt.value = false;
|
|
|
+ const response = await getVideoDetail(device, String(videoId));
|
|
|
+ if (response.status === 0 && response.data) {
|
|
|
+ const data = response.data;
|
|
|
+ videoInfo.value = {
|
|
|
+ id: videoId,
|
|
|
+ name: data.name || "",
|
|
|
+ cover: data.cover || "",
|
|
|
+ m3u8: data.m3u8 || "",
|
|
|
+ duration: data.duration || 0,
|
|
|
+ view: data.view || 0,
|
|
|
+ like: data.like || 0,
|
|
|
+ time: data.time || 0,
|
|
|
+ taginfo: data.tags
|
|
|
+ ? data.tags.split(",").map((tag: string) => ({
|
|
|
+ name: tag.trim(),
|
|
|
+ hash: tag.trim(),
|
|
|
+ }))
|
|
|
+ : [],
|
|
|
+ };
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showPurchasePrompt.value = true;
|
|
|
+ const { name, cover, duration, view, like } = route.query;
|
|
|
+ videoInfo.value = {
|
|
|
+ id: videoId,
|
|
|
+ name: name as string,
|
|
|
+ cover: cover as string,
|
|
|
+ m3u8: "",
|
|
|
+ duration: parseInt(duration as string) || 0,
|
|
|
+ view: parseInt(view as string) || 0,
|
|
|
+ like: parseInt(like as string) || 0,
|
|
|
+ time: 0,
|
|
|
+ taginfo: [],
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
} else if (isVipUser) {
|
|
|
// 付费用户,从详情接口获取视频信息
|