增加首页,首页加跳转
parent
649b7482d0
commit
015ce8616f
1
App.vue
1
App.vue
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 => {
|
||||
|
|
|
|||
|
|
@ -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,7 +86,9 @@
|
|||
</template>
|
||||
|
||||
<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 UniIcons from "../uni_modules/uni-icons/components/uni-icons/uni-icons.vue";
|
||||
// ========== 新增:引入uni-data-checkbox ==========
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue