showDepartmentQrcode.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="showModel" v-show="disjunctor">
  3. <view class="showModel__wrap">
  4. <view class="showModel__header">
  5. 科室二维码 <text v-if="userData.user.dutyDeptDTO">({{ refreshQRCodeTime }}s)</text>
  6. </view>
  7. <view class="showModel__article">
  8. <view class="showModel__content" v-if="userData.user.dutyDeptDTO">
  9. <image :src="qrCode" mode="widthFix" style="width: 100%;"></image>
  10. <view class="page_item_btn" @click="bindDept()"> 切换科室 </view>
  11. <view class="page_item_btn mt8" @click="toStationaryPatient()"> 驻点患者 </view>
  12. </view>
  13. <view class="showModel__content" v-else>
  14. <view class="page_item_btn" @click="bindDept()"> 绑定科室 </view>
  15. </view>
  16. </view>
  17. <view class="showModel__footer">
  18. <view class="showModel__know" @click="know" hover-class="seimin-btn-hover">关闭</view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. get,
  26. post,
  27. webHandle
  28. } from "../../http/http.js";
  29. export default {
  30. data() {
  31. return {
  32. timer: null,
  33. refreshQRCodeTime: 0, //刷新时间间隔
  34. qrCode: '',//二维码
  35. userData: uni.getStorageSync('userData'),//当前用户
  36. };
  37. },
  38. props: {
  39. // 显示隐藏
  40. disjunctor: {
  41. type: Boolean,
  42. default: false,
  43. },
  44. },
  45. methods: {
  46. // 关闭
  47. know() {
  48. this.$emit("know");
  49. clearInterval(this.timer);
  50. this.timer = null;
  51. },
  52. // 绑定科室
  53. bindDept(){
  54. uni.navigateTo({
  55. url: `../search/search?type=showDepartmentQrcode`,
  56. });
  57. },
  58. // 驻点患者
  59. toStationaryPatient(){
  60. uni.navigateTo({
  61. url: `/pages/stationaryPatient/stationaryPatient?dutyDeptId=${this.userData.user.dutyDeptDTO.id}`,
  62. });
  63. },
  64. // 获取我的二维码
  65. getQrCode(){
  66. uni.showLoading({
  67. title: "加载中",
  68. mask: true,
  69. });
  70. post("/dept/deptCodes/0", [this.userData.user.dutyDeptDTO.id])
  71. .then((result) => {
  72. uni.hideLoading();
  73. if (result.status == 200) {
  74. this.qrCode = result.data[0].base64;
  75. this.refreshQRCodeTime = result.data[0].refreshQRCodeTime;
  76. clearInterval(this.timer);
  77. this.timer = setInterval(() => {
  78. this.refreshQRCodeTime = Math.max(--this.refreshQRCodeTime, 0);
  79. if (this.refreshQRCodeTime === 0) {
  80. clearInterval(this.timer);
  81. this.getQrCode();
  82. }
  83. }, 1000);
  84. } else {
  85. uni.showToast({
  86. icon: "none",
  87. title: result.msg || "接口获取数据失败!",
  88. });
  89. }
  90. })
  91. },
  92. },
  93. mounted() {
  94. this.userData = uni.getStorageSync('userData');
  95. console.log(this.userData.user, 'userData');
  96. // 有责任科室则查询动态二维码
  97. this.userData.user.dutyDeptDTO && this.getQrCode();
  98. },
  99. };
  100. </script>
  101. <style lang="less" scoped>
  102. .showModel {
  103. position: fixed;
  104. left: 0;
  105. right: 0;
  106. top: 0;
  107. bottom: 0;
  108. background-color: rgba(0, 0, 0, 0.2);
  109. z-index: 999999;
  110. .page_item_btn {
  111. height: 88rpx;
  112. background-image: linear-gradient(to right, #72c172, #3bb197);
  113. border-radius: 8rpx;
  114. line-height: 88rpx;
  115. color: #fff;
  116. font-size: 36rpx;
  117. font-weight: 700;
  118. text-align: center;
  119. }
  120. .showModel__wrap {
  121. width: 560rpx;
  122. position: absolute;
  123. left: 50%;
  124. top: 50%;
  125. transform: translate(-50%, -50%);
  126. background-color: #fff;
  127. border-radius: 12rpx;
  128. .showModel__header {
  129. font-size: 36rpx;
  130. color: #000;
  131. height: 84rpx;
  132. display: flex;
  133. justify-content: center;
  134. align-items: center;
  135. }
  136. .showModel__article {
  137. color: #000;
  138. margin: 0 auto 25rpx;
  139. width: 488rpx;
  140. background-color: rgb(249, 250, 251);
  141. border: 2rpx solid rgb(229, 233, 237);
  142. border-radius: 12rpx;
  143. box-sizing: border-box;
  144. display: flex;
  145. flex-direction: column;
  146. justify-content: center;
  147. align-items: center;
  148. &.p0 {
  149. padding: 0;
  150. }
  151. &.p1 {
  152. text-align: left;
  153. }
  154. .showModel__icon {
  155. font-size: 138rpx;
  156. margin-bottom: 32rpx;
  157. &.showModel__icon--success {
  158. color: rgb(52, 179, 73);
  159. }
  160. &.showModel__icon--warn {
  161. color: rgb(245, 165, 35);
  162. }
  163. &.showModel__icon--error {
  164. color: rgb(255, 58, 82);
  165. }
  166. }
  167. .showModel__content {
  168. font-size: 36rpx;
  169. word-break: break-all;
  170. width: 100%;
  171. }
  172. .showModel__info {
  173. font-size: 32rpx;
  174. color: rgb(102, 102, 102);
  175. }
  176. .specialCloseFlag {
  177. width: 90%;
  178. height: 100%;
  179. padding: 16rpx;
  180. }
  181. .radio-wrap {
  182. .radio-item {
  183. margin-top: 16rpx;
  184. /deep/ .uni-radio-input-checked {
  185. background-color: #49b856 !important;
  186. border-color: #49b856 !important;
  187. }
  188. }
  189. }
  190. }
  191. .showModel__footer {
  192. box-sizing: border-box;
  193. height: 100rpx;
  194. border-top: 2rpx solid rgb(229, 233, 237);
  195. display: flex;
  196. align-items: center;
  197. view {
  198. height: 100%;
  199. display: flex;
  200. align-items: center;
  201. justify-content: center;
  202. font-size: 36rpx;
  203. color: rgb(102, 102, 102);
  204. position: relative;
  205. &:nth-of-type(2)::before {
  206. content: "";
  207. position: absolute;
  208. left: 0;
  209. bottom: 0;
  210. width: 2rpx;
  211. height: 87rpx;
  212. background-color: rgb(229, 233, 237);
  213. }
  214. }
  215. .showModel__ok {
  216. flex: 1;
  217. color: rgb(73, 184, 86);
  218. }
  219. .showModel__cancel {
  220. flex: 1;
  221. }
  222. .showModel__know {
  223. flex: 1;
  224. color: rgb(73, 184, 86);
  225. }
  226. }
  227. }
  228. }
  229. </style>