抖音c端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

91 行
2.2 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'
  2. const util = require("../../utils/util.js");
  3. const Http = require("../../utils/HttpBasics");
  4. const config = require("../../config/config");
  5. const imgurl = require("../../utils/imgurl");
  6. Page({
  7. data: {
  8. navigationBarHeight,
  9. latitude: null,
  10. longitude: null,
  11. markers: [],//标记点
  12. polyline: [],//路线
  13. circles:[],
  14. },
  15. getLocation() {
  16. let that = this;
  17. tt.getLocation({
  18. type: "wgs84",
  19. success: function (res) {
  20. console.log(res, 9999)
  21. if (res && res.longitude && res.latitude) {
  22. that.setData({
  23. latitude: res.latitude,
  24. longitude: res.longitude,
  25. circles:[{
  26. latitude: res.latitude,
  27. longitude: res.longitude,
  28. radius: 400,
  29. },]
  30. })
  31. }
  32. },
  33. fail: error => {
  34. console.log(error);
  35. }
  36. })
  37. },
  38. onLoad: function (options) {
  39. let that = this;
  40. let tempMarkers = []
  41. let polyline = []
  42. // tt.authorize({
  43. // scope: "scope.userLocation",
  44. // success(res) {
  45. // console.log(res, res.data);
  46. // // if (res.data["scope.userLocation"] === "ok") that.msg("您已允许授权");
  47. // },
  48. // fail(err) {
  49. // console.log(err);
  50. // // if (err.data["scope.userLocation"] === "auth deny")
  51. // // that.msg("您已拒绝授权");
  52. // },
  53. // });
  54. that.getLocation()
  55. tempMarkers.push({
  56. id: 1,
  57. longitude: Number(options.longitude),
  58. latitude: Number(options.latitude),
  59. title: "店铺位置",
  60. alpha: 0.6,
  61. anchorX: 0.5,
  62. anchorY: 1,
  63. })
  64. polyline.push({
  65. points: [
  66. {
  67. longitude: Number(options.longitude),
  68. latitude: Number(options.latitude),
  69. }
  70. ],
  71. color: "#222222",
  72. width: 4,
  73. dottedLine: false,
  74. colorList: ["#000022", "#220000"],
  75. borderColor: "#222222",
  76. borderWidth: 0,
  77. })
  78. that.setData({
  79. markers: tempMarkers
  80. })
  81. // console.log(this.data.latitude,this.data.longitude);
  82. },
  83. onReady(e) {
  84. this.mapCtx = tt.createMapContext("myMap");
  85. },
  86. })