roose 4 年之前
父节点
当前提交
9ebe21b9cd
共有 5 个文件被更改,包括 76 次插入32 次删除
  1. 11 0
      pages/index/index.js
  2. 50 28
      pages/love/love.js
  3. 2 2
      pages/love/love.wxml
  4. 13 1
      pages/love/love.wxss
  5. 0 1
      pages/visitandinfo/visitandinfo.wxml

+ 11 - 0
pages/index/index.js

@@ -44,7 +44,18 @@ Page({
   },
   goSaoMa() {
      console.log("扫阿");
+     var _this = this;
+     // 允许从相机和相册扫码
+     wx.scanCode({
+       success: (res) => {
+         console.log(res,"打印锕");
+         let length = res.result.substring(res.result.lastIndexOf('/')+1,res.result.length)
       
+         wx.navigateTo({
+           url: '/pages/love/love?id='+length,
+         })
+       }
+     })
   },
 
   onLoad() {

+ 50 - 28
pages/love/love.js

@@ -7,6 +7,22 @@ Page({
     lng: '', // 经度
     lat: '', // 纬度
     visitLocation: '',
+    info: '', //老人锕
+  },
+  oldClick(e) {
+    let fid = e.currentTarget.dataset.infos.fid;
+    let name = e.currentTarget.dataset.infos.name;
+    const app = getApp()
+    app.globalData.id = fid
+    app.globalData.name = name
+    wx.switchTab({
+      url: `/pages/collectInfo/collectInfo`,
+      success: function (e) {
+        var page = getCurrentPages().pop();
+        if (page == undefined || page == null) return;
+        page.onLoad();
+      }
+    })
   },
   time() {
     var timestamp = Date.parse(new Date());
@@ -60,39 +76,45 @@ Page({
         });
       },
       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, //纬度        
-                            });
-                          }
-                        })
-                      }
-                    });
-                  }
-                })
-              }
+
+      }
+    });
+  },
+  // 获取老人详情
+  oldsInfo(id) {
+    wx.request({
+      url: app.globalData.publicUrl + '/info/one',
+      method: "GET",
+      header: {
+        appletsId: wx.getStorageSync('openId')
+      },
+      data: {
+        id: id
+      },
+      success: (res) => {
+        console.log(res, "777777");
+        if (res.data.code == 0) {
+          this.setData({
+            info: res.data.data
+          })
+        } else {
+          wx.showModal({
+            showCancel: false,
+            content: '查询失败,当前二维码过期或失效',
+            success() {
+              wx.switchTab({
+                url: '/pages/index/index',
+              })
             }
           })
-        }, 1000);
+
+        }
       }
-    });
+    })
   },
-  onLoad: function () {
+  onLoad: function (opotions) {
     this.time();
     this.getSelfLocation();
+    this.oldsInfo(opotions.id);
   },
 })

+ 2 - 2
pages/love/love.wxml

@@ -14,8 +14,8 @@
 	</view>
 	<view class="title">老人姓名</view>
 	<view class="flex-box">
-		<view>张三<text>(1991191)</text></view>
-		<view class="old-btn" bindtap="oldClick">老人详情</view>
+		<view class="pop-oldtitle">{{info.name}}<text >({{info.idNumber}})</text></view>
+		<view class="old-btn" bindtap="oldClick" data-infos='{{info}}'>老人详情</view>
 	</view>
 	<view class="title">探访情况</view>
 	<view class="title">健康状况</view>

+ 13 - 1
pages/love/love.wxss

@@ -4,11 +4,12 @@
   font-weight: 500;
   font-size: 28rpx;
 }
+
 .title {
   margin-top: 40rpx;
   margin-bottom: 20rpx;
   font-weight: 700;
- 
+
 }
 
 .flex-box {
@@ -41,6 +42,17 @@
 radio:nth-child(2) {
   margin-left: 80rpx;
 }
+
 radio:nth-child(3) {
   margin-left: 80rpx;
+}
+
+.pop-oldtitle {
+  background-color: #F0F9EB;
+  color: #84CD5F;
+  box-sizing: border-box;
+  padding: 8rpx 10rpx 8rpx 10rpx;
+  text-align: center;
+  font-size: 26rpx;
+
 }

+ 0 - 1
pages/visitandinfo/visitandinfo.wxml

@@ -1,7 +1,6 @@
 	<wxs module="time" src="../../utils/time.wxs"></wxs>
 	<wxs module="subqian" src="../../utils/subqian.wxs"></wxs>
 	<wxs module="subhou" src="../../utils/subhou.wxs"></wxs>
-
 	<view>
 		<view id='tabs'>
 			<view class='tabs-box'>