city.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="page-container" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
  3. <view class="custom-navbar">
  4. <view class="navbar-content">
  5. <view class="nav-left" @click="goBack">
  6. <u-icon name="close" color="#333" size="32"></u-icon>
  7. </view>
  8. <view class="nav-title">{{city}}</view>
  9. <view @click="goTo" class="nav-right">
  10. <image src="../../static/images/filter.svg" mode="widthFix"></image> 筛选城市
  11. </view>
  12. </view>
  13. </view>
  14. <view class="page-content">
  15. <hg-level4-address :city="city" :county="county" :street="street" @confirm="onAddressConfirm"></hg-level4-address>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import hgLevel4Address from '@/components/hg-level4-address/hgLevel4Address.vue';
  21. export default {
  22. components: {
  23. hgLevel4Address
  24. },
  25. data() {
  26. return {
  27. statusBarHeight: 0, // 状态栏高度
  28. city: '', //市
  29. county: '', //区
  30. street:''//街道
  31. };
  32. },
  33. onLoad(options) {
  34. // 获取状态栏高度
  35. let systemInfo = uni.getSystemInfoSync();
  36. this.statusBarHeight = systemInfo.statusBarHeight || 0;
  37. this.city = options&&options.city||'深圳市'
  38. this.county = options&&options.county||''
  39. this.street = options&&options.street||''
  40. },
  41. onShow() {
  42. },
  43. methods: {
  44. onAddressConfirm(selected) {
  45. console.log("选中的地址:", selected);
  46. this.city = selected[1].name
  47. this.county = selected[2].name
  48. let data = {
  49. city: this.city=='全国'||this.city=='全部'?'':this.city,
  50. county: this.county == '全部' ? '' : this.county
  51. }
  52. uni.$emit('filterCity', data)
  53. uni.navigateBack()
  54. },
  55. goBack(){
  56. uni.navigateBack()
  57. },
  58. goTo(){
  59. uni.navigateTo({
  60. url:'/package/jobIntention/city?type=search'
  61. })
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. .page-container{
  68. display: flex;
  69. flex-direction: column;
  70. height: 100vh;
  71. background: #FBFBFB;
  72. }
  73. .custom-navbar {
  74. width: 100%;
  75. height: 88rpx;
  76. box-sizing: border-box;
  77. display: flex;
  78. flex-direction: column;
  79. .navbar-content {
  80. display: flex;
  81. align-items: center;
  82. justify-content: space-between;
  83. box-sizing: border-box;
  84. padding: 0 32rpx;
  85. .nav-left, .nav-right {
  86. width: 146rpx;
  87. height: 60rpx;
  88. display: flex;
  89. align-items: center;
  90. justify-content: flex-start;
  91. padding-left: 20rpx;
  92. }
  93. .nav-right{
  94. width: fit-content;
  95. white-space: nowrap;
  96. color: #016Bf6;
  97. align-items: center;
  98. justify-content: flex-start;
  99. padding-left: 0rpx;
  100. image{
  101. width: 28rpx;
  102. display: block;
  103. margin-right:6rpx;
  104. position: relative;
  105. top:2rpx
  106. }
  107. }
  108. .nav-title {
  109. color: rgba(51, 51, 51, 1);
  110. font-family: DM Sans;
  111. font-size: 30rpx;
  112. font-weight: 700;
  113. line-height: 26px;
  114. letter-spacing: 0px;
  115. text-align: center;
  116. }
  117. }
  118. }
  119. .page-content {
  120. flex: 1;
  121. overflow: hidden;
  122. display: flex;
  123. }
  124. </style>