home.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  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.7.9',
  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. }
  150. },
  151. created: function() {
  152. this.$store.dispatch({
  153. type: 'home/commActions',
  154. payload: {
  155. key: 'getuser',
  156. }
  157. }).then((data) => {
  158. if (data) {
  159. uni.setStorageSync('permissions', data.permissions);
  160. uni.setStorageSync('nowPermission', data.nowPermission);
  161. this.code = data.code;
  162. this.name = data.name;
  163. this.nowPermission = data.nowPermission;
  164. this.dep = data.dep;
  165. this.depManager = data.depManager;
  166. this.hospName = data.hospName;
  167. let current = this.pemissionList.find(item => item.permission == data.nowPermission);
  168. this.nowPermissionName = current.name;
  169. this.totalTodo = data.permissions.reduce(function(total, currentValue) {
  170. return total + currentValue.todoNum;
  171. }, 0);
  172. }
  173. });
  174. this.$store.dispatch({
  175. type: 'home/commActions',
  176. payload: {
  177. key: 'getVersionLog',
  178. data: {
  179. versionNo: this.version
  180. }
  181. }
  182. }).then((data) => {
  183. if (data) {
  184. if (!data.logId) {
  185. this.showJournal = false;
  186. } else {
  187. this.showJournal = true;
  188. this.journalData = data;
  189. }
  190. }
  191. });
  192. },
  193. created: function() {
  194. this.$store.dispatch({
  195. type: 'home/commActions',
  196. payload: {
  197. key: 'getuser',
  198. }
  199. }).then((data) => {
  200. if (data) {
  201. uni.setStorageSync('permissions', data.permissions);
  202. uni.setStorageSync('nowPermission', data.nowPermission);
  203. this.code=data.code;
  204. this.name=data.name;
  205. this.nowPermission=data.nowPermission;
  206. this.dep=data.dep;
  207. this.depManager=data.depManager;
  208. this.hospName=data.hospName;
  209. let current=this.pemissionList.find(item => item.permission == data.nowPermission);
  210. this.nowPermissionName=current.name;
  211. this.totalTodo=data.permissions.reduce(function(total,currentValue){
  212. return total+currentValue.todoNum;
  213. },0);
  214. }
  215. });
  216. this.$store.dispatch({
  217. type: 'home/commActions',
  218. payload: {
  219. key: 'getVersionLog',
  220. data: {versionNo: this.version}
  221. }
  222. }).then((data) => {
  223. if (data) {
  224. if(!data.logId) {
  225. this.showJournal = false;
  226. } else {
  227. this.showJournal = true;
  228. this.journalData = data;
  229. }
  230. }
  231. });
  232. },
  233. methods: {
  234. logOut() {
  235. this.$store.dispatch({
  236. type: 'home/commActions',
  237. payload: {
  238. key: 'logout',
  239. }
  240. }).then((data)=>{
  241. if(data){
  242. uni.removeStorageSync('hiId');
  243. uni.removeStorageSync('permissions');
  244. uni.removeStorageSync('token');
  245. uni.removeStorageSync('code');
  246. // uni.removeStorageSync('nowPermission');
  247. uni.removeStorageSync('id');
  248. uni.removeStorageSync('name');
  249. // uni.setStorageSync('hospSign', this.hospSign);
  250. uni.redirectTo({
  251. url: `/pages/login/login?hospSign=${uni.getStorageSync('hospSign')}`
  252. });
  253. }
  254. });
  255. },
  256. identifyEnterCode(content){
  257. let repalcedContent = content.replace(/(\r\n|\n|\r)/gm, "<br />");
  258. return repalcedContent;
  259. },
  260. feedbackFunc(){
  261. uni.navigateTo({
  262. url: '/pages/suggestionsFeedback/suggestionsFeedback'
  263. });
  264. },
  265. resetCallbackFunc(){
  266. uni.navigateTo({
  267. url: '/pages/resetInfo/resetInfo'
  268. });
  269. },
  270. resetFontSizeFunc(){
  271. uni.navigateTo({
  272. url: '/pages/changeSize/changeSize'
  273. });
  274. },
  275. viewReportHandle(){
  276. uni.navigateTo({
  277. url: '/pages/reports/reports'
  278. });
  279. },
  280. journalOk() {
  281. this.showJournal = false;
  282. this.$store.dispatch({
  283. type: 'home/commActions',
  284. payload: {
  285. key: 'hadRead',
  286. data: {
  287. versionNO: this.version,
  288. versionId: this.journalData.logId
  289. }
  290. }
  291. });
  292. },
  293. switchRole() {
  294. console.log('切换角色');
  295. uni.navigateTo({
  296. url: '/pages/role-switching/role-switching'
  297. });
  298. },
  299. showVersionInfo(){
  300. this.$store.dispatch({
  301. type: 'home/commActions',
  302. payload: {
  303. key: 'getThisVersionInfo',
  304. data: {
  305. versionNo: this.version,
  306. }
  307. }
  308. }).then(data=>{
  309. // console.log({'getThisVersionInfo':data});
  310. this.versionData = data;
  311. this.ifshowVersionInfo = true;
  312. });
  313. }
  314. },
  315. computed: {
  316. isMsgShow() {
  317. return this.totalTodo <= 0 ? false : true;
  318. }
  319. }
  320. }
  321. </script>
  322. <style lang="less">
  323. .journal {
  324. overflow: hidden;
  325. position: absolute;
  326. top: 50%;
  327. left: 50%;
  328. transform: translateX(-50%) translateY(-50%);
  329. border-radius: 15rpx;
  330. padding: 50rpx;
  331. padding-bottom: 75rpx;
  332. width: 562.5rpx;
  333. // height: 625rpx;
  334. font-size: 22.5rpx;
  335. line-height: 35rpx;
  336. background: #FFFFFF;
  337. .journal-title {
  338. display: flex;
  339. flex-direction: column;
  340. text {
  341. font-size: 35rpx;
  342. line-height: 52.5rpx;
  343. &:last-child {
  344. font-size: 22.5rpx;
  345. line-height: 33.75rpx;
  346. color: #666E80;
  347. }
  348. }
  349. }
  350. .journal-content {
  351. margin: 25rpx 0;
  352. max-height: 332.5rpx;
  353. .journal-content-inner {
  354. width: 462.5rpx;
  355. font-size: 22.5rpx;
  356. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  357. font-weight: 400;
  358. color: #292C33;
  359. line-height: 35rpx;
  360. word-wrap:break-word;
  361. }
  362. }
  363. .journal-ok {
  364. position: fixed;
  365. left: 0;
  366. bottom: 0;
  367. border-radius: 0;
  368. border: 0;
  369. width: 100%;
  370. height: 75rpx;
  371. line-height: 75rpx;
  372. font-size: 22.5rpx;
  373. color: #fff;
  374. background-color: #3377FF;
  375. }
  376. }
  377. .home-page {
  378. height: 100%;
  379. .content-info {
  380. height: 700.25rpx;
  381. background-color: #FFFFFF;
  382. .top-box {
  383. position: relative;
  384. height: 350rpx;
  385. .bgpic {
  386. width: 750rpx;
  387. height: 350rpx;
  388. }
  389. .hosname {
  390. font-size: 45rpx;
  391. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  392. font-weight: 400;
  393. color: #FFFFFF;
  394. position: absolute;
  395. left: 50rpx;
  396. top: 92.5rpx;
  397. }
  398. }
  399. .info-box {
  400. width: 700rpx;
  401. height: 250rpx;
  402. border-radius: 15rpx;
  403. background-color: #FFFFFF;
  404. position: absolute;
  405. left: 25rpx;
  406. right: 25rpx;
  407. top: 226.25rpx;
  408. box-shadow: 0px 10px 30px 0px rgba(0, 13, 51, 0.1);
  409. .head {
  410. margin-left: 37.5rpx;
  411. margin-top: 68.75rpx;
  412. .name {
  413. font-size: 35rpx;
  414. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  415. font-weight: 400;
  416. color: #17181A;
  417. }
  418. .gender {
  419. width: 25rpx;
  420. height: 25rpx;
  421. background: linear-gradient(135deg, #4DA6FF 0%, #4D88FF 100%);
  422. border-radius: 6.25rpx;
  423. margin-left: 15rpx;
  424. }
  425. .username {
  426. font-size: 25rpx;
  427. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  428. font-weight: 400;
  429. color: #17181A;
  430. margin-left: 55rpx;
  431. }
  432. }
  433. .row {
  434. margin-left: 37.5rpx;
  435. margin-top: 62.5rpx;
  436. .col {
  437. display: inline-block;
  438. margin-right: 25rpx;
  439. }
  440. }
  441. .text {
  442. width: 50rpx;
  443. font-size: 22.5rpx;
  444. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  445. font-weight: 400;
  446. color: #666E80;
  447. // overflow: hidden;
  448. // text-overflow: ellipsis;
  449. // white-space: nowrap;
  450. }
  451. }
  452. .avatar-box {
  453. width: 125rpx;
  454. height: 125rpx;
  455. position: absolute;
  456. right: 75rpx;
  457. top: 187.5rpx;
  458. background: #FFFFFF;
  459. z-index: 2;
  460. border-radius: 50%
  461. }
  462. .avatar {
  463. width: 112.5rpx;
  464. height: 112.5rpx;
  465. margin-left: 6.25rpx;
  466. margin-top: 6.25rpx;
  467. border-radius: 50%
  468. }
  469. .function-box {
  470. position: absolute;
  471. top: 496.25rpx;
  472. width: 750rpx;
  473. background-color: #FFFFFF;
  474. .role-switch {
  475. height: 100rpx;
  476. width: 725rpx;
  477. margin-left: 25rpx;
  478. background: #FFFFFF;
  479. border-bottom: 0.62rpx solid #DADEE6;
  480. .msg-box {
  481. width: 50rpx;
  482. height: 30rpx;
  483. float: left;
  484. margin-top: 35rpx;
  485. margin-left: 15rpx;
  486. position: relative;
  487. background: #FF4060;
  488. border-radius: 24px;
  489. text-align: center;
  490. .msg-text {
  491. font-size: 17.5rpx;
  492. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  493. font-weight: 400;
  494. color: #FFFFFF;
  495. line-height: 30rpx;
  496. }
  497. }
  498. .role {
  499. font-size: 22.5rpx;
  500. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  501. font-weight: 400;
  502. color: #7A8599;
  503. line-height: 100rpx;
  504. float: right;
  505. margin-right: 25rpx;
  506. }
  507. }
  508. // .sys-setting{
  509. // height: 100rpx;
  510. // width: 725rpx;
  511. // margin-left: 25rpx;
  512. // background: #FFFFFF;
  513. // }
  514. .suggestions-feedback-btn {
  515. height: 100rpx;
  516. width: 725rpx;
  517. margin-left: 25rpx;
  518. background: #FFFFFF;
  519. border-bottom: 0.62rpx solid #DADEE6;
  520. .func-text {
  521. }
  522. }
  523. .resetPsd-btn {
  524. height: 100rpx;
  525. width: 725rpx;
  526. margin-left: 25rpx;
  527. background: #FFFFFF;
  528. border-bottom: 0.5px solid #DADEE6;
  529. }
  530. .viewReport-btn {
  531. height: 100rpx;
  532. width: 725rpx;
  533. margin-left: 25rpx;
  534. background: #FFFFFF;
  535. }
  536. .func-text {
  537. font-size: 22.5rpx;
  538. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  539. font-weight: 500;
  540. color: #292C33;
  541. line-height: 100rpx;
  542. float: left;
  543. }
  544. .icon-more {
  545. width: 12.37rpx;
  546. height: 21.21rpx;
  547. line-height: 100rpx;
  548. float: right;
  549. margin-top: 39.37rpx;
  550. margin-right: 25rpx;
  551. }
  552. }
  553. }
  554. .logout-box {
  555. width: 750rpx;
  556. height: 100rpx;
  557. background-color: #FFFFFF;
  558. margin-top:210rpx;
  559. .logout-text {
  560. font-size: 22.5rpx;
  561. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  562. font-weight: 500;
  563. color: #292C33;
  564. line-height: 100rpx;
  565. margin-left: 330rpx;
  566. }
  567. }
  568. .copyright {
  569. position: absolute;
  570. bottom: 90rpx;
  571. left: 0;
  572. display: flex;
  573. flex-direction: column;
  574. justify-content: center;
  575. align-items: center;
  576. width: 100%;
  577. color: #666E80;
  578. }
  579. }
  580. </style>