showDepartmentQrcode.vue 6.3 KB

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