Merge pull request '唐润平:添加右下角面板阈值刻度线' (#77) from trp_dev_v2.0 into master
Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/77
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="gas-info-item">
|
<div id="gas-info-item">
|
||||||
<div class="info" ref="container"></div>
|
<div class="point" ref="point">
|
||||||
|
<div class="info" ref="container"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="name">{{ gasInfo.name }}</div>
|
<div class="name">{{ gasInfo.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -85,6 +88,8 @@ onMounted(handleOnMounted);
|
|||||||
function handleOnMounted() {
|
function handleOnMounted() {
|
||||||
e_info = Echarts.init(container.value);
|
e_info = Echarts.init(container.value);
|
||||||
e_info.setOption(option);
|
e_info.setOption(option);
|
||||||
|
// 设置阈值
|
||||||
|
setPoint();
|
||||||
}
|
}
|
||||||
watch(
|
watch(
|
||||||
() => params.gasInfo.value,
|
() => params.gasInfo.value,
|
||||||
@@ -101,13 +106,41 @@ watch(
|
|||||||
e_info.setOption(option);
|
e_info.setOption(option);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 获取阈值dom元素
|
||||||
|
const point = ref(null);
|
||||||
|
//手写js实现阈值的在表盘的刻度的位置
|
||||||
|
function setPoint() {
|
||||||
|
const deg = 360 * (params.gasInfo.point / params.gasInfo.max);
|
||||||
|
point.value.style.transform = `rotate(${deg}deg)`; //旋转指定度数
|
||||||
|
point.value.children[0].style.transform = `rotate(${-deg}deg)`; //注意子元素逆向旋转
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
#gas-info-item {
|
#gas-info-item {
|
||||||
width: 231px;
|
width: 231px;
|
||||||
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
//旋转定位阈值位于的刻度
|
||||||
|
.point {
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
//用伪元素标记阈值
|
||||||
|
.point::after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
height: 22px;
|
||||||
|
width: 4px;
|
||||||
|
background: white;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
.info {
|
.info {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
|
|||||||
30
src/main.js
30
src/main.js
@@ -1,23 +1,23 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from "vue";
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from "pinia";
|
||||||
|
|
||||||
import App from './App.vue'
|
import App from "./App.vue";
|
||||||
import router from './router'
|
import router from "./router";
|
||||||
|
|
||||||
import ElementPlus from 'element-plus'
|
import ElementPlus from "element-plus";
|
||||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
||||||
//导入图标组件
|
//导入图标组件
|
||||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
|
||||||
import 'element-plus/dist/index.css'
|
import "element-plus/dist/index.css";
|
||||||
|
|
||||||
import '@/assets/styles/index.scss'
|
import "@/assets/styles/index.scss";
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App);
|
||||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||||
app.component(key, component)
|
app.component(key, component);
|
||||||
}
|
}
|
||||||
app.use(ElementPlus,{locale: zhCn})
|
app.use(ElementPlus, { locale: zhCn });
|
||||||
app.use(createPinia())
|
app.use(createPinia());
|
||||||
app.use(router)
|
app.use(router);
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount("#app");
|
||||||
|
|||||||
@@ -1,95 +1,112 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="login-box" id="login-box">
|
<div class="login-box" id="login-box">
|
||||||
<el-form
|
<el-form
|
||||||
:model="loginForm"
|
:model="loginForm"
|
||||||
ref="formInstance"
|
ref="formInstance"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
label-width="65px"
|
label-width="65px"
|
||||||
>
|
>
|
||||||
<h3>FateVerse</h3>
|
<h3>FateVerse</h3>
|
||||||
<el-form-item prop="username" label="账号">
|
<el-form-item prop="username" label="账号">
|
||||||
<el-input v-model="loginForm.username" :prefix-icon="User" ></el-input>
|
<el-input v-model="loginForm.username" :prefix-icon="User"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password" label="密码">
|
<el-form-item prop="password" label="密码">
|
||||||
<el-input v-model="loginForm.password" type="password" :prefix-icon="Lock" ></el-input>
|
<el-input
|
||||||
|
v-model="loginForm.password"
|
||||||
|
type="password"
|
||||||
|
:prefix-icon="Lock"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="code" label="验证码" >
|
<el-form-item prop="code" label="验证码">
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<el-input v-model="loginForm.code" :prefix-icon="key" @keyup.enter.native="handleLogin(formInstance)"></el-input>
|
<el-input
|
||||||
<img :src="codeImg" alt="" @click="getCode">
|
v-model="loginForm.code"
|
||||||
|
:prefix-icon="key"
|
||||||
|
@keyup.enter.native="handleLogin(formInstance)"
|
||||||
|
></el-input>
|
||||||
|
<img :src="codeImg" alt="" @click="getCode" />
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="handleLogin(formInstance)" type="primary">登录</el-button>
|
<el-button @click="handleLogin(formInstance)" type="primary"
|
||||||
|
>登录</el-button
|
||||||
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from "vue-router";
|
||||||
import { getCodeImg } from '../../api/login';
|
import { getCodeImg } from "../../api/login";
|
||||||
import { useAuthStore } from '@/store/userstore'
|
import { useAuthStore } from "@/store/userstore";
|
||||||
import { ElLoading } from 'element-plus'
|
import { ElLoading } from "element-plus";
|
||||||
import { User,Lock, Key } from '@element-plus/icons-vue'
|
import { User, Lock, Key } from "@element-plus/icons-vue";
|
||||||
const router = useRouter()
|
const router = useRouter();
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore();
|
||||||
const loginForm = reactive({
|
const loginForm = reactive({
|
||||||
username: 'admin',
|
username: "admin",
|
||||||
password: '123456',
|
password: "123456",
|
||||||
code: '',
|
code: "",
|
||||||
uuid: ''
|
uuid: "",
|
||||||
})
|
});
|
||||||
const codeImg = ref('')
|
const codeImg = ref("");
|
||||||
const formInstance = ref()
|
const formInstance = ref();
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
username: [
|
username: [{ required: true, message: "请输入账户名", trigger: "blur" }],
|
||||||
{ required: true, message: '请输入账户名', trigger: 'blur' },
|
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
||||||
],
|
code: [{ required: true, message: "请输入验证码", trigger: "blur" }],
|
||||||
password: [
|
});
|
||||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
|
||||||
],
|
|
||||||
code: [
|
|
||||||
{ required: true, message: '请输入验证码', trigger: 'blur' },
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
//获取二维码
|
//获取二维码
|
||||||
const getCode = () => {
|
const getCode = () => {
|
||||||
getCodeImg().then(res=>{
|
getCodeImg().then((res) => {
|
||||||
loginForm.uuid = res.data.uuid
|
loginForm.uuid = res.data.uuid;
|
||||||
codeImg.value = 'data:image/gif;base64,' + res.data.img
|
codeImg.value = "data:image/gif;base64," + res.data.img;
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const handleLogin = (instance) => {
|
const handleLogin = (instance) => {
|
||||||
if(!instance) return
|
if (!instance) return;
|
||||||
instance.validate( async (valid, fields)=>{
|
instance.validate(async (valid, fields) => {
|
||||||
if (!valid) return
|
if (!valid) return;
|
||||||
// 发送请求
|
// 发送请求
|
||||||
await authStore.userLogin(loginForm).then(res=>{
|
await authStore.userLogin(loginForm).then((res) => {
|
||||||
if(res) {
|
if (res) {
|
||||||
ElLoading.service({text: '正在加载系统资源',background: '#409eff',lock: true})
|
ElLoading.service({
|
||||||
router.push('/')
|
text: "正在加载系统资源",
|
||||||
}else {
|
background: "#409eff",
|
||||||
getCode()
|
lock: true,
|
||||||
|
});
|
||||||
|
router.push("/");
|
||||||
|
} else {
|
||||||
|
getCode();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
getCode()
|
getCode();
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
ElLoading.service({text: '正在加载系统资源',background: '#409eff',lock: true}).close()
|
ElLoading.service({
|
||||||
})
|
text: "正在加载系统资源",
|
||||||
|
background: "#409eff",
|
||||||
|
lock: true,
|
||||||
|
}).close();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.login-box {
|
.login-box {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: #4158D0;
|
background-color: #4158d0;
|
||||||
background-image: linear-gradient(43deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%);
|
background-image: linear-gradient(
|
||||||
|
43deg,
|
||||||
|
#4158d0 0%,
|
||||||
|
#c850c0 46%,
|
||||||
|
#ffcc70 100%
|
||||||
|
);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user