Selaa lähdekoodia

fix: bugFixed 2022-10-20

wangyuan 2 vuotta sitten
vanhempi
commit
dd3c60a63f

+ 2 - 0
app.js

@@ -8,6 +8,8 @@ App({
   },
   globalData: {
     accessToken: '',
+    phoneAuth: false, // 是否有号码权限
+    headAuth: false, // 是否有头像权限
     userInfo: {
       userName: '',
       phoneNumber: '',

+ 9 - 0
note.txt

@@ -0,0 +1,9 @@
+2022-10-21
+  1,我的页面,0次的时候应只有一个充值按钮,有次数才显示预约按钮 fixed
+  2,我的页面,onshow的时候重新获取检测机会 fixed
+  3,我的档案,没有记录的时候,管理的按钮不应该有,新建的按钮拉长 fixed
+  4,我的档案,下面的管理,新建按钮改为小程序Button组件,适配 12/13 Pro Max fixed
+  5,输入框输入的文字颜色加重,避免和placeholder相同 fixed
+  6,我的预约,待检测账号字段去除
+  7、小程序默认页面改为index
+  8,accessToken使用本地保存,不用每次使用wx.login获取。用户端有效期7天,工作人员2天

+ 8 - 2
pages/addressAdd/addressAdd.js

@@ -13,9 +13,15 @@ Page({
     rangText: '',
     isEdit: false,
     addressId: '',
-    regionIndex: [0,0,0],
-    regionArray: [['浙江省','上海市'], ['杭州市','嘉定区'],['富阳区','嘉定区']]
+    regionIndex: [0,0,0]
   },
+
+  onShow () {
+    this.setData({
+      region: []
+    })
+  },
+
   onLoad (options) {
     this.getRegionFn()
     if (options.type && options.type == 0) {

+ 1 - 1
pages/addressAdd/addressAdd.wxml

@@ -8,7 +8,7 @@
       <input class="phone-input user-input" bindinput="bindinput" model:value="{{contactPhone}}" type="number" maxlength="11"  placeholder="请输入手机号"/>
     </view>
     <view class="form-item chose-region ittflex-jcb">
-      <view class="label ittflex">所在区域</view>
+      <view class="label ittflex {{region.length == 0 ? 'label-placeholder' : ''}}">所在区域</view>
       <view class="actions">
         <picker class="my-picker" mode="region" value="{{region}}" bindchange="bindRegonPickerChange">
           <view class="picker-item ittflex">

+ 7 - 4
pages/addressAdd/addressAdd.wxss

@@ -20,10 +20,13 @@
   height: 100%;
   font-size: 26rpx;
   font-weight: 400;
-  color: #999999;
+  color: #333;
   justify-content: flex-start;
   text-indent: 30rpx;
 }
+.label-placeholder {
+  color: #999999;
+}
 .actions {
   width: 550rpx;
   height: 100%;
@@ -41,7 +44,7 @@
   margin-right: 14rpx;
   font-size: 26rpx;
   font-weight: 400;
-  color: #999999;
+  color: #333;
 }
 .address-detail {
   height: 212rpx;
@@ -52,7 +55,7 @@
   height: 170rpx;
   font-size: 26rpx;
   font-weight: 400;
-  color: #999999;
+  color: #333;
 }
 .user-input {
   margin: 0 auto;
@@ -60,7 +63,7 @@
   height: 100%;
   font-size: 26rpx;
   font-weight: 400;
-  color: #999999;
+  color: #333;
 }
 .confirm-btn {
   width: 690rpx;

+ 2 - 2
pages/createFile/createFile.wxml

@@ -44,7 +44,7 @@
         <view class="actions actions-bothday ittflex">
           <picker class="my-picker" mode="date" bindchange="bindPickerChange" value="{{index}}">
             <view class="picker-item ittflex">
-              <text class="picker-text">{{pickerText}}</text>
+              <text class="picker-text {{pickerText == '请选择' ? 'picker-text-placeholder' : ''}}">{{pickerText}}</text>
               <van-icon name="calendar-o" size="34rpx"/>
             </view>
           </picker>
@@ -55,7 +55,7 @@
         <view class="actions actions-bothday ittflex">
           <picker class="my-picker" mode="selector" range="{{relativeRange}}" bindchange="bindReaPickerChange">
             <view class="picker-item ittflex">
-              <text class="picker-text">{{relativeText}}</text>
+              <text class="picker-text {{relativeText == '请选择' ? 'picker-text-placeholder' : ''}}">{{relativeText}}</text>
               <van-icon name="arrow-down" color="#999"/>
             </view>
           </picker>

+ 5 - 2
pages/createFile/createFile.wxss

@@ -62,7 +62,7 @@
 .weui-input {
   text-align: right;
   padding-right: 20rpx;
-  color: #999;
+  color: #333;
   font-size: 26rpx;
 }
 .radio-woman {
@@ -118,7 +118,10 @@
   margin-right: 14rpx;
   font-size: 26rpx;
   font-weight: 400;
-  color: #999999;
+  color: #333;
+}
+.picker-text-placeholder {
+  color: #999;
 }
 .relative-picker {
   justify-content: flex-end;

+ 44 - 2
pages/index/index.js

@@ -1,6 +1,7 @@
 // pages/index/index.js
 import { homePage } from '../../api/index'
-import { createQRcode } from "../../api/document";
+import { createQRcode } from "../../api/document"
+// import { ittLogin, bindMobile, bindBaseInfo } from '../../api/my'
 const app = getApp()
 Page({
 
@@ -17,7 +18,8 @@ Page({
     baseStr: 'data:image/jpg;base64,',
     QRCodeBase64: '',
     qrcodeDialog: false,
-    qrUserName: ''
+    qrUserName: '',
+    phoneAuthShow: false
   },
   
   onShow () {
@@ -30,6 +32,46 @@ Page({
       })
     }
   },
+
+  onLoad () {
+    //this.ittLoginFn()
+  },
+
+  ittLoginFn () {
+    // var that = this
+    wx.login({
+      success (loginCode) {
+        if (loginCode.code) {
+          var data = {
+            code: loginCode.code
+          }
+          wx.showLoading({
+            title: '登录中...',
+            mask: true
+          })
+          ittLogin(data).then(res => {
+            wx.hideLoading()
+            app.globalData.accessToken = res.data.accessToken
+            app.globalData.phoneAuth = !res.data.isNeedPhone
+            app.globalData.headAuth = res.data.headImg ? true : false
+            app.globalData.userInfo.headImg= res.data.headImg
+            app.globalData.userInfo.userName = res.data.userName
+            app.globalData.userInfo.phoneNumber = res.data.phoneNumber
+            //const resIsNeedPhone = res.data.isNeedPhone
+            // const resHeadImg = res.data.headImg
+            console.log(app.globalData.phoneAuth, app.globalData.headAuth);
+          }).catch(e => {
+            wx.hideLoading()
+          })
+        }
+      }
+    })
+  },
+
+  getPhoneNumber (e) {
+    console.log(e.detail.code)
+  },
+
   onPullDownRefresh () {
     wx.vibrateShort({
       type: 'medium'

+ 15 - 0
pages/index/index.wxml

@@ -81,4 +81,19 @@
       </view>
     </view>
   </view>
+  <van-overlay show="{{ phoneAuthShow }}">
+    <view class="wrapper ittflex">
+      <view class="userinfo-auth-modal">
+        <view class="modal-title">申请权限</view>
+        <view class="px-border"></view>
+        <view class="app-logo">
+          <image class="logopng" src="../../imaes/logo1@2x.png"></image>
+        </view>
+        <view class="auth-text">
+          小程序申请授权你的手机号
+        </view>
+        <button class="confirm auth-btn" open-type="getPhoneNumber" bindtap="getPhoneNumber">点击授权</button>
+      </view>
+    </view>
+  </van-overlay>
 </view>

+ 56 - 0
pages/index/index.wxss

@@ -336,4 +336,60 @@
   border-radius: 50%;
   border: 2px solid #fff;
   box-sizing: border-box;
+}
+.wrapper {
+  height: 100%;
+  align-items: center;
+}
+.action-modal {
+  width: 540rpx;
+  min-height: 280rpx;
+  background: #FFFFFF;
+  border-radius: 24rpx;
+  margin-top: 300rpx;
+}
+.userinfo-auth-modal {
+  width: 498rpx;
+  height: 496rpx;
+  background: #FFFFFF;
+  border-radius: 5px;
+}
+.modal-title {
+  height: 82rpx;
+  text-align: center;
+  line-height: 82rpx;
+  font-size: 30rpx;
+  font-weight: bold;
+  color: #333333;
+}
+.px-border {
+  height: 1rpx;
+  transform: scaleY(0.5);
+  transform-origin: 50% 100%;
+  background-color: #dddddd;
+}
+.app-logo {
+  height: 80rpx;
+  text-align: center;
+  margin: 30rpx 0;
+}
+.auth-text {
+  width: 418rpx;
+  margin: 0 auto;
+  font-size: 26rpx;
+  font-weight: 400;
+  color: #333333;
+}
+.logopng {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 50%;
+}
+.auth-btn {
+  width: 418rpx;
+  border-radius: 10rpx;
+  margin-top: 80rpx;
+  background-color: var(--maincolor);
+  color: #fff;
+  font-size: 26rpx;
 }

+ 16 - 9
pages/my/my.js

@@ -25,6 +25,7 @@ Page({
     nickname: '',
     phone: '',
     count: 0,
+    isFirstGetCount: true, // 是否为第一次获取检测机会的次数
     gridList: [
       {
         id: 0,
@@ -83,6 +84,16 @@ Page({
     ]
   },
 
+  onShow () {
+    console.log('my onshow ===========', this.data.isFirstGetCount);
+    this.setData({
+      pageLogin: app.globalData.userInfo.login
+    })
+    if (!this.data.isFirstGetCount) {
+      this.getAccountNmberFn()
+    }
+  },
+
   /**
    * 生命周期函数--监听页面加载
    * 调用login接口,判断是否需要绑定手机号和头像昵称
@@ -220,9 +231,12 @@ Page({
   // 获取用户剩余检测机会
   getAccountNmberFn () {
     var that = this
+    wx.showNavigationBarLoading()
     getAccountNmber({}).then(res => {
+      wx.hideNavigationBarLoading()
       that.setData({
-        count: res.data
+        count: res.data,
+        isFirstGetCount: false
       })
     })
   },
@@ -362,14 +376,7 @@ Page({
       })
     })
   },
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-    this.setData({
-      pageLogin: app.globalData.userInfo.login
-    })
-  },
+
   // 路由跳转
   handleNavTo (e) {
     var url = e.currentTarget.dataset.url

+ 1 - 1
pages/my/my.wxml

@@ -17,7 +17,7 @@
         </view>
         <view class="action-btn ittflex-jcs">
           <view class="appoin-btn ittflex" style="margin-right:10rpx;" bindtap="handleCharge">去充值</view>
-          <view class="appoin-btn ittflex" bindtap="handleAppoint">立即预约</view>
+          <view wx:if="{{count !== 0}}" class="appoin-btn ittflex" bindtap="handleAppoint">立即预约</view>
         </view>
       </view>
     </view>

+ 0 - 4
pages/myAppointment/myAppointment.wxml

@@ -24,10 +24,6 @@
           <text>预约账号:</text>
           <text>{{globalDataUserName}}</text>
         </view>
-        <view class="username-w info-item">
-          <text>待检测账号:</text>
-          <text>测试用户</text>
-        </view>
         <view class="order-time info-item">
           <text>下单时间:</text>
           <text>{{item.addTime}}</text>

+ 9 - 4
pages/myFile/myFile.wxml

@@ -30,11 +30,16 @@
             <text class="report-text report-text-fail" wx:if="{{item.reportId == null}}">还未产生报告</text>
           </view>
         </view>
+        <view class="actions ittflex-jcb">
+          <button plain="" class="handle-btn manage-btn ittflex" bindtap="handleFile">管理</button>
+          <button class="handle-btn itt-btn" bindtap="handleAddFile">新建档案</button>
+        </view>
+      </block>
+      <block wx:if="{{fileList.length == 0}}">
+        <view class="actions ittflex-jcb">
+        <button class="handle-btn-full itt-btn" bindtap="handleAddFile">新建档案</button>
+        </view>
       </block>
-      <view class="actions ittflex-jcb">
-        <view class="handle-btn manage-btn ittflex" bindtap="handleFile">管理</view>
-        <view class="handle-btn itt-btn" bindtap="handleAddFile">新建档案</view>
-      </view>
     </view>
     <view class="my-dialog" wx:if="{{qrcodeDialog}}">
       <view class="qr-content">

+ 5 - 1
pages/myFile/myFile.wxss

@@ -96,8 +96,12 @@
   height: 80rpx;
   border-radius: 10rpx;
 }
+.handle-btn-full {
+  width: 100%;
+  height: 80rpx;
+  border-radius: 10rpx;
+}
 .manage-btn {
-  border: 1rpx solid #333333;
   font-size: 26rpx;
   font-weight: 400;
   color: #333333;

+ 1 - 0
pages/report/report.js

@@ -16,6 +16,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
+    console.log('report onshow');
     app.globalData.selectedInex = 1
     this.getMyReportList()
   },

+ 4 - 4
pages/reportDetail/reportDetail.js

@@ -8,7 +8,7 @@ Page({
   data: {
     reportid: '',
     name: '评估说明', // 默认展示: 评估说明 小结 ReportTotal, 系统:用具体的中文名称
-    systemName: ['评估说明','检测小结','循环系统', '呼吸系统', '消化系统','泌尿与生殖系统', '血液系统', '内分泌系统', '营养与代谢', '神经系统', '免疫系统', '运动系统', '感官系统', '理化因素', '精神及心理'],
+    systemName: ['评估说明','检测小结','循环系统', '呼吸系统', '消化系统','泌尿与生殖系统', '血液系统', '内分泌系统', '营养与代谢', '神经系统', '免疫系统', '运动系统', '感官系统', '理化因素', '情绪表格'],
     leftNavActive: 0, // 0 小结 1 系统
     summaryList: [],
     systemList: [],
@@ -52,8 +52,8 @@ Page({
     })
     getReport(data).then(res => {
       wx.hideLoading()
-      if (that.data.name == 'ReportTotal' || that.data.name == '精神及心理') {
-        console.log(that.data.name == '精神及心理');
+      if (that.data.name == 'ReportTotal' || that.data.name == '情绪表格') {
+        console.log(that.data.name == '情绪表格');
         that.setData({
           summaryList: res.data || []
         })
@@ -132,7 +132,7 @@ Page({
         })
       } else {
         that.setData({
-          name: navName
+          name: navName == '情绪表格' ? '精神及心理' : navName
         })
       }
       await that.getReportFn()

+ 13 - 0
pages/reportDetail/reportDetail.wxml

@@ -138,6 +138,10 @@
     </block>
     <!-- 精神及心理 -->
     <block wx:if="{{leftNavActive === 14}}">
+      <view class="sub-title">
+        情绪报告是基本情绪的检测结果,由于情绪和心理名词的独特内涵,以及从英文的直译结果,许多情绪的字面意思并无法涵盖许多的具体情况,并因个体的经历和诱发某种情绪的特异性,因而不能够单单从字面或独立的- - -个情绪来解读。
+      </view>
+      <view class="sub-title">以下信息描述为您近期的情绪状况,此结果仅供基本参考。</view>
       <view class="psic-title" >情绪心理反应性检测</view>
       <block wx:for="{{summaryList}}" wx:key="index">
         <view class="psic-item split-item ittflex-jcs" >
@@ -148,6 +152,15 @@
           {{item.desc || '--'}}
         </view>
       </block>
+      <view class="sum-title">
+        情绪是身体的精神支柱,身体是情绪的物质基础。
+      </view>
+      <view class="sum-title">
+        如果您近期情绪压力过大,建议您选择一些比较放松的活动;
+      </view>
+      <view class="sum-title">
+        如果您近期心情愉悦,一定要继续保持。
+      </view>
     </block>
   </view>
 </view>

+ 14 - 0
pages/reportDetail/reportDetail.wxss

@@ -120,6 +120,13 @@
   font-weight: 400;
   color: #999999;
 }
+.sub-title {
+  font-size: 26rpx;
+  font-weight: 400;
+  color: #333333;
+  text-indent: 30rpx;
+  padding: 30rpx;
+}
 .psic-title {
   height: 60rpx;
   background-color: rgba(69, 166, 181, 0.2);
@@ -128,6 +135,13 @@
   text-align: center;
   line-height: 60rpx;
 }
+.sum-title {
+  font-size: 26rpx;
+  font-weight: 400;
+  color: #333333;
+  text-indent: 30rpx;
+  padding: 30rpx;
+}
 .psic-item {
   height: 92rpx;
   border: 1rpx solid #DDDDDD;