增加首页,首页加跳转

feasure
lld 2026-02-18 02:08:46 +08:00
parent 649b7482d0
commit 015ce8616f
5 changed files with 92 additions and 38 deletions

View File

@ -256,6 +256,7 @@ export default {
</script>
<style lang="scss">
//
@import './tuniao-ui/index.scss';
@import './tuniao-ui/iconfont.css';
@import '@/static/scss/index.scss';

View File

@ -121,11 +121,6 @@
"iconPath": "static/images/tabbar/news.png",
"selectedIconPath": "static/images/tabbar/news_.png",
"text": "消息中心"
},{
"pagePath": "pages/control/index",
"iconPath": "static/images/tabbar/news.png",
"selectedIconPath": "static/images/tabbar/news_.png",
"text": "消息中心"
},
{
"pagePath": "pages/mine/index",

View File

@ -1,15 +1,16 @@
<template>
<view class="container">
<z-paging ref="paging" refresher-only class="z-paging-container" :show-empty="false" :show-footer="false" @onRefresh="refresh">
<z-paging ref="paging" refresher-only bg-color="var(--gradualCyanLight)" :show-empty="false" :show-footer="false" @onRefresh="refresh">
<template #refresher="{refresherStatus}">
<!-- 此处的custom-refresh为demo中自定义的组件非z-paging的内置组件请在实际项目中自行创建这里插入什么view下拉刷新就显示什么view -->
<custom-refresher :status="refresherStatus" />
</template>
<uni-section title="请选择大棚:" :subTitle="imei" titleFontSize="18px" type="line">
<view class="uni-px-5 uni-pb-5">
<uni-data-select v-model="value" :localdata="range" @change="change"></uni-data-select>
</view>
<view class="card shadow shadow-lg bg-white ">
<uni-section :title="`当前大棚:【${selectedText}】`" :subTitle="imei" titleFontSize="20px" type="line" >
<!-- <view class="uni-px-5 uni-pb-5">-->
<!-- <uni-data-select v-model="value" :localdata="range" @change="change"></uni-data-select>-->
<!-- </view>-->
</uni-section>
<uni-section title="实时温湿度" titleFontSize="16px" type="line" v-if="value!== 1">
@ -87,8 +88,7 @@
</view>
</view>
</uni-section>
</view>
<uni-popup ref="inputNamelog" mode="center" >
<!-- 新增修改运行时间的弹窗 -->
@ -183,7 +183,7 @@ export default {
// hide: false
showStatusText: false,
control: '正在加载中...',
range: [],
// range: [],
agriId:'',
imei:'',
publishTopic: '/control',
@ -278,7 +278,15 @@ export default {
newLimitTime: 0, //
};
},
onLoad() {
onLoad(option) {
if (option.agriInfo) {
const agriInfo = JSON.parse(option.agriInfo); //
this.value = agriInfo.imei;
this.selectedText = agriInfo.agriName;
this.agriId = agriInfo.agriId;
this.change(this.value)
}
this.title="";
// [k, g]
const mutexPairs = [
@ -296,7 +304,7 @@ export default {
});
},
onShow() {
this.getAgriList();
// this.getAgriList();
// MQTT
mqttUtil.setOnMessageCallback(this.ackMessage);
//
@ -309,7 +317,7 @@ export default {
},
methods: {
refresh() {
this.getAgriList()
// this.getAgriList()
this.change(this.imei)
mqttUtil.setOnMessageCallback(this.ackMessage);
this.$refs.paging.complete();
@ -332,11 +340,11 @@ export default {
this.getNewSpecialData(e);
this.mqttConfig.subscribeTopic = `frontend/${clientId}/dtu/862538065276061`;
}
const selectedItem = this.range.find(item => item.value === e);
if (selectedItem) {
this.selectedText = selectedItem.text; //
this.agriId = selectedItem.agriId;
this.title= this.selectedText;
// const selectedItem = this.range.find(item => item.value === e);
// if (selectedItem) {
// this.selectedText = selectedItem.text; //
// this.agriId = selectedItem.agriId;
// this.title= this.selectedText;
if (e !== 'A' && e!=='B' && e!=='C') {
// 使MQTT
this.publishTopic = `frontend/${clientId}${MQTT_TOPIC_SUFFIX.DOWN}/${this.imei}`;
@ -361,12 +369,12 @@ export default {
this.publishMessage()
}
}
} else {
this.selectedText = ''; //
this.title='';
this.value=1;
this.agriId = '';
}
// } else {
// this.selectedText = ''; //
// this.title='';
// this.value=1;
// this.agriId = '';
// }
this.reset();
this.style="";
},
@ -547,10 +555,7 @@ export default {
},
publishMessage() {
if (!this.connected || !this.publishTopic || !this.message) {
uni.showToast({
title: '控制异常',
icon: 'none'
})
return
}
@ -1100,4 +1105,10 @@ export default {
/deep/ .is-input-border {
width: 340rpx;
}
.card {
border-radius: 20rpx;
background: pink;
overflow: hidden;
}
</style>

View File

@ -44,12 +44,12 @@
>
<view class="item-title">
<view class="title-text">{{ item.agriName }}</view>
<text :class="['tag','tag-status',{'tag-manual':item.workMode==='手动模式'}]" v-if="item.workMode">{{ item.workMode }}</text>
<text :class="['tag','tag-status',{'tag-manual':item.workModeDesc==='手动模式'}]" v-if="item.workModeDesc">{{ item.workModeDesc }}</text>
<text :class="['tag','tag-online',{'tag-offline':item.online==='离线'}]" v-if="item.online">{{ item.online }}</text>
</view>
<view class="item-subtitle">
{{ item.imei }}
设备编号{{ item.imei }}
</view>
<view class="item-tags">
@ -165,6 +165,7 @@ export default {
getScanCode(res){
this.searchValue = res;
this.value = 1;
this.input(this.searchValue)
},
handleAddAgri() {
this.$refs.addAgri.open();
@ -225,8 +226,9 @@ export default {
deviceStatus: TimeUtil.isLessThanSpecifiedSeconds(item.time, 90) ? '在线' : '离线',
online: TimeUtil.isLessThanSpecifiedSeconds(item.time, 90) ? '在线' : '离线', // online
agriName: item.agriName || '未知大棚',
imei: `设备编号:${item.imei || '未知'}`,
workMode: item.workMode === 0 ? '手动模式' : '自动模式',
imei: `${item.imei || '未知'}`,
workModeDesc: item.workMode === 0? '手动模式':'自动模式',
workMode: item.workMode,
temp1: item.temp1,
temp2: item.temp2,
temp3: item.temp3,
@ -264,7 +266,9 @@ export default {
title: `点击了:${item.agriName}`,
icon: 'none'
})
this.$tab.navigateTo('/pages/mine/require/index')
console.info(item)
var agri = JSON.stringify(item);
this.$tab.navigateTo('/pages/control/index?agriInfo='+encodeURIComponent(agri))
},
getNewSpecialData() {
getNewSpecialData().then(response => {

View File

@ -31,7 +31,17 @@
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
</view>
</view>
<view class="login-page" v-if="false">
<!-- 授权登录按钮 -->
<view class="submit-btn" @tap.stop="openAuthorizationModal">
授权登录
</view>
<wx-user-info-modal
v-model="showAuthorizationModal"
@updated="updatedUserInfoEvent"
></wx-user-info-modal>
</view>
<!-- ========== 新增uni-data-checkbox 记住密码可正常勾选 ========== -->
<view style="margin: 10px 0 0 10px; text-align: left;">
<uni-data-checkbox
@ -76,6 +86,8 @@
</template>
<script>
import WxUserInfoModal from '@/uni_modules/tuniaoui-wx-user-info/components/tuniaoui-wx-user-info/tuniaoui-wx-user-info.vue'
import { getCodeImg } from '@/api/login'
import { getToken } from '@/utils/auth'
import UniIcons from "../uni_modules/uni-icons/components/uni-icons/uni-icons.vue";
@ -85,11 +97,12 @@
export default {
// ========== ==========
components: {UniIcons, UniDataCheckbox},
components: {UniIcons, UniDataCheckbox,WxUserInfoModal},
data() {
return {
isShowPwd: false,
codeUrl: "",
showAuthorizationModal: false,
captchaEnabled: true,
//
register: true,
@ -127,6 +140,15 @@
this.remember = true ;
}
},
//
openAuthorizationModal() {
this.showAuthorizationModal = true
},
//
updatedUserInfoEvent(info) {
console.log('获取到的用户信息', info)
},
// ========== ==========
// ========== ==========
getEncryptKey() {
@ -382,5 +404,26 @@
.icp { position: fixed; bottom: 0; width: 100%; background: #fff; padding: 12px 0; box-shadow: 0 -2px 4px rgba(0,0,0,0.1); }
.icp-one { max-width: 800px; margin: 0 auto; text-align: center; font-size: 12px; color: #666; }
.login-page {
width: 300rpx;
height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
}
/* 授权按钮 */
.submit-btn {
width: 100%;
background-color: #05C160;
color: #FFFFFF;
margin-top: 60rpx;
border-radius: 10rpx;
padding: 25rpx;
font-size: 32rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 30rpx;
}
</style>