IntServ.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="container">
  3. <view class="intServBtnBox">
  4. <view class="intServBtn" @tap="onSafeVolunteerTo">
  5. <image src="https://www.zgsafesp.cn/doc/安全志愿.png" class="intServBtnBGImg" mode="widthFix"></image>
  6. </view>
  7. <view class="intServBtn">
  8. <picker @change="bindAreaChange" :value="indexArea" :range="AreaData" range-key="areaName">
  9. <image src="https://www.zgsafesp.cn/doc/用工服务.png" class="intServBtnBGImg" mode="widthFix"></image>
  10. </picker>
  11. </view>
  12. <view class="intServBtn" @tap="onNoticeTo">
  13. <image src="https://www.zgsafesp.cn/doc/宣传学习.png" class="intServBtnBGImg" mode="widthFix"></image>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. var that
  20. export default {
  21. options: {
  22. styleIsolation: 'isolated'
  23. },
  24. data() {
  25. return {
  26. selectAllAreaData: [],
  27. AreaData: [],
  28. indexArea: -1,
  29. isVolunteer: null
  30. }
  31. },
  32. methods: {
  33. getData(){
  34. that = this;
  35. that.onGetAreaData();
  36. },
  37. init(){
  38. that.isVolunteer = uni.getStorageSync('userInfo').isVolunteer;
  39. },
  40. onGetAreaData(fun) {
  41. that.$admin.reqDirect({
  42. method: 'GET',
  43. url: '/api/v1/Snapshot/area/tree'
  44. }).then(res => {
  45. if (res && res.length > 0) {
  46. that.selectAllAreaData = res;
  47. let firstData = [];
  48. let secondData = [];
  49. res.forEach((item, index) => {
  50. if (item.id == '510300') {
  51. firstData = item.children;
  52. }
  53. });
  54. firstData.forEach((item, index) => {
  55. if (index == 0) {
  56. res.forEach((allItem, allIndex) => {
  57. if (allItem.parentId == item.id) {
  58. secondData.push(allItem)
  59. }
  60. });
  61. }
  62. });
  63. that.AreaData = firstData;
  64. }
  65. typeof fun === 'function' && fun();
  66. })
  67. },
  68. onSafeVolunteerTo(){
  69. if (!uni.getStorageSync('userInfo').openID){
  70. that.$util.msg("请先登录", function(){
  71. uni.switchTab({
  72. url: "/pages/Index/Mine"
  73. })
  74. });
  75. }else {
  76. if (that.isVolunteer){
  77. uni.navigateTo({
  78. url: '/pagesCare/SafeVolunteer/Index'
  79. });
  80. }else{
  81. that.$util.msg('很抱歉,您没有访问权限')
  82. }
  83. }
  84. },
  85. bindAreaChange(e){
  86. that.indexArea = e.detail.value;
  87. if (that.indexArea != -1){
  88. uni.navigateTo({
  89. url: '/pagesCare/Employ/Index?areaID=' + encodeURIComponent(that.AreaData[that.indexArea].id) + '&areaName=' + encodeURIComponent(that.AreaData[that.indexArea].areaName)
  90. })
  91. }else {
  92. that.$util.msg("请选择您要查看的区域");
  93. }
  94. },
  95. onNoticeTo() {
  96. uni.navigateTo({
  97. url: '/pagesCare/Notice/Index'
  98. })
  99. },
  100. }
  101. }
  102. </script>
  103. <style>
  104. .container {
  105. background-color: #fff;
  106. }
  107. .intServBtnBox{
  108. padding: 50rpx 0 20rpx;
  109. text-align: center;
  110. line-height: 1;
  111. }
  112. .intServBtn {
  113. display: inline-block;
  114. width: calc(100% - 60rpx);
  115. height: 100%;
  116. text-align: center;
  117. border-radius: 14rpx;
  118. position: relative;
  119. margin-bottom: 30rpx;
  120. }
  121. .intServBtnBGImg {
  122. width: 100%;
  123. height: 100%;
  124. }
  125. </style>