|
@@ -1,6 +1,6 @@
|
|
|
-import { computed, defineComponent, onMounted, reactive, watch } from "vue";
|
|
|
+import { computed, defineComponent, onMounted, reactive, watch, ref } from "vue";
|
|
|
import styles from "./index.module.less";
|
|
|
-import { api_musicSheetPage } from "../../api";
|
|
|
+import { api_musicSheetPage, api_musicIsBuy } from "../../api";
|
|
|
import state, { togglePlay } from "/src/state";
|
|
|
import { List, Image, Field, DropdownMenu, DropdownItem } from "vant";
|
|
|
import { postMessage } from "/src/utils/native-message";
|
|
@@ -49,6 +49,8 @@ export default defineComponent({
|
|
|
loading: false,
|
|
|
hasNext: true,
|
|
|
});
|
|
|
+ const loading = ref(false)
|
|
|
+
|
|
|
const getList = async () => {
|
|
|
if (!data.hasNext) return;
|
|
|
data.loading = true;
|
|
@@ -93,23 +95,26 @@ export default defineComponent({
|
|
|
getList();
|
|
|
});
|
|
|
|
|
|
- const openAccomapina = (item: any) => {
|
|
|
+ const openAccomapina = async (item: any) => {
|
|
|
// 学生端或者老师端需要校验点播和会员曲目
|
|
|
if (vipVerify.value) {
|
|
|
// 如果是点播的曲子,需要弹窗提醒
|
|
|
if (item.paymentType === "CHARGE") {
|
|
|
- // 暂停播放
|
|
|
- togglePlay("paused");
|
|
|
- permissionPopup.active = "demand"
|
|
|
- permissionPopup.musicId = item.id
|
|
|
- permissionPopup.musicPrice = item.musicPrice
|
|
|
- permissionPopup.show = true
|
|
|
- return
|
|
|
+ if (loading.value === true) return
|
|
|
+ loading.value = true
|
|
|
+ // 查询是否购买了
|
|
|
+ const { data } = await api_musicIsBuy(item.id)
|
|
|
+ loading.value = false
|
|
|
+ if (data.buyed === false) {
|
|
|
+ permissionPopup.active = "demand"
|
|
|
+ permissionPopup.musicId = item.id
|
|
|
+ permissionPopup.musicPrice = item.musicPrice
|
|
|
+ permissionPopup.show = true
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
// 如果是vip的曲子,当前用户不是会员时,需要弹窗提醒
|
|
|
if (storeData.user.vipType === "NOT_VIP") {
|
|
|
- // 暂停播放
|
|
|
- togglePlay("paused");
|
|
|
permissionPopup.active = item.paymentType.includes('CHARGE') ? "memberAndDemand" : "member"
|
|
|
permissionPopup.musicId = item.id
|
|
|
permissionPopup.musicPrice = item.musicPrice
|