Commit 6dda009e authored by 石建新(贵阳日报)'s avatar 石建新(贵阳日报)
parents 7974e8e0 56dc57e2
......@@ -5,6 +5,8 @@ export const getUploadToken = params => instance.post("/common/file/getUploadTok
export const getDictDataApi = params => instance.post("/common/dict/getDictData", params);
// 获取省市区树状数据
export const getTreeListApi = params => instance.postForm("/dict/dictProvinceCityDistrict/getTreeList", params);
// 懒加载省市区(province,city,district,street)
export const getAreaListApi = ({ type, code }) => instance.post(`dict/area/list/${type}/${code}`);
// 获取岗位列表
export const dictJobTypeApi = params => instance.post("/dict/dictJobType/getTree", params);
// 获取岗位列表类型(1职位,2政策,3动态)
......
......@@ -12,15 +12,16 @@
<wd-col-picker
v-model="cityValue"
:columns="cityOpstion"
style="width: 100%;"
style="width: 100%"
value-key="code"
label-key="name"
:column-change="columnChangeCity"
@confirm="handleConfirmCity"
use-default-slot
>
<p :class="{ placeholder: !cityText }" class="text-single" style="width: 100%;">{{ cityText || "请选择公司所在地" }}</p>
<p :class="{ placeholder: !cityText }" class="text-single" style="width: 100%">
{{ cityText || "请选择公司所在地" }}
</p>
</wd-col-picker>
<view class="arrow"></view>
</view>
......@@ -42,37 +43,62 @@
<script setup>
import { ref } from "vue";
import AddressSelect from "@/components/form/address-select.vue";
import { getTreeListApi } from "@/api/common";
import { getTreeListApi, getAreaListApi } from "@/api/common";
import { useReleasePostionStore } from "./store";
import town from "@/assets/town.json";
/* tab */
const pinias = useReleasePostionStore();
const showTab = ref(true);
import { validateForm } from "@/utils/utils";
// 地区选择
getAreaListApi({ type: "street", code: "520112" }).then(res => {
console.log(res);
});
// 地区接口地址
const keys = ["district", "street"];
/* 获取省市区 */
const cityOpstion = ref([]);
const cityValue = ref([]);
const cityText = ref("");
let citySelectedItems = [];
getTreeListApi({ provinceName: "贵州省" }).then(res => {
getAreaListApi({ type: "city", code: "5201" }).then(res => {
cityOpstion.value.push(res.data);
});
const columnChangeCity = ({ selectedItem, resolve, index, finish }) => {
console.log(selectedItem.code);
console.log(index);
const type = keys[index];
if (type) {
getAreaListApi({ type, code: selectedItem.code }).then(res => {
resolve(res.data);
});
} else {
finish();
}
};
/* getTreeListApi({ provinceName: "贵州省" }).then(res => {
cityOpstion.value.push(res.data[0].children);
});
const columnChangeCity = ({ selectedItem, resolve, finish }) => {
console.log(selectedItem);
if (selectedItem.children) {
console.log(selectedItem.children);
resolve(selectedItem.children);
} else {
// 选择街道
// 加载街道
if (!town[selectedItem.code]) {
console.log("code:", selectedItem.code, "名字:", selectedItem.name);
}
if (selectedItem.children === null && town[selectedItem.code]) {
if (!town[selectedItem.code]) {
console.log("code:", selectedItem.code, "名字:", selectedItem.name);
}
resolve(town[selectedItem.code].map((v, i) => ({ ...v, code: i })));
} else {
finish();
}
}
};
}; */
const handleConfirmCity = ({ selectedItems }) => {
cityText.value = selectedItems.map(v => v.name || "").join("-");
citySelectedItems = selectedItems;
......
import axios from "axios";
import { getToken, removeToken } from "@/utils/token";
const baseURL = "https://lygsh-api.wjzpgz.com/";
// const baseURL = "http://192.168.11.48:8080/";
// const baseURL = "https://lygsh-api.wjzpgz.com/";
const baseURL = "http://192.168.11.48:8080/";
// 创建一个 axios 实例
const instance = axios.create({
baseURL, // 设置基础 URL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment