This commit is contained in:
3321822538@qq.com 2024-10-28 18:00:49 +08:00
parent 8ef690c338
commit fb0a071567
14 changed files with 158 additions and 241 deletions

View File

@ -1,6 +1,6 @@
const install = (Vue, vm) => {
Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://192.168.2.15:3202',
// baseUrl: 'http://192.168.2.16:3202',
baseUrl: 'https://fen.ccttiot.com/prod-api',
loadingText: '努力加载中~',
loadingTime: 800,

View File

@ -1145,8 +1145,8 @@ function init() {
// && devices.devices[0].name != 'SMART_R2XS'
// && devices.devices[0].name != 'SMART_R2XS'
// )
if (devices.devices[0].name.indexOf("CCYK") != -1){
// console.log("跳过",devices.devices[0].name) || devices.devices[0].name.indexOf("BBLE") != -1
if (devices.devices[0].name.indexOf("FXLE") != -1){
// console.log("跳过",devices.devices[0].name)
// isnotexist = false;
isnotexist = true;
}

View File

@ -1,5 +1,4 @@
var mOnFire = require("./other/onfire.js");
var $wxBlufiImpl = require("./xBlufi-wx-impl.js"); // 0表示阿里支付宝小程序 1表示微信小程序

View File

@ -56,7 +56,7 @@
"urlCheck" : false,
"minified" : true,
"postcss" : true,
"es6" : false
"es6" : true
},
"usingComponents" : true,
"optimization" : {

View File

@ -36,16 +36,16 @@
{{item.realValue}}%
</view>
<view class="txt" v-if="item.type == 3">
{{item.realValue}}g
{{item.realValue}}kg
</view>
<view class="txt" v-if="item.type == 4">
{{item.realValue}}%
</view>
<view class="txt" v-if="item.type == 5">
{{item.realValue}}
{{item.realValue}}
</view>
<view class="txt" v-if="item.type == 6">
{{item.realValue}}
{{item.realValue}}Khz
</view>
<view class="txt" v-if="item.type == 7">
{{item.realValue}}km

View File

@ -1,18 +1,17 @@
<template>
<view class="pages">
<u-navbar title="设备录入" :border-bottom="false" :background="bgc" title-size='38' title-color='#fff'
back-icon-color="#fff" height='50'></u-navbar>
<u-navbar title="设备录入" :border-bottom="false" :background="bgc" title-size='38' title-color='#000'
back-icon-color="#000" height='50'></u-navbar>
<view class="title">
<text>设备录入列表</text>
<text style="font-size: 28rpx;width: 160rpx;height: 60rpx;border-radius: 20rpx;background-color: #8883F0;text-align: center;color: #fff;line-height: 60rpx;margin-top: 20rpx;" @click="btnkzt">控制台</text>
<text style="font-size: 28rpx;width: 160rpx;height: 60rpx;border-radius: 20rpx;background-color: #FFC107;text-align: center;color: #fff;line-height: 60rpx;margin-top: 20rpx;" @click="btnkzt">控制台</text>
</view>
<view class="dblist" v-for="(item, index) in devicesLists" :key="index">
<view class="cen" :id="item.deviceId" @click="createBLEConnections(item)">
<view class="name">
<view class="">
状态<text v-if="item.flags == true" style="color: #e10328;">已录入</text> <text v-else
style="color:seagreen;">未录入</text>
状态<text v-if="item.flags == true" style="color: #e10328;">已录入</text> <text v-else style="color:seagreen;">未录入</text>
</view>
<view class="" style="display: flex;width: 100%;">
SN码:{{item.sn == undefined ? '--' : item.sn}}
@ -21,11 +20,11 @@
<view class="mac">
MAC{{item.name.substring(5)}}
</view>
<view class="" style="color: #8883F0;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;">
<view class="" style="color: #FFC107;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;">
蓝牙强度:{{item.RSSI}}
</view>
<!-- <view @click="btnshows(item,index)"
style="color: #8883F0;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;">
<!-- <view @click.stop="btnshows(item,index)"
style="color: #FFC107;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;">
型号选择:{{item.xuanz == undefined ? '--' : item.xuanz}}
</view> -->
</view>
@ -51,10 +50,8 @@
<text>3.确保设备未被添加过</text>
<button @click="btnyc">好的</button>
</view>
<view v-if="mengcflag" class="mengc"
style="width: 100%;height: 100vh;background-color: #000;opacity: .5;position: fixed;top: 0;left: 0;"></view>
<!-- 选择蓝牙型号 -->
<u-select v-model="shows" :list="arr" @confirm="confirm"></u-select>
</view>
@ -62,15 +59,12 @@
<script>
const app = getApp();
// var xBlufi = require("@/components/blufi/xBlufi.js");
var xBlufi = require("@/components/blufi/xBlufi.js");
export default {
data() {
return {
mengcflag: false,
titleflag: false, //
bgc: {
backgroundColor: "#F7FAFE",
},
devicesList: [
// {name:'110000',
// mac:'11111'}
@ -90,7 +84,7 @@
status: false,
storeId: '',
bgc: {
backgroundColor: "#8883f0",
backgroundColor: "#FAFDFD",
},
lurulist: [],
arr: [],
@ -126,7 +120,6 @@
path: '/pages/shouye/index'
}
},
//
onShareTimeline: function() {
return {
@ -141,61 +134,27 @@
methods: {
btnkzt(){
uni.navigateTo({
url:'/page_user/wifijoint/index'
url:'/page_user/lurutwo'
})
},
// sn
scanQRCode(item) {
this.snname = item.name
uni.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
success: res => {
function getQueryParam(url, paramName) {
let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
let results = regex.exec(url);
return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null
}
let sceneValue = res.result
let decodedValue = decodeURIComponent(sceneValue)
let id = getQueryParam(decodedValue, 's')
this.storeId = id
this.devicesLists.forEach(item => {
if (item.name == this.snname) {
item.sn = id
}
})
},
fail: err => {
console.error('扫描失败:', err)
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
getxingh() {
this.$u.get(`/app/model/all`).then(res => {
this.$u.get(`/app/model/admin/all`).then(res => {
if (res.code == 200) {
this.arr = res.data
this.arr.forEach(item => {
if (item.hasOwnProperty('modelId')) {
item.value = item.modelId;
}
if (item.hasOwnProperty('modelName')) {
item.label = item.modelName;
if (item.hasOwnProperty('name')) {
item.label = item.name;
}
})
console.log(this.arr, '2121212')
}
})
},
btnshows(item, index) {
this.arrname = item.name
this.shows = true
},
//
confirm(e) {
this.devicesLists.forEach(item => {
@ -205,6 +164,12 @@
}
})
},
btnshows(item, index) {
this.arrname = item.name
this.shows = true
},
//
btnyc() {
@ -246,8 +211,6 @@
} else {
this.shibaiflag = true
this.bluetoothflag = false
}
break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
@ -277,7 +240,7 @@
})
let devicesarr = options.data
this.devicesList.forEach(device => {
if (device.name.substring(0, 4) == "CCYK") {
if (device.name.substring(0, 4) == "FXLE") {
this.devicesList.push(device);
let uniqueDevicesList = Array.from(new Set(this.devicesList));
this.devicesLists = uniqueDevicesList.filter(device => {
@ -297,7 +260,7 @@
arr.push(item.name.slice(5))
})
this.arrs = arr.join(',')
this.$u.get(`/app/device/getExistMac/${this.arrs}`).then(res => {
this.$u.get(`/app/beehive/admin/getExistMac/${this.arrs}`).then(res => {
if (res.code == 200 && Array.isArray(res.data)) {
const existingDevices = new Map(res.data.map(item => [item.mac, true])); // 使MapMAC
@ -344,102 +307,8 @@
createBLEConnections(e) {
let Bluetoothmac = e.name.substring(5)
uni.navigateTo({
url:'/page_fenbao/device/joinDevice?mac='+Bluetoothmac
url:'/page_user/luruone?mac=' + Bluetoothmac
})
// this.arrs = ''
// this.qrResult = e.name //mac
// if (this.ver_data == null) { //
// xBlufi.initXBlufi(1)
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
// xBlufi.notifyStartDiscoverBle({
// 'isStart': true
// })
// this.devicesList.forEach(device => {
// if (device.name == this.qrResult) {
// this.deviceId = device.deviceId
// this.name = device.name
// this.mac = device.name.slice(5, 17)
// }
// })
// uni.showLoading({
// title: '...'
// })
// //
// setTimeout(() => {
// setTimeout(()=>{
// uni.showLoading({
// title: '...'
// })
// setTimeout(()=>{
// uni.hideLoading()
// uni.showToast({
// title: '',
// icon: 'success',
// duration: 2000
// })
// this.devicesLists.forEach(item => {
// if (item.name == this.qrResult) {
// item.lj = ''
// }
// })
// },2000)
// },500)
// xBlufi.notifyStartDiscoverBle({
// 'isStart': false
// })
// xBlufi.notifyConnectBle({
// isStart: true,
// deviceId: this.deviceId,
// name: this.name
// })
// xBlufi.notifyInitBleEsp32({
// deviceId: this.deviceId
// })
// }, 1000)
// }else{ //
// uni.showLoading({
// title: '...'
// })
// let that = this //this
// uni.getNetworkType({
// success(res) {
// if (res.networkType !== 'none') {
// uni.getConnectedBluetoothDevices({
// success(res) {
// setTimeout(() => { //
// xBlufi.notifySendCustomData({
// customData: 'open'
// })
// setTimeout(()=>{ //
// xBlufi.notifySendCustomData({
// customData: 'close'
// })
// setTimeout(()=>{ //
// uni.hideLoading()
// that.ver_data = null
// xBlufi.listenDeviceMsgEvent(false, that.funListenDeviceMsgEvent);
// wx.closeBLEConnection({
// deviceId: that.deviceId,
// })
// that.devicesLists.forEach(item => {
// if (item.name == that.qrResult) {
// item.lj = ''
// }
// })
// // console.log('guanbi');
// },1000)
// },2000)
// }, 1000)
// },
// fail(err) {
// console.error('', err)
// }
// })
// }
// }
// })
// }
},
// mac
getluru() {
@ -704,12 +573,12 @@
width: 108rpx;
height: 60rpx;
background: rgba(255, 255, 255, 0);
border: 2rpx solid #8883F0;
border: 2rpx solid #000;
filter: blur(0px);
border-radius: 20rpx;
text-align: center;
line-height: 60rpx;
color: #8883F0;
color: #000;
}
}
}
@ -723,7 +592,7 @@
bottom: 112rpx;
button {
background: #8883F0;
background: #FFC107;
border-radius: 52rpx 52rpx 52rpx 52rpx;
color: #fff;
}
@ -764,7 +633,7 @@
margin-top: 46rpx;
width: 266rpx;
height: 96rpx;
background: #8883F0;
background: #FFC107;
border-radius: 52rpx 52rpx 52rpx 52rpx;
color: #fff;
text-align: center;

View File

@ -181,6 +181,22 @@
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},{
"path" : "luruone",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},{
"path" : "lurutwo",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path" : "about",

View File

@ -47,7 +47,7 @@
</view>
<view class="imgbox" v-else>
<image :src="userImgs" mode="" v-if=""></image>
<image :src="userImgs" mode="aspectFill" v-if=""></image>
</view>
<u-select v-model="showfengzhong" :list="fengzhongcolumns" title='选择蜂种' @confirm="confirmfz"></u-select>

View File

@ -48,7 +48,7 @@
<view class="xy">
<u-checkbox-group>
<u-checkbox v-model="checked" shape="circle" active-color="#FFCC25"
@change="checkboxChange">该蜂箱所属蜂场之下进行此日志,并且记录</u-checkbox>
@change="checkboxChange">该蜂场的所有蜂箱进行此日志</u-checkbox>
</u-checkbox-group>
<view class="txt">
</view>

View File

@ -69,7 +69,7 @@
<u-switch v-model="form.enableFence" active-color="#FFC107" @change="chang"></u-switch>
</view>
<view class="iptbox" @click="btnfx(7)">
<input type="text" class="ips" v-model="form.address" :placeholder="'低于' + form.minFence + 'km时'"
<input type="text" class="ips" v-model="form.address" :placeholder="'超出' + form.minFence + 'km时'"
placeholder-class="my-placeholder" disabled />
<image src="https://api.ccttiot.com/smartmeter/img/static/ugAdKZm5ZHZ4to1cDsNI" mode=""></image>
</view>

View File

@ -18,7 +18,7 @@
</view>
<view class="tabbar">
<view class="cont" v-for="(item,index) in miyuancolumns" :key="index" @click="btntab(index,item)">
{{item.label == null ? '--' : item.label}} <text v-if="item.count != '-1'">({{item.count == null ? '--' : item.count}})</text>
{{item.label == null ? '--' : item.label}} <text v-if="item.count != '-1'">({{item.count == null ? '0' : item.count}})</text>
<view class="gl" :id="indextab == index ? 'active' : ''"></view>
</view>
</view>
@ -199,7 +199,7 @@
code: '',
swiperHeight:554,
curtitidx:0,
miyuancolumns: [{label:'全部',count:'a'}],
miyuancolumns: [{label:'全部',count:'0'}],
pagesum: 1,
pagesize: 99,
pagesizes: 5,
@ -326,11 +326,6 @@
this.getlist()
} else {
this.logoflag = true
// uni.showToast({
// title: res.msg,
// icon: 'none',
// duration: 2000
// })
}
})
},

View File

@ -7,19 +7,19 @@
<view class="tip_cont">
<image src="https://api.ccttiot.com/smartmeter/img/static/uKW514Tl8TVUiaJW2ygl" mode=""></image>
<view class="txt">
蜂箱数量:{{tjobj.beehiveCount == undefined ? '' : tjobj.beehiveCount}}
蜂箱数量:{{tjobj.beehiveCount == undefined ? '--' : tjobj.beehiveCount}}
</view>
</view>
<view class="tip_cont" style="margin-top: 48rpx;">
<image src="https://api.ccttiot.com/smartmeter/img/static/uBEd8suIZ2vdqOGI8rP6" mode=""></image>
<view class="txt">
蜂场数量:{{tjobj.apiaryCount == undefined ? '' : tjobj.apiaryCount}}
蜂场数量:{{tjobj.apiaryCount == undefined ? '--' : tjobj.apiaryCount}}
</view>
</view>
<view class="tip_cont" style="margin-top: 48rpx;">
<image src="https://api.ccttiot.com/smartmeter/img/static/ufgkE5w8AND4eLZD94RR" mode=""></image>
<view class="txt">
24h预警:{{tjobj.warnCount == undefined ? '' : tjobj.warnCount}}
24h预警:{{tjobj.warnCount == undefined ? '--' : tjobj.warnCount}}
</view>
</view>
</view>
@ -98,7 +98,7 @@
电量不足
</view>
<view class="cont_bot">
{{yjobj[4].count == undefined ? '' : yjobj[4].count}}
{{yjobj[4].count == undefined ? '--' : yjobj[4].count}}
</view>
</view>
<view class="cont">
@ -106,7 +106,7 @@
出勤异常
</view>
<view class="cont_bot">
{{yjobj[5].count == undefined ? '' : yjobj[5].count}}
{{yjobj[5].count == undefined ? '--' : yjobj[5].count}}
</view>
</view>
<view class="cont">
@ -114,7 +114,7 @@
重量异常
</view>
<view class="cont_bot">
{{yjobj[3].count == undefined ? '' : yjobj[3].count}}
{{yjobj[3].count == undefined ? '--' : yjobj[3].count}}
</view>
</view>
<view class="cont">
@ -122,7 +122,7 @@
温度异常
</view>
<view class="cont_bot">
{{yjobj[1].count == undefined ? '' : yjobj[1].count}}
{{yjobj[1].count == undefined ? '--' : yjobj[1].count}}
</view>
</view>
<view class="cont">
@ -130,7 +130,7 @@
湿度异常
</view>
<view class="cont_bot">
{{yjobj[2].count == undefined ? '' : yjobj[2].count}}
{{yjobj[2].count == undefined ? '--' : yjobj[2].count}}
</view>
</view>
<view class="cont">
@ -138,7 +138,7 @@
声音异常
</view>
<view class="cont_bot">
{{yjobj[6].count == undefined ? '' : yjobj[6].count}}
{{yjobj[6].count == undefined ? '--' : yjobj[6].count}}
</view>
</view>
</view>

View File

@ -3,7 +3,7 @@
<!-- <u-navbar :is-back="false" :title="tittxt" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' height='36' >
</u-navbar> -->
<view class="page1" v-if="!ischeck">
<!-- <view class="page1" v-if="!ischeck">
<view class="tit">
请选择您的身份
</view>
@ -15,25 +15,33 @@
</view>
</view>
</view>
<!-- <view class="cont" @click="type=2" :class="type==2? 'act1':'' ">
<view class="cont" @click="type=2" :class="type==2? 'act1':'' ">
<view class="img">
<image src="https://api.ccttiot.com/smartmeter/img/static/uko7p1h7VgRZgRlCotGY" mode=""></image>
<view class="txt">
认养用户
</view>
</view>
</view> -->
</view>
<view class="btn" @click="chck()">
确定
</view>
</view>
<view class="page2" v-if="ischeck">
</view> v-if="ischeck"-->
<view class="page2" >
<view class="img_box">
<image src="https://api.ccttiot.com/smartmeter/img/static/uko7p1h7VgRZgRlCotGY" mode=""></image>
</view>
<button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" >
授权登录
</button>
<!-- <view class="yinsi">
<u-checkbox-group>
<u-checkbox v-model="checked" shape="circle" size="28"></u-checkbox>
</u-checkbox-group>
<view class="yinsiwz">
我已同意并阅读 <text>服务条款</text> <text>法律条款及隐私政策</text>
</view>
</view> -->
</view>
<view class="inputbox" v-if="false">
@ -71,9 +79,10 @@
},
tittxt:"授权登录",
chooseType:true,
type:0,
type:1,
login:false,
ischeck:false,
checked:false
}
},
methods: {
@ -99,52 +108,61 @@
}
},
getPhoneNumber(e) {
let that = this;
console.log("eeeeeeee", e);
const wxLoginAsync = () => {
return new Promise((resolve, reject) => {
wx.login({
success(res) {
if (res.code) {
console.log('登录!', res);
let data = {
loginCode: res.code,
type: that.type,
mobileCode: e.detail.code,
deptId:100,
};
resolve(data);
} else {
reject(res.errMsg);
}
},
fail(err) {
reject(err);
}
});
});
};
wxLoginAsync()
.then(async (data) => {
this.$u.post("/app/auth/wxLogin",data).then((res) => {
// this.$forceUpdate()
if (res.code == 200) {
console.log(res,'resres');
wx.setStorageSync('token', res.token);
that.ceshi()
}else{
uni.showToast({
title: res.code,
icon: 'none',
duration: 1000
});
}
});
})
.catch((err) => {
console.error(err);
});
// if(this.checked == false){
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 1000
// })
// }else{
let that = this;
console.log("eeeeeeee", e);
const wxLoginAsync = () => {
return new Promise((resolve, reject) => {
wx.login({
success(res) {
if (res.code) {
console.log('登录!', res);
let data = {
loginCode: res.code,
type: that.type,
mobileCode: e.detail.code,
deptId:100,
};
resolve(data);
} else {
reject(res.errMsg);
}
},
fail(err) {
reject(err);
}
});
});
};
wxLoginAsync()
.then(async (data) => {
this.$u.post("/app/auth/wxLogin",data).then((res) => {
// this.$forceUpdate()
if (res.code == 200) {
console.log(res,'resres');
wx.setStorageSync('token', res.token);
that.ceshi()
}else{
uni.showToast({
title: res.code,
icon: 'none',
duration: 1000
});
}
});
})
.catch((err) => {
console.error(err);
});
// }
},
async ceshi() {
this.$u.get("/app/user/userInfo").then((res) => {
@ -159,6 +177,24 @@
</script>
<style lang="scss" >
/deep/ .u-checkbox{
display: block !important;
}
.yinsi{
width: 100%;
justify-content: center;
display: flex;
align-items: center;
font-size: 24rpx;
margin-top: 56rpx;
color: #979797;
.yinsiwz{
margin-left: 4rpx;
}
text{
color: #fff;
}
}
page{
background: #FFFFFF;
background-image: url('https://api.ccttiot.com/smartmeter/img/static/uSDAKkwGLuWmNUnwnm6m');
@ -242,7 +278,7 @@
height: 90rpx;
background: #FFF5D6;
border-radius: 54rpx 54rpx 54rpx 54rpx;
line-height: 90rpx;
font-weight: 500;
font-size: 40rpx;
color: #FFC107;

View File

@ -3,9 +3,9 @@
<u-navbar :is-back="false" title="我的" :border-bottom="false" :background="bgc" title-color='#3D3D3D '
title-size='36' height='45' id="navbar">
</u-navbar>
<!-- <view class="sblr" @click="btnluru">
<view class="sblr" @click="btnluru" v-if="deviceAdmin">
设备录入
</view> -->
</view>
<view class="atv">
<button
v-if="imglist == ''" style="border: 0;outline: none;width: 220rpx;padding-left: 0rpx;height: 220rpx;border-radius: 50%;background: #D8D8D8;"
@ -55,7 +55,8 @@
title: "我的",
userobj:{},
imglist:'',
token:''
token:'',
deviceAdmin:false
}
},
onLoad() {
@ -90,6 +91,7 @@
if (res.code == 200) {
this.userobj = res.data
this.imglist = res.data.avatar
this.deviceAdmin = res.data.deviceAdmin
}
})
},
@ -167,7 +169,7 @@
position: fixed;
top: 200rpx;
right: 20px;
background-color: #D8D8D8;
background-color: #FFC107;
}
page {
background-color: #FAFDFD;