Browse Source

学生优秀作业

bzkf30 2 years ago
parent
commit
b12e4f9688

+ 70 - 0
src/pages/ysgc_new/api.js

@@ -0,0 +1,70 @@
+import request from '@/utils/request';
+
+export const ysgc_list = (data = {}) =>
+  request({
+    url: '/ysgc/zp/index',
+    data: data
+  })
+
+export const ssyskc_list = (data = {}) =>
+  request({
+    url: '/kzkt/ssyskc/index',
+    data: data
+  })
+
+export const xskc_detail = (data = {}) => {
+  return request({
+    url: '/kzkt/ssyskc/detail',
+    data: data
+  })
+}
+
+export const ysgc_detail = (data = {}) =>
+  request({
+    url: '/ysgc/zp/detail',
+    data: data
+  })
+
+export const ysgc_evaluate_list = (data = {}) =>
+  request({
+    url: '/ysgc/zp_evaluate/index',
+    data: data
+  })
+
+export const ysgc_addEvaluate = (data = {}) =>
+  request({
+    url: '/ysgc/zp_evaluate/add',
+    data: data
+  })
+
+//点赞
+export const jszp_like_add = (data = {}) =>
+  request({
+    url: '/ysgc/zp_like/add',
+    data: data
+  })
+
+export const jszp_like_del = (data = {}) =>
+  request({
+    url: '/ysgc/zp_like/delete',
+    data: data
+  })
+
+//收藏
+export const jszp_fav_add = (data = {}) =>
+  request({
+    url: '/ysgc/zp_fav/add',
+    data: data
+  })
+
+export const jszp_fav_del = (data = {}) =>
+  request({
+    url: '/ysgc/zp_fav/delete',
+    data: data
+  })
+
+export const user_detail = (data = {}) =>
+  request({
+    url: '/user/main/detail',
+    data: data
+  })

+ 45 - 0
src/pages/ysgc_new/index.vue

@@ -0,0 +1,45 @@
+<template>
+  <div class="ysgcContent">
+    <van-nav-bar title="艺术广场" @click-left="onClickLeft" />
+
+    <van-tabs v-model:active="activeName" @change="handleChange">
+      <van-tab title="学生优秀作业" name="1"></van-tab>
+      <van-tab title="教师优秀作品" name="2"></van-tab>
+    </van-tabs>
+
+    <router-view></router-view>
+  </div>
+</template>
+
+<script setup>
+import { useRouter } from 'vue-router';
+const router = useRouter();
+
+const onClickLeft = () => history.back();
+
+const activeName = ref("1");
+if (router.currentRoute.value.name == "xsyxzy_list" || router.currentRoute.value.name == "xsyxzy_detail") {
+  activeName.value = "1";
+} else if (router.currentRoute.value.name == "jsyxzp_list") {
+  activeName.value = "2";
+}
+
+const handleChange = () => {
+  if (activeName.value == 1) {
+    router.push({ name: 'xsyxzy_list' })
+  } else if (activeName.value == 2) {
+    router.push({ name: 'jsyxzp_list' })
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.ysgcContent {
+  height: 100vh;
+  background: #fcfeff;
+  overflow: auto;
+  .van-tabs {
+    box-shadow: 0px 1px 2px 0px rgba(153, 160, 168, 0.18);
+  }
+}
+</style>

+ 129 - 0
src/pages/ysgc_new/jsyxzp.vue

@@ -0,0 +1,129 @@
+<template>
+  <div>
+    <van-search v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="handleSearch" @clear="handleSearch" />
+
+    <van-empty v-if="listData.length==0 && !loading" description="无数据" />
+    <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+      <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="initData" class="grid grid-cols-2">
+        <van-cell v-for="(item, index) in listData" :key="index" @click="lookDetail(item.yz_id)">
+          <van-image :src="getFullUrl(item.yz_img)" />
+          <div class="p-2">
+            <div class="van-ellipsis title">{{item.yz_name}}</div>
+            <van-rate class="my-2" v-model="item.yz_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.yz_like_num}}</span>
+              </div>
+              <div class="icon-item">
+                <van-icon name="like-o" />
+                <span>{{item.yz_fav_num}}</span>
+              </div>
+            </div>
+          </div>
+        </van-cell>
+      </van-list>
+    </van-pull-refresh>
+  </div>
+</template>
+
+<script setup>
+import { getFullUrl } from '~/utils/helper';
+import { ysgc_list } from "./api.js";
+import { useRouter } from 'vue-router';
+const router = useRouter();
+const loading = ref(false);
+const finished = ref(false);
+const refreshing = ref(false);
+const keyword = ref("");
+const listData = ref([]);
+
+const handleSearch = () => {
+  listData.value = [];
+  currentPage.value = 1;
+  onRefresh();
+}
+
+const total = ref(0);
+const limit = ref(12);
+const currentPage = ref(1);
+// initData();
+function initData() {
+  if (refreshing.value) {
+    listData.value = [];
+    refreshing.value = false;
+  }
+
+  let obj = {
+    page: currentPage.value,
+    limit: limit.value,
+    keyword: keyword.value,
+    yz_type: '2',
+  }
+  loading.value = true;
+  ysgc_list(obj).then((res) => {
+    if (res.code == 1) {
+      listData.value = listData.value.concat(res.data.page_data);
+      total.value = parseInt(res.data.total_rows);
+      loading.value = false;
+
+      currentPage.value++;
+      if (listData.value.length >= total.value) {
+        finished.value = true;
+      }
+    }
+  });
+};
+
+function onRefresh() {
+  // 清空列表数据
+  finished.value = false;
+  currentPage.value = 1;
+
+  // 重新加载数据
+  // 将 loading 设置为 true,表示处于加载状态
+  loading.value = true;
+  initData();
+};
+
+
+const lookDetail = (id) => {
+  router.push({ name: 'ysgc_detail', params: { id } })
+}
+</script>
+
+<style lang="scss" scoped>
+:deep(.van-search__content--round) {
+  box-shadow: 0px 1px 2px 0px rgba(153, 160, 168, 0.18);
+  background: #fff;
+}
+:deep(.van-list) {
+  .van-cell {
+    padding: 10px 8px;
+  }
+  .van-cell__value {
+    border-radius: 6px;
+    box-shadow: 0px 5px 12px 0px rgba(153, 160, 168, 0.18);
+    text-align: left;
+    .van-image {
+      display: block;
+      .van-image__img {
+        border-radius: 6px 6px 0 0;
+        height: 98px;
+      }
+    }
+  }
+  .van-list__finished-text {
+    -ms-grid-column-span: 1 / -1;
+    grid-column: 1 / -1;
+    display: none;
+  }
+}
+.title {
+  font-size: 14px;
+}
+.tip {
+  color: #9a9a9a;
+  font-size: 12px;
+}
+</style>

+ 170 - 0
src/pages/ysgc_new/xsyxzy-detail.vue

@@ -0,0 +1,170 @@
+<template>
+  <div>
+    <div class="flex justify-between items-center mt-10px px-10px bread">
+      <div class="">
+        学生优秀作业<span> - </span>
+        {{ detailData.ks_name }}
+      </div>
+      <div class="back" @click="handleBack">返回</div>
+    </div>
+
+    <van-search v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="handleSearch" @clear="handleSearch" />
+
+    <van-empty v-if="listData.length==0 && !loading" description="无数据" />
+    <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+      <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="initData" class="grid grid-cols-2">
+        <van-cell v-for="(item, index) in listData" :key="index" @click="lookDetail(item.yz_id)">
+          <van-image :src="getFullUrl(item.yz_img)" />
+          <div class="p-2">
+            <div class="van-ellipsis title">{{item.yz_name}}</div>
+            <van-rate class="my-2" v-model="item.yz_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.yz_like_num}}</span>
+              </div>
+              <div class="icon-item">
+                <van-icon name="like-o" />
+                <span>{{item.yz_fav_num}}</span>
+              </div>
+            </div>
+          </div>
+        </van-cell>
+      </van-list>
+    </van-pull-refresh>
+  </div>
+</template>
+
+<script setup>
+import { getFullUrl } from '~/utils/helper';
+import { ysgc_list, xskc_detail } from "./api.js";
+import { useRouter } from 'vue-router';
+const router = useRouter();
+const loading = ref(false);
+const finished = ref(false);
+const refreshing = ref(false);
+const keyword = ref("");
+const listData = ref([]);
+
+const handleSearch = () => {
+  listData.value = [];
+  currentPage.value = 1;
+  onRefresh();
+}
+
+const total = ref(0);
+const limit = ref(12);
+const currentPage = ref(1);
+// initData();
+function initData() {
+  if (refreshing.value) {
+    listData.value = [];
+    refreshing.value = false;
+  }
+
+  let obj = {
+    page: currentPage.value,
+    limit: limit.value,
+    keyword: keyword.value,
+    yz_type: '1',
+    ks_id: router.currentRoute.value.params.id
+  }
+  loading.value = true;
+  ysgc_list(obj).then((res) => {
+    if (res.code == 1) {
+      listData.value = listData.value.concat(res.data.page_data);
+      total.value = parseInt(res.data.total_rows);
+      loading.value = false;
+
+      currentPage.value++;
+      if (listData.value.length >= total.value) {
+        finished.value = true;
+      }
+    }
+  });
+};
+
+function onRefresh() {
+  // 清空列表数据
+  finished.value = false;
+  currentPage.value = 1;
+
+  // 重新加载数据
+  // 将 loading 设置为 true,表示处于加载状态
+  loading.value = true;
+  initData();
+};
+
+const detailData = ref({});
+initDetailInfo();
+function initDetailInfo() {
+  let data = {
+    ks_id: router.currentRoute.value.params.id,
+  };
+  xskc_detail(data).then((res) => {
+    if (res.code == 1) {
+      detailData.value = res.data.one_info;
+    }
+  });
+}
+
+const handleBack = () => {
+  router.back();
+}
+
+
+const lookDetail = (id) => {
+  router.push({ name: 'ysgc_detail', params: { id } })
+}
+</script>
+
+<style lang="scss" scoped>
+.bread {
+  background: #f6fcff;
+  // height: 40px;
+  font-size: 14px;
+  color: #646566;
+  padding: 10px;
+}
+.back {
+  color: #00a3ff;
+  border: 1px solid;
+  border-radius: 30px;
+  white-space: nowrap;
+  padding: 3px 10px;
+  margin-left: 8px;
+}
+:deep(.van-search__content--round) {
+  box-shadow: 0px 1px 2px 0px rgba(153, 160, 168, 0.18);
+  background: #fff;
+}
+:deep(.van-list) {
+  .van-cell {
+    padding: 10px 8px;
+  }
+  .van-cell__value {
+    border-radius: 6px;
+    box-shadow: 0px 5px 12px 0px rgba(153, 160, 168, 0.18);
+    text-align: left;
+    .van-image {
+      display: block;
+      .van-image__img {
+        border-radius: 6px 6px 0 0;
+        height: 98px;
+      }
+    }
+  }
+  .van-list__finished-text {
+    -ms-grid-column-span: 1 / -1;
+    grid-column: 1 / -1;
+    display: none;
+  }
+}
+.title {
+  font-size: 14px;
+}
+.tip {
+  color: #9a9a9a;
+  font-size: 12px;
+}
+</style>

+ 130 - 0
src/pages/ysgc_new/xsyxzy.vue

@@ -0,0 +1,130 @@
+<template>
+  <div>
+    <van-search v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="handleSearch" @clear="handleSearch" />
+
+    <van-empty v-if="listData.length==0 && !loading" description="无数据" />
+    <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
+      <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="initData" class="grid grid-cols-2">
+        <van-cell v-for="(item, index) in listData" :key="index" @click="lookDetail(item.ks_id)">
+          <van-image :src="getFullUrl(item.ks_img_cropping || item.ks_img)" />
+          <div class="p-2">
+            <div class="van-ellipsis title">{{item.ks_name}}</div>
+            <van-rate class="my-2" v-model="item.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.like_num}}</span>
+              </div>
+              <div class="icon-item">
+                <van-icon name="like-o" />
+                <span>{{item.fav_num}}</span>
+              </div>
+            </div>
+          </div>
+        </van-cell>
+      </van-list>
+    </van-pull-refresh>
+  </div>
+</template>
+
+<script setup>
+import { getFullUrl } from '~/utils/helper';
+import { ssyskc_list } from "./api.js";
+import { useRouter } from 'vue-router';
+const router = useRouter();
+const loading = ref(false);
+const finished = ref(false);
+const refreshing = ref(false);
+const keyword = ref("");
+const listData = ref([]);
+
+const handleSearch = () => {
+  listData.value = [];
+  currentPage.value = 1;
+  onRefresh();
+}
+
+const total = ref(0);
+const limit = ref(12);
+const currentPage = ref(1);
+// initData();
+function initData() {
+  if (refreshing.value) {
+    listData.value = [];
+    refreshing.value = false;
+  }
+
+  let obj = {
+    page: currentPage.value,
+    limit: limit.value,
+    keyword: keyword.value,
+    ks_status: "3",
+    is_ysgc: "1"
+  }
+  loading.value = true;
+  ssyskc_list(obj).then((res) => {
+    if (res.code == 1) {
+      listData.value = listData.value.concat(res.data.page_data);
+      total.value = parseInt(res.data.total_rows);
+      loading.value = false;
+
+      currentPage.value++;
+      if (listData.value.length >= total.value) {
+        finished.value = true;
+      }
+    }
+  });
+};
+
+function onRefresh() {
+  // 清空列表数据
+  finished.value = false;
+  currentPage.value = 1;
+
+  // 重新加载数据
+  // 将 loading 设置为 true,表示处于加载状态
+  loading.value = true;
+  initData();
+};
+
+
+const lookDetail = (id) => {
+  router.push({ name: 'xsyxzy_detail', params: { id } })
+}
+</script>
+
+<style lang="scss" scoped>
+:deep(.van-search__content--round) {
+  box-shadow: 0px 1px 2px 0px rgba(153, 160, 168, 0.18);
+  background: #fff;
+}
+:deep(.van-list) {
+  .van-cell {
+    padding: 10px 8px;
+  }
+  .van-cell__value {
+    border-radius: 6px;
+    box-shadow: 0px 5px 12px 0px rgba(153, 160, 168, 0.18);
+    text-align: left;
+    .van-image {
+      display: block;
+      .van-image__img {
+        border-radius: 6px 6px 0 0;
+        height: 98px;
+      }
+    }
+  }
+  .van-list__finished-text {
+    -ms-grid-column-span: 1 / -1;
+    grid-column: 1 / -1;
+    display: none;
+  }
+}
+.title {
+  font-size: 14px;
+}
+.tip {
+  color: #9a9a9a;
+  font-size: 12px;
+}
+</style>

+ 29 - 6
src/router/routes/ysgc.ts

@@ -3,17 +3,40 @@ import type { RouteRecordRaw } from 'vue-router'
 export default <RouteRecordRaw>{
   path: '/ysgc',
   name: "ysgc",
-  redirect: "/ysgc/index",
+  // redirect: "/ysgc/index",
   children: [
-    {
-      path: 'index',
-      name: "ysgc_list",
-      component: () => import('~/pages/ysgc/index.vue'),
-    },
+    // {
+    //   path: 'index',
+    //   name: "ysgc_list",
+    //   component: () => import('~/pages/ysgc/index.vue'),
+    // },
     {
       path: 'detail/:id',
       name: "ysgc_detail",
       component: () => import('~/pages/ysgc/detail.vue'),
+    },
+    {
+      path: '',
+      name: "ysgc_list",
+      component: () => import('~/pages/ysgc_new/index.vue'),
+      redirect: "/ysgc/xsyxzy",
+      children: [
+        {
+          path: 'xsyxzy',
+          name: "xsyxzy_list",
+          component: () => import('~/pages/ysgc_new/xsyxzy.vue'),
+        },
+        {
+          path: 'xsyxzy-detail/:id',
+          name: "xsyxzy_detail",
+          component: () => import('~/pages/ysgc_new/xsyxzy-detail.vue'),
+        },
+        {
+          path: 'jsyxzp',
+          name: "jsyxzp_list",
+          component: () => import('~/pages/ysgc_new/jsyxzp.vue'),
+        },
+      ]
     }
   ]
 }