bzkf30 2 vuotta sitten
vanhempi
commit
b5907ff95b

+ 3 - 5
src/pages/jckc/index.vue

@@ -4,7 +4,6 @@
     <van-search v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="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.kk_id)">
@@ -61,7 +60,7 @@
 import { getFullUrl } from '~/utils/helper';
 import { kc_list, grade_list } from "./api.js";
 import { useRouter } from 'vue-router';
-const router = useRouter()
+const router = useRouter();
 const loading = ref(false);
 const finished = ref(false);
 const refreshing = ref(false);
@@ -87,7 +86,6 @@ function initGradeData() {
   });
 }
 
-
 const fasciculeData = ref([
   { v: "", n: "全部" },
   { v: "1", n: "上册" },
@@ -152,7 +150,7 @@ function initData() {
 function onRefresh() {
   // 清空列表数据
   finished.value = false;
-
+  currentPage.value = 1;
 
   // 重新加载数据
   // 将 loading 设置为 true,表示处于加载状态
@@ -163,7 +161,6 @@ function onRefresh() {
 
 let popupShow = ref(false);
 const handleRightClick = () => {
-  console.log('right click')
   popupShow.value = true;
 }
 
@@ -181,6 +178,7 @@ const lookDetail = (id) => {
 .jckcContent {
   height: 100vh;
   background: #fcfeff;
+  overflow: auto;
   :deep(.van-cell) {
     line-height: 30px;
   }

+ 80 - 26
src/pages/jckc/zy_index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="zyContent">
-    <van-loading v-if="loading || detailLoad" class="h-full flex items-center justify-center" />
+    <!-- <van-loading v-if="loading || detailLoad" class="h-full flex items-center justify-center" /> -->
 
     <van-nav-bar left-arrow :title="detailInfo.grade_name+' 《'+ detailInfo.kk_name+'》'" @click-left="onClickLeft" />
 
@@ -14,18 +14,17 @@
     </div>
 
     <div class="flex justify-between items-center space-x-1">
-      <van-search class="flex-1" v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="initData" />
+      <van-search class="flex-1" v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="handleSearch" />
       <!-- <div @click="onClickRight" class="flex items-center" style="color: #00A3FF;font-size: 12px;">
         课程安排
         <van-icon name="arrow" size="14" />
       </div> -->
     </div>
 
-    <van-empty v-if="listData.length==0" description="无数据" />
-
-    <van-grid v-if="!loading" :border="false" :column-num="2" :center="false" :gutter="5">
-      <van-grid-item v-for="(item, index) in listData" :key="index" @click="lookDetail(item.kf_id)">
-        <div class="shadow">
+    <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.kf_id)">
           <van-image :src="getFullUrl(item.kf_img)" />
           <div class="p-2">
             <div class="van-ellipsis title">{{item.kf_name}}</div>
@@ -41,9 +40,9 @@
               </div>
             </div>
           </div>
-        </div>
-      </van-grid-item>
-    </van-grid>
+        </van-cell>
+      </van-list>
+    </van-pull-refresh>
 
     <van-dialog v-model:show="dialogShow" :show-confirm-button="false" message-align="left" style="height: 60%;">
       <template #title>
@@ -64,6 +63,8 @@ const router = useRouter();
 const parentId = ref(router.currentRoute.value.params.id);
 const loading = ref(false);
 const detailLoad = ref(false);
+const finished = ref(false);
+const refreshing = ref(false);
 const keyword = ref("");
 const listData = ref([]);
 const detailInfo = ref({});
@@ -71,11 +72,24 @@ const dialogShow = ref(false);
 
 const onClickLeft = () => history.back();
 
-initData();
+const handleSearch = () => {
+  listData.value = [];
+  currentPage.value = 1;
+  onRefresh();
+}
+
+const total = ref(0);
+const limit = ref(12);
+const currentPage = ref(1);
 function initData() {
+  if (refreshing.value) {
+    listData.value = [];
+    refreshing.value = false;
+  }
+
   let obj = {
-    page: "1",
-    limit: "9999",
+    page: currentPage.value,
+    limit: limit.value,
     keyword: keyword.value,
     kk_id: parentId.value,
   }
@@ -83,11 +97,28 @@ function initData() {
   files_list(obj).then((res) => {
     if (res.code == 1) {
       listData.value = 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();
+};
+
 
 initDetailData();
 function initDetailData() {
@@ -113,6 +144,7 @@ const onClickRight = () => {
 .zyContent {
   height: 100vh;
   background: #fcfeff;
+  overflow: auto;
   .production {
     background: url(/images/bg.png) no-repeat top left;
     color: #fff;
@@ -128,22 +160,44 @@ const onClickRight = () => {
     //   background: #fff;
     // }
   }
-  :deep(.van-grid-item) {
-    width: 50%;
-    .van-grid-item__content {
-      padding-top: 0;
+  // :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;
+  //     }
+  //   }
+  // }
+  :deep(.van-list) {
+    .van-cell {
+      padding: 10px 8px;
     }
-  }
-  :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;
+    .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;
+    }
   }
   .tip {
     color: #9a9a9a;

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

@@ -0,0 +1,25 @@
+import request from '@/utils/request';
+
+export const ysgc_list = (data = {}) =>
+  request({
+    url: '/ysgc/zp/index',
+    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
+  })

+ 140 - 0
src/pages/ysgc/detail.vue

@@ -0,0 +1,140 @@
+<template>
+  <div class="detailContent">
+    <van-nav-bar left-arrow title="作品详情" @click-left="onClickLeft" />
+
+    <div class="flex justify-between items-center px-3 mt-2">
+      <div style="font-size: 15px;">{{detailInfo.yz_name}}</div>
+      <div class="flex space-x-4 tip">
+        <div @click="handleFinger">
+          <van-icon :name="detailInfo.is_like==0 ? 'good-job-o' : 'good-job'" />
+          <span>{{detailInfo.yz_like_num}}</span>
+        </div>
+        <div @click="handleLoveIcon">
+          <van-icon :name="detailInfo.is_fav==0 ? 'like-o' : 'like'" />
+          <span>{{detailInfo.yz_fav_num}}</span>
+        </div>
+      </div>
+    </div>
+
+    <div class="swiperContent m-2">
+      <van-swipe class="mb-5">
+        <van-swipe-item class="flex items-center justify-center" v-for="(item, index) in imageData" :key="index">
+          <van-image :src="getFullUrl(item)" />
+        </van-swipe-item>
+      </van-swipe>
+    </div>
+
+    <div class="commentDiv px-5">
+      <div class="flex justify-between items-center my-5">
+        <van-rate class="my-2" v-model="star" color="#ffd21e" void-icon="star" void-color="#eee" size="16px" allow-half :readonly="disabled" />
+        <van-button round type="success" size="small" :disabled="disabled" @click="handleComment">评价</van-button>
+      </div>
+      <div>
+        <div v-for="(item, index) in evaluateData" :key="index">
+          <div class="flex items-baseline space-x-4">
+            <div class="user">{{item.yze_user_realname}}</div>
+            <div class="time">{{item.create_time}}</div>
+          </div>
+          <van-rate class="my-2" v-model="item.yze_star" color="#ffd21e" void-icon="star" void-color="#eee" size="16px" allow-half readonly />
+          <van-divider dashed></van-divider>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { getFullUrl } from '~/utils/helper';
+import { ysgc_detail, ysgc_evaluate_list, ysgc_addEvaluate } from "./api.js";
+import userInfo from '~/store/index';
+import { useRouter } from 'vue-router';
+const router = useRouter();
+const parentId = ref(router.currentRoute.value.params.id);
+const detailInfo = ref({});
+const imageData = ref([]);
+const star = ref(0);
+const evaluateData = ref([]);
+const disabled = ref(false);
+
+const onClickLeft = () => history.back();
+
+initDetailData();
+function initDetailData() {
+
+  ysgc_detail({ yz_id: parentId.value }).then((res) => {
+    if (res.code == 1) {
+      detailInfo.value = res.data.one_info;
+      imageData.value = detailInfo.value.file_list;
+      console.log(detailInfo.value)
+    }
+  })
+}
+
+initEvaluateData();
+function initEvaluateData() {
+  let obj = {
+    yz_id: parentId.value,
+    limit: "9999"
+  }
+  ysgc_evaluate_list(obj).then((res) => {
+    if (res.code == 1) {
+      evaluateData.value = res.data.page_data;
+      disabled.value = res.template.check_myexist == 1 ? true : false;
+    }
+  })
+}
+
+const handleComment = () => {
+  let obj = {
+    yze_user_realname: user.user_realname,
+    yze_star: this.pjInfo.yze_star,
+    yz_id: id,
+    yze_id: this.pjInfo.yze_id,
+  }
+  ysgc_addEvaluate(obj).then((res) => {
+    if (res.code == 1) {
+      evaluateData.value = res.data.page_data;
+      disabled.value = res.template.check_myexist == 1 ? true : false;
+    }
+  })
+}
+</script>
+
+<style lang="scss" scoped>
+.detailContent {
+  height: 100vh;
+  background: #fcfeff;
+  overflow: auto;
+  .tip {
+    color: #00a3ff;
+    font-size: 12px;
+    white-space: nowrap;
+  }
+  :deep(.swiperContent) {
+    background: #f5f9f9;
+    height: 60%;
+    border-radius: 6px;
+    .van-swipe {
+      height: 100%;
+    }
+  }
+  .commentDiv {
+    .van-button--round {
+      width: 80px;
+      background: linear-gradient(90deg, #00a3ff, #57c38f);
+      border: none;
+    }
+    .user {
+      font-size: 14px;
+      color: #171721;
+    }
+    .time {
+      font-size: 12px;
+      color: #8083a3;
+    }
+    .van-divider {
+      margin: 8px 0;
+    }
+  }
+}
+</style>

+ 174 - 0
src/pages/ysgc/index.vue

@@ -0,0 +1,174 @@
+<template>
+  <div class="ysgcContent">
+    <van-nav-bar left-arrow title="艺术广场" @click-left="onClickLeft" />
+
+    <van-swipe class="mb-5" :loop="false" :width="144" :show-indicators="false">
+      <van-swipe-item v-for="(item, index) in swiperData" :key="index">
+        <van-image :src="getFullUrl(item.yz_img)" />
+      </van-swipe-item>
+    </van-swipe>
+
+    <van-tabs v-model:active="activeName" @change="handleChange">
+      <van-tab title="学生优秀作品" name="1"></van-tab>
+      <van-tab title="教师优秀作品" name="2"></van-tab>
+    </van-tabs>
+
+    <van-search v-model="keyword" shape="round" placeholder="搜索你要看的内容" @search="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 activeName = ref("1");
+const swiperData = ref([]);
+
+const onClickLeft = () => history.back();
+
+const handleChange = () => {
+  listData.value = [];
+  currentPage.value = 1;
+  onRefresh();
+}
+
+const handleSearch = () => {
+  listData.value = [];
+  currentPage.value = 1;
+  onRefresh();
+}
+
+const total = ref(0);
+const limit = ref(12);
+const currentPage = ref(1);
+function initData() {
+  if (refreshing.value) {
+    listData.value = [];
+    refreshing.value = false;
+  }
+
+  let obj = {
+    page: currentPage.value,
+    limit: limit.value,
+    keyword: keyword.value,
+    yz_type: activeName.value,
+  }
+  loading.value = true;
+  ysgc_list(obj).then((res) => {
+    if (res.code == 1) {
+      listData.value = listData.value.concat(res.data.page_data);
+      if (swiperData.value.length == 0) {
+        swiperData.value = listData.value.filter((item, index) => index < 4);
+      }
+      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>
+.ysgcContent {
+  height: 100vh;
+  background: #fcfeff;
+  overflow: auto;
+  :deep(.van-swipe) {
+    .van-swipe-item:not(:last-child) {
+      padding-right: 8px;
+    }
+    .van-image {
+      display: block;
+      img {
+        border-radius: 6px;
+        height: 96px;
+      }
+    }
+  }
+  .van-tabs {
+    box-shadow: 0px 1px 2px 0px rgba(153, 160, 168, 0.18);
+  }
+  :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>

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

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

+ 58 - 4
src/store/index.ts

@@ -1,4 +1,58 @@
-export const token = '2d0ee1JYallYIYnP933n6e1SAChayy9g9HiFlJr2Uqqex_b8iQSgqf9ai1uJYjiR2xUbl9FwcAL2mi6AxNzoTGENzp7H5Ib0'
-export const userId = '2'
-export const client = ''
-export const userRoleId = ''
+// export const token = '01c54JHFBaaOkzA6XETYWgkxbxorMrroEyjBLls9Gpcc5BU7634OMG_bLyWXBxYA4jfrr6ij_aviuT5F8iLB3nTUFSg39xwEAlvQ'
+// export const userId = '2'
+// export const client = ''
+// export const userRoleId = ''
+
+const userInfo = {
+  "user_id": "100",
+  "user_name": "tyyxadmin",
+  "user_realname": "局管理",
+  "user_password": "b923bc037bffebe673963ddd046c7306990ea7aa",
+  "user_group_id": "1",
+  "user_role_id": "69",
+  "user_level_id": "1",
+  "user_detail_id": null,
+  "user_score": "23",
+  "modify_dateline": "1616403054",
+  "create_dateline": "1616403054",
+  "isdelete": "0",
+  "area_id1": "0",
+  "area_id2": "0",
+  "area_id3": "0",
+  "area_id4": "0",
+  "sm_id": "0",
+  "sm_admin": "0",
+  "cm_id": "0",
+  "cm_admin": "0",
+  "user_phone": "",
+  "phone_validation": "0",
+  "parent_user_id": null,
+  "user_nickname": null,
+  "user_avatar": "https://ossdownload.bozedu.net/template/default/static/img/avatar_student_small.png",
+  "user_email": null,
+  "email_validation": "0",
+  "email_token": null,
+  "email_token_exptime": null,
+  "ischeck": "1",
+  "student_no": null,
+  "address": null,
+  "gender": null,
+  "about": null,
+  "qq": null,
+  "openid": "",
+  "webchatopenid": null,
+  "user_level": "1",
+  "user_birthday": "",
+  "grade_id": null,
+  "create_user_id": null,
+  "user_dept": "",
+  "user_cardno": null,
+  "dept_id": "",
+  "user_eyear": "0",
+  "user_grade_num": "0",
+  "user_class_num": "0",
+  "last_token": null,
+  "last_login": null,
+  "token": "01c54JHFBaaOkzA6XETYWgkxbxorMrroEyjBLls9Gpcc5BU7634OMG_bLyWXBxYA4jfrr6ij_aviuT5F8iLB3nTUFSg39xwEAlvQ"
+}
+export default userInfo

+ 3 - 1
src/utils/request.ts

@@ -1,7 +1,8 @@
 import axios from 'axios'
 import type { AxiosRequestConfig } from 'axios'
 import { showFailToast } from 'vant'
-import { token } from '~/store/index'
+import userInfo from '~/store/index';
+const token = userInfo.token;
 
 const _request = axios.create({
   baseURL: window.GLOBAL_CONFIG.api,
@@ -23,6 +24,7 @@ _request.interceptors.request.use(
           token,
           client: 'web',
           api: 'json',
+          site: "tyyx",
           issubmit: (config.url?.endsWith('add') || config.url?.endsWith('edit')) ? '1' : undefined,
         },
         config.data)