浇花器
This commit is contained in:
parent
f5b6a50aed
commit
3570f4d736
|
@ -21,7 +21,7 @@ const install = (Vue, vm) => {
|
||||||
// });
|
// });
|
||||||
Vue.prototype.$u.http.setConfig({
|
Vue.prototype.$u.http.setConfig({
|
||||||
baseUrl: 'https://yxd.ccttiot.com/prod-api',
|
baseUrl: 'https://yxd.ccttiot.com/prod-api',
|
||||||
// baseUrl: 'http://192.168.2.56:8081',
|
// baseUrl: 'http://192.168.0.107:8081',
|
||||||
loadingText: '努力加载中~',
|
loadingText: '努力加载中~',
|
||||||
loadingTime: 800,
|
loadingTime: 800,
|
||||||
// 设置自定义头部content-type
|
// 设置自定义头部content-type
|
||||||
|
@ -115,15 +115,15 @@ const install = (Vue, vm) => {
|
||||||
};
|
};
|
||||||
vm.$u.post(`/loginByopenid?jsCode=${res.code}`,data).then(res=>{
|
vm.$u.post(`/loginByopenid?jsCode=${res.code}`,data).then(res=>{
|
||||||
if (res.code == 10003) {
|
if (res.code == 10003) {
|
||||||
uni.navigateTo({
|
// uni.navigateTo({
|
||||||
url:'/pages/login/login'
|
// url:'/pages/login/login'
|
||||||
})
|
// })
|
||||||
|
|
||||||
} else if (res.code == 200) {
|
} else if (res.code == 200) {
|
||||||
// console.log("老用户登录",res.data)
|
// console.log("老用户登录",res.data)
|
||||||
uni.switchTab({
|
// uni.switchTab({
|
||||||
url:'/pages/index/index'
|
// url:'/pages/index/index'
|
||||||
})
|
// })
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
设置浇水
|
设置浇水
|
||||||
</view>
|
</view>
|
||||||
<view class="ts">
|
<view class="ts">
|
||||||
距离下次浇水时间还有{{xctime}}
|
请设置浇水时间
|
||||||
</view>
|
</view>
|
||||||
<view class="shifen" @click="show = true">
|
<view class="shifen" @click="show = true">
|
||||||
<text>{{hour}}时</text> <text>{{minutekq}}分</text>
|
<text>{{hour}}时</text> <text>{{minutekq}}分</text>
|
||||||
|
|
|
@ -101,8 +101,18 @@
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.userid = res.data.userId
|
this.userid = res.data.userId
|
||||||
}else if(res.code == 401){
|
}else if(res.code == 401){
|
||||||
uni.navigateTo({
|
uni.showModal({
|
||||||
url:'/pages/login/login'
|
title: '提示',
|
||||||
|
content: '您还未登录,是否前去登录?',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url:'/pages/login/login'
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -116,6 +126,7 @@
|
||||||
userId:this.userid,
|
userId:this.userid,
|
||||||
pre:e.slice(0,5)
|
pre:e.slice(0,5)
|
||||||
}
|
}
|
||||||
|
console.log(data);
|
||||||
this.$u.post(`/app/bandDevice`,data).then((res) => {
|
this.$u.post(`/app/bandDevice`,data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
@ -152,7 +163,7 @@
|
||||||
'isStart': false
|
'isStart': false
|
||||||
})
|
})
|
||||||
if (that.devicesList.length > 0) {
|
if (that.devicesList.length > 0) {
|
||||||
that.flags = true
|
// that.flags = true
|
||||||
this.$u.get(`/app/device/isBand/${this.arr}`).then(res =>{
|
this.$u.get(`/app/device/isBand/${this.arr}`).then(res =>{
|
||||||
if(res.code == 200){
|
if(res.code == 200){
|
||||||
res.data.forEach(item =>{
|
res.data.forEach(item =>{
|
||||||
|
|
|
@ -118,7 +118,8 @@
|
||||||
file:'',
|
file:'',
|
||||||
intervalId: null,
|
intervalId: null,
|
||||||
progress:0,
|
progress:0,
|
||||||
shengjiflag:false
|
shengjiflag:false,
|
||||||
|
xctime:'--'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 分享到好友(会话)
|
// 分享到好友(会话)
|
||||||
|
@ -139,10 +140,18 @@
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||||
this.deviceid = option.deviceid
|
this.deviceid = option.deviceid
|
||||||
if(option.ver != undefined && option.ver != null){
|
if(option.xctime){
|
||||||
this.ver = option.ver
|
if(option.xctime != '--' && option.ver){
|
||||||
this.getbanben()
|
this.ver = option.ver
|
||||||
|
this.xctime = option.xctime
|
||||||
|
console.log(11);
|
||||||
|
}else{
|
||||||
|
this.ver = 1
|
||||||
|
this.xctime = option.xctime
|
||||||
|
console.log(22);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getshebxq()
|
this.getshebxq()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -154,7 +163,7 @@
|
||||||
content: '您确定要解绑当前设备吗?',
|
content: '您确定要解绑当前设备吗?',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
that.$u.delete(`//app/device/unbind/${that.deviceid}`).then(res => {
|
that.$u.delete(`/app/device/unbind/${that.deviceid}`).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '解绑成功',
|
title: '解绑成功',
|
||||||
|
@ -185,6 +194,7 @@
|
||||||
this.$u.get(`/app/getDeviceInfo/${this.deviceid}`).then(res => {
|
this.$u.get(`/app/getDeviceInfo/${this.deviceid}`).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.user = res.data
|
this.user = res.data
|
||||||
|
this.getbanbens()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -198,11 +208,20 @@
|
||||||
this.xptxt = e[0].label
|
this.xptxt = e[0].label
|
||||||
},
|
},
|
||||||
getbanben(){
|
getbanben(){
|
||||||
this.$u.get(`/app/getVersion?version=${this.ver.slice(3)}`).then(res => {
|
this.$u.get(`/app/model/${this.user.modelId}`).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.file = res.data.file
|
this.file = res.data.asDeviceVersion.file
|
||||||
console.log(this.file);
|
console.log(this.file)
|
||||||
// this.file = 'https://www.zenghi.com/gj/water_flower.bin'
|
// this.file = 'https://wc.chuangtewl.com/download/water_flower.bin'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getbanbens(){
|
||||||
|
this.$u.get(`/app/model/${this.user.modelId}`).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.file = res.data.asDeviceVersion.file
|
||||||
|
console.log(this.file)
|
||||||
|
// this.file = 'https://wc.chuangtewl.com/download/water_flower.bin'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -219,8 +238,15 @@
|
||||||
// 选择固件版本
|
// 选择固件版本
|
||||||
gjconfirm(e) {
|
gjconfirm(e) {
|
||||||
// this.gjtxt = e[0].label
|
// this.gjtxt = e[0].label
|
||||||
if(this.ver != ''){
|
// if(this.ver != ''){
|
||||||
if(this.file != ''){
|
if(this.file == '' || this.file == null){
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无新版本',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
console.log('更新');
|
||||||
var data = {
|
var data = {
|
||||||
sum: 100,
|
sum: 100,
|
||||||
http: this.file
|
http: this.file
|
||||||
|
@ -230,20 +256,14 @@
|
||||||
})
|
})
|
||||||
this.shengjiflag = true
|
this.shengjiflag = true
|
||||||
this.startProgress()
|
this.startProgress()
|
||||||
}else{
|
|
||||||
uni.showToast({
|
|
||||||
title: '暂无新版本',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}else{
|
// }else{
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: '请连接蓝牙获取版本号',
|
// title: '请连接蓝牙获取版本号',
|
||||||
icon: 'none',
|
// icon: 'none',
|
||||||
duration: 2000
|
// duration: 2000
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
// 点击取消修改设备名称
|
// 点击取消修改设备名称
|
||||||
btnqx() {
|
btnqx() {
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
<u-navbar :is-back="true" :title='tit' title-color="#000" :border-bottom="false" :background="bgc"
|
<u-navbar :is-back="true" :title='tit' title-color="#000" :border-bottom="false" :background="bgc"
|
||||||
id="navbar">
|
id="navbar">
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
<view class="" v-html="cont">
|
<view class="" v-html="cont"></view>
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -29,7 +26,6 @@
|
||||||
path: '/pages/index/index'
|
path: '/pages/index/index'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 分享到朋友圈
|
// 分享到朋友圈
|
||||||
onShareTimeline: function() {
|
onShareTimeline: function() {
|
||||||
return {
|
return {
|
||||||
|
@ -55,7 +51,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-title{
|
/deep/ .u-title{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
|
@ -69,6 +65,4 @@
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
|
@ -390,26 +390,26 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
wx.openBluetoothAdapter({
|
wx.openBluetoothAdapter({
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
console.log('蓝牙适配器初始化成功');
|
console.log('蓝牙适配器初始化成功');
|
||||||
},
|
},
|
||||||
fail: function (err) {
|
fail: function (err) {
|
||||||
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err);
|
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '蓝牙适配器初始化失败,可能是因为没有权限',
|
title: '蓝牙适配器初始化失败,可能是因为没有权限',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration:2000
|
duration:2000
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.vardataflag = 1
|
this.vardataflag = 1
|
||||||
xBlufi.initXBlufi(1)
|
xBlufi.initXBlufi(1)
|
||||||
let that = this
|
let that = this
|
||||||
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent)
|
xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent)
|
||||||
xBlufi.notifyStartDiscoverBle({
|
xBlufi.notifyStartDiscoverBle({
|
||||||
'isStart': true
|
'isStart': true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
// 请求个人信息
|
// 请求个人信息
|
||||||
|
@ -465,19 +465,7 @@
|
||||||
taht.getinfo()
|
taht.getinfo()
|
||||||
uni.setStorageSync('token', res.token)
|
uni.setStorageSync('token', res.token)
|
||||||
}else{
|
}else{
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '您还未登录,是否前去登录?',
|
|
||||||
success: function (res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url:'/pages/login/login'
|
|
||||||
})
|
|
||||||
} else if (res.cancel) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -801,7 +789,7 @@
|
||||||
btnsz() {
|
btnsz() {
|
||||||
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent)
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/page_user/upload?deviceid=' + this.shebid + '&ver=' + this.ver
|
url: '/page_user/upload?deviceid=' + this.shebid + '&ver=' + this.ver + '&xctime=' + this.xctime
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 选择设备
|
// 选择设备
|
||||||
|
@ -961,78 +949,99 @@
|
||||||
},
|
},
|
||||||
// 处理从设备接收数据
|
// 处理从设备接收数据
|
||||||
getchuli() {
|
getchuli() {
|
||||||
const inputString = this.datalist
|
const inputString = this.datalist;
|
||||||
const [ver, restOfString] = inputString.split('@')
|
|
||||||
this.ver = ver || ''
|
// 检查是否有 @ 分隔符
|
||||||
console.log(this.ver, restOfString, 'ververver')
|
const hasAtSymbol = inputString.includes('@');
|
||||||
const processedString = restOfString
|
let processedString;
|
||||||
|
|
||||||
const pairs = processedString.split(';')
|
if (hasAtSymbol) {
|
||||||
console.log(pairs,'10101010');
|
const [ver, restOfString] = inputString.split('@');
|
||||||
const showObject = {}
|
this.ver = ver || '';
|
||||||
const pSetObjects = {}
|
processedString = restOfString || ''; // 如果 restOfString 是 undefined,设置为空字符串
|
||||||
|
} else {
|
||||||
|
processedString = inputString; // 如果没有 @,直接使用整个字符串
|
||||||
|
this.ver = ''; // 如果没有 @,ver 设置为空
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(this.ver, processedString, 'ververver');
|
||||||
|
|
||||||
|
const pairs = processedString.split(';').filter(Boolean); // 过滤掉空字符串
|
||||||
|
console.log(pairs, '10101010');
|
||||||
|
|
||||||
|
const showObject = {};
|
||||||
|
const pSetObjects = {};
|
||||||
|
|
||||||
// 解析字符串
|
// 解析字符串
|
||||||
pairs.forEach(pair => {
|
pairs.forEach(pair => {
|
||||||
const [key, value] = pair.split(':')
|
const [key, value] = pair.split(':');
|
||||||
if (key === 'show') {
|
if (key === 'show') {
|
||||||
showObject.showArray = value.split(',').map(Number)
|
showObject.showArray = value.split(',').map(Number);
|
||||||
} else if (key.startsWith('p_set')) {
|
} else if (key.startsWith('p_set')) {
|
||||||
pSetObjects[key] = value.split(',').map(Number)
|
pSetObjects[key] = value.split(',').map(Number);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.ver_data = pSetObjects // 六个浇水时间段
|
|
||||||
this.jstimeobj = pSetObjects
|
this.ver_data = pSetObjects; // 六个浇水时间段
|
||||||
this.showobj = showObject// 雨滴,锁,等是否开启
|
this.jstimeobj = pSetObjects;
|
||||||
|
this.showobj = showObject; // 雨滴,锁,等是否开启
|
||||||
|
|
||||||
// 设置开关状态
|
// 设置开关状态
|
||||||
this.yschecked = this.showobj.showArray[1] !== 1
|
this.yschecked = this.showobj.showArray[1] !== 1;
|
||||||
this.etchecked = this.showobj.showArray[0] !== 1
|
this.etchecked = this.showobj.showArray[0] !== 1;
|
||||||
// 计算浇水时间
|
|
||||||
const calculateTimeDifference = (date1, date2) => {
|
// 计算浇水时间
|
||||||
const diffMs = Math.abs(date1 - date2)
|
const calculateTimeDifference = (date1, date2) => {
|
||||||
const diffMinutes = Math.floor(diffMs / (1000 * 60))
|
const diffMs = Math.abs(date1 - date2);
|
||||||
const diffHours = Math.floor(diffMinutes / 60)
|
const diffMinutes = Math.floor(diffMs / (1000 * 60));
|
||||||
const remainingMinutes = diffMinutes % 60
|
const diffHours = Math.floor(diffMinutes / 60);
|
||||||
return { hours: diffHours, minutes: remainingMinutes }
|
const remainingMinutes = diffMinutes % 60;
|
||||||
}
|
return { hours: diffHours, minutes: remainingMinutes };
|
||||||
const formatTime = (seconds) => {
|
};
|
||||||
const minutes = Math.floor(seconds / 60)
|
|
||||||
const remainingSeconds = seconds % 60
|
const formatTime = (seconds) => {
|
||||||
return `${minutes}分${remainingSeconds}秒`
|
const minutes = Math.floor(seconds / 60);
|
||||||
}
|
const remainingSeconds = seconds % 60;
|
||||||
const getTimeFromArray = (timeArray) => {
|
return `${minutes}分${remainingSeconds}秒`;
|
||||||
const [hour, minute, , second] = timeArray
|
};
|
||||||
const date = new Date()
|
|
||||||
date.setHours(hour, minute, second, 0) // 毫秒设为0
|
const getTimeFromArray = (timeArray) => {
|
||||||
return date
|
const [hour, minute, , second] = timeArray;
|
||||||
}
|
const date = new Date();
|
||||||
let nextTime = null
|
date.setHours(hour, minute, second, 0); // 毫秒设为0
|
||||||
let nextTimeDiff = null
|
return date;
|
||||||
let nextWaterDuration = null
|
};
|
||||||
let prevTime = null
|
|
||||||
for (const key in this.ver_data) {
|
let nextTime = null;
|
||||||
if (this.ver_data.hasOwnProperty(key) && this.ver_data[key][3] === 1) {
|
let nextTimeDiff = null;
|
||||||
const timeArray = this.ver_data[key]
|
let nextWaterDuration = null;
|
||||||
const timeDate = getTimeFromArray(timeArray)
|
let prevTime = null;
|
||||||
const diff = calculateTimeDifference(timeDate, new Date())
|
|
||||||
|
for (const key in this.ver_data) {
|
||||||
if (timeDate > new Date()) {
|
if (this.ver_data.hasOwnProperty(key) && this.ver_data[key][3] === 1) {
|
||||||
if (!nextTime || (diff.hours * 60 + diff.minutes < (nextTimeDiff?.hours || 0) * 60 + (nextTimeDiff?.minutes || 0))) {
|
const timeArray = this.ver_data[key];
|
||||||
nextTimeDiff = diff
|
const timeDate = getTimeFromArray(timeArray);
|
||||||
nextTime = timeDate
|
const diff = calculateTimeDifference(timeDate, new Date());
|
||||||
nextWaterDuration = formatTime(timeArray[2])
|
|
||||||
}
|
if (timeDate > new Date()) {
|
||||||
} else if (!prevTime || timeDate > prevTime) {
|
if (!nextTime || (diff.hours * 60 + diff.minutes < (nextTimeDiff?.hours || 0) * 60 + (nextTimeDiff?.minutes || 0))) {
|
||||||
prevTime = timeDate;
|
nextTimeDiff = diff;
|
||||||
}
|
nextTime = timeDate;
|
||||||
}
|
nextWaterDuration = formatTime(timeArray[2]);
|
||||||
}
|
}
|
||||||
// 输出结果
|
} else if (!prevTime || timeDate > prevTime) {
|
||||||
this.xctime = nextTime ? `${nextTimeDiff.hours}时${nextTimeDiff.minutes}分` : '无距离下次浇水时间'
|
prevTime = timeDate;
|
||||||
this.xctimesc = nextWaterDuration || '未知'
|
}
|
||||||
this.sctimejs = prevTime ? prevTime.toTimeString().slice(0, 5) : '无上次浇水时间'
|
}
|
||||||
this.xctimesj = nextTime ? nextTime.toTimeString().slice(0, 5) : '无下次浇水时间'
|
}
|
||||||
console.log('下次浇水时间', this.xctimesj, '距离下次浇水时间', this.xctime, '上次浇水时间', this.sctimejs)
|
|
||||||
}
|
// 输出结果
|
||||||
|
this.xctime = nextTime ? `${nextTimeDiff.hours}时${nextTimeDiff.minutes}分` : '无距离下次浇水时间';
|
||||||
|
this.xctimesc = nextWaterDuration || '未知';
|
||||||
|
this.sctimejs = prevTime ? prevTime.toTimeString().slice(0, 5) : '无上次浇水时间';
|
||||||
|
this.xctimesj = nextTime ? nextTime.toTimeString().slice(0, 5) : '无下次浇水时间';
|
||||||
|
console.log('下次浇水时间', this.xctimesj, '距离下次浇水时间', this.xctime, '上次浇水时间', this.sctimejs);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -40,8 +40,9 @@
|
||||||
—————— 其他登录方式 ——————
|
—————— 其他登录方式 ——————
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<button class="lofo" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
<button style="color: #ccc;margin-top: 30rpx;" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uxWMldLMb888YHm0qOgN" mode=""></image>
|
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/uxWMldLMb888YHm0qOgN" mode=""></image> -->
|
||||||
|
快捷登录
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -8,11 +8,15 @@
|
||||||
<view class="denglu" @click="denglu">
|
<view class="denglu" @click="denglu">
|
||||||
登录
|
登录
|
||||||
</view>
|
</view>
|
||||||
|
<view class="zhuce" style="margin-top: 30rpx;" @click="denglus">
|
||||||
|
暂不登录
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
var xBlufi = require("@/components/blufi/xBlufi.js")
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -36,7 +40,20 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
wx.openBluetoothAdapter({
|
||||||
|
success: function (res) {
|
||||||
|
console.log('蓝牙适配器初始化成功');
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err);
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '蓝牙适配器初始化失败,可能是因为没有权限',
|
||||||
|
// icon: 'none',
|
||||||
|
// duration:2000
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
xBlufi.initXBlufi(1)
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
// 跳转到注册页
|
// 跳转到注册页
|
||||||
|
@ -50,6 +67,11 @@
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:'/pages/login/denglu'
|
url:'/pages/login/denglu'
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
denglus(){
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/index/index'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +88,7 @@
|
||||||
.anniu{
|
.anniu{
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
bottom: 198rpx;
|
bottom: 140rpx;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
.zhuce{
|
.zhuce{
|
||||||
width: 614rpx;
|
width: 614rpx;
|
||||||
|
|
|
@ -56,8 +56,9 @@
|
||||||
—————— 其他登录方式 ——————
|
—————— 其他登录方式 ——————
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<button class="lofo" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
<button style="color: #ccc;margin-top: 30rpx;" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uxWMldLMb888YHm0qOgN" mode=""></image>
|
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/uxWMldLMb888YHm0qOgN" mode=""></image> -->
|
||||||
|
快捷登录
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
|
21
pages/my.vue
21
pages/my.vue
|
@ -31,7 +31,6 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="bot">
|
<view class="bot">
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
@ -49,7 +48,6 @@
|
||||||
退出登录 <image src="https://api.ccttiot.com/smartmeter/img/static/uKpBiM6T9kj4BddzJtDc" mode=""></image>
|
退出登录 <image src="https://api.ccttiot.com/smartmeter/img/static/uKpBiM6T9kj4BddzJtDc" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<tab-bar :indexs='2'></tab-bar>
|
<tab-bar :indexs='2'></tab-bar>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
@ -84,6 +82,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
this.getinfo()
|
this.getinfo()
|
||||||
this.gettiken()
|
this.gettiken()
|
||||||
},
|
},
|
||||||
|
@ -94,6 +95,20 @@
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.userobj = res.data
|
this.userobj = res.data
|
||||||
this.imageSrc = res.data.avatar
|
this.imageSrc = res.data.avatar
|
||||||
|
}else if(res.code == 401){
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '您还未登录,是否前去登录?',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url:'/pages/login/login'
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -129,7 +144,6 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转意见反馈
|
// 跳转意见反馈
|
||||||
btnyjfk(){
|
btnyjfk(){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
@ -142,7 +156,6 @@
|
||||||
url:'/page_user/kefu'
|
url:'/page_user/kefu'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到详情
|
// 跳转到详情
|
||||||
btnxq(num){
|
btnxq(num){
|
||||||
if(num == 1){
|
if(num == 1){
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
bgc: {
|
bgc: {
|
||||||
backgroundColor: "#E2EFDF",
|
backgroundColor: "#E2EFDF",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 分享到好友(会话)
|
// 分享到好友(会话)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user