home.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <view class="home-page">
  3. <view class="content-info">
  4. <view class="top-box">
  5. <image class="bgpic" src="/static/images/pcbg.png"></image>
  6. <text class="hosname">{{hospName}}</text>
  7. </view>
  8. <view class="avatar-box">
  9. <image class="avatar" src="/static/images/boy-avatar.png"></image>
  10. </view>
  11. <view class="info-box">
  12. <view class="head">
  13. <text class="name">
  14. {{name}}
  15. </text>
  16. <!-- <image class="gender" src="/static/images/boy.png"></image> -->
  17. <text class="username">{{code}}</text>
  18. </view>
  19. <!-- <view class="row">
  20. <text class="text">心血管内科</text>
  21. </view> -->
  22. <view class="row">
  23. <view class="col">
  24. <text class="text">主管:{{depManager}}</text>
  25. </view>
  26. <view class="col">
  27. <text class="text">|</text>
  28. </view>
  29. <view class="col">
  30. <text class="text">所属查核组:{{dep}}</text>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="function-box">
  35. <view class="role-switch" @click="switchRole">
  36. <text class="func-text">角色切换</text>
  37. <view class="msg-box" v-show="isMsgShow">
  38. <text class="msg-text">{{this.totalTodo}}</text>
  39. </view>
  40. <image class="icon-more" src="/static/images/icon-more.png"></image>
  41. <text class="role">{{nowPermissionName}}</text>
  42. </view>
  43. <!-- <view class="sys-setting">
  44. <text class="func-text">系统设置</text>
  45. <image class="icon-more" src="/static/images/icon-more.png"></image>
  46. </view> -->
  47. </view>
  48. </view>
  49. <view class="logout-box" @click="logOut">
  50. <text class="logout-text">退出登录</text>
  51. </view>
  52. <tm-tabbar :permission="nowPermission" />
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. nowPermission: '', //用户当前第一权限
  60. nowPermissionName:'',//当前权限名
  61. code:'',//用户名
  62. name:'',//名字
  63. dep:'',//所属查核组
  64. depManager:'',//查核组组长
  65. hospName:'',//医院名
  66. totalTodo:0,//总待办数
  67. pemissionList:[
  68. {permission: 1, name: '管理员'},
  69. {permission: 2, name: '查核组长'},
  70. {permission: 3, name: '查核组员'},
  71. {permission: 4, name: '单位负责人'},
  72. {permission: 5, name: '改善者'}
  73. ]
  74. }
  75. },
  76. created: function() {
  77. this.$store.dispatch({
  78. type: 'home/commActions',
  79. payload: {
  80. key: 'getuser',
  81. }
  82. }).then((data) => {
  83. if (data) {
  84. uni.setStorageSync('permissions', data.permissions);
  85. uni.setStorageSync('nowPermission', data.nowPermission);
  86. this.code=data.code;
  87. this.name=data.name;
  88. this.nowPermission=data.nowPermission;
  89. this.dep=data.dep;
  90. this.depManager=data.depManager;
  91. this.hospName=data.hospName;
  92. let current=this.pemissionList.find(item => item.permission == data.nowPermission);
  93. this.nowPermissionName=current.name;
  94. this.totalTodo=data.permissions.reduce(function(total,currentValue){
  95. return total+currentValue.todoNum;
  96. },0);
  97. }
  98. });
  99. },
  100. methods: {
  101. logOut() {
  102. this.$store.dispatch({
  103. type: 'home/commActions',
  104. payload: {
  105. key: 'logout',
  106. }
  107. }).then((data)=>{
  108. if(data!==null){
  109. uni.navigateTo({
  110. url: '/pages/login/login'
  111. });
  112. }
  113. });
  114. },
  115. switchRole() {
  116. uni.navigateTo({
  117. url: '/pages/role-switching/role-switching'
  118. });
  119. }
  120. },
  121. computed:{
  122. isMsgShow(){
  123. return this.totalTodo<=0?false:true;
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="less">
  129. .home-page {
  130. height: 100%;
  131. .content-info {
  132. height: 596.25rpx;
  133. background-color: #FFFFFF;
  134. .top-box {
  135. position: relative;
  136. height: 350rpx;
  137. .bgpic {
  138. width: 750rpx;
  139. height: 350rpx;
  140. }
  141. .hosname {
  142. font-size: 45rpx;
  143. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  144. font-weight: 400;
  145. color: #FFFFFF;
  146. position: absolute;
  147. left: 50rpx;
  148. top: 92.5rpx;
  149. }
  150. }
  151. .info-box {
  152. width: 700rpx;
  153. height: 250rpx;
  154. border-radius: 15rpx;
  155. background-color: #FFFFFF;
  156. position: absolute;
  157. left: 25rpx;
  158. right: 25rpx;
  159. top: 226.25rpx;
  160. box-shadow: 0px 10px 30px 0px rgba(0, 13, 51, 0.1);
  161. .head {
  162. margin-left: 37.5rpx;
  163. margin-top: 68.75rpx;
  164. .name {
  165. font-size: 35rpx;
  166. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  167. font-weight: 400;
  168. color: #17181A;
  169. }
  170. .gender {
  171. width: 25rpx;
  172. height: 25rpx;
  173. background: linear-gradient(135deg, #4DA6FF 0%, #4D88FF 100%);
  174. border-radius: 6.25rpx;
  175. margin-left: 15rpx;
  176. }
  177. .username {
  178. font-size: 25rpx;
  179. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  180. font-weight: 400;
  181. color: #17181A;
  182. margin-left: 55rpx;
  183. }
  184. }
  185. .row {
  186. margin-left: 37.5rpx;
  187. margin-top: 62.5rpx;
  188. .col {
  189. display: inline-block;
  190. margin-right: 25rpx;
  191. }
  192. }
  193. .text {
  194. font-size: 22.5rpx;
  195. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  196. font-weight: 400;
  197. color: #666E80;
  198. }
  199. }
  200. .avatar-box {
  201. width: 125rpx;
  202. height: 125rpx;
  203. position: absolute;
  204. right: 75rpx;
  205. top: 187.5rpx;
  206. background: #FFFFFF;
  207. z-index: 2;
  208. border-radius: 50%
  209. }
  210. .avatar {
  211. width: 112.5rpx;
  212. height: 112.5rpx;
  213. margin-left: 6.25rpx;
  214. margin-top: 6.25rpx;
  215. border-radius: 50%
  216. }
  217. .function-box {
  218. position: absolute;
  219. top: 496.25rpx;
  220. width: 750rpx;
  221. .role-switch {
  222. height: 100rpx;
  223. width: 725rpx;
  224. margin-left: 25rpx;
  225. background: #FFFFFF;
  226. border-bottom: 0.62rpx solid #DADEE6;
  227. .msg-box {
  228. width: 50rpx;
  229. height: 30rpx;
  230. float: left;
  231. margin-top: 35rpx;
  232. margin-left: 15rpx;
  233. position: relative;
  234. background: #FF4060;
  235. border-radius: 24px;
  236. text-align: center;
  237. .msg-text {
  238. font-size: 17.5rpx;
  239. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  240. font-weight: 400;
  241. color: #FFFFFF;
  242. line-height: 30rpx;
  243. }
  244. }
  245. .role {
  246. font-size: 22.5rpx;
  247. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  248. font-weight: 400;
  249. color: #7A8599;
  250. line-height: 100rpx;
  251. float: right;
  252. margin-right: 25rpx;
  253. }
  254. }
  255. // .sys-setting{
  256. // height: 100rpx;
  257. // width: 725rpx;
  258. // margin-left: 25rpx;
  259. // background: #FFFFFF;
  260. // }
  261. .func-text {
  262. font-size: 22.5rpx;
  263. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  264. font-weight: 500;
  265. color: #292C33;
  266. line-height: 100rpx;
  267. float: left;
  268. }
  269. .icon-more {
  270. width: 12.37rpx;
  271. height: 21.21rpx;
  272. line-height: 100rpx;
  273. float: right;
  274. margin-top: 39.37rpx;
  275. margin-right: 25rpx;
  276. }
  277. }
  278. }
  279. .logout-box {
  280. width: 750rpx;
  281. height: 100rpx;
  282. background-color: #FFFFFF;
  283. margin-top: 15rpx;
  284. .logout-text {
  285. font-size: 22.5rpx;
  286. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  287. font-weight: 500;
  288. color: #292C33;
  289. line-height: 100rpx;
  290. margin-left: 330rpx;
  291. }
  292. }
  293. }
  294. </style>