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.

141 lines
3.0 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
  2. const Http = require("../../utils/HttpBasics");
  3. const config = require("../../config/config");
  4. let app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. navigationBarHeight,
  11. falgFloor:0,//楼座标识
  12. tierFalg:0,//楼层标识
  13. dataLsit:[],//楼层信息
  14. tmpePicture:'',//零时存放 图片
  15. },
  16. lookimg(){
  17. app.globalData.previewFlag = true
  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. // imgload(e){
  53. // console.log(e.detail.width,e.detail.height)
  54. // if (e.detail.width > e.detail.height){
  55. // this.setData({
  56. // img_W_H_flag :true
  57. // })
  58. // }else{
  59. // this.setData({
  60. // img_W_H_flag: false
  61. // })
  62. // }
  63. // },
  64. getStoreMap(){//获取楼层信息
  65. Http.get({
  66. url: config.api.getStoreMap
  67. }).then(res=>{
  68. //初始化地图
  69. let tmepimg = ''
  70. if (res.data[0].floors[0].floorMaps && res.data[0].floors[0].floorMaps.length != 0) {
  71. tmepimg = res.data[0].floors[0].floorMaps[0].url
  72. } else {
  73. tmepimg = ''
  74. }
  75. //拿取第一张地图
  76. this.setData({
  77. dataLsit:res.data,
  78. tmpePicture: tmepimg
  79. })
  80. })
  81. },
  82. /**
  83. * 生命周期函数--监听页面加载
  84. */
  85. onLoad: function (options) {
  86. this.getStoreMap()
  87. },
  88. /**
  89. * 生命周期函数--监听页面初次渲染完成
  90. */
  91. onReady: function () {
  92. },
  93. /**
  94. * 生命周期函数--监听页面显示
  95. */
  96. onShow: function () {
  97. },
  98. /**
  99. * 生命周期函数--监听页面隐藏
  100. */
  101. onHide: function () {
  102. },
  103. /**
  104. * 生命周期函数--监听页面卸载
  105. */
  106. onUnload: function () {
  107. },
  108. /**
  109. * 页面相关事件处理函数--监听用户下拉动作
  110. */
  111. onPullDownRefresh: function () {
  112. },
  113. /**
  114. * 页面上拉触底事件的处理函数
  115. */
  116. onReachBottom: function () {
  117. },
  118. /**
  119. * 用户点击右上角分享
  120. */
  121. onShareAppMessage: function () {
  122. }
  123. })