Compare commits

...

15 Commits
master ... znjj

  1. 4
      .env.development
  2. 10
      .env.production
  3. 2
      .env.staging
  4. 2
      package.json
  5. 2
      src/api/login.js
  6. 117
      src/api/school.js
  7. 4
      src/store/modules/permission.js
  8. 15
      src/store/modules/user.js
  9. 257
      src/views/index.vue
  10. 6
      src/views/login.vue
  11. 2
      src/views/register.vue
  12. 4
      vue.config.js

4
.env.development

@ -1,10 +1,10 @@
# 页面标题
VUE_APP_TITLE = 智能化衣柜
VUE_APP_TITLE = 智能居家数据监护
# 开发环境配置
ENV = 'development'
# 智能化衣柜/开发环境
# 智能居家数据监护/开发环境
VUE_APP_BASE_API = '/dev-api'
VUE_APP_IMG_URL = 'https://test.tall.wiki/commen/'
VUE_APP_API_QZURL = 'https://test.tall.wiki/commen/'

10
.env.production

@ -1,16 +1,16 @@
# 页面标题
VUE_APP_TITLE = 智能化衣柜
VUE_APP_TITLE = 智能居家数据监护
# 生产环境配置
NODE_ENV = 'production'
# 大唐
VUE_APP_BASE_API = '/commen_api/'
VUE_APP_IMG_URL = '/commen_api/'
VUE_APP_API_QZURL = '/commen_api/'
VUE_APP_BASE_API = '/multimodal/'
VUE_APP_IMG_URL = '/multimodal/'
VUE_APP_API_QZURL = '/multimodal/'
# 访问路径
VUE_APP_PUBLIC_PATH = '/commen/'
VUE_APP_PUBLIC_PATH = '/multimodal_yf/safetySys/'

2
.env.staging

@ -1,5 +1,5 @@
# 页面标题
VUE_APP_TITLE = 智能化衣柜
VUE_APP_TITLE = 智能居家数据监护
# 生产环境配置
NODE_ENV = 'production'

2
package.json

@ -1,7 +1,7 @@
{
"name": "ruoyi",
"version": "3.8.9",
"description": "智能化衣柜",
"description": "智能居家数据监护",
"author": "若依",
"license": "MIT",
"scripts": {

2
src/api/login.js

@ -9,7 +9,7 @@ export function login(username, password, code, uuid) {
uuid,
};
return request({
url: "/login",
url: "/app/user/login",
headers: {
isToken: false,
repeatSubmit: false,

117
src/api/school.js

@ -1,115 +1,40 @@
import request from "@/utils/request";
// ------ 教务处学校管理 ------
// 学校列表
export function schoolList(data) {
// 获取设备信息
export function attributes(data) {
return request({
url: "/school/list",
method: "post",
data: data,
});
}
// 新增/修改学校
export function schoolAdd(data) {
return request({
url: "/school/add",
method: "post",
data: data,
});
}
// 新增/修改学校
export function schoolDel(data) {
return request({
url: "/school/del",
method: "post",
data: data,
});
}
// ------ 教务处评审管理 ------
// 评审列表
export function commentList(data) {
return request({
url: "/come/list",
method: "post",
data: data,
});
}
// 评审详情
export function reviewDetails(data) {
return request({
url: "/come/detail",
method: "post",
data: data,
});
}
// ------ 专家评审 ------
// 学校列表
export function expertschoolist(data) {
return request({
url: "/expert/school/list",
method: "post",
data: data,
});
}
// 评审详情
export function expertReviewDetails(data) {
return request({
url: "/expert/comment/list",
method: "post",
data: data,
url: "/app/device/attributes",
method: "get",
params: data,
});
}
// 评审
export function expertReviewAdd(data) {
// 根据项目key查找项目id
export function queryProjectInfoByKey(data) {
return request({
url: "/expert/comment/add",
method: "post",
data: data,
url: "/app/device/queryProjectInfoByKey",
method: "get",
params: data,
});
}
// ------ 分片相关接口 ------
// 校验文件是否已上传
export function register(data) {
// 根据项目id查找设备列表
export function deviceList(data) {
return request({
url: "/mediaUpload/register",
method: "post",
data: data,
});
}
// 校验分片是否已上传
export function checkchunk(data) {
return request({
url: "/mediaUpload/checkchunk",
method: "post",
data: data,
});
}
// 循环上传分片
export function uploadchunk(data) {
return request({
url: "/mediaUpload/uploadchunk",
method: "post",
data: data,
headers: {
"Content-Type": "multipart/form-data",
},
url: "/app/device/list",
method: "get",
params: data,
});
}
// 合并分片
export function mergechunks(data) {
// 下发属性
export function sendAttribute(data) {
return request({
url: "/mediaUpload/mergechunks",
url: "/app/device/sendAttribute",
method: "post",
data: data,
});
}
// 合并后上传文件
export function addFile(data) {
// 下发命令
export function sendCommand(data) {
return request({
url: "/netdisk/file/add",
url: "/app/device/sendCommand",
method: "post",
data: data,
});

4
src/store/modules/permission.js

@ -34,8 +34,8 @@ const permission = {
return new Promise(resolve => {
// 向后端请求路由数据
getRouters().then(res => {
const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data))
const sdata = JSON.parse(JSON.stringify([]))
const rdata = JSON.parse(JSON.stringify([]))
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
const asyncRoutes = filterDynamicRoutes(dynamicRoutes);

15
src/store/modules/user.js

@ -43,8 +43,10 @@ const user = {
const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
console.log('res.data',res.data);
setToken(res.data.token)
commit('SET_TOKEN', res.data.token)
resolve()
}).catch(error => {
reject(error)
@ -56,14 +58,15 @@ const user = {
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
const user = res.user
console.log('获取用户信息',res);
const user = res.data.user
let avatar = user.avatar || ""
if (!isHttp(avatar)) {
avatar = (isEmpty(avatar)) ? defAva : process.env.VUE_APP_BASE_API + avatar
}
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.data.roles)
commit('SET_PERMISSIONS', res.data.permissions)
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}

257
src/views/index.vue

@ -1,86 +1,243 @@
<template>
<div style="padding: 16px">
<!-- <img src="./welcome.5e305008.png" style="" /> -->
<div style="padding: 16px;min-height: calc(100vh - 84px);display: flex; justify-content: center;align-items: center;">
<div class="div-box">
<div class="div-box-title"> 智能居家数据监护 </div>
<div class="div-ul">
<div class="div-li">
<div>
<span>温度</span>{{ deviceInfo.temperature || '-' }}
</div>
<div> <span>湿度</span>{{ deviceInfo.humidity || '-' }}%
</div>
</div>
<!-- ON开启 OFF关闭 -->
<div class="div-li">
<div>
<span>CO</span>{{ deviceInfo.co || '-' }}PPM
</div>
<div>
<span>预警</span>
<el-switch disabled active-value="1" inactive-value="0" v-model="deviceInfo.warning" active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</div>
</div>
</div>
<div class="div-tips"><span>阈值设定</span>{{ getThreshold() }} <i class="el-icon-edit"
style="color: rgb(64, 158, 255);margin-left: 4px;cursor: pointer;" @click="handleSettings"></i></div>
</div>
<!-- 添加或修改公告对话框 -->
<el-dialog title="阈值设定" :visible.sync="open" width="780px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="温度" prop="temperature">
<el-input v-model="form.temperature" placeholder="请输入温度" />
</el-form-item>
<el-form-item label="湿度" prop="humidity">
<el-input v-model="form.humidity" placeholder="请输入湿度" />
</el-form-item>
<el-form-item label="CO" prop="co">
<el-input v-model="form.co" placeholder="请输入CO" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { queryProjectInfoByKey, deviceList, attributes, sendAttribute, sendCommand } from "@/api/school";
export default {
name: "Index",
data() {
return {
deviceId: "", // id
deviceInfo: {
temperature: 0, //
threshold: 0, //
},
open: false,
value2: false,
loading: false,
//
form: {},
//
rules: {
temperature: [
{ required: true, message: "温度不能为空", trigger: "blur" }
],
humidity: [
{ required: true, message: "湿度不能为空", trigger: "blur" }
],
co: [
{ required: true, message: "CO不能为空", trigger: "blur" }
],
},
//
version: "3.8.9",
};
},
created() {
this.getqueryProjectInfoByKey() // keyid
},
methods: {
goTarget(href) {
window.open(href, "_blank");
//
handleSettings() {
this.open = true;
this.form = {
temperature: this.deviceInfo.temperature1, //
humidity: this.deviceInfo.humidity1, // 湿
co: this.deviceInfo.co1, // CO
};
// this.$message.success('');
},
// keyid
getqueryProjectInfoByKey() {
this.loading = true;
queryProjectInfoByKey({
projectKey: "qKStHKKt"
}).then(res => {
this.getDeviceList(res.data.id) // id
});
},
// id
getDeviceList(_id) {
deviceList({
projectId: _id
}).then(res => {
const w2Device = res.rows.find(device => device.deviceName === "S1");
this.deviceId = w2Device.id;
this.getAttributes(this.deviceId); // id
})
},
};
</script>
<style scoped lang="scss">
.home {
blockquote {
padding: 10px 20px;
margin: 0 0 20px;
font-size: 17.5px;
border-left: 5px solid #eee;
// id
getAttributes(_id) {
attributes({
deviceId: _id,
}).then(res => {
this.loading = false;
// deviceInfo
let deviceAttributesList = res.data.deviceAttributesList
//
let temperature = deviceAttributesList.find(row => row.id === 447247444691968)?.attributeValue;
let temperature1 = deviceAttributesList.find(row => row.id === 447247458859777)?.attributeValue;
// 湿湿
let humidity = deviceAttributesList.find(row => row.id === 447247449387520)?.attributeValue;
let humidity1 = deviceAttributesList.find(row => row.id === 447247458859778)?.attributeValue;
// COCO
let co = deviceAttributesList.find(row => row.id === 447247453780224)?.attributeValue;
let co1 = deviceAttributesList.find(row => row.id === 447247458859779)?.attributeValue;
//
let warning = deviceAttributesList.find(row => row.id === 447247458859776)?.attributeValue;
this.deviceInfo = {
temperature: temperature, //
temperature1: temperature1, //
humidity: humidity, // 湿
humidity1: humidity1, // 湿
co: co, // CO
co1: co1, // CO
warning: warning || 0, //
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #eee;
});
},
getThreshold() {
return `温度:${this.deviceInfo.temperature1 || '-'}℃ 湿度:${this.deviceInfo.humidity1 || '-'}% CO:${this.deviceInfo.co1 || '-'}PPM`;
},
/** 下发属性 */
submitForm: function () {
this.$refs["form"].validate(valid => {
if (valid) {
let attributeParams = {
temperature: this.form.temperature, //
humidity: this.form.humidity, // 湿
co: this.form.co, // CO
}
.col-item {
margin-bottom: 20px;
sendAttribute({
"attributeAndValues": [
{
"attributeIdentifier": "tempThreshold",
"attributeValue": this.form.temperature
},
{
"attributeIdentifier": "humiThreshold",
"attributeValue": this.form.humidity
},
{
"attributeIdentifier": "coThreshold",
"attributeValue": this.form.co
}
], // JSON
"deviceId": this.deviceId // id
}).then(response => {
this.getAttributes(this.deviceId); // id
this.$modal.msgSuccess("操作成功");
this.open = false;
ul {
padding: 0;
margin: 0;
});
}
});
},
},
};
</script>
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
color: #676a6c;
overflow-x: hidden;
<style scoped lang="scss">
.div-box {
transform: scale(1.4);
width: 500px;
box-sizing: border-box;
padding: 16px;
border: 1px solid #ccc;
border-radius: 10px;
ul {
list-style-type: none;
.div-box-title {
font-size: 20px;
font-weight: bold;
margin-bottom: 20px;
text-align: center;
border-bottom: 1px solid #ccc;
padding-bottom: 16px;
}
}
h4 {
margin-top: 0px;
.div-ul {
.div-li>div:nth-of-type(1) {
border-right: 1px solid #ccc;
margin-right: 16px;
}
h2 {
margin-top: 10px;
font-size: 26px;
font-weight: 100;
}
.div-li {
font-size: 18px;
display: flex;
justify-content: space-between;
margin-bottom: 12px;
p {
margin-top: 10px;
div {
flex: 1;
align-items: center;
}
b {
font-weight: 700;
span {
color: #666;
}
}
}
.update-log {
ol {
display: block;
list-style-type: decimal;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0;
margin-inline-end: 0;
padding-inline-start: 40px;
}
.div-tips {
font-size: 18px;
line-height: 22px;
display: flex;
align-items: center;
span {
color: #666;
}
}
</style>

6
src/views/login.vue

@ -8,7 +8,7 @@
>
<h3 class="title" style="margin-bottom: 0">
</h3>
<h3 class="title">智能化衣柜</h3>
<h3 class="title">智能居家数据监护</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
@ -81,7 +81,7 @@
</el-form>
<!-- 底部 -->
<div class="el-login-footer">
<div>山西经济管理干部学院教务部</div>
<div>Copyright © 2018-2025 ruoyi.vip All Rights Reserved.</div>
</div>
</div>
@ -139,7 +139,7 @@ export default {
this.captchaEnabled =
res.captchaEnabled === undefined ? true : res.captchaEnabled;
if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.codeUrl = "data:image/gif;base64," + res.data.img;
this.loginForm.uuid = res.uuid;
}
});

2
src/views/register.vue

@ -6,7 +6,7 @@
:rules="registerRules"
class="register-form"
>
<h3 class="title">智能化衣柜</h3>
<h3 class="title">智能居家数据监护</h3>
<el-form-item prop="username">
<el-input
v-model="registerForm.username"

4
vue.config.js

@ -8,7 +8,7 @@ function resolve(dir) {
const CompressionPlugin = require("compression-webpack-plugin");
const name =
process.env.VUE_APP_TITLE || "智能化衣柜"; // 网页标题
process.env.VUE_APP_TITLE || "智能居家数据监护"; // 网页标题
const port = process.env.port || process.env.npm_config_port || 80; // 端口
@ -40,7 +40,7 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `https://test.tall.wiki/commen/`,
target: `http://121.37.81.216/multimodal/`,
changeOrigin: true,
pathRewrite: {
["^" + process.env.VUE_APP_BASE_API]: "",

Loading…
Cancel
Save