Forráskód Böngészése

Merge branch 'master' of http://git.dgtis.com/zhangningning/ali_ai_learn_web into dev-yxk

yinxiangke 1 hónapja
szülő
commit
707184ca0c

+ 8 - 0
src/api/common.js

@@ -3,4 +3,12 @@ import request from './request.js'
 // 上传文件
 export function uploadFile(data = {}) {
   return request.post('/upload',data)
+}
+/* 是否购买资源
+ * buyType  1-工作流  2-课程 
+ * chapterId  章节id(buyType为2必填)
+ * publishId  工作流id(buyType为1必填)
+ */
+export function purchase(data = {}) {
+  return request.get('/common/purchase',data)
 }

+ 5 - 1
src/api/course.js

@@ -9,12 +9,16 @@ export function getCourseList(data = {}) {
 export function getCourseDetail(data = {}) {
   return request.get('/course/'+data.id)
 }
+// 查询登录人记过笔记的课程列表(笔记列表旁边的课程列表)
+export function getCourseWithNotesList(data = {}) {
+  return request.get('/course/coursesWithNotesList')
+}
 // 获取课程标签
 //学习阶段  bus_study_stage
 //教程分类  bus_course_category
 //技能标签  bus_skill_tag
 export function getDictType(data = {}) {
-  return request.get('/system/dict/type')
+  return request.get('/system/dict/type',data)
 }
 // 查询章节列表
 export function getChaptersList(data = {}) {

+ 6 - 0
src/api/mall.js

@@ -0,0 +1,6 @@
+import request from './request.js'
+
+// 查询商城列表
+export function getMallList(data = {}) {
+  return request.get('/mall/list',data)
+}

+ 14 - 9
src/components/Pagination.vue

@@ -1,14 +1,19 @@
 <!-- src/components/Pagination.vue -->
 <template>
-  <div class="pagination-container">
-    <el-pagination
-      background
-      layout="prev, pager, next, total"
-      :total="total"
-      :page-size="pageSize"
-      :current-page="currentPage"
-      @current-change="handleCurrentChange"
-    />
+  <div>
+    <div v-if="total === 0" >
+      <el-empty :image-size="200" />
+    </div>
+    <div class="pagination-container">
+      <el-pagination
+        background
+        layout="prev, pager, next, total"
+        :total="total"
+        :page-size="pageSize"
+        :current-page="currentPage"
+        @current-change="handleCurrentChange"
+      />
+    </div>
   </div>
 </template>
 

+ 25 - 18
src/pages/LearnNote/LearnNote.vue

@@ -3,31 +3,32 @@
     <Breadcrumb />
     <div class="flex-between">
       <div class="detail_right">
-        <div class="padding16 bg_color_fff border_radius_10">
+        <div class="padding16 bg_color_fff border_radius_10 box_shadow_card">
           <div class="gap10">
             <div class="line_vertical"></div>
             <div class="font_size20 bold">课程笔记列表</div>
           </div>
-          <div class="flex-between mt10 course_List" 
-          :class="{'active': item === 1}"
-          v-for="item in 5" :key="item">
-            <img src="" alt="" style="width: 160px; height: 90px;" class="border_radius_8 bg_color_f5">
+          <div class="flex-between mt10 course_List cursor-pointer" 
+          @click="selectedItem = item"
+          :class="{'active': item.courseId === selectedItem.courseId}"
+          v-for="item in list" :key="item">
+            <img :src="item.coverImageUrl" alt="" style="width: 160px; height: 90px;" class="border_radius_8 bg_color_f5">
             <div class="flex_1 ml20">
-              <div class="font_size18 bold">课程笔记标题</div>
-              <div class="font_size14 line2 gray mt10">- 本文介绍两款开源的密码破解工具John the Ripp...</div>
+              <div class="font_size18 bold">{{ item.courseTitle }}</div>
+              <div class="font_size14 line2 gray mt10">{{ item.courseIntro }}</div>
             </div>
           </div>
         </div>
       </div>
-      <div class="flex_1 ml20 fit_content">
-        <noteList />
+      <div class="flex_1 ml20 fit_content bg_color_fff border_radius_10 padding16 box_shadow_card">
+        <Xuxibiji :info="selectedItem" />
       </div>
     </div>
   </div>
 </template>
 <script setup>
-
-import noteList from '@/pages/LearnNote/components/noteList.vue'
+import Xuxibiji from '@/pages/LearningSystem/components/xuxibiji.vue'
+import { getCourseWithNotesList } from '@/api/course.js'
 
 
 import { ref, onMounted } from 'vue'
@@ -35,23 +36,29 @@ import { useRoute } from 'vue-router'
 import { useAppStore } from '@/pinia/appStore'
 const appStore = useAppStore()
 const route = useRoute()
-const query = route.query;
-const learnNoteId = ref(query.learnNoteId || '');
-const learnNoteDetail = ref({})
+const list = ref({})
+const selectedItem = ref({})
+
 onMounted(() => {
-  // getLearnNoteDetailFn();
+  getList();
 });
-const getLearnNoteDetailFn = async () => {
-   getLearnNoteDetail({learnNoteId: learnNoteId.value}).then(res => {
+const getList = async () => {
+   getCourseWithNotesList().then(res => {
     if(res.code === 200){
       console.log(res)
-      learnNoteDetail.value = res.data || {};
+      list.value = res.rows || [];
+      if(list.value.length > 0){
+        selectedItem.value = list.value[0]
+      }
     }
   })
 };
 </script>
 <style lang="scss">
 .LearnNote{
+  .detail_right{
+    max-height: calc(100% - 100px);
+  }
   .course_List{
     padding: 16px;
     border-radius: 16px;

+ 0 - 101
src/pages/LearnNote/components/noteList.vue

@@ -1,101 +0,0 @@
-<template>
-  <div class="xuxibiji">
-    <div class="list_item padding16 border_radius_16 flex-center-between bg_color_fff mb20" 
-    v-for="(item, index) in 4" :key="index">
-      <div class="flex_1">
-        <div class="bold font_size18">这是笔记名称</div>
-        <div class="gray999 mt5">{{$t('common.genxinyu')}} 2025-11-08 03:26</div>
-      </div>
-      <div>
-        <el-button type="primary" plain size="large" @click="openAddDialog()">
-          <el-icon><EditPen /></el-icon>
-          <span class="ml10">{{$t('common.edit')}}</span>
-        </el-button>
-        <el-button type="danger" plain size="large" @click="del(index)">
-          <el-icon><Delete /></el-icon>
-          <span class="ml10">{{$t('common.delete')}}</span>
-        </el-button>
-      </div>
-    </div>
-    <Pagination 
-      :total="listTotal"
-      :page-size="searchFom.pageSize"
-      :current-page="searchFom.pageNum"
-      @page-change="handlePageChange"
-    />
-    <BlockNoteEditorDialog ref="blockNoteEditorDialogRef" />
-  </div>
-</template>
-<script setup>
-import { ElMessageBox } from 'element-plus'
-import addIcon from '@/assets/imgs/add.png'
-import BlockNoteEditorDialog from '@/components/BlockNoteEditorDialog.vue'
-import Pagination from '@/components/Pagination.vue'
-import { getCourseList } from '@/api/course.js'
-import { ref, onMounted,reactive } from 'vue'
-import { useAppStore } from '@/pinia/appStore'
-const appStore = useAppStore()
-defineProps({
-  info: {
-    type: Object,
-    default: () => ({})
-  }
-})
-const comments = ref('');
-const listTotal = ref(0);
-const searchFom = reactive({
-  pageNum: 1,
-  pageSize: 10,
-})
-const list = ref([]);
-
-onMounted(() => {
-  getList();
-});
-
-const handlePageChange = (page) => {
-  searchFom.pageNum = page
-  // 这里可以添加获取数据的逻辑
-  console.log('当前页:', page);
-  getList();
-}
-// 查询寻找工作流列表
-const getList = async (type) => {
-  if(type === 'init'){
-    searchFom.pageNum = 1
-  }
-  // const res = await getQuestList(searchFom)
-  // if(res.code === 200){
-  //   listTotal.value = res.total
-  //   list.value = res.rows
-  // }
-};
-// 打开添加对话框
-const blockNoteEditorDialogRef = ref(null)
-const openAddDialog = () => {
-  blockNoteEditorDialogRef.value.openDialog();
-};
-// 删除笔记
-const del = (index) => {
-  // list.value.splice(index, 1)
-  ElMessageBox.confirm('确定删除吗?', '提示', {
-    confirmButtonText: '确定',
-    cancelButtonText: '取消',
-    type: 'warning'
-  }).then(() => {
-    getList();
-  }).catch(() => {
-    // 取消删除
-  });
-};
-</script>
-<style scoped lang="scss">
-.xuxibiji{
-  .addBtn{
-    cursor: pointer;
-    margin-top: 20px;
-    padding: 10px 20px;
-    color: #fff;
-  }
-}
-</style>

+ 33 - 34
src/pages/LearningSystem/LearningSystem.vue

@@ -25,16 +25,16 @@
       <Breadcrumb />
       <div class="padding12 bg_color_fff border_radius_16 box_shadow_card">
         <div class="typeList flex-between typeborder">
-          <div class="gray font_size14 typeName">学习分类:</div>
+          <div class="gray font_size14 typeName">学习阶段:</div>
           <div class="flex_1 gap10">
-            <div class="font_size14 typeItem"  :class="{'active':searchFom.categoryId2 === ''}"
-            @click="searchFom.categoryId2 = ''; searchFom.categoryId3 = '';getList('init');categoryListTree2=[]"
+            <div class="font_size14 typeItem"  :class="{'active':searchFom.studyStage === ''}"
+            @click="searchFom.studyStage === '';getList('init');"
             :key="-1">
               全部
             </div>
             <div class="font_size14 typeItem" 
-             v-for="item in categoryListTree" :key="item.categoryId"
-             :class="{'active':searchFom.categoryId2 === item.categoryId}"
+             v-for="item in bus_study_stage" :key="item.studyStage"
+             :class="{'active':searchFom.studyStage === item.studyStage}"
              @click="searchFom.categoryId2 = item.categoryId;searchFom.categoryId3 = '';categoryListTree2=[]; getList('init');getCategoryListTreeFn2();">
               {{item.categoryName}}
             </div>
@@ -43,15 +43,15 @@
         <div class="typeList flex-between typeborder">
           <div class="gray font_size14 typeName">教程分类:</div>
           <div class="flex_1 gap10">
-            <div class="font_size14 typeItem"  :class="{'active':searchFom.categoryId2 === ''}"
-            @click="searchFom.categoryId2 = ''; searchFom.categoryId3 = '';getList('init');categoryListTree2=[]"
+            <div class="font_size14 typeItem"  :class="{'active':searchFom.courseCategory === ''}"
+            @click="searchFom.courseCategory === '';getList('init');"
             :key="-1">
               全部
             </div>
             <div class="font_size14 typeItem" 
-             v-for="item in categoryListTree" :key="item.categoryId"
-             :class="{'active':searchFom.categoryId2 === item.categoryId}"
-             @click="searchFom.categoryId2 = item.categoryId;searchFom.categoryId3 = '';categoryListTree2=[]; getList('init');getCategoryListTreeFn2();">
+             v-for="item in bus_course_category" :key="item.courseCategory"
+             :class="{'active':searchFom.courseCategory === item.courseCategory}"
+             @click="getList('init');">
               {{item.categoryName}}
             </div>
           </div>
@@ -59,15 +59,15 @@
         <div class="typeList flex-between">
           <div class="gray font_size14 typeName">技能标签:</div>
           <div class="flex_1 gap10">
-            <div class="font_size14 typeItem"  :class="{'active':searchFom.categoryId3 === ''}"
-            @click="searchFom.categoryId3 = ''; getList('init');"
+            <div class="font_size14 typeItem"  :class="{'active':searchFom.skillTag === ''}"
+            @click="searchFom.skillTag = ''; getList('init');"
             :key="-1">
               全部
             </div>
             <div class="font_size14 typeItem" 
-             v-for="item in categoryListTree2" :key="item.categoryId"
-             :class="{'active':searchFom.categoryId3 === item.categoryId}"
-             @click="searchFom.categoryId3 = item.categoryId; getList('init');">
+             v-for="item in bus_skill_tag" :key="item.skillTag"
+             :class="{'active':searchFom.skillTag === item.skillTag}"
+             @click="searchFom.skillTag = item.skillTag; getList('init');">
               {{item.categoryName}}
             </div>
           </div>
@@ -105,7 +105,7 @@
       <!-- 分页 -->
       <!-- 替换原有的分页代码 -->
       <Pagination 
-        :total="searchFom.total"
+        :total="listTotal"
         :page-size="searchFom.pageSize"
         :current-page="searchFom.pageNum"
         @page-change="handlePageChange"
@@ -124,7 +124,7 @@
   import Pagination from '@/components/Pagination.vue'
 
   import { getCategoryListTree } from '@/api/category.js'
-  import { getCourseList } from '@/api/course.js'
+  import { getCourseList, getDictType } from '@/api/course.js'
 
   import { isLogin } from '@/utils/util.js'
   import { useI18n } from 'vue-i18n' 
@@ -159,26 +159,27 @@
 
 
   // 一级分类列表
-  const categoryListTree = ref([]);
-  // 二级分类列表
-  const categoryListTree2 = ref([]);
+  const bus_study_stage = ref([]);
+  const bus_course_category = ref([]);
+  const bus_skill_tag = ref([]);
   // 活动平台
 
   // 添加分页相关数据
   const list = ref([]);
   const listTotal = ref(0);
   const searchFom = reactive({
-    categoryId1: categoryId.value,
-    categoryId2: '',
-    categoryId3: '',
-    workflowTitle: '',
+    studyStage: '',
+    courseCategory: '',
+    skillTag: '',
     pageNum: 1,
     pageSize: 10,
   })
 
   onMounted(() => {
     getList();
-    getCategoryListTreeFn();
+    getDictTypeFn('bus_study_stage');
+    getDictTypeFn('bus_course_category');
+    getDictTypeFn('bus_skill_tag');
   })
 
    // 列表
@@ -214,16 +215,14 @@
     })
   };
 
-  const getCategoryListTreeFn = () => {
-    getCategoryListTree({categoryId: categoryId.value}).then(res => {
-      console.log(res)
-      categoryListTree.value = res.rows || [];
-    })
-  };
-  const getCategoryListTreeFn2 = () => {
-    getCategoryListTree({categoryId: searchFom.categoryId2}).then(res => {
+  //// 获取课程标签
+//学习阶段  bus_study_stage
+//教程分类  bus_course_category
+//技能标签  bus_skill_tag
+  const getDictTypeFn = (dictType) => {
+    getDictType({dictType}).then(res => {
       console.log(res)
-      categoryListTree2.value = res.rows || [];
+      [dictType].value = res.rows || [];
     })
   };
 

+ 1 - 1
src/pages/LearningSystem/components/xuxibiji.vue

@@ -4,7 +4,7 @@
       <div class="line_vertical"></div>
       <div class="font_size18 bold">{{$t('common.xuxibiji')}}</div>
     </div>
-    <div class="addBtn flex-center gradient border_radius_10" @click="openAddDialog">
+    <div class="addBtn flex-center gradient border_radius_10" @click="openAddDialog" v-if="info.courseId">
       <div class="gap10">
         <img :src="addIcon" alt="" style="width:30px;height:30px">
         <span class="font_size18">{{$t('common.add')}}{{$t('common.xuxibiji')}}</span>

+ 35 - 16
src/pages/mibiShop/mibiShop.vue

@@ -3,16 +3,28 @@
     <Breadcrumb />
     <div class="list">
       <div class="list_item bg_color_fff border_radius_16 box_shadow_card"
-      v-for="item in 10" :key="item"
+      v-for="item in list" :key="item"
       >
-        <img src="" alt="" style="width: 291.2px; height: 291.2px;" class="bg_color_f5">
+        <img :src="item.imageUrl" alt="" style="width: 291.2px; height: 291.2px;border-radius: 16px 16px 0 0;" class="bg_color_f5">
         <div class="item_info padding16">
           <div class="line2 font_size18 bold line_height24">
-            {{item==1?'小红xhs书虚拟电商赚钱项目开店选品定价上架自动发货在...':'小红xhs书虚拟'}}
+            {{item.itemName}}
           </div>
           <div class="flex-center-between">
-            <div class="bold color_price font_size20">900米币</div>
-            <div class="border_radius_4 lijiduihuan  color_fff gradient font_size14 flex-center mt10">
+            <div class="bold color_price font_size20">{{item.points}}{{$t('common.mibi')}}</div>
+            <div class="border_radius_4 lijiduihuan  color_fff gradient font_size14 flex-center mt10"
+             @click="confirmBuy({
+                callback:initList,
+                appStore,
+                router,
+                type:'pointsBalance',
+                price:item.points,
+                t,
+                productId:item.itemId,
+                orderType:'mi_mall',
+                payMethod:'MI'
+              })"
+            >
               立即兑换
             </div>
           </div>
@@ -30,12 +42,14 @@
 <script setup>
 import Pagination from '@/components/Pagination.vue'
 import { ref, onMounted,reactive } from 'vue'
-import { useRoute } from 'vue-router'
+import { useRouter } from 'vue-router'
 import { useAppStore } from '@/pinia/appStore'
+import { getMallList } from '@/api/mall.js'
+import { confirmBuy } from '@/utils/util.js'
+import { useI18n } from 'vue-i18n' 
+const { t } = useI18n() 
 const appStore = useAppStore()
-const route = useRoute()
-const query = route.query;
-const learnNoteId = ref(query.learnNoteId || '');
+const router = useRouter()
 
 
 // 添加分页相关数据
@@ -43,10 +57,10 @@ const list = ref([]);
 const listTotal = ref(0);
 const searchFom = reactive({
   pageNum: 1,
-  pageSize: 10,
+  pageSize: 20,
 })
 onMounted(() => {
-  // getList();
+  getList('init');
 });
 
 const handlePageChange = (page) => {
@@ -55,18 +69,23 @@ const handlePageChange = (page) => {
   console.log('当前页:', page);
   getList();
 }
+const initList = ()=>{
+  getList('init');
+};
 // 查询寻找工作流列表
 const getList = async (type) => {
   if(type === 'init'){
     searchFom.pageNum = 1
   }
-  // const res = await getQuestList(searchFom)
-  // if(res.code === 200){
-  //   listTotal.value = res.total
-  //   list.value = res.rows
-  // }
+  const res = await getMallList(searchFom)
+  if(res.code === 200){
+    listTotal.value = res.total || 0;
+    list.value = res.rows || [];
+  }
 };
 
+
+
 </script>
 <style lang="scss">
 .mibiShop{

+ 2 - 1
src/utils/util.js

@@ -48,7 +48,8 @@ export function formatDeadline(deadline) {
   const diffHours = Math.ceil(diffTime / (1000 * 60 * 60)) % 24;
   return {diffDays,diffHours};
 }
-export function confirmBuy({type='baoMiBalance',price=0,callback,appStore,router,t,payMethod,orderType,productId}){
+//type: pointsBalance  pointsBalance
+export function confirmBuy({type='pointsBalance',price=0,callback,appStore,router,t,payMethod,orderType,productId}){
   const balance = appStore.userInfo?.[type] || 0;
   if(balance < price ){
     ElMessageBox.confirm('您的余额不足,是否前往充值?', t('common.tip'), {