This commit is contained in:
Sliverber 2024-07-01 10:06:13 +08:00
parent 6feb350092
commit 44e9dae6e8
7 changed files with 870 additions and 245 deletions

View File

@ -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;

View File

@ -51,7 +51,7 @@
/* */
"mp-weixin" : {
"libVersion" : "latest",
"appid" : "wx3914d4d7441fb438",
"appid" : "wxe092159cf34ef21a",
"setting" : {
"urlCheck" : false
},

View File

@ -12,8 +12,74 @@
间隔时长
</view>
<view class="set_li">
每隔<view class="ipt_box"><input type="text" class="ips" v-model="code" placeholder=" "
placeholder-class="my-placeholder" /> </view>/ 除螨工作
</view>
<view class="tit">
<image src="https://api.ccttiot.com/smartmeter/img/static/ufvwKG3vcJYtbkf0Oeij" mode=""></image>
保护设置
</view>
<view class="tit1">
<image src="https://api.ccttiot.com/smartmeter/img/static/utZh1saVjZgOBz3orDkL" mode=""></image>
电量保护%
</view>
<view class="set_li">
电量少于<view class="ipt_box"><input type="text" class="ips" v-model="code" placeholder=" "
placeholder-class="my-placeholder" /> </view>加热板/风扇停止工作
</view>
<view class="tit1">
<image src="https://api.ccttiot.com/smartmeter/img/static/utZh1saVjZgOBz3orDkL" mode=""></image>
加热
</view>
<view class="set_li">
箱外温度低于<view class="ipt_box"><input type="text" class="ips" v-model="code" placeholder=" "
placeholder-class="my-placeholder" /> </view>加热板工作
</view>
<view class="set_li">
箱内高于箱外<view class="ipt_box"><input type="text" class="ips" v-model="code" placeholder=" "
placeholder-class="my-placeholder" /> </view>加热板停止工作
</view>
<view class="tit1">
<image src="https://api.ccttiot.com/smartmeter/img/static/utZh1saVjZgOBz3orDkL" mode=""></image>
风扇
</view>
<view class="set_li">
箱内温度高于<view class="ipt_box"><input type="text" class="ips" v-model="code" placeholder=" "
placeholder-class="my-placeholder" /> </view>风扇工作
</view>
<view class="set_li">
箱内温度降到<view class="ipt_box"><input type="text" class="ips" v-model="code" placeholder=" "
placeholder-class="my-placeholder" /> </view>风扇停止工作
</view>
<view class="set_li">
CO₂浓度高于<view class="ipt_box"><input type="text" class="ips" v-model="code" placeholder=" "
placeholder-class="my-placeholder" /> </view>风扇工作
</view>
<view class="set_li">
CO₂浓度低于<view class="ipt_box"><input type="text" class="ips" v-model="code" placeholder=" "
placeholder-class="my-placeholder" /> </view>风扇停止工作
</view>
<view class="tit">
<image src="https://api.ccttiot.com/smartmeter/img/static/ufvwKG3vcJYtbkf0Oeij" mode=""></image>
震动通知
</view>
<view class="tit1">
<image src="https://api.ccttiot.com/smartmeter/img/static/utZh1saVjZgOBz3orDkL" mode=""></image>
单次震动
</view>
<view class="tit1">
<image src="https://api.ccttiot.com/smartmeter/img/static/utZh1saVjZgOBz3orDkL" mode=""></image>
持续震动
</view>
<view class="btn_box">
<view class="btns">
重置
</view>
<view class="btn1">
保存
</view>
</view>
</view>
</template>
@ -25,6 +91,7 @@
backgroundColor: " #F4FAF8",
},
title: "设置",
code:''
}
},
@ -50,35 +117,113 @@
// position: relative;
width: 750rpx;
padding: 40rpx;
.btn_box{
margin-top: 136rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
.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 {
margin-top: 32rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
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;
}
}
}
}
</style>

View File

@ -37,16 +37,19 @@
<view class="tit">
照片
</view>
<view class="imgbox" @click="btn">
<view class="imgbox" @click="btn" v-if="userImgs==''">
<view class="">
</view>
<image src="https://api.ccttiot.com/smartmeter/img/static/uLpiGDDDvBwk7hOhOtVp" mode="" v-if=""></image>
</view>
<view class="imgbox" @click="btn">
<image src="https://api.ccttiot.com/smartmeter/img/static/uLpiGDDDvBwk7hOhOtVp" mode="" v-if=""></image>
<view class="imgbox" v-else>
<image :src="userImgs" mode="" v-if=""></image>
</view>
<u-select v-model="showfengzhong" :list="fengzhongcolumns" title='角色切换' @confirm="confirm"></u-select>
<u-select v-model="showmiyuan" :list="miyuancolumns" title='角色切换' @confirm="confirm"></u-select>
<u-select v-model="showfengzhong" :list="fengzhongcolumns" title='选择蜂种' @confirm="confirm"></u-select>
<u-select v-model="showmiyuan" :list="miyuancolumns" title='选择蜜源' @confirm="confirm"></u-select>
<view class="btn">
确认添加
</view>
@ -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 // delta1
});
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
},
btn() {
let _this = this
let math = 'static/' + _this.$u.guid(20)

View File

@ -203,6 +203,11 @@
this.curtitidx = e.detail.current
// console.log(e, 'aaaa');
},
addApiary(){
uni.navigateTo({
url:'/page_Beehive/add_Beehive'
})
}
}
}

View File

@ -3,7 +3,7 @@
<view class="backImg">
<image src="https://api.ccttiot.com/smartmeter/img/static/utkroSMjT09nmCYaA7FT" mode=""></image>
</view>
<view class="tipbox">
<view class="tipbox" v-if="haveApiary">
<view class="tip_cont">
<image src="https://api.ccttiot.com/smartmeter/img/static/uKW514Tl8TVUiaJW2ygl" mode=""></image>
<view class="txt">
@ -23,24 +23,90 @@
</view>
</view>
</view>
<view class="no_cont" v-if="!haveApiary">
<view class="img" @click="addApiary()">
<image src="https://api.ccttiot.com/smartmeter/img/static/uUZ3MF84e3bKgwAei8Rz" mode=""></image>
</view>
<view class="txt">
当前还没有添加蜂场哦,点击跳转添加蜂场
</view>
</view>
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" v-if="isLoading" />
<view class="warp_box">
<view class="warp_box" v-if="haveApiary">
<swiper class="swiper" :style="{ height: swiperHeight + 'rpx' }" :current='curtitidx'
previous-margin='50rpx' next-margin='50rpx' :circular='true' @change="swiperchange">
<swiper-item v-for="(item, index) in swiperItems" :key="index"
:class="{ 'active': curtitidx === index }">
<swiper-item>
<view class="swiper-item">
<view class="card_box">
<view class="card">
<image src="https://api.ccttiot.com/smartmeter/img/static/uMgejepZdfttR61bJlpP" mode="">
</image>
<view class="card_top">
<view class="top_left">
<image src="https://api.ccttiot.com/smartmeter/img/static/uhsU6Y1K35jxA4aRauzy"
mode=""></image>
近7天蜜蜂总出勤变化
</view>
<view class="top_right">
<view style="width: 1rpx;">
</view>
<view class="txt">
<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
</view>
<view class="echarts">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas4"
canvas-id="uni-ec-canvas" :ec="ec">
</uni-ec-canvas>
</view>
</view>
</view>
</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">
<view class="card_box">
<view class="card">
<view class="card_top">
<view class="top_left">
<image src="https://api.ccttiot.com/smartmeter/img/static/uk7CvwzeU0ukxvS9cBtD"
mode=""></image>
近7天蜂箱总重量变化
</view>
<view class="top_right">
<view style="width: 1rpx;">
</view>
<view class="txt">
<view class="iconfont icon-xiangyou1"></view>
</view>
</view>
</view>
<view class="echarts">
<uni-ec-canvas class="uni-ec-canvas" id="uni-ec-canvas" ref="canvas3"
canvas-id="uni-ec-canvas" :ec="ec">
</uni-ec-canvas>
</view>
</view>
</view>
</view>
</swiper-item>
</swiper>
</view>
<view class="info_cont">
<view class="info_cont" v-if="haveApiary">
<view class="cont">
<view class="cont_top">
电量不足
@ -51,7 +117,7 @@
</view>
<view class="cont">
<view class="cont_top">
电量不足
出勤异常
</view>
<view class="cont_bot">
0
@ -59,7 +125,7 @@
</view>
<view class="cont">
<view class="cont_top">
电量不足
重量异常
</view>
<view class="cont_bot">
0
@ -67,7 +133,7 @@
</view>
<view class="cont">
<view class="cont_top">
电量不足
温度异常
</view>
<view class="cont_bot">
0
@ -75,7 +141,7 @@
</view>
<view class="cont">
<view class="cont_top">
电量不足
湿度异常
</view>
<view class="cont_bot">
0
@ -83,7 +149,7 @@
</view>
<view class="cont">
<view class="cont_top">
电量不足
声音异常
</view>
<view class="cont_bot">
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', //
grid: {
left: '4%',
right: '4%',
bottom: '3%',
top: '4%',
containLabel: true
},
xAxis: {
show: true,
type: 'category',
boundaryGap: false,
axisLine: {
show: false // X线
},
label: {
normal: {
position: 'center',
formatter: ` {a|${value2}}\n\n{b|剩余电量}`, //
rich: {
a: {
fontSize: 15,
fontWeight: '700',
color: '#333',
axisTick: {
show: false // X
},
b: {
axisLabel: {
show: false // X
},
axisLabel: {
show: true,
color: '#ccc',
fontSize: 11,
color: '#888',
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)',
},
// {
// value: 100 - value2,
// name: '',
// label: {
// normal: {
// show: false,
// },
// },
// itemStyle: {
// normal: {
// color: '#173164',
// },
// },
// },
],
},
// {
// 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: '',
// }, ],
// },
],
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,21 +556,25 @@
background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
border-radius: 20rpx 20rpx 20rpx 20rpx;
.cont:nth-child(3n) {
margin-right: 0rpx;
}
.cont {
margin-right: 100rpx;
width: 96rpx;
display: flex;
flex-wrap: wrap;
justify-content: center;
.cont_top {
font-weight: 400;
font-size: 24rpx;
color: #808080;
}
.cont_bot {
margin-top: 4rpx;
@ -350,13 +609,71 @@
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 {
width: 638rpx;
height: 428rpx;
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;
}
}
}
}
}

View File

@ -1,15 +1,42 @@
<template>
<view class="page">
<u-navbar :is-back="false" :title="tittxt" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' height='36' >
<!-- <u-navbar :is-back="false" :title="tittxt" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' height='36' >
</u-navbar>
<view class="imgbox">
<image src="https://api.ccttiot.com/smartmeter/img/static/uCqHftk2W2zEPX03DLcb" mode=""></image>
</u-navbar> -->
<view class="page1" v-if="!ischeck">
<view class="tit">
请选择您的身份
</view>
<view class="tip">
欢迎来到e租居
<view class="cont" @click="type=1" :class="type==1? 'act1':'' " >
<view class="img">
<image src="https://api.ccttiot.com/smartmeter/img/static/u9G5tgpJskUSaT16Shn6" mode=""></image>
<view class="txt">
养蜂人
</view>
<view class="inputbox">
</view>
</view>
<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 class="btn" @click="chck()">
确定
</view>
</view>
<view class="page2" v-if="ischeck">
<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>
<view class="inputbox" v-if="false">
<!-- 在这里放置你的输入框 -->
<view class="box1" v-if="chooseType">
<view class="input_txt">
@ -22,7 +49,7 @@
我是租户
</div>
</view>
<view class="box1" v-if="login">
<!-- <view class="box1" v-if="login">
<view class="input_txt" style="width: 536rpx;font-size: 24rpx;line-height: 32rpx;">
您暂未授权e租居小程序获取你的信息将无法正常使用小程序的功能如需要正常使用请点击授权按钮打开头像昵称等信息的授权
</view>
@ -30,7 +57,7 @@
<button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" style="margin-top: 330rpx;margin-left: -10rpx;" >
授权登录
</button>
</view>
</view> -->
</view>
</view>
</template>
@ -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,6 +136,12 @@
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 @@
<style lang="scss" >
page{
background: #FFFFFF;
background-image: url('https://api.ccttiot.com/smartmeter/img/static/uSDAKkwGLuWmNUnwnm6m');
background-size: cover;
/* 确保背景图覆盖整个区域 */
background-repeat: no-repeat;
/* 防止背景图重复 */
background-position: center;
}
.page {
position: relative; /* 添加相对定位 */
}
.imgbox {
width: 750rpx;
height: 576rpx;
z-index: 0;
image {
width: 750rpx;
height: 576rpx;
}
}
.tip {
width: 204rpx;
position: absolute;
top: 400rpx;
left: 30rpx;
padding: 0 64rpx;
.page1{
.tit{
margin-top: 200rpx;
font-weight: 500;
font-size: 48rpx;
font-size: 40rpx;
color: #FFFFFF;
line-height: 66rpx;
}
.inputbox {
position: absolute; /* 或者 fixed根据你的需求 */
top: 700rpx; /* 调整这里来控制距离顶部的距离 */
width: 750rpx; /* 调整输入框的宽度 */
padding: 100rpx 0;
background: #fff; /* 设置背景颜色,这里是红色的半透明 */
border-radius: 50rpx; /* 设置圆角 */
z-index: 999; /* 设置 z-index确保在其他内容上方显示 */
padding-left: 104rpx;
.input_txt{
font-weight: 400;
font-size: 32rpx;
color: #3D3D3D;
line-height: 44rpx;
}
.button{
margin-top: 64rpx;
.cont{
display: flex;
justify-content: center;
align-items: center;
width: 562rpx;
height: 96rpx;
background: #8883F0;
border-radius: 52rpx 52rpx 52rpx 52rpx;
margin-top: 52rpx;
width: 620rpx;
height: 366rpx;
background: #FFF5D6;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0,0,0,0.15);
border-radius: 30rpx 30rpx 30rpx 30rpx;
.img{
width: 208rpx;
image{
width: 208rpx;
height: 208rpx;
}
.txt{
width: 100%;
text-align: center;
font-weight: 500;
font-size: 40rpx;
color: #3D3D3D;
}
}
}
.act1{
background: #FFE593;
}
.btn{
display: flex;
justify-content: center;
align-items: center;
margin-top: 134rpx;
width: 620rpx;
height: 86rpx;
background: #FFE47F;
border-radius: 16rpx 16rpx 16rpx 16rpx;
font-weight: 500;
font-size: 36rpx;
color: #FFFFFF;
}
}
.page2{
.img_box{
margin-top: 250rpx;
margin-left: 86rpx;
width: 452rpx;
height: 452rpx;
image{
width: 452rpx;
height: 452rpx;
}
}
.button{
margin-top: 204rpx;
margin-left: 18rpx;
width: 586rpx;
height: 90rpx;
background: #FFF5D6;
border-radius: 54rpx 54rpx 54rpx 54rpx;
font-weight: 500;
font-size: 40rpx;
color: #FFC107;
}
}
}
</style>