query_universitydb_conditions.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <template>
  2. <div class="query_universitydb_conditions">
  3. <head-component :headinfo=headinfo></head-component>
  4. <div class="page-content">
  5. <div class="content-left">
  6. <div class="tab-box">
  7. <div :class="[onePage?'item-box-active':'item-box']" @click="showPage(1)">
  8. <img v-if="onePage" src="@/assets/images/environment/condition-search-h.png">
  9. <img v-else src="@/assets/images/environment/condition-search.png">
  10. 条件查询
  11. </div>
  12. <div :class="[twoPage?'item-box-active':'item-box']" @click="showPage(2)">
  13. <img v-if="twoPage" src="@/assets/images/environment/keys-search-h.png">
  14. <img v-else src="@/assets/images/environment/keys-search.png">
  15. 关键字查询
  16. </div>
  17. </div>
  18. </div>
  19. <div class="content-right">
  20. <div class="one-page" v-show="onePage">
  21. <div class="top">
  22. <img src="@/assets/images/environment/search-card1.png" @click="showAreaChooseHandler">
  23. <img src="@/assets/images/environment/search-card2.png" @click="showEducationlevelHandler">
  24. <img src="@/assets/images/environment/search-card3.png" @click="showCharacteristicHandler">
  25. </div>
  26. <div class="search-btn">
  27. <p v-show="form.educationlevelName || form.areaname || form.characteristicName">
  28. <span style="margin-right: 3px;margin-left: 3px">已选择条件:</span>
  29. <span style="margin-right: 3px;margin-left: 3px">{{form.educationlevelName}}</span>
  30. <span v-show="form.areaname">|</span>
  31. <span style="margin-right: 3px;margin-left: 3px">{{form.areaname}}</span>
  32. <span v-show="form.characteristicName">|</span>
  33. <span style="margin-right: 3px;margin-left: 3px">{{form.characteristicName}}</span>
  34. </p>
  35. <img @click="search" style="z-index:10" src="@/assets/images/environment/search-btn.png">
  36. </div>
  37. </div>
  38. <div class="two-page" v-show="twoPage">
  39. <div class="two-page-search">
  40. <el-input
  41. v-model="form.name"
  42. style="width: 1484px;height: 84px"
  43. placeholder="请输入"
  44. @change="byKeyword"
  45. >
  46. <template #suffix>
  47. <span style="font-size: 38px;color: #444040;margin-left: 37px;">
  48. X
  49. </span>
  50. </template>
  51. </el-input>
  52. </div>
  53. <div class="result-box">
  54. <div class="two-page-result">
  55. <div v-for="(item,index) in universityList"
  56. :class="[item.selected?'item-result-box-active':'item-result-box']"
  57. @click="toDetail(item)">
  58. <div v-html="item.name"></div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <drag_component></drag_component>
  65. </div>
  66. <div>
  67. <!--院校属地-->
  68. <el-dialog v-model="showAreaChoose" width="1000px" append-to-body>
  69. <div class="dialog-box">
  70. <div v-for="dict in gk_province" :key="dict.value" @click="chooseArea(dict)">
  71. <p>
  72. {{ dict.label }}
  73. </p>
  74. </div>
  75. </div>
  76. </el-dialog>
  77. </div>
  78. <div>
  79. <!--学历层次-->
  80. <el-dialog v-model="showEducationlevel" width="1000px" append-to-body>
  81. <div class="dialog-box dialog-box2">
  82. <div v-for="dict in educationlevel" :key="dict.value" @click="chooseEducationlevel(dict)">
  83. <p>
  84. {{ dict.label }}
  85. </p>
  86. </div>
  87. </div>
  88. </el-dialog>
  89. </div>
  90. <div>
  91. <!--特色-->
  92. <el-dialog v-model="showCharacteristic" width="1000px" append-to-body>
  93. <div class="dialog-box">
  94. <div v-for="dict in characteristic" :key="dict.value" @click="chooseCharacteristic(dict)">
  95. <p>
  96. {{ dict.label }}
  97. </p>
  98. </div>
  99. </div>
  100. </el-dialog>
  101. </div>
  102. </div>
  103. </template>
  104. <script setup>
  105. import headComponent from '@/views/xjc-integratedmachine/components/head_component.vue'
  106. import Drag_component from "@/views/xjc-integratedmachine/components/drag_component.vue";
  107. import {ref} from "vue";
  108. import {getUniversityByKeyword} from "@/api/xjc-integratedmachine/environment/university.js";
  109. const router = useRouter()
  110. const onePage = ref(true)
  111. const twoPage = ref(false)
  112. const threePage = ref(false)
  113. const form = ref({
  114. areaid: null,
  115. areaname: null,
  116. educationlevel: null,
  117. educationlevelName: null,
  118. characteristic: null,
  119. characteristicName: null,
  120. name: null
  121. })
  122. const keyInput = ref(false);
  123. const headinfo = ref({})
  124. function setHeadinfo() {
  125. headinfo.value = {
  126. title: '高校信息查询',
  127. user: {
  128. avatar: '头像路径',
  129. nickName: '张三'
  130. },
  131. backUrl: '/xjc-integratedmachine/environment/index',
  132. homeUrl: '/xjc-integratedmachine/environment/index'
  133. }
  134. }
  135. //切换tabs
  136. const showPage = (val) => {
  137. if (val === 1) {
  138. onePage.value = true;
  139. twoPage.value = false;
  140. threePage.value = false;
  141. } else if (val === 2) {
  142. onePage.value = false;
  143. twoPage.value = true;
  144. threePage.value = false;
  145. } else if (val === 3) {
  146. onePage.value = false;
  147. twoPage.value = false;
  148. threePage.value = true;
  149. }
  150. }
  151. function jumpTo(path) {
  152. router.push({
  153. path: path,
  154. query: {name: 123}
  155. })
  156. }
  157. onMounted(() => {
  158. setHeadinfo()
  159. })
  160. const universityList = ref([])
  161. // 定义一个函数,用于将关键词变为红色
  162. function highlightKeywords(text, keywords) {
  163. // 遍历关键词列表
  164. keywords.forEach(keyword => {
  165. // 使用正则表达式匹配关键词,并替换为带有红色样式的HTML标签
  166. // 这里使用全局匹配标志'g',以确保替换所有出现的关键词
  167. console.log("keywords", keywords)
  168. let regex = new RegExp(keyword, 'g');
  169. text = text.replace(regex, `<span style="color: #0DE6A1;">${keyword}</span>`);
  170. console.log("text", text)
  171. });
  172. return text;
  173. }
  174. function byKeyword() {
  175. getUniversityByKeyword(form.value).then(resp => {
  176. resp.list.map(item => {
  177. item.selected = false;
  178. let keyWord = form.value.name
  179. item.name = highlightKeywords(item.name, [keyWord]);
  180. console.log(" item.name", item.name)
  181. // 遍历数据数组,并处理每个字符串
  182. })
  183. universityList.value = resp.list
  184. })
  185. }
  186. function toDetail(row) {
  187. router.push({
  188. path: '/xjc-integratedmachine/environment/university_details_video',
  189. query: {
  190. id: row.id,
  191. name: row.name,
  192. }
  193. })
  194. }
  195. const tab = ref("tj")
  196. function changeTab(path) {
  197. tab.value = path
  198. }
  199. const showAreaChoose = ref(false)
  200. const showEducationlevel = ref(false)
  201. const showCharacteristic = ref(false)
  202. const {proxy} = getCurrentInstance()
  203. const {gk_province, educationlevel, characteristic} = proxy.useDict('gk_province', 'educationlevel', 'characteristic')
  204. function showAreaChooseHandler() {
  205. showAreaChoose.value = true
  206. }
  207. function chooseArea(item) {
  208. form.value.areaid = item.value
  209. form.value.areaname = item.label
  210. showAreaChoose.value = false
  211. }
  212. function showEducationlevelHandler() {
  213. showEducationlevel.value = true
  214. }
  215. function chooseEducationlevel(item) {
  216. form.value.educationlevel = item.value
  217. form.value.educationlevelName = item.label
  218. showEducationlevel.value = false
  219. }
  220. function showCharacteristicHandler() {
  221. showCharacteristic.value = true
  222. }
  223. function chooseCharacteristic(item) {
  224. form.value.characteristic = item.value
  225. form.value.characteristicName = item.label
  226. showCharacteristic.value = false
  227. }
  228. function search() {
  229. router.push({
  230. path: '/xjc-integratedmachine/environment/university_list',
  231. query: form.value
  232. })
  233. }
  234. </script>
  235. <style scoped lang="scss">
  236. .query_universitydb_conditions {
  237. background: url('@/assets/images/login/login-home-background.png') no-repeat;
  238. background-size: 1920px 1080px;
  239. z-index: 10;
  240. width: 100%;
  241. height: 1080px;
  242. .page-content {
  243. width: 100%;
  244. position: absolute;
  245. top: 100px;
  246. bottom: 0;
  247. display: flex;
  248. justify-content: space-between;
  249. .content-left {
  250. width: 244px;
  251. height: 957px;
  252. background: rgba(255, 255, 255, 0.26);
  253. ::v-deep .el-menu-item .is-active {
  254. background: red !important;
  255. }
  256. .item-box {
  257. width: 244px;
  258. height: 80px;
  259. color: #B3B3B3;
  260. display: flex;
  261. align-items: center;
  262. margin-right: 5px;
  263. font-weight: bold;
  264. font-size: 20px;
  265. background: #C8FFED;
  266. img {
  267. width: 28px;
  268. height: 28px;
  269. margin-right: 10px;
  270. margin-left: 40px;
  271. }
  272. }
  273. .item-box-active {
  274. width: 244px;
  275. height: 80px;
  276. background: #1EC590;
  277. font-weight: bold;
  278. font-size: 20px;
  279. display: flex;
  280. color: #FFFFFF;
  281. line-height: 40px;
  282. margin-right: 5px;
  283. align-items: center;
  284. img {
  285. width: 28px;
  286. height: 28px;
  287. margin-right: 10px;
  288. margin-left: 40px;
  289. }
  290. }
  291. }
  292. .content-right {
  293. width: 1615px;
  294. height: 926px;
  295. background: #FFFFFF;
  296. border-radius: 35px 35px 35px 35px;
  297. margin-top: 13px;
  298. margin-right: 24px;
  299. .one-page {
  300. .top {
  301. display: flex;
  302. justify-content: space-around;
  303. align-items: center;
  304. img {
  305. width: 446px;
  306. height: 239px;
  307. margin-top: 271px;
  308. }
  309. }
  310. .search-btn {
  311. display: flex;
  312. align-items: center;
  313. flex-direction: column;
  314. justify-content: space-around;
  315. margin-top: 271px;
  316. img {
  317. width: 244px;
  318. height: 100px;
  319. }
  320. p{
  321. }
  322. span{
  323. margin-left: 3px;
  324. }
  325. }
  326. }
  327. .two-page {
  328. display: flex;
  329. flex-direction: column;
  330. align-items: center;
  331. .two-page-search {
  332. margin-top: 57px;
  333. ::v-deep .el-input__inner {
  334. width: 1300px;
  335. height: 84px;
  336. font-size: 24px;
  337. margin-left: 34px;
  338. }
  339. ::v-deep .el-input__suffix {
  340. font-size: 100px;
  341. width: 100px;
  342. height: 100px;
  343. }
  344. ::v-deep .el-input__wrapper {
  345. background: #F5F9FA;
  346. box-shadow: none;
  347. }
  348. }
  349. .result-box {
  350. width: 1484px;
  351. height: 750px;
  352. overflow: auto;
  353. .two-page-result {
  354. display: flex;
  355. flex-wrap: wrap;
  356. justify-content: space-between;
  357. align-items: center;
  358. .item-result-box-active {
  359. min-width: 320px;
  360. height: 92px;
  361. background: linear-gradient(180deg, #B6FFEF 0%, #C5EEFF 100%);
  362. box-shadow: inset 0px -2px 7px 0px #1E410E;
  363. border-radius: 5px 5px 5px 5px;
  364. border: 1px solid #A2F57F;
  365. font-weight: 400;
  366. font-size: 30px;
  367. color: #0DE6A1;
  368. line-height: 90px;
  369. text-align: center;
  370. margin-left: 50px;
  371. margin-right: 50px;
  372. margin-top: 32px;
  373. padding-left: 20px;
  374. padding-right: 20px;
  375. }
  376. .item-result-box {
  377. min-width: 320px;
  378. height: 92px;
  379. background: #E0EEF4;
  380. border-radius: 5px 5px 5px 5px;
  381. font-weight: 400;
  382. font-size: 30px;
  383. color: #000000;
  384. line-height: 90px;
  385. text-align: center;
  386. margin-left: 50px;
  387. margin-right: 50px;
  388. margin-top: 32px;
  389. padding-left: 20px;
  390. padding-right: 20px;
  391. }
  392. .item-result-box:hover {
  393. min-width: 320px;
  394. height: 92px;
  395. background: linear-gradient(180deg, #B6FFEF 0%, #C5EEFF 100%);
  396. box-shadow: inset 0px -2px 7px 0px #1E410E;
  397. border-radius: 5px 5px 5px 5px;
  398. border: 1px solid #A2F57F;
  399. font-weight: 400;
  400. font-size: 30px;
  401. color: #000000;
  402. line-height: 90px;
  403. text-align: center;
  404. margin-left: 50px;
  405. margin-top: 32px;
  406. padding-left: 20px;
  407. padding-right: 20px;
  408. }
  409. }
  410. }
  411. }
  412. }
  413. }
  414. }
  415. .dialog-box {
  416. display: flex;
  417. flex-wrap: wrap;
  418. justify-content: space-between;
  419. div {
  420. //border: 1px solid;
  421. }
  422. p {
  423. min-width: 120px;
  424. padding-left: 10px;
  425. padding-right:10px;
  426. height: 60px;
  427. margin-left: 10px;
  428. margin-right: 10px;
  429. border: 1px solid;
  430. font-weight: 400;
  431. font-size: 30px;
  432. color: #333333;
  433. text-align: center;
  434. line-height: 60px;
  435. border-radius: 10px;
  436. }
  437. }
  438. .dialog-box2{
  439. display: flex;
  440. justify-content: space-around;
  441. }
  442. </style>