diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 40204f9..c8d9ccf 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -20,8 +20,8 @@ const install = (Vue, vm) => { // }, // }); Vue.prototype.$u.http.setConfig({ - // baseUrl: 'http://192.168.2.88/dev-api', - baseUrl: 'https://znb.ccttiot.com/prod-api/', + baseUrl: 'http://192.168.2.10:3202', + // baseUrl: '192.168.2.10:3202/app', loadingText: '努力加载中~', loadingTime: 800, // 设置自定义头部content-type @@ -46,9 +46,9 @@ const install = (Vue, vm) => { // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的 // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 - // const token = uni.getStorageSync('token'); + const token = uni.getStorageSync('token'); - const token = " eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjY2ODhkNGE3LWM1MzctNGE2Mi1hMGNlLWIwOWUyZjhjOWM5OCJ9.umR5ryK0CA8zrnq04XBj21-Z-yaOwQ3oCv1cYga2bo6I-CAvR_WVM-wn9h8ZaJGqYpLhU6wdxjlD78y1coNWFg" + // const token = " eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjY2ODhkNGE3LWM1MzctNGE2Mi1hMGNlLWIwOWUyZjhjOWM5OCJ9.umR5ryK0CA8zrnq04XBj21-Z-yaOwQ3oCv1cYga2bo6I-CAvR_WVM-wn9h8ZaJGqYpLhU6wdxjlD78y1coNWFg" // console.log("我是token", token) config.header.Authorization = token; diff --git a/manifest.json b/manifest.json index d273adc..471ff5b 100644 --- a/manifest.json +++ b/manifest.json @@ -51,7 +51,7 @@ /* 小程序特有相关 */ "mp-weixin" : { "libVersion" : "latest", - "appid" : "wx3914d4d7441fb438", + "appid" : "wxe092159cf34ef21a", "setting" : { "urlCheck" : false }, diff --git a/page_user/user_set.vue b/page_user/user_set.vue index b72f094..2f505f5 100644 --- a/page_user/user_set.vue +++ b/page_user/user_set.vue @@ -12,8 +12,74 @@ 间隔时长 + 每隔 天/次 除螨工作 + + + + 保护设置 + + + + 电量保护(%) + + + 电量少于 加热板/风扇停止工作 + + + + 加热(℃) + + + 箱外温度低于 加热板工作 + + + 箱内高于箱外 加热板停止工作 + + + + 风扇(℃) + + + 箱内温度高于 风扇工作 + + + 箱内温度降到 风扇停止工作 + + + CO₂浓度高于 风扇工作 + + + CO₂浓度低于 风扇停止工作 + + + + 震动通知 + + + + 单次震动 + + + + 持续震动 + + + 重置 + + + 保存 + + @@ -25,6 +91,7 @@ backgroundColor: " #F4FAF8", }, title: "设置", + code:'' } }, @@ -35,7 +102,7 @@ }, methods: { - + } } @@ -50,35 +117,113 @@ // position: relative; width: 750rpx; padding: 40rpx; - .tit{ + .btn_box{ + margin-top: 136rpx; display: flex; flex-wrap: nowrap; align-items: center; - image{ + .btns{ + display: flex; + align-items: center; + justify-content: center; + width: 322rpx; + height: 88rpx; + background: #FFF5D6; + border-radius: 20rpx 20rpx 20rpx 20rpx; + border: 2rpx solid #FFC107; + + font-weight: 500; + font-size: 32rpx; + color: #FFC107; + } + .btn1{ + display: flex; + align-items: center; + justify-content: center; + margin-left: 30rpx; + width: 322rpx; + height: 88rpx; + background: #FFCC25; + border-radius: 20rpx 20rpx 20rpx 20rpx; + + font-weight: 500; + font-size: 32rpx; + color: #3D3D3D; + } + } + .tit { + display: flex; + flex-wrap: nowrap; + align-items: center; + + image { margin-right: 22rpx; width: 52rpx; height: 52rpx; - + } + font-weight: 600; font-size: 36rpx; color: #3D3D3D; } - .tit1{ + + .tit1 { margin-top: 32rpx; display: flex; flex-wrap: nowrap; align-items: center; - image{ + + image { margin-right: 18rpx; width: 46rpx; height: 46rpx; - + } + font-weight: 400; font-size: 32rpx; color: #3D3D3D; } + .set_li { + margin-top: 34rpx; + margin-left: 104rpx; + display: flex; + flex-wrap: nowrap; + align-items: center; + font-weight: 400; + font-size: 32rpx; + color: #808080; + + .ipt_box { + display: flex; + align-items: center; + justify-content: center; + margin: 0 16rpx; + // width: 98rpx; + height: 88rpx; + background: #FFFFFF; + box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); + border-radius: 20rpx 20rpx 20rpx 20rpx; + .ips { + margin-left: 15rpx; + width: 100rpx; + + } + + + + .my-placeholder { + font-weight: 400; + font-size: 32rpx; + color: #808080; + } + + } + + + } + } \ No newline at end of file diff --git a/pages/Apiary/AddApiary.vue b/pages/Apiary/AddApiary.vue index 80346b9..67631e8 100644 --- a/pages/Apiary/AddApiary.vue +++ b/pages/Apiary/AddApiary.vue @@ -37,16 +37,19 @@ 照片 - + + + + - - + + - - + + 确认添加 @@ -64,7 +67,7 @@ }, code: '', fengzhongcolumns: [ - [] + ], miyuancolumns: [ { @@ -99,16 +102,88 @@ lng: 0, address: '', }, - upurl:'' + + userImgs: '', + token: '', + sn:'', + upurl:'https://api.ccttiot.com/' } }, onLoad() { }, onShow() { - + this.getQiniuToken() + this.getfengzhongcolumns() + this.getmiyuancolumns() }, methods: { + getQiniuToken() { + this.$u.get("/common/qiniu/uploadInfo").then((res) => { + if (res.code == 200) { + this.token=res.token + + } + }); + // this.$u.get('https://v2.ielts.langsi.online/file/getToken').then(res => { + // console.log(res.data); + // this.token = res.data.token + // }).catch(err => { + // console.log(err) + // }) + + }, + getfengzhongcolumns() { + let data ={ + dictType:'apiary_bee_type' + } + this.$u.get("/common/getDictByType?",data).then((res) => { + if (res.code == 200) { + this.fengzhongcolumns = res.data.map(item => ({ + value: item.dictValue, + label: item.dictLabel + })); + + } + }); + + }, + getmiyuancolumns() { + let data ={ + dictType:'apiary_honey_type' + } + this.$u.get("/common/getDictByType?",data).then((res) => { + if (res.code == 200) { + this.miyuancolumns = res.data.map(item => ({ + value: item.dictValue, + label: item.dictLabel + })); + + } + }); + + + }, + addApiary(){ + let data ={ + + } + this.$u.get('/farm/apiary',data ).then((res) => { + + if (res.code === 200) { + uni.navigateBack({ + delta: 1 // delta值为1时表示返回的页面层数 + }); + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + + } + }) + }, btn() { let _this = this let math = 'static/' + _this.$u.guid(20) diff --git a/pages/Beehive.vue b/pages/Beehive.vue index 1603d4f..1d00fdd 100644 --- a/pages/Beehive.vue +++ b/pages/Beehive.vue @@ -203,6 +203,11 @@ this.curtitidx = e.detail.current // console.log(e, 'aaaa'); }, + addApiary(){ + uni.navigateTo({ + url:'/page_Beehive/add_Beehive' + }) + } } } diff --git a/pages/index/index.vue b/pages/index/index.vue index 2386c29..9378400 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -3,7 +3,7 @@ - + @@ -23,24 +23,90 @@ + + + + + + 当前还没有添加蜂场哦,点击跳转添加蜂场 + + - + - + - - + + + + + 近7天蜜蜂总出勤变化 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 近7天蜂箱总重量变化 + + + + + + + + + + + + + + + + + + - + 电量不足 @@ -51,7 +117,7 @@ - 电量不足 + 出勤异常 0 @@ -59,7 +125,7 @@ - 电量不足 + 重量异常 0 @@ -67,7 +133,7 @@ - 电量不足 + 温度异常 0 @@ -75,7 +141,7 @@ - 电量不足 + 湿度异常 0 @@ -83,13 +149,13 @@ - 电量不足 + 声音异常 0 - + @@ -121,146 +187,316 @@ loading: '努力加载中', nomore: '实在没有了' }, - curtitidx: 1, + curtitidx: 0, swiperHeight: 426, activeSwiperHeight: 500, // 激活的swiper高度 - swiperItems: [1, 2, 3], // Placeholder for swiper items + swiperItems: [1, 2, ], // Placeholder for swiper items + numdata:[], + haveApiary:true } }, onShow() { + + + this.ishave() + // setTimeout(() => { + + // this.$refs.canvas4.init(this.initChart4) + + // }, 200); + }, onPullDownRefresh() { - - - }, methods: { + addApiary(){ + uni.navigateTo({ + url:'/pages/Apiary/AddApiary' + }) + }, + ishave(){ + let data ={ + pageNum:1, + pageSize:0 + } + this.$u.get('/farm/apiary/list?',data ).then((res) => { + + if (res.code === 200) { + if(res.total>1){ + this.getnum() + }else{ + this.haveApiary=false + } + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + + } + }) + }, swiperchange(e) { this.curtitidx = e.detail.current // console.log(e, 'aaaa'); }, - initChart(canvas, width, height, canvasDpr) { + getnum(){ + const currentDate = new Date(); + + // 获取前七天的日期 + const sevenDaysAgoDate = new Date(); + sevenDaysAgoDate.setDate(currentDate.getDate() - 7); + + // 格式化日期为 'YYYY-MM-DD' + const formatDate = (date) => { + const year = date.getFullYear(); + const month = (date.getMonth() + 1).toString().padStart(2, '0'); + const day = date.getDate().toString().padStart(2, '0'); + return `${year}-${month}-${day}`; + }; + + const currentDateString = formatDate(currentDate); + const sevenDaysAgoDateString = formatDate(sevenDaysAgoDate); + + // 赋值给 data 中的 dateRange + let data = { + dateRange: `${sevenDaysAgoDateString},${currentDateString}` + }; + this.$u.get('/farmer/report/ioCount?',data ).then((res) => { + + if (res.code === 200) { + this.numdata=res.data + this.$refs.canvas3.init(this.initChart4) + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + + } + }) + }, + // 进出量 + initChart4(canvas, width, height, canvasDpr) { let that = this - console.log(canvas, width, height, canvasDpr) - let value = 100; - let value2 = this.deviceInfo.totalElectriQuantity + const option = { - // backgroundColor:"#061740", - // title: { - // show: false, - // text: `历史请求满意度`, // 图表标题 - // x: 'center', - // y: '20', - // textStyle: { - // color: '#333', //'#fff', - // fontSize: 20, - // }, - // }, - series: [{ - type: 'pie', // 饼图类型 - radius: ['98%', '70%'], // 饼图半径,第一个值是内半径,第二个值是外半径 - silent: true, - clockwise: true, - startAngle: 90, // 起始角度 - z: 0, - zlevel: 0, - data: [{ - value: value, - name: '占比', // 数据项名称 - itemStyle: { - normal: { - color: '#8883F0', // 数据项颜色 - }, - }, - label: { - normal: { - position: 'center', - formatter: ` {a|${value2}}\n\n{b|剩余电量}`, // 标签内容格式 - rich: { - a: { - fontSize: 15, - fontWeight: '700', - color: '#333', - }, - b: { - fontSize: 11, - color: '#888', - }, - }, - }, - }, - }, - // { - // value: 100 - value2, - // name: '', - // label: { - // normal: { - // show: false, - // }, - // }, - // itemStyle: { - // normal: { - // color: '#173164', - // }, - // }, - // }, - ], + grid: { + left: '4%', + right: '4%', + bottom: '3%', + top: '4%', + containLabel: true + }, + xAxis: { + show: true, + type: 'category', + boundaryGap: false, + axisLine: { + show: false // 隐藏X轴线 }, - // { - // type: 'gauge', // 仪表盘类型 - // radius: '130%', // 仪表盘半径,占图表容器的百分比 - // center: ['50%', '50%'], // 仪表盘中心位置 - // startAngle: 359, - // endAngle: 359.9, - // splitNumber: 2, // 刻度分割段数 - // hoverAnimation: true, - // axisTick: { - // show: true, // 是否显示刻度线 - // length: 10, // 刻度线长度 - // lineStyle: { - // color: 'auto', - // width: 1, - // }, - // }, - // splitLine: { - // length: 0, // 刻度线分隔线长度 - // lineStyle: { - // width: 1, - // color: '#061740', - // }, - // }, - // axisLabel: { - // show: false, // 是否显示刻度标签 - // }, - // pointer: { - // show: false, // 是否显示指针 - // }, - // axisLine: { - // lineStyle: { - // opacity: 0, - // }, - // }, - // detail: { - // show: false, // 是否显示仪表盘详情 - // }, - // data: [{ - // value: 0, - // name: '', - // }, ], - // }, - ], + axisTick: { + show: false // 隐藏X轴刻度 + }, + axisLabel: { + show: false // 隐藏X轴标签 + }, + axisLabel: { + show: true, + color: '#ccc', + fontSize: 11, + rotate: 0, + }, + splitLine: { + show: false, + }, + // data: that.chartday, + }, + yAxis: { + show: true, + axisLine: { + show: false, + }, + axisTick: { + show: false, + }, + axisLabel: { + show: true, + color: '#ccc', + fontSize: 11, + formatter: function(value) { + // 保留两位小数,没有小数时显示00 + return value + '只' + }, + }, + splitLine: { + show: true, // 显示X轴网格线 + lineStyle: { + type: 'dashed', // 设置网格线为虚线 + color: '#ccc', // 可以设置虚线的颜色 + width: 1 // 可以设置虚线的宽度 + } + } + }, + visualMap: { + type: 'piecewise', + show: false, + dimension: 0, + seriesIndex: 0, + pieces: [{ + gt: 1, + lt: 3, + color: 'RGBA(255, 241, 201, 1)', + }, + { + gt: 5, + lt: 7, + color: 'RGBA(255, 241, 201, 1)', + }, + ], + }, + series: [{ + type: 'line', + smooth: 0.6, + symbol: 'none', + lineStyle: { + color: '#FFE28C', + width: 4, + }, + areaStyle: { + normal: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ + offset: 0, + color: '#FFF1C9' + }, ]), + }, + }, + data: that.numdata.map(item => item.value), + }], }; chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: canvasDpr }) - console.log(chart); - // option.series[0].data = that.chartData + + + canvas.setChart(chart) + chart.setOption(option) + return chart + }, + //重量 + initChart3(canvas, width, height, canvasDpr) { + let that = this + + const option = { + grid: { + left: '2%', + right: '10%', + bottom: '3%', + top: '4%', + containLabel: true + }, + xAxis: { + show: true, + type: 'category', + boundaryGap: false, + axisLine: { + show: false // 隐藏X轴线 + }, + axisTick: { + show: false // 隐藏X轴刻度 + }, + axisLabel: { + show: false // 隐藏X轴标签 + }, + axisLabel: { + show: true, + color: '#ccc', + fontSize: 11, + rotate: 0, + }, + splitLine: { + show: false, + }, + // data: that.chartday, + // data: that.numdata.map(item => item.date) + }, + yAxis: { + show: true, + axisLine: { + show: false, + }, + axisTick: { + show: false, + }, + axisLabel: { + show: true, + color: '#ccc', + fontSize: 11, + formatter: function(value) { + // 保留两位小数,没有小数时显示00 + return value + 'Kg' + }, + }, + splitLine: { + show: true, // 显示X轴网格线 + lineStyle: { + type: 'dashed', // 设置网格线为虚线 + color: '#ccc', // 可以设置虚线的颜色 + width: 1 // 可以设置虚线的宽度 + } + } + }, + visualMap: { + type: 'piecewise', + show: false, + dimension: 0, + seriesIndex: 0, + pieces: [{ + gt: 1, + lt: 3, + color: 'RGBA(255, 241, 201, 1)', + }, + { + gt: 5, + lt: 7, + color: 'RGBA(255, 241, 201, 1)', + }, + ], + }, + series: [{ + type: 'line', + smooth: 0.6, + symbol: 'none', + lineStyle: { + color: '#FFE28C', + width: 4, + }, + areaStyle: { + normal: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ + offset: 0, + color: '#FFF1C9' + }, ]), + }, + }, + data: that.numdata.map(item => item.value), + }], + }; + chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: canvasDpr + }) + + canvas.setChart(chart) chart.setOption(option) return chart @@ -289,7 +525,26 @@ height: 870rpx; } } - + .no_cont { + margin: 500rpx auto 0; + width: 432rpx; + + .img { + image { + width: 432rpx; + height: 432rpx; + } + } + + .txt { + margin-top: 50rpx; + width: 100%; + text-align: center; + font-weight: 500; + font-size: 32rpx; + color: #808080; + } + } .info_cont { display: flex; flex-wrap: wrap; @@ -301,23 +556,27 @@ background: #FFFFFF; box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); border-radius: 20rpx 20rpx 20rpx 20rpx; - .cont:nth-child(3n){ + + .cont:nth-child(3n) { margin-right: 0rpx; } - .cont{ + + .cont { margin-right: 100rpx; width: 96rpx; display: flex; flex-wrap: wrap; justify-content: center; - .cont_top{ + + .cont_top { font-weight: 400; font-size: 24rpx; color: #808080; - + } - .cont_bot{ - + + .cont_bot { + margin-top: 4rpx; width: 96rpx; text-align: center; @@ -329,38 +588,96 @@ } .warp_box { - margin-top: 128rpx; - - .swiper { - .swiper-item { + margin-top: 128rpx; + + .swiper { + .swiper-item { + display: flex; + justify-content: center; + transition: height 0.3s ease-in-out; + + &.active { + height: 500rpx; // 激活状态的高度 + } + + &:not(.active) { + height: 426rpx; // 非激活状态的高度 + } + + .card_box { display: flex; - justify-content: center; - transition: height 0.3s ease-in-out; - - &.active { - height: 500rpx; // 激活状态的高度 - } - - &:not(.active) { - height: 426rpx; // 非激活状态的高度 - } - - .card_box { - display: flex; - flex-wrap: wrap; - - .card { - width: 638rpx; - - image { - width: 638rpx; - height: 428rpx; + flex-wrap: wrap; + + .card { + padding: 18rpx; + width: 638rpx; + height: 426rpx; + background: #FFFFFF; + box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); + border-radius: 28rpx 28rpx 28rpx 28rpx; + + .card_top { + display: flex; + align-items: center; + .top_left { + + display: flex; + align-items: center; + font-weight: 400; + font-size: 36rpx; + color: #3D3D3D; + + image { + margin-right: 24rpx; + margin-left: 28rpx; + width: 25.03rpx; + height: 34rpx; + } + } + + .top_cont { + width: 33.33%; + text-align: center; + font-weight: 600; + font-size: 36rpx; + color: #3D3D3D; + } + + .top_right { + margin-left: auto; + display: flex; + align-items: center; + + .txt { + display: flex; + align-items: center; + flex-wrap: nowrap; + margin-left: auto; + font-weight: 400; + font-size: 32rpx; + color: #4D4D4D; + + .icon-xiangyou1 { + margin-top: 4rpx; + margin-left: 8rpx; + } + } } } + .echarts { + + margin-top: 24rpx; + width: 100%; + // height: 80%; + + height: 344rpx; + } } + } } } + } .tipbox { width: 300rpx; diff --git a/pages/login/login.vue b/pages/login/login.vue index a2b9600..92e8013 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -1,15 +1,42 @@ @@ -44,11 +71,24 @@ }, tittxt:"授权登录", chooseType:true, - usertype:'', - login:false + type:0, + login:false, + ischeck:false, } }, methods: { + chck(){ + if(this.type==0){ + uni.showToast({ + title: '请先选择身份', + icon: 'none', + duration: 1000 + }); + }else{ + this.ischeck=true + } + + }, userType(num){ this.chooseType=false this.login=true @@ -68,9 +108,10 @@ if (res.code) { console.log('登录!', res); let data = { - wxOpenId: res.code, - userType: that.usertype, + loginCode: res.code, + userType: that.type, mobileCode: e.detail.code, + deptId:100, }; resolve(data); } else { @@ -95,7 +136,13 @@ console.log(res,'resres'); wx.setStorageSync('token', res.token); that.ceshi() - } + }else{ + uni.showToast({ + title: res.code, + icon: 'none', + duration: 1000 + }); + } }); }) @@ -118,62 +165,98 @@