Browse Source

新增游客模式功能

kaileyhao 1 year ago
parent
commit
b4c95710a0

+ 1 - 0
app.js

@@ -5,6 +5,7 @@ App({
     
   },
   onLaunch: function () {
+    
     if (wx.canIUse('getUpdateManager')) {
       const updateManager = wx.getUpdateManager()
       updateManager.onCheckForUpdate(function (res) {

+ 1 - 1
app.json

@@ -15,7 +15,7 @@
     "pages/process/process",
     "pages/bind/bind",
     "pages/sessionList/sessionList",
-    
+    "pages/authRoute/index",
     "pages/userChat/userChat",
     "pages/send/send",
     "pages/select_express/select_express"

+ 840 - 60
pages/auth/index.js

@@ -1,74 +1,625 @@
-// pages/cssHeart/index.js
-var app=getApp();
+// pages/mapIndex/mapIndex.js
+import { $wuxSelect } from '../../dist/index'
+import { $wuxDialog } from '../../dist/index'
+import { $wuxToptips } from '../../dist/index'
+var app = getApp();
+var QQMapWX = require('../../utils/qqmap-wx-jssdk.js');
+var qqmapsdk;
+var centerlatitude="";
+var centerlongitude="";  //当前中心点经纬度
+var deviceArray=[];    //设备组列表
+var userArray=[];
+
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    localDomin: app.globalData.localDomin,
-    invite_id:"",
+    userToken:"",
+    userInfo:null,
+    localDomin: app.globalData.localDomin, 
+    userIndex:1,
+    equimentIndex:1,
+    menuShow:1,          //导航菜单栏活动 
+    bindTtqShow:false,    //是否展示绑定糖糖圈
+    ruleActiveIndex:0,
+    
+    slingShowGroup:false, //单个血糖仪列表展示
+
+    slingShow:false,     //预约信息列表
+    appointmentSlingShow: false, //展示已经预约设备
+    appointmentInt: [],   //初始化信息
+    appointmentInfo:[],   //预约成功的设备信息
+   
+    deviceInfo:[],       //单个点击选中的信息
+
+    appointmentArray:[],  //预约列表
+   
+    latitude: "23.56329",
+    longitude:"113.89308",
+    markers: [
+    
+    ],
+    userShowSling:false,  //点击用户位置展示
+    userDescInfo:"",
+    havePeople:true,
+    messageNum:0,
+    couponSlingShow:false,
+    advertisSlingShow:false,
+    socket9601: app.globalData.socket9601
   },
+  all(e) {
+    console.log(e, 'eeeeeeee')
+    var that = this
+    wx.request({
+      method: "post",
+      url: app.globalData.localHref + '/ThApi/TestWx/saveUserFormId.html',
+      data: { 'token': this.data.userToken, 'formid': e.detail.formId },
+      header: {
+        "Content-Type": "application/json"
+      },
+      success: function (res) {
 
-  //主动授权获取用户信息
-  onGotUserInfo: function (e) {
-    console.log(e)
-    var that = this;
+        console.log(e.detail.value); console.log(e.detail.formId);
+
+        console.log(res);
+
+      },
+      fail: function () {
+        console.log("请求失败")
+      }
+    })
+  },
+
+  //授权页点击事件
+    
+  person: function () {
+    //点击用户头像
+    wx.navigateTo({
+      url: '../authRoute/index',
+    })
+  },
+  
+  bindAccount: function () {
+    //绑定账号
+    wx.navigateTo({
+      url: '../authRoute/index',
+    })
+  },
+  bottleCenter() {
+    //跳转聊天列表
+    wx.navigateTo({
+      url: '../authRoute/index',
+    })
+  },
+  
+  poisitonCenter: function () {
+    //点击预约
+    wx.navigateTo({
+      url: '../authRoute/index',
+    })
+  },
+
+
+
+  //关闭优惠券弹出框
+  closeCouponBtn:function(){
+    app.globalData.couponShow = false;
+    app.globalData.couponShowTime = Date.parse(new Date()) + 60*1000*10;
+    this.setData({
+      couponSlingShow:false
+    })
+  },
+  //关闭广告业弹窗
+  closeSlingAdvertising:function(){
+    app.globalData.advertisShow = false;
+    app.globalData.advertisShowTime = Date.parse(new Date()) + (1000*60*60*24);
+    this.setData({
+      advertisSlingShow:false
+    })
+  },
+  //跳转活动页
+  jumpActive:function(){
+    var that=this;
+    wx.showLoading({
+      title: '数据加载中',
+      icon: 'loading',
+    })
+    wx.navigateTo({
+      url: '../h5/index?jumpHref=' + that.data.appointmentInt.activity.redirect_url,
+      success: function(res) {
+        
+      },
+      fail: function(res) {},
+      complete: function(res) {
+        setTimeout(function () {
+          wx.hideLoading();  //关闭loading
+        }, 500)
+      },
+    })
+
+
+    
+    
    
-    wx.login({
-      success: function (resLogin) {
-        console.log(resLogin);//获取登录code
-        wx.getUserInfo({
-          success: res => {
-            wx.showLoading({
-              title: '数据加载中',
-              icon: 'loading',
-            })
-            //允许授权
-            wx.request({
-              method: "post",
-              url: app.globalData.localHref + '/ThApi/User/login.html',
-              data: { code: resLogin.code, 
-                      encryptedData: res.encryptedData, 
-                      iv: res.iv ,
-                      invite_id: that.data.invite_id
-                      },
-              header: {
-                "Content-Type": "application/x-www-form-urlencoded"
-              },
-              success: function (res) {
-                console.log(res)
-                // 展示本地存储能力
-                wx.setStorageSync('userToken', res.data.data.token)
-                app.initSocket()
-                wx.reLaunch({
-                  url: '../mapIndex/mapIndex'
+  },
+  //领取优惠券
+  clickCoupon:function(e){
+    console.log(e)
+    var that=this;
+    var couponId = e.currentTarget.dataset.id;
+    var index = e.currentTarget.dataset.index;
+    
+    if (that.data.appointmentInt.coupon[index].checked==false){
+      return false;
+    }
+
+    wx.showLoading({
+      title: '数据加载中',
+      icon: 'loading',
+    })
+    wx.request({
+      method: "post",
+      url: app.globalData.localHref + '/ThApi/Service/receiveCoupon.html',
+      data: {
+        token: that.data.userToken,
+        coupon_id: couponId
+      },
+      header: {
+        "Content-Type": "application/x-www-form-urlencoded"
+      },
+      success: function (res) {
+        console.log(res)
+        setTimeout(function () {
+          wx.hideLoading();  //关闭loading
+        }, 200)
+        if (res.data.retCode == 1) {
+          wx.showModal({
+            title: '提示',
+            content: '领取成功',
+            showCancel: false,
+            success: function (res) {
+              if (res.confirm) {
+                that.setData({
+                  [`appointmentInt.coupon[${index}].checked`]: false
                 })
-                
-              },
-              fail: function (err) {
-                console.log(err)
+                console.log(that.data.appointmentInt.coupon[index])
+              }
+            }
+          }); 
+        }else{
+          wx.showToast({
+            title: res.data.msg,
+            icon: 'none',
+            duration: 2000
+          })
+        }
+      },
+      fail: function (err) {
+        console.log(err)
+      }
+    });
+  },
+
+  //点击漂流糖友按钮
+  userList:function(e){
+    console.log(e)
+    var that=this;
+    var userIndex=e.currentTarget.dataset.index;
+    if (userIndex==1){
+      that.setData({
+        userIndex:0
+      })
+    }else{
+      that.setData({
+        userIndex: 1
+      })
+    }
+    that.getEquimentList(centerlatitude, centerlongitude);
+  },
+
+  //点击漂流设备按钮
+  equimentList:function(e){
+    console.log(e)
+    var that=this;
+    var equimentIndex = e.currentTarget.dataset.index;
+    if (equimentIndex == 1) {
+      that.setData({
+        equimentIndex: 0
+      })
+    } else {
+      that.setData({
+        equimentIndex: 1
+      })
+    }
+    that.getEquimentList(centerlatitude, centerlongitude);
+  },
+
+  
+ 
+  
+  //获取当前位置
+  clickPositon: function () {
+    var that = this;
+    console.log(that.data.longitude)
+    if (that.data.longitude == "113.89308") {
+      wx.showModal({
+        title: '提示',
+        content: '获取位置信息才能正常使用该功能',
+        success(res) {
+          if (res.confirm) {
+            wx.openSetting({
+              success: (res) => {
+                setTimeout(function () {
+                  wx.getLocation({
+                    type: 'gcj02', //返回可以用于wx.openLocation的经纬度
+                    success: (res) => {
+                      that.setData({
+                        scale: 14,
+                        latitude: res.latitude,
+                        longitude: res.longitude,
+                      });
+                    },
+                  });
+                }, 500)
               }
             });
-          },
-          fail: res => {
-            //拒绝授权      
+          } else if (res.cancel) {
           }
+        }
+      })
+    } else {
+      //获取定位
+      wx.getLocation({
+        type: 'gcj02', //返回可以用于wx.openLocation的经纬度
+        success: (res) => {
+          that.setData({
+            scale: 14,
+            latitude: res.latitude,
+            longitude: res.longitude,
+          })
+        },
+      });
+    }
+  },
+
+  //跳转到订单详情
+  // orderDesc:function(e){
+  //   wx.navigateTo({
+  //     url: '../orderNo/index?orderId=' + e.currentTarget.dataset.orderid,
+  //     success: function(res) {},
+  //     fail: function(res) {},
+  //     complete: function(res) {},
+  //   })
+  // },
+   orderDesc:function(e){
+    wx.navigateTo({
+      url: '../process/process?reservation_no=' + e.currentTarget.dataset.orderid,
+      success: function(res) {},
+      fail: function(res) {},
+      complete: function(res) {},
+    })
+  },
+
+
+
+  //取消预订
+  appointmentBtn(e){
+    var that=this;
+    wx.showModal({
+      title: '',
+      content: '确认取消预订吗?',
+      cancelText: "不取消",
+      confirmText: "确认取消",
+      success(res) {
+        if (res.confirm) {
+          wx.showLoading({
+            title: '数据加载中',
+            icon: 'loading',
+          })
+          wx.request({
+            method: "post",
+            url: app.globalData.localHref + '/ThApi/Service/cancelReservation.html',
+            data: {
+              token: that.data.userToken,
+              reservation_no: e.currentTarget.dataset.id
+            },
+            header: {
+              "Content-Type": "application/x-www-form-urlencoded"
+            },
+            success: function (res) {
+              setTimeout(function () {
+                wx.hideLoading();  //关闭loading
+              }, 200)
+              if (res.data.retCode == 1) {
+                wx.showModal({
+                  title: '提示',
+                  content: '已取消预定,你可以重新选择糖化仪预约。定期测糖化,健康棒棒哒!',
+                  showCancel: false,
+                  success: function (res) {
+                    if (res.confirm) {
+                      that.setData({
+                        appointmentSlingShow:false   //关闭预约订单
+                      })
+                    }
+                  }
+                }); 
+              }else{
+                wx.showModal({
+                  title: '提示',
+                  content: res.data.msg,
+                  showCancel: false,
+                  success: function (res) {
+                    if (res.confirm) {
+                      
+                    }
+                  }
+                }); 
+              }
+            },
+            fail: function (err) {
+              setTimeout(function () {
+                wx.hideLoading();  //关闭loading
+              }, 200)
+              wx.showModal({
+                title: '提示',
+                content: res.msg,
+                showCancel: false,
+                success: function (res) {
+                  if (res.confirm) {
+
+                  }
+                }
+              }); 
+              console.log(err)
+            }
+          });
+        } else if (res.cancel) {
+          console.log('用户点击取消')
+        }
+      }
+    })
+  },
+
+  //点击预定设备
+  clickAppointment(e){
+    wx.showLoading({
+      title: '数据加载中',
+      icon: 'loading',
+    });
+    setTimeout(function(){
+      wx.hideLoading()
+    },500)
+
+    wx.navigateTo({
+      url: '../orderInfo/index?id=' + e.currentTarget.dataset.id + '&wait=' + e.currentTarget.dataset.wait + '&number=' + e.currentTarget.dataset.number + '&time=' + e.currentTarget.dataset.time,
+      
+    })
+  },
+
+  //点击查看位置
+  clickPosition(e){
+    wx.showLoading({
+      title: '数据加载中',
+      icon: 'loading',
+    })
+    var lat = parseFloat(e.currentTarget.dataset.lat);
+    var lng = parseFloat(e.currentTarget.dataset.lng);
+    wx.getLocation({
+      type: 'gcj02', //返回可以用于wx.openLocation的经纬度
+      success(res) {
+        wx.hideLoading();  //关闭loading
+        const latitude = lat
+        const longitude = lng
+        wx.openLocation({
+          latitude,
+          longitude,
+          scale: 10
         })
       }
     })
   },
+  
+
+  //中心经纬度切换
+  regionchange(e) {
+    var that=this;
+    var mapCtx = wx.createMapContext("map");
+    if (e.type=="end"){
+      mapCtx.getCenterLocation({
+        success: function (res) {
+          // wx.showLoading({
+          //   title: '数据加载中',
+          //   icon: 'loading',
+          // })
+          centerlatitude = res.latitude;
+          centerlongitude = res.longitude;  //当前中心点经纬度
+          console.log(res.latitude, res.longitude)
+         
+          that.getEquimentList(res.latitude, res.longitude);
+          that.getAppointmentList(centerlatitude, centerlongitude);
+          
+        }
+      })
+    }
+  },
 
+  //菜单选项
+  clickMenu:function(e){
+    this.setData({
+      menuShow: e.currentTarget.dataset.index
+    })
+  },
+  //规则table切换
+  tabClickRule: function (e) {
+    this.setData({
+      ruleActiveIndex: e.currentTarget.dataset.index
+    });
+  },
+  //关闭绑定糖糖圈
+  closeBindTtq:function(){
+    this.setData({
+      bindTtqShow:true
+    })
+  },
+  //点击地图图标
+  markertap: function (e) {
+    
+    var that = this
+    var positionId = e.markerId;
+    var type = positionId.split("_")[0];
+    var id = positionId.split("_")[1]
+    if (type =="device"){  //点击图标为设备
+      if (that.data.appointmentSlingShow==true){
+        return false;    //如果已经有预约设备禁止弹出
+      }
+      that.setData({
+        slingSlideDown: false,
+        slingShowGroup:true,    //打开当前弹层
+        slingShow: false    //关闭主弹层
+      })
 
+      // wx.showLoading({
+      //   title: '数据加载中',
+      //   icon: 'loading',
+      // })
+      // setTimeout(function () { wx.hideLoading();},300)
+      for (var i = 0; i < deviceArray.length; i++){
+        if (deviceArray[i]["device_id"] == id){
+          that.setData({
+            deviceInfo: deviceArray[i]
+          })
+        }
+      }
+    }
+    if (type=="user"){   //点击图标为用户瓶子
+      for (var i = 0; i < userArray.length ; i++){
+        if (id == userArray[i]["user_id"]){
+          
+          that.setData({
+            userShowSling: true,
+            userDescInfo: userArray[i],
+            longitude: userArray[i]["lng"],
+            latitude: userArray[i]["lat"]
+          })
+        }
+      }
+      
+    }
+  },
+  closeUserSling:function(){
+    this.setData({
+      userShowSling: false,
+    })
+  },
   
+  //预约列表关闭
+  arrowDown:function(){
+    var that=this;
+    that.setData({ 
+      slingSlideDown:true,
+    })
+    setTimeout(function(){
+      that.setData({
+        slingShow: false,
+        slingShowGroup: false
+      })
+    },200)
+  },
+  //寄出设备给下家
+  sendDeliver:function(e){
+    if (!this.data.havePeople){
+      wx.showToast({
+        title: '您的下家糖友走丢了,请您暂时保存设备',
+        icon: 'none',
+        duration: 2000
+      })
+    }else{
+      console.log('7898')
+      wx.navigateTo({
+        url: '../send/send?reservation_no=' + e.currentTarget.dataset.id + '&device_send_status=' + e.currentTarget.dataset.device_send_status,
+      })
+    }
+    
+  },
+  //查看物流信息
+  lookDeliver:function(e){
+    console.log(this.data.appointmentInfo[0].device_send_status,"appointmentInfo.device_send_status")
+    if (this.data.appointmentInfo[0].device_send_status == 4){
+      wx.navigateTo({
+        url: '../send/send?reservation_no=' + e.currentTarget.dataset.id + ' &device_send_status=' + this.data.appointmentInfo[0].device_send_status,
+        
+      })
+    } else{
+      wx.navigateTo({
+        url: '../express/index?reservation_no=' + e.currentTarget.dataset.id
+      })
+    }
+    
+  },
+
+  //修改糖化
+  editBlood:function(e){
+    console.log(e)
+    var hba1c=e.currentTarget.dataset.hba1c;
+    var reservation_no = e.currentTarget.dataset.reservation_no;
+    console.log(hba1c, reservation_no)
+    wx.navigateTo({
+      url: '../editBlood/index?reservation_no=' + reservation_no + '&new_value=' + hba1c,
+    })
+  },
+
+  //操作指南
+  lookStudy:function(){
+    
+    wx.navigateTo({
+      url: '../vedioPlay/index',
+    })
+  },
 
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    this.setData({
-      invite_id: wx.getStorageSync('invite_id')      //获取token缓存
+    if (options.id!=undefined){
+      // 展示本地存储能力
+      wx.setStorageSync('invite_id', options.id)
+    }else{
+      wx.setStorageSync('invite_id', "")
+    }
+    var that = this;
+    that.setData({
+      userToken: wx.getStorageSync('userToken')      //获取token缓存
+    });
+    
+    wx.getUserInfo({
+      success: res => {
+        // 可以将 res 发送给后台解码出 unionId
+        // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
+        // 所以此处加入 callback 以防止这种情况
+        that.setData({
+          userInfo: res.userInfo,     //获取用户头像
+        })
+        app.globalData.userInfo = res.userInfo
+      },
+    })
+    wx.getLocation({
+      type: 'gcj02', //返回可以用于wx.openLocation的经纬度    //获取当前经纬度信息
+      success: (res) => {
+        app.globalData.latitude=res.latitude,       //传送全局经纬度
+        app.globalData.longitude=res.longitude,
+          
+        that.setData({
+          scale: 14,
+          latitude: res.latitude,
+          longitude: res.longitude,
+        });
+
+        that.getUserLocation(res.latitude, res.longitude)
+      },
+       
     });
   },
 
@@ -83,23 +634,46 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-   
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
 
-  },
+    var _this = this;
+    // 实例化API核心类
+    // qqmapsdk = new QQMapWX({
+    //   key: 'N23BZ-ZAA3X-4ME4G-TRJVT-J6IY6-3SFVZ'
+    // });
+    
+    // var latitude = "22.55329";
+    // var longitude = "113.88308";
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
+     
+    // qqmapsdk.reverseGeocoder({
+    //   //位置坐标,默认获取当前位置,非必须参数
+    //   location: {
+    //     latitude: latitude,
+    //     longitude: longitude
+    //   },
+    //   //get_poi: 1, //是否返回周边POI列表:1.返回;0不返回(默认),非必须参数
+    //   success: function (res) {//成功后的回调
+    //     //console.log(res);
+    //   },
+    //   fail: function (error) {
+    //     console.error(error);
+    //   },
+    //   complete: function (res) {
+    //     //console.log(res);
+    //   }
+    // })
+    _this.setData({
+      bindTtqShow: app.globalData.ttqBind,    //全局绑定赋值
 
+    }); 
+    var that = this  
+    this.getUserStart();                             //初始化个人信息
+    app.globalData.callback = function (res) {
+      that.setData({
+        messageNum: that.data.messageNum+1
+      })
+    }
   },
-
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
@@ -118,11 +692,217 @@ Page({
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {
+    console.log(this.data.path)
     return {
       title: app.globalData.title,
       desc: app.globalData.desc,
-      path: app.globalData.path,
+      path: this.data.path,
       imageUrl: app.globalData.imageUrl,
     }
-  }
+  },
+
+  //获取初始化信息
+  getUserStart(){
+    var that=this;
+    wx.request({
+      method: "post",
+      url: app.globalData.localHref + '/ThApi/User/initData.html',
+      data: {
+        token: that.data.userToken
+      },
+      header: {
+        "Content-Type": "application/x-www-form-urlencoded"
+      },
+      success: function (res) {
+        console.log(res)
+        if (res.data.retCode==1){
+          app.globalData.ttqBind = res.data.data.ttq_account;  //赋值全局绑定信息
+          app.globalData.path = "pages/mapIndex/mapIndex?id=" + res.data.data.th_user_id;
+          that.setData({
+            path: "pages/mapIndex/mapIndex?id=" + res.data.data.th_user_id
+          })
+          if (res.data.data.reservation.length && res.data.data.reservation[0].next_reservation.avatar_url==undefined){
+            that.setData({
+              havePeople: false
+            })
+            
+          }else{
+            that.setData({
+              havePeople: true
+            })
+          }
+          console.log(that.data.havePeople, '123')
+          if (res.data.data.ttq_account==""){
+            that.setData({
+              bindTtqShow: false,     //判断用户是否已经绑定
+            })
+          }else{
+            that.setData({
+              bindTtqShow: true,     
+            })
+          }
+          if (res.data.data.reservation.length == 0){
+            that.setData({
+              ["appointmentInfo"]: res.data.data.reservation,
+              ["appointmentInt"]: res.data.data,
+              messageNum: res.data.data.unread_msg_count,
+              appointmentSlingShow: false,     //判断用户是否已经预约
+            })
+          }else{
+            that.setData({
+              ["appointmentInfo"]: res.data.data.reservation,
+              ["appointmentInt"]: res.data.data,
+              messageNum: res.data.data.unread_msg_count,
+              appointmentSlingShow: true,     //判断用户是否已经预约
+            })
+          }
+
+
+          if ((res.data.data.coupon.length > 0) && (app.globalData.couponShow == true)){
+            that.setData({
+              couponSlingShow: true
+            })
+          }else{
+            that.setData({
+              couponSlingShow: false
+            })
+          }
+
+          if ((res.data.data.activity.show == 1) && (app.globalData.advertisShow == true)) {
+              that.setData({
+                advertisSlingShow: true
+              })
+          }else{
+            that.setData({
+              advertisSlingShow: false
+            })
+          }
+        }
+
+        if (res.data.retCode == -1005) {
+          
+        }
+      },
+      fail: function (err) {
+        console.log(err)
+      }
+    });
+  },
+  //通过经纬度获取周边当前设备信息
+  getEquimentList(lat, lng){
+    var that = this;
+    
+    wx.request({
+      method: "post",
+      url: app.globalData.localHref + '/ThApi/Service/scopeForVisitor.html',
+      data: {
+        max_distance:10000,
+        lat: lat,
+        lng: lng
+      },
+      header: {
+        "Content-Type": "application/x-www-form-urlencoded"
+      },
+      success: function (res) {
+        console.log(res.data)
+        var newArray=new Array();
+        
+        if (res.data.retCode==1){
+          deviceArray= res.data.data.device;
+          userArray = res.data.data.user;
+
+          if (that.data.equimentIndex==1){   //用户点击瓶子才会展示
+            for (var i = 0; i < res.data.data.device.length; i++) {
+              newArray.push({
+                iconPath: app.globalData.localDomin + "/wechatProgram/images/equimenntIco.png",
+                id: 'device_' + res.data.data.device[i]["device_id"],
+                latitude: res.data.data.device[i]["lat"],
+                longitude: res.data.data.device[i]["lng"],
+                width: 30,
+                height: 30
+              })
+            }
+          }
+          
+          if (that.data.userIndex == 1) { //用户点击设备才会展示
+            for (var j = 0; j < res.data.data.user.length; j++) {
+              newArray.push({
+                iconPath: app.globalData.localDomin + "/wechatProgram/images/newBottleIco.png",
+                id: 'user_' + res.data.data.user[j]["user_id"],
+                latitude: res.data.data.user[j]["lat"],
+                longitude: res.data.data.user[j]["lng"],
+                width: 30,
+                height: 30
+              })
+            }
+          }
+
+          that.setData({
+            ["markers"]: newArray
+          })
+        }
+      },
+      fail: function (err) {
+        console.log(err)
+      }
+    });
+  },
+
+  //点击预约获取设备
+  getAppointmentList(lat, lng){
+    var that = this;
+    wx.request({
+      method: "post",
+      url: app.globalData.localHref + '/ThApi/Service/deviceFilter.html',
+      data: {
+        token: that.data.userToken,
+        filter_type: 1,
+        limit:100,
+        lat: lat,
+        lng: lng
+      },
+      header: {
+        "Content-Type": "application/x-www-form-urlencoded"
+      },
+      success: function (res) {
+        setTimeout(function () {
+          wx.hideLoading();  //关闭loading
+        },200)
+        if (res.data.retCode == 1) {
+          that.setData({
+            appointmentArray:res.data.data
+          })
+        }
+      },
+      fail: function (err) {
+        console.log(err)
+      }
+    });
+  },
+
+  //传送用户地理信息
+  getUserLocation(lat, lng) {
+    var that = this;
+    wx.request({
+      method: "post",
+      url: app.globalData.localHref + '/ThApi/User/location.html',
+      data: {
+        token: that.data.userToken,
+        lat: lat,
+        lng: lng
+      },
+      header: {
+        "Content-Type": "application/x-www-form-urlencoded"
+      },
+      success: function (res) {
+        if (res.data.retCode == 1) {
+          
+        }
+      },
+      fail: function (err) {
+        console.log(err)
+      }
+    });
+  },
+
 })

+ 9 - 1
pages/auth/index.json

@@ -1,3 +1,11 @@
 {
-  "navigationBarTitleText": "缘分糖化漂流"
+  "navigationBarTitleText": "糖化缘分漂流",
+  "usingComponents": {
+    "wux-cell-group": "../../dist/cell-group/index",
+    "wux-cell": "../../dist/cell/index",
+    "wux-select": "../../dist/select/index",
+    "wux-button": "../../dist/button/index",
+    "wux-dialog": "../../dist/dialog/index",
+    "wux-toptips": "../../dist/toptips/index"
+  }
 }

File diff suppressed because it is too large
+ 396 - 11
pages/auth/index.wxml


+ 136 - 9
pages/auth/index.wxss

@@ -1,9 +1,136 @@
-/* pages/cssHeart/index.wxss */
-.authSling{position: fixed;left: 0; width: 750rpx; height: 100%; background-color: rgba(0,0,0, .5)}
-.authContatn{overflow: hidden; margin: auto; margin-top: 130rpx; width:540rpx;height: auto;text-align: center;
-background: linear-gradient(to right, #64c5f7 , #06a0f0);border-radius: 20rpx;background-color: #06a0f0}
-.authImg{margin: auto; margin-top: 70rpx; width:130rpx;height: 130rpx;border-radius: 100%}
-.authTitle{margin-top: 30rpx;text-align: center;letter-spacing: 5rpx; font-size: 32rpx;color: #fff;font-weight: bold}
-.authTxt{margin: auto; margin-top: 50rpx; width: 430rpx;height: auto; line-height: 40rpx; text-align: center;font-size: 28rpx;color: #fff;}
-.authBtnContant{margin-top: 80rpx; width: 540rpx;height:220rpx;background-color: #fff }
-.clickAuth{width: 420rpx;height: 90rpx;color: #fff;line-height: 90rpx; letter-spacing: 5rpx; background-color:#04a6fa;border-radius: 50rpx;}
+/* pages/mapIndex/mapIndex.wxss */
+.left{float: left}
+.right{float: right}
+.menu{position: fixed;left: 0;top: 0; z-index: 9999; width: 750rpx;height: 80rpx; border-top:1rpx solid #eeeeee;  background-color: #fff;}
+.menuImg{margin-left: 20rpx; margin-top: 7rpx; width: 64rpx;height: 64rpx;text-align: center; border-radius: 100%;background-color: #fff}
+.menuImg .image{float: left; margin-left: 2rpx; margin-top: 2rpx; width: 60rpx;height: 60rpx;border-radius: 100%}
+
+.menuTxt{width: 130rpx; height: 60rpx; margin-left: 30rpx; line-height: 60rpx;color: #444444;font-size: 28rpx;text-align: center }
+.menuTxtActive{color: #04a6fa; border-bottom: 5rpx solid #04a6fa;}
+
+.bindTtq{position: absolute; top: 95rpx; left: 30rpx; width: 690rpx;height: 70rpx; line-height: 70rpx; text-align: center; font-size:24rpx; color: #444; background-color: #fff;border-radius: 10rpx;}
+.closeBindTtq{position: absolute;top: 0; right: 0;width: 70rpx;height: 70rpx;}
+.closeBindTtq cover-image{margin: auto; margin-top: 25rpx; width:20rpx;height: 20rpx}
+
+.bottleIco{position: absolute; top: 180rpx; left: 0rpx; width: 750rpx;height: 120rpx;}
+.bottleIco cover-image{width: 80rpx;height: 80rpx;}
+.bottleIco cover-view{text-align: center}
+.bottleTxt{margin-left: -10rpx; width: 100rpx; line-height: 40rpx;font-size: 20rpx;}
+
+.positionUser{position: absolute;left: 50%;bottom:50%;margin-left: -30rpx;margin-top: -30rpx; width: 60rpx;height: 60rpx;}
+
+.positionUser{position: absolute;left: 50%;bottom:50%;margin-left: -30rpx;margin-top: -30rpx; width: 60rpx;height: 60rpx;}
+.poisitonCenter{position: absolute;left: 50%;bottom:10%;font-size: 32rpx; color: #fff; margin-left: -150rpx;text-align: center; width: 300rpx;height: 90rpx; line-height: 90rpx; background-color: #07a4ed;border-radius: 50rpx;}
+
+.positionClick{position: absolute; left: 40rpx; bottom:30%;}
+.positionClick cover-image{width:80rpx;height: 80rpx;}
+
+.personCenter{position: absolute; right: 40rpx; bottom:30%;width:80rpx;height: 80rpx;}
+.personCenter cover-image{margin-left: 6rpx;margin-top: 7rpx; width:70rpx;height: 70rpx;}
+
+.messageNum{position: absolute;z-index: 999; top:5rpx; right: 5rpx; width: 30rpx;height: 30rpx; color: #fff;font-size: 22rpx;line-height: 30rpx; text-align: center; border-radius: 100%;background-color: red}
+
+.glucoseContant{position: absolute; z-index: 999; bottom: 0rpx; left: 0rpx; width: 750rpx;height: 550rpx;background-color: rgba(0, 0, 0, 0)}
+.arrow cover-image{margin:auto; text-align:center;width: 64rpx;height: 64rpx;}
+.arrow cover-view:nth-child(1){
+  animation-name: arrowDown; /*动画的名称 */
+  animation-duration: 1000ms; /*动画从开始到结束的时间*/
+  animation-timing-function: linear; /*动画执行快慢的参数*/
+  animation-iteration-count:infinite; /*动画执行快慢的参数*/
+  animation-delay: 200ms; 
+}
+.arrow cover-view:nth-child(2){
+  animation-name: arrowDown; /*动画的名称 */
+  animation-duration: 1000ms; /*动画从开始到结束的时间*/
+  animation-timing-function: linear; /*动画执行快慢的参数*/
+  animation-iteration-count:infinite; /*动画执行快慢的参数*/
+  animation-delay: 300ms; 
+}
+@keyframes arrowDown 
+{
+  0%   {-webkit-opacity: 0;}
+  50%  {-webkit-opacity: .3;}
+  75%  {-webkit-opacity: .7;}
+  100% {-webkit-opacity:1;}
+}
+.slingShowActive{
+  animation-name: slingDown; /*动画的名称 */
+  animation-duration: 200ms; /*动画从开始到结束的时间*/
+  animation-timing-function: linear; /*动画执行快慢的参数*/
+  animation-iteration-count:1; /*动画执行快慢的参数*/ 
+}
+@keyframes slingDown{
+  0%   {bottom: 0;}
+  100% {bottom:-100%;}
+}
+.equimentList{position: relative;padding-bottom: 10rpx;padding-top: 15rpx; margin: auto; margin-top:15rpx;  width:700rpx;height: 200rpx;background-color: #fff;border-radius: 10rpx;box-shadow: 0rpx 0rpx 10rpx gray}
+.equimentListTop{margin: auto; width:630rpx;height: auto;}
+.equimentListTopLeft{width: 450rpx;height: 120rpx; line-height: 60rpx; font-size: 26rpx; color: #757575;}
+.equimentListTopRight{position: absolute;z-index: 99; left: 400rpx;top:0rpx; width:120rpx;height: 120rpx;}
+
+.equimentListIcon{position: absolute;z-index: 99;left: 620rpx;top:90rpx; width: 30rpx;height: 30rpx;}
+
+.split{ clear:both;width:500rpx;height:1rpx;background-color:#eee}
+.equimentTime{margin: auto; width: 630rpx;line-height: 80rpx;font-size:26rpx;color:#333333 }
+
+.equimentListLeft{margin-left: 15rpx; width:520rpx;height: 270rpx;}
+.equimentListTitle{font-size:26rpx;color:#757575;line-height: 60rpx;}
+.equimentListTxt{font-size:24rpx;color:#333333;line-height: 60rpx;}
+
+.equimentListRight{margin-right: 15rpx; width:170rpx;height: 270rpx;}
+.appointmentBtn{margin: auto; width: 160rpx;height: 60rpx;font-size: 28rpx; background-color: #04a6fa;color: #fff;text-align: center;line-height: 60rpx;border-radius: 30rpx;}
+
+.clickBtn{position: absolute; z-index: 99; left:510rpx; top:200rpx;  width:160rpx;height: 60rpx;}
+
+
+.ruleNav{position: fixed; top:80rpx; left: 25rpx;  margin: auto; width:710rpx;height: 80rpx;background-color: #fff;border-radius: 10rpx 10rpx 0 0;border-bottom:1rpx solid #dcdcdc;}
+.ruleNavTitle{width:236rpx;height: 80rpx;text-align: center; line-height: 80rpx;color: #333333;font-weight: bold;font-size: 28rpx;}
+.ruleNavTitleActive{color:#07a4ed}
+
+
+.ruleContant{margin: auto;padding: 30rpx;width: 650rpx;height:auto; background-color: #fff;border-radius: 0rpx 0rpx 10rpx 10rpx;}
+.ruleContantTitle{font-size:28rpx;font-weight:bold;text-align:left;color:#333333;}
+.ruleContantTxt{padding:0rpx 0 15rpx 0rpx; margin-bottom: 15rpx;  font-size:28rpx;text-align:left;color:#555555;border-bottom: 1rpx solid #eeeeee}
+.ruleContantTxt1{padding:15rpx 0 0rpx 0rpx; margin-bottom: 15rpx;  font-size:28rpx;text-align:left;color:#555555;}
+
+.clickAppointment{margin-left: 80rpx; margin-top: 5rpx; width:120rpx;height: 50rpx;text-align: center;color: #fff; line-height: 50rpx; background-color: #07a4ed;border-radius: 50rpx; }
+
+
+/* 弹出用户信息 */
+.userInfoContant{position: fixed;z-index: 999; width: 100%;height: 100% ;background-color: rgba(0, 0, 0, .5)}
+.userInfo{position: fixed;left: 50%; top:50%; margin-left: -225rpx; margin-top: -210rpx; z-index: 999; width:450rpx;height: 190rpx;}
+.userDesc{width: 450rpx;height:170rpx;background-color: #fff;border-radius: 15rpx;}
+.downIco{margin: auto; width: 30rpx;height: 19rpx;}
+
+cover-view{white-space:normal}
+.userImg{padding: 10rpx;width:95rpx;height:170rpx;}
+.userImg cover-image{ width: 90rpx;height: 90rpx;border-radius: 100%;border: 2rpx solid #04a6fa;}
+.userTxt{margin-left: 10rpx; width: 320rpx;height: 170rpx;}
+.userName{width: 270rpx; height: 40rpx; line-height: 40rpx; font-size: 30rpx;padding: 10rpx;color: #444;font-weight: bold;}
+.userTag{padding: 5rpx;width: 320rpx; height: 50rpx; font-size: 24rpx;color: #a5a5a5;}
+.userTH{margin-left: 10rpx; margin-top: 0rpx; width: 320rpx;height: 40rpx;font-size: 28rpx;color: #04a6fa;font-weight: bold; line-height: 40rpx;}
+.timeString{margin-left: 10rpx;height: 40rpx; width: 320rpx; color:#aaa;font-size:24rpx;}
+.edit{float: right; width: 60rpx;height: 60rpx;}
+.editImg{margin-left: 0rpx; margin-top: 0rpx; width: 40rpx;height: 40rpx;}
+.userType{float: left; text-indent: 10rpx; color:#333;  font-size: 24rpx;}
+
+
+
+
+.slingCoupon{position: absolute;top:0;left: 0rpx; z-index: 1000; width: 100%;height: 100%;background-color: rgba(0, 0, 0, .5)}
+.couponContant{position: absolute; left: 110rpx; top: 50%; margin-top: -300rpx; width: 530rpx;height: 600rpx;background-color: #fff;border-radius: 10rpx;}
+.couponTop{width: 530rpx;height:70rpx;text-align: center; font-size:26rpx;color:#8b8b8b; line-height: 70rpx;}
+.closeCouponBtn{margin-top: -70rpx; width: 70rpx;height: 70rpx;}
+.couponBottom{overflow-y: scroll;-webkit-overflow-scrolling : touch; width: 530rpx;height: 530rpx;}
+.couponList{margin: auto; margin-top: 10rpx; margin-bottom: 10rpx; width: 490rpx;height: 125rpx;}
+.couponTitle{margin-top: -110rpx; margin-left: 80rpx; width:350rpx;color:#07a4ed;font-size: 26rpx;}
+.couponTxt{margin-top: 10rpx; margin-left: 80rpx; width:350rpx;color:#444444;font-size: 22rpx;}
+.couponData{margin-top: 5rpx; margin-left: 100rpx; width:300rpx;text-align: right; color:#757575;font-size: 20rpx;}
+
+.slingAdvertising{position: absolute;top:0;left: 0rpx; z-index: 1000; width: 100%;height: 100%;background-color: rgba(0, 0, 0, .5)}
+.slingAdvertisingImg{position: absolute;top:45%;left: 50%;width:550rpx;height:700rpx;margin-left: -275rpx;margin-top: -300rpx;border-radius: 10rpx;}
+.closeSlingAdvertising{position: absolute;top:85%;left: 50%;width: 64rpx;height: 64rpx; margin-left: -32rpx;}
+.closeSlingAdvertising cover-image{width: 64rpx;height: 64rpx;}
+.form_btn button::after{
+  border:none;
+}

+ 128 - 0
pages/authRoute/index.js

@@ -0,0 +1,128 @@
+// pages/cssHeart/index.js
+var app=getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    localDomin: app.globalData.localDomin,
+    invite_id:"",
+  },
+
+  //主动授权获取用户信息
+  onGotUserInfo: function (e) {
+    console.log(e)
+    var that = this;
+   
+    wx.login({
+      success: function (resLogin) {
+        console.log(resLogin);//获取登录code
+        wx.getUserInfo({
+          success: res => {
+            wx.showLoading({
+              title: '数据加载中',
+              icon: 'loading',
+            })
+            //允许授权
+            wx.request({
+              method: "post",
+              url: app.globalData.localHref + '/ThApi/User/login.html',
+              data: { code: resLogin.code, 
+                      encryptedData: res.encryptedData, 
+                      iv: res.iv ,
+                      invite_id: that.data.invite_id
+                      },
+              header: {
+                "Content-Type": "application/x-www-form-urlencoded"
+              },
+              success: function (res) {
+                console.log(res)
+                // 展示本地存储能力
+                wx.setStorageSync('userToken', res.data.data.token)
+                app.initSocket()
+                wx.reLaunch({
+                  url: '../mapIndex/mapIndex'
+                })
+                
+              },
+              fail: function (err) {
+                console.log(err)
+              }
+            });
+          },
+          fail: res => {
+            //拒绝授权      
+          }
+        })
+      }
+    })
+  },
+
+
+  
+
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      invite_id: wx.getStorageSync('invite_id')      //获取token缓存
+    });
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+   
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+    return {
+      title: app.globalData.title,
+      desc: app.globalData.desc,
+      path: app.globalData.path,
+      imageUrl: app.globalData.imageUrl,
+    }
+  }
+})

+ 3 - 0
pages/authRoute/index.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "缘分糖化漂流"
+}

+ 16 - 0
pages/authRoute/index.wxml

@@ -0,0 +1,16 @@
+<!--pages/cssHeart/index.wxml-->
+<!--授权弹出窗口-->
+<view wx:if="1" class='authSling'>
+  <view class='authContatn'>
+    <view><image class='authImg' src='{{localDomin}}/wechatProgram/images/authBottle.png' mode='cover'></image></view>
+    <view class='authTitle'>共享糖化</view>
+    <view class='authTxt'>请先通过微信授权,放心参与糖化缘分漂流您的信息数据将受到保护</view>
+    <view class='authBtnContant'>
+      <view style='width:100rpx;height:60rpx'></view>
+      <button class="clickAuth" open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="onGotUserInfo">请求授权</button>
+    </view>
+  </view>
+</view>
+
+
+

+ 9 - 0
pages/authRoute/index.wxss

@@ -0,0 +1,9 @@
+/* pages/cssHeart/index.wxss */
+.authSling{position: fixed;left: 0; width: 750rpx; height: 100%; background-color: rgba(0,0,0, .5)}
+.authContatn{overflow: hidden; margin: auto; margin-top: 130rpx; width:540rpx;height: auto;text-align: center;
+background: linear-gradient(to right, #64c5f7 , #06a0f0);border-radius: 20rpx;background-color: #06a0f0}
+.authImg{margin: auto; margin-top: 70rpx; width:130rpx;height: 130rpx;border-radius: 100%}
+.authTitle{margin-top: 30rpx;text-align: center;letter-spacing: 5rpx; font-size: 32rpx;color: #fff;font-weight: bold}
+.authTxt{margin: auto; margin-top: 50rpx; width: 430rpx;height: auto; line-height: 40rpx; text-align: center;font-size: 28rpx;color: #fff;}
+.authBtnContant{margin-top: 80rpx; width: 540rpx;height:220rpx;background-color: #fff }
+.clickAuth{width: 420rpx;height: 90rpx;color: #fff;line-height: 90rpx; letter-spacing: 5rpx; background-color:#04a6fa;border-radius: 50rpx;}

+ 6 - 0
pages/mapIndex/mapIndex.js

@@ -788,6 +788,12 @@ Page({
             })
           }
         }
+
+        if (res.data.retCode == -1005) {
+          wx.navigateTo({
+            url: '../auth/index',
+          })
+        }
       },
       fail: function (err) {
         console.log(err)