city.vue 2.9 KB

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