fix/non-blocking-route-navigation
qinzhenpen 2 years ago
commit 9ca910ee48

@ -5,4 +5,4 @@ VITE_APP_TITLE = 数字营销实训系统
VITE_APP_ENV = 'development'
# 若依管理系统/开发环境
VITE_APP_BASE_API = 'http://192.168.2.6:9868'
VITE_APP_BASE_API = 'http://192.168.2.16:9868'

@ -7,6 +7,5 @@ export function accessAI(data) {
method: 'post',
data:data,
timeout: 100000,
responseType: 'blob',
})
}

@ -1,20 +1,19 @@
import request from '@/utils/request'
// 登录方法
export function login(username, password, code, uuid) {
export function login(username, passwordEncode, TOKEN) {
const data = {
username,
password,
code,
uuid
passwordEncode,
TOKEN
}
return request({
url: '/login',
url: '/api/user/login',
headers: {
isToken: false
},
method: 'post',
data: data
params: data
})
}

@ -0,0 +1,81 @@
import request from '@/utils/request'
//学习资源查看
export function learningResourcesView(query) {
return request({
url: "/api/stu/concept/block/getBlockResources",
method: "get",
params:query
});
}
//获取视频流
export function getVideoStream(query) {
return request({
url: "/api/stu/concept/block/getResource",
method: "get",
params:query
});
}
//资源学习分数统计
export function resourcesLearningScoreStatistics(query) {
return request({
url: "/api/stu/concept/block/hashWatchScore",
method: "post",
data:query
});
}
//学习资源查看
export function checkLearningAssessment(query) {
return request({
url: "/api/stu/concept/block/getBlockResources",
method: "get",
params:query
});
}
//学习测评计分
export function scoreLearningAssessment(query) {
return request({
url: "/api/stu/digitalCredit/hashLearningAssessmentScore",
method: "post",
data:query
});
}
//知识笔记上传
export function uploadingKnowledgeNotes(query) {
return request({
url: "/api/stu/digitalCredit/addKnowledgeNotes",
method: "post",
data:query
});
}
//知识笔记回显
export function viewKnowledgeNotes(query) {
return request({
url: "/api/stu/digitalCredit/getKnowledgeNotes",
method: "post",
params:query
});
}
//学习成绩查询
export function academicRecordEnquiry(query) {
return request({
url: "/api/userBehavior/getAcademicRecord",
method: "post",
params:query
});
}
//上传实训报告
export function uploadTrainingReport(query) {
return request({
url: "/api/stu/concept/block/upload",
method: "post",
data:query
});
}
//获取实训报告详情
export function getDetailsTrainingReport(query) {
return request({
url: "/api/stu/concept/block/getReport",
method: "get",
params:query
});
}

@ -0,0 +1 @@
<svg t="1693990215046" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9835" width="200" height="200"><path d="M0 0m292.571429 0l438.857142 0q292.571429 0 292.571429 292.571429l0 292.571428q0 292.571429-292.571429 292.571429l-438.857142 0q-292.571429 0-292.571429-292.571429l0-292.571428q0-292.571429 292.571429-292.571429Z" fill="#1296db" p-id="9836" data-spm-anchor-id="a313x.search_index.0.i1.4fb93a81PyrcFM" class=""></path><path d="M438.857143 585.142857m0 73.142857l0 292.571429q0 73.142857-73.142857 73.142857l0 0q-73.142857 0-73.142857-73.142857l0-292.571429q0-73.142857 73.142857-73.142857l0 0q73.142857 0 73.142857 73.142857Z" fill="#2c2c2c" p-id="9837" data-spm-anchor-id="a313x.search_index.0.i5.4fb93a81PyrcFM" class="selected"></path><path d="M877.714286 585.142857m0 73.142857l0 292.571429q0 73.142857-73.142857 73.142857l0 0q-73.142857 0-73.142858-73.142857l0-292.571429q0-73.142857 73.142858-73.142857l0 0q73.142857 0 73.142857 73.142857Z" fill="#2c2c2c" p-id="9838" data-spm-anchor-id="a313x.search_index.0.i3.4fb93a81PyrcFM" class="selected"></path><path d="M658.285714 438.857143m0 73.142857l0 438.857143q0 73.142857-73.142857 73.142857l0 0q-73.142857 0-73.142857-73.142857l0-438.857143q0-73.142857 73.142857-73.142857l0 0q73.142857 0 73.142857 73.142857Z" fill="#2c2c2c" p-id="9839" data-spm-anchor-id="a313x.search_index.0.i4.4fb93a81PyrcFM" class="selected"></path></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -0,0 +1 @@
<svg t="1694052338470" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4058" width="200" height="200"><path d="M64 66.64m135.2 0l625.6 0q135.2 0 135.2 135.2l0 625.6q0 135.2-135.2 135.2l-625.6 0q-135.2 0-135.2-135.2l0-625.6q0-135.2 135.2-135.2Z" fill="#9E74FF" p-id="4059" data-spm-anchor-id="a313x.search_index.0.i1.45f43a81aJNwrV" class="selected"></path><path d="M437.84 698.24h128.4V495.2l-61.84 51.76-66.56-35.6z m158.64-227.28v227.28h128V472l-54.08-70.96zM280 698.24h128V493.84l-35.68-24L280 548.32z m441.68 23.52H279.12a17.2 17.2 0 0 0-17.44 16.8 17.84 17.84 0 0 0 17.44 17.52h443.04a17.44 17.44 0 0 0 17.52-17.52 18.32 18.32 0 0 0-18.16-16.8zM300.64 491.2l69.92-57.84L504 514l158-147.2c0.64-0.72 1.36-1.36 1.36-2l26.56 27.2 42.32-120-122.32 38.96 29.6 29.6c-0.72 0-0.72 0.72-1.36 0.72l-139.2 129.68L367.2 392l-88.72 72.96a17.04 17.04 0 0 0-2 24 16.48 16.48 0 0 0 24.16 2.24z" fill="#FFFFFF" p-id="4060"></path></svg>

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -13,21 +13,33 @@ NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/register'];
// router.beforeEach((to, from, next) => {
// NProgress.start()
// if (!getToken()) {
// next()
// } else {
// // 没有token
// if (whiteList.indexOf(to.path) !== -1) {
// // 在免登录白名单,直接进入
// next()
// } else {
// next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
// // NProgress.done()
// }
// }
// })
router.beforeEach((to, from, next) => {
NProgress.start()
if (getToken()) {
if (to.path === '/login') {
next({ path: '/' })
NProgress.done()
} else {
next()
if (isHttp(to.path)) {
next()
} else {
next()
}
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next()
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done()
}
}
})
router.afterEach(() => {
NProgress.done()

@ -99,13 +99,38 @@ export const constantRoutes = [
{
path: "",
component: Layout,
redirect: "/portraitModel",
redirect: "/learningResources",
children: [
{
path: "/portraitModel",
component: () => import("@/views/portraitModel/index"),
name: "portraitModel",
meta: { title: "用户画像模型", icon: "dashboard", affix: true },
path: "/learningResources",
component: () => import("@/views/learningCenter/learningResources.vue"),
name: "learningResources",
meta: { title: "资源中心", icon: "dashboard", affix: true },
},
],
},
{
path: "",
component: Layout,
redirect: "/evaluation",
children: [
{
path: "/evaluation",
component: () => import("@/views/learningCenter/evaluation.vue"),
name: "evaluation",
meta: { title: "知识测评", icon: "dashboard", affix: true },
},
],
},{
path: "",
component: Layout,
redirect: "/Achievement",
children: [
{
path: "/Achievement",
component: () => import("@/views/learningCenter/Achievement.vue"),
name: "Achievement",
meta: { title: "学习成绩", icon: "dashboard", affix: true },
},
],
},

@ -1,5 +1,5 @@
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import { getToken, setToken, removeToken,setUserInfo,removeUserInfo } from '@/utils/auth'
import defAva from '@/assets/images/profile.jpg'
const useUserStore = defineStore(
@ -17,12 +17,12 @@ const useUserStore = defineStore(
login(userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
const TOKEN = userInfo.token
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
setToken(res.token)
this.token = res.token
login(username, password, TOKEN).then(res => {
setToken(res.data.accessToken)
this.token = res.data.accessToken
setUserInfo(JSON.stringify(res.data))
resolve()
}).catch(error => {
reject(error)
@ -53,15 +53,16 @@ const useUserStore = defineStore(
// 退出系统
logOut() {
return new Promise((resolve, reject) => {
logout(this.token).then(() => {
// logout(this.token).then(() => {
this.token = ''
this.roles = []
this.permissions = []
removeToken()
removeUserInfo()
resolve()
}).catch(error => {
reject(error)
})
// }).catch(error => {
// reject(error)
// })
})
}
}

@ -1,7 +1,7 @@
import Cookies from 'js-cookie'
const TokenKey = 'Admin-Token'
const user='UserInfo'
export function getToken() {
return Cookies.get(TokenKey)
}
@ -13,3 +13,12 @@ export function setToken(token) {
export function removeToken() {
return Cookies.remove(TokenKey)
}
export function setUserInfo(userinfo) {
return Cookies.set(user, userinfo)
}
export function getUserInfo() {
return Cookies.get(user)
}
export function removeUserInfo() {
return Cookies.remove(user)
}

@ -2,8 +2,8 @@ import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
// 密钥对生成 http://web.chacuo.net/netrsakeypair
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' +
'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
const publicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCRehqqa1eLnTL3BSRq3zmB+Yw7nLAMAZ0G+FpoGP0eFLc0JVC2P2sfkCJJjH2cOmoLcUFjHfDcHzMNyl4wmNTMeXhpvK3v2ha1ufZnGmoMd9d4+1R/t/pZdxXXzkQMN2012X/KIojluEJmrIXLUM0zjOTABSMlTY6TPfSrmuXyGwIDAQAB'
const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n' +
'7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' +

@ -70,6 +70,7 @@ service.interceptors.request.use(config => {
service.interceptors.response.use(res => {
// 未设置状态码则默认成功状态
const code = res.data.code || 200;
// console.log(code);
// 获取错误信息
const msg = errorCode[code] || res.data.msg || errorCode['default']
// 二进制数据则直接返回
@ -110,9 +111,22 @@ service.interceptors.response.use(res => {
} else if (message.includes("timeout")) {
message = "系统接口请求超时";
} else if (message.includes("Request failed with status code")) {
if (message.includes("401")) {
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = true;
useUserStore().logOut().then(() => {
location.href = '/login';
})
}).catch(() => {
isRelogin.show = false;
});
} else if (message.includes("code 400")) {
// ElNotification.error({ title: error.response.data })
ElMessage({ message: error.response.data.msg, type: 'error' })
}
message = "系统接口" + message.substr(message.length - 3) + "异常";
}
ElMessage({ message: message, type: 'error', duration: 5 * 1000 })
// ElMessage({ message: message, type: 'error', duration: 5 * 1000 })
return Promise.reject(error)
}
)

@ -1,186 +1,296 @@
<template>
<div class="app-containere">
<el-scrollbar ref="scrollbar" height="530px">
<div v-for="(message, index) in messages" :key="index" :class="['message', message.type]">
<div class="items-end" v-if="message.type === 'ai-main'">
<img src="@/assets/images/ai.png" alt="">
</div>
<div :class="['items-text', message.type]" :id="'text-container-' + message.id">
<p>{{ message.displayContent }}</p>
<div class="app-containere">
<el-scrollbar ref="scrollbar" height="530px">
<div class="one-AI" v-if="textOne">
<img src="@/assets/images/ai.png" alt="" />
<div class="AI-item">
<h2>你好,我是AI助手</h2>
<p>作为你的智能伙伴,我既能写文章、想点子,又能陪你聊天、答疑解惑。</p>
<p>想知道我还能做什么?点这里快速上手!可以浏览器收藏网站,下次使用更高效哦 ~</p>
<div class="examples">
<div style="flex-basis: 100%;">
<p>你可以试着问我:</p>
</div>
<div class="example-item" v-for="item in itemData" :key="item" @click="sendExample(item)">
<div style="display:flex">
<img :src="getImg(item.img)" alt="">
<span>{{item.title}}</span>
</div>
<p>{{item.text}}</p>
</div>
</div>
</div>
</div>
</el-scrollbar>
<div class="main-input">
<form @submit.prevent="sendText">
<el-scrollbar height="140px">
<div class="inputCode" style="display:flex">
<el-input
@keydown="handleKeyDown"
v-model="input"
type="textarea"
rows='6'
resize='none'
placeholder="文件拖拽进来,使用“/”调用指令,可通过shift+回车换行"
/>
<el-button class="sendButton" :disabled="input===''||butFlag" @click="sendText">
<img src="@/assets/images/发送.png"/>
</el-button>
</div>
</el-scrollbar>
</form>
<div
v-for="(message, index) in messages"
:key="index"
:class="['message', message.type]"
>
<div class="items-end" v-if="message.type === 'ai-main'">
<img src="@/assets/images/ai.png" alt="" />
</div>
<div
:class="['items-text', message.type]"
:id="'text-container-' + message.id"
>
<p>{{ message.displayContent }}</p>
</div>
</div>
</el-scrollbar>
<div class="main-input">
<form @submit.prevent="sendText">
<el-scrollbar height="140px">
<div class="inputCode" style="display: flex">
<el-input
@keydown="handleKeyDown"
v-model="input"
type="textarea"
rows="6"
resize="none"
placeholder="文件拖拽进来,使用“/”调用指令,可通过shift+回车换行"
/>
<el-button
class="sendButton"
:disabled="input === '' || butFlag"
@click="sendText"
>
<img src="@/assets/images/发送.png" />
</el-button>
</div>
</el-scrollbar>
</form>
</div>
</template>
</div>
</template>
<script setup>
import { ref, reactive } from 'vue';
import * as AI from "@/api/AI.js"
const input = ref('');
const butFlag = ref(false);
const messages = reactive([]);
const scrollbar = ref(null);
const sendText = () => {
if (input.value.trim() === '') return;
let text = input.value;
input.value = '';
// 添加用户消息
messages.push({ id: Date.now(), type: 'user-main', displayContent: text });
const sendData=[ {
"content":text,
"functionCall": {
"arguments": "",
"name": "",
"thoughts": ""
},
"name": "",
"role": "user",
"userId": "512"
}]
AI.accessAI(sendData).then((res)=>{
const blob = res;
if (blob instanceof Blob) {
const reader = new FileReader();
reader.onload = function() {
const text = reader.result;
// 使用 receiveText 方法逐字显示返回的文本
receiveText(text);
};
reader.readAsText(blob); // 读取 Blob 数据
} else {
console.error("Expected Blob, but received:", blob);
import { ref, reactive } from "vue";
import * as AI from "@/api/AI.js";
import {getAssetsFile} from "@/utils/index.js"
const input = ref("");
const butFlag = ref(false);
const messages = reactive([]);
const scrollbar = ref(null);
const isRequestPending = ref(false);
const textOne=ref(true)
const getImg=(img)=>{
return getAssetsFile(img)
}
})
};
const receiveText = (text) => {
const messageId = Date.now();
const newMessage = reactive({ id: messageId, type: 'ai-main', displayContent: '' });
messages.push(newMessage);
let index = 0;
const intervalId = setInterval(() => {
if (index < text.length) {
newMessage.displayContent += text[index];
index++;
} else {
clearInterval(intervalId);
}
}, 100);
nextTick(() => {
setTimeout(() => {
const scrollContainer = scrollbar.value?.$el.querySelector('.el-scrollbar__wrap');
if (scrollContainer) {
// 计算并调整滚动位置
scrollContainer.scrollTop = scrollContainer.scrollHeight;
}
}, 100); // 可以增加延迟时间
});
};
const handleKeyDown = (event) => {
if (event.key === 'Enter' && !event.shiftKey) {
event.preventDefault();
sendText();
const itemData=[
{
title:'热点文章编写',
text:'你是一位编辑,请从数学老师王闰秋鼓励支持其发挥数学…',
img:'热点.png'
},
{
title:'暑期实践活动安排',
text:'仿照这些优秀范例,设计一份初中生2024年暑期社会实践…',
img:'安排.png'
},
{
title:'PPT内容框架',
text:'现在你需要制作一份PPT,你需要按照我给出的主题来准备…',
img:'框架.png'
},{
title:'最新学术论文检索',
text:'帮我检索一下今年6月的人工智能领域的最新论文,记得给…',
img:'检索.png'
},{
title:'期末备考计划',
text:'你是大学期末备考专家,我是一名学【工商管理】的学生…',
img:'科研论文.png'
},{
title:'科普2024世界人工智能大会',
text:'阅读下面这些链接,科普一下:2024世界人工智能大会究…',
img:'新闻01.png'
},
]
const sendExample=(item)=>{
textOne.value=false
input.value=item.text
sendText()
}
const sendText = async() => {
if (input.value.trim() === '' || isRequestPending.value) return;
if (input.value.trim() === "") return;
isRequestPending.value = true;
let text = input.value;
textOne.value=false
input.value = "";
// 添加用户消息
messages.push({ id: Date.now(), type: "user-main", displayContent: text });
const sendData = [
{
content: text,
functionCall: {
arguments: "",
name: "",
thoughts: "",
},
name: "",
role: "user",
userId: "512",
},
];
const messageId = Date.now();
const newMessage = reactive({ id: messageId, type: 'ai-main', displayContent: '' });
messages.push(newMessage);
const resp=await fetch('http://192.168.2.16:9868/api/bigModule/createArticleByAi',{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(sendData),
})
const reader=resp.body.getReader()
while(1){
const {done,value}=await reader.read()
if(done){
break
}
};
</script>
const decoder=new TextDecoder()
const tet=decoder.decode(value)
newMessage.displayContent+=tet
}
isRequestPending.value = false;
nextTick(() => {
setTimeout(() => {
const scrollContainer = scrollbar.value?.$el.querySelector('.el-scrollbar__wrap');
if (scrollContainer) {
scrollContainer.scrollTop = scrollContainer.scrollHeight;
}
}, 10);
});
};
const handleKeyDown = (event) => {
if (event.key === "Enter" && !event.shiftKey) {
event.preventDefault();
sendText();
}
};
</script>
<style lang="scss" scoped>
.app-containere{
margin: 10px 4px 10px 10px;
box-shadow: 0px 0px 13px 0px #0452C6;
border-radius: 10px;
padding: 25px;
.app-containere {
margin: 10px 4px 10px 10px;
box-shadow: 0px 0px 13px 0px #0452c6;
border-radius: 10px;
padding: 25px;
}
.message {
display: flex;
align-items: flex-start;
margin-bottom: 10px;
clear: both;
}
.main-input {
background: #011031;
border-radius: 10px;
border: 1px solid #003e7c;
padding: 10px;
}
.inputCode {
.el-button {
margin-top: auto;
background: #ffffff00;
border-color: #ffffff00;
}
.message {
display: flex;
.el-textarea {
--el-input-bg-color: #ffffff00 !important;
--el-input-border-color: #ffffff00;
--el-input-hover-border-color: #ffffff00;
--el-input-focus-border-color: #ffffff00;
--el-input-text-color: #ffffff;
}
}
.ai-main {
display: flex;
justify-content: flex-start;
gap: 1rem;
max-width: 94rem;
clear: both;
.items-end {
align-items: flex-start;
margin-bottom: 10px;
clear: both;
flex-direction: column;
flex-shrink: 0;
display: flex;
position: relative;
}
.main-input {
.items-text {
max-width: calc(100% - 400px);
color: #ffffff;
padding: 0px 20px 0px 10px;
flex-direction: column;
min-width: 0;
background: #011031;
border-radius: 10px;
border: 1px solid #003E7C;
padding: 10px;
border: 1px solid #003e7c;
}
.inputCode {
.el-button {
margin-top: auto;
background: #FFFFFF00;
border-color: #FFFFFF00;
}
.el-textarea {
--el-input-bg-color: #FFFFFF00 !important;
--el-input-border-color: #FFFFFF00;
--el-input-hover-border-color: #FFFFFF00;
--el-input-focus-border-color: #FFFFFF00;
--el-input-text-color: #FFFFFF;
}
}
.user-main {
justify-content: flex-end;
margin-top: 15px;
display: flex;
float: right;
gap: 1rem;
max-width: 94rem;
clear: both;
.items-text {
color: #ffffff;
padding: 0px 20px 0px 10px;
flex-direction: column;
min-width: 0;
background: #011031;
border-radius: 10px;
border: 1px solid #003e7c;
margin-right: 15px;
}
.ai-main {
display: flex;
justify-content: flex-start;
gap: 1rem;
max-width: 94rem;
clear: both;
.items-end {
align-items: flex-start;
flex-direction: column;
flex-shrink: 0;
display: flex;
position: relative;
}
.items-text {
color: #FFFFFF;
padding: 0px 20px 0px 10px;
flex-direction: column;
min-width: 0;
background: #011031;
border-radius: 10px;
border: 1px solid #003E7C;
}
}
.one-AI{
display: flex;
width: 100%;
img{
width: 31px;
height: 31px;
}
.user-main {
justify-content: flex-end;
margin-top: 15px;
display: flex;
float: right;
gap: 1rem;
max-width: 94rem;
clear: both;
.items-text {
color: #FFFFFF;
padding: 0px 20px 0px 10px;
flex-direction: column;
min-width: 0;
background: #011031;
border-radius: 10px;
border: 1px solid #003E7C;
margin-right: 15px;
.AI-item{
width: calc(100% - 200px);
margin-left: 10px;
background: #011031;
border-radius: 10px;
border: 1px solid #003E7C;
padding: 10px 15px;
color:#FFFFFF;
p{
font-size: 12px;
}
.examples{
display: flex;
flex-wrap: wrap;
margin-top: 60px;
width: calc(100% - 300px);
.example-item{
margin: 0 25px 15px 0;
cursor: pointer;
width: 349px;
height: 72px;
background: #002C5B;
border-radius: 10px;
padding: 10px;
img{
width: 20px;
height: 20px;
}
span{
margin-left: 5px;
font-weight: 400;
font-size: 16px;
color: #FFFFFF;
}
}
}
}
</style>
}
</style>

@ -0,0 +1,541 @@
<template>
<div class="app-container">
<div class="img-centent">
<div class="left" style=" width: 100%" >
<el-scrollbar height="650px" style="height:96%">
<el-row>
<el-col :span="24">
<div class="title-back">
<span>任务背景</span>
</div>
</el-col>
</el-row>
<div>
<p style="color:#FFFFFF">
小张去东北旅游,看到了很多以前没见过的植物,于是使用手机中拍照识图类APP识别自己所看到的植物,其中有以下两张鸢尾花的照片,<br />
APP准确识别出了这是变色鸢尾和山鸢尾,他想知道手机APP是怎么做到如此精准的识别的,接下来,我们就带他体验其中的原理吧。
</p>
<div class="Step">
<div class="Step-item">步骤一</div>
<span>下图为小张拍出的两张鸢尾花照片(图源来自百度)</span>
</div>
<div class="img">
<img src="@/assets/images/szjj/u744.jpg" alt="" />
<img src="@/assets/images/szjj/u745.png" alt="" />
</div>
<div class="Step2" v-for="item in topicList" :key="item">
<div class="Step">
<div class="Step-item">步骤二</div>
<span>特征提取</span>
</div>
<p class="a" style="color:#FFFFFF">{{ item.stemContent }}</p>
<p>
<el-radio
label="两张图片花的颜色不同"
size="large"
v-model="item.studentAnswer"
@change="submit"
>A. {{ item.optionA }}</el-radio
>
</p>
<p>
<el-radio
label="两张图片花瓣数量不同"
size="large"
v-model="item.studentAnswer"
@change="submit"
>B. {{ item.optionB }}</el-radio
>
</p>
<p>
<el-radio
label="两张图片花瓣的长度和宽度不同"
size="large"
v-model="item.studentAnswer"
@change="submit"
>C. {{ item.optionC }}</el-radio
>
</p>
<p>
<el-radio
label="两张图片花的植株高度不同"
size="large"
v-model="item.studentAnswer"
@change="submit"
>D. {{ item.optionD }}</el-radio>
</p>
</div>
<div class="Step3">
<div class="Step">
<div class="Step-item">步骤三</div>
<span>训练分类器</span>
</div>
<p style="color:#FFFFFF">
假设我们根据上述特征区分出了变色鸢尾和山鸢尾,我们把特征进行量化,假设测量得到一朵鸢尾花的花瓣长度为1.1cm,宽度为0.1cm,那么这朵鸢尾花的特征就可以用(1.1,0.1)表示,<br />我们表示在直角坐标系中,就可以是直角坐标系中的一个点。如下:
</p>
<img src="@/assets/images/szjj/setpt1.png" alt="" />
<p style="color:#FFFFFF">
那么我们可以想象这样一个场景,我们把大量变色鸢尾和山鸢尾的图片喂给计算机,同时输入图片的花瓣长度和宽度特征数据,并把变色鸢尾图片标注为0,把山鸢尾图片标注为1,山鸢尾用黑色的点表示,变色鸢尾<br />用白色的点表示,那么我们可以训练出一个分类器。
</p>
<span class="btn"> 分类器训练</span>
<p><img src="@/assets/images/szjj/setpt2.png" alt="" /></p>
<p style="color:#FFFFFF">
这是一个简单的分类,当我们用数据对分类器进行了训练,那么它就具备了识别能力,当训练数据量越大,特征提取的越多越精确,那么系统识别能力就越精确。
</p>
<p style="color:#FFFFFF">
这个时候我们上传一张鸢尾花图片,或者用手机对着鸢尾花拍照,系统就会计算花瓣的长度和宽度,然后对比系统已有的数据,看是落在线的上面还是下面,如果<br />落在线的下面则系统识别为1,即为山鸢尾。
</p>
<span class="btn btn1" @click="Upload" :class="{'is-disabled':Answer!==''}">上传鸢尾花图片</span
>
<p><img :src="getAssetsFile(Identifyimg)" alt=""/></p>
<p>
<label for="" style="color:#FFFFFF">系统识别您上传的鸢尾花为:</label>
<el-select
class="m-2"
placeholder="请选择"
size="large"
style="width: 382px"
v-model="value"
@change="selectChange"
>
<el-option label="变色鸢尾花" value="变色鸢尾花" />
<el-option label="山鸢尾花" value="山鸢尾花" />
</el-select>
</p>
</div>
</div>
</el-scrollbar>
<div class="dialog-footer">
<el-button type="primary" round plain size="large" @click="submitTask" >提交任务</el-button>
<el-button type="primary" round plain size="large" @click="reset">重新开始</el-button>
</div>
</div>
<div class="Case">
<span @click="centerDialogVisible=true"></span>
</div>
<el-dialog
custom-class="gdialog"
v-model="centerDialogVisible"
title="图像识别"
width="70%">
<el-scrollbar height="666px">
<p>
随着计算机视觉技术的发展,图像识别技术已经成为了一个热门话题。图像识别是指将图像中的信息转换为可以被计算机理解和处理的形式,从而实现图像的自动分析和处理。<br />下面,我们就来看看如何进行图像识别。
</p>
<span class="headline">一、图像识别技术的分类</span>
<p>
根据图像识别技术的不同,可以将其分为两类:一类是传统的图像识别技术,另一类是深度学习图像识别技术。
</p>
<p>
传统的图像识别技术主要是基于经验和专家知识的,例如分类、检索、识别等。这种技术虽然简单、可靠,但是在处理大量的图像时,往往需要人工干预,效率低下。
</p>
<p>
深度学习图像识别技术则是基于机器学习和深度神经网络的,它能够自动地学习和识别图像中的特征,从而实现自动分类、检索、识别等任务。相比于传统的图像识别技术,深度学习图像识别技术更加高效、准确,<br />能够处理大量的图像数据,并且具有更好的鲁棒性和泛化能力。
</p>
<span class="headline">二、图像识别技术的流程</span>
<p>图像识别技术的流程一般包括以下几个步骤:</p>
<p>
1、图像预处理:对待识别的图像进行预处理,包括图像增强、灰度化、二值化等操作,以提高图像的可读性和稳定性。
</p>
<p>
2、特征提取:从待识别的图像中提取出有用的特征,这是图像识别的关键步骤。常用的特征提取方法包括卷积神经网络、最大池化等。
</p>
<p>
3、模型训练:使用机器学习或深度学习算法,构建图像识别模型,并进行训练。常用的模型训练方法包括随机森林、卷积神经网络等。
</p>
<p>
4、模型预测:使用训练好的模型对待识别的图像进行预测,得到识别结果。
结果分析:对识别结果进行分析和处理,得到图像的分类、检索、识别等结果。
</p>
<span class="headline">三、图像识别技术的应用</span>
<p>
图像识别技术已经广泛应用于各个领域,例如人脸识别、目标检测、图像搜索、自动驾驶等。下面我们来看看一些具体的应用场景。
</p>
<p>
1、人脸识别:人脸识别是图像识别技术的一个重要应用领域,它可以用于身份识别、安全监控等方面。
</p>
<p>
2、目标检测:目标检测是指在图像中检测出目标的位置和大小等信息,常用于图像搜索、人脸识别等方面。
</p>
<p>
3、图像搜索:图像搜索是指在大量的图像中快速定位需要的图像,常用于目标检测、图像搜索等方面。
</p>
<p>
4、自动驾驶:自动驾驶是指让计算机自动驾驶汽车,图像识别技术可以用于汽车的自动驾驶控制、障碍物检测等方面。
</p>
<span class="headline">四、总结</span>
<p>
图像识别技术是一项重要的计算机视觉技术,它可以用于各种图像处理和识别任务。传统的图像识别技术和深度学习图像识别技术各有优缺点。
</p>
</el-scrollbar>
</el-dialog>
<el-dialog
v-model="dialogVisible"
custom-class="gdialog imggdialog"
title="上传鸢尾花图片"
width="50%"
:align-center="true"
>
<div class="Flowers">
<div class="item">
<img src="@/assets/images/szjj/1.png" alt="" />
<el-radio v-model="Answer" label="1" size="large" @change="Choiceimg"
>1</el-radio
>
</div>
<div class="item">
<img src="@/assets/images/szjj/2.png" alt="" />
<el-radio v-model="Answer" label="2" size="large" @change="Choiceimg"
>2</el-radio
>
</div>
<div class="item">
<img src="@/assets/images/szjj/3.png" alt="" />
<el-radio v-model="Answer" label="3" size="large" @change="Choiceimg"
>3</el-radio
>
</div>
</div>
</el-dialog>
</div>
</div>
</template>
<script setup>
// import { getUserId, getToken } from "@/utils/auth.js";
import * as commonality from "@/api/commonality.js";
import {getAssetsFile} from '@/utils/index.js'
import { ref } from "vue";
const { proxy } = getCurrentInstance();
const dialogVisible = ref(false);
const centerDialogVisible = ref(false);
const topicList = ref([]);
const Answer = ref("");
const imgList = ref([
{
name: "变色鸢尾花",
imgSrc: "szjj/1.png",
},
{
name: "变色鸢尾花",
imgSrc: "szjj/2.png",
},
{
name: "山鸢尾花",
imgSrc: "szjj/3.png",
},
]);
const restartCount = ref(0);
const step=ref(0)
const value = ref("");
const errrCount = ref(0);
const Identifyimg=ref('szjj/setpt2.png')
const dialogShowbtn = () => {
getlist();
if(restartCount.value>0) return
commonality.getImgEcho({module:'图像识别',userId:'487'}).then((res) => {
if(res.data.length<0) return
Answer.value = res.data[0].selectPicture;
value.value = res.data[0].selectText;
step.value=3
});
};
const getlist = () => {
commonality.getImgList({ userId: '487', module: "图像识别" }).then((res) => {
topicList.value = res.data;
if( topicList.value[0].studentAnswer!==null||topicList.value[0].studentAnswer!=='') step.value=1
topicList.value.userId = '487';
if(restartCount.value>0){
topicList.value.forEach((item) => {
item.studentAnswer = null;
});
}
});
};
// 答题
const submit = () => {
topicList.value[0].userId = '487';
step.value=1
restartCount.value=0
commonality
.submitAnswer({ StuImageRecognitionTrainingDTO: topicList.value[0] })
.then((res) => {
proxy.$modal.msgSuccess(res.msg);
})
.catch((error) => {
errrCount.value++;
});
};
// 禁用函数
const disabled = (val) => {
if (val !== null) {
return true;
}
};
// 选择要识别的图片函数
const Choiceimg = () => {
if (Answer.value == 1 || Answer.value == 2) {
console.log(Identifyimg.value,"Identifyimg");
Identifyimg.value="szjj/点在上.png"
} else {
Identifyimg.value="szjj/点在下.png"
}
proxy.$modal.msgSuccess("选择识别成功");
dialogVisible.value = false;
step.value=2
commonality.uploadImg({irisName:value.value||null, module: "图像识别" ,order:Answer.value||null ,userId: '487'})
};
const selectChange = () => {
if (Answer.value == "") {
proxy.$modal.msgError("请选择识别的鸢尾花");
value.value = "";
return
}
commonality.uploadImg({irisName:value.value||null, module: "图像识别" ,order:Answer.value ||null,userId: '487'})
if (Answer.value == 1 || Answer.value == 2) {
if(value.value=='变色鸢尾花'){
proxy.$modal.msgSuccess("识别成功")
}else{
proxy.$modal.msgError("识别失败");
value.value = "";
errrCount.value++;
}
} else {
if(value.value=='山鸢尾花'){
proxy.$modal.msgSuccess("识别成功");
step.value=3
}else{
proxy.$modal.msgError("识别失败");
value.value = "";
errrCount.value++;
}
}
step.value=3
};
const submitTask = () => {
if(step.value<3) return proxy.$modal.msgWarning('请完成实训后提交')
commonality
.submitTask({
module: "人工智能",
numberOfErrors: errrCount.value > 10 ? 10 : errrCount.value ,
taskName: "图像识别",
userId: '487',
})
.then((response) => {
proxy.$modal.msgSuccess("提交成功");
centerDialogVisible.value = false;
})
.catch((error) => {});
};
// 上传
const Upload=()=>{
if(step.value<1) return proxy.$modal.msgError('请完成实训后上传')
dialogVisible.value = true
}
// 重新开始
const reset = () => {
restartCount.value=1
step.value=0
Answer.value = "";
value.value = "";
dialogVisible.value = false;
centerDialogVisible.value=false
Identifyimg.value="szjj/setpt2.png"
topicList.value.forEach((item) => {
item.studentAnswer = null;
});
};
dialogShowbtn()
</script>
<style lang="scss" scoped>
.img-centent {
.left{
position: relative;
}
// p,
// span {
// font-size: 12px;
// font-family: Source Han Sans CN;
// font-weight: 600;
// color: #333333;
// }
.Case {
position: absolute;
top: 150px;
right: 15px;
width: 216px;
padding-left: 60px;
span{
display: inline-block;
width: 110px;
height: 143px;
background: url("@/assets/images/szjj/案例任务.png") no-repeat;
background-size: 100% 100%;
}
// 鼠标小手
// cursor: pointer;
}
}
.Step-item {
width: 52px;
height: 25px;
color: #ffffff;
background: #5621F8;
border-radius: 13px;
font-size: 12px;
text-align: center;
line-height: 25px;
}
div {
.title-back {
width: 182px;
height: 66px;
line-height: 66px;
text-align: center;
background: url("@/assets/images/szjj/任务背景.png") no-repeat;
background-size: 100% 100%;
font-size: 20px;
font-family: Source Han Sans CN;
font-weight: bold;
}
.Step {
display: flex;
align-items: center;
.Step-item{
font-size: 12px;
}
span {
margin-left: 8px;
font-size: 15px;
font-family: Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
font-weight: 600;
}
}
.img {
margin: 20px 0px;
img {
width: 332px;
height: 248px;
margin-right: 70px;
}
}
.Step2 {
width: calc(100% - 40%);
:deep(.a) {
width: 100%;
height: 100%;
background-color: transparent !important;
padding: 0;
}
p {
width: 100%;
height: 36px;
background: #e9ebfc;
border-radius: 4px;
padding: 0px 21px;
:deep(.el-radio__input.is-disabled.is-checked .el-radio__inner) {
background-color: #5621f8 !important;
border-color: #5621f8 !important;
}
}
}
.Step3 {
.btn {
display: inline-block;
min-width: 136px;
height: 40px;
text-align: center;
line-height: 40px;
font-size: 12px;
color: #ffffff;
padding-left: 10px;
background: url("@/assets/images/szjj/icon-分类器训练.png")
no-repeat;
background-size: cover;
}
.btn1 {
background: url("@/assets/images/szjj/icon-上传鸢尾花图片.png")
no-repeat !important;
background-size: cover;
// 鼠标小手
cursor: pointer;
}
}
.setp-footer {
display: flex;
justify-content: center;
margin-top: 20px;
el-button {
width: 136px;
height: 40px;
margin: 0px 10px;
}
.el-button--primary {
padding-left: 53px;
padding-right: 34px;
border: none;
color: #ffffff;
background: url("@/assets/images/szjj/提交任务.png") no-repeat !important;
background-size: 100% 100%;
}
.el-button--primary:nth-child(2) {
background: url("@/assets/images/szjj/重新开始.png") no-repeat !important;
background-size: 100% 100%;
}
}
}
:deep(.gdialog) {
&:not(.is-fullscreen) {
// margin-top: 36vh !important;
// margin-left: 26vh;
}
.el-dialog__body {
// padding: 0px !important;
.Flowers {
height: 30vh;
display: flex;
justify-content: center;
gap: 96px;
.item {
width: 196px;
height: 196px;
display: flex;
flex-direction: column;
img {
width: 196px;
height: 196px;
margin-bottom: 36px;
}
.el-radio--large {
flex-direction: column-reverse;
.el-radio__label {
padding-left: 0px !important;
// padding-bottom: 24px !important;
}
}
}
}
}
}
.is-disabled{
cursor:not-allowed;
}
:deep(.imggdialog) {
margin-top: 36vh !important;
// margin-left: 26vh;
.el-dialog__body {
.el-radio--large {
.el-radio__input {
margin-top: 24px;
}
}
}
}
</style>

@ -0,0 +1,672 @@
<template>
<div class="app-container">
<div class="Naturallanguageprocessing">
<div class="left">
<el-scrollbar height="650px" style="height: 93%;">
<el-row>
<el-col :span="24">
<div class="TaskBackground">
<span>任务背景</span>
</div>
</el-col>
</el-row>
<div class="gdialog">
<p style="color:#FFFFFF !important">
hatGPT突然火爆,小张也去了解了ChatGPT,发现ChatGPT是美国人工智能研究实验室OpenAI新推出的一种人工智能技术驱动的自然语言处理工具,使用了Transformer神经网络架构,也是GPT-3.5架构,这是一种用于处理序列数据的模型,拥有语言理解和文本生成能力,尤其是它会通过连接大量的语料库来训练模型,这些语料库包含了真实世界中的对话,使得ChatGPT具备上知天文下知地理,还能根据聊天的上下文进行互动的能力,做到与真正人类几乎无异的聊天场景进行交流。ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。如此强大的工具,背后是什么原理呢,让我们一起来看一下吧。<br/><br/>
ChatGPT的核心是自然语言处理,接下来我们了解下自然语言处理的过程吧。
</p>
<div class="step">
<div class="step-item">
<span>步骤一</span>
</div>
<span>文本分词</span><br/>
</div>
<p style="color:#FFFFFF !important">中文分词(Chinese Word Segmentation)指的是将一个汉字序列切分成一个个单独的词。简单的讲,中文分词就是让计算机系统在汉语文本中的词与词之间自动加上空格或其他边界标记。<br/>
请对下面两句话进行分词,分词结果请去掉标点符号:<br/></p>
<p style="color:#FFFFFF !important">这个门把手坏了,请你来修一下。</p>
<el-row>
<el-col :span="24">
<el-input v-model.trim="text1.input1" style="width: 160px;margin-right:15px" @change="textChanged(text1,1)"/>
<el-input v-model.trim="text1.input2" style="width: 160px;margin-right:15px" @change="textChanged(text1,1)"/>
<el-input v-model.trim="text1.input3" style="width: 160px;margin-right:15px" @change="textChanged(text1,1)"/>
<el-input v-model.trim="text1.input4" style="width: 160px;margin-right:15px" @change="textChanged(text1,1)"/>
<el-input v-model.trim="text1.input5" style="width: 160px;margin-right:15px" @change="textChanged(text1,1)"/>
<el-input v-model.trim="text1.input6" style="width: 160px;margin-right:15px" @change="textChanged(text1,1)"/>
<el-input v-model.trim="text1.input7" style="width: 160px;margin-right:15px" @change="textChanged(text1,1)"/>
</el-col>
</el-row>
<p style="color:#FFFFFF !important">快把手拿开,这里危险不能摸。</p>
<el-row>
<el-col :span="24">
<el-input v-model.trim="text2.input1" style="width: 147px;margin-right:5px" @change="textChanged(text2,2)"/>
<el-input v-model.trim="text2.input2" style="width: 147px;margin-right:5px" @change="textChanged(text2,2)"/>
<el-input v-model.trim="text2.input3" style="width: 147px;margin-right:5px" @change="textChanged(text2,2)"/>
<el-input v-model.trim="text2.input4" style="width: 147px;margin-right:5px" @change="textChanged(text2,2)"/>
<el-input v-model.trim="text2.input5" style="width: 147px;margin-right:5px" @change="textChanged(text2,2)"/>
<el-input v-model.trim="text2.input6" style="width: 147px;margin-right:5px" @change="textChanged(text2,2)"/>
<el-input v-model.trim="text2.input7" style="width: 147px;margin-right:5px" @change="textChanged(text2,2)"/>
<el-input v-model.trim="text2.input8" style="width: 147px;margin-right:5px" @change="textChanged(text2,2)"/>
</el-col>
</el-row>
<p style="color:#FFFFFF !important">请问上面两句话中“把手”有何区别?计算机是如何识别两句话中“把手”的不同含义的?</p>
<div class="answer" >
<!-- <span v-if="item.correctAnswer!==null& item.studentAnswer!==item.correctAnswer">正确答案:{{item.correctAnswer}}</span> -->
<p><el-checkbox v-model="answer.studentAnswer" label="A" size="large" @change="answerChanged(answer,'1')" >A.上面那句话中把手是名词,指门把手,用于开关门的,门把手可作为一个词</el-checkbox></p>
<p><el-checkbox v-model="answer.studentAnswer" label="B" size="large" @change="answerChanged(answer,'1')" >B.下面那句话中把手是动宾结构,是挪开手的意思,这里的把手不能作为一个词</el-checkbox></p>
<p><el-checkbox v-model="answer.studentAnswer" label="C" size="large" @change="answerChanged(answer,'1')" >C.计算机可以根据上下文语境,语义解析,大规模语料库等推断两句话中“把手”的不同含义</el-checkbox></p>
<p><el-checkbox v-model="answer.studentAnswer" label="D" size="large" @change="answerChanged(answer,'1')" >D.人很容易理解这两句中“把手”的不同,但是这对计算机来说是比较难的</el-checkbox></p>
</div>
<el-divider />
<div class="step">
<div class="step-item">
<span>步骤二</span>
</div>
<span>词性标注</span><br/>
</div>
<p style="color:#FFFFFF !important">根据上一步文本分词相关知识,我们知道中文中同样一个词在不同的句子,不同的上下文环境中有不同的含义,因此要结合上下文进行词性标注,词性标注是自然语言处理<br/>中一项非常重要的基础性工作,词性标注主要被应用于文本挖掘(text mining)和NLP领域,是各类基于文本的机器学习任务,例如语义分析等的预处理步骤。</p>
<p style="color:#FFFFFF !important">请对下面两句话进行词性标注:<br/><br/>1.警察制服了小偷<br/><br/>2.环卫工上班必须穿制服<br/><br/>上面两句话中“制服”都是一个词语,它们有什么不同?下面说法正确的是:</p>
<div class="answer" >
<p> <el-checkbox v-model="answer2.studentAnswer" label="A" size="large" @change="answerChanged(answer2,'2')" >A.上面那句话中制服是动词</el-checkbox></p>
<p ><el-checkbox v-model="answer2.studentAnswer" label="B" size="large" @change="answerChanged(answer2,'2')" >B.下面那句话中制服是名词</el-checkbox></p>
<p ><el-checkbox v-model="answer2.studentAnswer" label="C" size="large" @change="answerChanged(answer2,'2')" >C.只有人才能识别出这两句话中制服的不同,目前计算机还无法识别这两句话中制服的不同含义</el-checkbox></p>
<p ><el-checkbox v-model="answer2.studentAnswer" label="D" size="large" @change="answerChanged(answer2,'2')" >D.让计算机识别出这两句话中“制服”的不同并不容易,依赖于强大的语料库和算法。</el-checkbox></p>
</div>
<el-divider />
<div class="step">
<div class="step-item">
<span>步骤三</span>
</div>
<span>文本摘要</span><br/>
</div>
<p style="color:#FFFFFF !important">对于长文本的文本总结,在信息快速膨胀的时代尤其有意义,如对每日新闻的自动总结可以快速为我们提供有效的信息。文本总结模型有两种可用的方法,一种是摘要式的方法,即从
语义方面提供更加简单精炼的总结;另一种是抽取式的方法,即通过对原文中的关键语句进行重新排列,最大限度地提炼原文的主要信息。抽取式的方法不需要人工标注和训练,因此
更加简单明了。<br/>
请针对下面这段文字进行总结,撰写100字以内的摘要,再点击自动生成摘要,跟自己撰写的摘要对比下,体验下AI的强大功能吧。
</p>
<div class="Abstract">
<el-scrollbar height="300px">
<div class="texts" style="color:#FFFFFF !important">
大模型的高速发展和渗透带来生成式人工智能的广泛应用,形形色色的生成式人工智能插件在短短几个月内交互到了人类社会的生产生活中,引发新一轮智能化浪潮。正如数十年前计算机技术、互联网革命引领了技术与生产方式的历史性变革,生成式人工智能开始深刻地影响人们生活的方方面面。当我们使用生成式人工智能高效搜索、生成文本、提高工作效率,当我们感受训练聊天机器人的新鲜感,当我们在文本之上使用图像生成、音频视频生成,生成式人工智能的潜在风险也在不知不觉中逐渐渗透。<br/><br/>
科技创新的二元性历来受到社会广泛关注,从互联网的数据隐私到智能机器人的道德伦理,再到生成式人工智能对于个人隐私的处理和引发潜在欺诈行为风险,如何规范应用值得我们深度思考。<br/><br/>
用户会给生成式人工智能工具提供个人、公司或所属社会组织的非公开信息,模型获得了这些数据,便有可能在后续各类生成任务中泄露信息。过去担忧手机APP等软件在用户未察觉时对其隐私进行观察和调用,而在生成式人工智能应用场景中,亦存在隐私和信息泄露风险。例如,生成式人工智能可以被用来创建背景丰富、看似来源可靠的信息,进而诱导用户点击恶意链接或下载恶意软件;可以塑造丰富立体的社交媒体形象,甚至模仿某人的声音或外貌,引导造谣与诈骗;可以被训练为向特定用户推荐误导性内容,或在某些情况下加强他们已有的偏见,等等。<br/><br/>
生成式人工智能可处理海量数据,但也给知识产权保护、个人隐私保护、打击虚假信息等方面带来新挑战。积极推进人工智能治理,法治与社会教育是促进守正创新的两大抓手。<br/><br/>
一方面,营造安全有序的法治环境,规范生成式人工智能服务。为减少虚假信息的传播,建议明确禁止或限制其在特定领域的使用。例如,批量化的虚拟形象创建和对话;为降低隐私泄露风险,建议规定生成式人工智能使用个人数据时需经用户同意,确保数据隐私得到保护,用户有权决定哪些数据可以被使用,以及生成的内容如何使用;为减少对社会公序良俗的破坏,建议严格限制仇恨言论、歧视性内容创建。可考量设立专门的机构负责技术审查和认证,评估生成式人工智能系统的安全性、可信度、伦理问题等。
</div>
</el-scrollbar>
<el-input type="textarea" style="width: calc(100% - 20px); margin-top: 10px;" placeholder="请针对上述文本给出100-300字的文本摘要" v-model.trim="digest"/>
<div class="Abstract-footer">
<el-button type="primary" size="mini" @click="generateAbstract" >提交</el-button>
<el-button type="primary" size="mini" @click="generateAbstractAuto">自动生成摘要</el-button>
</div>
</div>
<el-divider />
<div class="step">
<div class="step-item">
<span>步骤四</span>
</div>
<span>词云</span><br/>
</div>
<p style="color:#FFFFFF !important">
词云主要提供了一种观察社交媒体网站上的热门话题或搜索关键字的一种方式,它可以对网络文本中出现频率较高的“关键词”予以视觉上的突出,形成“关键词云层”或“关键词渲染”,从而过滤掉大量的文本信息,使浏览网页者只要一眼扫过文本就可以领略文本的主旨。<br/><br/>
接下来来体验下词云生成吧:
</p>
<div class="Abstract">
<el-scrollbar height="300px">
<div class="texts">
人工智能发展迎来新趋势<br/>
通顺的自然语言生成 通达的全领域知识体系覆盖 通畅的人机交互接口<br/>
  人工智能发展迎来新趋势(AI前沿观察)<br/>
  中央经济工作会议提出,要大力推进新型工业化,发展数字经济,加快推动人工智能发展。<br/>
  2023年10月18日,中国在第三届“一带一路”国际合作高峰论坛期间发布《全球人工智能治理倡议》,围绕人工智能发展、安全、治理三方面系统阐述了人工智能治理中国方案。<br/>
  近年来,全球人工智能技术快速发展,成为推动科技和产业加速发展的重要力量,对经济社会发展和人类文明进步产生深远影响。人工智能技术发展现状如何?有哪些应用?未来趋势怎样?记者采访了相关专家。<br/>
  人工智能处理复杂任务的能力大为提升<br/>
  当前,人工智能技术已进入实用阶段,正深刻地改变着人类的生产生活。<br/>
  “近70年的发展历程中,人工智能经历了灌输规则、灌输知识、从数据中学习这三个阶段。近年来在全球迅速发展的人工智能大模型技术,其依托的基本模型都基于‘大数据+大算力+强算法’训练,这是人工智能发展第三阶段的典型体现。”北京智源人工智能研究院院长黄铁军说。<br/>
  目前,各类人工智能大模型处于迅猛发展之中,全球众多高科技企业纷纷投身人工智能大模型建设。<br/>
  “现在围绕人工智能大模型已形成相对成熟的技术框架,但产品和生态尚在发展形成之中。”中国科学院自动化研究所副所长、研究员曾大军说,“总体而言,人工智能大模型的技术发展历程相比以往任何人工智能技术都更为迅猛,其影响力也是史无前例的。”<br/>
  人工智能大模型的出现,为通用人工智能的实现打开了新的想象空间,大大提升了人工智能处理复杂任务的能力。<br/>
  “比如,基于人工智能大语言模型的聊天机器人能够实现高质量的信息整合、翻译和简单问题求解与规划。”曾大军说,“这类机器人受到关注,主要是因为其已初步具备通用人工智能的部分特性,包括通顺的自然语言生成、全领域的知识体系覆盖、跨任务场景的通用处理模型、通畅的人机交互接口。”<br/>
  不过,目前人工智能大模型能力仍有局限性。<br/>
  “一方面,由于人工智能大模型自身结构和机制漏洞,有被恶意攻击的风险;另一方面,人工智能大模型自身的知识表达和学习模式还存在缺陷,导致其回答会有常识性错误、杜撰内容等。”曾大军说,“人工智能学者们正在围绕这些问题进行攻关。”<br/>
  人工智能加速迈向全面应用新阶段<br/>
  “我是刚入学的大一计算机专业学生,想选修人工智能课程,需要做什么准备?”“你需要学习基础数学知识、编程语言,学习机器学习算法,关注技术趋势……”这段对话并非出自师生之间,而是学生与人工智能之间的问答。<br/>
  2023年8月,浙江大学联合高等教育出版社等发布“智海—三乐”教育垂直大模型,在核心教材、领域论文和学位论文等语料和专业指令数据集的基础上,可提供智能问答、试题生成、学习导航、教学评估等服务,现已在多所高校应用。<br/>
  “我们把这些教材拆成语句、段落、篇章去‘喂给’大模型,这些高质量的语料会合成词与词之间的概率关联,给学生以启迪。”浙江大学教授吴飞说。<br/>
  工业质检、知识管理、代码生成、语音交互……当前,中国人工智能正从单点应用向多元化应用、从通用场景向行业特定场景不断深入,加速迈向全面应用新阶段。特别是随着人工智能大模型的突破和生成式人工智能的兴起,人工智能得以更好处理生产生活中的复杂问题,为各行业实现产品和流程革新提供了更加先进的工具和手段。<br/>
  预测一个台风未来10天的路径,过去需要在3000台服务器上花费5小时进行仿真,现在基于预训练的盘古气象大模型,10秒内就可以获得更精确的预测结果;字数将近4000万的一套古籍,研究人员利用人工智能,3个多月就完成了识别、点校、上线发布……<br/>
  “人工智能大模型带动生成式人工智能产业迅速发展,在科学探索、技术研发、艺术创作、企业经营等诸多领域都带来了巨大的创新机遇。”中国工程院院士王恩东说。<br/>
  在供需两侧的共同推动下,技术创新成果开始大规模地从实验室研究走向产业实践,人工智能产业化进程不断加快。据不完全统计,截至2023年10月,中国累计发布200余个人工智能大模型,科研院所和企业成为开发主力军。<br/>
  在华为混合云总裁尚海峰看来,以人工智能为代表的创新技术,正在加快重塑各个行业。<br/>
  科技部新一代人工智能发展研究中心主任赵志耘表示:“人工智能技术正沿着追求更高精度、挑战更复杂任务、拓展能力边界等方向持续演进。场景创新成为人工智能技术升级、产业增长的新路径。”<br/>
  浪潮信息高级副总裁刘军认为,未来,人工智能还需要进一步去深入应用场景、赋能具体的产业环节。“这个过程很难靠一家厂商独立完成,需要产业链、创新生态更多的深度协同。”刘军说。<br/>
  更加通用的人工智能有望实现<br/>
  专家表示,以人工智能大模型为代表的人工智能第三发展阶段,未来会有一段较长的发展红利期,将成为新一轮科技革命和产业变革的重要驱动力量。<br/>
  中国科学院自动化研究所对人工智能大模型的演进态势做了研判,曾大军介绍了其观点:应用和创新生态正在发生剧变或至少有剧变的潜质,人工智能大模型推动决策智能迅猛发展,人工智能大模型小型化和领域专业化需求非常迫切,更加通用的人工智能有望实现。<br/>
  曾大军说:“人工智能大模型就像一个人类大脑的雏形,通过‘喂给’各种数据,实现各种智能能力。人工智能大模型正在重新定义人与计算机的互动关系,有望成为人机交互的主要接口。”<br/>
  曾大军着重强调了人工智能大模型小型化和领域化的发展。他表示,现有人工智能大模型的算力和能耗挑战,会促使很多工作向领域专用化、轻量级的小模型或大小模型混搭的方向发展,特别是金融、教育、医疗、交通等领域,力求降低大模型的成本。<br/>
  黄铁军认为人工智能将从信息智能到实体智能发展,视觉、具身人工智能大模型将是下一个爆发点。“大数据是世界的表达,从中训练出的语言认知模型可以支持信息服务,语言类大模型能够提高自动驾驶、机器人等实体的智能水平,但还需要视觉、听觉、具身、交互等技术的发展。”<br/>
  黄铁军告诉记者,目前的智能涌现还只是静态涌现,还不具备人脑的动态涌现能力。“未来有望通过类脑智能实现真正拥有动态涌现能力的人工智能。”<br/>
  曾大军认为,人工智能大模型有望发展成为更加通用的人工智能。“在不久的将来,人工智能大模型将超越信息域,结合硬件设施,发展成为与物理和人类世界互动的具象智能,逐步缩小与真正的‘通用人工智能’的差距。”<br/>
  “预计未来智能程度还将不断提高,对各行业的带动和影响更为深刻,这是其他技术难以比肩的。”黄铁军说。<br/>
  在曾大军看来,决策科学加人工智能融合创新,能够碰撞出非常多的火花。<br/>
  “人工智能,特别是经过知识自动推理的加持之后,能够实现从已知到未知的跨越。”曾大军进一步解释,“更高层级的决策功能,比如产业态势的研判、风险评估等,这种从未知到未知的决策,机器智能有可能起到很大的辅助作用。”(记者 吴月辉 谷业凯)
</div>
</el-scrollbar>
<div class="Wordcloud">
<div class="left">
<el-button type="primary" size="mini" @click="generateWordcloud">生成词云图</el-button>
</div>
<div class="right1">
</div>
</div>
</div>
</div>
</el-scrollbar>
<div class="dialog-footer">
<el-button @click="submit">提交任务</el-button>
<el-button type="primary" @click="restart">重新开始</el-button>
</div>
</div>
<div class="right">
<span @click="NaturallanguageprocessingVisible=true"></span>
</div>
<el-dialog
custom-class="gdialog"
v-model="NaturallanguageprocessingVisible"
title="自然语言处理"
width="66%">
<el-scrollbar height="650px">
<p>自然语言处理( Natural Language Processing, NLP)是计算机科学领域与人工智能领域中的一个重要方向。它研究能实现人与计算机之间用自然语言进行有效通信的各种理论和方法。自然语言处理是一门融语言学、计算机科学、数学于一体的科学。因此,这一领域的研究将涉及自然语言,即人们日常使用的语言,所以它与语言学的研究有着密切的联系,但又有重要的区别。自然语言处理并不是一般地研究自然语言,而在于研制能有效地实现自然语言通信的计算机系统,特别是其中的软件系统。因而它是计算机科学的一部分。<br/><br/>
自然语言处理主要应用于机器翻译、舆情监测、自动摘要、观点提取、文本分类、问题回答、文本语义对比、语音识别、中文OCR等方面。<br/><br/>
针对文本数据,自然语言处理流程如下:<br/><br/>
<span class="headline">1.文本分词</span><br/>
中文分词就是让计算机系统在汉语文本中的词与词之间自动加上空格或其他边界标记。中文分词是文本挖掘的基础,对于输入的一段中文,成功的进行中文分词,可以达到电脑自动识别语句含义的效果。<br/>
中文分词技术属于自然语言处理技术范畴,对于一句话,人可以通过自己的知识来明白哪些是词,哪些不是词,但如何让计算机也能理解?其处理过程就是分词算法。<br/>
有了成熟的分词算法,是否就能容易的解决中文分词的问题呢?事实远非如此。中文是一种十分复杂的语言,让计算机理解中文语言更是困难。在中文分词过程中,有两大难题一直没有完全突破。<br/><br/>
歧义识别<br/>
歧义是指同样的一句话,可能有两种或者更多的切分方法。例如,在句子“这个门把手坏了”中,“把手”是个词,但在句子“请把手拿开”中,“把手”就不是一个词;在句子“将军任命了一名中将”中,“中将”是个词,但在句子“产量三年中将增长两倍”中,“中将”就不再是词。这些词计算机又如何去识别?<br/><br/>
如果交集型歧义和组合型歧义计算机都能解决的话,在歧义中还有一个难题,是真歧义。真歧义意思是给出一句话,由人去判断也不知道哪个应该是词,哪个应该不是词。例如:“乒乓球拍卖完了”,可以切分成“乒乓 球拍 卖 完 了”、也可切分成“乒乓球 拍卖 完 了”,如果没有上下文其他的句子,恐怕谁也不知道“拍卖”在这里算不算一个词。<br/><br/>
新词识别<br/>
命名实体(人名、地名)、新词,专业术语称为未登录词。也就是那些在分词词典中没有收录,但又确实能称为词的那些词。最典型的是人名,人可以很容易理解。句子“王军虎去广州了”中,“王军虎”是个词,因为是一个人的名字,但要是让计算机去识别就困难了。如果把“王军虎”做为一个词收录到字典中去,全世界有那么多名字,而且每时每刻都有新增的人名,收录这些人名本身就是一项既不划算又巨大的工程。即使这项工作可以完成,还是会存在问题,例如:在句子“王军虎头虎脑的”中,“王军虎”还能不能算词?<br/><br/>
除了人名以外,还有机构名、地名、产品名、商标名、简称、省略语等都是很难处理的问题,而且这些又正好是人们经常使用的词,因此对于搜索引擎来说,分词系统中的新词识别十分重要。新词识别准确率已经成为评价一个分词系统好坏的重要标志之一。<br/><br/>
<span class="headline">2.词性标注</span><br/>
根据上一步文本分词相关知识,我们知道中文中同样一个词在不同的句子,不同的上下文环境中有不同的含义,因此要结合上下文进行词性标注,词性标注(Part-Of-Speech tagging, POS tagging)也被称为语法标注(grammatical tagging)或词类消疑(word-category disambiguation),是语料库语言学(corpus linguistics)中将语料库内单词的词性按其含义和上下文内容进行标记的文本数据处理技术。<br/><br/>
词性标注在本质上是分类问题,将语料库中的单词按词性分类。一个词的词性由其在所属语言的含义、形态和语法功能决定。以汉语为例,汉语的词类系统有18个子类,包括7类体词,4类谓词、5类虚词、代词和感叹词。词类不是闭合集,而是有兼词现象,例如“制服”在作为“服装”和作为“动作”时会被归入不同的词类,因此词性标注与上下文有关 [3] 。对词类的理论研究可以得到基于人工规则的词性标注方法,这类方法对句子的形态进行分析并按预先给定的规则赋予词类<br/><br/>
词性标注可以由人工或特定算法完成,使用机器学习(machine learning)方法实现词性标注是自然语言处理(Natural Language Processing, NLP)的研究内容。常见的词性标注算法包括隐马尔可夫模型(Hidden Markov Model, HMM)、条件随机场(Conditional random fields, CRFs)等。<br/><br/>
<span class="headline">3.分类管理</span><br/>
分类管理是进行文本分类之前先预定义类别,例如新闻资讯中的体育、政治、科技等类别,因此我们需要先进行分类器训练,让系统知道什么样的文本属于哪一类,本系统使用了训练文本集训练分类器,人为定义一个类别,上传语料文件,对系统进行训练,训练完之后,系统会自动把与语料内容相关度比较高的分为一类,语料内容越丰富,分类越准确。<br/><br/>
<span class="headline">4.文本分类</span><br/>
文本分类是用电脑对文本集按照一定的分类体系或标准进行自动分类标记。它根据一个已经被标注的训练文档集合, 找到文档特征和文档类别之间的关系模型, 然后利用这种学习得到的关系模型对新的文档进行类别判断。<br/>
伴随着信息的爆炸式增长,人工标注数据已经变得耗时、质量低下,且受到标注人主观意识的影响。因此,利用机器自动化的实现对文本的标注变得具有现实意义,将重复且枯燥的文本标注任务交由计算机进行处理能够有效克服以上问题,同时所标注的数据具有一致性、高质量等特点。<br/><br/>
其应用场景众多,包括:<br/>
情感分析(Sentiment Analyse)<br/>
主题分类(Topic Labeling)<br/>
问答任务(Question Answering)<br/>
意图识别(Dialog Act Classification)<br/>
自然语言推理(Natural Language Inference)<br/><br/>
其分类标签可以是:<br/>
情感分析(积极、消极、中性)<br/>
主题分类(金融、体育、军事、社会)<br/>
问答任务(是、否)<br/>
意图识别(天气查询、歌曲搜索、随机闲聊)<br/>
自然语言推理(导出、矛盾、中立)<br/><br/>
<span class="headline"> 5.文本摘要</span><br/>
文本摘要是指通过各种技术,对文本或者是文本的集合,抽取、总结或是精炼其中的要点信息,用以概括和展示原始文本的主要内容或大意。作为文本生成任务的主要方向之一,从本质上而言,这是一种信息压缩技术。文本摘要技术是信息爆炸时代,提升人们获取有效信息效率的关键技术之一,如何从冗余、非结构化的长文本中提炼出关键信息,构成精简通顺的摘要,是文本摘要的核心问题。<br/><br/>
按照实现技术方案的不同,可以分为抽取式文本摘要、生成式文本摘要;<br/>
抽取式摘要,即直接从原文中抽取一些预先设置好的单元来组成摘要,抽取单元一般为句子、短语或词语,目前大多数方法都是以句子作为抽取单元。抽取式的方法基于一个假设,一篇文档的核心思想可以用文档中的某一句或几句话来概括,那么摘要的任务就变成了找到文档中最重要的几句话。<br/>
生成式摘要,它试图通过理解原文的意思来生成摘要,其实就是模仿人类写摘要的方式,可能会用 原文中的词 ,也可能会用新词 (未出现在原文中的词)来做表述。其优点是相比于抽取式而言用词更加灵活 ,因为所产生的词可能从未在原文中出现过。
总的来说,抽取式的文本摘要直接从原文中摘取完整的句子作为文章的摘要,所以通常在语法层面的正确性以及对原文概括的准确性上比较占优势,如同按部就班的老实人,令人心安;生成式的文本摘要可以产生原文中没有的单词和短语,容易产生事实性错误,好比一位逍遥的江湖侠客,蛟龙终非池中物,目前,我们这位侠客虽然艳惊四座,但却容易野马脱缰,返回不符合事实的结果。<br/><br/>
<span class="headline">6.相似度计算</span><br/>
在自然语言处理中,我们经常需要判定两个东西是否相似。<br/>
比如,在微博的热点话题推荐那里,我们需要比较微博之间的相似度,让相似度高的微博聚集在一起形成一个簇,提出一个主题。<br/>
在问答系统中,比如说人工客服,我们需要提前准备好问题和一些答案,让用户输入的问题与题库中的问题进行相似度的比较,最后输出答案。<br/>
在推荐系统中,我们需要提取一个用户的所有物品,在根据这个物品找到对应的用户群,比较两个用户之间的相似性,在进行相应的推荐(协同过滤)。<br/>
在对语料进行预处理的时候,我们需要给予文本的相似度,把相似度高的重复主题过滤掉。<br/>
如果是文本分析,它首先就要用到分词技术,然后去掉不必要的词(语气词,连接词)。然后对词给一个抽象的量表示权重,最后在用一些方法去统计出整体的相似度。<br/><br/>
<span class="headline">7.情感分析</span><br/>
情感分析是指通过文本来挖掘人们对于产品、服务、组织、个人、事件等的观点、情感倾向、态度等。情感分析是随着互联网发展而产生的,早期主要用于对网上销售商品的用户评语的分析,以便判断用户对其所购商品是“喜欢”还是“不喜欢”。后期随着自媒体的流行,情感分析技术更多地用于识别话题发起者、参与者的情感趋向,从中判断或挖掘话题中的价值,由此来分析相关舆情。<br/>
情感分析的流程包括文本预处理、特征标注与选择、训练模型、调整模型。本系统是先新建情感词,用户定义情感词,并上传语料对系统进行训练,训练之后系统即可自动对用户输入的文本进行情感分析,给出情感分析结果,语料内容越丰富则分析结果越准确。<br/>
随着近年来深度学习的发展,以及文本数据的可获取性不断提升,情感分析在自然语言处理研究领域中日渐举足轻重,慢慢从理论研究领域拓展到实践应用中。目前主要用于预测电影票房、股票趋势、舆情分析、改进服务及产品、了解用户体验等。<br/><br/>
<span class="headline"> 8.数据可视化</span><br/>
数据可视化主要旨在借助于图形化手段,清晰有效地传达与沟通信息。但是,这并不就意味着数据可视化就一定因为要实现其功能用途而令人感到枯燥乏味,或者是为了看上去绚丽多彩而显得极端复杂。为了有效地传达思想概念,美学形式与功能需要齐头并进,通过直观地传达关键的方面与特征,从而实现对于相当稀疏而又复杂的数据集的深入洞察。<br/>
数据可视化是以图形的方式呈现结构化或非结构化数据,从而将隐藏在数据中的信息直接呈现给人们。它不仅仅是使用数据可视化工具将数据转化为图形。相反,它是从数据的角度看待世界。换句话说,数据可视化的对象是数据,把可视化作为探索世界的手段。<br/>
数据可视化最大重要性是在于它帮助人们更快地理解数据。寻找堆积如山的信息之间的联系并不容易,但图形和图表可以将无形的信息,转化为可见的图形符号,直接清晰地表达出来,帮助你快速发现关键点。研究表明,人们记得他们看到的大约80%的事情,但只记得他们读过的20%。大脑记忆图像的速度比抽象单词快一百万倍。所以,可视化数据可以加深人们对信息的记忆。</p>
</el-scrollbar>
<template #footer>
</template>
</el-dialog>
</div>
</div>
</template>
<script setup>
import * as commonality from "@/api/commonality";
// import {getUserId} from "@/utils/auth.js";
const {proxy} = getCurrentInstance();
const NaturallanguageprocessingVisible=ref(false)
const text1 = ref({
input1: "",
input2: "",
input3: "",
input4: "",
input5: "",
input6: "",
input7: "",
})
const text2 = ref({
input1: "",
input2: "",
input3: "",
input4: "",
input5: "",
input6: "",
input7: "",
input8: "",
})
let participleRecord=ref(0)//分词记录
// 正确计数
const correctCount = ref(0);
// 错误计数
const errorCount = ref(0);
const digest = ref('')//摘要
const digest1 = ref('')//摘要
const restartStatus = ref(false);
const textChanged=(text,setp)=>{
const sentence1 = '这个/门把手/坏/了/请你/来/修一下';
const sentence2 = '快/把/手/拿开/这里/危险/不能/摸';
if(Object.values(text).every(value => value !== '')){
if(setp==1){
if(JSON.stringify(Object.values(text))===JSON.stringify(sentence1.split('/'))){
proxy.$modal.msgSuccess('分词成功');
participleRecord.value=1
correctCount.value=1
}else{
proxy.$modal.msgWarning('分词错误,请重新输入');
errorCount.value++
}
}else{
if(JSON.stringify(Object.values(text))===JSON.stringify(sentence2.split('/'))){
proxy.$modal.msgSuccess('分词成功');
participleRecord.value=2
correctCount.value=2
}else{
proxy.$modal.msgWarning('分词错误,请重新输入')
errorCount.value++
}
}
}
}
// 答题
const answer = ref({
correctAnswer: "A,B,C,D",
studentAnswer: []
})
const answer2= ref({
correctAnswer: "A,B,D",
studentAnswer: []
})
// 答题
const answerChanged = (item,idx) => {
if(idx==='1'){
if(participleRecord.value!==2) {
proxy.$modal.msgWarning('请先完成文本分詞');
item.studentAnswer=[];
return
}
if(item.studentAnswer.length==4){
correctCount.value=3
proxy.$modal.msgSuccess('回答正确');
}
}else{
if(answer.value.studentAnswer.length<0){
proxy.$modal.msgWarning('请先完成步骤一');
item.studentAnswer=[]
return
}
if(item.studentAnswer.length==3){
if(item.studentAnswer.includes('A')&&item.studentAnswer.includes('B')&&item.studentAnswer.includes('D')){
correctCount.value=4
proxy.$modal.msgSuccess('回答正确');
}else{
proxy.$modal.msgWarning('回答错误');
let ErrorAnswer=item.studentAnswer.filter(item=>item!=='A'&&item!=='B'&&item!=='D')
let index=item.studentAnswer.indexOf(ErrorAnswer[0])
item.studentAnswer=item.studentAnswer.splice(0,index)
errorCount.value++
}
}
}
}
// 生成摘要
const generateAbstract = () => {
if(correctCount.value<4) {
proxy.$modal.msgWarning('请先完成步骤二');
return
}
const test='生成式人工智能深刻影响人们生活的方方面面,当我们使用生成式人工智能高效搜索、生成文本、提高工作效率时,生成式人工智能的潜在风险也在不知不觉中逐渐渗透。生成式人工智能可处理海量数据,但也给知识产权保护、个人隐私保护、打击虚假信息等方面带来新挑战。积极推进人工智能治理,法治与社会教育是促进守正创新的两大抓手。一方面,营造安全有序的法治环境,规范生成式人工智能服务。同时,健全生成式人工智能系统出现问题时的法律责任和赔偿机制,另一方面,加强对公众的教育与培训也至关重要,强调伦理和法律约束,以提高对这些潜在风险的认识。'
if(digest.value=='') return proxy.$modal.msgError('请输入摘要');
proxy.$modal.msgSuccess('提交成功');
correctCount.value=5
}
// 自动生成摘要
const generateAbstractAuto = () => {
if(correctCount.value<5) {
proxy.$modal.msgWarning('请先撰写100字以内的摘要,再点击自动生成摘要进行对比!');
return
}
commonality.getSummary({userId:'487'}).then(res => {
digest.value = res.msg;
proxy.$modal.msgSuccess('自动生成摘要');
}).catch(err => {
errorCount++
});
}
// 生成词云
const generateWordcloud = () => {
// if(correctCount.value<5) {
// proxy.$modal.msgWarning('请先完成步骤三');
// return
// }
commonality.creatWordCloud({userId:'487'}).then(res => {
var blobUrl = URL.createObjectURL(res);
document.querySelector('.right1').innerHTML = `<img src="${blobUrl}" alt="词云图" style="width: 100%; height: 304px;">`;
proxy.$modal.msgSuccess('生成词云图');
correctCount.value=6
});
}
const submit=()=>{
if(correctCount.value<6) {
proxy.$modal.msgWarning('请先完成所有步骤');
return
}
handleClose()
console.log(errorCount.value,"errorCount.value");
commonality.submitTask({module:'人工智能',numberOfErrors:errorCount.value > 10 ? 10 : errorCount.value || 0,taskName:'自然语言处理',userId:'487'}).then((response) => {
proxy.$modal.msgSuccess("提交任务成功");
NaturallanguageprocessingVisible.value=false
restartStatus.value=false
})
.catch((error) => {
});
}
// 重新开始
const restart=()=>{
correctCount.value=0
participleRecord.value=0
digest.value=''
restartStatus.value=true
text1.value = {
input1: "",
input2: "",
input3: "",
input4: "",
input5: "",
input6: "",
input7: "",
}
text2.value = {
input1: "",
input2: "",
input3: "",
input4: "",
input5: "",
input6: "",
input7: "",
input8: "",
}
answer.value.studentAnswer=[]
answer2.value.studentAnswer=[]
document.querySelector('.right1').innerHTML = '';
console.log(answer.value,"restartStatus.value");
NaturallanguageprocessingVisible.value=false
}
// 保存记录
const handleClose = () => {
const dataObj={
userId:'487',
stepOneA:Object.values(text1.value).join(',')||'',
stepOneB:Object.values(text2.value).join(',')||'',
stepOneC:answer.value.studentAnswer.join(',')||'',
stepOneD:answer2.value.studentAnswer.join(',')||'',
textOne:digest.value,
numberOfErrors:errorCount.value || 0,
subState:correctCount.value
}
if(document.querySelector('.right1 img')!==null){
dataObj.textThree=document.querySelector('.right1 img').src;
}
NaturallanguageprocessingVisible.value=false
if(restartStatus.value) return
commonality.saveNlp(dataObj).then((response) => {
})
.catch((error) => {
});
}
const getList=()=>{
commonality.getNlpEcho({userId:'487'}).then((response) => {
if(restartStatus.value) return
if(response.data){
const data=response.data
if(data.stepOneA){
participleRecord.value=1
}else if(data.stepOneB){
participleRecord.value=2
}
if(data.stepOneC){
correctCount.value=3
}
if(data.stepOneD){
correctCount.value=4
}
if(data.textOne){
correctCount.value=5
}
if(data.textThree){
correctCount.value=6
}
errorCount.value=data.numberOfErrors || 0
text1.value = {
input1: data.stepOneA.split(',')[0],
input2: data.stepOneA.split(',')[1],
input3: data.stepOneA.split(',')[2],
input4: data.stepOneA.split(',')[3],
input5: data.stepOneA.split(',')[4],
input6: data.stepOneA.split(',')[5],
input7: data.stepOneA.split(',')[6],
}
text2.value = {
input1: data.stepOneB.split(',')[0],
input2: data.stepOneB.split(',')[1],
input3: data.stepOneB.split(',')[2],
input4: data.stepOneB.split(',')[3],
input5: data.stepOneB.split(',')[4],
input6: data.stepOneB.split(',')[5],
input7: data.stepOneB.split(',')[6],
input8: data.stepOneB.split(',')[7],
}
answer.value.studentAnswer=data.stepOneC.split(',')
answer2.value.studentAnswer=data.stepOneD.split(',')
digest.value=data.textOne
correctCount.value=data.subState
console.log(correctCount.value,"correctCount.value");
var blobUrl = URL.createObjectURL(data.textThree);
document.querySelector('.right1').innerHTML = `<img src="${blobUrl}" alt="词云图" style="width: 100%; height: 304px;">`;
}
})
.catch((error) => {
});
}
getList()
// 页面销毁
onBeforeUnmount(()=>{
handleClose()
})
</script>
<style lang='scss' scoped>
.Naturallanguageprocessing {
display: flex;
.left {
position: relative;
// width: calc(100% - 216px);
height: 100%;
}
.right {
position: absolute;
top: 150px;
right: 15px;
width: 216px;
padding-left: 60px;
span {
display: inline-block;
width: 110px;
height: 143px;
background: url("@/assets/images/szjj/案例任务.png") no-repeat;
background-size: 100% 100%;
cursor: pointer;
}
}
.TaskBackground{
span{
display: inline-block;
width: 181px;
height: 66px;
text-align: center;
line-height: 66px;
background: url("@/assets/images/szjj/任务背景.png") no-repeat !important;
background-size: 100% 100% !important;
font-family: Source Han Sans CN;
font-weight: bold;
font-size: 20px;
color: #FFFFFF;
}
}
.gdialog{
width: calc(100% - 160px);
.step{
display: flex;
align-items: center;
.step-item{
width: 52px;
height: 25px;
line-height: 25px;
text-align: center;
background: #5621F8;
border-radius: 12px;
margin-right: 8px;
span{
display: inline-block;
font-family: Source Han Sans CN;
font-weight: bold;
font-size: 12px;
color:#FFFFFF;
}
}
span{
font-size: 15px;
color: #FFFFFF;
font-weight: 600;
}
}
.answer{
p{
width:calc(100% - 30%);
// height: 36px;
background: #E9EBFC;
border-radius: 4px;
padding:0px 21px;
.el-checkbox {
}
}
}
.Abstract{
width: calc(100% - 10%);
// height: 543px;
background: #F7F7F7;
border-radius: 4px;
border: 1px solid #DCDCDC;
padding: 19px 19px 21px 19px;
margin-bottom: 20px;
.texts{
width:calc(100% - 20px);
// height: 317px;
padding: 16px 33px 49px 19px;
background: #FFFFFF;
border-radius: 5px;
border: 1px solid #E5E5E5;
font-family: Source Han Sans CN;
font-weight: 500;
font-size: 12px;
color: #333333;
line-height: 20px;
}
.Abstract-footer{
margin-top: 12px;
.el-button{
height: 40px;
border: none;
padding: 12px 40px !important;
}
.el-button:nth-child(1) {
background: url("@/assets/images/szjj/提交任务.png") no-repeat;
background-size: 100% 100%;
}
.el-button:nth-child(2) {
background: url("@/assets/images/szjj/重新开始.png") no-repeat;
background-size: 100% 100%;
}
}
.Wordcloud{
display: flex;
margin-top: 12px;
// min-height:347px;
.left{
width: calc(100% - 68%);
// height: 311px;
.el-button:nth-child(1) {
height: 40px;
border: none;
padding: 12px 40px !important;
background: url("@s/assets/images/szjj/提交任务.png") no-repeat;
background-size: 100% 100%;
}
}
.right1{
width: 401px;
// height: 304px;
padding: 10px;
// background: #FFFFFF;
}
}
}
.el-scrollbar{
// height: 300px;
}
}
}
:deep( .el-textarea__inner){
height: 124px !important;
}
.dialog-footer{
margin-top: 5px;
}
</style>

@ -0,0 +1,877 @@
<template>
<div class="app-container">
<div class="Robot-learning">
<div class="left">
<div class="gdialog">
<el-scrollbar height="650px" style="height: 93%;">
<el-row>
<el-col :span="24">
<div class="TaskBackground">
<span >任务背景</span>
</div>
</el-col>
</el-row>
<p style="color:#FFFFFF !important">假设我们要构建一个决策树来预测一个人是否会购买某个产品。我们将使用以下特征来进行预测:</p>
<p class="info"><img src="@/assets/images/szjj/年龄.png"/>年龄:年龄范围在18岁到65岁之间</p>
<p class="info"><img src="@/assets/images/szjj/性别.png"/>性别:男性或女性</p>
<p class="info"><img src="@/assets/images/szjj/收入.png"/>收入:收入范围在0到100,000之间</p>
<p style="color:#FFFFFF !important">我们有一个包含以下数据的训练集:</p>
<div class="tabback">
<el-table :data="TrainingSet" style="width: 100%" stripe>
<el-table-column type="index" label="编号" align="center" width="150"/>
<el-table-column prop="age" label="年龄" align="center" />
<el-table-column prop="sex" label="性别" align="center" />
<el-table-column prop="income" label="收入" align="center" />
<el-table-column prop="purchase" label="购买" align="center" />
</el-table>
</div>
<p style="color:#FFFFFF !important">现在,我们将使用这些数据来构建一个决策树模型。<br/>
我们可以使用信息增益或基尼不纯度等指标来选择最佳特征。在这个例子中,我们选择使用信息增益。计算结果显示应该选择性别作为根节点。<br/><br/>
接下来,我们根据性别的取值(男性或女性)将数据集分割成两个子集。<br/>
对于男性子集:
</p>
<div class="tabback tab2">
<el-table :data="MaleSubset" style="width: 100%" stripe>
<el-table-column type="index" label="编号" align="center" width="150"/>
<el-table-column prop="age" label="年龄" align="center" >
<template #default="{row}">
<el-input v-model.trim="row.age" placeholder=""></el-input>
</template>
</el-table-column>
<el-table-column prop="income" label="收入" align="center" >
<template #default="{row}">
<el-input v-model.trim="row.income" placeholder=""></el-input>
</template>
</el-table-column>
<el-table-column prop="purchase" label="购买" align="center">
<template #default="{row}">
<el-input v-model.trim="row.purchase" placeholder=""></el-input>
</template>
</el-table-column>
</el-table>
</div>
<el-button @click="segmentation(MaleSubset,1,'男')" class="LeftbuttonS">分割</el-button>
<p style="color:#FFFFFF !important">对于女性子集:</p>
<div class="tabback tab2">
<el-table :data="FemaleSubset" style="width: 100%" stripe>
<el-table-column type="index" label="编号" align="center" width="150"/>
<el-table-column prop="age" label="年龄" align="center" >
<template #default="{row}">
<el-input v-model.trim="row.age" placeholder="" ></el-input>
</template>
</el-table-column>
<el-table-column prop="income" label="收入" align="center" >
<template #default="{row}">
<el-input v-model.trim="row.income" placeholder=""></el-input>
</template>
</el-table-column>
<el-table-column prop="purchase" label="购买" align="center">
<template #default="{row}">
<el-input v-model.trim="row.purchase" placeholder="" ></el-input>
</template>
</el-table-column>
</el-table>
</div>
<el-button @click="segmentation(FemaleSubset,2,'女')" :disabled="state<2" class="LeftbuttonS">分割</el-button>
<p style="color:#FFFFFF !important"> 对于男性子集,我们可以看到购买的结果是"是"和"否"都有,所以我们需要进一步划分。我们选择年龄作为下一个节点。<br/>
对于年龄的取值(小于等于30岁和大于30岁):<br/>
对于小于等于30岁的子集:
</p>
<div class="tabback tab3">
<el-table :data="greaterThan" style="width: 100%" stripe>
<el-table-column type="index" label="编号" align="center" width="150"/>
<el-table-column prop="income" label="收入" align="center" >
<template #default="{row}">
<el-input v-model="row.income" placeholder=""></el-input>
</template>
</el-table-column>
<el-table-column prop="purchase" label="购买" align="center" >
<template #default="{row}">
<el-input v-model.trim="row.purchase" placeholder=""></el-input>
</template>
</el-table-column>
</el-table>
</div>
<el-button @click="divide(greaterThan,3)" :disabled="state<3" class="LeftbuttonS">分割</el-button>
<p style="color:#FFFFFF !important">对于大于30岁的子集:</p>
<div class="tabback tab3">
<el-table :data="lessThan" style="width: 100%" stripe>
<el-table-column type="index" label="编号" align="center" width="150"/>
<el-table-column prop="income" label="收入" align="center" >
<template #default="{row}">
<el-input v-model.trim="row.income" placeholder=""></el-input>
</template>
</el-table-column>
<el-table-column prop="purchase" label="购买" align="center" >
<template #default="{row}">
<el-input v-model.trim="row.purchase" placeholder=""></el-input>
</template>
</el-table-column>
</el-table>
</div>
<el-button @click="divide(lessThan ,4)" :disabled="state<4" class="LeftbuttonS">分割</el-button>
<p style="color:#FFFFFF !important">
对于小于等于30岁的子集,购买的结果都是"否",所以我们不需要再进行划分。<br/>
对于大于30岁的子集,购买的结果都是"是",所以我们不需要再进行划分。<br/>
对于女性子集,购买的结果都是"是",所以我们不需要再进行划分。<br/>
请根据上述过程绘制决策树:
</p>
<div class="DecisionTree">
<div class="titleimg">
<img src="@/assets/images/szjj/性别(2).png" alt="">
</div>
<div class="titleimg sex">
<span class="tetx"> <img src="@/assets/images/szjj/性别(1).png" alt="">性别</span>
</div>
<div class="information">
<div class="box">
<span class="tetx"><img src="@/assets/images/szjj/年龄1.png" alt="">年齡</span>
</div>
<div class="box" @click="Decisiontreepurchase('女','购买')">
<span class="tetx"><img src="@/assets/images/szjj/购买2.png" alt="">购买</span>
</div>
<div class="ipt">
<el-select
v-model="Conditions.sex"
size="large">
<el-option label="男" value="男"/>
<el-option label="女" value="女"/>
</el-select>
</div>
</div>
<div class="Consumption">
<div class="box1" @click="Decisiontreepurchase('男','购买')">
<span ><img src="@/assets/images/szjj/购买(1).png" alt="" >购买</span>
</div>
<div class="box1" @click="Decisiontreepurchase('男','不购买')">
<span ><img src="@/assets/images/szjj/减少.png" alt="">不购买</span>
</div>
<div class="ipt1">
<el-select
v-model="Conditions.age"
size="large">
<el-option label="大于三十" value="是"/>
<el-option label="小于等于三十" value="否"/>
</el-select>
</div>
</div>
</div>
<p style="color:#FFFFFF !important">上述例子是决策树相关的一个简单案例,实际中决策树可以用于金融领域的精准营销,利用大数据建模,分析客户年龄、收入、职业、历史信贷记录等信息,锁定哪些客户群里更有可能发生信贷风险,<br/>
哪些属于优质客户,更可能购买产品和服务等。<br/>
来源:https://zhuanlan.zhihu.com/p/651602495
</p>
</el-scrollbar>
<div class="dialog-footer" style="margin-top: 7px;">
<el-button @click="submit">提交任务</el-button>
<el-button type="primary" @click="restart">重新开始</el-button>
</div>
</div>
</div>
<div class="right">
<span @click="robotlearningVisible=true"></span>
</div>
<el-dialog
custom-class="gdialog"
v-model="robotlearningVisible"
title="机器学习"
width="66%"
:before-close="handleCole"
>
<el-scrollbar height="600px">
<p>
机器学习是一门多领域交叉学科,涉及概率论、统计学、逼近论、凸分析、算法复杂度理论等多门学科。专门研究计算机怎样模拟或实现人类的学习行为,以获取新的知识或技能,重新组织已有的知识结构使之不断改善自身的性能。<br/><br/>
它是人工智能核心,是使计算机具有智能的根本途径。<br/>
机器学习是计算机科学的一个分支,它允许计算机在不被明确告知这些模式是什么的情况下,从数据中自动推断出模式。这些推断通常基于使用算法来自动检查数据的统计属性,并创建数学模型来表示不同数量之间的关系。<br/><br/>
让我们将其与传统计算进行对比,传统计算依赖于确定性系统,其中我们明确地告诉计算机一组规则来执行特定任务。这种计算机编程方法被称为基于规则的。机器学习与基于规则的编程的不同之处在于,它能够自己推断出这些规则。<br/><br/>
假设你是一名银行经理,你想弄清楚一个贷款申请人是否有可能拖欠贷款。在基于规则的方法中,银行经理(或其他专家)将明确地告诉计算机,如果申请人的信用评分低于阈值,则拒绝该申请。<br/><br/>
然而,机器学习算法只需要获取客户信用评分和贷款结果的历史数据,然后自己计算出这个阈值应该是多少。在这样做的过程中,机器从历史数据中学习并创建自己的规则。<br/><br/>
当然,这只是对机器学习的介绍,因为现实世界的机器学习模型通常比简单的阈值复杂得多。尽管如此,这仍然是一个很好的例子,说明机器学习可以有多么强大。<br/><br/>
只要您拥有相关数据,任何组织KPI都可以进行优化。例如,给定一个历史客户数据集,您可以预测当前的哪些客户有离开的危险,这样您就可以在流失发生之前阻止它。<br/><br/>
机器学习方法已经取得了巨大的进步,而且可以完成的远不止于此。从自动驾驶汽车到语音识别,再到标记收件箱垃圾邮件的自动电子邮件过滤系统,机器学习算法构成了我们今天所依赖的许多技术进步的基础。<br/><br/>
机器学习算法通常分为三大类:监督学习、无监督学习和强化学习。接下来,让我们了解一下不同类型的机器学习算法以及它们可以解决的特定类型的问题。<br/><br/>
<span class="headline">1 监督学习</span> <br/><br/>
监督学习指的是一类算法,在这种算法中,机器学习模型被赋予一组数据,这些数据带有我们感兴趣的数据的明确标签(这个标签通常被称为响应变量或目标变量)。半监督学习使用标记和未标记数据的组合来训练人工智能模型。<br/><br/>
如果处理的是无标签的数据,则需要对数据打上标签。打标签是对数据实例进行注释以帮助训练机器学习模型的过程。打标签通常由人工完成,这可能既昂贵又耗时。然而,有一些方法可以使打标签过程自动化。<br/><br/>
监督学习的一个很好的例子是我们前面考虑的贷款申请场景。在这里,我们有过去贷款申请人的信用评分(以及潜在的收入水平、年龄等)的历史数据,以及明确的标签,这些标签告诉我们这些申请人是否拖欠贷款。<br/><br/>
监督学习算法可以进一步细分为回归和分类。这个差异是指我们的目标变量的类型。如果目标是在几个离散的类别之间进行选择——例如,申请人是否拖欠贷款,这是一张猫、狗还是人的照片,等等——那么这个问题就被称为分类,因为我们正在试图给数据确定所属的类别。然而,如果我们的目标变量是连续的,那么这个问题就被称为回归。例如,根据卧室的数量和位置来预测房子的价格。<br/><br/>
常见的监督学习算法有线性回归、逻辑回归、支持向量机、决策树等<br/><br/>
<span class="headline">2 无监督学习</span> <br/><br/>
在无监督学习问题中,我们得到的数据没有标签,我们只是在寻找模式。常见的无监督学习算法有聚类分析、关联规则挖掘、降维和特征提取等。例如,给定亚马逊客户的购买历史,我们能否识别任何集群(类似客户的组)?<br/><br/>
在这种情况下,即使我们没有明确的、确定的数据,关于一个人的兴趣是什么,只要确定一个特定的客户群体购买了类似的商品,我们就可以根据集群中的其他人也购买了什么来进行购买推荐。类似的系统是亚马逊的“你可能也会感兴趣”推荐引擎的核心。<br/><br/>
K-means聚类是一种聚类模型,它根据客户行为模式的相似性将客户群体分配到不同的集群或组中。在技术层面上,它的工作原理是找到每个集群的质心,然后将其用作集群的初始平均值。然后根据新客户与集群中其他成员的相似性将其分配到集群中。<br/><br/>
此外,一旦我们确定了集群,我们就可以研究它们的特征。例如,假设我们看到一个给定的集群正在购买许多电子游戏。在这种情况下,我们可以有根据地猜测这群用户是游戏玩家。一旦我们完成了这种形式的分析,我们甚至可以使用无监督学习的标签来创建监督学习模型,例如,让我们能够预测一个25岁的玩家与一个50岁的钓鱼爱好者相比,可能会在我们这里花多少钱。<br/><br/>
<span class="headline">3 强化学习</span><br/><br/>
强化学习是一类机器学习算法,我们分配计算机代理执行某些任务,而不给它确切的指导。相反,我们允许计算机做出自己的选择,并根据这些选择是否会导致我们想要的结果,我们分配惩罚和奖励。我们多次重复这个过程,让计算机通过试错和反复迭代来学习做某事的最佳方式。<br/><br/>
有趣的是,玩游戏是强化学习显示出最惊人结果的应用。谷歌臭名昭著的AlphaGo模型就是利用强化学习建立起来的,它甚至击败了排名最高的人类围棋选手。此后,谷歌将同样的技术扩展到了AlphaZero,它是最初的AlphaGo的继承者,被国际象棋选手用作确定最佳策略的参考。<br/><br/>
</p>
</el-scrollbar>
</el-dialog>
</div>
</div>
</template>
<script setup>
import * as commonality from "@/api/commonality.js";
// import {getUserId} from "@/utils/auth.js";
const {proxy} = getCurrentInstance();
const robotlearningVisible = ref(false);
const TrainingSet=ref([
{
age:'25',
sex:'男',
income:'30000',
purchase:'否'
},
{
age:'35',
sex:'女',
income:'40000',
purchase:'是'
},
{
age:'45',
sex:'女',
income:'80000',
purchase:'是'
},
{
age:'20',
sex:'男',
income:'10000',
purchase:'否'
},
{
age:'55',
sex:'男',
income:'60000',
purchase:'是'
},
{
age:'60',
sex:'女',
income:'90000',
purchase:'是'
},
{
age:'30',
sex:'男',
income:'50000',
purchase:'否'
},{
age:'40',
sex:'女',
income:'75000',
purchase:'是'
}
])
const MaleSubset=ref([
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
])
const FemaleSubset=ref([
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
])
const greaterThan=ref([
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
])
const lessThan=ref([
{
age:'',
sex:'',
income:'',
purchase:''
}
])
const IncorrectScoring=ref(0)
const state=ref(1)
const Conditions=ref({
sex:'',
age:'',
})
const restartStatus=ref(false)
// 分割
const segmentation = (data,id,sex) => {
if(sex=='男'){
console.log(data,"data");
}
const women = TrainingSet.value.filter(item => item.sex === sex);
let isConsistent =null
let isVacancy =null
if (women.length === 0) {
console.log('没有女性数据');
return;
}
isVacancy=data.every(val=>!val.age || !val.income || !val.purchase)
if(isVacancy){
proxy.$modal.msgWarning('分割子集不能为空!')
return
}
data.forEach((item, outerIndex) => {
const dataItem = item; // 为清晰起见,使用一个新变量
isConsistent = women.some(womanItem => {
// 如果找到一个匹配的women项,返回true
return (
womanItem.sex===sex&&
dataItem.age === womanItem.age &&
dataItem.income === womanItem.income &&
dataItem.purchase === womanItem.purchase
);
});
// 只比较第四个元素
});
if (!isConsistent) {
if(id==1){
IncorrectScoring.value=1
}else if(id==2){
IncorrectScoring.value=2
}
proxy.$modal.msgError('分割错误');
// 在这里可以添加更多逻辑,比如显示更具体的错误消息
} else {
proxy.$modal.msgSuccess('分割成功');
if(id==1){
state.value=2
}else if(id==2){
state.value=3
}
}
}
const divide=(data,id)=>{
let women=null
if(id==3){
women = TrainingSet.value.filter(item => item.age <= '30');
}else if(id==4){
women = TrainingSet.value.filter(item => item.age > '30');
}
let isConsistent =null
data.forEach((item, outerIndex) => {
if (!item.income || !item.purchase) {
proxy.$modal.msgError('请填写完整');
return;
}
const dataItem = item; // 为清晰起见,使用一个新变量
isConsistent= women.some(womanItem => {
// 如果找到一个匹配的women项,返回true
return (
dataItem.income === womanItem.income &&
dataItem.purchase === womanItem.purchase
);
});
});
if(data.length){
if(!isConsistent){
if(id==3){
IncorrectScoring.value=3
}else if(id==4){
IncorrectScoring.value=4
}
proxy.$modal.msgError('划分错误');
}else{
if(id==3){
state.value=4
}else if(id==4){
state.value=5
}
proxy.$modal.msgSuccess('划分成功');
}
}
}
// 购买
const Decisiontreepurchase=(sex,buys)=>{
if(state.value<4){
proxy.$modal.msgWarning('请先以上步骤');
return
}
if(sex=='女'){
if(Conditions.value.sex!=='女'){
IncorrectScoring.value=5
proxy.$modal.msgError('购买错误');
}else{
state.value=6
proxy.$modal.msgSuccess('购买成功');
}
}else{
if(Conditions.value.age!=='是'){
if(Conditions.value.age=='否'){
if(buys =='不购买'){
state.value=5
proxy.$modal.msgSuccess('不购买');
}else{
proxy.$modal.msgError('购买错误');
IncorrectScoring.value=5
}
}
}else{
console.log(buys,"buys");
if(buys =='购买'){
proxy.$modal.msgSuccess('购买成功');
}else{
proxy.$modal.msgError('购买错误');
IncorrectScoring.value=5
}
}
}
state.value=6
}
// 提交任务
const submit=()=>{
if(state.value){
if(state.value<3){
return proxy.$modal.msgWarning('未分割男性/女性子集!')
}
if( state.value<5){
return proxy.$modal.msgWarning('未划分男性大于30岁/小于等于30岁的子集!')
}
if(state.value<6){
return proxy.$modal.msgWarning('请先绘制决策树!')
}
}
commonality.submitTask({module:'人工智能',numberOfErrors:IncorrectScoring.value > 10 ? 10 : IncorrectScoring.value || 0,taskName:'机器人学习',userId:'487'}).then((response) => {
proxy.$modal.msgSuccess("提交任务成功");
restartStatus.value=false
robotlearningVisible.value=false
handleCole()
})
.catch((error) => {
});
}
// 保存
const handleCole=()=>{
const dtoList={}
dtoList.one=JSON.stringify(MaleSubset.value),
dtoList.two=JSON.stringify(FemaleSubset.value),
dtoList.three=JSON.stringify(greaterThan.value),
dtoList.four=JSON.stringify(lessThan.value),
dtoList.userId='487'
dtoList.subState=state.value
dtoList.numberOfErrors=IncorrectScoring.value
robotlearningVisible.value=false
if(restartStatus.value) return
commonality.RobotSave(dtoList).then((response) => {
})
}
const getList=()=>{
commonality.RobotECho({userId:'487'}).then(res=>{
if(restartStatus.value) return
MaleSubset.value=JSON.parse(res.data.stepOneA)
FemaleSubset.value=JSON.parse(res.data.stepOneB)
greaterThan.value=JSON.parse(res.data.stepOneC)
lessThan.value=JSON.parse(res.data.stepOneD)
state.value=res.data.subState || 1
})
}
const restart=()=>{
state.value=0
restartStatus.value=true
robotlearningVisible.value=false
MaleSubset.value=[
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
]
FemaleSubset.value=[
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
]
greaterThan.value=[
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
{
age:'',
sex:'',
income:'',
purchase:''
},
]
lessThan.value=[
{
age:'',
sex:'',
income:'',
purchase:''
}
]
Conditions.value.sex=''
Conditions.value.age=''
}
getList()
//组件销毁钩子
onBeforeUnmount(() => {
handleCole()
})
</script>
<style lang='scss' scoped>
.Robot-learning {
display: flex;
.left {
position: relative;
width: 100%;
}
.right {
position: absolute;
top: 150px;
right: 15px;
width: 216px;
padding-left: 60px;
span {
display: inline-block;
width: 110px;
height: 143px;
background: url("@/assets/images/szjj/案例任务.png") no-repeat;
background-size: 100% 100%;
cursor: pointer;
}
}
.gdialog{
.TaskBackground{
span{
display: inline-block;
width: 181px;
height: 66px;
text-align: center;
line-height: 66px;
background: url("@/assets/images/szjj/任务背景.png") no-repeat !important;
background-size: 100% 100% !important;
font-family: Source Han Sans CN;
font-weight: bold;
font-size: 20px;
color: #333333;
}
}
.info{
display: flex;
align-items: center;
color:#FFFFFF !important;
img{
margin-right: 10px;
}
}
.tabback{
width: calc(100% - 30%);
padding: 13px 17px;
background: url('@/assets/images/szjj/圆角矩形 10 拷贝 3.png') no-repeat center center;
background-size: 100% 100%;
}
.tab2{
width: calc(100% - 40%);
margin-bottom: 20px;
}
.tab3{
width: calc(100% - 50%);
margin-bottom: 20px;
}
.DecisionTree{
position: relative;
width: calc(100% - 45%);
height: 316px;
padding: 12px 0px;
background: url('@/assets/images/szjj/圆角矩形 10 拷贝 3.png') no-repeat center center;
background-size: 100% 100%;
.titleimg{
display: flex;
justify-content: center;
margin-left: 12px;
}
.sex{
position: relative;
display: flex;
justify-content: center;
align-items: center;
margin-left: 12px;
margin-top: 10px;
height: 31px;
&::before{
content: '';
display: inline-block;
position: absolute;
top: 92%;
left: 30%;
width: 264px;
height: 58px;
background: url('@/assets/images/szjj/线条.png') no-repeat center center;
background-size: 100% 100%;
}
}
.information{
position: absolute;
top: 57%;
left: 20%;
display: flex;
gap: 116px;
.box{
width: 147px;
height: 31px;
background: linear-gradient(-90deg, #6C32E0 0%, #A365E2 100%);
border-radius: 4px;
border: 2px solid;
border-image: linear-gradient(0deg, #C0DCFF, #CBBAFF) 10 10;
}
.box:nth-child(1){
&::before{
content: '男';
position: absolute;
top: -98%;
left: 14%;
}
&::after{
content: '';
position: absolute;
top: 99%;
left: -2%;
width: 169px;
height: 66px;
background: url('@/assets/images/szjj/线条.png') no-repeat center center;
background-size: 100% 100%;
}
}
// .box:nth-child(2){
// &::before{
// content: '';
// position: absolute;
// top: -98%;
// left: 87%;
// width: 85px;
// height: 28px;
// line-height: 28px;
// text-align: center;
// background: #FFFFFF;
// border-radius: 2px;
// border: 1px solid #E5E5E5;
// }
// }
}
.ipt{
position: absolute;
top: -146%;
right: -6%;
width: 85px;
height: 28px !important;
// 不继承
}
.Consumption{
position: absolute;
bottom: 3%;
left: 12%;
display: flex;
gap: 90px;
.box1{
width: 90px;
height: 31px;
background: linear-gradient(-90deg, #6C32E0 0%, #A365E2 100%);
border-radius: 4px;
border: 2px solid;
border-image: linear-gradient(0deg, #C0DCFF, #CBBAFF) 10 10;
span{
display: inline-block;
display: flex;
align-items: center;
justify-content: center;
width: 90px;
line-height: 31px;
color: #FFFFFF;
text-align: center;
img{
margin-right: 10px;
}
}
}
.box1:nth-child(1){
&::before{
content: '大于30岁';
position: absolute;
top: -100%;
left:-20%;
width: 85px;
height: 28px;
line-height: 28px;
text-align: center;
background: #FFFFFF;
border-radius: 2px;
border: 1px solid #E5E5E5;
}
}
// .box1:nth-child(2){
// &::before{
// content: '小于等于30岁';
// position: absolute;
// top: -113%;
// left: 85%;
// width: 90px;
// height: 28px;
// line-height: 28px;
// text-align: center;
// background: #FFFFFF;
// border-radius: 2px;
// // border: 1px solid #E5E5E5;
// }
// }
.ipt1{
position: absolute;
top: -136%;
right: 89%;
width: 85px;
height: 28px !important;
// 不继承
}
}
.tetx{
display: flex;
align-items: center;
justify-content: center;
width: 147px;
text-align: center;
line-height: 29px;
background: linear-gradient(-90deg, #6C32E0 0%, #A365E2 100%);
border-radius: 4px;
border: 2px solid;
border-image: linear-gradient(0deg, #C0DCFF, #CBBAFF) 10 10;
font-family: Source Han Sans CN;
font-weight: 500;
font-size: 14px;
color: #FFFFFF;
img{
margin-right: 10px;
}
}
}
.LeftbuttonS{
width: 136px;
height: 40px;
background:url('@/assets/images/szjj/按钮1.png') no-repeat center center;
background-size: 100% 100%;
font-family: Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
border: none;
// cursor: pointer;
}
}
}
</style>

@ -3,15 +3,15 @@
<div class="text-centent">
<div class="left">
<el-scrollbar height="650px">
<el-scrollbar height="650px" style="height:96%">
<el-row>
<el-col :span="24">
<div class="title-back">
<span>任務背景</span>
<span>任务背景</span>
</div>
</el-col>
</el-row>
<p >
<p style="color:#FFFFFF">
小张在写期末课程小论文的时候,上网查资料发现一篇文章特别有参考价值,但是这篇文章无法复制,小张要怎么做才能获得这篇文章的电子版呢?
</p>
<div class="Step" v-for="item in Step1" :key="item">
@ -129,7 +129,7 @@
</div>
</template>
<script setup>
// import {getUserId,getToken} from "@/utils/auth.js";
import {getToken} from "@/utils/auth.js";
import * as commonality from "@/api/commonality.js";
const { proxy } = getCurrentInstance()
const textDialogVisible = ref(false);
@ -141,7 +141,7 @@ const answerRecord=ref(0)
const Step1 = ref([]);
const Step2 = ref([]);
const CharacterRecognitionCase=()=>{
commonality.getTextList({userId:getUserId(),model:'文字识别OCR'}).then(res=>{
commonality.getTextList({userId:'487',model:'文字识别OCR'}).then(res=>{
if(Step1.value.length<1&&Step2.value.length<1){
Step1.value.push(res.data[0])
Step2.value.push(res.data[1])
@ -176,7 +176,7 @@ const CharacterRecognitionCase=()=>{
// submitStepOne
const stepOneanswer=()=>{
answerRecord.value=1
commonality.submitStepOne({userId:getUserId(),answer:Step1.value[0].studentAnswer}).then(res=>{
commonality.submitStepOne({userId:'487',answer:Step1.value[0].studentAnswer}).then(res=>{
if(res.msg.includes('错误')){
errorCount.value=1
proxy.$modal.msgError(res.msg);
@ -196,7 +196,7 @@ const stepTwoanswer=()=>{
return proxy.$modal.msgWarning("请先下载文章图片再进行此操作")
}
answerRecord.value=3
commonality.submitStepTwo({userId:getUserId(),answer:Step2.value[0].studentAnswer.join(',')}).then(res=>{
commonality.submitStepTwo({userId:'487',answer:Step2.value[0].studentAnswer.join(',')}).then(res=>{
if(res.msg.includes('错误')){
errorCount.value=2
proxy.$modal.msgError(res.msg);
@ -213,7 +213,7 @@ const downloadArticle=()=>{
return proxy.$modal.msgWarning("请先完成上一步")
}
answerRecord.value=2
window.open(`http://szjj.sztzjy.com:9909/api/stu/experimental/downloadImg?userId=${getUserId()}&TOKEN=${getToken()}`)
window.open(`http://szjj.sztzjy.com:9909/api/stu/experimental/downloadImg?userId=${'487'}&TOKEN=${getToken()}`)
}
// 识别文字
@ -221,7 +221,7 @@ const textarea=ref('')
// 识别文字函数
const identifyText=()=>{
const params={
userId:getUserId(),
userId:'487',
context:textarea.value
}
if(answerRecord.value<3){
@ -242,7 +242,7 @@ const submit = () => {
return proxy.$modal.msgWarning("请先完成实训")
}
commonality
.submitTask({module:'人工智能',numberOfErrors:errorCount.value>10?10:errorCount.value,taskName:'文字之别OCR',userId:getUserId()})
.submitTask({module:'人工智能',numberOfErrors:errorCount.value>10?10:errorCount.value,taskName:'文字之别OCR',userId:'487'})
.then((response) => {
proxy.$modal.msgSuccess("提交成功");
textDialogVisible.value=false
@ -274,7 +274,7 @@ CharacterRecognitionCase()
.right {
position: absolute;
right: 15px;
top: 20px;
top: 150px;
width: 216px;
padding-left: 60px;
span {
@ -322,7 +322,7 @@ div {
font-size: 15px;
font-family: Source Han Sans CN;
font-weight: 600;
color: #333333;
color: #FFFFFF;
}
}

@ -3,15 +3,15 @@
<div class="Face-recognition">
<div class="left">
<el-scrollbar height="650px">
<el-scrollbar height="650px" style="height:96%">
<el-row>
<el-col :span="24">
<div class="title-back">
<span>任務背景</span>
<span>任务背景</span>
</div>
</el-col>
</el-row>
<div style="width: calc(100% - 216px);">
<div style="width: calc(100% - 216px);color:#FFFFFF">
<p >
小张假期和几个朋友一起出去旅游,旅途很开心,也拍了很多照片,小张想挑出包含自己的照片,可面对那么多照片犯了难,突然他想到了手机相册里的自动分类功能,<br />
可以把某个人识别出来自动建一个相册,解决问题的同时,他对这个功能背后的原理产生了兴趣,接下来跟着小张一起探究背后的原理吧。
@ -62,7 +62,7 @@
<div class="Identify" v-loading="loading">
<div class="Identify-item1">
<div class="Frame">
<img src="../../../assets/images/szjj/框内图标.png" alt="" />
<img src="@/assets/images/szjj/框内图标.png" alt="" />
<span>将识别到的正确图片放置到框内</span>
</div>
<div class="Frame item" v-for="item in IdentifyList" :key="item">
@ -434,7 +434,7 @@ getList()
}
.right {
position: absolute;
top: 20px;
top: 150px;
right: 15px;
width: 216px;
padding-left: 60px;
@ -493,7 +493,7 @@ getList()
font-size: 15px;
font-family: Source Han Sans CN;
font-weight: 600;
color: #333333;
color: #FFFFFF;
}
}
.serchimg {

@ -7,27 +7,35 @@
<script setup>
import face from './components/face-recognition.vue'
const pageData=[face]
const page=ref(face)
import article from './components/article-identification.vue'
import recognition from './components/Image-recognition.vue'
import voice from './components/voice-technology.vue'
import Naturall from './components/Naturallanguageprocessing.vue'
import Robot from './components/Robot-learning.vue'
const pageData=[recognition,article,face,voice,Naturall,Robot]
const page=ref(recognition)
const clickIndx=(index)=>{
page.value=pageData[index]
}
const imgData=[
{
text:'什么是大数据',
text:'图像识别',
img:'wst'
},{
text:'大数据技术框架',
text:'文字识别',
img:'wz'
},{
text:'HADOOP',
text:'人脸识别',
img:'bt'
},{
text:'HDFS',
text:'语音技术',
img:'xt'
},{
text:'Apriori关联算法',
text:'自然语音处理',
img:'sp'
},{
text:'机器学习',
img:'dmx'
}
]
</script>

@ -322,27 +322,27 @@
</div>
<div class="img1 ending_item" v-show="showDiv[2]" >
<span >扫描D并计数</span>
<img src="@/assets/images/箭头1.png" alt="">
<img src="../../../../assets/images/箭头1.png" alt="">
</div>
<div class="img1 tsImg1 ending_item" v-show="showDiv[4]" >
<span>比较产生L1</span>
<img src="@/assets/images/箭头2.png" alt="">
<img src="../../../../assets/images/箭头2.png" alt="">
</div>
<div class="img2 ending_item" v-show="showDiv[6]" >
<span>连接</span>
<img src="@/assets/images/箭头3.png" alt="">
<img src="../../../../assets/images/箭头3.png" alt="">
</div>
<div class="img1 tsImg2 ending_item" v-show="showDiv[8]" >
<span>扫描比较产生L2</span>
<img src="@/assets/images/箭头4.png" alt="">
<img src="../../../../assets/images/箭头4.png" alt="">
</div>
<div class="img1 tsImg3 ending_item" v-show="showDiv[10]" >
<span>连接剪枝</span>
<img src="@/assets/images/箭头5.png" alt="">
<img src="../../../../assets/images/箭头5.png" alt="">
</div>
<div class="img3 ending_item" v-show="showDiv[12]" >
<span>扫描比较产生L2</span>
<img src="@/assets/images/箭头6.png" alt="">
<img src="../../../../assets/images/箭头6.png" alt="">
</div>
</div>
</div>

@ -0,0 +1,500 @@
<template>
<div class="app-container">
<div class="study_main">
<div class="study_main_up">
<div class="study_main_up_top">
<div class="study_main_up_left">
<img src="../../assets/icons/svg/score.svg" />
<span style="color:#FFFFFF">得分情况</span>
</div>
<el-button type="primary" :icon="Refresh" round @click="updateReportGrade">更新</el-button>
</div>
<div class="study_main_up_foot">
<el-table
:data="tableData4"
:span-method="tableSpanMethod"
stripe
border
:header-cell-style="{background: '#A2C9FF'}"
style="width: 100%"
>
<el-table-column prop="sid" label="序号" width="80" align="center" />
<el-table-column
prop="learningProjects"
label="学习项目"
width="210"
align="center"
/>
<el-table-column
prop="assessmentItems"
label="考核项目"
width="225"
align="center"
/>
<el-table-column
prop="scoringCriteria"
label="计分标准"
width="314"
align="center"
/>
<el-table-column
prop="totalScore"
label="总分"
width="129"
align="center"
/>
<el-table-column
prop="scoreWeight"
label="成绩权重"
width="129"
align="center"
/>
<el-table-column
prop="completionStatus"
label="完成情况"
width="225"
align="center"
/>
<el-table-column
prop="scoreProject"
label="得分"
width="131"
align="center"
/>
</el-table>
</div>
</div>
<div class="study_main_but">
<div class="study_main_but_left">
<img src="../../assets/icons/svg/sxbg.svg" />
<span style="color:#FFFFFF">实训报告</span>
</div>
<!-- action="http://qkljr.sztzjy.com:90/api/stu/concept/block/upload" -->
<el-upload
ref="uploadRef"
class="upload-demo"
:file-list="fileList"
:auto-upload="false"
:on-change="handleChange"
:show-file-list="false"
multiple="multiple"
>
<template #trigger>
<el-button color="#626aef" round ><el-icon><UploadFilled /></el-icon>点击上传</el-button>
</template>
<!-- <div class="reportPromptFile" v-html="item[`${index}`].path"></div> -->
</el-upload>
<div class="study_main_but_foot">
<el-table
:data="tableData2"
stripe
style="width: 100%"
border
:header-cell-style="{background: '#A2C9FF'}"
>
<el-table-column
prop="reportName"
label="报告名称"
width="289"
align="center"
/>
<el-table-column
prop="uploadTime"
label="上传时间"
width="289"
align="center"
/>
<el-table-column
prop="size"
label="文件大小"
width="290"
align="center"
/>
<el-table-column
prop="rating"
label="评分"
width="289"
align="center"
/>
<el-table-column
label="操作"
class="controls"
width="286"
align="center"
>
<el-link type="success" @click="uploadReport"><el-icon><Download /></el-icon>下载</el-link>
<el-link type="warning" @click="showComments"><el-icon><Tickets /></el-icon>查看评语</el-link>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
<el-dialog
v-model="dialogVisible"
title="评语"
width="30%"
:before-close="handleClose"
>
<span>{{tableData2[0].teacherComments}}</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">确定</el-button>
<!-- <el-button type="primary" @click="dialogVisible = false">
Confirm
</el-button> -->
</span>
</template>
</el-dialog>
</template>
<script setup>
import { Refresh } from "@element-plus/icons-vue";
import { onMounted, ref } from "vue";
import * as API from "@/api/prtrait/prtrait.js"
// import {Base64} from 'js-base64'
// import { useRouter } from "vue-router";
import {download} from '@/utils/request.js'
import { getToken } from '@/utils/auth'
import { ElMessage } from "element-plus";
// const router=useRouter();
//评语弹窗
const dialogVisible = ref(false)
const tableSpanMethod = computed(() => {
// if (tableData.value.length >= 5) {
if (tableData4.value.length >= 6) {
return arraySpanMethod;
}
return null;
});
const arraySpanMethod = ({ row, column, rowIndex, columnIndex }) => {
if (rowIndex === tableData4.value.length - 1) {
if (columnIndex === 0) {
return [1, 5];
} else if (columnIndex === 1) {
return [0, 0];
}
}
};
const tableData2 =ref([])
const tableData=ref([])
const tableData4=ref([
{
sid:1,
assessmentItems:"阅读知识",
learningProjects:"知识概要",
scoreProject:null,
scoreWeight:null,
scoringCriteria:"",
totalScore:100
},
{
sid:2,
assessmentItems:"观看资源",
learningProjects:"资源学习",
scoreProject:null,
scoreWeight:null,
scoringCriteria:"",
totalScore:100
},
{
sid:3,
assessmentItems:"客观题测试",
learningProjects:"学习测评",
scoreProject:null,
scoreWeight:null,
scoringCriteria:"",
totalScore:100
},
{
sid:4,
assessmentItems:"输错/选错次数",
learningProjects:"实验实训",
scoreProject:null,
scoreWeight:null,
scoringCriteria:"",
totalScore:100
},
{
sid:5,
assessmentItems:"",
learningProjects:"实训报告",
scoreProject:null,
scoreWeight:null,
scoringCriteria:"",
totalScore:100
},
])
const calculateAverageScore=()=>{
// 计算每个对象的权重乘以得分,并存储在一个新数组中
const weightedScores = tableData4.value.map(item => {
if(item.scoreProject!==null){
// 解析权重字符串,去掉百分号并转换为数字
const weight = parseFloat(item.scoreWeight.replace('%', ''))/100;
// 解析得分字符串并转换为数字
const score = parseFloat(item.scoreProject);
// 计算权重乘以得分
const weightedScore = weight * score;
return weightedScore;
}
return 0
});
// 使用 reduce 方法计算新数组中所有元素的总和
const totalWeightedScore = weightedScores.reduce((acc, curr) => acc + curr, 0);
// 最终结果是总和乘以5
const finalResult = totalWeightedScore;
const finalResult1=String(finalResult.toFixed())
const newData = {
sid: "合计",
project: "",
assessmentItems: "100%",
scoringCriteria: "/",
totalScore: finalResult1,
weight: "",
condition: "",
score: "",
}
tableData4.value.push(newData)
}
const fileList=ref([])
const data=ref({
"ascription":'',
"userId":'487',
"schoolId":'232'
})
const handleChange =(info)=> {
fileList.value.push(info);
let formData2 = new FormData();
formData2.append("file", fileList.value[0].raw)
formData2.append("stuBlockProduct", JSON.stringify(data.value))
fileList.value.splice(0, fileList.value.length);
API.uploadTrainingReport(formData2).then(()=>{
getReports()
})
}
const uploadRef = ref(null);
const getReports=()=>{
API.getDetailsTrainingReport(data.value).then((res)=>{
tableData2.value.splice(0, tableData2.value.length);
if(res.data!==null){
tableData2.value.push(res.data)
tableData2.value[0].size=tableData2.value[0].size+"kb"
}
})
}
const data2={
"userId":'587',
"TOKEN":'Bearer '+getToken()
}
//下载
const uploadReport=async()=>{
window.open(`http://118.31.7.2:7899/api/stu/concept/block/download?TOKEN= ${'Bearer '+getToken()}&userId=${data2.userId}`)
// window.open(`http://202.97.179.126:8800/api/stu/concept/block/download?reportName=${tableData2.value[0].reportName}&TOKEN= ${'Bearer '+getToken()}&module=${data2.module}&userId=${data.userId}`)
// window.open(`http://202.199.90.115:8800/api/stu/concept/block/download?reportName=${tableData2.value[0].reportName}&TOKEN= ${'Bearer '+getToken()}&module=${data2.module}&userId=${data.userId}`)
}
const isUpdate=ref(false)
//查看评语
const showComments=()=>{
if(tableData2.value.length<=0){
ElMessage({
message: "暂无评语",
type: "warning",
});
return
}
dialogVisible.value=true
}
onMounted(()=>{
data.value.module='数字营销'
setTimeout(() => {
cerateGrade()
}, 300);
setTimeout(() => {
getReports()
}, 600);
})
const cerateGrade=()=>{
API.academicRecordEnquiry(data.value).then((res)=>{
let currentId =1
const tableData3 = res.data.map(item => {
const weight1 = parseInt(item.scoreWeight*100)
const weight2 = `${weight1}%`;
if(item.learningProjects==="知识概要"){
const score=parseFloat(item.scoringCriteria)
const time = reactive({value: '/'});
if(item.completionStatus!==null){
time.value=parseFloat(item.completionStatus)
}
tableData4.value[0].scoringCriteria=`阅读1分钟得${score}分,1分钟以下不得分`
tableData4.value[0].completionStatus=`阅读${time.value}分钟`
tableData4.value[0].scoreProject=item.scoreProject
tableData4.value[0].scoreWeight=weight2
}
if(item.learningProjects==="实验实训"){
const score=parseFloat(item.scoringCriteria)
const time = reactive({value: '/'});
if(item.completionStatus!==null){
time.value=parseFloat(item.completionStatus)
}
tableData4.value[3].scoringCriteria=`输错/选错次数扣${score}分`
tableData4.value[3].completionStatus=`输错/选错 ${time.value}次`
tableData4.value[3].scoreProject=item.scoreProject
tableData4.value[3].scoreWeight=weight2
}
if(item.learningProjects==="资源学习"){
const score=parseFloat(item.scoringCriteria)
const time = reactive({value: '/'});
if(item.completionStatus!==null){
time.value=parseFloat(item.completionStatus)
}
tableData4.value[1].scoringCriteria=`观看资源1分钟得${score}分`
tableData4.value[1].completionStatus=`观看${time.value}分钟`
tableData4.value[1].scoreProject=item.scoreProject
tableData4.value[1].scoreWeight=weight2
}
if(item.learningProjects==="学习测评"){
const time = reactive({value: '/'});
if(item.completionStatus!==null){
time.value=parseFloat(item.completionStatus)
}
const score=parseFloat(item.scoringCriteria)
tableData4.value[2].scoringCriteria=`${score}分/道`
tableData4.value[2].completionStatus=`错${time.value}道`
tableData4.value[2].scoreProject=item.scoreProject
tableData4.value[2].scoreWeight=weight2
}
if(item.learningProjects==="实训报告"){
tableData4.value[4].scoringCriteria=`提交实训报告,教师评分`
tableData4.value[4].completionStatus=item.completionStatus
if(item.scoreProject!==null){
tableData4.value[4].scoreProject=item.scoreProject
}
tableData4.value[4].scoreWeight=weight2
}
return {
...item
};
});
if(isUpdate.value){
return
}
tableData.value.push(...tableData3)
calculateAverageScore()
})
}
const updateReportGrade=()=>{
getReports()
cerateGrade()
}
</script>
<style lang="scss" scoped>
.study_main {
margin-top: 15px;
width: 1443px;
.study_main_up {
.el-button {
margin-right: 0px;
height: 28px;
width: 125px;
background: #0E64FE;
}
.study_main_up_top {
display: flex;
justify-content: space-between;
margin-bottom: 10px;
.study_main_up_left{
align-items: center;
justify-content: center;
display: flex;
span{
margin-left: 10px;
}
}
img {
width: 30px !important;
height: 30px;
}
}
}
.study_main_but {
margin-top: 25px;
.study_main_but_left {
align-items: center;
display: flex;
span{
margin-left: 10px;
}
img {
width: 30px;
height: 30px;
}
}
.upload-demo{
margin-top: 15px;
.el-button {
margin-right: 0px;
height: 30px;
width: 125px;
}
}
.is-underline:nth-child(1){
margin-left: 26px;
}
.is-underline:nth-child(2){
margin-left: 36px;
}
.study_main_but_foot{
margin-top: 20px;
}
}
}
// 设置表格行高度
:deep(.el-table__body tr,
.el-table__body td) {
padding: 0;
height: 40px !important;
border: 2px solid #8CA4EC;
}
:deep(.el-table__body tr:nth-child(6),
.el-table__body td) {
padding: 0;
height: 40px !important;
color: #FF8C01;
}
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
background: #F2F5FB;
}
::v-deep .study_main_up_foot .el-table {
--el-table-border-color: #8CA4EC;
}
::v-deep .study_main_but_foot .el-table {
--el-table-border-color: #9E74FF;
}
::v-deep .el-table__header-wrapper{
background: red;
}
.reportPromptFile{
font-size: 12px;
line-height: 7px;
font-family: '微软雅黑';
font-weight: 300;
}
</style>

@ -0,0 +1,575 @@
<template>
<el-scrollbar height="760px" always>
<div class="app-container">
<div class="tl_top">
<div class="eval_top">
<p>
<img
src="@/assets/icons/svg/color.svg"
style="width: 15px"
/>选择题 (共{{ mlistLength }}题), 合计100分
</p>
<el-button
style="margin-top: 10px;margin-left: 1212px;"
type="primary"
plain
@click="answerAgain"
>重新作答</el-button
>
<el-button
style="margin-top: 10px"
type="primary"
plain
@click="taskAnswer"
>提交</el-button
>
</div>
<hr />
</div>
<div
class="eval_main"
v-for="(item, index) in mlist"
:key="index"
:class="['eval_main' + index]"
>
<div class="eval_main_title">
<div class="eval_main_left">
<span>{{ index + 1 }}</span>
</div>
<div class="eval_main_right">
{{ item.topicName }}&nbsp;<span>({{ item.topicType }})</span>
</div>
</div>
<div class="eval_main_content">
<div class="eval_main_single">
<hr />
<el-radio-group
v-if="item.topicType === '单选题'"
v-model="item.studentAnswer"
@change="changeMultipleChoiceQuestions"
>
<el-radio
:class="getSingleChoiceStyle(item.rightOrWrong, item.answer, 'A',item.studentAnswer)" v-if="item.optionA !== null" label="A" border >A.{{ item.optionA}}<span class="stylingCorrectly" v-if="item.answer!=='A'&&item.studentAnswer==='A'&&item.rightOrWrong!==''&&item.rightOrWrong!==null">正确答案:{{item.answer}}</span>
</el-radio
>
<el-radio
:class=" getSingleChoiceStyle(item.rightOrWrong, item.answer, 'B',item.studentAnswer) "
v-if="item.optionB !== null"
label="B"
border
>B.{{ item.optionB }}<span class="stylingCorrectly" v-if="item.answer!=='B'&&item.studentAnswer==='B'&&item.rightOrWrong!==''&&item.rightOrWrong!==null">正确答案:{{item.answer}}</span>
</el-radio
>
<el-radio
:class="
getSingleChoiceStyle(item.rightOrWrong, item.answer, 'C',item.studentAnswer)
"
v-if="item.optionC !== null"
label="C"
border
>C.{{ item.optionC }}<span class="stylingCorrectly" v-if="item.answer!=='C'&&item.studentAnswer==='C'&&item.rightOrWrong!==''&&item.rightOrWrong!==null">正确答案:{{item.answer}}</span>
</el-radio
>
<el-radio
:class="
getSingleChoiceStyle(item.rightOrWrong, item.answer, 'D',item.studentAnswer)
"
v-if="item.optionD !== null"
label="D"
border
>D.{{ item.optionD }}<span class="stylingCorrectly" v-if="item.answer!=='D'&&item.studentAnswer==='D'&&item.rightOrWrong!==''&&item.rightOrWrong!==null">正确答案:{{item.answer}}</span></el-radio
>
<el-radio
:class="
getSingleChoiceStyle(item.rightOrWrong, item.answer, 'E',item.studentAnswer)
"
v-if="item.optionE !== null"
label="E"
border
>E.{{ item.optionE }}<span class="stylingCorrectly" v-if="item.answer!=='E'&&item.studentAnswer==='E'&&item.rightOrWrong!==''&&item.rightOrWrong!==null">正确答案:{{item.answer}}</span></el-radio
>
</el-radio-group>
<div class="eval_main_checkbox">
<el-checkbox-group
v-if="item.topicType === '多选题'"
v-model="item.studentAnswer"
>
<el-checkbox
v-if="item.optionA !== null"
v-model="item.state"
:label="item.optionA"
border
:class="showIcon(item, 'A')"
>
A.{{ item.optionA
}}<span class="stylingCorrectly2" v-if="ifShow(item,item.optionA)">正确答案:{{item.answer}}</span></el-checkbox
>
<el-checkbox
v-if="item.optionB !== null"
v-model="item.state"
:label="item.optionB"
border
:class="showIcon(item, 'B')"
>B.{{ item.optionB
}}<span class="stylingCorrectly2" v-if="ifShow(item,item.optionB)">正确答案:{{item.answer}}</span></el-checkbox
>
<el-checkbox
v-if="item.optionC !== null"
v-model="item.state"
:label="item.optionC"
border
:class="showIcon(item, 'C')"
>C.{{ item.optionC
}}<span class="stylingCorrectly2" v-if="ifShow(item,item.optionC)">正确答案:{{item.answer}}</span></el-checkbox
>
<el-checkbox
v-if="item.optionD !== null"
v-model="item.state"
:label="item.optionD"
border
:class="showIcon(item, 'D')"
>D.{{ item.optionD
}}<span class="stylingCorrectly2" v-if="ifShow(item,item.optionD)">正确答案:{{item.answer}}</span></el-checkbox
>
<el-checkbox
v-if="item.optionE !== null"
v-model="item.state"
:label="item.optionE"
border
:class="showIcon(item, 'E')"
>E.{{ item.optionE
}}<span class="stylingCorrectly2" v-if="ifShow(item,item.optionE)">正确答案:{{item.answer}}</span></el-checkbox
>
</el-checkbox-group>
</div>
<el-radio-group
v-if="item.topicType === '判断题'"
v-model="item.studentAnswer"
>
<el-radio label="A" border :class=" getSingleChoiceStyle(item.rightOrWrong, item.answer, 'A',item.studentAnswer)">正确</el-radio>
<el-radio label="B" border :class=" getSingleChoiceStyle(item.rightOrWrong, item.answer, 'B',item.studentAnswer)">错误</el-radio>
</el-radio-group>
</div>
</div>
</div>
</div>
</el-scrollbar>
</template>
<script setup>
// import { useRouter } from "vue-router";
// import {Base64} from 'js-base64'
import * as API from "@/api/prtrait/prtrait.js"
// import { getUserId } from "@/utils/auth";
import { ElMessage } from "element-plus";
import { onMounted } from "vue";
const data = ref({
module: "",
ascription:"",
userId: '487',
});
const multipleChoiceAnswer = ref();
// const router = useRouter();
const mlist = ref({});
const mlistLength = ref(0);
const correctNot1 = ref(false);
const correctNot2 = ref(false);
const getSingleChoiceStyle = (item, answer, answer2,studentAnswer) => {
// console.log(item, answer, answer2);
// if (item === "正确" && answer === answer2) {
if(item===''||item===null){
return
}
if ( answer === answer2) {
correctNot1.value = true;
return "correctStyleSingleChoiceQuestions";
}
if (answer !== answer2) {
correctNot2.value = true;
return "singleChoiceErrorStyle";
}
return;
};
const showIcon = (item, answer) => {
if(item.rightOrWrong===''||item.rightOrWrong===null){
return
}
if(item.answer!==null){
const isFlag=ref(false)
item.answer.split(',').map((item2)=>{
if(item2===answer){
isFlag.value=true
}
return item2
})
if(isFlag.value){
return "Correct";
}else{
return "error"
}
}
};
// 单选题ico函数
//哈希函数学习测评
const answerData=ref([])
onMounted(()=>{
data.value.module='数字营销'
submitDialogVisible1()
})
const submitDialogVisible1 = () => {
const newArray = [];
API.checkLearningAssessment(data.value).then((res)=>{
mlist.value = res.data;
mlist.value.forEach((item) => {
answerData.value.push(item.studentAnswer)
if (item.topicType === "多选题"&&item.rightOrWrong===null) {
item.studentAnswer = [];
}
if(item.topicType === "多选题"&&item.rightOrWrong!==null){
item.studentAnswer = item.studentAnswer.split(',').map((item2) => {
if (item2 === "A") {
return item.optionA;
}
if (item2 === "B") {
return item.optionB;
}
if (item2 === "C") {
return item.optionC;
}
if (item2 === "D") {
return item.optionD;
}
if (item2 === "E") {
return item.optionE;
}
return item2;
});
}
});
mlistLength.value = res.data.length;
})
};
const answer = ref([]);
// const checkboxGroup = ref([]);
const ifShow=(item,item2)=>{
if(item.rightOrWrong===''||item.rightOrWrong===null){
return false
}
const flag2=ref(false)
const item4=item.answer.split(',')
const arr=ref([])
item4.forEach(item5=>{
if(item5==='A'){
arr.value.push(item.optionA)
}
if(item5==='B'){
arr.value.push(item.optionB)
}
if(item5==='C'){
arr.value.push(item.optionC)
}if(item5==='D'){
arr.value.push(item.optionD)
}
if(item5==='E'){
arr.value.push(item.optionE)
}
})
item.studentAnswer.forEach(item3=>{
if(item3===item2){
flag2.value=true
}
})
// if(JSON.stringify(item.studentAnswer) === JSON.stringify(arr.value)){
if(arraysAreEqual(JSON.stringify(item.studentAnswer),JSON.stringify(arr.value))){
flag2.value=false
}
return flag2.value
}
function arraysAreEqual(arr1, arr2) {
const set1 = new Set(arr1);
const set2 = new Set(arr2);
return Array.from(set1).every(value => set2.has(value)) && Array.from(set2).every(value => set1.has(value));
}
//哈希函数提交
const isTask=ref(false)
let number=0
const TaskAssessment1 = async (TaskData) => {
TaskData.stuLearningAssessmentScoreDTO.stuLearningAssessmentDTOS.forEach(item => {
if(item.studentAnswer[0]===null||item.studentAnswer.length===0){
isTask.value=true
}
});
if(isTask.value&&number===0){
ElMessage({
message: "还有题目未完成",
type: "warning",
})
isTask.value=false
number++
return
}
try {
const res = await API.scoreLearningAssessment(TaskData);
ElMessage({
message: "提交成功",
type: "success",
});
setTimeout(()=>{
submitDialogVisible1()
},500)
} catch (error) {
// ElMessage({
// message: "请勿重复提交",
// type: "warning",
// });
}
};
const answerAgain=()=>{
mlist.value.forEach(item=>{
// item.answer=''
if(item.topicType==='多选题'){
item.studentAnswer=[]
}else{
item.studentAnswer=''
}
item.rightOrWrong=''
})
}
const taskAnswer = () => {
mlist.value.forEach((item) => {
if (item.studentAnswer === "" || item.studentAnswer === null) {
return;
}
});
const mlistArray = Object.values(mlist.value);
const transformedData = {
stuLearningAssessmentScoreDTO: {
userId: '487',
learningProjects: "学习测评",
assessmentItems: "客观题测试",
stuLearningAssessmentDTOS: mlistArray.map((item) => {
return {
topicId: item.topicId,
topicName: item.topicName,
topicType: item.topicType,
topicDifficultyLevel: item.topicDifficultyLevel,
topicScore: item.topicScore,
topicNumber: item.topicNumber,
optionA: item.optionA,
optionB: item.optionB,
optionC: item.optionC,
optionD: item.optionD,
optionE: item.optionE,
optionF: item.optionF,
answer: item.answer,
studentAnswer: item.studentAnswer,
questionAnswer: item.questionAnswer,
module: item.module,
logic: item.logic,
};
}),
},
};
transformedData.stuLearningAssessmentScoreDTO.stuLearningAssessmentDTOS.forEach(
(item) => {
// console.log(item,"89465845");
if (item.topicType === "多选题") {
const newArray = [];
item.studentAnswer.forEach((item2) => {
if (item2 === item.optionA) {
newArray.push("A");
}
if (item2 === item.optionB) {
newArray.push("B");
}
if (item2 === item.optionC) {
newArray.push("C");
}
if (item2 === item.optionD) {
newArray.push("D");
}
if (item2 === item.optionE) {
newArray.push("E");
}
});
item.studentAnswer = newArray;
// item.studentAnswer.push(newArray)
}
if (item.topicType === "多选题") {
item.studentAnswer.sort(function (s1, s2) {
let x1 = s1.toUpperCase();
let x2 = s2.toUpperCase();
if (x1 < x2) {
return -1;
}
if (x1 > x2) {
return 1;
}
return 0;
});
}
if (item.topicType !== "多选题") {
let flag = item.studentAnswer;
item.studentAnswer = [];
item.studentAnswer.push(flag);
}
}
);
TaskAssessment1(transformedData);
};
</script>
<style lang="scss" scoped>
.app-container {
background-color: #fff;
border-radius: 6px;
}
.tl_top {
position: fixed;
width: 82%;
height: 45px;
z-index: 999;
top: 158px;
right: 50px;
background-color: white;
}
.eval_top {
display: flex;
justify-content: space-between;
// position: fixed;
// z-index: 999;
p {
width: 210px;
height: 14px;
font-size: 14px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #333333;
}
}
.eval_main {
margin-top: 25px;
.eval_main_title {
width: 100%;
display: flex;
font-weight: bold;
font-size: 14px;
align-items: center;
.eval_main_right {
margin-left: 23px;
span {
font-size: 14px;
color: #00b4f2;
}
// &::before{
// content: ' ';
// margin-right:80PX;
// }
}
}
}
.eval_main_single {
margin: 20px 0 10px 91px;
.el-radio-group {
width: 985px;
}
.el-radio {
margin-bottom: 5px;
width: 801px;
top: 5px;
}
.el-checkbox {
margin-bottom: 5px;
width: 801px;
top: 5px;
}
.el-checkbox-group {
font-size: 0;
line-height: 0;
display: inline-flex;
align-items: center;
flex-wrap: wrap;
width: 985px;
}
}
.eval_main_left {
position: relative;
align-items: center;
display: flex;
justify-content: center;
width: 32px;
height: 32px;
background-color: #00b4f2;
color: white;
border-radius: 50%;
font-size: 13px;
font-size: 15px;
font-weight: 100;
margin-left: 35px;
}
hr {
border: 1px solid #e5e5e5;
}
.eval_main0 {
margin-top: 122px !important;
}
.correctStyleSingleChoiceQuestions.el-radio.is-bordered.is-checked {
border-color: #00bb00 !important;
position: relative;
&::after{
content: '√';
position: absolute;
// margin-left: 94%;
left: 805px;
color: #00bb00;
}
}
.singleChoiceErrorStyle.el-radio.is-bordered.is-checked {
border-color: red !important;
// 尾部插入
position: relative;
&::after{
content: 'X';
position: absolute;
// margin-left: 93%;
left: 805px;
color: red;
}
}
.error.el-checkbox.is-bordered.is-checked {
position: relative;
border-color: red !important;
&::after{
content: 'X';
// margin-left: 96% !important;
position: absolute;
left: 805px;
color: red;
}
}
.Correct.el-checkbox.is-bordered.is-checked {
position: relative;
// right: -2%;
border-color: #00bb00 !important;
&::after{
content: '√';
// margin-left: 93%;
position: absolute;
color: #00bb00;
left: 805px;
}
}
.stylingCorrectly{
position: absolute;
right: -101px;
}
.stylingCorrectly2{
position: absolute;
left: 828px;
}
</style>

@ -0,0 +1,183 @@
<template>
<div class="app-container">
<el-scrollbar height="780px" always>
<!-- <div class="app-container"> -->
<!-- <div class="main"> -->
<el-row :gutter="40">
<el-col :span="3" v-for="i in item" :key="i">
<div class="zs">
<div class="el_top">
<a target="_blank" @click="showResource(i.resourcesUrl)">
<span style="color:#FFFFFF">{{i.resourcesName}}</span>
</a>
</div>
<div class="el_bon">
<!-- <a :href="getImgLink(i.resourcesUrl)" target="_blank"> -->
<a target="_blank" @click="showResource(i.resourcesUrl)">
<img :src="getImg(i.resourcesImg)"/>
</a>
</div>
</div>
</el-col>
</el-row>
<!-- </div> -->
<!-- </div> -->
</el-scrollbar>
</div>
</template>
<script setup>
import * as API from "@/api/prtrait/prtrait.js"
import { getAssetsFile } from '@/utils';
// import { getUserId } from '@/utils/auth'
import { onMounted } from "vue";
const getImg=(i)=>{
return getAssetsFile('images/'+i)
}
const getImgLink=(i)=>{
return i
}
const data=ref({
"stuScoreDetailsDTO":{
"learningProjects":"资源学习",
"assessmentItems":"观看资源",
"viewingTime":0,
"userId":'487',
}
})
const item=ref({})
onMounted(()=>{
API.learningResourcesView({module:data.value.stuScoreDetailsDTO.module}).then((res)=>{
item.value=res.data
})
})
const showResource=async(i)=>{
console.log(i);
// const newWindow=window.open(`http://192.168.2.4:8800/api/stu/concept/block/getResource?`+`module=${data2.module}`+`&name=${i}`)
// window.open(`http://qkljr.sztzjy.com:90/api/stu/concept/block/getResource?`+`module=${data2.module}`+`&name=${i}`)
if(i.includes('mp4')){
const newWindow=window.open('','_blank')
newWindow.document.write(`
<html>
<head>
<title>视频播放</title>
<style>
body {
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #333333;
}
video {
width: 90%;
// max-width: 800px;
}
</style>
</head>
<body>
<video controls autoplay controlsList="nodownload">
<source src="http://118.31.7.2:96/report${i}" type="video/mp4">
</video>
</body>
</html>
`);
}
if(i.includes('pdf')){
// window.open(`http://qkljr.sztzjy.com:90/api/stu/concept/block/getResource?`+`module=${data2.module}`+`&name=${i}#toolbar=0`)
window.open(`http://118.31.7.2:96/report${i}#toolbar=0`)
// window.open(`http://202.199.90.115:8800/api/stu/concept/block/getResource?`+`module=${data2.module}`+`&name=${i}`)
}
}
const timer=ref(null)
let seconds=0
onMounted(()=>{
timer.value=setInterval(()=>{
seconds++
},1000)
})
onBeforeUnmount(()=>{
item.value={}
if(timer.value){
clearInterval(timer.value)
}
data.value.stuScoreDetailsDTO.viewingTime=seconds
API.resourcesLearningScoreStatistics(data.value)
})
const taskTime=async()=>{
}
</script>
<style lang="scss" scoped>
.app-container {
// background-color: #fff;
// border-radius: 6px;
// padding: 25px 25px 25px 0;
.k_main {
width: 98%;
display: inline-block;
margin: 20px;
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3);
height: 750px;
background-color: white;
border-radius: 10px;
}
.el-col-4 {
margin-bottom: 30px;
}
.zs {
margin-bottom: 36px;
border: 1px solid #dcdfe6;
border-radius: 8px;
}
.main {
}
.el_top {
height: 66px;
display: flex;
justify-content: center;
align-items: center;
font-size: 12px;
font-family: Source Han Sans CN;
font-weight: 550;
color: #333333;
padding: 7px;
text-align: center;
}
.el_bon {
display: flex;
justify-content: center;
background-color: whitesmoke;
padding: 10px 27px 10px 27px;
img {
width: 151px;
height: 180px;
}
}
.el-row {
margin-bottom: 20px;
}
.el-row:last-child {
margin-bottom: 0;
}
.el-col {
border-radius: 4px;
font-size: 14px;
font-family: Source Han Sans CN;
font-weight: 500;
}
.grid-content {
border-radius: 4px;
min-height: 36px;
}
}
</style>

@ -1,67 +1,35 @@
<template>
<div class="login">
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">若依后台管理系统</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
size="large"
auto-complete="off"
placeholder="账号"
>
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
size="large"
auto-complete="off"
placeholder="密码"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-input
v-model="loginForm.code"
size="large"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
<div class="login" v-loading="loading">
<div class="login-main">
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">数字营销</h3>
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码" @keyup.enter="handleLogin" show-password>
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin: 0px 0px 25px 0px">记住密码</el-checkbox>
<el-form-item style="width: 100%">
<el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
<span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span>
</el-button>
<div style="float: right" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
</div>
</el-form-item>
</el-form>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;">
<el-button
:loading="loading"
size="large"
type="primary"
style="width:100%;"
@click.prevent="handleLogin"
>
<span v-if="!loading">登 录</span>
<span v-else>登 录 中...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
<!-- 底部 -->
<div class="el-login-footer" style="display: none">
<span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>
</div>
</el-form-item>
</el-form>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>
</div>
</div>
</template>
<script setup>
@ -76,8 +44,8 @@ const router = useRouter();
const { proxy } = getCurrentInstance();
const loginForm = ref({
username: "admin",
password: "admin123",
username: "",
password: "",
rememberMe: false,
code: "",
uuid: ""
@ -102,8 +70,8 @@ watch(route, (newRoute) => {
}, { immediate: true });
function handleLogin() {
proxy.$refs.loginRef.validate(valid => {
if (valid) {
// proxy.$refs.loginRef.validate(valid => {
// if (valid) {
loading.value = true;
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
if (loginForm.value.rememberMe) {
@ -116,29 +84,39 @@ function handleLogin() {
Cookies.remove("password");
Cookies.remove("rememberMe");
}
// 调用action的登录方法
userStore.login(loginForm.value).then(() => {
router.push({ path: redirect.value || "/" });
}).catch(() => {
loading.value = false;
// 重新获取验证码
if (captchaEnabled.value) {
getCode();
}
});
}
});
//登录
const params = {
username: loginForm.value.username,
password: loginForm.value.password !== '' ? encrypt(loginForm.value.password) : loginForm.value.password,
token: loginForm.value.TOKEN,
};
userStore
.login(params)
.then(res => {
router.push({ path: redirect.value || '/index' });
if (params.token) {
setTimeout(() => {
loading.value = false;
}, 3000);
} else {
loading.value = false;
}
}).catch(() => {
loading.value = false;
});
// }
// });
}
function getCode() {
getCodeImg().then(res => {
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
if (captchaEnabled.value) {
codeUrl.value = "data:image/gif;base64," + res.img;
loginForm.value.uuid = res.uuid;
}
});
}
// function getCode() {
// getCodeImg().then(res => {
// captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
// if (captchaEnabled.value) {
// codeUrl.value = "data:image/gif;base64," + res.img;
// loginForm.value.uuid = res.uuid;
// }
// });
// }
function getCookie() {
const username = Cookies.get("username");
@ -151,70 +129,78 @@ function getCookie() {
};
}
getCode();
// getCode();
getCookie();
</script>
<style lang='scss' scoped>
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background-image: url("../assets/images/login-background.jpg");
background-size: cover;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
color: #707070;
}
.login-form {
border-radius: 6px;
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
.el-input {
height: 40px;
input {
height: 40px;
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background-image: url('@/assets/images/login-background.0dded3b4.webp');
background-size: 100% 100%;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
color: rgb(48, 50, 52);
font-size: 22px;
font-weight: 500;
}
.login-main {
width: 85%;
height: 100%;
display: flex;
align-items: center;
justify-content: end;
}
.login-form {
border-radius: 6px;
background: #ffffff;
width: 400px;
padding: 55px 25px 33px 25px;
.el-input {
height: 40px;
input {
height: 40px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 0px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 40px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
color: #fff;
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 40px;
padding-left: 12px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 0px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 40px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
color: #fff;
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 40px;
padding-left: 12px;
}
</style>

Loading…
Cancel
Save