浇花器优化

This commit is contained in:
吴鹏 2024-11-02 17:59:26 +08:00
parent caf9895d28
commit 99888f22c5
11 changed files with 554 additions and 322 deletions

View File

@ -4,52 +4,56 @@
id="navbar">
</u-navbar>
<image class="bj" src="https://api.ccttiot.com/smartmeter/img/static/urqUoIyCCEBykZ2oG8eO" mode=""></image>
<view class="list">
<view class="list_val" v-for="(values, key, index) in list" :key="key">
<view class="lt" @click="btnitem(key,index,values)">
<view class="one">{{ formattedTime(values[0], values[1]) }}</view>
<view class="two">P{{ index + 1 }} <text></text> {{ formatTime(values[2]) }}</view>
</view>
<view class="rt">
<u-switch v-model="values[3]" @change="btnchange(key,index,values)" active-color="#48893B" inactive-color="#BDBCBC"></u-switch>
</view>
</view>
</view>
<!-- 设置浇水时间弹窗 -->
<view class="jiaoshui" v-if="timeflag">
<view class="top">
设置浇水
</view>
<view class="ts">
距离下次浇水时间还有{{xctime}}
</view>
<view class="shifen" @click="show = true">
<text>{{hour}}</text> <text>{{minutekq}}</text>
</view>
<view class="jssc">
浇水时长
</view>
<view class="shifen" @click="shows = true">
<text>{{minute}}</text> <text>{{second}}</text>
</view>
<view class="anniu">
<view class="qx" @click="btnqx">
取消
</view>
<view class="qd" @click="btnqd">
确定
</view>
</view>
<view class="" v-if="list.length > 0 || list != null">
<view class="list">
<view class="list_val" v-for="(values, key, index) in list" :key="key">
<view class="lt" @click="btnitem(key,index,values)">
<view class="one">{{ formattedTime(values[0], values[1]) }}</view>
<view class="two">P{{ index + 1 }} <text></text> {{ formatTime(values[2]) }}</view>
</view>
<view class="rt">
<u-switch v-model="values[3]" @change="btnchange(key,index,values)" active-color="#48893B" inactive-color="#BDBCBC"></u-switch>
</view>
</view>
</view>
<!-- 设置浇水时间弹窗 -->
<view class="jiaoshui" v-if="timeflag">
<view class="top">
设置浇水
</view>
<view class="ts">
距离下次浇水时间还有{{xctime}}
</view>
<view class="shifen" @click="show = true">
<text>{{hour}}</text> <text>{{minutekq}}</text>
</view>
<view class="jssc">
浇水时长
</view>
<view class="shifen" @click="shows = true">
<text>{{minute}}</text> <text>{{second}}</text>
</view>
<view class="anniu">
<view class="qx" @click="btnqx">
取消
</view>
<view class="qd" @click="btnqd">
确定
</view>
</view>
</view>
<view class="mask" v-if="timeflag"></view>
<!-- 定时时间 -->
<u-picker v-model="show" mode="time" :params="paramss" @confirm="confirm"></u-picker>
<!-- 定时时长 -->
<u-picker v-model="shows" mode="time" :params="params" @confirm="confirms"></u-picker>
<view class="mask" style="z-index: 9999;" v-if="kgflag"></view>
</view>
<view class="" style="width: 100%;padding-top: 80rpx;text-align: center;color: #000;font-size: 36rpx;">
设备未连接
</view>
<view class="mask" v-if="timeflag"></view>
<!-- 定时时间 -->
<u-picker v-model="show" mode="time" :params="paramss" @confirm="confirm"></u-picker>
<!-- 定时时长 -->
<u-picker v-model="shows" mode="time" :params="params" @confirm="confirms"></u-picker>
<view class="mask" style="z-index: 9999;" v-if="kgflag"></view>
</view>
</template>
@ -65,7 +69,7 @@
flag:false,
checked:false,
timeflag:false,
show: false,
params: {
year: false,

View File

@ -83,7 +83,7 @@
}
})
},
//
btnback() {
uni.switchTab({
url: '/pages/index/index'
@ -130,10 +130,11 @@
})
} else {
uni.showToast({
title: '网络波动异常,请重新识别',
title: '识别失败,请重新识别',
icon: 'none',
duration: 1000
})
that.maskpic = ''
}
})
}
@ -141,13 +142,13 @@
}
})
},
//
handleCameraError(e) {
console.error('相机出错:', e.detail);
//
},
//
switchCamera() {
this.cameraPosition = this.cameraPosition == 'back' ? 'front' : 'back'; //
this.cameraPosition = this.cameraPosition == 'back' ? 'front' : 'back';
},
//
uploadPictrue() {
@ -189,7 +190,7 @@
})
} else {
uni.showToast({
title: '网络波动异常,请重新识别',
title: '识别失败,请重新识别',
icon: 'none',
duration: 1000
})

View File

@ -8,20 +8,18 @@
<view class="list">
<view class="list_val" v-for="(item,index) in zwlist" :key="index" @click="btnxq(item.plantId)">
<view class="lt">
<image :src="item.url" mode=""></image>
<image :src="item.url" mode="aspectFill"></image>
</view>
<view class="rt">
<view class="name">
<text>{{item.name}}</text> <text style="color: #48893B;font-size: 32rpx;">{{Number(item.score * 100).toFixed(1) + '%'}}</text>
</view>
<view class="wz">
{{item.msg == null ? '暂无简介' : item.msg}}
{{ item.introduce == null ? '暂无简介' : (item.introduce.length > 20 ? item.introduce.substring(0, 20) + '...' : item.introduce) }}
</view>
</view>
</view>
</view>
</view>
</template>
@ -55,16 +53,24 @@
}
},
onLoad(option) {
this.cartpic = JSON.parse(option.cart)
this.zwlist = JSON.parse(option.list)
this.cartpic = JSON.parse(option.cart) //
this.zwlist = JSON.parse(option.list) //
},
methods:{
//
btnxq(plantId){
uni.navigateTo({
url:'/page_user/photoxq?plantId=' + plantId
})
if(plantId == null || plantId == ''){
uni.showToast({
title: '无该非植物信息',
icon: 'none',
duration: 2000
})
}else{
uni.navigateTo({
url:'/page_user/photoxq?plantId=' + plantId
})
}
}
}
}
</script>
@ -101,6 +107,7 @@
width: 140rpx;
height: 140rpx;
margin-right: 18rpx;
border-radius: 10rpx;
}
}
.rt{

View File

@ -31,7 +31,7 @@
</view>
</view>
<view class="cont_right">
<image :src="item.picture" mode=""></image>
<image :src="list.picture" mode="aspectFill"></image>
</view>
</view>
</view>

View File

@ -6,7 +6,7 @@
<view class="img">
<image class="img" src="https://api.ccttiot.com/smartmeter/img/static/uVKucPVDjxjaCDCpFKvw" mode=""></image>
</view>
<view class="name" @click="nameflag = true">
<view class="name" @click="btnxianshi">
<view class="">{{user.deviceName == undefined ? '--' : user.deviceName}}</view>
<image src="https://api.ccttiot.com/smartmeter/img/static/uL6FHnMGWFrdptmDokDI" mode=""></image>
</view>
@ -18,20 +18,17 @@
</view>
<view class="wifi">
<view class="">WIFI</view>
<view class="flex">ChangteA-5G <image
src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" mode=""></image>
<view class="flex">ChangteA-5G <image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" mode=""></image>
</view>
</view>
<view class="wifi" style="margin-top: 78rpx;" @click="xpshow = true">
<view class="">息屏</view>
<view class="flex">{{xptxt}} <image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F"
mode=""></image>
<view class="flex">{{xptxt}} <image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" mode=""></image>
</view>
</view>
<view class="wifi" style="margin-top: 24rpx;" @click="gjshow = true">
<view class="">固件更新</view>
<view class="flex">{{gjtxt}}<image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F"
mode=""></image>
<view class="flex">{{gjtxt}}<image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" mode=""></image>
</view>
</view>
<!-- 息屏选择器 -->
@ -43,7 +40,7 @@
<view class="top">
修改名称
</view>
<input type="text" placeholder="请输入您想要修改的名字" />
<input type="text" v-model="namesb" placeholder="请输入您想要修改的名字" />
<view class="anniu">
<view class="qx" @click="btnqx">
取消
@ -93,7 +90,8 @@
label: 'v2.1.3'
}],
deviceid:'',
user:{}
user:{},
namesb:''
}
},
//
@ -103,7 +101,6 @@
path: '/pages/index/index'
}
},
//
onShareTimeline: function() {
return {
@ -125,7 +122,11 @@
}
})
},
//
btnxianshi(){
this.nameflag = true
this.namesb = this.user.deviceName
},
//
xpconfirm(e){
this.xptxt = e[0].label
@ -140,9 +141,24 @@
},
//
btnqd(){
this.nameflag = false
}
this.$u.put(`/app/editDeviceName?deviceId=${this.deviceid}&deviceName=${this.namesb}`).then(res => {
if(res.code == 200){
this.nameflag = false
this.user.deviceName = this.namesb
uni.showToast({
title: '修改成功',
icon: 'success',
duration:2000
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration:2000
})
}
})
},
}
}
</script>
@ -151,7 +167,6 @@
/deep/ .u-title {
margin-bottom: 22rpx;
}
/deep/ .uicon-nav-back {
margin-bottom: 22rpx;
}
@ -223,7 +238,6 @@
height: 332rpx;
margin: auto;
}
.name {
width: 100%;
font-weight: 600;
@ -233,14 +247,12 @@
margin-top: 64rpx;
justify-content: center;
align-items: center;
image {
width: 44rpx;
height: 44rpx;
margin-left: 26rpx;
}
}
.model {
width: 100%;
display: flex;
@ -248,13 +260,11 @@
font-size: 32rpx;
color: #3D3D3D;
margin-top: 48rpx;
.one {
margin-left: 74rpx;
margin-right: 144rpx;
}
}
.wifi {
width: 678rpx;
height: 104rpx;
@ -270,11 +280,9 @@
justify-content: space-between;
padding: 0 42rpx;
box-sizing: border-box;
.flex {
display: flex;
align-items: center;
image {
width: 40rpx;
height: 40rpx;

View File

@ -44,6 +44,7 @@
this.getxq()
},
methods:{
//
getxq() {
this.$u.get(`/app/article/${this.id}`).then((res) => {
if (res.code == 200) {

View File

@ -7,14 +7,14 @@
</view>
<!-- 背景图 -->
<!-- 没设备时展示 -->
<image class="bjimg" v-if="false" src="https://api.ccttiot.com/smartmeter/img/static/uz8MR6BuZW2qRANnYgLu"
<image class="bjimg" v-if="bjflag" src="https://api.ccttiot.com/smartmeter/img/static/uz8MR6BuZW2qRANnYgLu"
mode=""></image>
<!-- 有设备时展示 -->
<image class="bjimg" v-else src="https://api.ccttiot.com/smartmeter/img/static/uXBpJuaUs0XUNb8HTahh" mode="">
</image>
<view class="wusb" v-if="false">
<view class="wusb" v-if="bjflag">
<text>暂无设备请先绑定设备</text>
<view class="bang">
<view class="bang" @click="btnaddsb">
绑定
</view>
</view>
@ -310,7 +310,9 @@
devicelist:[],
shebid:'',
user:{},
lastChar:''
lastChar:'',
timer:'',
bjflag:false
}
},
//
@ -333,7 +335,9 @@
},
onShow() {
//
this.getinfo()
//
this.getshuju()
},
@ -342,7 +346,7 @@
btnshowjs() {
this.showjs = true
},
//
formattedTime(minutes, seconds) {
//
const formattedMinutes = String(minutes).padStart(2, '0');
@ -388,8 +392,10 @@
content: '未连接成功是否重新连接重新连接请确保设备在附近5米范围内',
success: function (res) {
if (res.confirm) {
uni.hideLoading()
that.getinfo()
} else if (res.cancel) {
} else if (res.cancel) {
uni.hideLoading()
uni.showToast({
title: '已取消连接',
icon: 'none',
@ -454,103 +460,203 @@
},
//
btnyushui() {
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
that.yschecked = false
xBlufi.notifySendCustomData({
customData: '11yudi'
})
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} else {
console.log('手机未连接网络')
if(this.datalist == ''){
let that = this
uni.showModal({
title: '提示',
content: '设备未连接,是否进行设备连接?',
success: function (res) {
if (res.confirm) {
uni.hideLoading()
that.btnlj()
} else if (res.cancel) {
uni.hideLoading()
uni.showToast({
title: '已取消连接',
icon: 'none',
duration:2000
})
}
}
})
}else{
uni.showLoading({
title: '开启中...'
})
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
that.yschecked = false
xBlufi.notifySendCustomData({
customData: '11yudi'
})
uni.hideLoading()
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} else {
console.log('手机未连接网络')
}
}
}
})
})
}
},
//
btnyushuis() {
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
that.yschecked = true
xBlufi.notifySendCustomData({
customData: '11unyudi'
})
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} else {
console.log('手机未连接网络')
if(this.datalist == ''){
let that = this
uni.showModal({
title: '提示',
content: '设备未连接,是否进行设备连接?',
success: function (res) {
if (res.confirm) {
uni.hideLoading()
that.btnlj()
} else if (res.cancel) {
uni.hideLoading()
uni.showToast({
title: '已取消连接',
icon: 'none',
duration:2000
})
}
}
})
}else{
uni.showLoading({
title: '开启中...'
})
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
that.yschecked = true
xBlufi.notifySendCustomData({
customData: '11unyudi'
})
uni.hideLoading()
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} else {
console.log('手机未连接网络')
}
}
}
})
})
}
},
//
btnertong() {
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
that.etchecked = false
xBlufi.notifySendCustomData({
customData: '11lock'
})
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} else {
console.log('手机未连接网络')
if(this.datalist == ''){
let that = this
uni.showModal({
title: '提示',
content: '设备未连接,是否进行设备连接?',
success: function (res) {
if (res.confirm) {
uni.hideLoading()
that.btnlj()
} else if (res.cancel) {
uni.hideLoading()
uni.showToast({
title: '已取消连接',
icon: 'none',
duration:2000
})
}
}
})
}else{
uni.showLoading({
title: '开启中...'
})
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
that.etchecked = false
xBlufi.notifySendCustomData({
customData: '11lock'
})
uni.hideLoading()
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} else {
console.log('手机未连接网络')
}
}
}
})
})
}
},
//
btnertongs() {
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
that.etchecked = true
xBlufi.notifySendCustomData({
customData: '11unlock'
})
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} else {
console.log('手机未连接网络')
if(this.datalist == ''){
let that = this
uni.showModal({
title: '提示',
content: '设备未连接,是否进行设备连接?',
success: function (res) {
if (res.confirm) {
uni.hideLoading()
that.btnlj()
} else if (res.cancel) {
uni.hideLoading()
uni.showToast({
title: '已取消连接',
icon: 'none',
duration:2000
})
}
}
})
}else{
uni.showLoading({
title: '开启中...'
})
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
that.etchecked = true
xBlufi.notifySendCustomData({
customData: '11unlock'
})
uni.hideLoading()
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
} else {
console.log('手机未连接网络')
}
}
}
})
})
}
},
//
@ -577,6 +683,7 @@
url: '/page_user/dingshi?list=' + JSON.stringify(this.ver_data)
})
},
//
btnqx() {
@ -591,6 +698,9 @@
duration: 3000
})
} else {
uni.showLoading({
title: '开启中...'
})
let that = this
uni.getNetworkType({
success(res) {
@ -601,6 +711,7 @@
xBlufi.notifySendCustomData({
customData: "11time@" + that.jstime + '@'
})
uni.hideLoading()
that.startTimer(that.jstime)
that.sdjsflag = false
that.kgflag = true
@ -619,58 +730,104 @@
},
//
startTimer(totalSeconds) {
let sdseconds = totalSeconds
console.log(remainingSeconds, '000');
const timer = setInterval(() => {
//
const minutes = Math.floor(remainingSeconds / 60).toString()
const secs = (remainingSeconds % 60).toString()
//
this.sdseconds = secs.padStart(2, '0')
// 0
this.sdminutes = minutes.padStart(2, '0')
//
remainingSeconds--;
// 0
if (remainingSeconds <= 0) {
clearInterval(timer)
this.btnkq()
this.sdminutes = ''
this.sdseconds = ''
}
}, 1000)
startTimer(totalSeconds) {
let remainingSeconds = totalSeconds; // remainingSeconds
const sdminutes = ''; // 使
const sdseconds = '';
this.timer = setInterval(() => {
//
const minutes = Math.floor(remainingSeconds / 60).toString();
const secs = (remainingSeconds % 60).toString();
//
this.sdseconds = secs.padStart(2, '0');
this.sdminutes = (minutes > 0 ? minutes : '').padStart(2, '0'); // 0
//
remainingSeconds--;
// 0
if (remainingSeconds <= 0) {
clearInterval(this.timer);
this.btnkq(); //
this.sdminutes = ''; //
this.sdseconds = ''; //
}
}, 1000);
},
//
btnkq() {
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
xBlufi.notifySendCustomData({
customData: "11close"
})
that.startTimer(0)
that.sdminutes = ''
that.sdseconds = ''
that.kgflag = false
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
if(this.datalist == ''){
let that = this
uni.showModal({
title: '提示',
content: '设备未连接,是否进行设备连接?',
success: function (res) {
if (res.confirm) {
uni.hideLoading()
that.btnlj()
} else if (res.cancel) {
uni.hideLoading()
uni.showToast({
title: '已取消连接',
icon: 'none',
duration:2000
})
}
}
})
}else{
uni.showLoading({
title: '关闭中...'
})
let that = this
uni.getNetworkType({
success(res) {
if (res.networkType !== 'none') {
uni.getConnectedBluetoothDevices({
success(res) {
setTimeout(() => {
xBlufi.notifySendCustomData({
customData: "11close"
})
// that.startTimer(0)
clearInterval(that.timer)
that.sdminutes = ''
that.sdseconds = ''
that.kgflag = false
uni.hideLoading()
}, 1500)
},
fail(err) {
console.error('获取已连接蓝牙设备信息失败:', err)
}
})
}
}
}
})
})
}
},
//
btngb() {
this.sdjsflag = true
if(this.datalist == ''){
uni.showModal({
title: '提示',
content: '设备未连接,是否进行设备连接?',
success: function (res) {
if (res.confirm) {
uni.hideLoading()
that.btnlj()
} else if (res.cancel) {
uni.hideLoading()
uni.showToast({
title: '已取消连接',
icon: 'none',
duration:2000
})
}
}
})
}else{
this.sdjsflag = true
}
},
//
@ -699,6 +856,8 @@
this.datalist = ''
this.mac = ''
this.ver_data = {}
this.name = ''
this.deviceId = ''
this.xuanzeflag = false
let that = this
xBlufi.initXBlufi(1)
@ -744,34 +903,39 @@
getlist(){
this.$u.get(`/app/getDeviceInfoByUser?userId=${this.userobj.userId}`).then((res) => {
if (res.code == 200) {
this.devicelist = res.data
this.mac = res.data[0].mac
this.user = res.data[0]
this.shebid = res.data[0].deviceId
if(this.datalist == ''){
let that = this
xBlufi.initXBlufi(1)
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent)
xBlufi.notifyStartDiscoverBle({
'isStart': true
})
setTimeout(() => {
xBlufi.notifyStartDiscoverBle({
'isStart': false
if(res.data.length > 0 || res.data != ''){
this.bjflag = false
this.devicelist = res.data
this.mac = res.data[0].mac
this.user = res.data[0]
this.shebid = res.data[0].deviceId
if(this.datalist == ''){
let that = this
uni.showModal({
title: '提示',
content: '设备未连接,是否进行设备连接?',
success: function (res) {
if (res.confirm) {
uni.hideLoading()
that.btnlj()
} else if (res.cancel) {
uni.hideLoading()
uni.showToast({
title: '已取消连接',
icon: 'none',
duration:2000
})
}
}
})
if (that.devicesList.length > 0) {
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
}
}, 2000)
that.getchao()
}
}else{
this.bjflag = true
}
}
})
},
//
btnksxz() {
if (this.xuanzeflag == true) {
this.xuanzeflag = false
@ -848,7 +1012,6 @@
xBlufi.notifyInitBleEsp32({
deviceId: this.deviceId
})
this.deviceIds = options.data.deviceId
this.name = this.name
}
} else {
@ -871,32 +1034,34 @@
break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
if (!options.result) {
uni.showToast({
title: '蓝牙未开启',
icon: 'none',
duration: 3000
})
// uni.showModal({
// title: '',
// content: '',
// success: function (res) {
// if (res.confirm) {
// that.getinfo()
// } else if (res.cancel) {
// uni.showToast({
// title: '',
// icon: 'none',
// duration:2000
// })
// }
// }
uni.hideLoading()
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 3000
// })
uni.showModal({
title: '提示',
content: '请打开蓝牙和位置信息',
success: function (res) {
if (res.confirm) {
uni.hideLoading()
that.btnlj()
} else if (res.cancel) {
uni.hideLoading()
uni.showToast({
title: '已取消连接',
icon: 'none',
duration:2000
})
}
}
})
return
}
break
}
},
//
getshuju() {
let that = this
@ -927,7 +1092,7 @@
}, 60000)
},
//
//
getchuli() {
const inputString = this.datalist
const pairs = inputString.split(';')
@ -943,7 +1108,6 @@
}
})
this.ver_data = pSetObjects //
// this.ver_data.p_set5[3] = this.lastChar
console.log(inputString,this.ver_data, '002002002')
this.showobj = showObject //
if (this.showobj.showArray[1] == 1) {
@ -967,7 +1131,7 @@
const [hour, minute,minutes, second, /* other fields */ ] = timeArray
const date = new Date()
date.setHours(hour, minute,minute, second, 0) // 0
console.log(date,'11111');
console.log(date,'11111')
return date
}
function timeDifference(date1, date2) {
@ -989,9 +1153,8 @@
for (const key in ver_Data) {
if (ver_Data.hasOwnProperty(key) && ver_Data[key][3] === 1) {
const timeArray = ver_Data[key]
console.log(timeArray,'00000');
console.log(timeArray,'00000')
const timeDate = timeArrayToDate(timeArray)
const diff = timeDifference(timeDate, new Date())
if (timeDate > new Date()) {
if (!nextTime || (diff.hours * 60 + diff.minutes < (nextTimeDiff.hours || 0) * 60 + (
@ -1009,16 +1172,11 @@
}
}
// 访 null
this.xctime = nextTime ? `${nextTimeDiff.hours}${nextTimeDiff.minutes}` : '无距离下次浇水时间';
this.xctimesc = nextWaterDuration || '未知';
this.sctimejs = prevTime ? prevTime.toTimeString().split(' ')[0].slice(0, -3) : '无上次浇水时间';
this.xctimesj = nextTime ? nextTime.toTimeString().split(' ')[0].slice(0, -3) : '无下次浇水时间';
this.xctime = nextTime ? `${nextTimeDiff.hours}${nextTimeDiff.minutes}` : '无距离下次浇水时间'
this.xctimesc = nextWaterDuration || '未知'
this.sctimejs = prevTime ? prevTime.toTimeString().split(' ')[0].slice(0, -3) : '无上次浇水时间'
this.xctimesj = nextTime ? nextTime.toTimeString().split(' ')[0].slice(0, -3) : '无下次浇水时间'
console.log('下次浇水时间',this.xctimesj,'距离下次浇水时间',this.xctime,'上次浇水时间',this.sctimejs)
// console.log(':', nextTimeDiff ? `${nextTimeDiff.hours}${nextTimeDiff.minutes}` : '');
// console.log(':', nextTime ? nextTime.toTimeString().split(' ')[0] : '');
// console.log(':', nextWaterDuration || '');
// console.log(':', prevTimeDiff ? `${prevTimeDiff.hours}${prevTimeDiff.minutes}` : '');
// console.log(':', prevTime ? prevTime.toTimeString().split(' ')[0] : '')
}
}
}
@ -1171,7 +1329,7 @@
border-radius: 20rpx;
margin-top: 40rpx;
}
.sblist {
width: 100%;
height: 68vh;

View File

@ -21,7 +21,8 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 密码
</view>
<view class="yzm">
<input :type="txt" v-model="password" placeholder="请输入密码"/>
<input v-if="txt == 'password'" type="password" v-model="password" placeholder="请输入密码"/>
<input v-else type="text" v-model="password" placeholder="请输入密码"/>
<image v-if="txt == 'password'" src="https://api.ccttiot.com/smartmeter/img/static/uWm6nstWoT5VIJuXvcGu" @click="btn(1)" mode=""></image>
<image v-else src="https://api.ccttiot.com/smartmeter/img/static/uyVRL3hjK3JzSxbiIzBA" @click="btn(2)" mode=""></image>
</view>
@ -81,26 +82,40 @@
methods:{
//
btndl(){
let data = {
phone:this.tel,
// phoneCode:this.yzm,
// uuid:this.uuid,
password:this.password
}
this.$u.post(`/appCodeLogin`,data).then((res) => {
if (res.code == 200) {
wx.setStorageSync('token', res.token)
uni.switchTab({
url:'/pages/index/index'
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
if(this.tel == ''){
uni.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 2000
})
}else if(this.password == ''){
uni.showToast({
title: '密码不能为空',
icon: 'none',
duration: 2000
})
}else{
let data = {
phone:this.tel,
// phoneCode:this.yzm,
// uuid:this.uuid,
password:this.password
}
})
this.$u.post(`/appCodeLogin`,data).then((res) => {
if (res.code == 200) {
wx.setStorageSync('token', res.token)
uni.switchTab({
url:'/pages/index/index'
})
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
})
}
})
}
},
//
getPhoneNumber(e) {
@ -141,7 +156,7 @@
})
},
//
btn(num){
if(num == 1){
this.txt = 'txt'

View File

@ -39,11 +39,13 @@
},
methods:{
//
btnzc(){
uni.navigateTo({
url:'/pages/login/zhuce'
})
},
//
denglu(){
uni.navigateTo({
url:'/pages/login/denglu'

View File

@ -33,7 +33,8 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 新密码
</view>
<view class="yzm">
<input :type="txt" v-model="password" placeholder="请输入新密码"/>
<input v-if="txt == 'password'" type="password" v-model="password" placeholder="请输入新密码"/>
<input v-else type="text" v-model="password" placeholder="请输入新密码"/>
<image v-if="txt == 'password'" src="https://api.ccttiot.com/smartmeter/img/static/uWm6nstWoT5VIJuXvcGu" @click="btn(1)" mode=""></image>
<image v-else src="https://api.ccttiot.com/smartmeter/img/static/uyVRL3hjK3JzSxbiIzBA" @click="btn(2)" mode=""></image>
</view>
@ -43,7 +44,8 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 确认密码
</view>
<view class="yzm">
<input :type="txts" v-model="passwords" placeholder="请再次输入新密码"/>
<input v-if="txts == 'password'" type="password" v-model="passwords" placeholder="请再次输入新密码"/>
<input v-else type="text" v-model="passwords" placeholder="请再次输入新密码"/>
<image v-if="txts == 'password'" src="https://api.ccttiot.com/smartmeter/img/static/uWm6nstWoT5VIJuXvcGu" @click="btns(1)" mode=""></image>
<image v-else src="https://api.ccttiot.com/smartmeter/img/static/uyVRL3hjK3JzSxbiIzBA" @click="btns(2)" mode=""></image>
</view>
@ -71,7 +73,8 @@
yzm:'',
countdown: 60,
timer: null,
uuid:''
uuid:'',
yzmkg:false
}
},
//
@ -157,7 +160,7 @@
})
}
},
//
btn(num){
if(num == 1){
this.txt = 'txt'
@ -165,6 +168,7 @@
this.txt = 'password'
}
},
//
btns(num){
if(num == 1){
this.txts = 'txt'
@ -195,10 +199,27 @@
//
btnhuoqu(){
this.startCountdown()
this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => {
this.uuid = res.uuid
})
if(this.tel == ''){
uni.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 2000
})
}else{
if(this.yzmkg == false){
this.yzmkg = true
this.startCountdown()
this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => {
this.uuid = res.uuid
})
}else{
uni.showToast({
title: '不要重复点击',
icon: 'none',
duration: 2000
})
}
}
},
}
}

View File

@ -36,7 +36,8 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 密码
</view>
<view class="yzm">
<input :type="txt" v-model="password" placeholder="请输入密码"/>
<input v-if="txt == 'password'" type="password" v-model="password" placeholder="请输入密码"/>
<input v-else type="text" v-model="password" placeholder="请输入密码"/>
<image v-if="txt == 'password'" src="https://api.ccttiot.com/smartmeter/img/static/uWm6nstWoT5VIJuXvcGu" @click="btn(1)" mode=""></image>
<image v-else src="https://api.ccttiot.com/smartmeter/img/static/uyVRL3hjK3JzSxbiIzBA" @click="btn(2)" mode=""></image>
</view>
@ -54,15 +55,11 @@
<view class="wxlogo">
其他登录方式
</view>
<!-- <view class="lofo">
<image src="https://api.ccttiot.com/smartmeter/img/static/uxWMldLMb888YHm0qOgN" mode=""></image>
</view> -->
<button class="lofo" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
<image src="https://api.ccttiot.com/smartmeter/img/static/uxWMldLMb888YHm0qOgN" mode=""></image>
</button>
<!-- <button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" style="margin-left: -10rpx;">
授权登录
</button> -->
</view>
@ -79,7 +76,8 @@
yzm:'',
countdown: 60,
timer: null,
uuid:''
uuid:'',
yzmkg:false
}
},
//
@ -194,10 +192,10 @@
console.error(err)
})
},
//
btn(num){
if(num == 1){
this.txt = 'txt'
this.txt = 'text'
}else if(num == 2){
this.txt = 'password'
}
@ -225,10 +223,27 @@
//
btnhuoqu(){
this.startCountdown()
this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => {
this.uuid = res.uuid
})
if(this.tel == ''){
uni.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 2000
})
}else{
if(this.yzmkg == false){
this.yzmkg = true
this.startCountdown()
this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => {
this.uuid = res.uuid
})
}else{
uni.showToast({
title: '不要重复点击',
icon: 'none',
duration: 2000
})
}
}
},
//
btnljdl(){