mystudy.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // pages/course/course.js
  2. var util = require("../../utils/util.js");
  3. Page({
  4. data:{
  5. courses:[],
  6. banner:{
  7. delay:3000,
  8. timeoutProcess:null,
  9. currindex:0,
  10. bannerimg:[]
  11. },
  12. bannerTitle:"·项目概述·",
  13. chanpinTitle:"·相关产品·",
  14. bannerTitleImages : "https://rlzcgl.oss-cn-beijing.aliyuncs.com/wxminiprogram/images/Rlianimage/superSchool.jpg",
  15. bannerText : "智慧校园系统基于任联云平台,整合分析多维度校园数据,为教育局、学校、教师、学生和家长提供全方位的信息化服务。 公司以基础研发为核心竞争力,顺应RFID技术及物联网行业发展的大趋势,大力推进和开拓智慧校园方案和产品的开发和实施。(详情请登录任联官网http://www.renlianiot.com查看)",
  16. ad:[]
  17. },
  18. onLoad:function(options){
  19. // 页面初始化 options为页面跳转所带来的参数
  20. var that=this;
  21. var coursesArr = util.getCourses(),
  22. bannerArr = util.getBanner(),
  23. bannerTitle = that.data.bannerTitle,
  24. chanpinTitle = that.chanpinTitle,
  25. ddongcheAD = util.getSchoolData();
  26. var arr = new Array();
  27. for(var i = 0; i < 5; i++){
  28. arr[i] = new Array();
  29. }
  30. console.log(arr);
  31. that.setData({
  32. courses:coursesArr,
  33. banner:{
  34. currindex:0,
  35. bannerimg:bannerArr
  36. },
  37. ad:ddongcheAD
  38. });
  39. console.log(that.data);
  40. that.changeBanner(0);
  41. },
  42. onReady:function(){
  43. // 页面渲染完成
  44. },
  45. onShow:function(){
  46. // 页面显示
  47. },
  48. onHide:function(){
  49. // 页面隐藏
  50. },
  51. onUnload:function(){
  52. // 页面关闭
  53. },
  54. changeBanner:function(index){
  55. var that = this,
  56. banner = that.data.banner,
  57. currindex = banner.currindex;
  58. banner.bannerimg[currindex].class ='';
  59. banner.bannerimg[index].class = 'active';
  60. banner.currindex = index;
  61. that.setData({
  62. "banner":banner
  63. });
  64. //showImg todo
  65. },
  66. timetochange:function(){
  67. var that = this,
  68. banner = that.data.banner,
  69. currindex = banner.currindex;
  70. if(currindex < banner.bannerimg.length - 1)
  71. {
  72. currindex ++;
  73. }else{
  74. currindex = 0;
  75. }
  76. that.changeBanner(currindex);
  77. },
  78. bindStlBanner:function(e){
  79. console.log(e);
  80. var that = this;
  81. var bannerIdx = e.currentTarget.dataset.index;
  82. clearTimeout(that.data.banner.timeoutProcess);
  83. that.changeBanner(bannerIdx);
  84. that.data.banner.timeoutProcess = setInterval(that.timetochange,3000);
  85. }
  86. })