|
@@ -129,11 +129,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
- import { ref, computed, onMounted, provide, inject } from "vue";
|
|
|
+ import { ref, computed, onMounted, provide, inject, getCurrentInstance } from "vue";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import axios from "axios";
|
|
|
import { CloseBold } from "@element-plus/icons-vue";
|
|
|
import Geos_Info_ID from './geos_info_id.vue'; // 引入组件
|
|
|
+ let { proxy } = getCurrentInstance()
|
|
|
|
|
|
// 动态获取的地理資訊和学校数据
|
|
|
const items = ref([]); // 地理列表(父级菜单)
|
|
@@ -223,6 +224,7 @@
|
|
|
// 點擊 City 後, 取得所屬 City 的學校列表
|
|
|
const setCityActive = (index) => {
|
|
|
|
|
|
+ debugger;
|
|
|
// 設置當前選中的 City Index
|
|
|
activeIndex2.value = index;
|
|
|
|
|
@@ -243,7 +245,13 @@
|
|
|
};
|
|
|
|
|
|
const addToColumn3 = (item) => {
|
|
|
- column3Items.value.push(item);
|
|
|
+
|
|
|
+ if (!column3Items.value.includes(item)) {
|
|
|
+ column3Items.value.push(item);
|
|
|
+ ElMessage.success(`已加入接收名單`);
|
|
|
+ } else {
|
|
|
+ ElMessage.warning(`已存在接收名單中`);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const removeFromColumn3 = (index) => {
|
|
@@ -257,17 +265,29 @@
|
|
|
const requestData = { showSchool: false };
|
|
|
//const requestData = { showSchool: false, countryId: "CN" };
|
|
|
//const requestData = { showSchool: false, countryId: "TW" };
|
|
|
-
|
|
|
- //debugger;
|
|
|
+
|
|
|
try {
|
|
|
|
|
|
- //const response = await axios.post("https://localhost:5001/notice/get-geos", requestData);
|
|
|
-
|
|
|
- const apiUrl = 'https://' + new_msg_host.value + '/notice/get-geos';
|
|
|
+ const response = await proxy.$api.getGeos(requestData);
|
|
|
+ console.log(response, '发送消息返回');
|
|
|
+
|
|
|
+ if (response.state === 200) {
|
|
|
+ //ElMessage.success('消息发送成功');
|
|
|
+ // 在这里执行后续操作,确保数据已获取
|
|
|
+ const data = response.data; // 假设返回的数据在 `response.data` 中
|
|
|
+ console.log(data, '地理資訊');
|
|
|
+ // 后续逻辑处理
|
|
|
+ } else {
|
|
|
+ ElMessage.error('取得資訊失败,状态码错误');
|
|
|
+ }
|
|
|
|
|
|
- const response = await axios.post(apiUrl, requestData);
|
|
|
+ ////const response = await axios.post("https://localhost:5001/notice/get-geos", requestData);
|
|
|
+ //
|
|
|
+ //const apiUrl = 'https://' + new_msg_host.value + '/notice/get-geos';
|
|
|
+ //
|
|
|
+ //const response = await axios.post(apiUrl, requestData);
|
|
|
|
|
|
- const { state, data } = response.data;
|
|
|
+ const { state, data } = response;
|
|
|
if (state === 200) {
|
|
|
items.value = data.map((area) => ({
|
|
|
id: area.id,
|
|
@@ -289,12 +309,25 @@
|
|
|
const requestData = { showSchool: false, provinceId: provinceId };
|
|
|
//const requestData = { showSchool: false, countryId: "CN", provinceId };
|
|
|
|
|
|
- debugger;
|
|
|
-
|
|
|
+ //debugger;
|
|
|
try {
|
|
|
- const response = await axios.post("https://localhost:5001/notice/get-geos", requestData);
|
|
|
|
|
|
- const { state, data } = response.data;
|
|
|
+ const response = await proxy.$api.getGeos(requestData);
|
|
|
+ console.log(response, '发送消息返回');
|
|
|
+
|
|
|
+ if (response.state === 200) {
|
|
|
+ //ElMessage.success('消息发送成功');
|
|
|
+ // 在这里执行后续操作,确保数据已获取
|
|
|
+ const data = response.data; // 假设返回的数据在 `response.data` 中
|
|
|
+ console.log(data, '地理資訊');
|
|
|
+ // 后续逻辑处理
|
|
|
+ } else {
|
|
|
+ ElMessage.error('取得資訊失败,状态码错误');
|
|
|
+ }
|
|
|
+
|
|
|
+ //const response = await axios.post("https://localhost:5001/notice/get-geos", requestData);
|
|
|
+
|
|
|
+ const { state, data } = response;
|
|
|
|
|
|
// 成功取得資料的話,進行資料的 Mapping, 組成 City list
|
|
|
if (state === 200) {
|
|
@@ -311,10 +344,12 @@
|
|
|
ElMessage.error("网络错误,请检查后重试!");
|
|
|
}
|
|
|
};
|
|
|
- // 取得地理資訊(省)
|
|
|
+ // 取得學校資訊
|
|
|
const isLoading = ref(false); // 加载状态
|
|
|
const fetchSchoolDataByCity = async (provinceId, cityId) => {
|
|
|
|
|
|
+ debugger;
|
|
|
+
|
|
|
isLoading.value = true; // 开始加载
|
|
|
|
|
|
const requestData = { showSchool: false, countryId: "CN", provinceId, cityId };
|
|
@@ -322,8 +357,24 @@
|
|
|
//调用 fetchSchoolDataByCity 时,isLoading 置为 true
|
|
|
|
|
|
try {
|
|
|
- const response = await axios.post("https://localhost:5001/notice/get-geos", requestData);
|
|
|
- const { state, data } = response.data;
|
|
|
+
|
|
|
+ const response = await proxy.$api.getGeos(requestData);
|
|
|
+ console.log(response, '发送消息返回');
|
|
|
+
|
|
|
+ if (response.state === 200) {
|
|
|
+ //ElMessage.success('消息发送成功');
|
|
|
+ // 在这里执行后续操作,确保数据已获取
|
|
|
+ const data = response.data; // 假设返回的数据在 `response.data` 中
|
|
|
+ console.log(data, '地理資訊');
|
|
|
+ // 后续逻辑处理
|
|
|
+ } else {
|
|
|
+ ElMessage.error('取得資訊失败,状态码错误');
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //const response = await axios.post("https://localhost:5001/notice/get-geos", requestData);
|
|
|
+
|
|
|
+ const { state, data } = response;
|
|
|
|
|
|
if (state === 200) {
|
|
|
subItems.value = data.map((area) => ({
|