2024-05-24 17:24:28 +08:00

73 lines
1.7 KiB
TypeScript

// e:\project\dy_video_all\初晴剧场\pages\subscribe\subscribe.ts
import { httpRequest } from "../../utils/httpReques";
Page({
myModal: null as any,
data: {
bookcase: [],
bookcaseFlag: false,
bookId: ''
},
onLoad() {
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,
count: this.handelCount(m.count),
}
})
this.setData({
bookcase: ls,
bookcaseFlag: true
})
}
})
},
toPathVideo(ev: any) {
const sid = ev.currentTarget.dataset.sid;
tt.navigateTo({
url: `/pages/videoDetail/videoDetail?sid=${sid}`,
});
},
handelCount(count: any) {
if (count > 999) {
const isCount: any = (count / 100000).toFixed(2);
const ik = parseFloat(isCount) * 100
return `${ik}k`;
}
return count;
},
myModalRef(ref: any) {
this.myModal = ref
},
handelMyModal(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'
});
}
})
},
})