home.vue 14 KB

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