zcinfo.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // pages/zcinfo/zcinfo.js
  2. import {
  3. getVo
  4. } from "../../../pages/api/gzw-api"
  5. import {
  6. js_date_time
  7. } from "../../../utils/util"
  8. import {
  9. imgUrl
  10. } from "../../../pages/api/request"
  11. var QQMapWX = require('../../../libs/qqmap-wx-jssdk.min.js');
  12. let BMap = {};
  13. Page({
  14. /**
  15. * 页面的初始数据
  16. */
  17. data: {
  18. imgUrl,
  19. current: 0,
  20. autoplay: false,
  21. duration: 500,
  22. interval: 5000,
  23. records: {},
  24. latitude: "",
  25. longitude: "",
  26. markers: [],
  27. gzwImgUrl:"http://219.152.50.209:81/api"
  28. },
  29. /**
  30. * 生命周期函数--监听页面加载
  31. */
  32. onLoad(options) {
  33. BMap = new QQMapWX({
  34. key: 'KN3BZ-KUDND-PGH4Y-POVRP-43KF3-RNF4K'
  35. });
  36. let param = {
  37. id: options.id
  38. }
  39. this.getInfo(param);
  40. },
  41. /**
  42. * 生命周期函数--监听页面初次渲染完成
  43. */
  44. onReady() {
  45. },
  46. /**
  47. * 生命周期函数--监听页面显示
  48. */
  49. onShow() {
  50. },
  51. /**
  52. * 生命周期函数--监听页面隐藏
  53. */
  54. onHide() {
  55. },
  56. /**
  57. * 生命周期函数--监听页面卸载
  58. */
  59. onUnload() {
  60. },
  61. /**
  62. * 页面相关事件处理函数--监听用户下拉动作
  63. */
  64. onPullDownRefresh() {
  65. },
  66. /**
  67. * 页面上拉触底事件的处理函数
  68. */
  69. onReachBottom() {
  70. },
  71. /**
  72. * 用户点击右上角分享
  73. */
  74. onShareAppMessage() {
  75. },
  76. getInfo(data) {
  77. getVo(data).then(res => {
  78. if (res.success) {
  79. let records = res.data
  80. const photoUrl = records.photoUrl.split(",")
  81. for (let i = 0; i < photoUrl.length; i++) {
  82. photoUrl[i] = this.data.gzwImgUrl+photoUrl[i];
  83. }
  84. records.photoUrl = photoUrl;
  85. records.reviewTime = js_date_time(records.reviewTime);
  86. this.setData({
  87. records,
  88. })
  89. let that = this;
  90. BMap.geocoder({
  91. address: records.targetLocation,
  92. success: function (data) {
  93. var res = data.result
  94. that.setData({
  95. latitude: res.location.lat,
  96. longitude: res.location.lng,
  97. markers: [{
  98. latitude: res.location.lat,
  99. longitude: res.location.lng,
  100. iconPath: "/location.png",
  101. width: '30px',
  102. height: '30px',
  103. rotate: 0,
  104. alpha: 1
  105. }]
  106. });
  107. }
  108. });
  109. }
  110. })
  111. }
  112. })