1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- const fetch = require('../../utils/fetch')
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- slides: [],
- categories: []
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad (options) {
- //fetch('/slides')
- // .then(res => {
- // this.setData({ slides: res.data })
- // })
- // fetch('/categories')
- // .then(res => {
- // this.setData({ categories: res.data })
- // })
- const slides = [
- { image: '/assets/contest/2.jpg', link: '/pages/list/list?cat=10' },
- { image: '/assets/contest/1.jpg', link: '' },
- { image: '/assets/contest/4.jpg', link: '/pages/list/list?cat=30' },
- { image: '/assets/contest/3.jpg', link: '/pages/list/list?cat=20' }
- ]
- const categories = [
- { icon: '/assets/icons/scan.png', text: '签到扫码', category_id: 5 },
- { icon: '/assets/icons/art.png', text: '艺术', category_id: 1 },
- { icon: '/assets/icons/chemistry.png', text: '科技', category_id: 2 },
- { icon: '/assets/icons/math.png', text: '数学', category_id: 3 },
- { icon: '/assets/icons/cups.png', text: '奖杯赛', category_id: 4 },
- { icon: '/assets/icons/badminton.png', text: '体育', category_id: 6 },
- { icon: '/assets/icons/bicycle.png', text: '户外', category_id: 7 },
- { icon: '/assets/icons/keyboard.png', text: '创新专题', category_id: 8 },
- { icon: '/assets/icons/myself.png', text: '我的比赛', category_id: 9 }
- ]
- this.setData({ slides, categories })
- },
- mySomeFunc:function(){
- wx.scanCode({ onlyFromCamera:false, success:scanOK, fail:scanFail});
- },
- scanOK:function(){
- wx.showToast({title:"签到成功!"});
- },
- scanFail: function () {
- wx.showToast({ title: "请重新尝试!" });
- }
- })
|