odc.xiaohui
2023-05-12 4b48bacef8646cee8b66f5e10b0ed7124534e93e
miniprogram/pages/user/report/submitReport/index.ts
@@ -4,6 +4,7 @@
import { formatTime } from 'miniprogram/utils/util';
Page({
    data: {
        phoneDisab:true,
        isInGroup:'',
        remarks: '',
        addFig:false,
@@ -81,6 +82,11 @@
    getuserIdCard(e) {
        this.setData({
            userIdCard: e.detail
        })
    },
    getuserPhone(e){
        this.setData({
            phone: e.detail
        })
    },
    getLocation(e) {
@@ -273,6 +279,22 @@
        //     })
        //     return
        // }
      if (wx.getStorageSync('role')==1) {
        wx.request(
            {
                url: submitReport.globalData.url + "/wx/user/policeAddReport",
                method: this.data.addFig?"PUT":"POST",
                data: this.data.reportDetail,
                header: {
                    'token': wx.getStorageSync('token'),
                    'content-type': 'application/json'
                }, success: (res) => {
                    wx.reLaunch({
                        url: '../../report/index'
                    })
                }
            })
      }else{
        wx.request(
            {
                url: submitReport.globalData.url + "/wx/user/addReport",
@@ -287,10 +309,18 @@
                    })
                }
            })
      }
    },
    onLoad:function(e) {
        console.log(e);
        let that = this
        let role = wx.getStorageSync('role')
        if (role==1) {
            that.setData({
                phoneDisab :false
            })
        }
        let phone = wx.getStorageSync('phone')
        that.setData({
            phone: phone