home.vue 15 KB

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