60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
// e:\project\dy_video_all\初晴剧场\pages\leaderboard\leaderboard.ts
|
|
import { httpRequest } from "../../utils/httpReques";
|
|
Page({
|
|
data: {
|
|
module2: [],
|
|
searchList: [],
|
|
searchFlag: false,
|
|
searchValue: '',
|
|
intiPageFlag: false,
|
|
listFlag: false
|
|
},
|
|
onLoad: function (options) {
|
|
|
|
},
|
|
onShow() {
|
|
httpRequest('/top', 'POST', { lm: 1 }).then((res: any) => {
|
|
console.log(res, "[ohdsfkjshgdfkjsdkjfhs")
|
|
if (res.status == 1 && Array.isArray(res?.data?.module2)) {
|
|
this.setData({
|
|
module2: res?.data?.module2,
|
|
intiPageFlag: true,
|
|
listFlag: res?.data?.module2.length ? true : false
|
|
})
|
|
}
|
|
})
|
|
},
|
|
toPathVideo(ev: any) {
|
|
const sid = ev.currentTarget.dataset.sid;
|
|
tt.navigateTo({
|
|
url: `/pages/videoDetail/videoDetail?sid=${sid}`,
|
|
});
|
|
},
|
|
handelSearchInput(ev: any) {
|
|
const val = ev.detail.value;
|
|
this.setData({
|
|
searchValue: val,
|
|
})
|
|
},
|
|
searchVideo() {
|
|
const searchValue = this.data.searchValue;
|
|
if (!searchValue) {
|
|
tt.showToast({
|
|
title: '搜索内容不能为空',
|
|
icon: 'none',
|
|
});
|
|
return;
|
|
}
|
|
httpRequest('/find', 'POST', { keyword: searchValue }).then((reults: any) => {
|
|
tt.hideLoading({});
|
|
if (reults.status == 1 && Array.isArray(reults.data)) {
|
|
this.setData({
|
|
searchList: reults.data,
|
|
searchFlag: true,
|
|
intiPageFlag: true,
|
|
listFlag: reults.data.length ? true : false
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}) |