This commit is contained in:
parent
41669abfe3
commit
fe6b5b7c18
10
src/App.vue
10
src/App.vue
|
@ -1,4 +1,14 @@
|
|||
<script setup lang="ts">
|
||||
// 获取 URL 中的查询参数部分
|
||||
const queryString = window.location.search;
|
||||
|
||||
// 解析查询参数字符串
|
||||
const searchParams = new URLSearchParams(queryString);
|
||||
|
||||
// 读取名为 id 的参数
|
||||
const uid = searchParams.get('local') || '';
|
||||
|
||||
if(uid||!localStorage.getItem('local')) localStorage.setItem('local', uid);
|
||||
|
||||
</script>
|
||||
<template>
|
||||
|
|
12
src/api.js
12
src/api.js
|
@ -29,6 +29,11 @@ const instacneTrike = axios.create({
|
|||
timeout: 30000,
|
||||
});
|
||||
|
||||
const instacneBreed = axios.create({
|
||||
baseURL: "https://ceshi-suyuan-breed.lihaink.cn",
|
||||
timeout: 30000,
|
||||
});
|
||||
|
||||
const configInstacne=(ins)=>{
|
||||
ins.interceptors.request.use(
|
||||
(config) => {
|
||||
|
@ -68,9 +73,12 @@ configInstacne(instacne)
|
|||
configInstacne(instacnePlant)
|
||||
configInstacne(instacneTrade)
|
||||
configInstacne(instacneTrike)
|
||||
configInstacne(instacneBreed)
|
||||
|
||||
|
||||
export function sendMsg(params) {
|
||||
let uid = localStorage.getItem('local') || '';
|
||||
params.channel = uid + params.channel;
|
||||
return instacne.get('/dataviewTouchPush', { params })
|
||||
}
|
||||
|
||||
|
@ -86,6 +94,10 @@ export function apigetTownLists(params) {
|
|||
return instacneTrike.get('/api/city/get_street', { params })
|
||||
}
|
||||
|
||||
export function breedFarmCount(params) {
|
||||
return instacneBreed.get('/api/dataview.farm/farmCount', { params })
|
||||
}
|
||||
|
||||
//
|
||||
//api/dataview/merchant?mer_id=36&areaCode=510524&streetCode=510524100
|
||||
// }
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
import { defineStore } from "pinia"
|
||||
import { ref } from "vue"
|
||||
|
||||
export const useBreedStore = defineStore('app', () => {
|
||||
|
||||
const address = ref(JSON.parse(localStorage.getItem('address') || '{}'));
|
||||
if (!address.value.areaCode) {
|
||||
address.value = { areaCode: 510502, streetCode: '' };
|
||||
}
|
||||
|
||||
const setAddress = (e) => {
|
||||
address.value.areaCode = e.areaCode;
|
||||
address.value.streetCode = e.streetCode;
|
||||
localStorage.setItem('address', JSON.stringify(e));
|
||||
}
|
||||
|
||||
return {
|
||||
address,
|
||||
setAddress,
|
||||
}
|
||||
})
|
|
@ -18,17 +18,17 @@
|
|||
|
||||
<img src="/static/img/tradeScreen/FH.png" @click="router.go(-1)" class="back-btn" alt="">
|
||||
<div class="cont" v-if="flag">
|
||||
<div class="card" v-for="item in 9">
|
||||
<div class="card" v-for="(item, index) in farmList" :key="index">
|
||||
<div class="card-tit">
|
||||
究极公司
|
||||
{{ item.farm_name }}
|
||||
</div>
|
||||
<div class="card-cotnet">
|
||||
<div>商户姓名: 为对方</div>
|
||||
<div>商户姓名: {{ item.master }}</div>
|
||||
<div class="login">查看详情</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<areaChose v-else></areaChose>
|
||||
<areaChose v-else channel="user-breed-datav" @handTown="handTown"></areaChose>
|
||||
<div class="area" @click="flag = !flag">
|
||||
<div class="area-top">
|
||||
<div class="town">江陽區</div>
|
||||
|
@ -43,9 +43,15 @@ import { sendMsg } from "@/api.js"
|
|||
import axios from "axios"
|
||||
import { vehicleListApi } from "@/api.js"
|
||||
import areaChose from "@/view/components/areaChose.vue"
|
||||
import { useBreedStore } from "@/store/breed.js"
|
||||
import { breedFarmCount } from "@/api.js";
|
||||
import {useRouter} from "vue-router"
|
||||
const router = useRouter()
|
||||
|
||||
const nowPages = ref('index');
|
||||
const flag = ref(true)
|
||||
const flag = ref(true);
|
||||
|
||||
const appStore = useBreedStore();
|
||||
|
||||
// 镇列表
|
||||
const options = [
|
||||
|
@ -96,13 +102,22 @@ const changeArea = (e) => {
|
|||
}
|
||||
|
||||
const changeTown = (e) => {
|
||||
console.log(e)
|
||||
townOptions.forEach(item => {
|
||||
if (item.value == e) {
|
||||
sendFn('choseTown', { name: item.label })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const farmList = ref([]);
|
||||
const handTown = (a, s)=>{
|
||||
breedFarmCount({
|
||||
areaCode: a,
|
||||
streetCode: s
|
||||
}).then(res=>{
|
||||
farmList.value = res.data.farmList || [];
|
||||
flag.value = true;
|
||||
})
|
||||
}
|
||||
|
||||
const getTownList = () => {
|
||||
|
|
Loading…
Reference in New Issue