home.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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}}</text>
  25. </view>
  26. <view class="col">
  27. <text class="text">|</text>
  28. </view>
  29. <view class="col">
  30. <text class="text">所属查核组:{{dep}}</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.6.1',
  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. console.log({repalcedContent});
  251. return repalcedContent;
  252. },
  253. feedbackFunc(){
  254. uni.navigateTo({
  255. url: '/pages/suggestionsFeedback/suggestionsFeedback'
  256. });
  257. },
  258. resetCallbackFunc(){
  259. uni.navigateTo({
  260. url: '/pages/resetInfo/resetInfo'
  261. });
  262. },
  263. journalOk() {
  264. this.showJournal = false;
  265. this.$store.dispatch({
  266. type: 'home/commActions',
  267. payload: {
  268. key: 'hadRead',
  269. data: {
  270. versionNO: this.version,
  271. versionId: this.journalData.logId
  272. }
  273. }
  274. });
  275. },
  276. switchRole() {
  277. console.log('切换角色');
  278. uni.navigateTo({
  279. url: '/pages/role-switching/role-switching'
  280. });
  281. },
  282. showVersionInfo(){
  283. this.$store.dispatch({
  284. type: 'home/commActions',
  285. payload: {
  286. key: 'getThisVersionInfo',
  287. data: {
  288. versionNo: this.version,
  289. }
  290. }
  291. }).then(data=>{
  292. // console.log({'getThisVersionInfo':data});
  293. this.versionData = data;
  294. this.ifshowVersionInfo = true;
  295. });
  296. }
  297. },
  298. computed: {
  299. isMsgShow() {
  300. return this.totalTodo <= 0 ? false : true;
  301. }
  302. }
  303. }
  304. </script>
  305. <style lang="less">
  306. .journal {
  307. overflow: hidden;
  308. position: absolute;
  309. top: 50%;
  310. left: 50%;
  311. transform: translateX(-50%) translateY(-50%);
  312. border-radius: 15rpx;
  313. padding: 50rpx;
  314. padding-bottom: 75rpx;
  315. width: 562.5rpx;
  316. // height: 625rpx;
  317. font-size: 22.5rpx;
  318. line-height: 35rpx;
  319. background: #FFFFFF;
  320. .journal-title {
  321. display: flex;
  322. flex-direction: column;
  323. text {
  324. font-size: 35rpx;
  325. line-height: 52.5rpx;
  326. &:last-child {
  327. font-size: 22.5rpx;
  328. line-height: 33.75rpx;
  329. color: #666E80;
  330. }
  331. }
  332. }
  333. .journal-content {
  334. margin: 25rpx 0;
  335. max-height: 332.5rpx;
  336. .journal-content-inner {
  337. width: 462.5rpx;
  338. font-size: 22.5rpx;
  339. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  340. font-weight: 400;
  341. color: #292C33;
  342. line-height: 35rpx;
  343. word-wrap:break-word;
  344. }
  345. }
  346. .journal-ok {
  347. position: fixed;
  348. left: 0;
  349. bottom: 0;
  350. border-radius: 0;
  351. border: 0;
  352. width: 100%;
  353. height: 75rpx;
  354. line-height: 75rpx;
  355. font-size: 22.5rpx;
  356. color: #fff;
  357. background-color: #3377FF;
  358. }
  359. }
  360. .home-page {
  361. height: 100%;
  362. .content-info {
  363. height: 596.25rpx;
  364. background-color: #FFFFFF;
  365. .top-box {
  366. position: relative;
  367. height: 350rpx;
  368. .bgpic {
  369. width: 750rpx;
  370. height: 350rpx;
  371. }
  372. .hosname {
  373. font-size: 45rpx;
  374. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  375. font-weight: 400;
  376. color: #FFFFFF;
  377. position: absolute;
  378. left: 50rpx;
  379. top: 92.5rpx;
  380. }
  381. }
  382. .info-box {
  383. width: 700rpx;
  384. height: 250rpx;
  385. border-radius: 15rpx;
  386. background-color: #FFFFFF;
  387. position: absolute;
  388. left: 25rpx;
  389. right: 25rpx;
  390. top: 226.25rpx;
  391. box-shadow: 0px 10px 30px 0px rgba(0, 13, 51, 0.1);
  392. .head {
  393. margin-left: 37.5rpx;
  394. margin-top: 68.75rpx;
  395. .name {
  396. font-size: 35rpx;
  397. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  398. font-weight: 400;
  399. color: #17181A;
  400. }
  401. .gender {
  402. width: 25rpx;
  403. height: 25rpx;
  404. background: linear-gradient(135deg, #4DA6FF 0%, #4D88FF 100%);
  405. border-radius: 6.25rpx;
  406. margin-left: 15rpx;
  407. }
  408. .username {
  409. font-size: 25rpx;
  410. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  411. font-weight: 400;
  412. color: #17181A;
  413. margin-left: 55rpx;
  414. }
  415. }
  416. .row {
  417. margin-left: 37.5rpx;
  418. margin-top: 62.5rpx;
  419. .col {
  420. display: inline-block;
  421. margin-right: 25rpx;
  422. }
  423. }
  424. .text {
  425. font-size: 22.5rpx;
  426. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  427. font-weight: 400;
  428. color: #666E80;
  429. }
  430. }
  431. .avatar-box {
  432. width: 125rpx;
  433. height: 125rpx;
  434. position: absolute;
  435. right: 75rpx;
  436. top: 187.5rpx;
  437. background: #FFFFFF;
  438. z-index: 2;
  439. border-radius: 50%
  440. }
  441. .avatar {
  442. width: 112.5rpx;
  443. height: 112.5rpx;
  444. margin-left: 6.25rpx;
  445. margin-top: 6.25rpx;
  446. border-radius: 50%
  447. }
  448. .function-box {
  449. position: absolute;
  450. top: 496.25rpx;
  451. width: 750rpx;
  452. background-color: #FFFFFF;
  453. .role-switch {
  454. height: 100rpx;
  455. width: 725rpx;
  456. margin-left: 25rpx;
  457. background: #FFFFFF;
  458. border-bottom: 0.62rpx solid #DADEE6;
  459. .msg-box {
  460. width: 50rpx;
  461. height: 30rpx;
  462. float: left;
  463. margin-top: 35rpx;
  464. margin-left: 15rpx;
  465. position: relative;
  466. background: #FF4060;
  467. border-radius: 24px;
  468. text-align: center;
  469. .msg-text {
  470. font-size: 17.5rpx;
  471. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  472. font-weight: 400;
  473. color: #FFFFFF;
  474. line-height: 30rpx;
  475. }
  476. }
  477. .role {
  478. font-size: 22.5rpx;
  479. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  480. font-weight: 400;
  481. color: #7A8599;
  482. line-height: 100rpx;
  483. float: right;
  484. margin-right: 25rpx;
  485. }
  486. }
  487. // .sys-setting{
  488. // height: 100rpx;
  489. // width: 725rpx;
  490. // margin-left: 25rpx;
  491. // background: #FFFFFF;
  492. // }
  493. .suggestions-feedback-btn {
  494. height: 100rpx;
  495. width: 725rpx;
  496. margin-left: 25rpx;
  497. background: #FFFFFF;
  498. border-bottom: 0.62rpx solid #DADEE6;
  499. .func-text {
  500. }
  501. }
  502. .resetPsd-btn {
  503. height: 100rpx;
  504. width: 725rpx;
  505. margin-left: 25rpx;
  506. background: #FFFFFF;
  507. }
  508. .func-text {
  509. font-size: 22.5rpx;
  510. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  511. font-weight: 500;
  512. color: #292C33;
  513. line-height: 100rpx;
  514. float: left;
  515. }
  516. .icon-more {
  517. width: 12.37rpx;
  518. height: 21.21rpx;
  519. line-height: 100rpx;
  520. float: right;
  521. margin-top: 39.37rpx;
  522. margin-right: 25rpx;
  523. }
  524. }
  525. }
  526. .logout-box {
  527. width: 750rpx;
  528. height: 100rpx;
  529. background-color: #FFFFFF;
  530. margin-top:210rpx;
  531. .logout-text {
  532. font-size: 22.5rpx;
  533. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  534. font-weight: 500;
  535. color: #292C33;
  536. line-height: 100rpx;
  537. margin-left: 330rpx;
  538. }
  539. }
  540. .copyright {
  541. position: absolute;
  542. bottom: 90rpx;
  543. left: 0;
  544. display: flex;
  545. flex-direction: column;
  546. justify-content: center;
  547. align-items: center;
  548. width: 100%;
  549. color: #666E80;
  550. }
  551. }
  552. </style>