增加首页,首页加跳转

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> </script>
<style lang="scss"> <style lang="scss">
//
@import './tuniao-ui/index.scss'; @import './tuniao-ui/index.scss';
@import './tuniao-ui/iconfont.css'; @import './tuniao-ui/iconfont.css';
@import '@/static/scss/index.scss'; @import '@/static/scss/index.scss';

View File

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

View File

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

View File

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

View File

@ -31,7 +31,17 @@
<image :src="codeUrl" @click="getCode" class="login-code-img"></image> <image :src="codeUrl" @click="getCode" class="login-code-img"></image>
</view> </view>
</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 记住密码可正常勾选 ========== --> <!-- ========== 新增uni-data-checkbox 记住密码可正常勾选 ========== -->
<view style="margin: 10px 0 0 10px; text-align: left;"> <view style="margin: 10px 0 0 10px; text-align: left;">
<uni-data-checkbox <uni-data-checkbox
@ -76,7 +86,9 @@
</template> </template>
<script> <script>
import { getCodeImg } from '@/api/login' 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 { getToken } from '@/utils/auth'
import UniIcons from "../uni_modules/uni-icons/components/uni-icons/uni-icons.vue"; import UniIcons from "../uni_modules/uni-icons/components/uni-icons/uni-icons.vue";
// ========== uni-data-checkbox ========== // ========== uni-data-checkbox ==========
@ -85,11 +97,12 @@
export default { export default {
// ========== ========== // ========== ==========
components: {UniIcons, UniDataCheckbox}, components: {UniIcons, UniDataCheckbox,WxUserInfoModal},
data() { data() {
return { return {
isShowPwd: false, isShowPwd: false,
codeUrl: "", codeUrl: "",
showAuthorizationModal: false,
captchaEnabled: true, captchaEnabled: true,
// //
register: true, register: true,
@ -127,6 +140,15 @@
this.remember = true ; this.remember = true ;
} }
}, },
//
openAuthorizationModal() {
this.showAuthorizationModal = true
},
//
updatedUserInfoEvent(info) {
console.log('获取到的用户信息', info)
},
// ========== ========== // ========== ==========
// ========== ========== // ========== ==========
getEncryptKey() { 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 { 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; } .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> </style>