riku
2025-04-27 f46786f11c5c08ead7501a82e5a71430ad69b782
pages/cluetask/question/index.js
@@ -1,6 +1,7 @@
import { cluePicUrl } from '../../../config/index';
import { questionForm } from '../clue-item.js';
import { toLabel, toValue } from '../../../common/dataTowns';
import mapUtils from '../../../utils/map-utils';
import { uploadQuestion, updateQuestion } from '../../../services/clue/fetchClue';
@@ -173,14 +174,25 @@
  // 从地图选择定位
  chooseLocation() {
    const { locations } = this.data;
    let lng, lat;
    if (typeof locations.longitude === 'number' && typeof locations.latitude === 'number') {
      const coor = mapUtils.wgs84togcj02(locations.longitude, locations.latitude);
      lng = coor[0];
      lat = coor[1];
    }
    wx.chooseLocation({
      longitude: locations.longitude,
      latitude: locations.latitude,
      longitude: lng,
      latitude: lat,
      success: res => {
        const [lngGps, latGps] = mapUtils.gcj02towgs84(res.longitude, res.latitude);
        this.setData({
          locations: {
            ...res,
            coorTxt: `${res.longitude},${res.latitude}`,
            name: res.name,
            address: res.address,
            // 使用 gcj02 国测局坐标系
            longitude: lngGps,
            latitude: latGps,
            coorTxt: `${lngGps},${latGps}`,
          },
        });
      },
@@ -189,20 +201,20 @@
  // 添加图片
  handleAddImg(e) {
    wx.chooseAddress({
    // wx.chooseAddress({
      
    })
    wx.getLocation({
      type:'wgs84',
      success:res=>{
        this.setData({
          locations: {
            ...res,
            coorTxt: `${res.longitude},${res.latitude}`,
          },
        });
      }
    })
    // })
    // wx.getLocation({
    //   type:'wgs84',
    //   success:res=>{
    //     this.setData({
    //       locations: {
    //         ...res,
    //         coorTxt: `${res.longitude},${res.latitude}`,
    //       },
    //     });
    //   }
    // })
    const { fileList } = this.data;
    const { files } = e.detail;
    this.setData({