2024年5月23日 修改问题

This commit is contained in:
bai 2024-05-23 00:44:58 +08:00
parent 7dfc843a2d
commit 36c733acab
7 changed files with 83 additions and 33 deletions

1
builddev.bat Normal file
View File

@ -0,0 +1 @@
yarn build:dev

View File

@ -1 +0,0 @@
yarn build:test

View File

@ -13,6 +13,7 @@
"clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite",
"clean:lib": "rimraf node_modules",
"build": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 vite build && esno ./build/script/postBuild.ts",
"build:dev": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build --mode development && esno ./build/script/postBuild.ts",
"build:test": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build --mode test && esno ./build/script/postBuild.ts",
"build:no-cache": "pnpm clean:cache && npm run build",
"report": "cross-env REPORT=true npm run build",

View File

@ -2,7 +2,7 @@ import { defHttp } from '/@/utils/http/axios';
import { message } from 'ant-design-vue';
import { useGlobSetting } from '/@/hooks/setting';
const globSetting = useGlobSetting();
const baseUploadUrl = globSetting.uploadUrl;
export const baseUploadUrl = globSetting.uploadUrl;
enum Api {
positionList = '/sys/position/list',
userList = '/sys/user/list',

View File

@ -57,6 +57,34 @@ export const getMd5Str = ( str:string ) :string => {
return md5(str);
}
function calculateFileMd5(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
// 当文件被成功读取时调用onload事件
reader.onload = function (event) {
const arrayBufferView = event.target.result;
// 将ArrayBuffer转换为WordArray对象
const wordArray = CryptoJS.lib.WordArray.create(arrayBufferView);
// 计算MD5哈希值
const md5Hash = CryptoJS.MD5(wordArray).toString();
resolve(md5Hash);
};
// 当发生错误时调用onerror事件
reader.onerror = function () {
reject('Failed to read file');
};
// 开始读取文件内容
reader.readAsArrayBuffer(file);
});
}
export const get16BitStr = ( str:string ) :string => {
let val="";
for(let i = 0; i < str.length; i++){

View File

@ -13,25 +13,26 @@
</a-space>
<template v-else>
<a-space>
<a-button @click="reload"><Icon icon="ant-design:reload-outlined"/>刷新</a-button>
<a-button type="" @click="() => isPreview = false" class="addBtn" title="返回"><Icon icon="ant-design:fund-view-outlined"/>返回</a-button>
<a-button @click="reloadStn"><Icon icon="ant-design:reload-outlined"/>刷新</a-button>
<a-button type="" @click="() => { isPreview = false;reloadStn() }" class="addBtn" title="返回"><Icon icon="ant-design:fund-view-outlined"/>返回</a-button>
</a-space>
</template>
</div>
</div>
<!-- </a-affix> -->
<stuIndex v-show="isPreview" :hiddenBtn="true"/>
<stuIndex ref="stuIndexRef" v-show="isPreview" :hiddenBtn="true"/>
<div v-show="!isPreview" class="maxDiv">
<a-empty v-if="!dataSource || !dataSource.length"/>
<draggable v-bind="draggableBind" v-model="dataSource">
<template #item="{ element: one }">
<div class="box">
<!-- 下一层 -->
<a-card>
<a-card @mouseenter="() => one.showBtn = true" @mouseleave="() => one.showBtn = false">
<a-collapse ghost expandIconPosition="right">
<a-collapse-panel :key="one._id" forceRender>
<template #header>
<div class="topDiv">
<Icon icon="ant-design:holder-outlined"/>
<div>{{ one.sort }}</div>
<div class="inputd">
<a-input v-if="one.isEdit" :value="one.title" @change="changeInput($event, one, 'title')" @blur="() => { one.isEdit = false }" @click="stop" class="ainput"/>
@ -40,21 +41,24 @@
</div>
</template>
<template #extra>
<a-space>
<div><a-button type="primary" @click="addTwo($event, one)" class="twoBtn addBtn" title="新增二级"><Icon icon="ant-design:plus-outlined"/>新增章节</a-button></div>
<div><a-button type="primary" danger @click="delOne($event, one)" class="addBtn" title="删除此项及以下"><Icon icon="ant-design:delete"/>删除</a-button></div>
</a-space>
<span v-show="one.showBtn">
<a-space>
<div><a-button type="primary" @click="addTwo($event, one)" class="twoBtn addBtn" title="新增二级"><Icon icon="ant-design:plus-outlined"/>新增章节</a-button></div>
<div><a-button type="primary" danger @click="delOne($event, one)" class="addBtn" title="删除此项及以下"><Icon icon="ant-design:delete"/>删除</a-button></div>
</a-space>
</span>
</template>
<draggable v-bind="draggableBind" v-model="one.childrenList">
<template #item="{ element: two }">
<div class="box">
<!-- 下一层 -->
<a-card>
<a-card @mouseenter="() => two.showBtn = true" @mouseleave="() => two.showBtn = false">
<a-collapse ghost expandIconPosition="right">
<a-collapse-panel :key="two._id" :showArrow="false" forceRender>
<template #header>
<div class="twoTopDiv">
<div class="topDiv">
<Icon icon="ant-design:holder-outlined"/>
<div>{{ one.sort }}.{{ two.sort }}</div>
<div class="twoInputd">
<a-input v-if="two.isEdit" :value="two.title" @change="changeInput($event, two, 'title')" @blur="() => { two.isEdit = false }" @click="stop" class="ainput"/>
@ -64,10 +68,12 @@
</div>
</template>
<template #extra>
<a-space>
<a-button type="primary" class="addBtn" title="展开收起"><Icon icon="ant-design:plus-outlined"/>上传资源</a-button>
<a-button type="primary" danger @click="delTwo($event, one, two)" class="addBtn" title="删除此项及以下"><Icon icon="ant-design:delete"/>删除</a-button>
</a-space>
<span v-show="two.showBtn">
<a-space>
<a-button type="primary" class="addBtn" title="展开收起"><Icon icon="ant-design:plus-outlined"/>上传资源</a-button>
<a-button type="primary" danger @click="delTwo($event, one, two)" class="addBtn" title="删除此项及以下"><Icon icon="ant-design:delete"/>删除</a-button>
</a-space>
</span>
</template>
<div style="padding-top: 1rem;">
<a-space>
@ -80,9 +86,10 @@
</div>
<draggable v-bind="draggableBind" v-model="two.childrenList">
<template #item="{ element: three }">
<div class="box">
<div class="box" @mouseenter="() => three.showBtn = true" @mouseleave="() => three.showBtn = false">
<a-card>
<template #title>
<Icon icon="ant-design:holder-outlined"/>
{{ one.sort }}.{{ two.sort }}.{{ three.sort }}
<template v-if="three.type == 'video'">
<Icon icon="ant-design:video-camera-outlined" />视频
@ -95,20 +102,22 @@
</template>
</template>
<template #extra>
<a-space>
<a-button type="primary" v-if="three.isEdit" @click="() => three.isEdit = false" class="addBtn"><Icon icon="ant-design:edit"/>确认</a-button>
<a-button type="primary" v-if="!three.isEdit" @click="() => three.isEdit = true" class="addBtn"><Icon icon="ant-design:edit"/>编辑</a-button>
<a-button type="primary" danger @click="delThree($event, two, three)" class="addBtn"><Icon icon="ant-design:delete"/>删除</a-button>
</a-space>
<span v-show="three.showBtn">
<a-space>
<a-button type="primary" v-if="three.isEdit" @click="() => three.isEdit = false" class="addBtn"><Icon icon="ant-design:edit"/>确认</a-button>
<a-button type="primary" v-if="!three.isEdit" @click="() => three.isEdit = true" class="addBtn"><Icon icon="ant-design:edit"/>编辑</a-button>
<a-button type="primary" danger @click="delThree($event, two, three)" class="addBtn"><Icon icon="ant-design:delete"/>删除</a-button>
</a-space>
</span>
</template>
<div class="topDiv">
<template v-if="three.type == 'video'">
<!-- <j-upload v-model:value="three.filePath" maxCount="1" suffixList="avi,mov,mkv,mpeg,asf,3gp,wmv,mp4,flv,rmvb"/> video/mp4,video/webm,video/ogv-->
<j-upload v-if="three.isEdit" v-model:value="three.filePath" maxCount="1" text="上传视频" accept=".mp4,.webm,.ogv" :forceAcceptVerify="true"/>
<j-upload v-if="three.isEdit" v-model:value="three.filePath" :maxCount="1" text="上传视频" accept=".mp4,.webm,.ogv" :forceAcceptVerify="true"/>
<downloadAssembly v-else :filePath="three.filePath"/>
</template>
<template v-if="three.type == 'document'">
<j-upload v-if="three.isEdit" v-model:value="three.filePath" maxCount="1"/>
<j-upload v-if="three.isEdit" v-model:value="three.filePath" :maxCount="1"/>
<downloadAssembly v-else :filePath="three.filePath"/>
</template>
<template v-if="three.type == 'richText'">
@ -174,6 +183,8 @@
const saveLoading = ref<boolean>(false);
const isPreview = ref<boolean>(false);
const stuIndexRef = ref<any>();
//
const draggableBind = ref<Object>({
//
@ -212,6 +223,10 @@
loadData();
}
function reloadStn() {
stuIndexRef.value.reload();
}
async function loadData() {
dataSource.value = [];
let params = {
@ -460,12 +475,12 @@
<style lang="less" scoped>
.max {
height: calc(-142px + 100vh);
min-height: calc(-142px + 100vh);
max-height: calc(-142px + 100vh);
height: calc(-132px + 100vh);
// min-height: calc(-132px + 100vh);
// max-height: calc(-132px + 100vh);
overflow: hidden;
.maxDiv {
height: calc(-170px + 100vh);
height: calc(100% - 94px);
overflow-y: auto;
}
}

View File

@ -153,8 +153,10 @@
hiddenBtn: { type: Boolean, default: false },
});
// watch(() => props.hiddenBtn, () => {
// reload();
// watch(() => props.hiddenBtn, (v) => {
// if(v){
// reload();
// }
// });
@ -449,16 +451,20 @@
}
loadData();
defineExpose({
reload,
})
</script>
<style lang="less" scoped>
.max {
height: calc(-142px + 100vh);
min-height: calc(-142px + 100vh);
max-height: calc(-142px + 100vh);
height: calc(-132px + 100vh);
// min-height: calc(-132px + 100vh);
// max-height: calc(-132px + 100vh);
overflow: hidden;
.maxDiv {
height: calc(-170px + 100vh);
height: calc(100% - 94px);
overflow-y: auto;
}
}