application.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view class="container" :style="{height:computeHeight}">
  3. <up-navbar class="u-navbar-box" title="首页" placeholder bgColor="transparent" leftIcon=''
  4. :title-style="{fontWeight:'bold'}">
  5. </up-navbar>
  6. <!-- header -->
  7. <view class="flex-row justify-between"
  8. style="width: 676rpx; height: 342rpx;padding-left: 48rpx;padding-right: 26rpx;">
  9. <view class="flex-column font-xxl" style="margin-top: 46rpx;">
  10. <text class="text-black3 font-weight-bolder">特困户系统</text>
  11. <view class="index-tag flex-row align-center justify-center">
  12. <text class="font text-white font-weight-bolder" style="margin-right: 12rpx;">便民服务</text>
  13. </view>
  14. </view>
  15. <view style="width: 284rpx;height: 342rpx;">
  16. <image style="width: 100%;height: 100%;" src="@/static/images/index-computer.png" mode="aspectFill">
  17. </image>
  18. </view>
  19. </view>
  20. <!--入口 -->
  21. <view class="px-32" style="margin-top: -60rpx;" @click="handleEnterClick">
  22. <view class="position-relative flex-row align-center justify-between"
  23. style="width: 100%;height: 148rpx;border-radius: 20rpx;background-color: rgba(228, 240, 255, 0.8);">
  24. <image style="width: 100%;height: 100%;" src="@/static/images/index-center-bg.png" mode="aspectFill">
  25. </image>
  26. <view class="position-absolute top-0 left-0 flex-row align-center justify-between"
  27. style="height: 100%;width: 100%;">
  28. <view class="flex-row align-center" style="margin-left: 28rpx;">
  29. <image style="width: 66rpx;height: 66rpx;" src="@/static/images/index-enter-logo.png"
  30. mode="aspectFill"></image>
  31. <view class="flex-column ml-24">
  32. <text class="font-md" style="color: #4A90C6;">{{computeHandleDesc}}</text>
  33. <view class="bg-white flex-row align-center justify-center"
  34. style="width: 208rpx;height: 40rpx;border-radius: 20rpx;margin-top: 18rpx;">
  35. <text style="color: #4A90C6;font-size: 22rpx;">一键快速处理</text>
  36. </view>
  37. </view>
  38. </view>
  39. <image src="/static/images/index-enter-arrow.png"
  40. style="width: 32rpx;height: 32rpx;margin-right: 52rpx;" mode="aspectFill"></image>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. getUserInfoUrl,
  49. getMsgCountUrl
  50. } from '@/common/config/api.js'
  51. export default {
  52. data() {
  53. return {
  54. }
  55. },
  56. onLoad() {
  57. // 获取用户信息
  58. this.getUserInfo();
  59. },
  60. onShow() {
  61. this.getMsgCount();
  62. },
  63. computed: {
  64. computeHeight() {
  65. return uni.$u.sys().windowHeight + 'px'
  66. },
  67. computeHandleDesc() {
  68. if (!this.vuex_user.roles) {
  69. return '请先登录'
  70. }
  71. // 民政所
  72. if (this.vuex_user.roles.includes('village')) {
  73. return '护理申请'
  74. }
  75. if (this.vuex_user.roles.includes('area')) {
  76. return '护理审核'
  77. }
  78. if (this.vuex_user.roles.includes('company')) {
  79. return '护理指派'
  80. }
  81. if (this.vuex_user.roles.includes('nurse')) {
  82. return '护理打卡'
  83. }
  84. }
  85. },
  86. methods: {
  87. getUserInfo() {
  88. getUserInfoUrl()
  89. .then(res => {
  90. console.log('用户信息', res);
  91. let user = {
  92. id: res.user.userId,
  93. avatar: res.user.avatar,
  94. nickName: res.user.nickName,
  95. phonenumber: res.user.phonenumber,
  96. roles: res.roles
  97. }
  98. this.$u.vuex('vuex_user', user);
  99. })
  100. .catch(err => {
  101. console.log('err', err);
  102. })
  103. },
  104. // 获取未读消息数量
  105. getMsgCount() {
  106. console.log(this.vuex_user.id);
  107. getMsgCountUrl({
  108. params: {
  109. pageNum: 1,
  110. pageSize: 1,
  111. userId: this.vuex_user.id,
  112. status: 0
  113. },
  114. custom: {
  115. catch: true
  116. }
  117. })
  118. .then(res => {
  119. console.log('未读消息数', res);
  120. if (res.code === 200) {
  121. const count = String(res.total);
  122. if (count > 0) {
  123. uni.setTabBarBadge({
  124. index: 1,
  125. text: count > 99 ? '99+' : count
  126. })
  127. } else {
  128. uni.removeTabBarBadge({
  129. index: 1
  130. })
  131. }
  132. } else {
  133. uni.removeTabBarBadge({
  134. index: 1
  135. })
  136. }
  137. })
  138. .catch(err => {
  139. console.log(err);
  140. })
  141. },
  142. // 点击预约
  143. handleEnterClick() {
  144. // 民政所
  145. if (this.vuex_user.roles.includes('village')) {
  146. return uni.navigateTo({
  147. url: '/pages/subpack/pages/apply/apply'
  148. })
  149. }
  150. // 民政局
  151. if (this.vuex_user.roles.includes('area')) {
  152. return uni.navigateTo({
  153. url: '/pages/subpack/pages/application/list'
  154. })
  155. }
  156. // 护理公司
  157. if (this.vuex_user.roles.includes('company')) {
  158. return uni.navigateTo({
  159. url: '/pages/subpack/pages/application/list'
  160. })
  161. }
  162. // 护理人员
  163. if (this.vuex_user.roles.includes('nurse')) {
  164. return uni.navigateTo({
  165. url: '/pages/subpack/pages/application/list'
  166. })
  167. }
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .u-navbar-box {
  174. background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
  175. }
  176. .container {
  177. // background-image: url('@/static/images/index-bg.png');
  178. // background-size: cover;
  179. // background-position: center;
  180. .index-tag {
  181. width: 164rpx;
  182. height: 58rpx;
  183. margin-top: 38rpx;
  184. background-image: url('@/static/images/index-tag-bg.png');
  185. background-size: cover;
  186. background-position: center;
  187. }
  188. }
  189. </style>