123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- // 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/superBike.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.getdiaodongcheData();
- that.setData({
- courses:coursesArr,
- banner:{
- currindex:0,
- bannerimg:bannerArr
- },
- ad:ddongcheAD
- });
- console.log(that.data.ad);
- 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);
- }
- })
|