bzkf30 2 роки тому
батько
коміт
3fe24b8562

+ 1 - 0
package.json

@@ -15,6 +15,7 @@
   "dependencies": {
     "@vueuse/core": "^9.3.1",
     "axios": "^0.27.2",
+    "sass": "1.56.1",
     "vant": "4.0.0-beta.0",
     "vue": "^3.2.41",
     "vue-router": "^4.1.5"

BIN
public/images/icon-favor.png


BIN
public/images/icon-prove.png


+ 25 - 0
src/pages/jckc/api.js

@@ -0,0 +1,25 @@
+import request from '@/utils/request';
+
+export const kc_list = (data = {}) =>
+  request({
+    url: '/kczy/kc/index',
+    data: data
+  })
+
+export const grade_list = (data = {}) =>
+  request({
+    url: '/jcxx/grade/index',
+    data: data
+  })
+
+export const kc_detail = (data = {}) =>
+  request({
+    url: '/kczy/kc/detail',
+    data: data
+  })
+
+export const files_list = (data = {}) =>
+  request({
+    url: '/kczy/files/index',
+    data: data
+  })

+ 207 - 0
src/pages/jckc/index.vue

@@ -0,0 +1,207 @@
+<template>
+  <div class="jckcContent">
+    <van-nav-bar title="基础课程" right-text="筛选" @click-right="handleRightClick" />
+    <van-search v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="initData" />
+
+    <van-loading v-if="loading" class="h-full flex items-center justify-center" />
+    <van-grid v-else :border="false" :column-num="2" :center="false" :gutter="5">
+      <van-grid-item v-for="(item, index) in listData" :key="index" @click="lookDetail(item.kk_id)">
+        <div class="shadow">
+          <van-image :src="getFullUrl(item.kk_img)" />
+          <div class="p-2">
+            <div class="van-ellipsis title">{{item.kk_name}}</div>
+            <van-rate class="my-2" v-model="item.kk_star_num" color="#ffd21e" void-icon="star" void-color="#eee" size="16px" readonly allow-half />
+            <div class="flex space-x-4 tip">
+              <div>
+                <van-icon name="good-job-o" />
+                <span>{{item.kk_like_num}}</span>
+              </div>
+              <div class="icon-item">
+                <van-icon name="like-o" />
+                <span>{{item.kk_fav_num}}</span>
+              </div>
+            </div>
+          </div>
+        </div>
+      </van-grid-item>
+    </van-grid>
+
+    <van-popup v-model:show="popupShow" position="bottom" class="p-5">
+      <h1 class="my-5">请进行筛选</h1>
+      <div>
+        <div class="label">年级</div>
+        <van-row gutter="8">
+          <van-col span="6" v-for="(item, index) in gradeData" :key="index" class="mb-3">
+            <van-button :type="activeGradeIndex==index && 'primary'" @click="initGrade(item, index)">{{item.grade_name}}</van-button>
+          </van-col>
+        </van-row>
+      </div>
+      <div>
+        <div class="label">分册</div>
+        <van-row gutter="8">
+          <van-col span="6" v-for="(item, index) in fasciculeData" :key="index" class="mb-3">
+            <van-button :type="activeFasciculeIndex==index && 'primary'" @click="initFascicule(item, index)">{{item.n}}</van-button>
+          </van-col>
+        </van-row>
+      </div>
+      <van-row class="mt-8" gutter="20">
+        <van-col span="8">
+          <van-button @click="handleCancel()">取消</van-button>
+        </van-col>
+        <van-col span="16">
+          <van-button type="primary" @click="handleCancel(1)">确定</van-button>
+        </van-col>
+      </van-row>
+    </van-popup>
+  </div>
+</template>
+
+<script setup>
+import { getFullUrl } from '~/utils/helper';
+import { kc_list, grade_list } from "./api.js";
+import { useRouter } from 'vue-router';
+const router = useRouter()
+const loading = ref(false);
+const keyword = ref("");
+const listData = ref([]);
+
+const gradeData = ref([
+  {
+    grade_id: "",
+    grade_name: "全部",
+  }
+]);
+const activeGradeIndex = ref(0);
+const activeGrade = ref("");
+initGradeData();
+function initGradeData() {
+  grade_list({ limit: 50 }).then((res) => {
+    if (res.code == 1) {
+      gradeData.value = gradeData.value.concat(res.data.page_data);
+    }
+  });
+}
+
+
+const fasciculeData = ref([
+  { v: "", n: "全部" },
+  { v: "1", n: "上册" },
+  { v: "2", n: "下册" }
+]);
+const activeFasciculeIndex = ref(0);
+const activeFascicule = ref("");
+
+
+const initGrade = (value, i) => {
+  activeGradeIndex.value = i;
+  activeGrade.value = value.grade_id;
+
+  initData();
+};
+const initFascicule = (value, i) => {
+  activeFasciculeIndex.value = i;
+  activeFascicule.value = value.grade_id;
+
+  initData();
+};
+
+initData();
+function initData() {
+  let obj = {
+    page: "1",
+    limit: "9999",
+    keyword: keyword.value,
+    kc_cate_level_1: "1",
+    kk_shzt: "1",
+    grade_id: activeGrade.value,
+    team_id: activeFascicule.value,
+  }
+  loading.value = true;
+  kc_list(obj).then((res) => {
+    if (res.code == 1) {
+      listData.value = res.data.page_data;
+      loading.value = false;
+    }
+  });
+}
+
+
+let popupShow = ref(false);
+const handleRightClick = () => {
+  console.log('right click')
+  popupShow.value = true;
+}
+
+const handleCancel = (type) => {
+  popupShow.value = false;
+  type == 1 && initData();
+}
+
+const lookDetail = (id) => {
+  router.push({ name: 'jckc_zy', params: { id } })
+}
+</script>
+
+<style lang="scss" scoped>
+.jckcContent {
+  height: 100vh;
+  background: #fcfeff;
+  :deep(.van-cell) {
+    line-height: 30px;
+  }
+
+  :deep(.van-grid-item) {
+    width: 50%;
+    .van-grid-item__content {
+      padding-top: 0;
+    }
+  }
+  :deep(.shadow) {
+    border-radius: 6px;
+    box-shadow: 0px 5px 12px 0px rgba(153, 160, 168, 0.18);
+    .van-image {
+      display: block;
+      .van-image__img {
+        border-radius: 6px 6px 0 0;
+        height: 98px;
+      }
+    }
+  }
+  .title {
+    font-size: 14px;
+    // width: 100%;
+  }
+  .tip {
+    color: #9a9a9a;
+    font-size: 12px;
+  }
+}
+
+:deep(.van-popup) {
+  height: auto;
+  border-radius: 15px 15px 0 0;
+  h1 {
+    color: #222;
+    font-size: 16px;
+  }
+  .label {
+    font-size: 14px;
+    color: #999;
+    margin-bottom: 6px;
+  }
+  .van-button {
+    width: 100%;
+    &.van-button--normal {
+      background: #f6f6f6;
+      border: none;
+      color: #949494;
+      padding: 0;
+    }
+    &.van-button--primary {
+      background: #00a3ff;
+      border-color: #00a3ff;
+      color: #fffeff;
+    }
+  }
+}
+</style>

+ 68 - 0
src/pages/jckc/zy_index.vue

@@ -0,0 +1,68 @@
+<template>
+  <div>
+    <van-nav-bar :title="detailInfo.kk_name" />
+
+    <van-loading v-if="loading" class="h-full flex items-center justify-center" />
+    <!-- <van-grid v-else :border="false" :column-num="2" :center="false" :gutter="5">
+      <van-grid-item v-for="(item, index) in listData" :key="index" @click="lookDetail(item.kk_id)">
+        <div class="shadow">
+          <van-image :src="getFullUrl(item.kk_img)" />
+          <div class="p-2">
+            <div class="van-ellipsis title">{{item.kk_name}}</div>
+            <van-rate class="my-2" v-model="item.kk_star_num" color="#ffd21e" void-icon="star" void-color="#eee" size="16px" readonly allow-half />
+            <div class="flex space-x-4 tip">
+              <div>
+                <van-icon name="good-job-o" />
+                <span>{{item.kk_like_num}}</span>
+              </div>
+              <div class="icon-item">
+                <van-icon name="like-o" />
+                <span>{{item.kk_fav_num}}</span>
+              </div>
+            </div>
+          </div>
+        </div>
+      </van-grid-item>
+    </van-grid> -->
+  </div>
+</template>
+
+<script setup>
+import { kc_detail, files_list } from "./api.js";
+import { useRouter } from 'vue-router';
+const router = useRouter();
+const parentId = router.currentRoute.value.params.id;
+const loading = ref(false);
+const keyword = ref("");
+const listData = ref([]);
+const detailInfo = ref({});
+
+initData();
+function initData() {
+  let obj = {
+    kk_id: parentId.value,
+  }
+  loading.value = true;
+  files_list(obj).then((res) => {
+    if (res.code == 1) {
+      listData.value = res.data.page_data;
+      loading.value = false;
+    }
+  });
+}
+
+
+initDetailData();
+function initDetailData() {
+  kc_detail({ kk_id: parentId.value }).then((res) => {
+    if (res.code == 1) {
+      detailInfo.value = res.data.one_info;
+      console.log(detailInfo.value)
+    }
+  });
+}
+
+</script>
+
+<style>
+</style>

+ 19 - 0
src/router/routes/jckc.ts

@@ -0,0 +1,19 @@
+import type { RouteRecordRaw } from 'vue-router'
+
+export default <RouteRecordRaw>{
+  path: '/jckc',
+  name: "jckc",
+  redirect: "/jckc/index",
+  children: [
+    {
+      path: 'index',
+      name: "jckc_kc",
+      component: () => import('~/pages/jckc/index.vue'),
+    },
+    {
+      path: 'zy/:id',
+      name: "jckc_zy",
+      component: () => import('~/pages/jckc/zy_index.vue'),
+    }
+  ]
+}

+ 16 - 2
yarn.lock

@@ -696,7 +696,7 @@ character-reference-invalid@^1.0.0:
   resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz#083329cda0eae272ab3dbbf37e9a382c13af1560"
   integrity sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==
 
-chokidar@^3.5.3:
+"chokidar@>=3.0.0 <4.0.0", chokidar@^3.5.3:
   version "3.5.3"
   resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
   integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==
@@ -1621,6 +1621,11 @@ ignore@^5.0.5, ignore@^5.1.1, ignore@^5.2.0:
   resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a"
   integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==
 
+immutable@^4.0.0:
+  version "4.1.0"
+  resolved "https://registry.npmmirror.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef"
+  integrity sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==
+
 import-fresh@^3.0.0, import-fresh@^3.2.1:
   version "3.3.0"
   resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"
@@ -2395,6 +2400,15 @@ safe-regex@^2.1.1:
   dependencies:
     regexp-tree "~0.1.1"
 
+sass@1.56.1:
+  version "1.56.1"
+  resolved "https://registry.npmmirror.com/sass/-/sass-1.56.1.tgz#94d3910cd468fd075fa87f5bb17437a0b617d8a7"
+  integrity sha512-VpEyKpyBPCxE7qGDtOcdJ6fFbcpOM+Emu7uZLxVrkX8KVU/Dp5UF7WLvzqRuUhB6mqqQt1xffLoG+AndxTZrCQ==
+  dependencies:
+    chokidar ">=3.0.0 <4.0.0"
+    immutable "^4.0.0"
+    source-map-js ">=0.6.2 <2.0.0"
+
 scule@^0.3.2:
   version "0.3.2"
   resolved "https://registry.yarnpkg.com/scule/-/scule-0.3.2.tgz#472445cecd8357165a94a067f78cee40e700b596"
@@ -2443,7 +2457,7 @@ slash@^3.0.0:
   resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
   integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
 
-source-map-js@^1.0.2:
+"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.2:
   version "1.0.2"
   resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
   integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==