roose 4 лет назад
Родитель
Сommit
de6a004b17

+ 34 - 4
pages/index/index.js

@@ -20,7 +20,18 @@ Page({
     vertical: false,
     vertical: false,
     autoplay: true,
     autoplay: true,
     interval: 5000,
     interval: 5000,
-    duration: 500
+    duration: 500,
+    number: {},
+    msgList: [
+      {
+        url: "url",
+        title: "欢迎来到吉顺致养小程序"
+      },
+      {
+        url: "url",
+        title: "欢迎来到吉顺致养小程序"
+      },
+    ]
   },
   },
   goCollect() {
   goCollect() {
     wx.switchTab({
     wx.switchTab({
@@ -65,9 +76,28 @@ Page({
       }
       }
     })
     })
   },
   },
-
+  depts() {
+    console.log(wx.getStorageSync('openId'), "openid的问题");
+    wx.request({
+      url: app.globalData.publicUrl + '/applet/homeStatistics',
+      method: "GET",
+      data: {
+        appletsId: wx.getStorageSync('openId')
+      },
+      success: (res) => {
+        if (res.data.code == 0) {
+          this.setData({
+            number: res.data.data
+          })
+        }
+      }
+    })
+  },
   onLoad() {
   onLoad() {
-
-
+    this.depts();
   },
   },
+  onShow() {
+    console.log("进来儿了啊");
+    this.depts();
+  }
 })
 })

+ 12 - 5
pages/index/index.wxml

@@ -10,26 +10,33 @@
 	</view>
 	</view>
 	<view class="flex-box" bindtap="goTongzhi">
 	<view class="flex-box" bindtap="goTongzhi">
 		<image src="/images/tongzhi.png" style="width: 80rpx; height: 31rpx;"></image>
 		<image src="/images/tongzhi.png" style="width: 80rpx; height: 31rpx;"></image>
-		<view class="bck">今日探访老人可得双倍积分</view>
+		<!-- <view class="bck">今日探访老人可得双倍积分</view> -->
+		<swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="3000">
+			<block wx:for="{{msgList}}">
+				<swiper-item>
+					<view class="swiper_item">{{item.title}}</view>
+				</swiper-item>
+			</block>
+		</swiper>
 	</view>
 	</view>
 	<view class="shu-top2">
 	<view class="shu-top2">
 		<view class="shu"></view>
 		<view class="shu"></view>
-		<view class="top2">长春市朝阳区数据统计</view>
+		<view class="top2">{{number.dept}}统计</view>
 	</view>
 	</view>
 	<view class="top3">
 	<view class="top3">
 		<view class="top3-box">
 		<view class="top3-box">
 			<image src="/images/indexicon1.png" style="width: 77rpx; height: 70rpx;  margin-top: 20rpx;"></image>
 			<image src="/images/indexicon1.png" style="width: 77rpx; height: 70rpx;  margin-top: 20rpx;"></image>
-			<view class="top3-num">45623</view>
+			<view class="top3-num">{{number.infoTotal}}</view>
 			<view class="top3-title">老人数量</view>
 			<view class="top3-title">老人数量</view>
 		</view>
 		</view>
 		<view class="top3-box">
 		<view class="top3-box">
 			<image src="/images/indexicon2.png" style="width: 77rpx; height: 70rpx;  margin-top: 20rpx;"></image>
 			<image src="/images/indexicon2.png" style="width: 77rpx; height: 70rpx;  margin-top: 20rpx;"></image>
-			<view class="top3-num">12312</view>
+			<view class="top3-num">{{number.userTotal}}</view>
 			<view class="top3-title">巡访员数量</view>
 			<view class="top3-title">巡访员数量</view>
 		</view>
 		</view>
 		<view class="top3-box">
 		<view class="top3-box">
 			<image src="/images/indexicon3.png" style="width: 77rpx; height: 70rpx;  margin-top: 20rpx;"></image>
 			<image src="/images/indexicon3.png" style="width: 77rpx; height: 70rpx;  margin-top: 20rpx;"></image>
-			<view class="top3-num">56132</view>
+			<view class="top3-num">{{number.visitCount}}</view>
 			<view class="top3-title">累计巡访量</view>
 			<view class="top3-title">累计巡访量</view>
 		</view>
 		</view>
 	</view>
 	</view>

+ 25 - 2
pages/index/index.wxss

@@ -114,10 +114,12 @@ top3-num {
   align-items: center;
   align-items: center;
   justify-content: space-around;
   justify-content: space-around;
 }
 }
-.top4-box:nth-child(2){
+
+.top4-box:nth-child(2) {
   margin-left: 25rpx;
   margin-left: 25rpx;
 }
 }
-.top4-box:nth-child(4){
+
+.top4-box:nth-child(4) {
   margin-left: 25rpx;
   margin-left: 25rpx;
 }
 }
 
 
@@ -137,4 +139,25 @@ top3-num {
 
 
 .top4-box1 {
 .top4-box1 {
   margin-right: 20rpx;
   margin-right: 20rpx;
+}
+
+.swiper_container {
+  height: 50rpx;
+  width: 80vw;
+  margin-left: 20rpx;
+  line-height: 50rpx;
+  background: #dbe9f6;
+  color: #2087f7;
+  border-radius: 6rpx;
+  padding-left: 20rpx;
+  box-sizing: border-box;
+}
+
+.swiper_item {
+  font-size: 30rpx;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  letter-spacing: 2px;
+
 }
 }

+ 45 - 7
pages/love/love.js

@@ -144,7 +144,7 @@ Page({
         visitPhoto: this.data.visitPhoto,
         visitPhoto: this.data.visitPhoto,
         lat: this.data.lat,
         lat: this.data.lat,
         lng: this.data.lng,
         lng: this.data.lng,
-        visitLocation:this.data.visitLocation
+        visitLocation: this.data.visitLocation
       }
       }
       wx.request({
       wx.request({
         url: app.globalData.publicUrl + '/visit/add',
         url: app.globalData.publicUrl + '/visit/add',
@@ -168,7 +168,7 @@ Page({
             })
             })
           } else if (res.data.code == 1) {
           } else if (res.data.code == 1) {
             console.log("进来了啊");
             console.log("进来了啊");
-            
+
             wx.showModal({
             wx.showModal({
               showCancel: false,
               showCancel: false,
               content: res.data.message,
               content: res.data.message,
@@ -199,6 +199,10 @@ Page({
 
 
   //获取位置
   //获取位置
   getSelfLocation: function (varSendOrgId) {
   getSelfLocation: function (varSendOrgId) {
+    console.log(this.data.info, "老人的信心呢锕");
+    let split = this.data.info.photoAndLocation.split("/");
+    let lon = parseFloat(split[0])
+    let lat = parseFloat(split[1])
 
 
     // 实例化API核心类
     // 实例化API核心类
     var qqmapsdk = new QQMapWX({
     var qqmapsdk = new QQMapWX({
@@ -210,13 +214,48 @@ Page({
       type: 'gcj02',
       type: 'gcj02',
       success: function (res) {
       success: function (res) {
         console.log(res, "0000000");
         console.log(res, "0000000");
-        var latitude = res.latitude;
-        var longitude = res.longitude;
+        var latitude = parseFloat(res.latitude);
+        var longitude = parseFloat(res.longitude);
+        console.log(lat);
+        console.log(lon);
+        console.log(latitude);
+        console.log(longitude);
         that.setData({
         that.setData({
           lng: longitude, //经度
           lng: longitude, //经度
           lat: latitude, //纬度        
           lat: latitude, //纬度        
         });
         });
         // 调用sdk接口
         // 调用sdk接口
+        qqmapsdk.calculateDistance({
+          mode: 'walking', //步行,驾车为'driving'
+          to: [{
+            latitude: lat,
+            longitude: lon
+          }, {
+            latitude: latitude,
+            longitude: longitude
+          }],
+          // to: [{
+          //   latitude: lat,
+          //   longitude: lon,
+          // }, {
+          //   latitude: longitude,
+          //   longitude: longitude,
+          // }],
+          success: function (res) {
+            console.log(res.result.elements[0].distance, "距离的");
+            if (res.result.elements[0].distance > 1000) {
+              wx.showModal({
+                showCancel: false,
+                content: '当前位置超出老人家范围,请重新扫码定位',
+                success() {
+                  wx.switchTab({
+                    url: '/pages/index/index',
+                  })
+                }
+              })
+            }
+          },
+        })
         qqmapsdk.reverseGeocoder({
         qqmapsdk.reverseGeocoder({
           location: {
           location: {
             latitude: res.latitude,
             latitude: res.latitude,
@@ -257,6 +296,7 @@ Page({
           this.setData({
           this.setData({
             info: res.data.data
             info: res.data.data
           })
           })
+          this.getSelfLocation();
         } else {
         } else {
           wx.showModal({
           wx.showModal({
             showCancel: false,
             showCancel: false,
@@ -324,10 +364,8 @@ Page({
   },
   },
 
 
   onLoad: function (opotions) {
   onLoad: function (opotions) {
-    console.log(opotions,"dayin");
-    
+    console.log(opotions, "dayin");
     this.time();
     this.time();
-    this.getSelfLocation();
     this.oldsInfo(opotions.id);
     this.oldsInfo(opotions.id);
     this.setData({
     this.setData({
       imgPath: [],
       imgPath: [],

+ 2 - 2
pages/notice/notice.wxml

@@ -37,10 +37,10 @@
 					<view class="title">{{item.content}}</view>
 					<view class="title">{{item.content}}</view>
 					<view class="flex-box">
 					<view class="flex-box">
 						<view class="readwenzi" style="background:#dcdcdc">已读</view>
 						<view class="readwenzi" style="background:#dcdcdc">已读</view>
-						<view style="display: flex;  align-items: center;">
+						<!-- <view style="display: flex;  align-items: center;">
 							<image src="/images/shan.png" style="width: 50rpx; height: 50rpx; margin-right: 10rpx;"></image>
 							<image src="/images/shan.png" style="width: 50rpx; height: 50rpx; margin-right: 10rpx;"></image>
 							<view>删除</view>
 							<view>删除</view>
-						</view>
+						</view> -->
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>

+ 36 - 10
pages/paiming/paiming.js

@@ -2,28 +2,54 @@ const app = require('../../utils/util.js');
 Page({
 Page({
   data: {
   data: {
     logs: [],
     logs: [],
-    active:0,
-    collectInfosList:[
-      {
-        name:'张三',
+    active: 0,
+    collectInfosList: [{
+        name: '张三',
         time: "2020-08-07T11:47:47.400Z"
         time: "2020-08-07T11:47:47.400Z"
       },
       },
       {
       {
-        name:'李四',
+        name: '李四',
         time: "2020-08-07T11:47:47.400Z"
         time: "2020-08-07T11:47:47.400Z"
       },
       },
     ],
     ],
-
-    visitInfosList:[
-      {
-        name:'张三111',
+    list: {},
+    visitInfosList: [{
+        name: '张三111',
         visitTime: "2020-02-16T11:22:07.697Z"
         visitTime: "2020-02-16T11:22:07.697Z"
       },
       },
       {
       {
-        name:'李四22',
+        name: '李四22',
         visitTime: "2020-02-16T11:22:07.697Z"
         visitTime: "2020-02-16T11:22:07.697Z"
       },
       },
     ]
     ]
   },
   },
+  paiXing() {
+    wx.request({
+      url: app.globalData.publicUrl + '/applet/userValue',
+      method: "GET",
+      header: {
+        appletsId: wx.getStorageSync('openId')
+      },
+      success: (res) => {
+        console.log(res, "000");
+        this.setData({
+          list: res.data.data
+        })
+      }
+    })
+  },
+  onShow() {
+    console.log(wx.getStorageSync('user'), "打印");
+    if (wx.getStorageSync('user') == '') {
+      wx.redirectTo({
+        url: '/pages/login/login',
+      })
+    } else {
+
+    }
+  },
 
 
+  onLoad() {
+    this.paiXing();
+  }
 })
 })

+ 1 - 1
pages/paiming/paiming.wxml

@@ -2,7 +2,7 @@
 	<view>
 	<view>
 		<image src="/images/paimingbj.png" style="width: 100%; height: 550rpx;"> </image>
 		<image src="/images/paimingbj.png" style="width: 100%; height: 550rpx;"> </image>
 		<view class="flex-box">
 		<view class="flex-box">
-			<view class="jifen">506</view>
+			<view class="jifen">{{list}}</view>
 			<view class="wenzi">累计积分</view>
 			<view class="wenzi">累计积分</view>
 			<view class="btn">当前排名<text class="shuzi">5623</text>名</view>
 			<view class="btn">当前排名<text class="shuzi">5623</text>名</view>
 		</view>
 		</view>

+ 3 - 3
pages/personInfo/personInfo.js

@@ -1,7 +1,7 @@
 const app = require('../../utils/util.js');
 const app = require('../../utils/util.js');
 Page({
 Page({
   data: {
   data: {
-    info:{},
+    info: {},
   },
   },
   wanshan() {
   wanshan() {
     wx.navigateTo({
     wx.navigateTo({
@@ -28,8 +28,8 @@ Page({
       success: (res) => {
       success: (res) => {
         if (res.data.code == 0) {
         if (res.data.code == 0) {
           wx.clearStorageSync();
           wx.clearStorageSync();
-          wx.navigateTo({
-            url: '/pages/login/login',
+          wx.switchTab({
+            url: '/pages/index/index',
           })
           })
         }
         }
       }
       }

+ 2 - 2
utils/util.js

@@ -1,8 +1,8 @@
 const globalData = {
 const globalData = {
   
   
-  publicUrl: 'http://info.windd.cn:8080/test',
+  //publicUrl: 'http://info.windd.cn:8080/test',
 
 
- //publicUrl: 'http://10.16.4.8:7001',
+ publicUrl: 'http://10.16.4.8:7001',
 };
 };
 module.exports = {
 module.exports = {
   globalData: globalData,
   globalData: globalData,