2024-11-22 15:36:06 +08:00

80 lines
2.2 KiB
TypeScript

// e:\project\dy_video_all\dy_iaa_new_project\pages\collection\collection.ts
import { httpRequest } from "../../utils/httpReques";
Page({
myModal: null as any,
data: {
bookcase: [],
bookcaseFlag: false,
bookId: '',
canUsePlayletExtension: getApp().globalData.canUsePlayletExtension,
useVideoByte: getApp().globalData.useVideoByte,
},
onLoad: function () {
// options
},
onShow() {
const params = {
total: 99999
}
httpRequest('/Chasingdrama', 'POST', params).then((res: any) => {
if (res.status == 1 && Array.isArray(res?.data?.bookcase)) {
const bookcase = res?.data?.bookcase;
const ls: any = bookcase.map((m: any) => {
return {
...m,
}
})
this.setData({
bookcase: ls,
bookcaseFlag: true
})
}
})
},
toPathVideo(ev: any) {
const sid = ev.currentTarget.dataset.sid;
const id = ev.currentTarget.dataset.id;
const album_id = ev.currentTarget.dataset.item.album_id;
const episode_id = ev.currentTarget.dataset.item.episode_id;
let url = `/pages/videoDetail/videoDetail?sid=${sid}&id=${id || ''}`;
if(this.data.canUsePlayletExtension&&this.data.useVideoByte){
url = `/pages/videoByte/videoByte?is_continue=0&tt_album_id=${album_id}&tt_episode_id=${episode_id}&sid=${sid}`;
}
console.log("url",url);
tt.navigateTo({
url: url,
});
// tt.navigateTo({
// url: `/pages/videoDetail/videoDetail?sid=${sid}&id=${id || ''}`,
// });
},
myModalRef(ref: any) {
this.myModal = ref
},
deleteCollenction(ev: any) {
const sid = ev.currentTarget.dataset.sid;
this.myModal?.show?.();
this.setData({
bookId: sid
})
},
modalConfirm() {
const bookId = this.data.bookId;
const bookcase = this.data.bookcase;
const params = {
ids: bookId
}
httpRequest('/chasingdramadel', 'POST', params).then((res: any) => {
if (res.status == 1) {
const ls: any = bookcase.filter((m: any) => m.id != bookId);
this.setData({
bookcase: ls
})
tt.showToast({
title: '删除成功',
icon: 'none'
});
}
})
},
})