home.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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 class="suggestions-feedback-btn" @click="feedbackFunc">
  48. <text class="func-text">建议与反馈</text>
  49. <image class="icon-more" src="/static/images/icon-more.png"></image>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="logout-box" @click="logOut">
  54. <text class="logout-text">退出登录</text>
  55. </view>
  56. <view class="copyright" @click="showVersionInfo">
  57. <text>浙江新医智联信息科技有限公司</text>
  58. <text>{{version}}</text>
  59. </view>
  60. <tm-tabbar :permission="nowPermission" />
  61. <tm-modal v-if="showJournal">
  62. <view class="journal">
  63. <view class="journal-title">
  64. <text>{{journalData.logTitle}}</text>
  65. <text>{{journalData.logDate}}</text>
  66. </view>
  67. <scroll-view scroll-y="true" class="journal-content">
  68. <textarea class="journal-content-inner" v-html="identifyEnterCode(journalData.logContent)" />
  69. <!-- {{journalData.logContent}} -->
  70. </scroll-view>
  71. <button class="journal-ok" @click="journalOk">确定</button>
  72. </view>
  73. </tm-modal>
  74. <tm-modal v-if="ifshowVersionInfo">
  75. <view class="journal">
  76. <view class="journal-title">
  77. <text>{{versionData.versionNo}}</text>
  78. <text>{{versionData.versionDate}}</text>
  79. </view>
  80. <scroll-view scroll-y="true" class="journal-content">
  81. <textarea class="journal-content-inner" v-html="identifyEnterCode(versionData.versionContent)" />
  82. <!-- {{versionData.versionContent}} -->
  83. </scroll-view>
  84. <button class="journal-ok" @click="ifshowVersionInfo = false">确定</button>
  85. </view>
  86. </tm-modal>
  87. </view>
  88. </template>
  89. <script>
  90. export default {
  91. data() {
  92. return {
  93. ifshowVersionInfo:false,
  94. showJournal: false,
  95. version: '0.5.3',
  96. versionData: {
  97. versionNo: '',
  98. versionId: '',
  99. versionDate: '',
  100. versionContent: ''
  101. },
  102. journalData: {
  103. logId: '',
  104. logTitle: '',
  105. logDate: '',
  106. logContent: ''
  107. },
  108. nowPermission: '', //用户当前第一权限
  109. nowPermissionName: '', //当前权限名
  110. code: '', //用户名
  111. name: '', //名字
  112. dep: '', //所属查核组
  113. depManager: '', //查核组组长
  114. hospName: '', //医院名
  115. totalTodo: 0, //总待办数
  116. pemissionList: [{
  117. permission: 1,
  118. name: '管理员'
  119. },
  120. {
  121. permission: 2,
  122. name: '查核组长'
  123. },
  124. {
  125. permission: 3,
  126. name: '查核组员'
  127. },
  128. {
  129. permission: 4,
  130. name: '单位负责人'
  131. },
  132. {
  133. permission: 5,
  134. name: '改善者'
  135. }
  136. ]
  137. }
  138. },
  139. created: function() {
  140. this.$store.dispatch({
  141. type: 'home/commActions',
  142. payload: {
  143. key: 'getuser',
  144. }
  145. }).then((data) => {
  146. if (data) {
  147. uni.setStorageSync('permissions', data.permissions);
  148. uni.setStorageSync('nowPermission', data.nowPermission);
  149. this.code = data.code;
  150. this.name = data.name;
  151. this.nowPermission = data.nowPermission;
  152. this.dep = data.dep;
  153. this.depManager = data.depManager;
  154. this.hospName = data.hospName;
  155. let current = this.pemissionList.find(item => item.permission == data.nowPermission);
  156. this.nowPermissionName = current.name;
  157. this.totalTodo = data.permissions.reduce(function(total, currentValue) {
  158. return total + currentValue.todoNum;
  159. }, 0);
  160. }
  161. });
  162. this.$store.dispatch({
  163. type: 'home/commActions',
  164. payload: {
  165. key: 'getVersionLog',
  166. data: {
  167. versionNo: this.version
  168. }
  169. }
  170. }).then((data) => {
  171. if (data) {
  172. if (!data.logId) {
  173. this.showJournal = false;
  174. } else {
  175. this.showJournal = true;
  176. this.journalData = data;
  177. }
  178. }
  179. });
  180. },
  181. created: function() {
  182. this.$store.dispatch({
  183. type: 'home/commActions',
  184. payload: {
  185. key: 'getuser',
  186. }
  187. }).then((data) => {
  188. if (data) {
  189. uni.setStorageSync('permissions', data.permissions);
  190. uni.setStorageSync('nowPermission', data.nowPermission);
  191. this.code=data.code;
  192. this.name=data.name;
  193. this.nowPermission=data.nowPermission;
  194. this.dep=data.dep;
  195. this.depManager=data.depManager;
  196. this.hospName=data.hospName;
  197. let current=this.pemissionList.find(item => item.permission == data.nowPermission);
  198. this.nowPermissionName=current.name;
  199. this.totalTodo=data.permissions.reduce(function(total,currentValue){
  200. return total+currentValue.todoNum;
  201. },0);
  202. }
  203. });
  204. this.$store.dispatch({
  205. type: 'home/commActions',
  206. payload: {
  207. key: 'getVersionLog',
  208. data: {versionNo: this.version}
  209. }
  210. }).then((data) => {
  211. if (data) {
  212. if(!data.logId) {
  213. this.showJournal = false;
  214. } else {
  215. this.showJournal = true;
  216. this.journalData = data;
  217. }
  218. }
  219. });
  220. },
  221. methods: {
  222. logOut() {
  223. this.$store.dispatch({
  224. type: 'home/commActions',
  225. payload: {
  226. key: 'logout',
  227. }
  228. }).then((data)=>{
  229. if(data){
  230. uni.redirectTo({
  231. url: `/pages/login/login?hospSign=${uni.getStorageSync('hospSign')}`
  232. });
  233. }
  234. });
  235. },
  236. identifyEnterCode(content){
  237. let repalcedContent = content.replace(/(\r\n|\n|\r)/gm, "<br />");
  238. console.log({repalcedContent});
  239. return repalcedContent;
  240. },
  241. feedbackFunc(){
  242. uni.navigateTo({
  243. url: '/pages/suggestionsFeedback/suggestionsFeedback'
  244. });
  245. },
  246. journalOk() {
  247. this.showJournal = false;
  248. this.$store.dispatch({
  249. type: 'home/commActions',
  250. payload: {
  251. key: 'hadRead',
  252. data: {
  253. versionNO: this.version,
  254. versionId: this.journalData.logId
  255. }
  256. }
  257. });
  258. },
  259. switchRole() {
  260. console.log('切换角色');
  261. uni.navigateTo({
  262. url: '/pages/role-switching/role-switching'
  263. });
  264. },
  265. showVersionInfo(){
  266. this.$store.dispatch({
  267. type: 'home/commActions',
  268. payload: {
  269. key: 'getThisVersionInfo',
  270. data: {
  271. versionNo: this.version,
  272. }
  273. }
  274. }).then(data=>{
  275. // console.log({'getThisVersionInfo':data});
  276. this.versionData = data;
  277. this.ifshowVersionInfo = true;
  278. });
  279. }
  280. },
  281. computed: {
  282. isMsgShow() {
  283. return this.totalTodo <= 0 ? false : true;
  284. }
  285. }
  286. }
  287. </script>
  288. <style lang="less">
  289. .journal {
  290. overflow: hidden;
  291. position: absolute;
  292. top: 50%;
  293. left: 50%;
  294. transform: translateX(-50%) translateY(-50%);
  295. border-radius: 15rpx;
  296. padding: 50rpx;
  297. padding-bottom: 75rpx;
  298. width: 562.5rpx;
  299. // height: 625rpx;
  300. font-size: 22.5rpx;
  301. line-height: 35rpx;
  302. background: #FFFFFF;
  303. .journal-title {
  304. display: flex;
  305. flex-direction: column;
  306. text {
  307. font-size: 35rpx;
  308. line-height: 52.5rpx;
  309. &:last-child {
  310. font-size: 22.5rpx;
  311. line-height: 33.75rpx;
  312. color: #666E80;
  313. }
  314. }
  315. }
  316. .journal-content {
  317. margin: 25rpx 0;
  318. max-height: 332.5rpx;
  319. .journal-content-inner {
  320. width: 462.5rpx;
  321. font-size: 22.5rpx;
  322. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  323. font-weight: 400;
  324. color: #292C33;
  325. line-height: 35rpx;
  326. word-wrap:break-word;
  327. }
  328. }
  329. .journal-ok {
  330. position: fixed;
  331. left: 0;
  332. bottom: 0;
  333. border-radius: 0;
  334. border: 0;
  335. width: 100%;
  336. height: 75rpx;
  337. line-height: 75rpx;
  338. font-size: 22.5rpx;
  339. color: #fff;
  340. background-color: #3377FF;
  341. }
  342. }
  343. .home-page {
  344. height: 100%;
  345. .content-info {
  346. height: 596.25rpx;
  347. background-color: #FFFFFF;
  348. .top-box {
  349. position: relative;
  350. height: 350rpx;
  351. .bgpic {
  352. width: 750rpx;
  353. height: 350rpx;
  354. }
  355. .hosname {
  356. font-size: 45rpx;
  357. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  358. font-weight: 400;
  359. color: #FFFFFF;
  360. position: absolute;
  361. left: 50rpx;
  362. top: 92.5rpx;
  363. }
  364. }
  365. .info-box {
  366. width: 700rpx;
  367. height: 250rpx;
  368. border-radius: 15rpx;
  369. background-color: #FFFFFF;
  370. position: absolute;
  371. left: 25rpx;
  372. right: 25rpx;
  373. top: 226.25rpx;
  374. box-shadow: 0px 10px 30px 0px rgba(0, 13, 51, 0.1);
  375. .head {
  376. margin-left: 37.5rpx;
  377. margin-top: 68.75rpx;
  378. .name {
  379. font-size: 35rpx;
  380. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  381. font-weight: 400;
  382. color: #17181A;
  383. }
  384. .gender {
  385. width: 25rpx;
  386. height: 25rpx;
  387. background: linear-gradient(135deg, #4DA6FF 0%, #4D88FF 100%);
  388. border-radius: 6.25rpx;
  389. margin-left: 15rpx;
  390. }
  391. .username {
  392. font-size: 25rpx;
  393. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  394. font-weight: 400;
  395. color: #17181A;
  396. margin-left: 55rpx;
  397. }
  398. }
  399. .row {
  400. margin-left: 37.5rpx;
  401. margin-top: 62.5rpx;
  402. .col {
  403. display: inline-block;
  404. margin-right: 25rpx;
  405. }
  406. }
  407. .text {
  408. font-size: 22.5rpx;
  409. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  410. font-weight: 400;
  411. color: #666E80;
  412. }
  413. }
  414. .avatar-box {
  415. width: 125rpx;
  416. height: 125rpx;
  417. position: absolute;
  418. right: 75rpx;
  419. top: 187.5rpx;
  420. background: #FFFFFF;
  421. z-index: 2;
  422. border-radius: 50%
  423. }
  424. .avatar {
  425. width: 112.5rpx;
  426. height: 112.5rpx;
  427. margin-left: 6.25rpx;
  428. margin-top: 6.25rpx;
  429. border-radius: 50%
  430. }
  431. .function-box {
  432. position: absolute;
  433. top: 496.25rpx;
  434. width: 750rpx;
  435. background-color: #FFFFFF;
  436. .role-switch {
  437. height: 100rpx;
  438. width: 725rpx;
  439. margin-left: 25rpx;
  440. background: #FFFFFF;
  441. border-bottom: 0.62rpx solid #DADEE6;
  442. .msg-box {
  443. width: 50rpx;
  444. height: 30rpx;
  445. float: left;
  446. margin-top: 35rpx;
  447. margin-left: 15rpx;
  448. position: relative;
  449. background: #FF4060;
  450. border-radius: 24px;
  451. text-align: center;
  452. .msg-text {
  453. font-size: 17.5rpx;
  454. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  455. font-weight: 400;
  456. color: #FFFFFF;
  457. line-height: 30rpx;
  458. }
  459. }
  460. .role {
  461. font-size: 22.5rpx;
  462. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  463. font-weight: 400;
  464. color: #7A8599;
  465. line-height: 100rpx;
  466. float: right;
  467. margin-right: 25rpx;
  468. }
  469. }
  470. // .sys-setting{
  471. // height: 100rpx;
  472. // width: 725rpx;
  473. // margin-left: 25rpx;
  474. // background: #FFFFFF;
  475. // }
  476. .suggestions-feedback-btn {
  477. height: 100rpx;
  478. width: 725rpx;
  479. margin-left: 25rpx;
  480. background: #FFFFFF;
  481. // border-bottom: 0.62rpx solid #DADEE6;
  482. .func-text {
  483. }
  484. }
  485. .func-text {
  486. font-size: 22.5rpx;
  487. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  488. font-weight: 500;
  489. color: #292C33;
  490. line-height: 100rpx;
  491. float: left;
  492. }
  493. .icon-more {
  494. width: 12.37rpx;
  495. height: 21.21rpx;
  496. line-height: 100rpx;
  497. float: right;
  498. margin-top: 39.37rpx;
  499. margin-right: 25rpx;
  500. }
  501. }
  502. }
  503. .logout-box {
  504. width: 750rpx;
  505. height: 100rpx;
  506. background-color: #FFFFFF;
  507. margin-top:112.5rpx;
  508. .logout-text {
  509. font-size: 22.5rpx;
  510. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  511. font-weight: 500;
  512. color: #292C33;
  513. line-height: 100rpx;
  514. margin-left: 330rpx;
  515. }
  516. }
  517. .copyright {
  518. position: absolute;
  519. bottom: 90rpx;
  520. left: 0;
  521. display: flex;
  522. flex-direction: column;
  523. justify-content: center;
  524. align-items: center;
  525. width: 100%;
  526. color: #666E80;
  527. }
  528. }
  529. </style>