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.

147 lines
3.1 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. url:"",
  16. },
  17. lookimg(){
  18. app.globalData.previewFlag = true
  19. wx.previewImage({
  20. current: this.data.tmpePicture, // 当前显示图片的http链接
  21. urls: [this.data.tmpePicture] // 需要预览的图片http链接列表
  22. })
  23. },
  24. setFalgFloor(e){//设置选中楼层
  25. let index = e.currentTarget.dataset.index
  26. this.setData({
  27. falgFloor:index,
  28. tierFalg:0,
  29. })
  30. let tmepimg = ''
  31. if (this.data.dataLsit[index].floors[0].floorMaps && this.data.dataLsit[index].floors[0].floorMaps.length != 0) {
  32. tmepimg = this.data.dataLsit[index].floors[0].floorMaps[0].url
  33. } else {
  34. tmepimg = ''
  35. }
  36. this.setData({
  37. tmpePicture: tmepimg
  38. })
  39. },
  40. setTierFalg(e){//设置选中楼层
  41. let index = e.currentTarget.dataset.index
  42. let tmepimg = ''
  43. if (this.data.dataLsit[this.data.falgFloor].floors[index].floorMaps && this.data.dataLsit[this.data.falgFloor].floors[index].floorMaps.length!=0){
  44. tmepimg = this.data.dataLsit[this.data.falgFloor].floors[index].floorMaps[0].url
  45. }else{
  46. tmepimg = ''
  47. }
  48. this.setData({
  49. tierFalg: index,
  50. tmpePicture: tmepimg
  51. })
  52. },
  53. // imgload(e){
  54. // console.log(e.detail.width,e.detail.height)
  55. // if (e.detail.width > e.detail.height){
  56. // this.setData({
  57. // img_W_H_flag :true
  58. // })
  59. // }else{
  60. // this.setData({
  61. // img_W_H_flag: false
  62. // })
  63. // }
  64. // },
  65. getStoreMap(){//获取楼层信息
  66. Http.get({
  67. url: config.api.getStoreMap
  68. }).then(res=>{
  69. //初始化地图
  70. let tmepimg = ''
  71. if (res.data[0].floors[0].floorMaps && res.data[0].floors[0].floorMaps.length != 0) {
  72. tmepimg = res.data[0].floors[0].floorMaps[0].url
  73. } else {
  74. tmepimg = ''
  75. }
  76. //拿取第一张地图
  77. this.setData({
  78. dataLsit:res.data,
  79. tmpePicture: tmepimg
  80. })
  81. })
  82. },
  83. /**
  84. * 生命周期函数--监听页面加载
  85. */
  86. onLoad: function (options) {
  87. this.getStoreMap()
  88. this.setData({
  89. url: config.url +'/wapmaphtml/index.html'
  90. })
  91. console.log(this.data.url,"url")
  92. },
  93. /**
  94. * 生命周期函数--监听页面初次渲染完成
  95. */
  96. onReady: function () {
  97. },
  98. /**
  99. * 生命周期函数--监听页面显示
  100. */
  101. onShow: function () {
  102. },
  103. /**
  104. * 生命周期函数--监听页面隐藏
  105. */
  106. onHide: function () {
  107. },
  108. /**
  109. * 生命周期函数--监听页面卸载
  110. */
  111. onUnload: function () {
  112. },
  113. /**
  114. * 页面相关事件处理函数--监听用户下拉动作
  115. */
  116. onPullDownRefresh: function () {
  117. },
  118. /**
  119. * 页面上拉触底事件的处理函数
  120. */
  121. onReachBottom: function () {
  122. },
  123. /**
  124. * 用户点击右上角分享
  125. */
  126. onShareAppMessage: function () {
  127. }
  128. })