发布项目下拉搜索
This commit is contained in:
@@ -26,26 +26,21 @@
|
||||
<div class="info-item flexacenter">
|
||||
<div class="info-name">院校</div>
|
||||
<div class="flex1">
|
||||
<el-autocomplete v-model="info.school" :fetch-suggestions="querySchoolSearch" clearable class="inline-input w-50" placeholder="输入关键词,选择院校" @select="handleSchoolSelect" :trigger-on-focus="false">
|
||||
<!-- <template #suffix>
|
||||
<img class="arrows-icon" :class="{ 'spin': isSchoolSpin }" src="@/assets/img/arrow-black.svg" />
|
||||
</template> -->
|
||||
</el-autocomplete>
|
||||
<el-autocomplete v-model="info.school" :fetch-suggestions="querySchoolSearch" clearable class="inline-input w-50" placeholder="输入关键词,选择院校" @select="handleSchoolSelect" :trigger-on-focus="false"></el-autocomplete>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-item flexacenter">
|
||||
<div class="info-name">专业</div>
|
||||
<div class="flex1">
|
||||
<el-autocomplete v-model="info.profession" :fetch-suggestions="queryMajorSearch" clearable class="inline-input w-50" placeholder="输入关键词,选择专业" @select="handleMajorSelect" :trigger-on-focus="false">
|
||||
<!-- <template #suffix>
|
||||
<img class="arrows-icon" :class="{ 'spin': isMajorSpin }" src="@/assets/img/arrow-black.svg" />
|
||||
</template> -->
|
||||
</el-autocomplete>
|
||||
<el-autocomplete v-model="info.profession" :fetch-suggestions="queryMajorSearch" clearable class="inline-input w-50" placeholder="输入关键词,选择专业" @select="handleMajorSelect" :trigger-on-focus="false"></el-autocomplete>
|
||||
</div>
|
||||
</div>
|
||||
<div class="info-item flexacenter">
|
||||
<div class="info-name">项目</div>
|
||||
<el-input class="flex1 input" placeholder="请输入" v-model="info.project"></el-input>
|
||||
<div class="flex1">
|
||||
<el-autocomplete v-model="info.project" :fetch-suggestions="queryProjectSearch" clearable class="inline-input w-50" placeholder="输入关键词,选择项目" :trigger-on-focus="false"></el-autocomplete>
|
||||
</div>
|
||||
<!-- <el-input class="flex1 input" placeholder="请输入" v-model="info.project"></el-input> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -112,23 +107,23 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from "element-plus"
|
||||
import zhCn from "element-plus/dist/locale/zh-cn.mjs"
|
||||
const router = useRouter()
|
||||
useHead({ script: [{ src: "https://app.gter.net/bottom?tpl=footer,popupnotification", body: true }] })
|
||||
import { ElMessage } from "element-plus";
|
||||
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
|
||||
const router = useRouter();
|
||||
useHead({ script: [{ src: "https://app.gter.net/bottom?tpl=footer,popupnotification", body: true }] });
|
||||
|
||||
const setDisabled = time => {
|
||||
return time.getTime() > Date.now() // 可选历史天、可选当前天、不可选未来天
|
||||
}
|
||||
const setDisabled = (time) => {
|
||||
return time.getTime() > Date.now(); // 可选历史天、可选当前天、不可选未来天
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getInit()
|
||||
})
|
||||
getInit();
|
||||
});
|
||||
|
||||
onBeforeMount(() => {
|
||||
clearBottom()
|
||||
clearBottom();
|
||||
// clearTop()
|
||||
})
|
||||
});
|
||||
|
||||
// let isSchoolSpin = ref(false) // 院校左边箭头旋转
|
||||
// let isMajorSpin = ref(false) // 专业左边箭头旋转
|
||||
@@ -137,68 +132,68 @@ onBeforeMount(() => {
|
||||
// const MajorSearchBlur = () => (isMajorSpin.value = false)
|
||||
|
||||
// 清除底部的次数
|
||||
let clearBottomCount = 0
|
||||
let clearBottomCount = 0;
|
||||
|
||||
// 清除 底部
|
||||
const clearBottom = () => {
|
||||
const indexFooter = document.querySelector("section.index-footer")
|
||||
const indexFooter = document.querySelector("section.index-footer");
|
||||
if (!indexFooter) {
|
||||
clearBottomCount++
|
||||
setTimeout(() => clearBottom(), 50)
|
||||
return
|
||||
clearBottomCount++;
|
||||
setTimeout(() => clearBottom(), 50);
|
||||
return;
|
||||
}
|
||||
if (clearBottomCount == 15) return
|
||||
indexFooter.style.display = "none"
|
||||
}
|
||||
if (clearBottomCount == 15) return;
|
||||
indexFooter.style.display = "none";
|
||||
};
|
||||
|
||||
// 清除顶部的次数
|
||||
let clearTopCount = 0
|
||||
let clearTopCount = 0;
|
||||
|
||||
// 清除 底部
|
||||
const clearTop = () => {
|
||||
const indexHeader = document.querySelector("header.page-header")
|
||||
const indexHeader = document.querySelector("header.page-header");
|
||||
if (!indexHeader) {
|
||||
clearTopCount++
|
||||
setTimeout(() => clearTop(), 50)
|
||||
return
|
||||
clearTopCount++;
|
||||
setTimeout(() => clearTop(), 50);
|
||||
return;
|
||||
}
|
||||
if (clearTopCount == 5) return
|
||||
if (clearTopCount == 5) return;
|
||||
|
||||
indexHeader.style.display = "none"
|
||||
}
|
||||
indexHeader.style.display = "none";
|
||||
};
|
||||
|
||||
let typetype = ref("")
|
||||
let token = ""
|
||||
let typetype = ref("");
|
||||
let token = "";
|
||||
const getInit = () => {
|
||||
publishInitHttp().then(res => {
|
||||
publishInitHttp().then((res) => {
|
||||
if (res.code != 200) {
|
||||
ElMessage.error(res.message)
|
||||
return
|
||||
ElMessage.error(res.message);
|
||||
return;
|
||||
}
|
||||
const data = res.data
|
||||
token = data["token"]
|
||||
let interviewtime = data["info"]["interviewtime"] || 0
|
||||
if (interviewtime) data["info"]["interviewtime"] = handleDate(interviewtime)
|
||||
const data = res.data;
|
||||
token = data["token"];
|
||||
let interviewtime = data["info"]["interviewtime"] || 0;
|
||||
if (interviewtime) data["info"]["interviewtime"] = handleDate(interviewtime);
|
||||
|
||||
info.value = { ...data["info"] }
|
||||
})
|
||||
}
|
||||
info.value = { ...data["info"] };
|
||||
});
|
||||
};
|
||||
|
||||
// 处理初始化 面试时间的 时间戳格式
|
||||
const handleDate = timestamp => {
|
||||
const handleDate = (timestamp) => {
|
||||
// 使用Date对象将时间戳转换为日期对象
|
||||
var date = new Date(timestamp * 1000)
|
||||
var date = new Date(timestamp * 1000);
|
||||
|
||||
// 获取年份、月份和日期
|
||||
var year = date.getFullYear()
|
||||
var month = ("0" + (date.getMonth() + 1)).slice(-2) // 月份从0开始,需要加1并补0
|
||||
var day = ("0" + date.getDate()).slice(-2) // 获取日期并补0
|
||||
var year = date.getFullYear();
|
||||
var month = ("0" + (date.getMonth() + 1)).slice(-2); // 月份从0开始,需要加1并补0
|
||||
var day = ("0" + date.getDate()).slice(-2); // 获取日期并补0
|
||||
|
||||
// 拼接为yyyy-mm-dd格式的日期字符串
|
||||
var formattedDate = year + "-" + month + "-" + day
|
||||
var formattedDate = year + "-" + month + "-" + day;
|
||||
|
||||
return formattedDate
|
||||
}
|
||||
return formattedDate;
|
||||
};
|
||||
|
||||
let info = ref({
|
||||
school: "", // 学校
|
||||
@@ -209,99 +204,120 @@ let info = ref({
|
||||
isvisiblereply: 0, // 回复点赞可见
|
||||
message: "", // 过程
|
||||
anonymous: 0, // 匿名状态
|
||||
})
|
||||
});
|
||||
|
||||
// 关键字搜索学校
|
||||
const querySchoolSearch = (queryString, cb) => {
|
||||
publishSchoolSearchHttp({ keyword: queryString }).then(res => {
|
||||
if (res.code != 200) return
|
||||
let data = res.data || []
|
||||
publishSchoolSearchHttp({ keyword: queryString }).then((res) => {
|
||||
if (res.code != 200) return;
|
||||
let data = res.data || [];
|
||||
|
||||
let isRepetition = false
|
||||
let isRepetition = false;
|
||||
|
||||
data.forEach(element => {
|
||||
element["value"] = element["checkname"]
|
||||
if (element["checkname"] == queryString) isRepetition = true
|
||||
})
|
||||
if (!isRepetition) data.push({ value: queryString })
|
||||
data.forEach((element) => {
|
||||
element["value"] = element["checkname"];
|
||||
if (element["checkname"] == queryString) isRepetition = true;
|
||||
});
|
||||
if (!isRepetition) data.push({ value: queryString });
|
||||
// isSchoolSpin.value = true
|
||||
cb(data)
|
||||
})
|
||||
}
|
||||
cb(data);
|
||||
});
|
||||
};
|
||||
|
||||
// 选择院校
|
||||
const handleSchoolSelect = item => {
|
||||
info.value["schoolid"] = item["id"] || 0
|
||||
const handleSchoolSelect = (item) => {
|
||||
info.value["schoolid"] = item["id"] || 0;
|
||||
// isSchoolSpin.value = false
|
||||
}
|
||||
};
|
||||
|
||||
// 关键字搜索专业
|
||||
const queryMajorSearch = (queryString, cb) => {
|
||||
publishProfessionSearchHttp({ keyword: queryString }).then(res => {
|
||||
if (res.code != 200) return
|
||||
let data = res.data || []
|
||||
publishProfessionSearchHttp({ keyword: queryString }).then((res) => {
|
||||
if (res.code != 200) return;
|
||||
let data = res.data || [];
|
||||
|
||||
let isRepetition = false
|
||||
let isRepetition = false;
|
||||
|
||||
data.forEach(element => {
|
||||
element["value"] = element["name"]
|
||||
if (element["name"] == queryString) isRepetition = true
|
||||
})
|
||||
if (!isRepetition) data.push({ value: queryString })
|
||||
data.forEach((element) => {
|
||||
element["value"] = element["name"];
|
||||
if (element["name"] == queryString) isRepetition = true;
|
||||
});
|
||||
if (!isRepetition) data.push({ value: queryString });
|
||||
|
||||
// isMajorSpin.value = true
|
||||
cb(data)
|
||||
})
|
||||
}
|
||||
cb(data);
|
||||
});
|
||||
};
|
||||
|
||||
// 选择专业
|
||||
const handleMajorSelect = item => {
|
||||
info.value["profession_id"] = item["id"] || 0
|
||||
const handleMajorSelect = (item) => {
|
||||
info.value["profession_id"] = item["id"] || 0;
|
||||
// isMajorSpin.value = false
|
||||
}
|
||||
};
|
||||
|
||||
// 关键字搜索项目
|
||||
const queryProjectSearch = (queryString, cb) => {
|
||||
console.log("queryString", queryString);
|
||||
|
||||
publishProjectSearchHttp({ keyword: queryString, sid: info.value["schoolid"] }).then((res) => {
|
||||
if (res.code != 200) return;
|
||||
let data = res.data.data || [];
|
||||
|
||||
let isRepetition = false;
|
||||
|
||||
data.forEach((element) => {
|
||||
element["value"] = element["name"];
|
||||
if (element["name"] == queryString) isRepetition = true;
|
||||
});
|
||||
if (!isRepetition) data.push({ value: queryString });
|
||||
|
||||
// isMajorSpin.value = true
|
||||
cb(data);
|
||||
});
|
||||
};
|
||||
|
||||
// 切换匿名状态
|
||||
const cutAnonymous = () => {
|
||||
info.value["anonymous"] = info.value["anonymous"] == 0 ? 1 : 0
|
||||
}
|
||||
info.value["anonymous"] = info.value["anonymous"] == 0 ? 1 : 0;
|
||||
};
|
||||
|
||||
// 切换回复可见状态
|
||||
const cutVisible = () => {
|
||||
info.value["isvisiblereply"] = info.value["isvisiblereply"] == 0 ? 1 : 0
|
||||
}
|
||||
info.value["isvisiblereply"] = info.value["isvisiblereply"] == 0 ? 1 : 0;
|
||||
};
|
||||
|
||||
let loading = ref(false)
|
||||
let loading = ref(false);
|
||||
// 提交发布
|
||||
const submit = (status = 1) => {
|
||||
if (loading.value) {
|
||||
ElMessage.error("提交中,稍等")
|
||||
return
|
||||
ElMessage.error("提交中,稍等");
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
loading.value = true;
|
||||
publishSubmitHttp({ info: info.value, token, status })
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
if (res.code != 200) {
|
||||
ElMessage.error(res.message)
|
||||
return
|
||||
ElMessage.error(res.message);
|
||||
return;
|
||||
}
|
||||
|
||||
const data = res.data
|
||||
ElMessage.success(res.message)
|
||||
const data = res.data;
|
||||
ElMessage.success(res.message);
|
||||
|
||||
// router.push(`/details/${data["uniqid"]}`)
|
||||
if (status == 0) goToURL(`/index.html`, false)
|
||||
else goToURL(`/details/${data["uniqid"]}`, false)
|
||||
if (status == 0) goToURL(`/index.html`, false);
|
||||
else goToURL(`/details/${data["uniqid"]}`, false);
|
||||
})
|
||||
.finally(() => (loading.value = false))
|
||||
}
|
||||
.finally(() => (loading.value = false));
|
||||
};
|
||||
|
||||
// 放弃保存 跳跃上一页或者首页
|
||||
const abandonSaving = () => {
|
||||
if (router.currentRoute.value.meta.previousPage) router.go(-1)
|
||||
else goToURL("./index.html", false) // 跳转到首页
|
||||
if (router.currentRoute.value.meta.previousPage) router.go(-1);
|
||||
else goToURL("./index.html", false); // 跳转到首页
|
||||
// else router.push("./index.html") // 跳转到首页
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
Reference in New Issue
Block a user