linsheng0116 1 year ago
parent
commit
65f89f7d87
  1. 10
      kcui/src/api/kcInfo.js
  2. BIN
      kcui/src/assets/img/leftBox1.png
  3. BIN
      kcui/src/assets/img/tt.png
  4. BIN
      kcui/src/assets/img/twbg.jpg
  5. 6
      kcui/src/router/router.js
  6. 82
      kcui/src/view/TWInfo.vue
  7. 2
      src/main/java/com/main/woka/Filter/TestFilter.java
  8. 89
      src/main/java/com/main/woka/Web/Controller/KcInfoController.java
  9. 9
      src/main/java/com/main/woka/Web/Dao/KcInfo.java
  10. 3
      src/main/resources/application.properties

10
kcui/src/api/kcInfo.js

@ -12,3 +12,13 @@ export function getDocList(data) {
}
})
}
export function getTwInfo(params) {
return request({
url: '/kcDoc/getTwInfo',
method: 'get',
params,
headers: {
'Authorization': 'Bearer '+ getToken() // 将 token 放在请求头中
}
})
}

BIN
kcui/src/assets/img/leftBox1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
kcui/src/assets/img/tt.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

BIN
kcui/src/assets/img/twbg.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 KiB

6
kcui/src/router/router.js

@ -5,6 +5,7 @@ import Home from '@/view/Graph.vue'
import Book from '@/view/Book.vue'
import Calculator from "@/view/Calculator.vue";
import TwInfo from '@/view/TWInfo.vue'
import TwInfoXq from '@/view/TWInfoXq.vue'
import Login from '@/view/Login.vue'
import Mulu from '@/view/Mulu.vue'
//2.调用vue.use() 函数,把 VueRouter 安装为 Vue 的插件
@ -44,5 +45,10 @@ export default new VueRouter({
name: 'TwInfo', //路由名称,
component: TwInfo //对应的组件模板
},
{ //每一个链接都是一个对象
path: '/TwInfoXq', //链接路径
name: 'TwInfoXq', //路由名称,
component: TwInfoXq //对应的组件模板
},
]
})

82
kcui/src/view/TWInfo.vue

@ -1,5 +1,6 @@
<template>
<div style="width: 100%;height: 100%;background-color: #00173a">
<div style="width: 100%;height: 100%;">
<img style="width: 100%;height: 100%;position: absolute;z-index:-1;" src="../assets/img/twbg.jpg">
<headInfo></headInfo>
<!-- 这是内容界面 -->
<div class="content">
@ -12,18 +13,18 @@
</div>
<div class="leftBox2">
<div class="muluBox">
<img src="../assets/img/leftBox.png" style="width: 100%;object-fit: contain;z-index: 1;position: absolute;">
<img src="../assets/img/leftBox1.png" style="width: 100%;object-fit: contain;z-index: 1;position: absolute;">
<div class="muluList">
<div v-for="item in mulu" :key="item" >
<div v-for="item in mulu" :key="item">
<div class="oneMulu" v-if="page!=item" @click="goInfo(item.info)">
<div style="width: 80%;text-align: center;">{{ item.name }}</div>
<img src="../assets/img/jiantou.png"
style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 13%;">
</div>
<div class="oneMuluXuan" v-else >
<div style="width: 72%;text-align: center;" >{{ item.name }}</div>
<div class="oneMuluXuan" v-else>
<div style="width: 72%;text-align: center;">{{ item.name }}</div>
<img src="../assets/img/jiantou.png"
style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 8%;" >
style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 8%;">
</div>
</div>
</div>
@ -44,9 +45,19 @@
</div>
<div
style="width: 94%;height:3vw;position: absolute;z-index: 1;top: 4.9vw;left: 3%;background-color: #0c3068;box-shadow: 0px -9px 10px 0px rgb(75,230,255);"></div>
<!-- <img src="../assets/img/rightHead.png"-->
<!-- style="width: 96%;height:5vw;position: absolute;z-index: 1;top: 3.1vw;left: 2%;">-->
<div style="width: 94.4%;height: 2.9vw;position: absolute;z-index: 2;margin-left: 2.6%;top: 5vw;">
<div style="width: 94.4%;height: 2.9vw;position: absolute;z-index: 2;margin-left: 2.6%;top: 5vw;"
v-if="this.userType==1">
<div
style="width: 100%;height: 100%;display: flex;flex-direction: row;line-height: 2.9vw;text-align: center;color: #ffffff;">
<div style="width: 10%;">序号</div>
<div style="width: 20%;">标题</div>
<div style="width: 60%;">图片</div>
<div style="width: 10%;">详情</div>
<div style="width: 10%;">操作</div>
</div>
</div>
<div style="width: 94.4%;height: 2.9vw;position: absolute;z-index: 2;margin-left: 2.6%;top: 5vw;"
v-if="this.userType==0">
<div
style="width: 100%;height: 100%;display: flex;flex-direction: row;line-height: 2.9vw;text-align: center;color: #ffffff;">
<div style="width: 10%;">序号</div>
@ -58,12 +69,25 @@
</div>
<div class="rightList">
<img src="../assets/img/rightList.png" style="width: 100%;height: 95%;position: absolute;z-index: 1;"/>
<div class="rightListContent">
<div class="rightListContent" v-if="this.userType==0">
<div class="oneRight" v-for="item in contentList" :key="item">
<div style="width: 8%;">{{ item.id }}</div>
<div style="width: 22%;">{{ item.name }}</div>
<div style="width: 60%;">图片</div>
<div style="width: 10%;text-decoration: underline;font-style: italic;" @click="goXq(item.id)">点击查看详情</div>
</div>
</div>
<div class="rightListContent" v-if="this.userType==1">
<div class="oneRight" v-for="item in contentList" :key="item">
<div style="width: 8%;">{{ item.id }}</div>
<div style="width: 22%;">{{ item.name }}</div>
<div style="width: 60%;">图片</div>
<div style="width: 10%;text-decoration: underline;font-style: italic;">点击查看详情</div>
<div style="width: 10%;text-decoration: underline;font-style: italic;" @click="goXq(item.id)">点击查看详情</div>
<div
style="width: 9%;text-decoration: underline;font-style: italic;display: flex;justify-content: space-around;margin-left: 1%;">
<div @click="editTw(item.id)">修改</div>
<div @click="deleteTw(item.id)">删除</div>
</div>
</div>
</div>
<div class="pageList">
@ -88,7 +112,7 @@
<script>
import headInfo from '@/components/Head.vue';
import Foot from "@/components/Foot.vue";
import {getDocList} from "@/api/kcInfo";
import {getDocList, getTwInfo} from "@/api/kcInfo";
export default {
// eslint-disable-next-line vue/multi-word-component-names
@ -97,7 +121,7 @@ export default {
data() {
return {
userName: "",
userType:0,
userType: 0,
mulu: [
{id: 0, name: "图文资源", info: "TwInfo"},
{id: 1, name: "视频资源", info: "SpInfo"},
@ -121,9 +145,9 @@ export default {
},
methods: {
goInfo(info){
goInfo(info) {
console.log(info)
this.$router.push('/'+info)
this.$router.push('/' + info)
},
changeType(item) {
this.twType = item;
@ -167,6 +191,30 @@ export default {
console.log(this.onePagesList)
})
},
goXq(id) {
var data = {
id: id
}
getTwInfo(data).then((res) => {
this.$router.push({path: '/TwInfoXq', query: {id: id, level: res.data.level, type: "tw"}})
})
},
//
deleteTw() {
console.log("这是删除操作")
},
editTw(id) {
//
var data = {
id: id
}
getTwInfo(data).then((res) => {
console.log(res.data)
})
}
},
mounted() {
@ -191,7 +239,7 @@ export default {
.leftBox1 {
width: 100%;
height: 10%;
margin-top: 12%;
margin-top: 10%;
color: #7cdeff;
}
@ -202,7 +250,7 @@ export default {
}
.muluBox {
margin: 3% 14%;
margin: 0% 14%;
height: 92%;
width: 72%;
position: relative;

2
src/main/java/com/main/woka/Filter/TestFilter.java

@ -49,7 +49,7 @@ public class TestFilter implements Filter {
response.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept, Origin, X-Requested-With"); // 确保包含 Content-Type
response.setHeader("Access-Control-Allow-Credentials", "true");
//校验重复提交
System.out.println("laile");
if(true){

89
src/main/java/com/main/woka/Web/Controller/KcInfoController.java

@ -4,10 +4,13 @@ import com.main.woka.Common.core.AjaxResult;
import com.main.woka.Web.Dao.KcInfo;
import com.main.woka.Web.Mapper.KcFileMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.List;
@RestController
@RequestMapping("/kcDoc")
@ -21,25 +24,63 @@ public class KcInfoController extends BaseController {
public AjaxResult getDocList(@RequestBody KcInfo kcInfo) {
// int pageNum = kcInfo.getPageNum() == null ? 1 : kcInfo.getPageNum();
// int pageSize = kcInfo.getPageSize() == null ? 10 : kcInfo.getPageSize();
// int offset = (pageNum - 1) * pageSize;
//
// kcInfo.setOffset(offset);
// Long total = kcFileMapper.getKcCount(kcInfo);
// List<KcInfo> list = kcFileMapper.getkcList(kcInfo);
//
// int totalPages = (int) Math.ceil((double) total / pageSize);
//
// AjaxResult ajax = new AjaxResult();
// ajax.put("list",list);
// ajax.put("total",total);
// ajax.put("totalPages",totalPages);
// ajax.put("pageSize",pageSize);
//
//
//
// return AjaxResult.success(ajax);
return null;
int pageNum = kcInfo.getPageNum() == null ? 1 : kcInfo.getPageNum();
int pageSize = kcInfo.getPageSize() == null ? 10 : kcInfo.getPageSize();
int offset = (pageNum - 1) * pageSize;
kcInfo.setOffset(offset);
Long total = kcFileMapper.getKcCount(kcInfo);
List<KcInfo> list = kcFileMapper.getkcList(kcInfo);
int totalPages = (int) Math.ceil((double) total / pageSize);
AjaxResult ajax = new AjaxResult();
ajax.put("list",list);
ajax.put("total",total);
ajax.put("totalPages",totalPages);
ajax.put("pageSize",pageSize);
return AjaxResult.success(ajax);
// return null;
}
//管理员修改文件
@GetMapping("/getTwInfo")
public AjaxResult editTwInfo(@RequestParam("id") Long id){
System.out.println(id);
AjaxResult ajax = new AjaxResult();
KcInfo aa = kcFileMapper.selectById(id);
String path = aa.getTwUrl();
File file = new File(path);
String string = txt2String(file);
aa.setContentInfo(string);
ajax.put("data",aa);
return AjaxResult.success(ajax);
}
//读取txt文件方法
public static String txt2String(File file) {
StringBuilder result = new StringBuilder();
try {
// 构造一个BufferedReader类来读取文件
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
// BufferedReader br = new BufferedReader(new FileReader(file));
String s = null;
// 使用readLine方法,一次读一行
while ((s = br.readLine()) != null) {
result.append(System.lineSeparator() + s);
}
br.close();
} catch (Exception e) {
e.printStackTrace();
}
return result.toString();
}
}

9
src/main/java/com/main/woka/Web/Dao/KcInfo.java

@ -37,6 +37,15 @@ public class KcInfo {
private Integer offset;
private String contentInfo;//文章内容
public String getContentInfo() {
return contentInfo;
}
public void setContentInfo(String contentInfo) {
this.contentInfo = contentInfo;
}
public Long getId() {
return id;

3
src/main/resources/application.properties

@ -6,7 +6,8 @@
#spring.task.execution.shutdown.await-termination:是否等待剩余任务完成后才关闭应用
#spring.task.execution.shutdown.await-termination-period:等待剩余任务完成的最大时间
#spring.task.execution.thread-name-prefix:线程名的前缀,设置好了之后可以方便我们在日志中查看处理任务所在的线程池
spring.servlet.multipart.max-file-size=50MB
spring.servlet.multipart.max-request-size=50MB
spring.task.execution.pool.core-size=8
spring.task.execution.pool.max-size=20
spring.task.execution.pool.queue-capacity=20

Loading…
Cancel
Save