123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import httpRequestApi from '../../../utils/APIClient';
- Page({
- data: {
- wareCards: []
- },
- onLoad: function (option) {
- console.log(option);
- wx.setNavigationBarTitle({
- title: '搜索' //页面标题为路由参数
- })
- console.log(option.keyWords)
- this.search(option.keyWords);
- // httpRequestApi.getClassDetail(uid, option.id).success(res => {
- // console.log(res);
- // this.setData({
- // title: res.data.data.title,
- // videoUrl:res.data.data.playUrl
- // })
- // })
- },
- search: function (key) {
- httpRequestApi.getSearchResult(1, key, 1, 10).success(res => {
- console.log(res);
- const result = res.data.data.list;
- const resultTemp = [];
- result.forEach(item => {
- console.log(item)
- const temp = {};
- temp.title = item.lesson.title;
- temp.grade = item.lesson.gradeClassify;
- temp.img = item.lesson.iconImg;
- temp.classId = item.lesson.id
- resultTemp.push(temp);
- });
- this.setData({
- wareCards: resultTemp
- })
- console.log(this.data.wareCards)
- });
- },
- openClass: (e) => {
- let id = e.currentTarget.dataset.classid;
- let title = e.currentTarget.dataset.title;
- wx.navigateTo({
- url: `../class/class?id=${id}&title=${title}`
- })
- }
- })
|