|
@@ -3,7 +3,7 @@ import { state } from '@/state';
|
|
|
import { Button, Cell, Collapse, CollapseItem, Popup, showToast } from 'vant';
|
|
|
import { defineComponent, onMounted, reactive, TransitionGroup } from 'vue';
|
|
|
import styles from './index.module.less';
|
|
|
-import { useRoute, useRouter } from 'vue-router';
|
|
|
+import { useRoute } from 'vue-router';
|
|
|
import { postMessage } from '@/helpers/native-message';
|
|
|
import iconQuestion from './image/icon-question.png';
|
|
|
import iconNoCheck from './image/icon-nocheck.png';
|
|
@@ -11,7 +11,6 @@ import iconImm from './image/icon-imm.png';
|
|
|
import iconCheck from './image/icon-check.png';
|
|
|
import iconCheckDisabled from './image/icon-check-disabled.png';
|
|
|
|
|
|
-import { browser } from '@/helpers/utils';
|
|
|
import OEmpty from '@/components/o-empty';
|
|
|
import iconList from './image/icon-list.png';
|
|
|
import OHeader from '@/components/o-header';
|
|
@@ -39,7 +38,8 @@ export default defineComponent({
|
|
|
ruleStatus: false,
|
|
|
isDownloading: false, // 是否在下载资源
|
|
|
parentCollapse: '' as any,
|
|
|
- childrenCollapse: '' as any
|
|
|
+ childrenCollapse: '' as any,
|
|
|
+ disabledIds: [] as any
|
|
|
});
|
|
|
|
|
|
/** 获取课件详情 */
|
|
@@ -62,17 +62,32 @@ export default defineComponent({
|
|
|
route.query.id
|
|
|
);
|
|
|
if (Array.isArray(res?.data)) {
|
|
|
+ // data.disabledIds = [1082460, 1082461, 1082462, 1082463];
|
|
|
res.data.forEach((item: any) => {
|
|
|
item.status = 'nochecked';
|
|
|
item.children = item.knowledgePointList || [];
|
|
|
item.id = item.coursewareDetailId;
|
|
|
item.name = item.coursewareDetailName;
|
|
|
- // const tempK = item.knowledgePointList || [];
|
|
|
formatDataList(item.children);
|
|
|
});
|
|
|
|
|
|
data.list = res.data;
|
|
|
- console.log(data.list, 'data.list');
|
|
|
+ console.log(data.list, 'data.list', data.disabledIds);
|
|
|
+
|
|
|
+ const allIds = {} as any;
|
|
|
+ data.disabledIds.forEach((item: any) => {
|
|
|
+ allIds[item] = formatGetIds(item, data.list);
|
|
|
+ });
|
|
|
+ console.log(allIds, 'allIds');
|
|
|
+
|
|
|
+ for (const item in allIds) {
|
|
|
+ const ids = allIds[item];
|
|
|
+ for (let i = ids.length - 2; i >= 0; i--) {
|
|
|
+ // console.log(ids[i], 'ids', getFormatIdList(ids[i], data.list));
|
|
|
+ const listItem = getFormatIdList(ids[i], data.list);
|
|
|
+ onParentChangeStatus(listItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} catch (error) {
|
|
|
//
|
|
@@ -87,8 +102,12 @@ export default defineComponent({
|
|
|
item.collapse = '';
|
|
|
if (Array.isArray(item.materialList)) {
|
|
|
item.materialList.forEach((item: any) => {
|
|
|
- if (state.vIds.includes(item.id + '')) {
|
|
|
+ if (
|
|
|
+ state.vIds.includes(item.id + '') ||
|
|
|
+ item.typeCode !== 'VIDEO'
|
|
|
+ ) {
|
|
|
item.status = 'disabled';
|
|
|
+ data.disabledIds.push(item.id);
|
|
|
} else {
|
|
|
item.status = 'nochecked';
|
|
|
}
|
|
@@ -106,6 +125,45 @@ export default defineComponent({
|
|
|
return tempList;
|
|
|
};
|
|
|
|
|
|
+ // 获取数据的编号
|
|
|
+ const formatGetIds = (id: any, list: any[], ids = [] as any) => {
|
|
|
+ for (const item of list) {
|
|
|
+ if (item.id === id) {
|
|
|
+ return [...ids, id];
|
|
|
+ } else {
|
|
|
+ if (Array.isArray(item.materialList)) {
|
|
|
+ for (const material of item.materialList) {
|
|
|
+ if (material.id === id) {
|
|
|
+ return [...ids, item.id, id];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
+ const cIds: any = formatGetIds(id, item.children, [...ids, item.id]);
|
|
|
+ if (cIds.includes(id)) {
|
|
|
+ return cIds;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ids;
|
|
|
+ };
|
|
|
+
|
|
|
+ // 获取编号对应的数组
|
|
|
+ const getFormatIdList = (id: any, list: any[]) => {
|
|
|
+ let tempI: any = {};
|
|
|
+ for (const item of list) {
|
|
|
+ if (item.id === id) {
|
|
|
+ console.log(item, id);
|
|
|
+ tempI = item;
|
|
|
+ }
|
|
|
+ if (item.children && item.children.length > 0 && !tempI.id) {
|
|
|
+ tempI = getFormatIdList(id, item.children);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tempI;
|
|
|
+ };
|
|
|
+
|
|
|
const getKnowledgeMaterialIds = (list: any = []) => {
|
|
|
const tempList: any = [];
|
|
|
list.forEach((item: any) => {
|