IntServ.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. // that.isVolunteer = true;
  40. },
  41. onGetAreaData(fun) {
  42. that.$admin.reqDirect({
  43. method: 'GET',
  44. url: '/api/v1/Snapshot/area/tree'
  45. }).then(res => {
  46. if (res && res.length > 0) {
  47. that.selectAllAreaData = res;
  48. let firstData = [];
  49. let secondData = [];
  50. res.forEach((item, index) => {
  51. if (item.id == '510300') {
  52. firstData = item.children;
  53. }
  54. });
  55. firstData.forEach((item, index) => {
  56. if (index == 0) {
  57. res.forEach((allItem, allIndex) => {
  58. if (allItem.parentId == item.id) {
  59. secondData.push(allItem)
  60. }
  61. });
  62. }
  63. });
  64. that.AreaData = firstData;
  65. }
  66. typeof fun === 'function' && fun();
  67. })
  68. },
  69. onSafeVolunteerTo(){
  70. if (!uni.getStorageSync('userInfo').openID){
  71. that.$util.msg("请先登录", function(){
  72. uni.switchTab({
  73. url: "/pages/Index/Mine"
  74. })
  75. });
  76. }else {
  77. if (that.isVolunteer){
  78. uni.navigateTo({
  79. url: '/pagesBase/SafeVolunteer/Index'
  80. });
  81. }else{
  82. that.$util.msg('很抱歉,您没有访问权限')
  83. }
  84. }
  85. },
  86. bindAreaChange(e){
  87. that.indexArea = e.detail.value;
  88. if (that.indexArea != -1){
  89. uni.navigateTo({
  90. url: '/pagesBase/Employ/Index?areaID=' + encodeURIComponent(that.AreaData[that.indexArea].id) + '&areaName=' + encodeURIComponent(that.AreaData[that.indexArea].areaName)
  91. })
  92. }else {
  93. that.$util.msg("请选择您要查看的区域");
  94. }
  95. },
  96. onNoticeTo() {
  97. uni.navigateTo({
  98. url: '/pagesBase/Notice/Index'
  99. })
  100. },
  101. }
  102. }
  103. </script>
  104. <style>
  105. .container {
  106. background-color: #fff;
  107. }
  108. .intServBtnBox{
  109. padding: 50rpx 0 20rpx;
  110. text-align: center;
  111. line-height: 1;
  112. }
  113. .intServBtn {
  114. display: inline-block;
  115. width: calc(100% - 60rpx);
  116. height: 100%;
  117. text-align: center;
  118. border-radius: 14rpx;
  119. position: relative;
  120. margin-bottom: 30rpx;
  121. }
  122. .intServBtnBGImg {
  123. width: 100%;
  124. height: 100%;
  125. }
  126. </style>