|
@@ -17,18 +17,12 @@
|
|
|
<div class="nav" :class="{ active: navActive == 4 }" @click="navClick(4)">最多收藏</div>
|
|
<div class="nav" :class="{ active: navActive == 4 }" @click="navClick(4)">最多收藏</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="Box">
|
|
<div class="Box">
|
|
|
- <div class="video_box video_box2" v-for="(item, index) in paginatedData" :key="index">
|
|
|
|
|
- <div class="video-checkbox">
|
|
|
|
|
- <el-checkbox
|
|
|
|
|
- :value="isVideoSelected(item)"
|
|
|
|
|
- @change="toggleVideoSelection(item)"
|
|
|
|
|
- ></el-checkbox>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div class="video_box video_box2" v-for="(item, index) in data" :key="index">
|
|
|
<!-- <img :src="item.pic" /> -->
|
|
<!-- <img :src="item.pic" /> -->
|
|
|
<span class="name" v-html="item.title"></span>
|
|
<span class="name" v-html="item.title"></span>
|
|
|
<span class="author">作者:{{ item.author }}</span>
|
|
<span class="author">作者:{{ item.author }}</span>
|
|
|
<span class="detail">{{ item.description }}</span>
|
|
<span class="detail">{{ item.description }}</span>
|
|
|
- <div class="tag" v-if="item.tag && typeof item.tag === 'string' && item.tag.split(',').length > 0">
|
|
|
|
|
|
|
+ <div class="tag" v-if="item.tag.split(',').length > 0">
|
|
|
<el-tooltip :content="tag" placement="top" effect="dark" v-for="(tag, index) in item.tag.split(',').slice(0, 5)" :key="index">
|
|
<el-tooltip :content="tag" placement="top" effect="dark" v-for="(tag, index) in item.tag.split(',').slice(0, 5)" :key="index">
|
|
|
<!-- content to trigger tooltip here -->
|
|
<!-- content to trigger tooltip here -->
|
|
|
<span >{{ tag }}</span>
|
|
<span >{{ tag }}</span>
|
|
@@ -42,26 +36,6 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div v-if="data.length == 0" class="no_data">暂无数据</div>
|
|
<div v-if="data.length == 0" class="no_data">暂无数据</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <!-- 分页控件 -->
|
|
|
|
|
- <div class="pagination-box" v-if="data.length > 0">
|
|
|
|
|
- <el-button
|
|
|
|
|
- :disabled="currentPage === 1"
|
|
|
|
|
- @click="prevPage"
|
|
|
|
|
- size="small"
|
|
|
|
|
- >←上一页</el-button>
|
|
|
|
|
- <span class="page-info">第 {{ currentPage }} / {{ totalPages }} 页</span>
|
|
|
|
|
- <el-button
|
|
|
|
|
- :disabled="currentPage >= totalPages"
|
|
|
|
|
- @click="nextPage"
|
|
|
|
|
- size="small"
|
|
|
|
|
- >下一页→</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- <!-- 批量操作 -->
|
|
|
|
|
- <div class="batch-actions" v-if="selectedVideos.length > 0">
|
|
|
|
|
- <span class="selected-count">已选中 {{ selectedVideos.length }} 个视频</span>
|
|
|
|
|
- <el-button type="primary" size="small" @click="batchAdd">批量加入</el-button>
|
|
|
|
|
- <el-button size="small" @click="clearSelection">清空选择</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="close">关 闭</el-button>
|
|
<el-button @click="close">关 闭</el-button>
|
|
@@ -85,10 +59,6 @@ export default {
|
|
|
type: String,
|
|
type: String,
|
|
|
default: ""
|
|
default: ""
|
|
|
},
|
|
},
|
|
|
- grade: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: ""
|
|
|
|
|
- },
|
|
|
|
|
courseState: {
|
|
courseState: {
|
|
|
type: Number,
|
|
type: Number,
|
|
|
},
|
|
},
|
|
@@ -119,33 +89,15 @@ export default {
|
|
|
url: "",
|
|
url: "",
|
|
|
data: [],
|
|
data: [],
|
|
|
uJson: {},
|
|
uJson: {},
|
|
|
- navActive: 0,
|
|
|
|
|
- selectedVideos: [], // 选中的视频列表
|
|
|
|
|
- currentPage: 1, // 当前页码
|
|
|
|
|
- pageSize: 20, // 每页显示数量
|
|
|
|
|
- totalPages: 1 // 总页数
|
|
|
|
|
|
|
+ navActive: 0
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
dialogVisibleAiCreateVideo(newValue, oldValue) {
|
|
dialogVisibleAiCreateVideo(newValue, oldValue) {
|
|
|
if (newValue) {
|
|
if (newValue) {
|
|
|
- this.selectedVideos = [];
|
|
|
|
|
- // 默认以课程标题和年级为关键词
|
|
|
|
|
- let keywords = [];
|
|
|
|
|
- if (this.courseName) {
|
|
|
|
|
- keywords.push(this.courseName);
|
|
|
|
|
- }
|
|
|
|
|
- if (this.grade) {
|
|
|
|
|
- keywords.push(this.grade);
|
|
|
|
|
- }
|
|
|
|
|
- this.detail = keywords.join(',');
|
|
|
|
|
- this.data = [];
|
|
|
|
|
- this.currentPage = 1;
|
|
|
|
|
- if (this.detail) {
|
|
|
|
|
- this.searchA();
|
|
|
|
|
- } else {
|
|
|
|
|
- this.againEva();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.detail = ""
|
|
|
|
|
+ this.data = []
|
|
|
|
|
+ this.againEva()
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -280,16 +232,14 @@ export default {
|
|
|
let _data = await _this.aiGet2(_content[a])
|
|
let _data = await _this.aiGet2(_content[a])
|
|
|
data2[a] = _data
|
|
data2[a] = _data
|
|
|
}
|
|
}
|
|
|
- _this.data = _.flatMap(_.zip(...data2), (pair) => pair.filter(value => value !== undefined))
|
|
|
|
|
- // _this.data = _this.data.sort(
|
|
|
|
|
- // function (a, b) {
|
|
|
|
|
- // return b.play - a.play;
|
|
|
|
|
- // }
|
|
|
|
|
- // );
|
|
|
|
|
- _this.againEva2();
|
|
|
|
|
- _this.currentPage = 1;
|
|
|
|
|
- _this.updateTotalPages();
|
|
|
|
|
- // _this.loading = false
|
|
|
|
|
|
|
+ _this.data = _.flatMap(_.zip(...data2), (pair) => pair.filter(value => value !== undefined))
|
|
|
|
|
+ // _this.data = _this.data.sort(
|
|
|
|
|
+ // function (a, b) {
|
|
|
|
|
+ // return b.play - a.play;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // );
|
|
|
|
|
+ _this.againEva2();
|
|
|
|
|
+ // _this.loading = false
|
|
|
} catch (error){
|
|
} catch (error){
|
|
|
console.log(error);
|
|
console.log(error);
|
|
|
_this.loading = false
|
|
_this.loading = false
|
|
@@ -338,8 +288,6 @@ export default {
|
|
|
// }
|
|
// }
|
|
|
// );
|
|
// );
|
|
|
_this.againEva2();
|
|
_this.againEva2();
|
|
|
- _this.currentPage = 1;
|
|
|
|
|
- _this.updateTotalPages();
|
|
|
|
|
}else {
|
|
}else {
|
|
|
_this.$message.error("哎呀,请求太多了,服务器忙不过来了,请自行搜索关键词")
|
|
_this.$message.error("哎呀,请求太多了,服务器忙不过来了,请自行搜索关键词")
|
|
|
_this.loading = false
|
|
_this.loading = false
|
|
@@ -406,7 +354,6 @@ export default {
|
|
|
return aid.indexOf(el.aid) === -1
|
|
return aid.indexOf(el.aid) === -1
|
|
|
})
|
|
})
|
|
|
_this.$forceUpdate()
|
|
_this.$forceUpdate()
|
|
|
- _this.updateTotalPages();
|
|
|
|
|
}
|
|
}
|
|
|
_this.loading = false
|
|
_this.loading = false
|
|
|
})
|
|
})
|
|
@@ -414,60 +361,8 @@ export default {
|
|
|
console.log(error);
|
|
console.log(error);
|
|
|
// _this.$message.error("哎呀,请求太多了,服务器忙不过来了,请自行搜索关键词")
|
|
// _this.$message.error("哎呀,请求太多了,服务器忙不过来了,请自行搜索关键词")
|
|
|
_this.loading = false
|
|
_this.loading = false
|
|
|
- _this.updateTotalPages();
|
|
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- // 检查视频是否被选中
|
|
|
|
|
- isVideoSelected(item) {
|
|
|
|
|
- return this.selectedVideos.some(v => v.bvid === item.bvid);
|
|
|
|
|
- },
|
|
|
|
|
- // 切换视频选择状态
|
|
|
|
|
- toggleVideoSelection(item) {
|
|
|
|
|
- const index = this.selectedVideos.findIndex(v => v.bvid === item.bvid);
|
|
|
|
|
- if (index > -1) {
|
|
|
|
|
- this.selectedVideos.splice(index, 1);
|
|
|
|
|
- } else {
|
|
|
|
|
- this.selectedVideos.push(item);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- // 批量添加选中的视频
|
|
|
|
|
- batchAdd() {
|
|
|
|
|
- if (this.selectedVideos.length === 0) {
|
|
|
|
|
- this.$message.warning('请先选择要添加的视频');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- this.selectedVideos.forEach(video => {
|
|
|
|
|
- this.checkUrl(video.title, video.bvid);
|
|
|
|
|
- });
|
|
|
|
|
- this.$message.success(`成功添加 ${this.selectedVideos.length} 个视频`);
|
|
|
|
|
- this.selectedVideos = [];
|
|
|
|
|
- },
|
|
|
|
|
- // 清空选择
|
|
|
|
|
- clearSelection() {
|
|
|
|
|
- this.selectedVideos = [];
|
|
|
|
|
- },
|
|
|
|
|
- // 更新总页数
|
|
|
|
|
- updateTotalPages() {
|
|
|
|
|
- this.totalPages = Math.ceil(this.data.length / this.pageSize);
|
|
|
|
|
- },
|
|
|
|
|
- // 获取当前页的数据
|
|
|
|
|
- get paginatedData() {
|
|
|
|
|
- const start = (this.currentPage - 1) * this.pageSize;
|
|
|
|
|
- const end = start + this.pageSize;
|
|
|
|
|
- return this.data.slice(start, end);
|
|
|
|
|
- },
|
|
|
|
|
- // 上一页
|
|
|
|
|
- prevPage() {
|
|
|
|
|
- if (this.currentPage > 1) {
|
|
|
|
|
- this.currentPage--;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- // 下一页
|
|
|
|
|
- nextPage() {
|
|
|
|
|
- if (this.currentPage < this.totalPages) {
|
|
|
|
|
- this.currentPage++;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
},
|
|
},
|
|
|
mounted () {
|
|
mounted () {
|
|
|
|
|
|
|
@@ -701,45 +596,6 @@ export default {
|
|
|
padding: 5px 10px 10px;
|
|
padding: 5px 10px 10px;
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
|
border-radius: 5px;
|
|
border-radius: 5px;
|
|
|
- position: relative;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.video-checkbox {
|
|
|
|
|
- position: absolute;
|
|
|
|
|
- top: 10px;
|
|
|
|
|
- left: 10px;
|
|
|
|
|
- z-index: 10;
|
|
|
|
|
- background: rgba(255, 255, 255, 0.9);
|
|
|
|
|
- padding: 5px;
|
|
|
|
|
- border-radius: 4px;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.pagination-box {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- justify-content: center;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- margin: 20px 0;
|
|
|
|
|
- gap: 15px;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.page-info {
|
|
|
|
|
- font-size: 14px;
|
|
|
|
|
- color: #606266;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.batch-actions {
|
|
|
|
|
- display: flex;
|
|
|
|
|
- justify-content: space-between;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- padding: 15px;
|
|
|
|
|
- background: #f5f7fa;
|
|
|
|
|
- border-top: 1px solid #e4e7ed;
|
|
|
|
|
- margin-top: 20px;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.selected-count {
|
|
|
|
|
- font-size: 14px;
|
|
|
|
|
- color: #606266;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|