Cross.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <script setup>
  2. import { ref, reactive, watch } from "vue";
  3. import { useMainStore } from "@/stores/store";
  4. import axios from "axios";
  5. import moment from "moment";
  6. const store = useMainStore();
  7. const breadcrumbs = reactive([
  8. {
  9. title: "首頁",
  10. disabled: false,
  11. href: "/",
  12. },
  13. {
  14. title: "工藝學群",
  15. disabled: true,
  16. },
  17. {
  18. title: "跨域增能",
  19. disabled: true,
  20. },
  21. ]);
  22. let loading = ref(false);
  23. let pageNum = ref(1); // 頁數(預設第一頁)
  24. let pageAmount = ref(18); // 每頁顯示筆數
  25. let totalPages = ref(1); // 總頁數
  26. let totalNum = ref(0); // 資料總筆數
  27. let selectCategory = ref([]); // 選擇類別
  28. let isFilter = ref(false); // 篩選狀態
  29. let filterList = reactive([]); // 篩選條件
  30. let isSearch = ref(false); // 搜尋狀態
  31. let searchInput = ref(""); // 關鍵字
  32. let searchError = ref(false); // 搜尋錯誤訊息
  33. watch(searchInput, (val) => {
  34. if (val === "") {
  35. searchError.value = false;
  36. getClass();
  37. }
  38. });
  39. const courese = reactive({
  40. list: [],
  41. });
  42. async function getClass() {
  43. loading.value = true;
  44. let url = `https://cmm.ai:8088/api/get_online_courese?no_org=udemy&page_num=${pageNum.value}&page_amount=${pageAmount.value}`;
  45. // 篩選類別
  46. if (isFilter.value) {
  47. filterList.map((item) => {
  48. url += item;
  49. });
  50. }
  51. // 關鍵字搜尋
  52. if (isSearch.value) {
  53. url += `&key_word=${searchInput.value}`;
  54. }
  55. try {
  56. const response = await axios.get(url);
  57. courese.list = response.data.online_coures;
  58. console.log("response.data", response.data);
  59. totalNum.value = response.data.total_num;
  60. totalPages.value = store.getTotalPages(response.data.total_num, 18);
  61. loading.value = false;
  62. if (!response.data.online_coures.length) {
  63. searchError.value = true;
  64. } else {
  65. searchError.value = false;
  66. }
  67. } catch (error) {
  68. loading.value = false;
  69. console.error(error);
  70. }
  71. }
  72. getClass();
  73. const listLocation = ref(null);
  74. watch(pageNum, () => {
  75. getClass();
  76. listLocation.value.scrollIntoView({ behavior: "smooth", block: "start" });
  77. });
  78. watch(selectCategory, (val) => {
  79. if (val.includes("全部")) {
  80. selectCategory.value = [];
  81. isFilter.value = false;
  82. pageNum.value = 1;
  83. getClass();
  84. } else {
  85. selectFilter("category", val);
  86. }
  87. });
  88. // 篩選課程
  89. async function selectFilter(type, val) {
  90. isFilter.value = true;
  91. pageNum.value = 1; // 篩選時返回第一頁
  92. filterList.splice(0, filterList.length); // 清空陣列
  93. if (type === "category") {
  94. filterList.push(`&category=${val}`);
  95. }
  96. getClass();
  97. }
  98. async function handleSearch() {
  99. if (searchInput.value !== "") {
  100. isSearch.value = true;
  101. } else {
  102. isSearch.value = false;
  103. }
  104. getClass();
  105. }
  106. </script>
  107. <template>
  108. <v-breadcrumbs
  109. :items="breadcrumbs"
  110. divider="/"
  111. class="mt-10 pa-0"
  112. ></v-breadcrumbs>
  113. <div class="list">
  114. <section>
  115. <h3>跨域增能</h3>
  116. <p>
  117. 培育能承接文化生產者的內涵與工藝知識,並轉化成一般人能同理感受並更進一步在生活中學習應用的人才。
  118. <br />
  119. 主要專業並非工藝而是更偏向社會傳播,或其他八大藝術專業或民俗文化專業。但能進一步了解文化生產者。
  120. <br />
  121. 不管是傳統工藝的延伸,或是有形、無形文化資產的保護與創意化,都鼓勵跨領域的合作與創作,並在最後達到永續經營,成為國家升級的重要推動力量。以因應本土化、國際化、多元化的環境銳變與社會趨勢。
  122. </p>
  123. </section>
  124. <section>
  125. <h3>提供多元領域專業課程</h3>
  126. <p>
  127. 法務知識、財務稅務、資金籌措、藝術行政、市場分析、產品開發、消費者管理、藝術藏家、
  128. 品牌設計、市場通路、行銷策略、展覽企劃、文案撰寫、公關溝通、其他類及,策略課程
  129. </p>
  130. </section>
  131. <section>
  132. <h3>教學型態</h3>
  133. <div class="d-flex flex-column flex-sm-row justify-center">
  134. <p>
  135. 素養型 <br />
  136. (講述核心素養)
  137. </p>
  138. <p>
  139. 知識型 <br />
  140. (講述基本能力)
  141. </p>
  142. <p>
  143. 技術型 <br />
  144. (實作、討論)
  145. </p>
  146. </div>
  147. </section>
  148. </div>
  149. <div
  150. ref="listLocation"
  151. class="d-flex flex-column flex-sm-row align-center justify-space-between title"
  152. >
  153. <h2>所有課程</h2>
  154. <div class="search">
  155. <span>
  156. <input
  157. v-model="searchInput"
  158. type="text"
  159. @keyup.enter="handleSearch()"
  160. placeholder="關鍵字搜尋"
  161. />
  162. <button @click="handleSearch()">
  163. <img src="@/assets/img/news/news-search-icon.png" alt="" />
  164. </button>
  165. </span>
  166. <div
  167. v-if="searchError"
  168. class="d-flex justify-center align-center error me-4"
  169. >
  170. <v-icon color="primary" icon="mdi-alert" class="me-2"></v-icon>
  171. 沒有符合搜尋條件的項目
  172. </div>
  173. </div>
  174. </div>
  175. <v-row>
  176. <v-col cols="12" md="3" lg="2">
  177. <v-row class="filter-list">
  178. <v-col cols="12" sm="6" md="12">
  179. <v-select
  180. v-model="selectCategory"
  181. label="類別"
  182. :items="[
  183. '全部',
  184. '財務稅務',
  185. '市場分析',
  186. '行銷策略',
  187. '公關溝通',
  188. '法務知識',
  189. '產品開發',
  190. '品牌設計',
  191. '消費者管理',
  192. '策劃展覽',
  193. '藝術行政',
  194. '文案撰寫',
  195. '教學影音',
  196. '品牌企劃',
  197. ]"
  198. multiple
  199. hide-details
  200. ></v-select>
  201. </v-col>
  202. <!-- <v-col cols="12">
  203. <v-btn
  204. @click="selectFilter()"
  205. class="w-100"
  206. variant="flat"
  207. color="brown"
  208. rounded="xl"
  209. >
  210. 搜尋
  211. </v-btn>
  212. </v-col>
  213. <v-col cols="12">
  214. <v-btn class="w-100" variant="outlined" color="brown" rounded="xl">
  215. 清除重填
  216. </v-btn>
  217. </v-col> -->
  218. </v-row>
  219. </v-col>
  220. <v-col cols="12" md="9" lg="10">
  221. <v-row class="cross-courese">
  222. <v-col
  223. cols="12"
  224. md="6"
  225. lg="4"
  226. v-for="(item, index) in courese.list"
  227. :key="index"
  228. class="pa-5"
  229. >
  230. <div class="main-card">
  231. <a :href="item.video_url" target="_blank">
  232. <section class="card-title">
  233. <h3>{{ item.title }}</h3>
  234. </section>
  235. </a>
  236. <a :href="item.video_url" target="_blank">
  237. <div class="card-info">
  238. <ul>
  239. <li class="d-flex align-center">
  240. <p class="mb-0 ms-3">分類: {{ item.category }}</p>
  241. </li>
  242. <li class="d-flex align-center">
  243. <p class="mb-0 ms-3">來源: {{ item.content }}</p>
  244. </li>
  245. </ul>
  246. </div>
  247. </a>
  248. </div>
  249. </v-col>
  250. </v-row>
  251. </v-col>
  252. </v-row>
  253. <v-pagination
  254. v-if="courese.list.length"
  255. v-model="pageNum"
  256. :length="totalPages"
  257. rounded="circle"
  258. class="mt-16"
  259. ></v-pagination>
  260. <span v-if="courese.list.length" class="text-gray total-item"
  261. >總筆數:{{ totalNum }}</span
  262. >
  263. <div class="title mt-16">
  264. <h2>工藝中心開課</h2>
  265. </div>
  266. <p class="cooming-soon">「籌備中 cooming soon」</p>
  267. </template>
  268. <style lang="scss" scoped>
  269. .main-block {
  270. h2 {
  271. @media (max-width: 600px) {
  272. margin-bottom: 30px;
  273. }
  274. }
  275. }
  276. .v-input {
  277. @media (max-width: 600px) {
  278. max-width: 250px;
  279. margin: auto;
  280. margin-top: -20px;
  281. }
  282. }
  283. .cross-courese {
  284. .main-card {
  285. .card-title {
  286. height: 40%;
  287. h3 {
  288. font-size: 18px;
  289. font-weight: 500;
  290. }
  291. }
  292. .card-info {
  293. padding: 0;
  294. height: 60%;
  295. ul {
  296. justify-content: center;
  297. li:first-child {
  298. margin-bottom: 5px;
  299. }
  300. p {
  301. font-size: 14px;
  302. }
  303. }
  304. }
  305. }
  306. }
  307. .list {
  308. max-width: 850px;
  309. margin: 100px auto 50px;
  310. @media (max-width: 600px) {
  311. margin: 50px auto;
  312. }
  313. section {
  314. margin-bottom: 50px;
  315. text-align: center;
  316. h3 {
  317. margin-left: -20px;
  318. margin-bottom: 25px;
  319. list-style: disc;
  320. font-size: 28px;
  321. font-weight: 500;
  322. @media (max-width: 600px) {
  323. font-size: 22px;
  324. }
  325. &::before {
  326. content: "\2022"; /* Unicode 編碼 */
  327. font-size: 1.2em;
  328. color: #bca2b5;
  329. position: relative;
  330. top: 3px;
  331. }
  332. }
  333. p {
  334. line-height: 28px;
  335. letter-spacing: 1px;
  336. @media (max-width: 600px) {
  337. font-size: 14px;
  338. }
  339. }
  340. }
  341. }
  342. </style>