Browse Source

小图谱跳转

small-tupu
hanyuqing 7 months ago
parent
commit
6da6c15714
  1. 2
      gyxtp/src/router/router.js
  2. 66
      ruoyi-api/src/main/java/com/ruoyi/api/ReadTextData.java
  3. 4
      ruoyi-api/src/main/java/com/ruoyi/api/controller/DocApiController.java
  4. 193
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/BuildService.java
  5. 3
      ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
  6. 6
      ruoyi-system/pom.xml
  7. 736
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WordSplitter.java
  8. 44
      ruoyi-ui/src/api/system/article.js
  9. 399
      ruoyi-ui/src/views/system/article/index.vue
  10. 4
      ruoyi-ui/src/views/system/docmuban/index.vue
  11. 76
      ruoyi-ui/src/views/system/fileManage/index.vue

2
gyxtp/src/router/router.js

@ -22,7 +22,7 @@ const routes = [
meta: {
title: '数据图谱',
},
component: () => import ("../view/graphPageCopy.vue")
component: () => import ("../view/graphPage.vue")
},
{
path: '/battlefield',

66
ruoyi-api/src/main/java/com/ruoyi/api/ReadTextData.java

@ -0,0 +1,66 @@
package com.ruoyi.api;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.*;
public class ReadTextData {
// 定义一个类来存储每条记录
static class Record {
String author;
String organization;
String title;
@Override
public String toString() {
return "Record{" +
"author='" + author + '\'' +
", organization='" + organization + '\'' +
", title='" + title + '\'' +
'}';
}
}
public static void main(String[] args) {
// 替换为你的实际文件路径
String filePath = "D:\\project\\gyx\\tupudata\\csv\\test.txt"; // Windows 路径示例
// String filePath = "/Users/yourname/data.txt"; // Mac/Linux 路径示例
List<Record> records = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(new FileInputStream(filePath), StandardCharsets.UTF_8))) {
String line;
Record currentRecord = null;
int lineCount = 0;
while ((line = reader.readLine()) != null) {
line = line.trim(); // 去除首尾空格
if (line.isEmpty()) continue; // 跳过空行
lineCount++;
if (line.startsWith("作者:")) {
currentRecord = new Record();
currentRecord.author = line.substring(3); // 去掉"作者:"
records.add(currentRecord);
} else if (line.startsWith("单位:") && currentRecord != null) {
currentRecord.organization = line.substring(3); // 去掉"单位:"
} else if (line.startsWith("题名:") && currentRecord != null) {
currentRecord.title = line.substring(3); // 去掉"题名:"
}
// 如果格式不匹配,可添加日志或报错
}
} catch (IOException e) {
System.err.println("读取文件时发生错误:" + e.getMessage());
e.printStackTrace();
}
// 打印所有解析出的数据
for (int i = 0; i < records.size(); i++) {
System.out.println("第" + (i+1) + "条: " + records.get(i));
}
}
}

4
ruoyi-api/src/main/java/com/ruoyi/api/controller/DocApiController.java

@ -1891,8 +1891,8 @@ public void goPython(ZhyTaskInfo info, List<Map<String, Object>> searchItems,Str
// 解析 JSON 响应
ObjectMapper mapper = new ObjectMapper();
Map<String, String> objMap = mapper.readValue(payload, new TypeReference<Map<String, String>>() {});
// Map<String, String> objMap = mapper.readValue(payload, new TypeReference<Map<String, String>>() {});
Map<String, String> objMap = gson.fromJson(payload, Map.class);
// 检查响应状态
if ("500".equals(objMap.get("code"))) {
info.setStatus(2);

193
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/BuildService.java

@ -1,5 +1,6 @@
package com.ruoyi.api.service.impl;
import com.ruoyi.api.ReadTextData;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.Neo4jUtil;
import com.ruoyi.system.domain.ZhyArticle;
@ -14,10 +15,12 @@ import org.springframework.stereotype.Service;
import java.io.*;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.ruoyi.common.constant.Constants.ARTICLE_DIR;
import static com.ruoyi.common.constant.Constants.ARTICLE_PDF_DIR;
@Service
@ -42,7 +45,7 @@ public class BuildService {
// System.out.println(thesis.get("url"));
// 1. 获取文件路径
String filePath = (String) thesis.get("url");
String filePath1 = (String) thesis.get("url1");
String filePath1 =ARTICLE_DIR;
if (filePath == null || filePath.trim().isEmpty()) {
// return AjaxResult.error("文件路径不能为空");
}
@ -193,8 +196,196 @@ public class BuildService {
}
public void create1(Map<String,String> thesis){
// 1. 获取文件路径
String filePath = (String) thesis.get("url");
String filePath1 =ARTICLE_DIR;
if (filePath == null || filePath.trim().isEmpty()) {
// return AjaxResult.error("文件路径不能为空");
}
File file = new File(filePath);
if (!file.exists()) {
// return AjaxResult.error("文件不存在: " + filePath);
}
// List<Map<String, String>> dataList = new ArrayList<>();
List<ZhyArticle> articles = new ArrayList<>();
ZhyArticle zhyArticle = null; // 当前正在构建的记录
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(new FileInputStream(filePath), StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
if (line.isEmpty()) continue; // 跳过空行
if (line.startsWith("作者:")) {
// 遇到新的“作者”,说明上一条记录已结束,可以保存
if (zhyArticle != null) {
articles.add(zhyArticle);
}
// 开始一条新记录
zhyArticle = new ZhyArticle();
zhyArticle.setAuthors(line.substring(3)); // 去掉"作者:"
} else if (line.startsWith("单位:")) {
if (zhyArticle != null) {
zhyArticle.setAgencies(line.substring(3)); // 去掉"单位:"
}
} else if (line.startsWith("题名:")) {
if (zhyArticle != null) {
zhyArticle.setName(line.substring(3)); // 去掉"题名:"
}
}
}
// 文件读完,别忘了把最后一条记录加上
if (zhyArticle != null) {
articles.add(zhyArticle);
}
} catch (IOException e) {
System.err.println("读取文件时发生错误:" + e.getMessage());
e.printStackTrace();
}
ArrayList<String> mainKeywordList = new ArrayList<>();
String mainKeyword = "";
mainKeywordList.add(mainKeyword);
// 3. 处理每一行数据(和你原来逻辑一致)
for (ZhyArticle article : articles) {
// System.out.println(mainKeywordList);
Map mapLevel=new HashMap();
for (int i=0;i<mainKeywordList.size();i++){
// System.out.println(mainKeywordList.get(i));
ZhyDoc doc=test1Mapper.selectDocByTitle(mainKeywordList.get(i));
if(doc!=null){
if(doc.getDocLevel()==1l){
mapLevel.put("l1",mainKeywordList.get(i));
}
if(doc.getDocLevel()==2l){
mapLevel.put("l2",mainKeywordList.get(i));
}
if(doc.getDocLevel()==3l){
mapLevel.put("l3",mainKeywordList.get(i));
}
if(doc.getDocLevel()==4l){
mapLevel.put("l4",mainKeywordList.get(i));
}
if(doc.getDocLevel()==5l){
mapLevel.put("l5",mainKeywordList.get(i));
}
if(doc.getDocLevel()==6l){
mapLevel.put("l6",mainKeywordList.get(i));
}
}
}
// System.out.println(mapLevel);
//如果选择了l1,则看是否选择l2、l3、l4、l5、l6
String[] levels = {"l1", "l2", "l3", "l4", "l5", "l6"};
int n = levels.length;
for (int i = 0; i < n - 1; i++) {
String parentKey = levels[i];
if (mapLevel.containsKey(parentKey)) {
String parentValue = mapLevel.get(parentKey).toString();
for (int j = i + 1; j < n; j++) {
String childKey = levels[j];
if (mapLevel.containsKey(childKey)) {
String childValue = mapLevel.get(childKey).toString();
ZhyDocRelation relation=new ZhyDocRelation();
relation.setSourceName(parentValue);
relation.setTargetName(childValue);
List<Map> relations=zhyDocRelationMapper.selectZhyRelationshipArticle(relation);
// System.out.println(relations);
if(relations.size()>0){
boolean flag=false;
for (int p=0;p<relations.size();p++){
if(relations.get(p).get("articleName").equals(article.getName())) {
flag=true;
break;
}
}
if(!flag){
createRelation1(parentValue, childValue,article,filePath1);
}
}else{
//插入关系
createRelation1(parentValue, childValue,article,filePath1);
}
}
}
}
}
//
}
}
public void createRelation1(String parentValue,String childValue,ZhyArticle data,String local){
ZhyDoc doc1 = test1Mapper.selectDocByTitle(parentValue);
ZhyDoc doc2 = test1Mapper.selectDocByTitle(childValue);
if (doc1 != null && doc2 != null) {
List<ZhyDoc> allDocs = test1Mapper.selectAllDoc1();
for (ZhyDoc doc : allDocs) {
if (doc.getDocTitle().equals(childValue)) {
doc.setDocParentId(doc1.getId());
String updateCql = "MATCH (doc:Doc {docId: '" + doc.getId() + "'}) " +
"SET doc.docParentId = '" + doc1.getId() + "' " +
"RETURN doc";
neo4jUtil.excuteCypherSql(updateCql);
}
}
// 插入文章
ZhyArticle article = new ZhyArticle();
article.setName(data.getName());
// article.setOpenUrl(data.get("urls"));
File file = new File(ARTICLE_PDF_DIR, article.getName()+".pdf");
System.out.println("文件路径: " + file.getAbsolutePath());
article.setLocalUrl(file.getAbsolutePath());
article.setAuthors(data.getAuthors());
article.setKeywords(data.getKeywords());
article.setSummary(data.getSummary());
article.setUrls(data.getUrls());
article.setSourceId(doc1.getId());
article.setSourceName(doc1.getDocTitle());
article.setTargetId(doc2.getId());
article.setTagertName(doc2.getDocTitle());
zhyArticleMapper.insertZhyArticle(article);
// 插入关系
ZhyDocRelation zz = new ZhyDocRelation();
zz.setRelationship("相关"); // 你可能需要从 CSV 中读取关系类型,或固定值
zz.setSource(doc1.getId());
zz.setTarget(doc2.getId());
zz.setSourceName(doc1.getDocTitle());
zz.setTargetName(doc2.getDocTitle());
zz.setCreateTime(new Date());
zz.setArticleId(article.getId());
System.out.println(zz);
zhyDocRelationMapper.insertZhyRelationship(zz);
}
// 4. 批量创建 Neo4j 关系
List<ZhyDocRelation> listR = zhyDocRelationMapper.getAllRelation();
for (ZhyDocRelation rel : listR) {
String cql = "MATCH (a:Doc),(b:Doc) " +
"WHERE a.docId = '" + rel.getSource() + "' AND b.docId = '" + rel.getTarget() + "' " +
"CREATE (a)-[r:" + rel.getRelationship() + " {name: '" + rel.getRelationship() + "'}]->(b) " +
"RETURN r";
neo4jUtil.excuteCypherSql(cql);
test1Mapper.updateGraphRelation(rel);
}
}
public void createRelation(String parentValue,String childValue,Map<String, String> data,String local){
ZhyDoc doc1 = test1Mapper.selectDocByTitle(parentValue);
ZhyDoc doc2 = test1Mapper.selectDocByTitle(childValue);

3
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@ -194,6 +194,9 @@ public static final String indexPathBattle = "D:\\project\\gyx\\tupudata\\battl
*/
public static final String ARTICLE_TXT_DIR = TUPUDATA_ROOT + "/article/txt";
public static final String ARTICLE_DIR = TUPUDATA_ROOT + "/article";
/**
* DOC 文档目录
*/

6
ruoyi-system/pom.xml

@ -47,7 +47,11 @@
<artifactId>poi-ooxml</artifactId>
<version>5.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>5.2.2</version>
</dependency>
</dependencies>
</project>

736
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WordSplitter.java

File diff suppressed because it is too large

44
ruoyi-ui/src/api/system/article.js

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询文献管理列表
export function listArticle(query) {
return request({
url: '/system/article/list',
method: 'get',
params: query
})
}
// 查询文献管理详细
export function getArticle(id) {
return request({
url: '/system/article/' + id,
method: 'get'
})
}
// 新增文献管理
export function addArticle(data) {
return request({
url: '/system/article',
method: 'post',
data: data
})
}
// 修改文献管理
export function updateArticle(data) {
return request({
url: '/system/article',
method: 'put',
data: data
})
}
// 删除文献管理
export function delArticle(id) {
return request({
url: '/system/article/' + id,
method: 'delete'
})
}

399
ruoyi-ui/src/views/system/article/index.vue

@ -0,0 +1,399 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="文献名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入文献名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="本地地址" prop="openUrl">
<el-input
v-model="queryParams.openUrl"
placeholder="请输入本地地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="在线地址" prop="localUrl">
<el-input
v-model="queryParams.localUrl"
placeholder="请输入在线地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="来源id" prop="sourceId">
<el-input
v-model="queryParams.sourceId"
placeholder="请输入来源id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="来源名称" prop="sourceName">
<el-input
v-model="queryParams.sourceName"
placeholder="请输入来源名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="目标id" prop="targetId">
<el-input
v-model="queryParams.targetId"
placeholder="请输入目标id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="目标名称" prop="tagertName">
<el-input
v-model="queryParams.tagertName"
placeholder="请输入目标名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="文献作者" prop="authors">
<el-input
v-model="queryParams.authors"
placeholder="请输入文献作者"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="文献关键词" prop="keywords">
<el-input
v-model="queryParams.keywords"
placeholder="请输入文献关键词"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="机构" prop="agencies">
<el-input
v-model="queryParams.agencies"
placeholder="请输入机构"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="摘要" prop="summary">
<el-input
v-model="queryParams.summary"
placeholder="请输入摘要"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="urls" prop="urls">
<el-input
v-model="queryParams.urls"
placeholder="请输入urls"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:article:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:article:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:article:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:article:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="articleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="${comment}" align="center" prop="id" />
<el-table-column label="文献名称" align="center" prop="name" />
<el-table-column label="本地地址" align="center" prop="openUrl" />
<el-table-column label="在线地址" align="center" prop="localUrl" />
<el-table-column label="来源id" align="center" prop="sourceId" />
<el-table-column label="来源名称" align="center" prop="sourceName" />
<el-table-column label="目标id" align="center" prop="targetId" />
<el-table-column label="目标名称" align="center" prop="tagertName" />
<el-table-column label="文献作者" align="center" prop="authors" />
<el-table-column label="文献关键词" align="center" prop="keywords" />
<el-table-column label="机构" align="center" prop="agencies" />
<el-table-column label="摘要" align="center" prop="summary" />
<el-table-column label="urls" align="center" prop="urls" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:article:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:article:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改文献管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="文献名称" prop="name">
<el-input v-model="form.name" placeholder="请输入文献名称" />
</el-form-item>
<el-form-item label="本地地址" prop="openUrl">
<el-input v-model="form.openUrl" placeholder="请输入本地地址" />
</el-form-item>
<el-form-item label="在线地址" prop="localUrl">
<el-input v-model="form.localUrl" placeholder="请输入在线地址" />
</el-form-item>
<el-form-item label="来源id" prop="sourceId">
<el-input v-model="form.sourceId" placeholder="请输入来源id" />
</el-form-item>
<el-form-item label="来源名称" prop="sourceName">
<el-input v-model="form.sourceName" placeholder="请输入来源名称" />
</el-form-item>
<el-form-item label="目标id" prop="targetId">
<el-input v-model="form.targetId" placeholder="请输入目标id" />
</el-form-item>
<el-form-item label="目标名称" prop="tagertName">
<el-input v-model="form.tagertName" placeholder="请输入目标名称" />
</el-form-item>
<el-form-item label="文献作者" prop="authors">
<el-input v-model="form.authors" placeholder="请输入文献作者" />
</el-form-item>
<el-form-item label="文献关键词" prop="keywords">
<el-input v-model="form.keywords" placeholder="请输入文献关键词" />
</el-form-item>
<el-form-item label="机构" prop="agencies">
<el-input v-model="form.agencies" placeholder="请输入机构" />
</el-form-item>
<el-form-item label="摘要" prop="summary">
<el-input v-model="form.summary" placeholder="请输入摘要" />
</el-form-item>
<el-form-item label="urls" prop="urls">
<el-input v-model="form.urls" placeholder="请输入urls" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listArticle, getArticle, delArticle, addArticle, updateArticle } from "@/api/system/article";
export default {
name: "Article",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
articleList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
openUrl: null,
localUrl: null,
sourceId: null,
sourceName: null,
targetId: null,
tagertName: null,
authors: null,
keywords: null,
agencies: null,
summary: null,
urls: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询文献管理列表 */
getList() {
this.loading = true;
listArticle(this.queryParams).then(response => {
this.articleList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
openUrl: null,
localUrl: null,
sourceId: null,
sourceName: null,
targetId: null,
tagertName: null,
authors: null,
keywords: null,
agencies: null,
summary: null,
urls: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加文献管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getArticle(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改文献管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateArticle(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addArticle(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除文献管理编号为"' + ids + '"的数据项?').then(function() {
return delArticle(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/article/export', {
...this.queryParams
}, `article_${new Date().getTime()}.xlsx`)
}
}
};
</script>

4
ruoyi-ui/src/views/system/docmuban/index.vue

@ -530,6 +530,7 @@ export default {
},
//zhyDoc
addZhyDoc(type){
this.handleAdd()
this.form.type = type;
if(this.form.type == "方向" || this.form.type == "作战" || this.form.type == "装备" || this.form.type == "环境"){
@ -626,7 +627,7 @@ export default {
if (this.form.id != null) {
updateDocmuban(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.addZhyDocmubanOpen = false;
this.updateZhyDocmubanOpen = false;
this.getList();
});
} else {
@ -634,6 +635,7 @@ export default {
this.$modal.msgSuccess("新增成功");
this.addZhyDocmubanOpen = false;
this.getList();
});
}
}

76
ruoyi-ui/src/views/system/fileManage/index.vue

@ -319,50 +319,50 @@
</el-form-item>
<el-form-item label="上传视频" prop="courseUrl">
<el-upload class="avatar-uploader el-upload--text" multiple :headers="videoUpload.headers"
:action="videoUpload.url" :file-list="videoFileList" :show-file-list="false" accept=".mp4"
:on-success="handleVideoSuccess" :before-upload="beforeUploadVideo"
:on-progress="uploadVideoProcess"
:on-remove="handleVideoRemove">
<div v-if="!videoFlag && showVideoPath" style="display: flex; flex-wrap: wrap; gap: 10px;">
<div v-for="(url, index) in showVideoPath.split(',')" :key="url"
style="position: relative; flex: 1 1 calc(33.333% - 20px); min-width: 200px; margin-bottom: 10px;">
<video :src="`${videoUpload.url2}${url}`" style="width:90%; height: auto;border-radius: 0.5vw;"
class="avatar video-avatar" controls>
您的浏览器不支持视频播放
</video>
<img src="../../../assets/images/delete.png" @click.stop="handleVideoRemove(videoFileList[index])"
style="width: 35px; height: 35px;position: absolute; top: 5px; left: 5px; cursor: pointer; z-index: 999;"
alt="删除"/>
</div>
</div>
<el-progress :stroke-width="10" class="progressType" v-if="videoFlag" type="circle"
:percentage="videoUploadPercent" style="margin-top:30px;"></el-progress>
<el-button style="z-index: 999;" class="video-btn" slot="trigger" size="small"
type="primary">点击上传视频
</el-button>
</el-upload>
</el-form-item>
<!-- <el-form-item label="上传视频" prop="courseUrl">-->
<!-- <el-upload class="avatar-uploader el-upload&#45;&#45;text" multiple :headers="videoUpload.headers"-->
<!-- :action="videoUpload.url" :file-list="videoFileList" :show-file-list="false" accept=".mp4"-->
<!-- :on-success="handleVideoSuccess" :before-upload="beforeUploadVideo"-->
<!-- :on-progress="uploadVideoProcess"-->
<!-- :on-remove="handleVideoRemove">-->
<!-- <div v-if="!videoFlag && showVideoPath" style="display: flex; flex-wrap: wrap; gap: 10px;">-->
<!-- <div v-for="(url, index) in showVideoPath.split(',')" :key="url"-->
<!-- style="position: relative; flex: 1 1 calc(33.333% - 20px); min-width: 200px; margin-bottom: 10px;">-->
<!-- <video :src="`${videoUpload.url2}${url}`" style="width:90%; height: auto;border-radius: 0.5vw;"-->
<!-- class="avatar video-avatar" controls>-->
<!-- 您的浏览器不支持视频播放-->
<!-- </video>-->
<!-- <img src="../../../assets/images/delete.png" @click.stop="handleVideoRemove(videoFileList[index])"-->
<!-- style="width: 35px; height: 35px;position: absolute; top: 5px; left: 5px; cursor: pointer; z-index: 999;"-->
<!-- alt="删除"/>-->
<!-- </div>-->
<!-- </div>-->
<!-- <el-progress :stroke-width="10" class="progressType" v-if="videoFlag" type="circle"-->
<!-- :percentage="videoUploadPercent" style="margin-top:30px;"></el-progress>-->
<!-- <el-button style="z-index: 999;" class="video-btn" slot="trigger" size="small"-->
<!-- type="primary">点击上传视频-->
<!-- </el-button>-->
<!-- </el-upload>-->
<!-- </el-form-item>-->
<el-form-item label="上传图片" prop="courseUrl">
<el-upload :action="uploadImgUrl" list-type="picture-card" multiple :on-success="handleSuccess"
:on-remove="handleRemove" :file-list="fileListImgs">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="上传文件" prop="courseUrl">
<el-upload v-model="diaForm.list" :limit="5" :on-exceed="handleExceed" :on-preview="handlePreview"
:before-upload="beforeAvatarUpload" :on-remove="handleRemoveFile" :headers="reqHeaders"
:on-success="onUploadSuccess" action="http://localhost:10031/common/upload"
:file-list="resultFileList"
list-type="picture" class="upload-files" accept=".png,.jpeg,.gif,.pdf,.jpg,.JPG">
<div class="upfile-btn">
<d2-icon name="document-upload" class="document-upload"/>
<div>点击上传+拖拽上传</div>
</div>
</el-upload>
</el-form-item>
<!-- <el-form-item label="上传文件" prop="courseUrl">-->
<!-- <el-upload v-model="diaForm.list" :limit="5" :on-exceed="handleExceed" :on-preview="handlePreview"-->
<!-- :before-upload="beforeAvatarUpload" :on-remove="handleRemoveFile" :headers="reqHeaders"-->
<!-- :on-success="onUploadSuccess" action="http://localhost:10031/common/upload"-->
<!-- :file-list="resultFileList"-->
<!-- list-type="picture" class="upload-files" accept=".png,.jpeg,.gif,.pdf,.jpg,.JPG">-->
<!-- <div class="upfile-btn">-->
<!-- <d2-icon name="document-upload" class="document-upload"/>-->
<!-- <div>点击上传+拖拽上传</div>-->
<!-- </div>-->
<!-- </el-upload>-->
<!-- </el-form-item>-->
<el-form-item style="position: relative ;">

Loading…
Cancel
Save