detail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view>
  3. <view class="navbox">
  4. <uni-nav-bar color="#ffffff" left-icon="left" title="打卡记录" :background-color="backgroundColor"
  5. :border="false" statusBar='true' fixed="true" @clickLeft='getBack'>
  6. </uni-nav-bar>
  7. </view>
  8. <image :src="navbg" class="navbg"></image>
  9. <view class="zxmain" :style="'margin-top:-'+marTop+'rpx;'">
  10. <view class="ytbox">
  11. <view class="ytop flexc">
  12. <view class="tit" v-if="dataobj.name">{{dataobj.name.charAt(0)}}</view>
  13. <view class="cent">
  14. <view class="ctit">{{dataobj.name}}</view>
  15. <view class="ctime">最新打卡:{{dataobj.time}}</view>
  16. </view>
  17. </view>
  18. <!-- 日历 -->
  19. <view class="mb24">
  20. <lunc-calendar ref="calendar" :showLunar="false" :configWeek="configWeek" :configHoliday="configHoliday" :firstDayOfWeek="firstDayOfWeek" :showMonthBg="false" :showShrink="true" :signList="signList"
  21. @dayChange="dayChange" weekType="" @monthChange="monthChange" @getIsSelDayFn="getIsSelDayFn" @shrinkClick="shrinkClick">
  22. </lunc-calendar>
  23. </view>
  24. <view class="tips">出勤统计:打卡2次,上下班时间:{{dataobj.workTime}}</view>
  25. <!-- 步骤条 -->
  26. <view class="mb16 plr18">
  27. <view class="steps">
  28. <view class="cir"></view>
  29. <view class="stepsa">
  30. <view class="steptit">上班打卡</view>
  31. <view class="steptxt">
  32. <image :src="cirimg"></image>
  33. <view>08:27已打卡</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="steps">
  38. <view class="cir"></view>
  39. <view class="stepsa">
  40. <view class="steptit">下班打卡</view>
  41. <view class="steptxt">
  42. <image :src="cirimg"></image>
  43. <view>17:41已打卡</view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="tips">统计截至 2024-07-18 16:13</view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  55. import {getDictionaryFn} from "@/api/mine/register.js"
  56. import {getClockRl} from "@/api/mine/work.js"
  57. import luncCalendar from "@/work/components/lunc-calendar/lunc-calendar.vue"
  58. export default {
  59. components: {luncCalendar},
  60. data() {
  61. return {
  62. cirimg:require("@/static/images/home/chose.png"),
  63. navbg:require("@/static/images/navbg.png"),
  64. backgroundColor: "transparent",
  65. datainfo:{},
  66. dataobj:{},
  67. nvaHeight: 44,
  68. marTop: 0, //距离顶部的距离
  69. stubarHeight: 0, //
  70. visitName:'林涵宇',
  71. signList: [],
  72. configWeek:[],
  73. configHoliday:'Y',
  74. firstDayOfWeek:'sunday',
  75. // dayflag:false,
  76. // month:'',
  77. // year:'',
  78. // kaTime:'',
  79. // changetime:'',//改变的日期
  80. // timeday:'',//选择的日期
  81. // visitDate:'',
  82. userId:'',
  83. recordTime:'',
  84. }
  85. },
  86. onPageScroll(e) {
  87. var scrollTop = Number(e.scrollTop);
  88. if (scrollTop > 0) {
  89. this.backgroundColor = '#0491FD'
  90. } else {
  91. this.backgroundColor = 'transparent'
  92. }
  93. },
  94. onLoad: function() {
  95. if(e.data){
  96. var data=JSON.parse(decodeURIComponent(e.data))
  97. this.userId=data.userId;
  98. this.recordTime=data.recordTime;
  99. this.getCalendarList()
  100. }
  101. uni.getSystemInfo({
  102. success: (e) => {
  103. this.stubarHeight = Number(e.statusBarHeight);
  104. this.nvaHeight = Number(e.statusBarHeight) + 44;
  105. this.tabscheight = Number(this.nvaHeight) * 2 + 100;
  106. }
  107. })
  108. // 3c8cadac11af4f1298a2882addc8788d
  109. },
  110. onShow() {},
  111. mounted() {
  112. this.getHeightFn()
  113. },
  114. methods: {
  115. checkPermi,
  116. checkRole,
  117. getBack() {
  118. uni.navigateBack({
  119. delta: 1
  120. })
  121. },
  122. dayChange(e){
  123. if(e.daySign&&e.daySign.length){
  124. var daySign=e.daySign[0];
  125. this.datainfo=JSON.parse(JSON.stringify(daySign))
  126. }
  127. },
  128. monthChange(e){
  129. var y=e.year;
  130. var m=e.month;
  131. if(y==this.year&&m==this.month){
  132. this.getCalendarList()
  133. this.changetime='';
  134. }else{
  135. var time=y + '-' + m + '-' + '01'
  136. this.changetime=time
  137. this.getCalendarList(time)
  138. }
  139. },
  140. // 选中的日期
  141. getIsSelDayFn(e){
  142. if(e.sign&&e.sign.length){
  143. var date=e.sign[0].date;
  144. if(date==this.recordTime){
  145. var daySign=e.sign[0];
  146. this.datainfo=JSON.parse(JSON.stringify(daySign))
  147. }
  148. }
  149. },
  150. shrinkClick(e){
  151. console.log(e,3)
  152. },
  153. getHeightFn() {
  154. let query = uni.createSelectorQuery().in(this);
  155. //需要给黄色区域设置一个id标识,在这里是demo
  156. query.select('.navbox').boundingClientRect(data => {
  157. var top = data.top < 0 ? -data.top : data.top;
  158. var stubarHeight = Number(this.stubarHeight);
  159. this.marTop = stubarHeight > 0 ? 692 - Number(data.height) * 2 : 692 - Number(data.height) *
  160. 2 + 40 //赋值,待会要用
  161. if (top <= this.nvaHeight) {
  162. const opacity = top / 100 // 计算透明度值
  163. const color = `rgba(4, 145, 253, ${opacity})`
  164. this.backgroundColor = color // 更新盒子背景颜色
  165. } else {
  166. this.backgroundColor = '#00A9F0'
  167. }
  168. }).exec();
  169. },
  170. init() {
  171. // 门卫
  172. // getDictionaryFn('is_read').then(res=>{
  173. // if(res.code==200){
  174. // this.ydztlist = res.data.map(v => {
  175. // return {
  176. // label: v.dictLabel,
  177. // value: v.dictValue
  178. // }
  179. // })
  180. // }
  181. // })
  182. },
  183. getCalendarList() {
  184. var params = {
  185. userId: this.userId,
  186. recordTime: this.recordTime,
  187. }
  188. getClockRl(params).then(res => {
  189. if (res.code == 200) {
  190. var data=res.data;
  191. this.dataobj=res.data;
  192. if(data.rlData&&data.rlData.length){
  193. this.signList=data.rlData;
  194. }
  195. } else {
  196. this.$toast(res.msg)
  197. }
  198. })
  199. },
  200. },
  201. }
  202. </script>
  203. <style>
  204. /* page {
  205. background: #ffffff;
  206. } */
  207. </style>
  208. <style lang="scss" scoped>
  209. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  210. .navbg{width: 100%;height: 692rpx;}
  211. .zxmain{position: relative;padding: 20rpx 32rpx 40rpx;box-sizing: border-box;display: flex;}
  212. .ytbox{width: 684rpx;margin: 0 auto;padding-top: 24rpx;position: relative;flex: 1;overflow: auto;background-color: #ffffff;padding-bottom: 12rpx;border-radius: 14rpx;
  213. .ytop{padding: 16rpx 0 24rpx 16rpx;
  214. .tit{width: 62rpx;height: 62rpx;background: #0391FD;border-radius: 6rpx;font-weight: 500;
  215. font-size: 34rpx;color: #FFFFFF;margin-right: 18rpx;text-align: center;line-height: 62rpx;flex: 0 0 auto;}
  216. .cent{
  217. flex: 1;
  218. .ctit{font-weight: bold;font-size: 28rpx;color: #161616;margin-bottom: 6rpx;}
  219. .ctime{font-weight: 500;font-size: 18rpx;color: #666666;}
  220. }
  221. }
  222. .tips{font-weight: 500;font-size: 26rpx;color: #888888;padding-left: 34rpx;margin-bottom: 24rpx;}
  223. // 步骤条
  224. .steps{position: relative;display: flex;padding-bottom:40rpx;
  225. &::after{
  226. content: '';position: absolute;left:6rpx;top: 34rpx;bottom: 4rpx;background-color: #DADADA;width: 2rpx;
  227. }
  228. .cir{width: 14rpx;height: 14rpx;background: #AFAFAF;border-radius: 50%;flex: 0 0 auto;margin-right: 38rpx;margin-top: 13rpx;}
  229. .stepsa{flex: 1;
  230. .steptit{font-weight: bold;font-size: 28rpx;color: #161616;margin-bottom: 20rpx;}
  231. .steptxt{display: flex;
  232. image{width: 20rpx;height: 20rpx;margin-right: 14rpx;flex: 0 0 auto;margin-top: 7rpx;}
  233. view{font-weight: bold;font-size: 26rpx;color: #888888;}
  234. }
  235. }
  236. }
  237. }
  238. </style>