123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- //index.js
- //获取应用实例
- var app = getApp();
- var util = require("../../utils/util.js");
- Page({
- data: {
- banner:{
- delay:3000,
- timeoutProcess:null,
- currindex:0,
- bannerimg:[]
- },
- nav:[],
- ad:[],
- course_grp:[],
- moreCourses:{
- title:"已经到底,查看更多课程 >",
- url:"../course/course"
- },
- userInfo: {},
- pageTitle : {}
- },
- /*点击banner上的圆选择相应的图片 */
- 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);
- },
- onLoad: function () {
- console.log('onLoad index')
- var that = this;
- var bannerArr = util.getBanner(),
- navArr = util.getNav(),
- adArr = util.getAd(),
- courseGrp = util.getCourse();
- that.setData({
- banner:{
- currindex:0,
- bannerimg:bannerArr
- },
- nav:navArr,
- ad:adArr,
- course_grp:courseGrp,
- pageTitle : {
- title : "公司简介",
- text : "杭州任联科技有限公司聚焦于智慧城市安防领域,是一家专业研究和推广无线射频识别技术(RFID)的高新技术企业,是中国领先的RFID技术设备制造商和解决方案提供商之一;公司集无线射频识别技术的研发、生产、销售和服务于一体,能够为不同领域的用户度身定制完善的专业的系统解决方案,满足不同行业的个性化需求。",
- array : [
- {
- title : "涉及领域",
- text : "智慧校园;电动车防盗解决方案;老人、小孩及特殊人员定位;有源标签资产管理等解决方案。"
- },{
- title : "研发实力",
- text : "创始团队有深厚的华为华三研发背景及资源优势,网关、物联网、平台技术积累深厚,深刻理解行业技术发展趋势。"
- }
- ]
- }
- });
- that.changeBanner(0);
- //调用应用实例的方法获取全局数据
- app.getUserInfo(function(userInfo){
- //更新数据
- that.setData({
- userInfo:userInfo
- })
- })
- console.log(that.data);
- },
- onShow:function(){
- console.log("onshow index");
- var that = this;
- that.data.banner.timeoutProcess = setInterval(that.timetochange,3000);
- console.log(that.data);
- },
- onHide:function(){
- var that=this;
- clearTimeout(that.data.banner.timeoutProcess);
- },
- /**根据bannerArray的index显示 */
- 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
- },
- /*轮播banner */
- 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);
- }
- })
|