小程序:首页按钮功能完成;个人中心、生活物资页框架;体温上报定位权限获取失败提示信息;删除部分无用代码;
This commit is contained in:
		@@ -29,20 +29,21 @@ Page({
 | 
			
		||||
   * 生命周期函数--监听页面加载
 | 
			
		||||
   */
 | 
			
		||||
  onLoad(options) {
 | 
			
		||||
 | 
			
		||||
    console.log("residents/report onLoad")
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 生命周期函数--监听页面初次渲染完成
 | 
			
		||||
   */
 | 
			
		||||
  onReady() {
 | 
			
		||||
 | 
			
		||||
    console.log("residents/report onReady")
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 生命周期函数--监听页面显示
 | 
			
		||||
   */
 | 
			
		||||
  onShow() {
 | 
			
		||||
    console.log("residents/report onShow")
 | 
			
		||||
    if (this.data.isSkipOnShowFunc) {
 | 
			
		||||
      this.setData({
 | 
			
		||||
        isSkipOnShowFunc: false,
 | 
			
		||||
@@ -50,7 +51,6 @@ Page({
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    console.log('onShow')
 | 
			
		||||
    let userInfo = wx.getStorageSync("userInfo")
 | 
			
		||||
    console.log("userInfo", userInfo)
 | 
			
		||||
    this.setData({
 | 
			
		||||
@@ -121,14 +121,16 @@ Page({
 | 
			
		||||
   * 生命周期函数--监听页面隐藏
 | 
			
		||||
   */
 | 
			
		||||
  onHide() {
 | 
			
		||||
 | 
			
		||||
    console.log("residents/report onHide")
 | 
			
		||||
    clearInterval(this.data.timeInterval)
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * 生命周期函数--监听页面卸载
 | 
			
		||||
   */
 | 
			
		||||
  onUnload() {
 | 
			
		||||
 | 
			
		||||
    console.log("residents/report onUnload")
 | 
			
		||||
    clearInterval(this.data.timeInterval)
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
@@ -157,7 +159,6 @@ Page({
 | 
			
		||||
    this.setData({
 | 
			
		||||
      "formData.temperature": e.detail.value
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  updateTime() {
 | 
			
		||||
@@ -171,15 +172,26 @@ Page({
 | 
			
		||||
    wx.showLoading({
 | 
			
		||||
      title: '正在获取权限'
 | 
			
		||||
    })
 | 
			
		||||
    await new Promise((resolve) => {
 | 
			
		||||
    await new Promise((resolve, reject) => {
 | 
			
		||||
      wx.getSetting({
 | 
			
		||||
        success(res) {
 | 
			
		||||
          wx.hideLoading()
 | 
			
		||||
          if (!res.authSetting['scope.userLocation']) {
 | 
			
		||||
            wx.authorize({
 | 
			
		||||
              scope: 'scope.userLocationBackground',
 | 
			
		||||
              scope: 'scope.userLocation',
 | 
			
		||||
              // scope: 'scope.userLocationBackground',
 | 
			
		||||
              success() {
 | 
			
		||||
                resolve();
 | 
			
		||||
              },
 | 
			
		||||
              fail(err) {
 | 
			
		||||
                wx.showModal({
 | 
			
		||||
                  title: '定位失败',
 | 
			
		||||
                  content: '您已拒绝定位授权,小程序无法获取您的位置,请在微信首页长按删除小程序,重新打开再试',
 | 
			
		||||
                  showCancel: false,
 | 
			
		||||
                  complete: (res) => {
 | 
			
		||||
                    reject();
 | 
			
		||||
                  }
 | 
			
		||||
                })
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          } else {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user