| | |
| | | const router = Taro.useRouter(); |
| | | |
| | | Taro.useReady(async () => { |
| | | let res; |
| | | try { |
| | | res = await LocationUtils.getLocation(); |
| | | } catch (error) {} |
| | | if (isLogin.value && userStore.firstGetUserDetail) { |
| | | userStore.firstGetUserDetail = false; |
| | | if (LocationUtils.isProvinceChange(userStore.locationProvince)) { |
| | | userStore.resetState(); |
| | | } else { |
| | | userStore.getCurrentUserInfo(); |
| | | } |
| | | } |
| | | if (res?.result?.ad_info?.city && userStore.firstSetLocation) { |
| | | userStore.setLocationCity(res.result.ad_info.city, res.result.ad_info.province); |
| | | } |
| | | if (needAuth && !isLogin.value) { |
| | | Taro.navigateTo({ |
| | |
| | | <div class="home-header"> |
| | | <div class="home-searchbar-wrapper"> |
| | | <div class="city-btn-wrapper"> |
| | | <div class="city-btn" @click="goCitySelect"> |
| | | <div class="city-btn"> |
| | | <img :src="IconLocaltion" class="city-btn-icon" /> |
| | | <div class="city-btn-text">{{ locationCity }}</div> |
| | | </div> |
| | | </div> |
| | | <div class="reset-localtion">重新定位</div> |
| | | <div class="reset-localtion" @click="resetLocation">重新定位</div> |
| | | </div> |
| | | <div class="home-banner-wrapper"> |
| | | <nut-swiper :auto-play="3000"> |
| | |
| | | import HomeQueryMenuView from './HomeQueryMenuView.vue'; |
| | | import HomeQueryPositionMenuView from './HomeQueryPositionMenuView.vue'; |
| | | import IconLocaltion from '@/assets/home/icon-localtion.png'; |
| | | import { setLocationCity } from '@/utils'; |
| | | |
| | | const { locationCity } = useUser(); |
| | | |
| | |
| | | url: `${RouterPath.flexJobDetail}?id=${item.id}`, |
| | | }); |
| | | } |
| | | |
| | | async function resetLocation() { |
| | | try { |
| | | await setLocationCity(); |
| | | } catch (error) {} |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | |
| | | this.locationProvince = provinceName; |
| | | this.firstSetLocation = false; |
| | | setStorageLocationCity({ city: cityName, province: provinceName }); |
| | | if (LocationUtils.isProvinceChange(provinceName)) { |
| | | this.resetState(); |
| | | myClient.removeQueries(); |
| | | globalEventEmitter.trigger('logout/refresh'); |
| | | // myClient.invalidateQueries({ |
| | | // queryKey: ['logout/refresh'], |
| | | // }); |
| | | } |
| | | // if (LocationUtils.isProvinceChange(provinceName)) { |
| | | // this.resetState(); |
| | | // myClient.removeQueries(); |
| | | // globalEventEmitter.trigger('logout/refresh'); |
| | | // // myClient.invalidateQueries({ |
| | | // // queryKey: ['logout/refresh'], |
| | | // // }); |
| | | // } |
| | | LocationUtils.currentProvinceName = provinceName; |
| | | }, |
| | | }, |
New file |
| | |
| | | export * from './localtion'; |
New file |
| | |
| | | import { LocationUtils } from '@12333/utils'; |
| | | import { useUserStoreWithOut } from '@/stores/modules/user'; |
| | | |
| | | export async function setLocationCity() { |
| | | try { |
| | | let res = await LocationUtils.getLocation(); |
| | | if (res?.result?.ad_info?.city) { |
| | | const userStore = useUserStoreWithOut(); |
| | | userStore.setLocationCity(res.result.ad_info.city, res.result.ad_info.province); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | |
| | | export * from './storage'; |
| | | export * from './page'; |
| | | export * from './common'; |
| | |
| | | module.exports = { |
| | | env: { |
| | | BASE_URL: '"https://testrlywx.boleyuma.com"', |
| | | // BASE_URL: '"https://api.81812333.com"', |
| | | // BASE_URL: '"https://testrlywx.boleyuma.com"', |
| | | BASE_URL: '"https://api.81812333.com"', |
| | | BASE_URL_JX: '"https://api.jx818.com"', |
| | | |
| | | OSS_URL: '"https://waterdroptest2.oss-cn-hangzhou.aliyuncs.com/"', |
| | |
| | | import * as orderServices from '@12333/services/api/Order'; |
| | | import _ from 'lodash'; |
| | | import { trim } from '@12333/utils'; |
| | | import { MaybeRef } from 'vue'; |
| | | |
| | | export enum HomeOrderType { |
| | | Recommend = 'Recommend', |
| | | LastShelfTime = 'LastShelfTime', |
| | | } |
| | | |
| | | export function useTaskList() { |
| | | type UseTaskListOptions = { |
| | | cityName?: MaybeRef<string>; |
| | | }; |
| | | |
| | | export function useTaskList(options: UseTaskListOptions = {}) { |
| | | const { cityName = '' } = options; |
| | | |
| | | const searchValue = ref(''); |
| | | |
| | | const queryMenuState = reactive({ |
| | |
| | | }); |
| | | }, |
| | | { |
| | | queryKey: ['orderServices/getFrontOrderList', queryState, queryMenuState], |
| | | queryKey: ['orderServices/getFrontOrderList', queryState, queryMenuState, cityName], |
| | | } |
| | | ); |
| | | |
| | |
| | | const router = Taro.useRouter(); |
| | | |
| | | Taro.useReady(async () => { |
| | | let res; |
| | | try { |
| | | res = await LocationUtils.getLocation(); |
| | | } catch (error) {} |
| | | if (isLogin.value && userStore.firstGetUserDetail) { |
| | | userStore.firstGetUserDetail = false; |
| | | if (LocationUtils.isProvinceChange(userStore.locationProvince)) { |
| | | userStore.resetState(); |
| | | } else { |
| | | userStore.getCurrentUserInfo(); |
| | | } |
| | | } |
| | | if (res?.result?.ad_info?.city && userStore.firstSetLocation) { |
| | | userStore.setLocationCity(res.result.ad_info.city, res.result.ad_info.province); |
| | | } |
| | | if (needAuth && !isLogin.value) { |
| | | Taro.navigateTo({ |
| | |
| | | import { useUserStore } from '@/stores/modules/user'; |
| | | import { RectDown, Location2 } from '@nutui/icons-vue-taro'; |
| | | import Taro from '@tarojs/taro'; |
| | | import { LocationUtils, trim } from '@12333/utils'; |
| | | import { setLocationCity } from '@/utils'; |
| | | import _ from 'lodash'; |
| | | import IconLogo from '@/assets/home/icon-logo.png'; |
| | | import { TaskCard, ProTabs, ProTabPane } from '@12333/components'; |
| | |
| | | |
| | | const userStore = useUserStore(); |
| | | |
| | | const { searchValue, queryState, handleSearch, infiniteLoadingProps, queryMenuState } = |
| | | useTaskList(); |
| | | const { searchValue, queryState, handleSearch, infiniteLoadingProps, queryMenuState } = useTaskList( |
| | | { cityName: locationCity } |
| | | ); |
| | | |
| | | onMounted(async () => { |
| | | try { |
| | | await setLocationCity(); |
| | | } catch (error) {} |
| | | }); |
| | | |
| | | function goCitySelect() { |
| | | Taro.navigateTo({ |
| | |
| | | this.locationProvince = provinceName; |
| | | this.firstSetLocation = false; |
| | | setStorageLocationCity({ city: cityName, province: provinceName }); |
| | | if (LocationUtils.isProvinceChange(provinceName)) { |
| | | this.resetState(); |
| | | myClient.removeQueries(); |
| | | globalEventEmitter.trigger('logout/refresh'); |
| | | // myClient.invalidateQueries({ |
| | | // queryKey: ['logout/refresh'], |
| | | // }); |
| | | } |
| | | // if (LocationUtils.isProvinceChange(provinceName)) { |
| | | // this.resetState(); |
| | | // myClient.removeQueries(); |
| | | // globalEventEmitter.trigger('logout/refresh'); |
| | | // } |
| | | LocationUtils.currentProvinceName = provinceName; |
| | | }, |
| | | }, |
| | |
| | | <div class="city-btn-wrapper"> |
| | | <div class="city-btn"> |
| | | <img :src="IconLocaltion" class="city-btn-icon" /> |
| | | <div class="city-btn-text">{{ locationCity }}</div> |
| | | <div class="city-btn-text">当前定位:{{ locationCity }}</div> |
| | | </div> |
| | | </div> |
| | | <div class="reset-localtion">重新定位</div> |
| | | <div class="reset-localtion" @click="resetLocation">重新定位</div> |
| | | </div> |
| | | <Elevator :index-list="elevatorData" :height="'100%'" @click-item="clickItem" /> |
| | | </ContentView> |
| | |
| | | import { groupBy, sortBy } from 'lodash'; |
| | | import { useUserStore } from '@/stores/modules/user'; |
| | | import { Elevator } from '@12333/components'; |
| | | import IconLocaltion from '@/assets/home/icon-localtion.png'; |
| | | import IconLocaltion from '@/assets/task/icon-localtion.png'; |
| | | import { setLocationCity } from '@/utils'; |
| | | |
| | | defineOptions({ |
| | | name: 'citySelect', |
| | |
| | | console.log('item: ', item, getAreaByAreaCode(item.parentId).areaName); |
| | | userStore.setLocationCity(item.name, getAreaByAreaCode(item.parentId).areaName); |
| | | }; |
| | | |
| | | async function resetLocation() { |
| | | try { |
| | | await setLocationCity(); |
| | | } catch (error) {} |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | @import '@/styles/common.scss'; |
| | | |
| | | .citySelect-page-wrapper { |
| | | .home-searchbar-wrapper { |
| | | padding: 32px 0 28px; |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .city-btn-wrapper { |
| | | flex: 1; |
| | | min-width: 0; |
| | | |
| | | .city-btn { |
| | | display: flex; |
| | | align-items: center; |
| | | padding-right: 36px; |
| | | color: boleGetCssVar('text-color', 'primary'); |
| | | |
| | | .city-btn-icon { |
| | | width: 40px; |
| | | height: 40px; |
| | | } |
| | | |
| | | .city-btn-text { |
| | | @include ellipsis; |
| | | margin-left: 12px; |
| | | font-size: 30px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .reset-localtion { |
| | | font-weight: 400; |
| | | font-size: 24px; |
| | | color: boleGetCssVar('color', 'primary'); |
| | | line-height: 28px; |
| | | } |
| | | } |
| | | |
| | | .current-city { |
| | | padding: 20px 0; |
| | | color: boleGetCssVar('text-color', 'primary'); |
New file |
| | |
| | | export * from './localtion'; |
New file |
| | |
| | | import { LocationUtils } from '@12333/utils'; |
| | | import { useUserStoreWithOut } from '@/stores/modules/user'; |
| | | |
| | | export async function setLocationCity() { |
| | | try { |
| | | let res = await LocationUtils.getLocation(); |
| | | if (res?.result?.ad_info?.city) { |
| | | const userStore = useUserStoreWithOut(); |
| | | userStore.setLocationCity(res.result.ad_info.city, res.result.ad_info.province); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | |
| | | export * from './storage'; |
| | | export * from './page'; |
| | | export * from './common'; |