2024-07-29 09:16:58 +08:00

69 lines
1.7 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: ''
},
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;
console.log(id, "chapteridchapteridchapterid")
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'
});
}
})
},
})