import httpRequestApi from '../../utils/APIClient'; export const hotInit = (that) => { that.setData({ hotData: { title: '热门', imgUrls: [ '../../static/image/timg.jpg', '../../static/image/timg.jpg', '../../static/image/timg.jpg' ], indicatorDots: true, autoplay: true, interval: 5000, duration: 700, circular: true, hotWareCardFirst: 'hotWareCardFirst', hotWareCard : 'hotWareCard', hotSearch: '鹅鹅鹅', wareCards:[ { title:"铺满色巴掌的水泥道1", grade:"一年级 上学期", img: "../../static/image/timg.jpg", plays: "1", likes: "2", classId: "1001" }, { title:"铺满金色巴掌的水泥道2", grade:"一年级 上学期", img: "../../static/image/timg.jpg", plays: "12345", likes: "54321", classId: "1002" }, { title:"铺满金色巴掌的水泥道3", grade:"一年级 上学期", img: "../../static/image/timg.jpg", plays: "12345", likes: "54321", classId: "1003" }, ] } }), // 搜索方法 that.searchHandler = () => { console.log('搜索按钮') console.log(that.data.hotInput); if(that.data.hotInput.lenght !== 0){ wx.navigateTo({ url: `../main/searchResult/searchResult?keyWords=${that.data.hotInput}` }) } }, // 输入框输入 that.inputHandler = (e) => { that.setData({ hotInput: e.detail.value }); console.log(that.data.hotInput) } // 打开课程页面 that.openBooks = (e) =>{ wx.navigateTo({ url: `../main/books/books` }) } // 打开课程页面 that.openClass = (e) =>{ let id = e.currentTarget.dataset.classid; let title = e.currentTarget.dataset.title; wx.navigateTo({ url: `../main/class/class?id=${id}&title=${title}` }) } // 打开用户作品页面 that.openWorks = (e) =>{ let uid = e.currentTarget.dataset.uid; let title = e.currentTarget.dataset.title; wx.navigateTo({ url: `../social/works/works?id=${uid}&title=${title}` }) } that.getIndex = (uid)=>{ httpRequestApi.getIndex({ uid }).success((res)=>{ console.log(res); }) } that.getHotRecommend = (uid,pageNo,pageSize)=>{ httpRequestApi.getHotRecommend( uid, pageNo, pageSize ).success((res)=>{ console.log(res); }) } // 去全部课本 that.goToBooks = () =>{ wx.navigateTo({ url: `../main/books/books` }) } that.getIndex(1); that.getHotRecommend(1,1,3) }