|
@@ -1,62 +1,107 @@
|
|
|
-export const hotInit = (that) => {
|
|
|
- that.setData({
|
|
|
+export const hotInit = (that) => {
|
|
|
+ that.setData({
|
|
|
hotData: {
|
|
|
- nav: [],
|
|
|
- hotIndex: 0,
|
|
|
- hotList: [],
|
|
|
- left: ''
|
|
|
+ title: '热门',
|
|
|
+ imgUrls: [
|
|
|
+ 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
|
|
|
+ 'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
|
|
|
+ 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
|
|
|
+ ],
|
|
|
+ indicatorDots: true,
|
|
|
+ autoplay: true,
|
|
|
+ interval: 5000,
|
|
|
+ duration: 700,
|
|
|
+ circular: true,
|
|
|
+ hotSearch: '鹅鹅鹅',
|
|
|
+ wareCards:[
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "1",
|
|
|
+ likes: "2"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title:"铺满金色巴掌的水泥道",
|
|
|
+ grade:"一年级 上学期",
|
|
|
+ img: "../../static/image/timg.jpg",
|
|
|
+ plays: "12345",
|
|
|
+ likes: "54321"
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
- })
|
|
|
- //点击更改数据
|
|
|
- that.hotChoice = ({ currentTarget }) => {
|
|
|
- that.data.hotData.hotInd = currentTarget.dataset.index;
|
|
|
- if (that.data.hotData.nav.length > 3 && currentTarget.dataset.index == 2) {
|
|
|
- that.data.hotData.left = currentTarget.dataset.index * 225;
|
|
|
- }
|
|
|
- if (that.data.hotData.nav.length > 3 && currentTarget.dataset.index == 1) {
|
|
|
- that.data.hotData.left = '';
|
|
|
- }
|
|
|
- that.setData({
|
|
|
- hotData: that.data.hotData
|
|
|
- })
|
|
|
- //数据请求
|
|
|
- that.httpList(currentTarget.dataset.index + 1)
|
|
|
- }
|
|
|
- //滑动更改数据
|
|
|
- that.lookSlide = ({ detail }) => {
|
|
|
- that.data.hotData.hotInd = detail.current;
|
|
|
- if (that.data.hotData.nav.length > 3 && detail.current == 2) {
|
|
|
- that.data.hotData.left = detail.current * 225;
|
|
|
- }
|
|
|
- if (that.data.hotData.nav.length > 3 && detail.current == 1) {
|
|
|
- that.data.hotData.left = '';
|
|
|
- }
|
|
|
- // console.log(detail.current);
|
|
|
+ }),
|
|
|
+ that.searchHandler = () => {
|
|
|
+ console.log('搜索按钮')
|
|
|
+ console.log(that.data.hotInput);
|
|
|
+ },
|
|
|
+ that.inputHandler = (e) => {
|
|
|
that.setData({
|
|
|
- hotData: that.data.hotData
|
|
|
- })
|
|
|
- that.httpList(detail.current + 1)
|
|
|
- }
|
|
|
- //跳转到详情页
|
|
|
- that.details = ({ currentTarget }) => {
|
|
|
- const id = currentTarget.dataset.id;
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/details/details?id=' + id
|
|
|
- })
|
|
|
- }
|
|
|
- //请求数据封装
|
|
|
- that.httpList = (ind) => {
|
|
|
- httpRequestApi.getCourse({
|
|
|
- categoryId: ind
|
|
|
- }).success((res)=>{
|
|
|
- console.log('课程列表', res);
|
|
|
- that.data.hotData.hotList = res.data.data.list;
|
|
|
- that.setData({
|
|
|
- hotData: that.data.hotData
|
|
|
- })
|
|
|
- })
|
|
|
+ hotInput: e.detail.value
|
|
|
+ });
|
|
|
+ console.log(that.data.hotInput)
|
|
|
}
|
|
|
-
|
|
|
- //初始数据
|
|
|
- that.httpList(1)
|
|
|
- }
|
|
|
+}
|