添加了小程序跳转所需的需要改页

pull/10/head
孙萌 2023-10-08 15:35:13 +08:00
parent fdd43c9bdd
commit 74cc6c6f64
7 changed files with 70 additions and 44 deletions

View File

@ -43,7 +43,12 @@ input::-webkit-inner-spin-button {
-webkit-appearance: none !important; -webkit-appearance: none !important;
margin: 0; margin: 0;
} }
#app{
min-width: 1290px;
min-height: 900px;
width: 100vw;
height: 100vh;
}
@font-face { @font-face {
font-family: Oswald; font-family: Oswald;
src: url(./assets/ttf/Oswald-Medium.ttf); src: url(./assets/ttf/Oswald-Medium.ttf);

View File

@ -112,4 +112,8 @@ export default {
getGethls(data){ getGethls(data){
return sendGetRequest("/camera/gethls",data); return sendGetRequest("/camera/gethls",data);
}, },
//根据ID查询用户信息
getUser(data){
return sendGetRequest('/api/sel/user',data)
},
}; };

View File

@ -203,8 +203,8 @@
} }
.index { .index {
width: 100vw; width: 100%;
height: 100vh; height: 100%;
min-height: 900px; min-height: 900px;
overflow: auto; overflow: auto;
background: url(../image/index-background.png) no-repeat; background: url(../image/index-background.png) no-repeat;
@ -377,11 +377,13 @@
height: 100%; height: 100%;
background: rgba(0, 29, 68, 0.25); background: rgba(0, 29, 68, 0.25);
border-right: 2px solid rgba(0, 180, 255, 0.25); border-right: 2px solid rgba(0, 180, 255, 0.25);
overflow: auto;
} }
.index .index-content .right { .index .index-content .right {
width: calc(100% - 240px); width: calc(100% - 240px);
height: 100%; height: 100%;
overflow: auto;
} }
.input-view { .input-view {

File diff suppressed because one or more lines are too long

View File

@ -217,14 +217,13 @@
} }
.index { .index {
width: 100vw; width: 100%;
height: 100vh; height: 100%;
min-height: 900px; min-height: 900px;
overflow: auto; overflow: auto;
background: url(../image/index-background.png) no-repeat; background: url(../image/index-background.png) no-repeat;
background-size: 1920px 1080px; background-size: 1920px 1080px;
background-position: center top; background-position: center top;
.no-list { .no-list {
color: #fff; color: #fff;
display: flex; display: flex;
@ -392,12 +391,13 @@
background: rgba(0, 29, 68, 0.25); background: rgba(0, 29, 68, 0.25);
border-right: 2px solid rgba(0, 180, 255, 0.25); border-right: 2px solid rgba(0, 180, 255, 0.25);
overflow: auto;
} }
.right { .right {
width: calc(100% - 240px); width: calc(100% - 240px);
height: 100%; height: 100%;
overflow: auto;
} }
} }
} }

View File

@ -104,8 +104,8 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.home { .home {
width: 100vw; width: 100%;
height: 100vh; height: 100%;
min-height: 900px; min-height: 900px;
overflow: auto; overflow: auto;
background: url(../assets/image/background.jpg) no-repeat; background: url(../assets/image/background.jpg) no-repeat;

View File

@ -2,7 +2,7 @@
<div class="index"> <div class="index">
<div class="header"> <div class="header">
<div class="header-left"> <div class="header-left">
<img src="../assets/image/logo.png" alt=""> <img src="../assets/image/logo.png" alt="">
</div> </div>
<div class="header-center"> <div class="header-center">
<div @click="toRouter(item)" :class="item.routerList.indexOf(routerNow) != -1 ? 'active' : ''" <div @click="toRouter(item)" :class="item.routerList.indexOf(routerNow) != -1 ? 'active' : ''"
@ -73,12 +73,12 @@ export default {
{ name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, }, { name: '首页', img: require('../assets/image/index-icon.png'), list: [], router: 'realTime', isRouter: true, },
{ name: '一号温室', img: require('../assets/image/left-img0.png'), list: [] }, { name: '一号温室', img: require('../assets/image/left-img0.png'), list: [] },
{ name: '二号温室', img: require('../assets/image/left-img1.png'), list: [] }, { name: '二号温室', img: require('../assets/image/left-img1.png'), list: [] },
{ name: '施肥机', routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet','realTime'], img: require('../assets/image/left-img2.png'), list: [] },], { name: '施肥机', routerList: ['formula', 'irrigateSet', 'PIDSet', 'systemSet', 'upload', 'sensorSet', 'realTime'], img: require('../assets/image/left-img2.png'), list: [] },],
routerNow: 'realTime', routerNow: 'realTime',
routerIndex: 1, routerIndex: 1,
equipmentList: [], equipmentList: [],
userInfo: null, userInfo: null,
loading:true,// loading: true,//
} }
}, },
watch: { watch: {
@ -88,50 +88,65 @@ export default {
}, },
mounted() { mounted() {
this.getTime() this.getTime()
if (localStorage.getItem('token')) { var router = this.$route.query
this.userInfo = JSON.parse(localStorage.getItem('userInfo')) if (router.token && router.userid) {
localStorage.setItem('token', router.token)
this.api.getUser({ userId: router.userid }).then(res => {
var data=res.data.data
data.userid=router.userid
localStorage.setItem('userInfo', JSON.stringify(data))
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
this.gerRouter();
this.getEqbyid()
})
return
} else {
if (localStorage.getItem('token')) {
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
}
this.gerRouter();
this.getEqbyid()
} }
this.gerRouter();
this.getEqbyid()
}, },
methods: { methods: {
/// ///
getByid(){ getByid() {
var store=this.$store.state var store = this.$store.state
var data = { var data = {
deviceId:store.equipmentList[store.equipmentIndex-1].deviceId, deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
}; };
this.api.getByid(data).then((res) => { this.api.getByid(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
store.equipmentName=res.data.data store.equipmentName = res.data.data
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
this.loading=false this.loading = false
}); });
}, },
// //
getEqbyid() { getEqbyid() {
var userInfo = JSON.parse(localStorage.getItem('userInfo')) var userInfo = JSON.parse(localStorage.getItem('userInfo'))
this.api.getEqbyid(userInfo.userid).then((res) => { this.api.getEqbyid(userInfo.userid).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$store.state.equipmentList = res.data.data.map((item,index) => { this.$store.state.equipmentList = res.data.data.map((item, index) => {
return { return {
...item, ...item,
router: 'formula', router: 'formula',
index: index+1, index: index + 1,
}; };
}); });
this.leftList.forEach((el, index) => { this.leftList.forEach((el, index) => {
if (el.name == '施肥机') { if (el.name == '施肥机') {
this.leftList[index].list = this.$store.state.equipmentList this.leftList[index].list = this.$store.state.equipmentList
} }
}) })
this.getByid() this.getByid()
} }
}) })
}, },
@ -163,9 +178,9 @@ export default {
if (item.http) { if (item.http) {
window.location.href = item.http; window.location.href = item.http;
} else if (item.router == 'formula' && this.$route.query.index != item.index) { } else if (item.router == 'formula' && this.$route.query.index != item.index) {
this.$store.state.equipmentIndex=item.index this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/${item.router}?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/${item.router}?index=${item.index ? item.index : 1}` })
} else if (item.router != this.routerNow && !item.http) { } else if (item.router != this.routerNow && !item.http) {
this.$router.push({ name: item.router }) this.$router.push({ name: item.router })
} }
@ -178,13 +193,13 @@ export default {
if (item.http) { if (item.http) {
window.location.href = item.http; window.location.href = item.http;
} else if (item.router == 'formula' && this.$route.query.index != item.index) { } else if (item.router == 'formula' && this.$route.query.index != item.index) {
if(this.routerNow=='realTime'){ if (this.routerNow == 'realTime') {
this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/realTime?index=${item.index ? item.index : 1}` })
}else{ } else {
this.$store.state.equipmentIndex=item.index this.$store.state.equipmentIndex = item.index
this.$router.push({ path: `/formula?index=${item.index ? item.index : 1}` }) this.$router.push({ path: `/formula?index=${item.index ? item.index : 1}` })
} }
} else if (item.router != this.routerNow && !item.http) { } else if (item.router != this.routerNow && !item.http) {
this.$router.push({ name: item.router }) this.$router.push({ name: item.router })
} }