12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- // pages/course/course.js
- var util = require("../../utils/util.js");
- Page({
- data:{
- courses:[],
- banner:{
- delay:3000,
- timeoutProcess:null,
- currindex:0,
- bannerimg:[]
- },
- bannerTitle:"·项目概述·",
- chanpinTitle:"·相关产品·",
- bannerTitleImages : "https://rlzcgl.oss-cn-beijing.aliyuncs.com/wxminiprogram/images/Rlianimage/superSchool.jpg",
- bannerText : "智慧校园系统基于任联云平台,整合分析多维度校园数据,为教育局、学校、教师、学生和家长提供全方位的信息化服务。 公司以基础研发为核心竞争力,顺应RFID技术及物联网行业发展的大趋势,大力推进和开拓智慧校园方案和产品的开发和实施。(详情请登录任联官网http://www.renlianiot.com查看)",
- ad:[]
- },
- onLoad:function(options){
- // 页面初始化 options为页面跳转所带来的参数
- var that=this;
- var coursesArr = util.getCourses(),
- bannerArr = util.getBanner(),
- bannerTitle = that.data.bannerTitle,
- chanpinTitle = that.chanpinTitle,
- ddongcheAD = util.getSchoolData();
- var arr = new Array();
- for(var i = 0; i < 5; i++){
- arr[i] = new Array();
- }
- console.log(arr);
- that.setData({
- courses:coursesArr,
- banner:{
- currindex:0,
- bannerimg:bannerArr
- },
- ad:ddongcheAD
- });
- console.log(that.data);
- that.changeBanner(0);
- },
- onReady:function(){
- // 页面渲染完成
- },
- onShow:function(){
- // 页面显示
- },
- onHide:function(){
- // 页面隐藏
- },
- onUnload:function(){
- // 页面关闭
- },
- changeBanner:function(index){
- var that = this,
- banner = that.data.banner,
- currindex = banner.currindex;
- banner.bannerimg[currindex].class ='';
- banner.bannerimg[index].class = 'active';
- banner.currindex = index;
- that.setData({
- "banner":banner
- });
- //showImg todo
- },
- timetochange:function(){
- var that = this,
- banner = that.data.banner,
- currindex = banner.currindex;
- if(currindex < banner.bannerimg.length - 1)
- {
- currindex ++;
- }else{
- currindex = 0;
- }
- that.changeBanner(currindex);
- },
- bindStlBanner:function(e){
- console.log(e);
- var that = this;
- var bannerIdx = e.currentTarget.dataset.index;
- clearTimeout(that.data.banner.timeoutProcess);
- that.changeBanner(bannerIdx);
- that.data.banner.timeoutProcess = setInterval(that.timetochange,3000);
- }
- })
|