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

65 lines
1.6 KiB
TypeScript

// e:\project\dy_video_all\初晴剧场\pages\theater\theater.ts
import { httpRequest } from "../../utils/httpReques";
Page({
data: {
swiperCurrent: 0,
categoryList: [],
categoryid: '',
module1: [],
module2: []
},
onLoad(options) {
},
onShow() {
httpRequest('/top', 'POST').then((res: any) => {
console.log(res, "ppppppppp")
if (res.status == 1) {
this.setData({
categoryList: res.data.category,
categoryid: res.data.categoryid,
module1: res.data.module1,
module2: res.data.module2
})
}
})
},
handelSwiperChange(ev: any) {
const current = ev.detail.current;
this.setData({
swiperCurrent: current
})
},
handelSortTap(ev: any) {
const datasetcCtegoryid = ev.currentTarget.dataset.categoryid;
const categoryid = this.data.categoryid;
console.log(datasetcCtegoryid, categoryid)
if (categoryid != datasetcCtegoryid) {
httpRequest('/top', 'POST', { categoryid: datasetcCtegoryid }).then((res: any) => {
if (res.status == 1) {
this.setData({
categoryid: datasetcCtegoryid,
module1: res.data.module1,
})
}
})
}
},
toPathTap() {
tt.navigateTo({
url: `/pages/search/search`,
});
},
toPathLeaderboard() {
tt.navigateTo({
url: `/pages/leaderboard/leaderboard`,
});
},
toPathVideo(ev: any) {
const sid = ev.currentTarget.dataset.sid;
tt.navigateTo({
url: `/pages/videoDetail/videoDetail?sid=${sid}`,
});
},
})