home.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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.3',
  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. height: 100%;
  391. .content-info {
  392. height: 700.25rpx;
  393. background-color: #FFFFFF;
  394. .top-box {
  395. position: relative;
  396. height: 350rpx;
  397. .bgpic {
  398. width: 750rpx;
  399. height: 350rpx;
  400. }
  401. .hosname {
  402. font-size: 45rpx;
  403. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  404. font-weight: 400;
  405. color: #FFFFFF;
  406. position: absolute;
  407. left: 50rpx;
  408. top: 92.5rpx;
  409. }
  410. }
  411. .info-box {
  412. width: 700rpx;
  413. height: 250rpx;
  414. border-radius: 15rpx;
  415. background-color: #FFFFFF;
  416. position: absolute;
  417. left: 25rpx;
  418. right: 25rpx;
  419. top: 226.25rpx;
  420. box-shadow: 0px 10px 30px 0px rgba(0, 13, 51, 0.1);
  421. .head {
  422. margin-left: 37.5rpx;
  423. margin-top: 68.75rpx;
  424. .name {
  425. font-size: 35rpx;
  426. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  427. font-weight: 400;
  428. color: #17181A;
  429. }
  430. .gender {
  431. width: 25rpx;
  432. height: 25rpx;
  433. background: linear-gradient(135deg, #4DA6FF 0%, #4D88FF 100%);
  434. border-radius: 6.25rpx;
  435. margin-left: 15rpx;
  436. }
  437. .username {
  438. font-size: 25rpx;
  439. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  440. font-weight: 400;
  441. color: #17181A;
  442. margin-left: 55rpx;
  443. }
  444. }
  445. .row {
  446. margin-left: 37.5rpx;
  447. margin-top: 62.5rpx;
  448. .col {
  449. display: inline-block;
  450. margin-right: 25rpx;
  451. }
  452. }
  453. .text {
  454. width: 50rpx;
  455. font-size: 22.5rpx;
  456. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  457. font-weight: 400;
  458. color: #666E80;
  459. // overflow: hidden;
  460. // text-overflow: ellipsis;
  461. // white-space: nowrap;
  462. }
  463. }
  464. .avatar-box {
  465. width: 125rpx;
  466. height: 125rpx;
  467. position: absolute;
  468. right: 75rpx;
  469. top: 187.5rpx;
  470. background: #FFFFFF;
  471. z-index: 2;
  472. border-radius: 50%
  473. }
  474. .avatar {
  475. width: 112.5rpx;
  476. height: 112.5rpx;
  477. margin-left: 6.25rpx;
  478. margin-top: 6.25rpx;
  479. border-radius: 50%
  480. }
  481. .function-box {
  482. position: absolute;
  483. top: 496.25rpx;
  484. width: 750rpx;
  485. background-color: #FFFFFF;
  486. .role-switch {
  487. height: 100rpx;
  488. width: 725rpx;
  489. margin-left: 25rpx;
  490. background: #FFFFFF;
  491. border-bottom: 0.62rpx solid #DADEE6;
  492. .msg-box {
  493. width: 50rpx;
  494. height: 30rpx;
  495. float: left;
  496. margin-top: 35rpx;
  497. margin-left: 15rpx;
  498. position: relative;
  499. background: #FF4060;
  500. border-radius: 24px;
  501. text-align: center;
  502. .msg-text {
  503. font-size: 17.5rpx;
  504. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  505. font-weight: 400;
  506. color: #FFFFFF;
  507. line-height: 30rpx;
  508. }
  509. }
  510. .role {
  511. font-size: 22.5rpx;
  512. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  513. font-weight: 400;
  514. color: #7A8599;
  515. line-height: 100rpx;
  516. float: right;
  517. margin-right: 25rpx;
  518. }
  519. }
  520. // .sys-setting{
  521. // height: 100rpx;
  522. // width: 725rpx;
  523. // margin-left: 25rpx;
  524. // background: #FFFFFF;
  525. // }
  526. .suggestions-feedback-btn {
  527. height: 100rpx;
  528. width: 725rpx;
  529. margin-left: 25rpx;
  530. background: #FFFFFF;
  531. border-bottom: 0.62rpx solid #DADEE6;
  532. .func-text {
  533. }
  534. }
  535. .resetPsd-btn {
  536. height: 100rpx;
  537. width: 725rpx;
  538. margin-left: 25rpx;
  539. background: #FFFFFF;
  540. border-bottom: 0.5px solid #DADEE6;
  541. }
  542. .viewReport-btn {
  543. height: 100rpx;
  544. width: 725rpx;
  545. margin-left: 25rpx;
  546. background: #FFFFFF;
  547. }
  548. .func-text {
  549. font-size: 22.5rpx;
  550. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  551. font-weight: 500;
  552. color: #292C33;
  553. line-height: 100rpx;
  554. float: left;
  555. }
  556. .icon-more {
  557. width: 12.37rpx;
  558. height: 21.21rpx;
  559. line-height: 100rpx;
  560. float: right;
  561. margin-top: 39.37rpx;
  562. margin-right: 25rpx;
  563. }
  564. }
  565. }
  566. .logout-box {
  567. width: 750rpx;
  568. height: 100rpx;
  569. background-color: #FFFFFF;
  570. margin-top:210rpx;
  571. .logout-text {
  572. font-size: 22.5rpx;
  573. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  574. font-weight: 500;
  575. color: #292C33;
  576. line-height: 100rpx;
  577. margin-left: 330rpx;
  578. }
  579. }
  580. .copyright {
  581. position: absolute;
  582. bottom: 90rpx;
  583. left: 0;
  584. display: flex;
  585. flex-direction: column;
  586. justify-content: center;
  587. align-items: center;
  588. width: 100%;
  589. color: #666E80;
  590. }
  591. }
  592. </style>