info.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="window-box dis-flex" style="background-color: #E9ECF2">
  3. <ly-back :autoBack="false" @backClick="backClick"/>
  4. <view v-if="countDown >= 0" class="countDown">{{ formatZero(countDown, 2) }}</view>
  5. <view class="w100 flex-center-center flex-dir-column">
  6. <view class="baseMessage w80 p-r">
  7. <view class="p-a avatar">
  8. <student-info :student="student"/>
  9. </view>
  10. <view class="dis-flex flex-wrap flex-y-center m-40" style="height: 80px;text-align: center">
  11. <view class="flex-three p-10">姓名:{{pageData.studentInfo.name}}</view>
  12. <view class="flex-three p-10">性别:{{pageData.studentInfo.gender}}</view>
  13. <view class="flex-three p-10">班级:{{pageData.studentInfo.class}}</view>
  14. <view class="flex-three p-10">模式:{{pageData.studentInfo.model}}</view>
  15. <view class="flex-three p-10">学校:{{pageData.studentInfo.school}}</view>
  16. </view>
  17. </view>
  18. <view class="dis-flex w80">
  19. <view v-if="pageData.status == 1" class="m-t-50 p-r-20">
  20. <view v-for="(item,index) in pageData.card" :key="index" class="cardbg b-r-15" @click="showDetail(item)" :class="['cardbg-'+index]">
  21. <view class="f-u-35 dis-flex flex-y-center checkCard p-l-20 p-r-20 p-t-20 p-b-5">
  22. <view class="circle" :class="['circle-'+index]"></view>
  23. <view class="flex-grow t-a-c">
  24. <view class="f-w-b">{{item.name}}</view>
  25. <view class="f-u-32 font-color p-10">
  26. <view v-if="pageData.status == 1" class="t-a-c f-w-5 f-u-29">
  27. <view v-if="item.value1">{{item.title1}}:{{item.value1}}</view>
  28. <view class="m-t-10" v-if="item.value2">{{item.title2}}:{{item.value2}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="checkMessage p-40 m-t-50 b-r-15 flex-center-center flex-dir-column flex-grow" style="min-height: 500rpx">
  36. <view class="f-u-35 col-f p-20">{{pageData.status == 1?'检测结果展示':'待检测项目'}}</view>
  37. <view class="w-bg w100 b-r-15 m-t-10 flex-y-start flex-wrap flex-grow ">
  38. <view v-for="(item,index) in pageData.card" :key="index" class="flex-two t-a-c p-20 f-u-32 f-w-b">
  39. <view class="flex-center-center">
  40. <view class="circle1" :class="['circleBg-'+index]"></view>
  41. <view class="p-l-10">{{ item.name }} </view>
  42. </view>
  43. <view v-if="pageData.status == 0" class="t-a-c col-red f-w-5 p-l-50"> {{ item.status }} </view>
  44. <view v-if="pageData.status == 1" class="t-a-c f-w-5 p-l-50 p-t-20 font-color dis-flex flex-x-center">
  45. <view v-if="item.value1">{{item.title1}}:{{item.value1}}</view>
  46. <view class="p-l-20" v-if="item.value2">{{item.title2}}:{{item.value2}}</view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="dis-flex flex-x-center w100 m-t-50">
  53. <view v-if="pageData.status == 0" class="w10" @click="toTask(10)">
  54. <view class="btn btn-primary w100">进入测试</view>
  55. </view>
  56. <view v-if="pageData.status == 1" class="w10">
  57. <view class="btn btn-primary w100">重新检测</view>
  58. </view>
  59. <view v-if="pageData.status == 1" class="w10 m-l-50" @click="logout">
  60. <view class="btn btn-primary w100">完成</view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- <view class="window w40 flex-center-center flex-dir-column">-->
  65. <!-- <student-info :student="student"/>-->
  66. <!-- </view>-->
  67. <!-- <view class="w60 h100 dis-flex flex-x-center flex-dir-column">-->
  68. <!-- <template v-if="configStore.mType === 7">-->
  69. <!-- <view class="info-item">-->
  70. <!-- <view class="info-item-label">身高</view>-->
  71. <!-- <view class="">-->
  72. <!-- <view class="col-checked f-64">{{ queryForm.value1 }}</view>-->
  73. <!-- </view>-->
  74. <!-- </view>-->
  75. <!-- <view class="info-item">-->
  76. <!-- <view class="info-item-label">体重</view>-->
  77. <!-- <view class="">-->
  78. <!-- <view class="col-checked f-64">{{ queryForm.value2 }}</view>-->
  79. <!-- </view>-->
  80. <!-- </view>-->
  81. <!-- </template>-->
  82. <!-- <view v-if="configStore.mType === 8" class="info-item">-->
  83. <!-- <view class="info-item-label">肺活量</view>-->
  84. <!-- <view class="">-->
  85. <!-- <view class="btn btn-primary">进入肺活量</view>-->
  86. <!-- </view>-->
  87. <!-- </view>-->
  88. <!-- <view v-if="configStore.mType === 9" class="info-item">-->
  89. <!-- <view class="info-item-label">视力</view>-->
  90. <!-- <view class="">-->
  91. <!-- <view class="btn btn-primary">进入视力</view>-->
  92. <!-- </view>-->
  93. <!-- </view>-->
  94. <!-- </view>-->
  95. <ly-modal ref="modelRef"></ly-modal>
  96. </view>
  97. </template>
  98. <script setup>
  99. import {onActivated, onMounted, reactive, ref} from "vue";
  100. import {formatZero} from "@/utils/util";
  101. import {useConfigStore} from "@/store/useConfigStore";
  102. import {redirectTo} from "@/utils/app";
  103. import debounce from "@/utils/debounce";
  104. import studentInfo from "./studentInfo"
  105. import storage from "@/utils/storage";
  106. const configStore = useConfigStore()
  107. const countDown = ref(0)
  108. const debounces = new debounce()
  109. const modelRef = ref()
  110. let student = reactive({
  111. jname: '未识别',
  112. gender: 1,
  113. })
  114. const queryForm = reactive({
  115. student_id: 0,
  116. value1: 0,
  117. value2: 0,
  118. })
  119. const pageData = reactive({
  120. status: 0,
  121. studentInfo:{
  122. name:'测试',
  123. gender:'男',
  124. class:'xx年级xx班',
  125. model:'机器录入',
  126. school:'xxxx学校',
  127. },
  128. card:[
  129. {name:'BMI',img:'/card-bg1.png',status:'待检测',value1:'175cm',value2:'54kg',title1:'身高',title2:'体重'},
  130. {name:'肺活量',img:'/card-bg2 .png',status:'待检测',value1:'3500ml',title1:'肺活量'},
  131. {name:'视力',img:'/card-bg3.png',status:'待检测',value1:'5.0',value2:'5.0',title1:'左眼',title2:'右眼'}
  132. ]
  133. })
  134. const search = () => {
  135. queryForm.student_id = 2260
  136. }
  137. const backClick = () => {
  138. console.log('modelRef', modelRef, modelRef.value.open)
  139. modelRef.value.open({
  140. title: '温馨提示',
  141. content: '确认要退出吗?',
  142. showCancelButton: true,
  143. confirm:()=>{
  144. logout()
  145. }
  146. })
  147. // confirmModal('请认要退出吗?').then(() => {
  148. // redirectTo('pages/index/index')
  149. // }, () => {
  150. // })
  151. }
  152. const logout = () => {
  153. storage.remove(`student-${student.id}`)
  154. redirectTo('pages/index/index')
  155. }
  156. const countDownHandle = () => {
  157. countDown.value = 30
  158. debounces.countDown('countDown', {
  159. duration: 30000,
  160. callback: () => {
  161. countDown.value--
  162. },
  163. endCallback: () => {
  164. // 清空缓存学生信息
  165. logout()
  166. },
  167. })
  168. }
  169. const showDetail = (item)=>{
  170. console.log(item)
  171. }
  172. const toTask = () => {
  173. pageData.status = 1
  174. }
  175. // 挂载完成之后
  176. onMounted((r) => {
  177. // student = storage.getKey(`student-${r.id}`)
  178. countDownHandle()
  179. })
  180. // 激活页面时
  181. onActivated(() => {
  182. })
  183. </script>
  184. <style lang="scss" scoped>
  185. .container {
  186. width: 100vw;
  187. height: 100vh;
  188. max-width: 100vw;
  189. max-height: 100vh;
  190. overflow: hidden;
  191. }
  192. .info-item {
  193. display: flex;
  194. align-items: center;
  195. margin-bottom: 30rpx;
  196. &-label {
  197. margin-right: 50rpx;
  198. }
  199. }
  200. .countDown {
  201. width: 130rpx;
  202. height: 130rpx;
  203. position: fixed;
  204. top: 20rpx;
  205. right: 20rpx;
  206. border: 6rpx solid green;
  207. color: green;
  208. border-radius: 50%;
  209. display: flex;
  210. justify-content: center;
  211. align-items: center;
  212. font-size: 60rpx;
  213. }
  214. .baseMessage {
  215. background: linear-gradient(180deg, #FFFFFF 0%, #E0EDF8 100%);
  216. box-shadow: 0px 0px 8px 1px #498CFC;
  217. }
  218. .avatar {
  219. border: 8rpx solid #498CFC;
  220. border-radius: 50%;
  221. top: 0;
  222. transform: translateY(-50%);
  223. left: 60rpx;
  224. }
  225. .checkMessage {
  226. background: linear-gradient(180deg, #498CFC 0%, #E0EDF8 100%);
  227. }
  228. .cardbg{
  229. width: 500rpx;
  230. height: 230rpx;
  231. background-size: 100%;
  232. border-radius: 15rpx;
  233. margin-bottom: 20rpx;
  234. &-0{
  235. background: url('static/card-bg1.png') no-repeat center center;
  236. }
  237. &-1{
  238. background: url('static/card-bg2.png') no-repeat center center;
  239. }
  240. &-2{
  241. background: url('static/card-bg3.png') no-repeat center center;
  242. }
  243. }
  244. .checkCard{
  245. height: 80%;
  246. background-color: #FFFFFF;
  247. border-radius: 15rpx 15rpx 25rpx 25rpx;
  248. .circle{
  249. width: 130rpx;
  250. height: 130rpx;
  251. border-radius: 50%;
  252. &-0{
  253. background-color: #027EEC;
  254. }
  255. &-1{
  256. background-color: #F7B03C;
  257. }
  258. &-2{
  259. background-color: #17ACC3;
  260. }
  261. }
  262. }
  263. .circle1{
  264. width: 35rpx;
  265. height: 35rpx;
  266. border-radius: 50%;
  267. }
  268. .circleBg{
  269. &-0{
  270. background-color: #027EEC;
  271. }
  272. &-1{
  273. background-color: #F7B03C;
  274. }
  275. &-2{
  276. background-color: #17ACC3;
  277. }
  278. }
  279. .font-color{
  280. color: #153269;
  281. }
  282. </style>