home.vue 14 KB

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