提交 66db47db authored 作者: 王鹏飞's avatar 王鹏飞

feat: 持久化卡片列表切换状态并优化卡片栅格布局

上级 55d41116
...@@ -63,11 +63,8 @@ const bytesToSize = (bytes: number) => { ...@@ -63,11 +63,8 @@ const bytesToSize = (bytes: number) => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.card-item { .card-item {
width: 17%;
border-radius: 6px; border-radius: 6px;
overflow: hidden; overflow: hidden;
margin-right: 20px;
margin-bottom: 20px;
box-shadow: 0 0 10px 0 rgb(0 0 0 / 10%); box-shadow: 0 0 10px 0 rgb(0 0 0 / 10%);
background: #fff; background: #fff;
.card-item-top { .card-item-top {
......
<script setup lang="ts"> <script setup lang="ts">
import { useStorage } from '@vueuse/core'
import { getVideoList, createCharacter, getCourseListSearch, getLessonList, getOtherList } from '../../api' import { getVideoList, createCharacter, getCourseListSearch, getLessonList, getOtherList } from '../../api'
import CardListItem from './CardListItem.vue' import CardListItem from './CardListItem.vue'
import { useGetCategoryList } from '@/composables/useGetCategoryList' import { useGetCategoryList } from '@/composables/useGetCategoryList'
...@@ -11,30 +12,30 @@ const path = ref('') ...@@ -11,30 +12,30 @@ const path = ref('')
let tableData: any = $ref({ let tableData: any = $ref({
list: [], list: [],
title: '', title: '',
total: '' total: '',
}) })
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const props = defineProps({ const props = defineProps({
isShowAddDialog: { isShowAddDialog: {
type: Boolean, type: Boolean,
required: true required: true,
}, },
course_id: { course_id: {
type: String, type: String,
required: true required: true,
}, },
chapterName: { chapterName: {
type: String, type: String,
required: true required: true,
}, },
chapterID: { chapterID: {
type: String, type: String,
required: true required: true,
}, },
btnInfo: { btnInfo: {
type: Object, type: Object,
required: true required: true,
} },
}) })
interface Emits { interface Emits {
(e: 'update:isShowAddDialog', isShowVideoDialog: boolean): void (e: 'update:isShowAddDialog', isShowVideoDialog: boolean): void
...@@ -45,7 +46,7 @@ let { list: selectTree }: any = useGetCategoryList() ...@@ -45,7 +46,7 @@ let { list: selectTree }: any = useGetCategoryList()
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
value: 'id' value: 'id',
} }
const typeFilter = () => { const typeFilter = () => {
appList.value.refetch() appList.value.refetch()
...@@ -77,11 +78,11 @@ const listOptions = computed(() => { ...@@ -77,11 +78,11 @@ const listOptions = computed(() => {
tableData = data tableData = data
return { list: data.list, total: data.total } return { list: data.list, total: data.total }
}, },
params: { tab: tabValue, status: '1', authorized: '', name: '', course_id: props.course_id || '' } params: { tab: tabValue, status: '1', authorized: '', name: '', course_id: props.course_id || '' },
}, },
filters: [ filters: [
{ prop: 'classification', label: '类别:', slots: 'filter-type' }, { prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' } { type: 'input', prop: 'name', label: '标题:' },
], ],
columns: [ columns: [
{ type: 'selection' }, { type: 'selection' },
...@@ -91,7 +92,7 @@ const listOptions = computed(() => { ...@@ -91,7 +92,7 @@ const listOptions = computed(() => {
align: 'center', align: 'center',
computed({ row }: any) { computed({ row }: any) {
return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name
} },
}, },
{ label: '视频分类', prop: 'classification_name', align: 'center' }, { label: '视频分类', prop: 'classification_name', align: 'center' },
{ label: '知识点', prop: 'knowledge_points', align: 'center' }, { label: '知识点', prop: 'knowledge_points', align: 'center' },
...@@ -100,9 +101,9 @@ const listOptions = computed(() => { ...@@ -100,9 +101,9 @@ const listOptions = computed(() => {
{ label: '审核状态', prop: 'audit_status_name', align: 'center' }, { label: '审核状态', prop: 'audit_status_name', align: 'center' },
{ label: '更新人', prop: 'updated_operator_name', align: 'center' }, { label: '更新人', prop: 'updated_operator_name', align: 'center' },
{ label: '更新人部门', prop: 'organ_id_name', align: 'center' }, { label: '更新人部门', prop: 'organ_id_name', align: 'center' },
{ label: '更新日期', prop: 'updated_time', align: 'center' } { label: '更新日期', prop: 'updated_time', align: 'center' },
], ],
data: tableData.list data: tableData.list,
} }
}) })
// tab切换 // tab切换
...@@ -124,7 +125,7 @@ const handleAdd = (val: any) => { ...@@ -124,7 +125,7 @@ const handleAdd = (val: any) => {
course_id: props.course_id, course_id: props.course_id,
resource_type: props.btnInfo.resource_type, resource_type: props.btnInfo.resource_type,
parent_id: props.chapterID, parent_id: props.chapterID,
resource_id: val.id resource_id: val.id,
} }
createCharacter(params).then(() => { createCharacter(params).then(() => {
emit('update:isShowAddDialog', false) emit('update:isShowAddDialog', false)
...@@ -189,7 +190,7 @@ const addRequest = function (item: any, index: number, data: any) { ...@@ -189,7 +190,7 @@ const addRequest = function (item: any, index: number, data: any) {
course_id: props.course_id, course_id: props.course_id,
resource_type: props.btnInfo.resource_type, resource_type: props.btnInfo.resource_type,
parent_id: props.chapterID, parent_id: props.chapterID,
resource_id: item.id resource_id: item.id,
} }
createCharacter(params).then(() => { createCharacter(params).then(() => {
if (index === data.length - 1) { if (index === data.length - 1) {
...@@ -202,9 +203,9 @@ const addRequest = function (item: any, index: number, data: any) { ...@@ -202,9 +203,9 @@ const addRequest = function (item: any, index: number, data: any) {
} }
// 列表切换 // 列表切换
let isCard = $ref(true) const isCard = useStorage('isCard', true)
const changeCard = () => { const changeCard = () => {
isCard = !isCard isCard.value = !isCard.value
} }
let checkBox = $ref([]) let checkBox = $ref([])
...@@ -225,8 +226,7 @@ const addVideoList = function () { ...@@ -225,8 +226,7 @@ const addVideoList = function () {
draggable draggable
:before-close="handleCancel" :before-close="handleCancel"
size="60%" size="60%"
:title="`添加${props.btnInfo.btn_name}`" :title="`添加${props.btnInfo.btn_name}`">
>
<div class="video-head"> <div class="video-head">
<el-tabs @tab-change="tabChange" v-model="tabValue"> <el-tabs @tab-change="tabChange" v-model="tabValue">
<el-tab-pane label="我的资源" name="1"></el-tab-pane> <el-tab-pane label="我的资源" name="1"></el-tab-pane>
...@@ -251,8 +251,7 @@ const addVideoList = function () { ...@@ -251,8 +251,7 @@ const addVideoList = function () {
display: block; display: block;
height: 83px; height: 83px;
background-size: cover; background-size: cover;
background-image: url(${row.cover});`" background-image: url(${row.cover});`"></div>
></div>
</div> </div>
</template> </template>
<template #filter-type="{ params }"> <template #filter-type="{ params }">
...@@ -263,8 +262,7 @@ const addVideoList = function () { ...@@ -263,8 +262,7 @@ const addVideoList = function () {
:props="defaultProps" :props="defaultProps"
v-model="params.classification" v-model="params.classification"
:data="selectTree" :data="selectTree"
:default-expanded-keys="selectTree.length ? [selectTree[0]?.id] : []" :default-expanded-keys="selectTree.length ? [selectTree[0]?.id] : []" />
/>
</template> </template>
<template #body="{ data }" v-if="isCard"> <template #body="{ data }" v-if="isCard">
<div class="card-list" v-if="data.length"> <div class="card-list" v-if="data.length">
...@@ -279,8 +277,7 @@ const addVideoList = function () { ...@@ -279,8 +277,7 @@ const addVideoList = function () {
:tabIndex="tabValue" :tabIndex="tabValue"
:data="item" :data="item"
:path="path" :path="path"
@add="handleAdd" @add="handleAdd">
>
<el-checkbox @change="checkboxSelect" v-model="item.check_status"></el-checkbox> <el-checkbox @change="checkboxSelect" v-model="item.check_status"></el-checkbox>
</CardListItem> </CardListItem>
</div> </div>
...@@ -298,8 +295,9 @@ const addVideoList = function () { ...@@ -298,8 +295,9 @@ const addVideoList = function () {
.card-list-con { .card-list-con {
background: #fafafa; background: #fafafa;
padding: 20px; padding: 20px;
display: flex; display: grid;
flex-wrap: wrap; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 20px;
} }
.video-head { .video-head {
position: relative; position: relative;
......
...@@ -70,11 +70,8 @@ const bytesToSize = (bytes: number) => { ...@@ -70,11 +70,8 @@ const bytesToSize = (bytes: number) => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.card-item { .card-item {
width: 265px;
border-radius: 6px; border-radius: 6px;
overflow: hidden; overflow: hidden;
margin-right: 20px;
margin-bottom: 20px;
.card-item-top { .card-item-top {
background: rgba(204, 204, 204, 0.5); background: rgba(204, 204, 204, 0.5);
......
...@@ -57,11 +57,9 @@ const copyCourse = () => { ...@@ -57,11 +57,9 @@ const copyCourse = () => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.card-item { .card-item {
width: 17%; background-color: #fff;
border-radius: 6px; border-radius: 6px;
overflow: hidden; overflow: hidden;
margin-right: 20px;
margin-bottom: 20px;
.card-item-top { .card-item-top {
height: 170px; height: 170px;
position: relative; position: relative;
......
<script setup lang="ts"> <script setup lang="ts">
import { useStorage } from '@vueuse/core'
import { getCourseList } from '../api' import { getCourseList } from '../api'
import CardListItem from '../components/CardListItem.vue' import CardListItem from '../components/CardListItem.vue'
import { PictureFilled } from '@element-plus/icons-vue' import { PictureFilled } from '@element-plus/icons-vue'
...@@ -23,7 +24,7 @@ const tabChange = () => { ...@@ -23,7 +24,7 @@ const tabChange = () => {
} }
// 列表切换 // 列表切换
let isCard = $ref(true) const isCard = useStorage('isCard', true)
// table 数据 // table 数据
const listOptions = computed(() => { const listOptions = computed(() => {
...@@ -34,7 +35,7 @@ const listOptions = computed(() => { ...@@ -34,7 +35,7 @@ const listOptions = computed(() => {
align: 'center', align: 'center',
computed({ row }: any) { computed({ row }: any) {
return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name
} },
}, },
{ label: '课程分类', prop: 'classification_name', align: 'center' }, { label: '课程分类', prop: 'classification_name', align: 'center' },
{ label: '封面', slots: 'table-cover', width: 150, align: 'center' }, { label: '封面', slots: 'table-cover', width: 150, align: 'center' },
...@@ -43,7 +44,7 @@ const listOptions = computed(() => { ...@@ -43,7 +44,7 @@ const listOptions = computed(() => {
{ label: '更新人', prop: 'updated_operator_name', align: 'center' }, { label: '更新人', prop: 'updated_operator_name', align: 'center' },
{ label: '更新人部门', prop: 'organ_id_name', align: 'center' }, { label: '更新人部门', prop: 'organ_id_name', align: 'center' },
{ label: '更新日期', prop: 'updated_time', align: 'center' }, { label: '更新日期', prop: 'updated_time', align: 'center' },
{ label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' } { label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' },
] ]
if (tabValue.value === '2') { if (tabValue.value === '2') {
columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' }) columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' })
...@@ -54,16 +55,16 @@ const listOptions = computed(() => { ...@@ -54,16 +55,16 @@ const listOptions = computed(() => {
return { return {
remote: { remote: {
httpRequest: getCourseList, httpRequest: getCourseList,
params: { tab: tabValue, status: '', authorized: '', name: '' } params: { tab: tabValue, status: '', authorized: '', name: '' },
}, },
filters: [ filters: [
{ type: 'input', prop: 'name', label: '名称:' }, { type: 'input', prop: 'name', label: '名称:' },
{ {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department' slots: 'filter-department',
} },
], ],
columns columns,
} }
}) })
...@@ -72,7 +73,7 @@ const typeFilter = () => { ...@@ -72,7 +73,7 @@ const typeFilter = () => {
} }
const changeCard = () => { const changeCard = () => {
isCard = !isCard isCard.value = !isCard.value
} }
</script> </script>
...@@ -144,9 +145,10 @@ const changeCard = () => { ...@@ -144,9 +145,10 @@ const changeCard = () => {
<style lang="scss" scoped> <style lang="scss" scoped>
.card-list { .card-list {
background: #fafafa; background: #fafafa;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 20px;
padding: 20px; padding: 20px;
display: flex;
flex-wrap: wrap;
} }
.video-head { .video-head {
position: relative; position: relative;
......
<script setup lang="ts"> <script setup lang="ts">
import { useStorage } from '@vueuse/core'
import { getCourseList } from '../api' import { getCourseList } from '../api'
import CardListItem from '@/components/base/CardListItem.vue' import CardListItem from '@/components/base/CardListItem.vue'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
...@@ -20,15 +21,15 @@ let { list: selectTree }: any = useGetCategoryList() ...@@ -20,15 +21,15 @@ let { list: selectTree }: any = useGetCategoryList()
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
value: 'id' value: 'id',
} }
const appList = ref() const appList = ref()
// 列表切换 // 列表切换
let isCard = $ref(true) const isCard = useStorage('isCard', true)
const changeCard = () => { const changeCard = () => {
isCard = !isCard isCard.value = !isCard.value
} }
// 资源出处 tab触发 // 资源出处 tab触发
...@@ -45,7 +46,7 @@ const listOptions = $computed(() => { ...@@ -45,7 +46,7 @@ const listOptions = $computed(() => {
align: 'center', align: 'center',
computed({ row }: any) { computed({ row }: any) {
return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name
} },
}, },
{ label: '课件分类', prop: 'classification_name', align: 'center' }, { label: '课件分类', prop: 'classification_name', align: 'center' },
{ label: '知识点', prop: 'knowledge_points', align: 'center' }, { label: '知识点', prop: 'knowledge_points', align: 'center' },
...@@ -54,7 +55,7 @@ const listOptions = $computed(() => { ...@@ -54,7 +55,7 @@ const listOptions = $computed(() => {
{ label: '更新人', prop: 'updated_operator_name', align: 'center' }, { label: '更新人', prop: 'updated_operator_name', align: 'center' },
{ label: '更新人部门', prop: 'organ_id_name', align: 'center' }, { label: '更新人部门', prop: 'organ_id_name', align: 'center' },
{ label: '更新日期', prop: 'updated_time', align: 'center' }, { label: '更新日期', prop: 'updated_time', align: 'center' },
{ label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' } { label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' },
] ]
if (tabValue.value === '2') { if (tabValue.value === '2') {
columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' }) columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' })
...@@ -65,23 +66,23 @@ const listOptions = $computed(() => { ...@@ -65,23 +66,23 @@ const listOptions = $computed(() => {
return { return {
remote: { remote: {
httpRequest: getCourseList, httpRequest: getCourseList,
params: { tab: tabValue, status: '', authorized: '', name: '' } params: { tab: tabValue, status: '', authorized: '', name: '' },
}, },
filters: [ filters: [
{ {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '状态:', label: '状态:',
options: store.getMapValuesByKey('system_status') options: store.getMapValuesByKey('system_status'),
}, },
{ prop: 'classification', label: '类别:', slots: 'filter-type' }, { prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' }, { type: 'input', prop: 'name', label: '标题:' },
{ {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department' slots: 'filter-department',
} },
], ],
columns columns,
} }
}) })
...@@ -159,9 +160,10 @@ const typeFilter = () => { ...@@ -159,9 +160,10 @@ const typeFilter = () => {
<style lang="scss" scoped> <style lang="scss" scoped>
.card-list { .card-list {
background: #fafafa; background: #fafafa;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 20px;
padding: 20px; padding: 20px;
display: flex;
flex-wrap: wrap;
} }
.video-head { .video-head {
position: relative; position: relative;
......
<script setup lang="ts"> <script setup lang="ts">
import { useStorage } from '@vueuse/core'
import { getLessonList } from '../api' import { getLessonList } from '../api'
import CardListItem from '@/components/base/CardListItem.vue' import CardListItem from '@/components/base/CardListItem.vue'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
...@@ -15,9 +16,9 @@ const store = useMapStore() ...@@ -15,9 +16,9 @@ const store = useMapStore()
const appList = ref() const appList = ref()
// 列表切换 // 列表切换
let isCard = $ref(true) const isCard = useStorage('isCard', true)
const changeCard = () => { const changeCard = () => {
isCard = !isCard isCard.value = !isCard.value
} }
// 筛选部门列表 // 筛选部门列表
...@@ -28,7 +29,7 @@ let { list: selectTree }: any = useGetCategoryList() ...@@ -28,7 +29,7 @@ let { list: selectTree }: any = useGetCategoryList()
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
value: 'id' value: 'id',
} }
// 资源出处 tab触发 // 资源出处 tab触发
...@@ -45,7 +46,7 @@ const listOptions = $computed(() => { ...@@ -45,7 +46,7 @@ const listOptions = $computed(() => {
align: 'center', align: 'center',
computed({ row }: any) { computed({ row }: any) {
return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name
} },
}, },
{ label: '教案分类', prop: 'classification_name', align: 'center' }, { label: '教案分类', prop: 'classification_name', align: 'center' },
{ label: '知识点', prop: 'knowledge_points', align: 'center' }, { label: '知识点', prop: 'knowledge_points', align: 'center' },
...@@ -54,7 +55,7 @@ const listOptions = $computed(() => { ...@@ -54,7 +55,7 @@ const listOptions = $computed(() => {
{ label: '更新人', prop: 'updated_operator_name', align: 'center' }, { label: '更新人', prop: 'updated_operator_name', align: 'center' },
{ label: '更新人部门', prop: 'organ_id_name', align: 'center' }, { label: '更新人部门', prop: 'organ_id_name', align: 'center' },
{ label: '更新日期', prop: 'updated_time', align: 'center' }, { label: '更新日期', prop: 'updated_time', align: 'center' },
{ label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' } { label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' },
] ]
if (tabValue.value === '2') { if (tabValue.value === '2') {
columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' }) columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' })
...@@ -65,23 +66,23 @@ const listOptions = $computed(() => { ...@@ -65,23 +66,23 @@ const listOptions = $computed(() => {
return { return {
remote: { remote: {
httpRequest: getLessonList, httpRequest: getLessonList,
params: { tab: tabValue, status: '', authorized: '', name: '' } params: { tab: tabValue, status: '', authorized: '', name: '' },
}, },
filters: [ filters: [
{ {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '状态:', label: '状态:',
options: store.getMapValuesByKey('system_status') options: store.getMapValuesByKey('system_status'),
}, },
{ prop: 'classification', label: '类别:', slots: 'filter-type' }, { prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' }, { type: 'input', prop: 'name', label: '标题:' },
{ {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department' slots: 'filter-department',
} },
], ],
columns columns,
} }
}) })
...@@ -159,9 +160,10 @@ const typeFilter = () => { ...@@ -159,9 +160,10 @@ const typeFilter = () => {
<style lang="scss" scoped> <style lang="scss" scoped>
.card-list { .card-list {
background: #fafafa; background: #fafafa;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 20px;
padding: 20px; padding: 20px;
display: flex;
flex-wrap: wrap;
} }
.video-head { .video-head {
position: relative; position: relative;
......
<script setup lang="ts"> <script setup lang="ts">
import { useStorage } from '@vueuse/core'
import { getOtherList } from '../api' import { getOtherList } from '../api'
import CardListItem from '@/components/base/CardListItem.vue' import CardListItem from '@/components/base/CardListItem.vue'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
...@@ -16,9 +17,9 @@ const store = useMapStore() ...@@ -16,9 +17,9 @@ const store = useMapStore()
const appList = ref() const appList = ref()
// 列表切换 // 列表切换
let isCard = $ref(true) const isCard = useStorage('isCard', true)
const changeCard = () => { const changeCard = () => {
isCard = !isCard isCard.value = !isCard.value
} }
// 资源出处 tab触发 // 资源出处 tab触发
...@@ -35,7 +36,7 @@ let { list: selectTree }: any = useGetCategoryList() ...@@ -35,7 +36,7 @@ let { list: selectTree }: any = useGetCategoryList()
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
value: 'id' value: 'id',
} }
const listOptions = $computed(() => { const listOptions = $computed(() => {
...@@ -46,7 +47,7 @@ const listOptions = $computed(() => { ...@@ -46,7 +47,7 @@ const listOptions = $computed(() => {
align: 'center', align: 'center',
computed({ row }: any) { computed({ row }: any) {
return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name
} },
}, },
{ label: '课件分类', prop: 'classification_name', align: 'center' }, { label: '课件分类', prop: 'classification_name', align: 'center' },
{ label: '知识点', prop: 'knowledge_points', align: 'center' }, { label: '知识点', prop: 'knowledge_points', align: 'center' },
...@@ -55,7 +56,7 @@ const listOptions = $computed(() => { ...@@ -55,7 +56,7 @@ const listOptions = $computed(() => {
{ label: '更新人', prop: 'updated_operator_name', align: 'center' }, { label: '更新人', prop: 'updated_operator_name', align: 'center' },
{ label: '更新人部门', prop: 'organ_id_name', align: 'center' }, { label: '更新人部门', prop: 'organ_id_name', align: 'center' },
{ label: '更新日期', prop: 'updated_time', align: 'center' }, { label: '更新日期', prop: 'updated_time', align: 'center' },
{ label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' } { label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' },
] ]
if (tabValue.value === '2') { if (tabValue.value === '2') {
columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' }) columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' })
...@@ -66,23 +67,23 @@ const listOptions = $computed(() => { ...@@ -66,23 +67,23 @@ const listOptions = $computed(() => {
return { return {
remote: { remote: {
httpRequest: getOtherList, httpRequest: getOtherList,
params: { tab: tabValue, status: '', authorized: '', name: '' } params: { tab: tabValue, status: '', authorized: '', name: '' },
}, },
filters: [ filters: [
{ {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '状态:', label: '状态:',
options: store.getMapValuesByKey('system_status') options: store.getMapValuesByKey('system_status'),
}, },
{ prop: 'classification', label: '类别:', slots: 'filter-type' }, { prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' }, { type: 'input', prop: 'name', label: '标题:' },
{ {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department' slots: 'filter-department',
} },
], ],
columns columns,
} }
}) })
...@@ -160,9 +161,10 @@ const typeFilter = () => { ...@@ -160,9 +161,10 @@ const typeFilter = () => {
<style lang="scss" scoped> <style lang="scss" scoped>
.card-list { .card-list {
background: #fafafa; background: #fafafa;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 20px;
padding: 20px; padding: 20px;
display: flex;
flex-wrap: wrap;
} }
.video-head { .video-head {
position: relative; position: relative;
......
...@@ -44,11 +44,9 @@ const props: any = defineProps<{ data: object; tabIndex: string }>() ...@@ -44,11 +44,9 @@ const props: any = defineProps<{ data: object; tabIndex: string }>()
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.card-item { .card-item {
width: 18%; background: #fff;
border-radius: 6px; border-radius: 6px;
overflow: hidden; overflow: hidden;
margin-right: 10px;
margin-bottom: 20px;
.card-item-top { .card-item-top {
height: 170px; height: 170px;
position: relative; position: relative;
......
<script setup lang="ts"> <script setup lang="ts">
import { useStorage } from '@vueuse/core'
import { getVideoList } from '../api' import { getVideoList } from '../api'
import CardListItem from '../components/CardListItem.vue' import CardListItem from '../components/CardListItem.vue'
import { PictureFilled } from '@element-plus/icons-vue' import { PictureFilled } from '@element-plus/icons-vue'
...@@ -24,7 +25,7 @@ let { list: selectTree }: any = useGetCategoryList() ...@@ -24,7 +25,7 @@ let { list: selectTree }: any = useGetCategoryList()
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
value: 'id' value: 'id',
} }
// 资源出处 tab触发 // 资源出处 tab触发
const tabValue = ref('1') const tabValue = ref('1')
...@@ -34,7 +35,7 @@ const tabChange = () => { ...@@ -34,7 +35,7 @@ const tabChange = () => {
appList.value.refetch() appList.value.refetch()
} }
// 列表切换 // 列表切换
let isCard = $ref(true) const isCard = useStorage('isCard', true)
// table 数据 // table 数据
const listOptions = $computed(() => { const listOptions = $computed(() => {
const columns = [ const columns = [
...@@ -44,7 +45,7 @@ const listOptions = $computed(() => { ...@@ -44,7 +45,7 @@ const listOptions = $computed(() => {
align: 'center', align: 'center',
computed({ row }: any) { computed({ row }: any) {
return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name return row.name?.length > 10 ? `${row.name.slice(0, 10)}...` : row.name
} },
}, },
{ label: '视频分类', prop: 'classification_name', align: 'center' }, { label: '视频分类', prop: 'classification_name', align: 'center' },
{ label: '知识点', prop: 'knowledge_points', align: 'center' }, { label: '知识点', prop: 'knowledge_points', align: 'center' },
...@@ -54,7 +55,7 @@ const listOptions = $computed(() => { ...@@ -54,7 +55,7 @@ const listOptions = $computed(() => {
{ label: '更新人', prop: 'updated_operator_name', align: 'center' }, { label: '更新人', prop: 'updated_operator_name', align: 'center' },
{ label: '更新人部门', prop: 'organ_id_name', align: 'center' }, { label: '更新人部门', prop: 'organ_id_name', align: 'center' },
{ label: '更新日期', prop: 'updated_time', align: 'center' }, { label: '更新日期', prop: 'updated_time', align: 'center' },
{ label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' } { label: '操作', slots: 'table-operate', align: 'center', width: 200, fixed: 'right' },
] ]
if (tabValue.value === '2') { if (tabValue.value === '2') {
columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' }) columns.splice(2, 0, { label: '部门共享', prop: 'department_public_name', align: 'center' })
...@@ -65,23 +66,23 @@ const listOptions = $computed(() => { ...@@ -65,23 +66,23 @@ const listOptions = $computed(() => {
return { return {
remote: { remote: {
httpRequest: getVideoList, httpRequest: getVideoList,
params: { tab: tabValue, status: '', authorized: '', name: '' } params: { tab: tabValue, status: '', authorized: '', name: '' },
}, },
filters: [ filters: [
{ {
type: 'select', type: 'select',
prop: 'status', prop: 'status',
label: '状态:', label: '状态:',
options: store.getMapValuesByKey('system_status') options: store.getMapValuesByKey('system_status'),
}, },
{ prop: 'classification', label: '类别:', slots: 'filter-type' }, { prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' }, { type: 'input', prop: 'name', label: '标题:' },
{ {
prop: 'authorized', prop: 'authorized',
slots: 'filter-department' slots: 'filter-department',
} },
], ],
columns columns,
} }
}) })
...@@ -90,7 +91,7 @@ const typeFilter = () => { ...@@ -90,7 +91,7 @@ const typeFilter = () => {
} }
const changeCard = () => { const changeCard = () => {
isCard = !isCard isCard.value = !isCard.value
} }
// 批量上传 // 批量上传
const handleBatchImport = () => { const handleBatchImport = () => {
...@@ -182,9 +183,10 @@ const handleBatchImport = () => { ...@@ -182,9 +183,10 @@ const handleBatchImport = () => {
<style lang="scss" scoped> <style lang="scss" scoped>
.card-list { .card-list {
background: #fafafa; background: #fafafa;
display: flex; display: grid;
flex-wrap: wrap; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
padding: 20px 0; gap: 20px;
padding: 20px;
} }
.video-head { .video-head {
position: relative; position: relative;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论