application.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. <!--入口 -->
  45. <view v-if="vuex_user.roles.includes('company')" class="px-32" style="margin-top: 40rpx;" @click="goApply">
  46. <view class="position-relative flex-row align-center justify-between"
  47. style="width: 100%;height: 148rpx;border-radius: 20rpx;background-color: rgba(228, 240, 255, 0.8);">
  48. <image style="width: 100%;height: 100%;" src="@/static/images/index-center-bg.png" mode="aspectFill">
  49. </image>
  50. <view class="position-absolute top-0 left-0 flex-row align-center justify-between"
  51. style="height: 100%;width: 100%;">
  52. <view class="flex-row align-center" style="margin-left: 28rpx;">
  53. <image style="width: 66rpx;height: 66rpx;" src="@/static/images/index-enter-logo.png"
  54. mode="aspectFill"></image>
  55. <view class="flex-column ml-24">
  56. <text class="font-md" style="color: #4A90C6;">护理申请</text>
  57. <view class="bg-white flex-row align-center justify-center"
  58. style="width: 208rpx;height: 40rpx;border-radius: 20rpx;margin-top: 18rpx;">
  59. <text style="color: #4A90C6;font-size: 22rpx;">一键快速处理</text>
  60. </view>
  61. </view>
  62. </view>
  63. <image src="/static/images/index-enter-arrow.png"
  64. style="width: 32rpx;height: 32rpx;margin-right: 52rpx;" mode="aspectFill"></image>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. getUserInfoUrl,
  73. getMsgCountUrl
  74. } from '@/common/config/api.js'
  75. import {
  76. getDict
  77. } from '@/common/status/index.js'
  78. import {
  79. getCareInfo
  80. } from '@/common/config/application-api.js'
  81. export default {
  82. data() {
  83. return {
  84. }
  85. },
  86. onLoad() {
  87. // 获取用户信息
  88. this.getUserInfo();
  89. },
  90. onShow() {
  91. this.getMsgCount();
  92. },
  93. computed: {
  94. computeHeight() {
  95. return uni.$u.sys().windowHeight + 'px'
  96. },
  97. computeHandleDesc() {
  98. if (!this.vuex_user.roles) {
  99. return '请先登录'
  100. }
  101. // 民政所
  102. if (this.vuex_user.roles.includes('village')) {
  103. return '护理初审'
  104. }
  105. if (this.vuex_user.roles.includes('area')) {
  106. return '护理审核'
  107. }
  108. // 护理公司
  109. if (this.vuex_user.roles.includes('company')) {
  110. return '护理指派'
  111. }
  112. if (this.vuex_user.roles.includes('nurse')) {
  113. return '护理打卡'
  114. }
  115. }
  116. },
  117. methods: {
  118. goApply() {
  119. return uni.navigateTo({
  120. url: '/pages/subpack/pages/apply/apply'
  121. })
  122. },
  123. getUserInfo() {
  124. getUserInfoUrl()
  125. .then(res => {
  126. console.log('用户信息', res);
  127. let user = {
  128. id: res.user.userId,
  129. avatar: res.user.avatar,
  130. nickName: res.user.nickName,
  131. phonenumber: res.user.phonenumber,
  132. roles: res.roles
  133. }
  134. this.$u.vuex('vuex_user', user);
  135. })
  136. .catch(err => {
  137. console.log('err', err);
  138. })
  139. },
  140. // 获取未读消息数量
  141. getMsgCount() {
  142. console.log(this.vuex_user.id);
  143. getMsgCountUrl({
  144. params: {
  145. pageNum: 1,
  146. pageSize: 1,
  147. userId: this.vuex_user.id,
  148. status: 0
  149. },
  150. custom: {
  151. catch: true
  152. }
  153. })
  154. .then(res => {
  155. console.log('未读消息数', res);
  156. if (res.code === 200) {
  157. const count = String(res.total);
  158. if (count > 0) {
  159. uni.setTabBarBadge({
  160. index: 1,
  161. text: count > 99 ? '99+' : count
  162. })
  163. } else {
  164. uni.removeTabBarBadge({
  165. index: 1
  166. })
  167. }
  168. } else {
  169. uni.removeTabBarBadge({
  170. index: 1
  171. })
  172. }
  173. })
  174. .catch(err => {
  175. console.log(err);
  176. })
  177. },
  178. // 点击预约
  179. handleEnterClick() {
  180. // 街道
  181. if (this.vuex_user.roles.includes('village')) {
  182. return uni.navigateTo({
  183. url: '/pages/subpack/pages/application/list'
  184. })
  185. }
  186. // 民政局
  187. if (this.vuex_user.roles.includes('area')) {
  188. return uni.navigateTo({
  189. url: '/pages/subpack/pages/application/list'
  190. })
  191. }
  192. // 护理公司
  193. if (this.vuex_user.roles.includes('company')) {
  194. return uni.navigateTo({
  195. url: '/pages/subpack/pages/application/list'
  196. })
  197. }
  198. // 护理人员
  199. if (this.vuex_user.roles.includes('nurse')) {
  200. return uni.navigateTo({
  201. url: '/pages/subpack/pages/application/list'
  202. })
  203. }
  204. }
  205. }
  206. }
  207. </script>
  208. <style lang="scss" scoped>
  209. .u-navbar-box {
  210. background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
  211. }
  212. .container {
  213. // background-image: url('@/static/images/index-bg.png');
  214. // background-size: cover;
  215. // background-position: center;
  216. .index-tag {
  217. width: 164rpx;
  218. height: 58rpx;
  219. margin-top: 38rpx;
  220. background-image: url('@/static/images/index-tag-bg.png');
  221. background-size: cover;
  222. background-position: center;
  223. }
  224. }
  225. </style>