This commit is contained in:
2024-11-27 23:22:08 +08:00
commit 28c518b355
108 changed files with 30312 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}
+15
View File
@@ -0,0 +1,15 @@
export default [
// 获取天气情况
{
method: 'get',
url: '/getWeather',
data: {
code: 200,
message: 'success',
data: {
weather: '小雨转多云',
temperature: '13℃~18℃'
}
}
}
]
+25
View File
@@ -0,0 +1,25 @@
const Mock = require('mockjs')
// 遍历所有mock文件
const files = require.context('.', true, /\.js$/)
let mockList = files.keys()
.filter(key =>
key !== './index.js' && files(key).default
)
.map(key =>
files(key).default
);
// 开始注册所有mock服务
for (let list of mockList) { //遍历所有模块
// 遍历模块中的所有api
for (let item of list) {
// 注入mock
Mock.mock(
'/api' + item.url,
item.data
)
}
}
+20270
View File
File diff suppressed because it is too large Load Diff
+51
View File
@@ -0,0 +1,51 @@
{
"name": "bigscreen",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^1.4.0",
"core-js": "^3.8.3",
"dayjs": "^1.11.8",
"echarts": "^5.4.2",
"element-ui": "^2.15.13",
"mockjs": "^1.1.0",
"vue": "^2.6.14",
"vue-baidu-map": "^0.21.22"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"less": "^4.1.3",
"less-loader": "^11.1.3",
"vue-template-compiler": "^2.6.14"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "@babel/eslint-parser"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+38
View File
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
<style>
* {
margin: 0;
}
html,
body {
height: 100%;
}
</style>
<script>
//fontsize计算 1rem=16px
document.documentElement.style.fontSize = document.documentElement.clientWidth / 1920 * 16 + 'px'
</script>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
+589
View File
@@ -0,0 +1,589 @@
<template>
<div id="app">
<div class="container">
<div class="content-top">
<span class="title">硅藻识别系统</span>
<div class="time-box">
<div id="time">{{ nowTime }}</div>
<div class="line-box line-box1"></div>
</div>
<div class="weather-box">
<div class="line-box line-box2"></div>
<div id="weather">
{{ weatherObj.weather }}&nbsp;&nbsp;&nbsp;{{
weatherObj.temperature
}}
</div>
</div>
</div>
<div class="content-bottom">
<div class="content-left">
<section class="section-box roadDistribute-box">
<!-- <div class="content-bodyhead">
<div style="color: rgb(179, 179, 200); font-size: 18px;text-align: center;padding: 10px;">诊断信息输入</div>
死者姓名<input type="text" placeholder="在这里输入文本">
<br>性别<input type="text" placeholder="在这里输入文本">
<br>法医鉴定<input type="text" placeholder="在这里输入文本">
<br>送检材料<input type="text" placeholder="在这里输入文本">
<br><label>
<input type="checkbox" name="option1" value="Option 1"> 小环藻属
</label>
<label>
<input type="checkbox" name="option2" value="Option 2"> 直链藻属
</label>
<label>
<input type="checkbox" name="option3" value="Option 3"> 菱形藻属
</label>
</div> -->
<div class="title center" >源文件上传</div>
<div class="content-body">
<div class="distribute-textBox">
<div style="display: flex;justify-content: center; align-items: center; ">
<!-- <img src="./assets/image/gdut.jpg" alt="" > -->
<div class="imagebox" >
<el-upload
class="avatar-uploader"
action= http://192.168.161.130:80/api/upload
:show-file-list="false"
:on-success="handleAvatarSuccess">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
<el-button size="small" class="btn" type="btn-primary">点击上传</el-button>
</el-upload>
</div>
</div>
<div class="table">
<div class="title center" >检测结果</div>
<thead>
<tr>
<td align="center" style="width:200px;">类别</td>
<td align="center" style="width:200px;">概率</td>
</tr>
</thead>
<tbody>
<tr v-for="item in tableData" :key="item">
<td align="center">{{item.class}}</td>
<td align="center">{{item.score}}</td>
</tr>
</tbody>
</div>
</div>
</div>
</section>
</div>
<div class="content-middle">
<div class="image-box">
<img :src="resultUrl" id="100"
alt="">
</div>
<div class="btnArea">
<button type="btn-primary"
@click="deleteImg"
class="btn">删除</button>
<button type="btn-primary"
@click="getResult"
class="btn">获取结果</button>
</div>
</div>
<div class="content-right">
<!-- <div class="section-box eventStatistics-box">
<img src="./assets/image/logo.png"
alt="">
</div> -->
<div class="title">我国主要水藻图例</div>
<div class="content">
<div class="row">
<div class="column">
<img src="./assets/image/a.png" alt="">
<br>小环藻属
</div>
<div class="column">
<img src="./assets/image/b.png" alt="">
<br>直链藻属
</div>
</div>
<div class="row">
<div class="column">
<img src="./assets/image/c.png" alt="">
<br>菱形藻属
</div>
<div class="column">
<img src="./assets/image/d.png" alt="">
<br>卵形藻属
</div>
</div>
<div class="row">
<div class="column">
<img src="./assets/image/e.png" alt="">
<br>桥弯藻属
</div>
<div class="column">
<img src="./assets/image/f.png" alt="">
<br>异形藻属
</div>
</div>
<div class="row">
<div class="column">
<img src="./assets/image/g.png" alt="">
<br>针杆藻属
</div>
<div class="column">
<img src="./assets/image/h.png" alt="">
<br>舟形藻属
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import dayjs from "dayjs";
import {
getWeather
} from "@/api/bigScreen-api";
import nodata from"./assets/image/no-data.png";
import axios from 'axios'
export default {
name: "App",
components: {},
data () {
return {
timer: null,
// baseUrL:'http://192.168.161.130/',
baseUrL:'http://192.168.161.130:80/',
nowTime: dayjs(new Date()).format("YYYY-MM-DD HH:mm"),
weatherObj: {},
resultClass:"",
resultScore:"",
imageUrl: 'http://192.168.161.130:80/assets/gdut.jpg',
processIdNow:1,
resultUrl:nodata,
// tableData: [{
// class :'异极藻(Gomphonema',
// score :'0.8269811',
// },
// {
// class :'异极藻(Gomphonema',
// score :'0.8269811',
// },
// {
// class :'舟形藻(Navicula',
// score :'0.54520714',
// },
// ]
tableData:[]
};
},
mounted () {
this.init();
},
methods: {
init () {
this.getNowTime(); // 获取当前时间
this.getWeather(); // 获取天气
},
// 获取当前时间
getNowTime () {
clearInterval(this.timer);
this.timer = setInterval(() => {
this.nowTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm");
}, 1000 * 30);
},
// 获取天气
getWeather () {
getWeather().then((res) => {
if (res.code == 200) {
this.weatherObj = res.data;
}
});
},
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
//获取图片id
this.processIdNow = res.data;
},
deleteImg () {
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.delete(this.baseUrL+`api/delete/${this.processIdNow}`).then((res)=>{
if(res.data.code==0){
this.$message.success('删除成功')
}
else{
this.$message.error('删除失败')
}
})
.catch(() => {
this.$message.error('删除失败')
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
getResult(){
axios.get(this.baseUrL+`api/predict/${this.processIdNow}`).then((res)=>{
if(res.data.code ==0){
this.response_=res.data.data;
console.log(res.data);
console.log(this.response_[0])
document.getElementById('100').src = this.response_[0];
var result_class_degree = JSON.parse(this.response_[1]);
// console.log(result_class_degree)
// this.resultClass=result_class_degree[0].class;
// this.resultScore=result_class_degree[0].score;
this.tableData=[]
for (var i = 0; i < result_class_degree.length; i++) {
var rowData = result_class_degree[i];
this.tableData.push({
class: rowData.class,
score: rowData.score
})
}
}
else{
this.$message.error('失败')
}
}).catch(() => {
this.$message.error('文件已删除或未上传文件')
});
},
deactivated () {
clearInterval(this.timer);
},
beforeDestroy () {
clearInterval(this.timer);
},
}
};
</script>
<style lang="less" scoped>
#app {
height: 100%;
}
/* 布局相关 start */
.container {
height: 100%;
background-image: url("~@/assets/image/background.png");
background-size: cover;
}
.content-title {
height: 2rem;
display: flex;
align-items: center;
font-size: 1.2rem;
font-weight: bolder;
color: #0166e2;
img {
margin-right: 5px;
}
}
.content-body {
height: calc(100% - 12.2rem);
margin-top: 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.content-bodyhead{
text-align:left;
border:solid rgb(118, 103, 118);
padding: 10px;
color: #8c939d;
}
.content-bodyhead text{
padding: 4px 0;
}
.section-box {
box-sizing: border-box;
padding: 1rem;
border: 2px solid #ffffff;
}
.content-bottom {
display: flex;
flex-wrap: nowrap;
position: relative;
height: calc(100% - 7rem);
margin-top: -1rem;
padding: 0 1rem 1rem 1rem;
}
.content-bottom .title {
font-size: 24px;
font-weight: bold;
background-color: #2e325a;
color: #c4c6c9;
bottom: 10px;
}
.center{
display: flex;
align-content: center;
justify-content: center;
}
.content-left {
width: 27%;
margin-right: 1rem;
}
.content-middle {
width: 46%;
margin-right: 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.content-right {
width: 27%;
text-align: center;
// border-style:solid;
border-color:#cfc5c5;
background: rgba(255, 255, 255, 0.2); /* 使用半透明白色作为背景颜色 */
backdrop-filter: blur(10px); /* 使用模糊滤镜来创建磨砂玻璃效果 */
}
//右边盒子的布局
.content-right .title {
font-size: 24px;
font-weight: bold;
background-color: #2e325a;
color: #c4c6c9;
bottom: 10px;
}
.content {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.row {
display: flex;
flex-wrap: nowrap;
margin: 10px 0 0 0;
}
.column {
flex: 1;
border: 2px solid #ccc;
padding: 10px;
margin: 0 5px;
overflow: hidden;
color:#c4c6c9;
background-color: #16388e;
// max-height: 100%; /* 限制行的最大高度 */
}
.column img {
max-width: 66%; /* 图片的最大宽度为列的宽度 */
height: auto; /* 保持图片的纵横比 */
}
/* 布局相关 end */
/* header start */
.content-top {
position: relative;
height: 7rem;
text-align: center;
font-style: italic;
font-weight: bolder;
background: url("@/assets/image/background-top.jpg") no-repeat center;
background-size: 100% 100%;
background-position-y: -0.6875rem;
color: rgb(194, 193, 194);
.title {
line-height: 5rem;
font-size: 2rem;
letter-spacing: 2px;
}
.time-box {
position: absolute;
left: 5rem;
top: 0.5rem;
display: flex;
height: 30%;
font-size: 1.0625rem;
}
#time,
#weather {
padding: 0.5rem 1.2rem 0 1.2rem;
border-top: 2px solid #0166e2;
letter-spacing: 1px;
}
.weather-box {
position: absolute;
right: 5rem;
top: 0.5rem;
display: flex;
height: 30%;
font-size: 1.2rem;
}
.line-box {
width: 3rem;
height: 30%;
border-top: 2px solid #0166e2;
}
.line-box1 {
margin-left: 1rem;
}
.line-box2 {
margin-right: 1rem;
}
}
/* header end */
.roadDistribute-box {
height: 100%;
.distribute-textBox {
height: 40%;
padding: 1rem;
line-height: 3.2rem;
letter-spacing: 1px;
font-size: 1.5rem;
color: #ffffff;
}
}
.imagebox {
display: flex;
justify-content: center; //弹性盒子对象在主轴上的对齐方式
align-items: center; //定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式。
box-sizing: border-box;
border-color: #ffffff;
background: url("@/assets/image/background-map.png") no-repeat center;
position:relative
}
.imagebox img {
width: 300px;
height: 300px;
border: 1px solid #fff;
background-color: #fff;
}
.image-box {
display: flex;
justify-content: center; //弹性盒子对象在主轴上的对齐方式
align-items: center; //定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式。
box-sizing: border-box;
background-size: 100% 100%;
background: url("@/assets/image/background-map.png") no-repeat center;
}
.image-box img {
width: 87%;
height: 87%;
background-color: #fff;
}
.eventStatistics-box {
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.eventStatistics-box img {
width: 100%;
height: 50%;
background-color: #fff;
}
.btnArea {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
height: 10%;
}
.btn {
background-image: linear-gradient(to bottom right, #196cd8, #3c85c0, #63a6e4);
overflow: hidden;
font-size: 20px;
width: 60%;
height: 80%;
color: #ffffff;
border: 0 solid #fff;
opacity: 0.8;
margin: 0 2px;
border-radius: 20px;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
.above_txt{
position:absolute;top:108px;left:108px;
}
.table{
margin-top :2rem;
line-height: 2rem;
letter-spacing: 0px;
font-size:1.3rem;
}
.table .title{
margin-top :2rem;
letter-spacing: 0px;
font-size:1.5rem;
margin-bottom: 1rem;
}
</style>
+10
View File
@@ -0,0 +1,10 @@
import request from '@/utils/request'
// 获取天气情况
export function getWeather (param) {
return request({
url: '/getWeather',
method: 'get',
params: param
})
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

+14
View File
@@ -0,0 +1,14 @@
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
import '../mock/index'
new Vue({
render: h => h(App),
}).$mount('#app')
+89
View File
@@ -0,0 +1,89 @@
import axios from 'axios'
import { Notification } from 'element-ui'
// 创建axios实例
const service = axios.create({
baseURL: '/api',
timeout: 80000, // 请求超时时间
withCredentials: true,
// crossDomain: true
})
// request拦截器
service.interceptors.request.use(
config => {
// if (getToken()) {
// config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
// }
var lang = localStorage.getItem('lang')//因为项目中使用到了i18n国际化语言配置,请根据实际情况自行修改
if (!lang) {
lang = 'zh_CN'
}
config.headers['Accept-Language'] = lang.replace(/_/g, '-')
config.headers['Content-Type'] = 'application/json'
return config
},
error => {
Promise.reject(error)
}
)
// response 拦截器
service.interceptors.response.use(
response => {
return response.data
},
error => {
// 兼容blob下载出错json提示
if (error.response.data instanceof Blob && error.response.data.type.toLowerCase().indexOf('json') !== -1) {
const reader = new FileReader()
reader.readAsText(error.response.data, 'utf-8')
reader.onload = function () {
const errorMsg = JSON.parse(reader.result).message
Notification.error({
title: errorMsg,
duration: 5000
})
}
} else {
let code = 0
try {
code = error.response.data.status
} catch (e) {
if (error.toString().indexOf('Error: timeout') !== -1) {
Notification.error({
title: '网络请求超时',
duration: 5000
})
return Promise.reject(error)
}
}
if (code) {
// if (code === 401) {
// store.dispatch('LogOut').then(() => {
// // 用户登录界面提示
// Cookies.set('point', 401)
// location.reload()
// })
// } else if (code === 403) {
// router.push({ path: '/401' })
// } else {
// const errorMsg = error.response.data.message
// if (errorMsg !== undefined) {
// Notification.error({
// title: errorMsg,
// duration: 0
// })
// }
// }
} else {
Notification.error({
title: '接口请求失败',
duration: 5000
})
}
}
return Promise.reject(error)
}
)
export default service
+16
View File
@@ -0,0 +1,16 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
devServer: {
open: true, // 运行后自动打开浏览器
port: 8080,
// proxy: {
// '/api': {
// target: 'http://192.168.1.102:8088',
// ws: false,
// changeOrigin: true,
// logLevel: 'debug'
// }
// }
},
})