diff --git a/.env.development b/.env.development index 52470ee..0d93262 100644 --- a/.env.development +++ b/.env.development @@ -1 +1 @@ -VITE_BASE_URL = 'https://crmeb-test.shop.lihaink.cn/api' \ No newline at end of file +VITE_BASE_URL = 'https://ceshi-suyuan-breed.lihaink.cn' \ No newline at end of file diff --git a/.env.production b/.env.production index 4813c42..0d93262 100644 --- a/.env.production +++ b/.env.production @@ -1 +1 @@ -VITE_BASE_URL = '/' \ No newline at end of file +VITE_BASE_URL = 'https://ceshi-suyuan-breed.lihaink.cn' \ No newline at end of file diff --git a/dist.zip b/dist.zip new file mode 100644 index 0000000..b4980ea Binary files /dev/null and b/dist.zip differ diff --git a/src/api/api.js b/src/api/api.js new file mode 100644 index 0000000..86ac551 --- /dev/null +++ b/src/api/api.js @@ -0,0 +1,17 @@ +import axios from "@/utils/axios.js"; + +// 登录 +export const login = (data) => { + return axios.post('dataview/login', data); +} + + +// 养殖基地 +export const getfarmCount = (data) => { + return axios.get('dataview.farm/farmCount', { params: data }); +} + +// 养殖产品溯源 +export const getBreedTypeCount = (data) => { + return axios.get('dataview.farm/breedTypeCount', { params: data }); +} \ No newline at end of file diff --git a/src/api/dict.js b/src/api/dict.js new file mode 100644 index 0000000..ab21eb2 --- /dev/null +++ b/src/api/dict.js @@ -0,0 +1,19 @@ +import axios from "@/utils/axios.js"; + +//养殖基地类型 +export const farmTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'farm_type'); + +//养殖种类 +export const breedTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'breed_type'); + +//栏舍类型 +export const fenceHouseTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'fence_house_type'); + +//动物类型 +export const animalTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'animal_type'); + +//饲料类型 +export const feedingTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'feeding_type'); + +//离栏类型 +export const leaveFenceHouseTypeLists = () => axios.get('common/dict_data_lists_by_type_value?type_value='+'leave_fence_house_type'); \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index 133cd28..4d896ea 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,21 +1,64 @@ -import axios from "@/utils/axios.js"; +import axios from "axios"; + + +// 创建axios 实例 +const instacne = axios.create({ + baseURL: "https://crmeb-test.shop.lihaink.cn/api", + timeout: 30000, +}); + + +const configInstacne=(ins)=>{ + ins.interceptors.request.use( + (config) => { + // 在发送请求之前做什么 + + + + return config; + }, + (err) => { + return Promise.reject(err); + } + ); + // 响应拦截 + ins.interceptors.response.use( + (res) => { + + // if (res.data.status != 200) { + // ElMessage({ + // message: res.data.message, + // type: 'warning', + // }) + // return Promise.reject(res.data.message); + + // } + // 对响应的数据做什么 + return res.data; + }, + (err) => { + return Promise.reject(err); + } + ); + +} + +configInstacne(instacne) + + // 登录 export const login = (data) => { - return axios.post('dataview/login', data); + return instacne.post('dataview/login', data); } // 区县 export const getArea = (data) => { - return axios.get('city/get_area', { params: data }); + return instacne.get('city/get_area', { params: data }); } // 乡镇 export const getStreet = (data) => { - return axios.get('city/get_street', { params: data }); + return instacne.get('city/get_street', { params: data }); } -// 养殖基地 -export const getfarmCount = (data) => { - return axios.get('dataview.farm/farmCount ', { params: data }); -} \ No newline at end of file diff --git a/src/layout/index.vue b/src/layout/index.vue index 2d4249a..1b4abba 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -3,6 +3,17 @@ import headView from "@/components/headView.vue"; import Businesses from "@/components/Businesses.vue"; import { ref, nextTick, provide, onMounted, onUnmounted } from "vue"; import mitt from "@/utils/mitt"; +import { breedTypeLists } from "@/api/dict.js"; +import { useDictStore } from "@/store/dict.js"; + +const dictStore = useDictStore(); + +const initbreedTypeLists = ()=>{ + breedTypeLists().then(res=>{ + dictStore.setBreedTypeList(res.data); + }) +} +initbreedTypeLists(); const show = ref(true); const reload = () => { diff --git a/src/store/dict.js b/src/store/dict.js new file mode 100644 index 0000000..ed9d2fb --- /dev/null +++ b/src/store/dict.js @@ -0,0 +1,17 @@ +import { defineStore } from "pinia" +import { ref } from "vue" + +export const useDictStore = defineStore('dict', () => { + + const breedTypeList = ref([]); + + const setBreedTypeList = (data) => { + breedTypeList.value = data; + } + + + return { + breedTypeList, + setBreedTypeList + } +}) \ No newline at end of file diff --git a/src/utils/axios.js b/src/utils/axios.js index 2f0c9a4..c4a3d33 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -1,7 +1,7 @@ import axios from "axios"; const request = axios.create({ - baseURL: import.meta.env.VITE_BASE_URL, + baseURL: import.meta.env.VITE_BASE_URL + '/api', timeout: 5000 }) diff --git a/src/view/index/components/left.vue b/src/view/index/components/left.vue index 4e2f5fd..ffbca6e 100644 --- a/src/view/index/components/left.vue +++ b/src/view/index/components/left.vue @@ -1,17 +1,58 @@ @@ -207,12 +249,12 @@ onMounted(() => {
基地总数
-
{{ 50 }}个
+
{{ farmInfo.farmCount }}个
-
基地总数
-
{{ 200 }}亩
+
占地规模
+
{{ farmInfo.totalScale }}亩
{
-
+
-
品类名称: 黑山羊
-
溯源编码: 02457487544
+
品类名称: {{ item.brand }}
+
溯源编码: {{ item.sn }}