index.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. mktList: [
  42. "https://api.zhumi.tech/MiniProgram/mkt/mkt1.png",
  43. "https://api.zhumi.tech/MiniProgram/mkt/mkt2.png",
  44. "https://api.zhumi.tech/MiniProgram/mkt/mkt3.png",
  45. "https://api.zhumi.tech/MiniProgram/mkt/mkt4.png",
  46. "https://api.zhumi.tech/MiniProgram/mkt/mkt5.png",
  47. "https://api.zhumi.tech/MiniProgram/mkt/mkt6.png",
  48. "https://api.zhumi.tech/MiniProgram/mkt/mkt7.png"
  49. ],
  50. mktImgage: "https://api.zhumi.tech/MiniProgram/mkt/mkt1.png",
  51. leaseurl: undefined,
  52. promotionurl: undefined,
  53. userInfo: {},
  54. hasUserInfo: false,
  55. autoplayYPTJ: false,
  56. indicatorDotsYPTJ: false,
  57. circular: false,
  58. canIUse: wx.canIUse('button.open-type.getUserInfo')
  59. },
  60. onLoad: function(options) {
  61. if (options.skip == 1) {
  62. if (options.para == null) {
  63. wx.navigateTo({
  64. url: options.path
  65. })
  66. } else {
  67. wx.navigateTo({
  68. url: options.path + '?para=' + options.para
  69. })
  70. }
  71. }
  72. this.init(options)
  73. },
  74. init(options) {
  75. var that = this
  76. util.getData('/getBanners')
  77. .then(res => {
  78. that.setData({
  79. arr: res
  80. })
  81. })
  82. that.setData({
  83. navH: app.globalData.navHeight
  84. })
  85. util.getData('/getMktInfos',{
  86. mi_branche_code: 110000
  87. }).then(res => {
  88. that.setData({
  89. mktarr: res
  90. })
  91. })
  92. that.setData({
  93. navH: app.globalData.navHeight
  94. })
  95. },
  96. mktImageChange: function(e) {
  97. this.setData({
  98. mktImgage: e.currentTarget.dataset.path
  99. })
  100. },
  101. //点击轮播图
  102. BhrefPm: function(e) {
  103. var index = e.currentTarget.dataset.index;
  104. if (index != null) {
  105. if (e.currentTarget.dataset.type == 1) {
  106. wx.navigateTo({
  107. url: '/pages/promotion/promotionhref?para=' + index
  108. })
  109. }
  110. if (e.currentTarget.dataset.type == 2) {
  111. wx.navigateTo({
  112. url: index
  113. })
  114. }
  115. }
  116. },
  117. onShareAppMessage: function() {
  118. return {
  119. title: '科技强国梦 编程向未来',
  120. path: '/pages/index/index?id=888'
  121. }
  122. },
  123. // map
  124. markertap: function(e) {
  125. wx.getLocation({
  126. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  127. success: function(res) {
  128. var latitude = e.currentTarget.dataset.latitude
  129. var longitude = e.currentTarget.dataset.longitude
  130. wx.openLocation({ //出发wx.openLocation API
  131. latitude: Number(latitude), //坐标纬度(从地图获取坐标)
  132. longitude: Number(longitude), //坐标经度(从地图获取坐标)
  133. name: e.currentTarget.dataset.name, //打开后显示的地址名称
  134. address: e.currentTarget.dataset.address, //打开后显示的地址汉字
  135. scale: 17
  136. })
  137. }
  138. })
  139. },
  140. })