roose 4 лет назад
Родитель
Сommit
9fe7efca2f
5 измененных файлов с 216 добавлено и 2 удалено
  1. 10 2
      app.json
  2. 98 0
      pages/love/love.js
  3. 6 0
      pages/love/love.json
  4. 56 0
      pages/love/love.wxml
  5. 46 0
      pages/love/love.wxss

+ 10 - 2
app.json

@@ -1,11 +1,14 @@
 {
   "pages": [
     "pages/index/index",
+    "pages/love/love",
+   
+    "pages/login/login",
+
+    "pages/updatepassword/updatepassword",
     "pages/visitandinfo/visitandinfo",
     "pages/idCard/idCard",
-    "pages/updatepassword/updatepassword",
     "pages/notice/notice",
-    "pages/login/login",
     "pages/card/card",
     "pages/paiming/paiming",
     "pages/personInfo/personInfo",
@@ -88,5 +91,10 @@
     ]
   },
   "style": "v2",
+  "permission": {
+    "scope.userLocation": {
+      "desc": "你的位置信息将用于小程序位置接口的效果展示"
+    }
+  },
   "sitemapLocation": "sitemap.json"
 }

+ 98 - 0
pages/love/love.js

@@ -0,0 +1,98 @@
+const app = require('../../utils/util.js');
+var util = require('../../utils/md5.js')
+var QQMapWX = require('../../libs/qqmap-wx-jssdk.min.js');
+Page({
+  data: {
+    time: '',
+    lng: '', // 经度
+    lat: '', // 纬度
+    visitLocation: '',
+  },
+  time() {
+    var timestamp = Date.parse(new Date());
+    var date = new Date(timestamp);
+    //获取年份  
+    var Y = date.getFullYear();
+    //获取月份  
+    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
+    //获取当日日期 
+    var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
+    this.setData({
+      time: Y + '-' + M + '-' + D
+    })
+  },
+  //获取位置
+  getSelfLocation: function (varSendOrgId) {
+
+    // 实例化API核心类
+    var qqmapsdk = new QQMapWX({
+      key: 'B5DBZ-NGIHP-SQMD4-LHMG3-NJ72Z-7KFOV' //申请的开发者秘钥key
+    });
+    var that = this; //用户授权过可以直接获取位置
+    wx.getLocation({
+      //type: 'wgs84',
+      type: 'gcj02',
+      success: function (res) {
+        console.log(res, "0000000");
+        var latitude = res.latitude;
+        var longitude = res.longitude;
+        that.setData({
+          lng: longitude, //经度
+          lat: latitude, //纬度        
+        });
+        // 调用sdk接口
+        qqmapsdk.reverseGeocoder({
+          location: {
+            latitude: res.latitude,
+            longitude: res.longitude
+          },
+          success: function (res) {
+            //获取当前地址成功
+            console.log(res, "为是都是都是");
+            that.setData({
+              visitLocation: res.result.address
+            })
+          },
+          fail: function (res) {
+            console.log('获取当前地址失败');
+
+          }
+        });
+      },
+      fail: function (res) {
+        setTimeout(function () { //需要用户授权获取位置
+          wx.getSetting({
+            success: (res) => {
+              if (!res.authSetting['scope.userLocation']) {
+                wx.openSetting({
+                  success: (response) => {
+                    wx.showModal({
+                      title: '请重新授权',
+                      content: '需要获取您的地址信息',
+                      success: function (data) {
+                        wx.getLocation({
+                          success: function (res) {
+                            var latitude = res.latitude;
+                            var longitude = res.longitude;
+                            that.setData({
+                              selfLongitude: longitude, //经度
+                              selfLatitude: latitude, //纬度        
+                            });
+                          }
+                        })
+                      }
+                    });
+                  }
+                })
+              }
+            }
+          })
+        }, 1000);
+      }
+    });
+  },
+  onLoad: function () {
+    this.time();
+    this.getSelfLocation();
+  },
+})

+ 6 - 0
pages/love/love.json

@@ -0,0 +1,6 @@
+{
+  "navigationBarTitleText": "现场爱心探访",
+  "usingComponents": {
+  
+  }
+}

+ 56 - 0
pages/love/love.wxml

@@ -0,0 +1,56 @@
+<view class="home">
+	<view class="title">探访日期:<text>{{time}}</text></view>
+	<view class="title">探访位置</view>
+	<view class="visit-box">
+		<view>{{visitLocation}}</view>
+		<view class="flex-box">
+			<view>
+				经度:{{lng}}
+			</view>
+			<view style=" margin-left: 20rpx;">
+				纬度:{{lat}}
+			</view>
+		</view>
+	</view>
+	<view class="title">老人姓名</view>
+	<view class="flex-box">
+		<view>张三<text>(1991191)</text></view>
+		<view class="old-btn" bindtap="oldClick">老人详情</view>
+	</view>
+	<view class="title">探访情况</view>
+	<view class="title">健康状况</view>
+	<radio-group name="health">
+		<radio color='#009FE9' value='健康'>健康</radio>
+		<radio color='#009FE9' value='一般'>一般</radio>
+		<radio color='#009FE9' value='较差'>较差</radio>
+	</radio-group>
+	<view class="title">精神状态</view>
+	<radio-group name="mind">
+		<radio color='#009FE9' value='良好'>良好</radio>
+		<radio color='#009FE9' value='一般'>一般</radio>
+		<radio color='#009FE9' value='较差'>较差</radio>
+	</radio-group>
+	<view class="title">安全情况</view>
+	<radio-group name="security">
+		<radio color='#009FE9' value='安全'>安全</radio>
+		<radio color='#009FE9' value='一般'>一般</radio>
+		<radio color='#009FE9' value='较差'>较差</radio>
+	</radio-group>
+	<view class="title">卫生环境</view>
+	<radio-group name="hygiene">
+		<radio color='#009FE9' value='安全'>良好</radio>
+		<radio color='#009FE9' value='一般'>一般</radio>
+		<radio color='#009FE9' value='较差'>较差</radio>
+	</radio-group>
+	<view class="title">居中环境</view>
+	<radio-group name="live">
+		<radio color='#009FE9' value='安全'>良好</radio>
+		<radio color='#009FE9' value='一般'>一般</radio>
+		<radio color='#009FE9' value='较差'>较差</radio>
+	</radio-group>
+	<view class="title">老人需求说明</view>
+	<textarea class="view_textarea" name="demand" bindblur="bindTextAreaBlur" placeholder="请填写一下老人需求" />
+	<view class="title">探访备注说明</view>
+	<textarea class="view_textarea"  name="visitMessage" bindblur="bindTextAreaBlur" placeholder="请填写一下探访备注说明" />
+	<view class=" old-btn  " style=" width: 255rpx;   margin-top: 40rpx; margin-bottom: 40rpx;">现场含面部照片(正面照)</view>
+</view>

+ 46 - 0
pages/love/love.wxss

@@ -0,0 +1,46 @@
+.home {
+  width: 90%;
+  margin: 0 auto;
+  font-weight: 500;
+  font-size: 28rpx;
+}
+.title {
+  margin-top: 40rpx;
+  margin-bottom: 20rpx;
+  font-weight: 700;
+ 
+}
+
+.flex-box {
+  display: flex;
+
+}
+
+.visit-box {
+  margin: 40rpx 0;
+}
+
+.old-btn {
+  color: white;
+  background-color: #429EFF;
+  margin-left: 10rpx;
+  font-size: 24rpx;
+  padding: 5rpx 10rpx;
+  border-radius: 10rpx;
+}
+
+.view_textarea {
+  vertical-align: text-bottom;
+  background: rgba(255, 255, 255, 1);
+  border: 1px solid rgba(217, 217, 217, 1);
+  padding: 0 20rpx;
+  height: 150rpx;
+  width: 90%;
+}
+
+radio:nth-child(2) {
+  margin-left: 80rpx;
+}
+radio:nth-child(3) {
+  margin-left: 80rpx;
+}