index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. const app = getApp()
  2. var util = require("../../utils/util.js")
  3. Page({
  4. data: {
  5. pushCont: {
  6. wc_showtime: '',
  7. wct_frequency: '',
  8. wc_type: ''
  9. },
  10. isSetstatus: false,
  11. plindex: '-1',
  12. touchStart: 0,
  13. touchEnd: 0,
  14. showmask: false,
  15. bigimagecurrent: 0,
  16. changeAnimation: 1, //1--开启动画,0--关闭动画
  17. showAnimation: {}, //列表动画
  18. autoplay: true,
  19. interval: 5000,
  20. duration: 500,
  21. evaluateList: [],
  22. evaluateListNew: [],
  23. lastX: 0, //滑动开始x轴位置
  24. lastY: 0, //滑动开始y轴位置
  25. text: "没有滑动",
  26. currentGesture: 0, //标识手势
  27. animationData: {},
  28. pmshow: false,
  29. mode: "scaleToFill",
  30. mktnum: undefined,
  31. map: undefined,
  32. latitude: undefined,
  33. longitude: undefined,
  34. name: undefined,
  35. address: undefined,
  36. trafficList: [],
  37. arr: [],
  38. eqArray: [],
  39. pmArray: [],
  40. mktarr: [],
  41. leaseurl: undefined,
  42. promotionurl: undefined,
  43. userInfo: {},
  44. hasUserInfo: false,
  45. autoplayYPTJ: false,
  46. indicatorDotsYPTJ: false,
  47. circular: false,
  48. canIUse: wx.canIUse('button.open-type.getUserInfo')
  49. },
  50. onLoad: function(options) {
  51. if (options.skip == 1) {
  52. if (options.para == null) {
  53. wx.navigateTo({
  54. url: options.path
  55. })
  56. } else {
  57. wx.navigateTo({
  58. url: options.path + '?para=' + options.para
  59. })
  60. }
  61. }
  62. this.init(options)
  63. },
  64. init(options) {
  65. var that = this
  66. util.getData('/getBanners')
  67. .then(res => {
  68. that.setData({
  69. arr: res
  70. })
  71. })
  72. that.setData({
  73. navH: app.globalData.navHeight
  74. })
  75. util.getData('/getMktInfos',{
  76. mi_branche_code: 110000
  77. }).then(res => {
  78. that.setData({
  79. mktarr: res
  80. })
  81. })
  82. that.setData({
  83. navH: app.globalData.navHeight
  84. })
  85. },
  86. //点击轮播图
  87. BhrefPm: function(e) {
  88. var index = e.currentTarget.dataset.index;
  89. if (index != null) {
  90. if (e.currentTarget.dataset.type == 1) {
  91. wx.navigateTo({
  92. url: '/pages/promotion/promotionhref?para=' + index
  93. })
  94. }
  95. if (e.currentTarget.dataset.type == 2) {
  96. wx.navigateTo({
  97. url: index
  98. })
  99. }
  100. }
  101. },
  102. onShareAppMessage: function() {
  103. return {
  104. title: '科技强国梦 编程向未来',
  105. path: '/pages/index/index?id=888'
  106. }
  107. },
  108. // map
  109. markertap: function(e) {
  110. wx.getLocation({
  111. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  112. success: function(res) {
  113. var latitude = e.currentTarget.dataset.latitude
  114. var longitude = e.currentTarget.dataset.longitude
  115. wx.openLocation({ //出发wx.openLocation API
  116. latitude: Number(latitude), //坐标纬度(从地图获取坐标)
  117. longitude: Number(longitude), //坐标经度(从地图获取坐标)
  118. name: e.currentTarget.dataset.name, //打开后显示的地址名称
  119. address: e.currentTarget.dataset.address, //打开后显示的地址汉字
  120. scale: 17
  121. })
  122. }
  123. })
  124. },
  125. })