Browse Source

Merge branch 'zxm' of http://124.70.32.114:3100/zhangxiaomeng/kechengfuzhu into wzx

# Conflicts:
#	kcui/src/main.js
#	kcui/src/view/Graph.vue
wzx
linsheng0116 1 year ago
parent
commit
3d80fdcb92
  1. 2
      kcui/package.json
  2. 2
      kcui/public/index.html
  3. 17
      kcui/src/api/login.js
  4. BIN
      kcui/src/assets/img/loginBg.png
  5. BIN
      kcui/src/assets/img/loginBox.png
  6. BIN
      kcui/src/assets/img/loginButton.png
  7. BIN
      kcui/src/assets/img/mulubg.png
  8. BIN
      kcui/src/assets/img/mululist.png
  9. BIN
      kcui/src/assets/img/password.png
  10. BIN
      kcui/src/assets/img/userInfo.png
  11. 18
      kcui/src/main.js
  12. 17
      kcui/src/router/router.js
  13. 144
      kcui/src/view/Graph.vue
  14. 63
      kcui/src/view/Mulu.vue
  15. 4
      src/main/java/com/main/woka/Common/util/PasswordUtil.java
  16. 25
      src/main/java/com/main/woka/Web/Controller/LoginController.java

2
kcui/package.json

@ -1,5 +1,5 @@
{
"name": "testvue",
"name": "kcfz",
"version": "0.1.0",
"private": true,
"scripts": {

2
kcui/public/index.html

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<title>课程辅助</title>
</head>
<body>
<noscript>

17
kcui/src/api/login.js

@ -1,13 +1,24 @@
import request from "@/utils/request";
// 登录方法
export function userLogin() {
export function doLogin(data) {
return request({
url: '/user/doLogin',
method: 'get',
url: '/login/doLogin',
method: 'post',
data: data
})
}
export function registered(data) {
return request({
url: '/login/registered',
method: 'post',
data: data
})
}
export function test() {
return request({

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

18
kcui/src/main.js

@ -1,18 +1,18 @@
import Vue from 'vue';
import App from './App.vue';
import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router';
import router from './router/router.js';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'; // 引入样式
import 'element-ui/lib/theme-chalk/index.css';
Vue.config.productionTip = false;
import router from '../src/router/router.js'
// 安装 Vue Router 插件
Vue.use(VueRouter);
// 安装 Element UI 插件
Vue.config.productionTip = false
Vue.use(ElementUI);
// 安装 Vue Router 插件
Vue.use(VueRouter);
new Vue({
router, // 将路由器传递给 Vue 实例
render: h => h(App),
}).$mount('#app');
}).$mount('#app')

17
kcui/src/router/router.js

@ -1,11 +1,12 @@
//1.导入vue 和 vuerouter 的包
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/view/Home.vue'
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 Login from '@/view/Login.vue'
import Mulu from '@/view/Mulu.vue'
//2.调用vue.use() 函数,把 VueRouter 安装为 Vue 的插件
//vue.use()函数的作用,就是来安装插件的
Vue.use(VueRouter)
@ -15,7 +16,17 @@ export default new VueRouter({
routes: [ //配置路由,这里是个数组
{ //每一个链接都是一个对象
path: '/', //链接路径
name: 'Home', //路由名称,
name: 'Login', //路由名称,
component: Login, //对应的组件模板
},
{ //每一个链接都是一个对象
path: '/Mulu', //链接路径
name: 'Mulu', //路由名称,
component: Mulu, //对应的组件模板
},
{ //每一个链接都是一个对象
path: '/Graph', //链接路径
name: 'Graph', //路由名称,
component: Home //对应的组件模板
},
{ //每一个链接都是一个对象

144
kcui/src/view/Home.vue → kcui/src/view/Graph.vue

@ -2,12 +2,6 @@
<div style="width: 100%;height: 100%;">
<div style="width: 100%;height: 4vw;background-color: #42b983;">
<div style="background-color: silver;width: 3vw;height: 2vw;line-height: 2vw;text-align: center;" @click="goBook">跳转1</div>
<div class="stText">关键字:</div>
<input class="stInput" placeholder="请输入关键字" v-model="keywords"/>
<div @click="getInfo"
style="width: 4vw;height: 2vw;margin-left:0.2vw;background-color: #0AB7FD;float: right;font-size: 1vw;line-height: 2vw;text-align: center;border-radius:2vw;margin-top: 0.1vw;">
查询
</div>
</div>
<div style="width: 100%;height: 80%;">
<div class="gContainer">
@ -15,62 +9,48 @@
</div>
</div>
<!-- 弹窗 -->
<el-dialog
:visible.sync="isModalVisible"
title="添加分支内容"
width="30%"
top="15vh"
append-to-body
custom-class="custom-dialog"
>
<el-form label-width="80px">
<el-form-item label="fileId">
<el-input v-model="newBranchFileId"></el-input>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="typeValue" placeholder="请选择类型">
<el-option label="图文" value="图文"></el-option>
<el-option label="视频" value="视频"></el-option>
<el-option label="动画" value="动画"></el-option>
</el-select>
</el-form-item>
<el-form-item label="节点名称">
<el-input v-model="newBranchContent"></el-input>
</el-form-item>
<el-form-item label="节点内容">
<el-input type="textarea" v-model="newBranchValue"></el-input>
</el-form-item>
<el-form-item label="父级节点ID">
<el-input v-model="newBranchParentId" disabled></el-input>
</el-form-item>
<el-form-item label="关系">
<el-input v-model="newBranchRelation"
@input="newBranchRelation = $event.target.value.replace(/[^a-zA-Z\u4e00-\u9fa5]/g, '')"></el-input>
</el-form-item>
<el-form-item label="层级">
<el-input-number v-model="newBranchLevel" controls-position="right" :min="1"></el-input-number>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeModal"> </el-button>
<el-button type="primary" @click="addNewBranch"> </el-button>
</span>
</el-dialog>
<div v-if="isModalVisible" style="height: 5vw;width: 100%;" class="modal-overlay" @click.self="closeModal">
<div class="modal-content">
<h3>请输入分支内容</h3>
<label for="fileId">fileId:</label>
<input type="text" id="fileId" v-model="newBranchFileId" />
<label for="txtName">节点名称:</label>
<input type="text" id="txtName" v-model="newBranchContent" />
<label for="TxtValue">节点内容:</label>
<textarea id="TxtValue" v-model="newBranchValue"></textarea>
<label for="parentId">父级节点ID:</label>
<input type="text" id="parentId" v-model="newBranchParentId" />
<label for="relation">关系:</label>
<input type="text" id="relation" v-model="newBranchRelation"
@input="newBranchRelation = $event.target.value.replace(/[^a-zA-Z\u4e00-\u9fa5]/g, '')" />
<label for="level">层级:</label>
<input type="number" id="level" v-model="newBranchLevel" />
<button @click="addNewBranch">提交</button>
</div>
</div>
</div>
</template>
<script>
import {getgraphInfo, test, userLogin} from "@/api/login";
import {getgraphInfo, test} from "@/api/login";
import VisGraph from '@/assets/js/graphvis.min.20241008.js'
import LayoutFactory from '@/assets/js/graphvis.layout.min.js'
import {config} from '@/assets/defaultConfig.js'
import {addNode, getFileIdByDocId} from "@/api/file";
import {addNode} from "@/api/file";
export default {
// eslint-disable-next-line vue/multi-word-component-names
name: 'Home',
name: 'Graph',
data() {
return{
infos:[],
@ -89,9 +69,8 @@ export default {
newBranchFileId: '',
newBranchLevel: null,
newBranchParentId: '',
newBranchRelation:'',
typeValue: '',
keywords: '',
newBranchRelation:''
}
},
methods:{
@ -101,34 +80,12 @@ export default {
onCreated(editor) {
this.editor = Object.seal(editor) // Object.seal()
},
// getInfo(){
// var data = {}
// getgraphInfo(data).then((res)=>{
// this.zhengl(res.data);
//
// })
// },
getInfo(){
this.data = undefined;
if (this.keywords != '' && this.keywords != undefined) {
this.visGraph.clearAll();
let params = {
nodename: this.keywords,
};
getgraphInfo(params).then((res) => {
var data = {}
getgraphInfo(data).then((res)=>{
this.zhengl(res.data);
})
} else {
let params = {};
getgraphInfo(params).then((res) => {
this.zhengl(res.data);
})
}
},
async drawGraphData() {
this.graphData = this.demoData;
@ -165,27 +122,14 @@ export default {
};
this.visGraph = new VisGraph(document.getElementById('graph-panel'), configWithEvents);
},
async showPopup(node) {
showPopup(node) {
console.log("o----------")
console.log(node)
this.selectedNode = node;
this.newBranchParentId = node.properties.docId;
this.newBranchLevel = parseInt(node.properties.level) + 1;
try {
const response = await this.getFileIdByDocId({ docId: node.properties.docId });
this.newBranchFileId = response.fileId;
} catch (error) {
console.error('Failed to fetch file ID:', error);
alert('无法获取文件ID,请稍后再试。');
return;
}
this.isModalVisible = true; //
},
getFileIdByDocId(data) {
return getFileIdByDocId(data);
},
closeModal() {
this.isModalVisible = false;
this.newBranchContent = '';
@ -343,13 +287,13 @@ export default {
return styles[group] || {};
},
doLogin(){
userLogin().then((res)=>{
console.log(res);
this.testInfo();
this.getInfo();
})
},
// doLogin(){
// userLogin().then((res)=>{
// console.log(res);
// this.testInfo();
// this.getInfo();
// })
// },
testInfo(){
test().then((res)=>{
console.log(res);
@ -357,8 +301,8 @@ export default {
}
},
mounted() {
this.doLogin();
this.getInfo();
// this.doLogin();
}
}
</script>

63
kcui/src/view/Mulu.vue

@ -0,0 +1,63 @@
<template>
<div style="width: 100%;height: 100%;">
<img style="width: 100%;height: 100%;position: absolute;z-index:99;" src="../assets/img/mulubg.png">
<img src="../assets/img/mululist.png" style="width: 100%;height: 100%;position: absolute;z-index:100;">
<headInfo style="position: absolute;z-index: 100"></headInfo>
<div class="mululist">
<div v-for="item in mulu" :key="item" style="width: 100%;height: 10%;">
{{item.name}}
</div>
</div>
<div style="width: 100%;height: 3%;position: fixed;bottom: 0px;z-index: 100">
<foot></foot>
</div>
</div>
</template>
<script>
import headInfo from "@/components/Head.vue";
import Foot from "@/components/Foot.vue";
export default {
// eslint-disable-next-line vue/multi-word-component-names
name: 'Home',
components: {Foot, headInfo},
data() {
return{
mulu:[
{id:0,name:"图文资源"},
{id:1,name:"视频资源"},
{id:2,name:"动画显示"},
{id:3,name:"计算模块"},
{id:4,name:"知识图谱"},
{id:4,name:"帮助文档"},
]
}
},
methods:{
},
mounted() {
}
}
</script>
<style scoped>
.mululist{
display: flex;
flex-direction: column;
justify-content: space-around;
width: 10%;
height: 50%;
//background-color: #42b983;
position: absolute;
top: 25%;
z-index: 110;
left: 15%;
text-align: center;
font-size: 1.2vw;
color: #ffffff;
}
</style>

4
src/main/java/com/main/woka/Common/util/PasswordUtil.java

@ -1,8 +1,10 @@
package com.main.woka.Common.util;
import org.springframework.stereotype.Component;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@Component
public class PasswordUtil {
// 将给定的字符串通过MD5转换为哈希值

25
src/main/java/com/main/woka/Web/Controller/LoginController.java

@ -3,18 +3,16 @@ package com.main.woka.Web.Controller;
import cn.dev33.satoken.stp.StpUtil;
import com.main.woka.Common.core.AjaxResult;
import com.main.woka.Common.util.PasswordUtil;
import com.main.woka.Web.Dao.GraphQuery;
import com.main.woka.Web.Dao.KcUser;
import com.main.woka.Web.Mapper.KcUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@RestController
@RequestMapping("/login")
public class LoginController extends BaseController{
@Autowired
@ -33,28 +31,31 @@ public class LoginController extends BaseController{
return AjaxResult.error("请填写用户名");
}
//判断是不是有密码
if(kcUser.getPassword()==null || kcUser.getPassword().equals("")){
return AjaxResult.error("请填写密码");
}
kcUser.setPassword(null);
KcUser selectUser = new KcUser();
selectUser.setUserName(kcUser.getUserName());
//查询这个人
List<KcUser> list = kcUserMapper.selectUser(kcUser);
List<KcUser> list = kcUserMapper.selectUser(selectUser);
KcUser loginUser = list.get(0);
String userPassword = loginUser.getPassword();//获取这个用户的加密后的密码
//判断密码是否正确
String password = kcUser.getPassword();
String MD5 = passwordUtil.hashPassword(password);
String password1 = kcUser.getPassword();
String MD5 = passwordUtil.hashPassword(password1);
if(!userPassword.equals(MD5)){
return AjaxResult.error("密码错误");
}
StpUtil.login(kcUser.getId());//登录
StpUtil.login(loginUser.getId());//登录
// 获取当前登录的Token(假设你使用的是默认的Token名称 "satoken")
String token = StpUtil.getTokenValue();
@ -71,7 +72,9 @@ public class LoginController extends BaseController{
// 将Cookie添加到响应中
response.addCookie(cookie);
ajaxResult.put("info",kcUser);
loginUser.setPassword(null);
ajaxResult.put("info",loginUser);
return ajaxResult;
}

Loading…
Cancel
Save