C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 regels
2.7 KiB

  1. // pages/marketAtlas/marketAtlas.js
  2. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
  3. const Http = require("../../utils/HttpBasics");
  4. const config = require("../../config/config");
  5. let app = getApp();
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. navigationBarHeight,
  12. falgFloor:0,//楼座标识
  13. tierFalg:0,//楼层标识
  14. dataLsit:[],//楼层信息
  15. tmpePicture:'',//零时存放 图片
  16. },
  17. lookimg(){
  18. wx.previewImage({
  19. current: this.data.tmpePicture, // 当前显示图片的http链接
  20. urls: [this.data.tmpePicture] // 需要预览的图片http链接列表
  21. })
  22. },
  23. setFalgFloor(e){//设置选中楼层
  24. let index = e.currentTarget.dataset.index
  25. this.setData({
  26. falgFloor:index,
  27. tierFalg:0,
  28. })
  29. let tmepimg = ''
  30. if (this.data.dataLsit[index].floors[0].floorMaps && this.data.dataLsit[index].floors[0].floorMaps.length != 0) {
  31. tmepimg = this.data.dataLsit[index].floors[0].floorMaps[0].url
  32. } else {
  33. tmepimg = ''
  34. }
  35. this.setData({
  36. tmpePicture: tmepimg
  37. })
  38. },
  39. setTierFalg(e){//设置选中楼层
  40. let index = e.currentTarget.dataset.index
  41. let tmepimg = ''
  42. if (this.data.dataLsit[this.data.falgFloor].floors[index].floorMaps && this.data.dataLsit[this.data.falgFloor].floors[index].floorMaps.length!=0){
  43. tmepimg = this.data.dataLsit[this.data.falgFloor].floors[index].floorMaps[0].url
  44. }else{
  45. tmepimg = ''
  46. }
  47. this.setData({
  48. tierFalg: index,
  49. tmpePicture: tmepimg
  50. })
  51. },
  52. getStoreMap(){//获取楼层信息
  53. Http.get({
  54. url: config.api.getStoreMap
  55. }).then(res=>{
  56. //初始化地图
  57. let tmepimg = ''
  58. if (res.data[0].floors[0].floorMaps && res.data[0].floors[0].floorMaps.length != 0) {
  59. tmepimg = res.data[0].floors[0].floorMaps[0].url
  60. } else {
  61. tmepimg = ''
  62. }
  63. //拿取第一张地图
  64. this.setData({
  65. dataLsit:res.data,
  66. tmpePicture: tmepimg
  67. })
  68. })
  69. },
  70. /**
  71. * 生命周期函数--监听页面加载
  72. */
  73. onLoad: function (options) {
  74. this.getStoreMap()
  75. },
  76. /**
  77. * 生命周期函数--监听页面初次渲染完成
  78. */
  79. onReady: function () {
  80. },
  81. /**
  82. * 生命周期函数--监听页面显示
  83. */
  84. onShow: function () {
  85. },
  86. /**
  87. * 生命周期函数--监听页面隐藏
  88. */
  89. onHide: function () {
  90. },
  91. /**
  92. * 生命周期函数--监听页面卸载
  93. */
  94. onUnload: function () {
  95. },
  96. /**
  97. * 页面相关事件处理函数--监听用户下拉动作
  98. */
  99. onPullDownRefresh: function () {
  100. },
  101. /**
  102. * 页面上拉触底事件的处理函数
  103. */
  104. onReachBottom: function () {
  105. },
  106. /**
  107. * 用户点击右上角分享
  108. */
  109. onShareAppMessage: function () {
  110. }
  111. })