特易招,招聘小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.1 KiB

8 months ago
  1. <template>
  2. <view class="page">
  3. <PrivacyAgreementPoup/>
  4. <tabber select="0"/>
  5. </view>
  6. </template>
  7. <script>
  8. import PrivacyAgreementPoup from '@/components/config/PrivacyAgreementPoup.vue'
  9. import Position from '@/utils/position.js'
  10. import tabber from '@/components/base/tabbar.vue'
  11. import { mapGetters } from 'vuex'
  12. // import selectArea from '../../components/selectArea.vue';
  13. export default {
  14. components : {
  15. tabber,
  16. PrivacyAgreementPoup,
  17. },
  18. data() {
  19. return {
  20. bannerList: [
  21. {
  22. url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
  23. },
  24. {
  25. url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
  26. },
  27. {
  28. url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
  29. },
  30. ],
  31. }
  32. },
  33. computed : {
  34. ...mapGetters(['userShop']),
  35. },
  36. methods: {
  37. //显示选择地区
  38. showSelectArea() {
  39. // this.$refs.selectArea.open()
  40. },
  41. //搜索地址
  42. searchAddress() {
  43. Position.getLocation(res => {
  44. Position.selectAddress(res.longitude, res.latitude, success => {
  45. let address = this.extractProvinceAndCity(success)
  46. this.queryParams.title = address.city
  47. })
  48. })
  49. },
  50. //提取用户选择的地址信息(省市县信息)
  51. extractProvinceAndCity(res) { //提取用户选择的地址信息(省市)
  52. if (!res.address && res.name) { //用户直接选择城市的逻辑
  53. return {
  54. province: '',
  55. city: res.name
  56. };
  57. }
  58. if (res.address) { //用户选择了详细地址,要从详细地址中提取出省市县信息
  59. // 使用正则表达式匹配省市县
  60. const regex = /(?<province>[\u4e00-\u9fa5]+?省)(?<city>[\u4e00-\u9fa5]+?(?:市|自治州|盟|地区))/;
  61. const match = res.address.match(regex);
  62. if (match) { // 如果匹配成功,则返回省和市的信息
  63. return {
  64. province: match.groups.province,
  65. city: match.groups.city
  66. };
  67. }
  68. }
  69. return { //用户没选择地址就点了确定按钮
  70. province: '',
  71. city: ''
  72. }
  73. },
  74. }
  75. }
  76. </script>
  77. <style scoped lang="scss">
  78. </style>