浇花器

This commit is contained in:
吴鹏 2026-01-17 17:37:00 +08:00
parent ef474f6908
commit 1ba208ef93
15 changed files with 3704 additions and 1570 deletions

View File

@ -1,27 +1,7 @@
const install = (Vue, vm) => {
// Vue.prototype.$u.http.setConfig({
// baseURL: 'https://yruibao.com/admin',
// // baseUrl: 'http://192.168.10.104:8088',
// method: 'POST',
// // 设置为json返回后会对数据进行一次JSON.parse()
// dataType: 'json',
// showLoading: true, // 是否显示请求中的loading
// loadingText: '...', // 请求loading中的文字提示
// loadingTime: 800, // 在此时间内请求还没回来的话就显示加载中动画单位ms
// originalData: false, // 是否在拦截器中返回服务端的原始数据
// loadingMask: true, // 展示loading的时候是否给一个透明的蒙层防止触摸穿透
// // 配置请求头信息
// header: {
// 'content-type': 'application/json;charset=UTF-8',
// },
// });
Vue.prototype.$u.http.setConfig({
baseUrl: 'https://yxd.ccttiot.com/prod-api',
// baseUrl: 'http://192.168.1.7:8081',
// baseUrl: 'https://yxd.ccttiot.com/prod-api',
baseUrl: 'http://192.168.1.3:8081',
loadingText: '努力加载中~',
loadingTime: 800,
// 设置自定义头部content-type
@ -33,23 +13,7 @@ const install = (Vue, vm) => {
// 请求拦截部分,如配置,每次请求前都会执行
Vue.prototype.$u.http.interceptor.request = (config) => {
// 引用token
// 方式一存放在vuex的token假设使用了uView封装的vuex方式
// 见https://uviewui.com/components/globalVariable.html
// config.header.token = vm.token;
// 方式二如果没有使用uView封装的vuex方法那么需要使用$store.state获取
// config.header.token = vm.$store.state.token;
// 方式三如果token放在了globalData通过getApp().globalData获取
// 方式四如果token放在了Storage本地存储中拦截是每次请求都执行的
// 所以哪怕您重新登录修改了Storage下一次的请求将会是最新值
const token = uni.getStorageSync('token');
// const token = " eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImE1ZmE2YzM0LWM0Y2YtNGEwMS05YjY2LTE1M2M4YWY1YzU1YSJ9.Wze_tAjY7cCfw2K6mtDpTSd-QFLRF4A49Fx7bq7g2tVLKL4v5bqqHfpG0VQy7_a_CUQch5RPBTBIKMVCDupIqg"
// console.log("我是token", token)
config.header.Authorization = token;
// config.header.Tenant-Id=1
// #ifdef H5
@ -59,93 +23,10 @@ const install = (Vue, vm) => {
if(config.url == '/user/login') config.header.noToken = true;
// 最后需要将config进行return
return config;
// 如果return一个false值则会取消本次请求
// if(config.url == '/user/rest') return false; // 取消某次请求
}
// 响应拦截,如配置,每次请求结束都会执行本方法
Vue.prototype.$u.http.interceptor.response = (res) => {
// if(res.code == 10022 || res.code == 10023) {
// // res为服务端返回值可能有coderesult等字段
// // 这里对res.result进行返回将会在this.$u.post(url).then(res => {})的then回调中的res的到
// // 如果配置了originalData为true请留意这里的返回值
// uni.redirectTo({
// url:"/pages/login/login",
// fail:function(mes){
// console.log(mes)
// },
// success:function(mes){
// console.log(mes)
// }
// })
// // return res.result;
// }
if(res.code == 401) {
// res为服务端返回值可能有coderesult等字段
// 这里对res.result进行返回将会在this.$u.post(url).then(res => {})的then回调中的res的到
// 如果配置了originalData为true请留意这里的返回值
// return res.result;
uni.login({
success: function(ret) {
console.log("main.js==>res", ret)
// vm.$u.post('/user/login',{"js_code": ret.code}).then(res=>{
// if (res.code == 10003) {
// // console.log("新用户登录")
// uni.setStorageSync('token', res.data);
// } else if (res.code == 200) {
// // console.log("老用户登录",res.data)
// uni.setStorageSync('token', res.data);
// }
// });
}
});
wx.login({
success(res) {
if (res.code) {
console.log('登录!', res);
let data = {
loginCode: res.code,
};
vm.$u.post(`/wxLogin`,data).then(res=>{
if (res.code == 10003) {
// uni.navigateTo({
// url:'/pages/login/login'
// })
} else if (res.code == 200) {
// console.log("老用户登录",res.data)
// uni.switchTab({
// url:'/pages/index/index'
// })
}
});
}
},
});
}
return res;
// else if(res.code == 201) {
// // 假设201为token失效这里跳转登录
// vm.$u.toast('验证失败,请重新登录');
// setTimeout(() => {
// // 此为uView的方法详见路由相关文档
// vm.$u.route('/pages/user/login')
// }, 1500)
// return false;
// } else {
// // 如果返回false则会调用Promise的reject回调
// // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中res为服务端的返回值
// return false;
// }
}
}

View File

@ -577,7 +577,7 @@ function write_cmd_program(deviceId, serviceId, characteristicId, data) {
var dv = 0;
let result;
console.log("更新122")
const mtu = 512;
const mtu = 212;
uni.setBLEMTU({
deviceId: self
.data
@ -664,7 +664,7 @@ function write_cmd_program_dd(deviceId, serviceId, characteristicId, data) {
var dv = 0;
let result;
console.log("更新122")
const mtu = 512;
const mtu = 212;
uni.setBLEMTU({
deviceId: self
.data
@ -752,7 +752,7 @@ function write_cmd_program_zy(deviceId, serviceId, characteristicId, data) {
var dv = 0;
let result;
console.log("更新122")
const mtu = 512;
const mtu = 212;
uni.setBLEMTU({
deviceId: self
.data
@ -839,7 +839,7 @@ function write_cmd_program_yk(deviceId, serviceId, characteristicId, data) {
var dv = 0;
let result;
console.log("更新122")
const mtu = 512;
const mtu = 212;
uni.setBLEMTU({
deviceId: self
.data
@ -927,7 +927,7 @@ function write_cmd_program_fg(web, deviceId, serviceId, characteristicId, data)
var dv = 0;
let result;
console.log("更新122")
const mtu = 512;
const mtu = 212;
uni.setBLEMTU({
deviceId: self
.data
@ -1130,24 +1130,24 @@ function writeRouterSsid(deviceId, serviceId, characteristicId, data) {
},
fail: function (res) { //console.log(257);
}
})
});
}
function writeDevicePwd(deviceId, serviceId, characteristicId, data) {
var obj = {}
var obj = {},
frameControl = 0;
sequenceControl = parseInt(sequenceControl) + 1;
if (!util._isEmpty(data)) {
obj = util.isSubcontractor(data, self.data.isChecksum, sequenceControl, self.data.isEncrypt)
frameControl = util.getFrameCTRLValue(self.data.isEncrypt, self.data.isChecksum, util.DIRECTION_OUTPUT, false, obj.flag)
obj = util.isSubcontractor(data, self.data.isChecksum, sequenceControl, self.data.isEncrypt);
frameControl = util.getFrameCTRLValue(self.data.isEncrypt, self.data.isChecksum, util.DIRECTION_OUTPUT, false, obj.flag);
} else {
var pwdData = getCharCodeat(self.data.password)
obj = util.isSubcontractor(pwdData, self.data.isChecksum, sequenceControl, self.data.isEncrypt)
frameControl = util.getFrameCTRLValue(self.data.isEncrypt, self.data.isChecksum, util.DIRECTION_OUTPUT, false, obj.flag)
var pwdData = getCharCodeat(self.data.password);
obj = util.isSubcontractor(pwdData, self.data.isChecksum, sequenceControl, self.data.isEncrypt);
frameControl = util.getFrameCTRLValue(self.data.isEncrypt, self.data.isChecksum, util.DIRECTION_OUTPUT, false, obj.flag);
}
var defaultData = util.encrypt(aesjs, self.data.md5Key, sequenceControl, obj.lenData, true)
var defaultData = util.encrypt(aesjs, self.data.md5Key, sequenceControl, obj.lenData, true);
var value = util.writeData(util.PACKAGE_VALUE, util.SUBTYPE_SET_PWD, frameControl, sequenceControl, obj.len,
defaultData);
var typedArray = new Uint8Array(value);
@ -1169,8 +1169,8 @@ function writeDevicePwd(deviceId, serviceId, characteristicId, data) {
function writeDeviceEnd(deviceId, serviceId, characteristicId) {
sequenceControl = parseInt(sequenceControl) + 1;
var frameControl = util.getFrameCTRLValue(self.data.isEncrypt, false, util.DIRECTION_OUTPUT, false, false)
var value = util.writeData(self.data.PACKAGE_CONTROL_VALUE, util.SUBTYPE_END, frameControl, sequenceControl, 0, null)
var frameControl = util.getFrameCTRLValue(self.data.isEncrypt, false, util.DIRECTION_OUTPUT, false, false);
var value = util.writeData(self.data.PACKAGE_CONTROL_VALUE, util.SUBTYPE_END, frameControl, sequenceControl, 0, null);
var typedArray = new Uint8Array(value);
uni.writeBLECharacteristicValue({
deviceId: deviceId,
@ -1237,7 +1237,6 @@ function init() {
devicesList.push(devices);
}
} else if (devices.devices) {
// console.log(devices.devices[0])
if (devices.devices[0].name != '开发板'
&& devices.devices[0].name != '无线钉钉'
&& devices.devices[0].name != '无线工具'
@ -1369,7 +1368,7 @@ function init() {
}
});
mDeviceEvent.listenConnectBle(true, function (options) {
console.log("我要连接?", options.isStart,options);
console.log("我要连接?", options.isStart);
if (options.isStart) uni.createBLEConnection({
deviceId: options.deviceId,
success: function (res) {
@ -1453,7 +1452,7 @@ function init() {
self.data.deviceId = options.deviceId;
mac_id = options.deviceId;
setTimeout(() => {
var mtu = 512
var mtu = 212
uni.setBLEMTU({
deviceId: self
.data
@ -1516,7 +1515,7 @@ setTimeout(() => {
success: function(res) {
console.log("成功", res)
writeCutomsData(self.data.deviceId, self.data.service_uuid, self.data.characteristic_write_uuid, "get_fw");
const mtu = 512;
const mtu = 212;
uni.onBLECharacteristicValueChange(function(res) {
var my_str = Utf8ArrayToStr(res.value)
if(my_str.indexOf("wifi_ok") != -1)

View File

@ -63,7 +63,7 @@
getver(){
this.$u.get(`/system/config/configKey/app.version`).then(res => {
if (res.code == 200) {
if(res.data == '1.0.59'){
if(res.data == '1.0.60'){
this.flag = true
}else{
this.flag = false

View File

@ -0,0 +1,872 @@
<template>
<view class="" style="padding-bottom: 50rpx;box-sizing: border-box;">
<u-navbar title="设备控制" :border-bottom="false" :background="bgc" title-color='#000' back-icon-color="#000" :custom-back="btnshang"
title-size='36' height='50'></u-navbar>
<view class="iptbox">
<view class="qrcode" @click="qrcode()">
<image src="https://api.ccttiot.com/smartmeter/img/static/uy7BNwAMIKwvstqFnRhs" mode=""></image>
</view>
<input type="text" class="ips" v-model="storeId" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;" placeholder-class="my-placeholder"/>
<view class="" style="width: 140rpx;height: 60rpx;background-color: #52c41a;text-align: center;line-height: 60rpx;border-radius: 8rpx;color: #fff;" @click="btnly" v-if="obj.mac">
蓝牙
</view>
</view>
<!-- <view class="machao">
网关MAC号{{obj.mac == undefined ? '--' : obj.mac}} <text v-if="onlineStatus == '离线'" style="color: red;margin-left: 50rpx;">离线</text> <text v-if="onlineStatus == '在线'" style="color: green;margin-left: 50rpx;">在线</text>
</view> -->
<!-- 网关信息卡片 -->
<view class="device-info-card" v-if="obj.dataPoints">
<!-- 设备头部信息 -->
<view class="device-header">
<view class="device-header-info" style="display: flex;justify-content: space-between;align-items: center;">
<view class="device-name" style="display: flex;justify-content: space-between;align-items: center;">
网关信息
<view class="device-status-row" style="margin-left: 20rpx;">
<view class="status-badge" :class="{'status-online': onlineStatus == '在线', 'status-offline': onlineStatus == '离线'}">
{{onlineStatus}}
</view>
</view>
</view>
<view class="info-item" style="font-size: 22rpx;font-weight: 400;color: #ccc;">
<text class="info-value">{{obj.mac || '--'}}</text>
</view>
</view>
</view>
<!-- 状态信息 -->
<view class="info-section" style="border-top: 1rpx solid #f0f0f0;padding-top: 20rpx;">
<view class="section-title">网关信息</view>
<view class="info-grid">
<view class="info-item">
<text class="info-label">VER</text>
<text class="info-value">{{obj.dataPoints && obj.dataPoints.VER ? obj.dataPoints.VER.value : '--'}}</text>
</view>
<view class="info-item" style="position: relative;">
<text class="info-label">CSQ</text>
<view style="display: flex;align-items: center;gap: 10rpx;">
<text class="info-value" style="flex: 1;">{{obj.dataPoints && obj.dataPoints.CSQ ? obj.dataPoints.CSQ.value : '--'}}</text>
<view class="update-btn" @click="updateCSQ">
<text class="update-icon"></text>
<text class="update-text">更新</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="zisb" style="width: 658rpx;margin: auto;">
<view class="tit" style="margin-top: 30rpx;">
子设备信息
</view>
</view>
<!-- 设备详细信息卡片 -->
<view class="device-info-card" v-if="macobj.deviceId">
<!-- 设备头部信息 -->
<view class="device-header">
<image v-if="macobj.picture || macobj.modelPicture" :src="macobj.picture || macobj.modelPicture" class="device-image" mode="aspectFill"></image>
<view class="device-header-info">
<view class="device-name" style="display: flex;justify-content: space-between;align-items: center;">
{{macobj.deviceName || macobj.modelName || '--'}}
<view class="info-item" style="font-size: 22rpx;font-weight: 400;color: #ccc;">
<text class="info-value">{{macobj.mac || '--'}}</text>
</view></view>
<view class="device-status-row">
<view class="status-badge" :class="{'status-online': macobj.onlineStatus == '1', 'status-offline': macobj.onlineStatus == '0'}">
{{macobj.onlineStatus == '1' ? '在线' : '离线'}}
</view>
<text class="device-version" v-if="macobj.version">版本: {{macobj.dataPoints.ver.value == null ? '--' : macobj.dataPoints.ver.value}}</text>
<text class="device-version" v-if="macobj.dataPoints.RSSI">信号:{{macobj.dataPoints.RSSI.value == null ? '--' : macobj.dataPoints.RSSI.value}}</text>
<view class="signal-strength" v-if="macobj.bluetoothDbm !== null && macobj.bluetoothDbm !== undefined">
<view class="signal-bars">
<view class="signal-bar" :class="{'active': getSignalLevel(macobj.bluetoothDbm) >= 1}"></view>
<view class="signal-bar" :class="{'active': getSignalLevel(macobj.bluetoothDbm) >= 2}"></view>
<view class="signal-bar" :class="{'active': getSignalLevel(macobj.bluetoothDbm) >= 3}"></view>
<view class="signal-bar" :class="{'active': getSignalLevel(macobj.bluetoothDbm) >= 4}"></view>
</view>
<text class="signal-value">{{macobj.bluetoothDbm}}dBm</text>
</view>
</view>
</view>
</view>
<text class="device-version" style="margin-bottom: 20rpx;display: block;" v-if="macobj.dataPoints.RSSI">更新时间: {{macobj.dataPoints.RSSI.at == null ? '--' : macobj.dataPoints.RSSI.at}}</text>
<!-- 状态信息 -->
<view class="info-section" style="border-top: 1rpx solid #f0f0f0;padding-top: 20rpx;">
<view class="section-title">状态信息</view>
<view class="info-grid">
<view class="info-item">
<text class="info-label">在线状态</text>
<text class="info-value" :style="{color: macobj.onlineStatus == '1' ? '#52c41a' : '#ff4d4f'}">
{{macobj.onlineStatus == '1' ? '在线' : '离线'}}
</text>
</view>
<view class="info-item">
<text class="info-label">设备状态</text>
<text class="info-value" style="font-size: 36rpx;font-weight: 600;">{{getDeviceStatus()}}</text>
</view>
</view>
</view>
</view>
<view class="list">
<view class="anniulist">
<view class="anniu" @click="btngbkq">
开启
</view>
<view class="anniu" @click="btngb">
关闭
</view>
<view class="anniu" @click="getmacs">
刷新
</view>
</view>
<view class="fanhui" @click="btnfh">
返回
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#FAFDFD",
},
storeId: '',
obj: {},
id: '',
onlineStatus: '--',
powerStatus: '--',
message: '定时器未启动',
intervalId: null, // ID
wdxsn:'',
wdxsw:'',
xsN:'',
xsW:'',
valuedian:1000,
xshu:'1',
x:'',
macsb:'',
macobj:{}
}
},
onLoad(options) {
if (options.sn) {
this.storeId = options.sn
this.getsn()
}
},
onUnload() {
//
this.clearInterval()
},
onHide() {
//
this.clearInterval()
},
beforeDestroy() {
//
this.clearInterval()
},
methods: {
btnly(){
uni.reLaunch({
url:'/page_newyemian/wgluru'
})
},
btnshang(){
uni.reLaunch({
url:'/page_newyemian/wgluru'
})
},
// 1-4
getSignalLevel(dbm) {
if (dbm === null || dbm === undefined) {
return 0;
}
// -50-60-60-703-70-802-80-901
if (dbm >= -60) {
return 4; //
} else if (dbm >= -70) {
return 3;
} else if (dbm >= -80) {
return 2;
} else if (dbm >= -90) {
return 1;
} else {
return 0; //
}
},
getver() {
if (!this.macobj || !this.macobj.dataPoints) {
return '--';
}
return this.macobj.dataPoints.ver
},
// dataPoints.d
getDeviceStatus() {
if (!this.macobj || !this.macobj.dataPoints) {
return '--';
}
const d = this.macobj.dataPoints.water_sw.value;
if (d === 0 || d === '0') {
return '关闭';
} else if (d === 1 || d === '1') {
return '开启';
} else {
return '--';
}
},
startInterval() {
//
const timerCallback = () => {
if(this.storeId == '' || this.storeId == null || this.obj == null){
this.clearInterval()
}else{
this.$u.get(`/app/beehive/admin/sn/${this.storeId}?refresh=true`).then(res => {
if (res.code == 200) {
this.obj = res.data
this.xsW = res.data.xsW
this.xsN = res.data.xsN
this.id = res.data.deviceId
if (res.data.onlineStatus == 0) {
this.onlineStatus = '离线'
} else if (res.data.onlineStatus == 1) {
this.onlineStatus = '在线'
}
if (res.data.powerStatus == 0) {
this.powerStatus = '关闭'
} else if (res.data.powerStatus == 1) {
this.powerStatus = '开启'
}
}
})
}
}
// IDintervalId
this.intervalId = setInterval(timerCallback, 5000)
},
clearInterval() {
//
if (this.intervalId !== null) {
clearInterval(this.intervalId)
this.intervalId = null
}
},
// sn
qrcode() {
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.getsn()
},
fail: err => {
console.error('扫描失败:', err)
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
// sn
getsn() {
this.$u.get(`/device/device/getDetail?sn=${this.storeId}`).then(res => {
if (res.code == 200) {
if(res.data == null){
this.clearInterval()
}else{
this.obj = res.data
this.getmac()
if (res.data.onlineStatus == 0) {
this.onlineStatus = '离线'
} else if (res.data.onlineStatus == 1) {
this.onlineStatus = '在线'
}
}
} else {
uni.showToast({
title:'错误' + res.msg,
icon: 'none',
duration: 2000,
})
this.clearInterval()
}
})
},
// CSQ
updateCSQ() {
uni.showLoading({
title: '更新中...',
mask: true,
icon: 'none'
})
let data = {
mac:this.obj.mac,
command:'CSQ'
}
this.$u.post(`/as/deviceGateway/sendCommandToGateway`,data).then(res => {
if (res.code == 200 && res.data.success == true) {
this.getsn()
setTimeout(()=>{
uni.hideLoading()
uni.showToast({
title: '更新成功',
icon: 'success',
duration: 2000
})
},1000)
} else {
uni.showToast({
title: res.data.msg,
icon: 'none',
duration: 2000
})
uni.hideLoading()
}
}).catch(err => {
uni.hideLoading()
uni.showToast({
title: '更新失败',
icon: 'none',
duration: 2000
})
})
},
//
btnfh() {
uni.reLaunch({
url:'/page_newyemian/wgluru'
})
},
//
getmacs(){
uni.showLoading({
title: '刷新中...',
mask: true,
icon: 'none'
})
setTimeout(()=>{
this.$u.get(`/system/config/configKey/device.gateway.test.mac`).then(res =>{
if(res.code == 200){
this.macsb = res.data
this.$u.get(`/device/device/getDetail?mac=${this.macsb}&gatewayMacList=${this.obj.mac}`).then(resp =>{
if(resp.code == 200){
this.getsn()
this.id = resp.data.deviceId
this.macobj = resp.data
uni.showToast({
title: '刷新成功',
icon: 'success',
duration: 2000
})
uni.hideLoading()
}else{
uni.showToast({
title: '错误' + resp.msg,
icon: 'none',
duration: 2000
})
uni.hideLoading()
}
})
}else{
uni.showToast({
title: '错误' + res.msg,
icon: 'none',
duration: 2000
})
uni.hideLoading()
}
})
},1000)
},
//
getmac(){
this.$u.get(`/system/config/configKey/device.gateway.test.mac`).then(res =>{
if(res.code == 200){
this.macsb = res.data
this.$u.get(`/device/device/getDetail?mac=${this.macsb}&gatewayMacList=${this.obj.mac}`).then(resp =>{
if(resp.code == 200){
this.id = resp.data.deviceId
this.macobj = resp.data
}else{
uni.showToast({
title: '错误' + resp.msg,
icon: 'none',
duration: 2000
})
}
})
}else{
uni.showToast({
title: '错误' + res.msg,
icon: 'none',
duration: 2000
})
}
})
},
//
btngb() {
uni.showLoading({
title: '关闭中...',
mask: true,
icon: 'none'
})
let data = {
deviceMac:this.macsb,
gatewayMac:this.obj.mac
}
this.$u.post(`/device/device/close/specGateway`,data).then((res) => {
if (res.code == 200) {
setTimeout(() => {
this.btnsx()
}, 1000)
uni.showToast({
title: res.msg,
icon: 'success',
duration: 2000
})
} else {
uni.hideLoading()
uni.showToast({
title: '错误' + res.msg,
icon: 'none',
duration: 2000
})
}
})
},
//
btngbkq() {
uni.showLoading({
title: '开启中...',
mask: true,
icon: 'none'
})
let data = {
deviceMac:this.macsb,
second:180,
gatewayMac:this.obj.mac
}
this.$u.post(`/device/device/time/specGateway`,data).then((res) => {
if (res.code == 200) {
setTimeout(() => {
this.btnsx()
}, 1000)
uni.showToast({
title: res.msg,
icon: 'success',
duration: 2000
})
} else {
uni.hideLoading()
uni.showToast({
title: '错误' + res.msg,
icon: 'none',
duration: 2000
})
}
})
},
//
btnsx() {
this.$u.get(`/device/device/getDetail?mac=${this.macsb}&gatewayMacList=${this.obj.mac}`).then(resp =>{
if(resp.code == 200){
this.id = resp.data.deviceId
this.macobj = resp.data
uni.hideLoading()
}else{
uni.hideLoading()
uni.showToast({
title: '错误' + resp.msg,
icon: 'none',
duration: 2000
})
}
})
}
}
}
</script>
<style lang="less">
.jiaozhun{
display: flex;
padding:0 50rpx;
box-sizing: border-box;
width: 100%;
align-items: center;
justify-content: space-between;
button{
height: 80rpx;
line-height: 80rpx;
background-color: #52c41a;
color: #fff;
}
.input{
input{
height: 80rpx;
line-height: 80rpx;
}
border: 1px solid #ccc;
border-radius: 20rpx;
display: flex;
width: 260rpx;
height: 80rpx;
text-align: center;
}
.view{
width: 200rpx;
height: 80rpx;
border-radius: 20rpx;
background-color: #52c41a;
color: #fff;
text-align: center;
line-height: 80rpx;
font-size: 28rpx;
}
}
.list {
margin-top: 30rpx;
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: 50rpx;
.anniulist {
width: 658rpx;
margin: auto;
text-align: left;
font-size: 32rpx;
display: flex;
justify-content: space-between;
.anniu {
width: 30%;
height: 90rpx;
border-radius: 20rpx;
background-color: #52c41a;
color: #fff;
font-size: 32rpx;
text-align: center;
line-height: 90rpx;
margin: 0 10rpx;
}
}
.fanhui {
width: 658rpx;
height: 90rpx;
border-radius: 20rpx;
background-color: #52c41a;
color: #fff;
font-size: 32rpx;
text-align: center;
line-height: 90rpx;
margin: auto;
margin-top: 50rpx;
}
}
.machao {
width: 658rpx;
margin: auto;
margin-top: 20rpx;
text-align: left;
font-size: 32rpx;
display: flex;
align-items: center;
.one{
width: 320rpx;
}
input{
width: 100rpx;
height: 40rpx;
border: 1px solid #52c41a;
margin-left: 50rpx;
text-align: center;
border-radius: 10rpx;
}
view{
margin-left: 20rpx;
padding: 10rpx 20rpx;
box-sizing: border-box;
background-color: #52c41a;
color: #fff;
border-radius: 10rpx;
margin-right: 10rpx;
}
}
.title {
font-size: 70rpx;
font-weight: 600;
text-align: left;
width: 658rpx;
margin: auto;
margin-top: 30rpx;
}
.shuom {
width: 658rpx;
margin: auto;
margin-top: 30rpx;
text-align: left;
font-size: 32rpx;
}
.iptbox {
display: flex;
align-items: center;
flex-wrap: nowrap;
padding: 22rpx;
margin: 28rpx auto 0;
width: 658rpx;
height: 88rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
border-radius: 20rpx 20rpx 20rpx 20rpx;
.qrcode {
padding-right: 20rpx;
border-right: 2rpx solid #D8D8D8;
image {
width: 54rpx;
height: 54rpx;
}
}
.ips {
width: 630rpx;
}
image {
width: 18rpx;
height: 32rpx;
}
.my-placeholder {
font-weight: 400;
font-size: 32rpx;
color: #808080;
}
}
.tit {
font-size: 36rpx;
font-weight: 600;
color: #333;
}
//
.device-info-card {
width: 658rpx;
margin: 30rpx auto;
background: #FFFFFF;
border-radius: 20rpx;
padding: 30rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
.device-header {
display: flex;
align-items: center;
padding-bottom: 30rpx;
.device-image {
width: 120rpx;
height: 120rpx;
border-radius: 16rpx;
margin-right: 24rpx;
background: #f5f5f5;
}
.device-header-info {
flex: 1;
.device-name {
font-size: 36rpx;
font-weight: 600;
color: #333;
margin-bottom: 16rpx;
}
.device-status-row {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 16rpx;
.status-badge {
padding: 8rpx 20rpx;
border-radius: 20rpx;
font-size: 24rpx;
&.status-online {
background: #e6f7e6;
color: #52c41a;
}
&.status-offline {
background: #fff1f0;
color: #ff4d4f;
}
}
.device-version {
font-size: 24rpx;
color: #999;
}
.signal-strength {
display: flex;
align-items: center;
gap: 8rpx;
.signal-bars {
display: flex;
align-items: flex-end;
gap: 3rpx;
height: 24rpx;
.signal-bar {
width: 6rpx;
background: #e0e0e0;
border-radius: 2rpx;
transition: all 0.3s;
&:nth-child(1) {
height: 8rpx;
}
&:nth-child(2) {
height: 12rpx;
}
&:nth-child(3) {
height: 16rpx;
}
&:nth-child(4) {
height: 20rpx;
}
&.active {
background: #52c41a;
}
}
}
.signal-value {
font-size: 22rpx;
color: #999;
}
}
}
}
}
.info-section {
margin-bottom: 30rpx;
&:last-child {
margin-bottom: 0;
}
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #333;
margin-bottom: 20rpx;
padding-left: 16rpx;
border-left: 6rpx solid #52c41a;
}
.info-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20rpx;
.info-item {
background: #fafafa;
border-radius: 12rpx;
padding: 20rpx;
display: flex;
flex-direction: column;
.info-label {
font-size: 24rpx;
color: #999;
margin-bottom: 8rpx;
}
.info-value {
font-size: 28rpx;
color: #333;
font-weight: 500;
word-break: break-all;
width: 170rpx;
}
.info-value-group {
display: flex;
flex-direction: column;
.info-value {
margin-bottom: 4rpx;
}
.info-time {
font-size: 22rpx;
color: #999;
}
}
.update-btn {
padding: 8rpx 16rpx;
border: none;
border-radius: 8rpx;
background: linear-gradient(135deg, #52c41a 0%, #73d13d 100%);
cursor: pointer;
transition: all 0.3s;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
gap: 4rpx;
box-shadow: 0 2rpx 8rpx rgba(82, 196, 26, 0.3);
.update-icon {
font-size: 22rpx;
color: #fff;
line-height: 1;
font-weight: bold;
display: inline-block;
transition: transform 0.3s;
}
.update-text {
font-size: 22rpx;
color: #fff;
line-height: 1;
font-weight: 500;
}
&:active {
background: linear-gradient(135deg, #389e0d 0%, #52c41a 100%);
box-shadow: 0 1rpx 4rpx rgba(82, 196, 26, 0.4);
transform: scale(0.95);
.update-icon {
transform: rotate(180deg);
}
}
}
}
}
}
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -64,7 +64,6 @@
<view class="mask" style="z-index: 9999;" v-if="kgflag"></view>
</view>
<view class="choushuiben" v-else>
<view class="tit">
浇水设置
@ -228,16 +227,16 @@
methods: {
//
getxq(){
this.$u.get(`/app/getDeviceInfo/${this.shebid}`).then(res => {
this.$u.get(`/app/device/getDetail?deviceId=${this.shebid}`).then(res => {
if (res.code == 200) {
if(this.pre != 'WATER'){
this.shi = res.data.parameters.h.length < 10 ? '0' + res.data.parameters.h.value : res.data.parameters.h.value
this.fen = res.data.parameters.m.length < 10 ? '0' + res.data.parameters.m.value : res.data.parameters.m.value
this.miao = res.data.parameters.t.value
this.tian = res.data.parameters.d.value
this.shi = res.data.iotData.h.length < 10 ? '0' + res.data.iotData.h.value : res.data.iotData.h.value
this.fen = res.data.iotData.m.length < 10 ? '0' + res.data.iotData.m.value : res.data.iotData.m.value
this.miao = res.data.iotData.t.value
this.tian = res.data.iotData.d.value
} else {
// WATER h1/m1/s1/o1...( d1..d6)
const params = res.data.parameters
const params = res.data.iotData
const mapped = this.buildListFromBackend(params)
// u-switch
this.list = mapped

View File

@ -1,46 +1,46 @@
<template>
<view class="page">
<u-navbar title="发布动态" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
title-size='36' height='46' id="navbar">
</u-navbar>
<view class="topcont">
<view class="title">
<input type="text" v-model="title" placeholder="添加标题"/>
</view>
<textarea class="cont" name="" v-model="cont" placeholder="写下自己的感受,分享给更多的人" id="" cols="30" rows="10"></textarea>
<view class="imglist">
<view class="mediaitem" v-for="(item,index) in mediaList" :key="index">
<!-- 图片预览 -->
<image v-if="item.type === 'image'" class="media-preview" :src="item.url" mode="aspectFill" @click="previewMedia(index)"></image>
<!-- 视频预览 -->
<video v-else-if="item.type === 'video'" class="media-preview" :src="item.url" :poster="item.poster" controls="true" :show-play-btn="true" :show-center-play-btn="true" :enable-progress-gesture="true" :enable-fullscreen="true" @click="previewMedia(index)">
<!-- <cover-view class="play-icon" @click.stop="previewMedia(index)"></cover-view> -->
</video>
<!-- 删除按钮 -->
<view class="delete-btn" @click="deleteMedia(index)">
<text class="delete-icon">×</text>
title-size='36' height='46' id="navbar">
</u-navbar>
<view class="topcont">
<view class="title">
<input type="text" v-model="title" placeholder="添加标题"/>
</view>
<textarea class="cont" name="" v-model="cont" placeholder="写下自己的感受,分享给更多的人" id="" cols="30" rows="10"></textarea>
<view class="imglist">
<view class="mediaitem" v-for="(item,index) in mediaList" :key="index">
<!-- 图片预览 -->
<image v-if="item.type === 'image'" class="media-preview" :src="item.url" mode="aspectFill" @click="previewMedia(index)"></image>
<!-- 视频预览 -->
<video v-else-if="item.type === 'video'" class="media-preview" :src="item.url" :poster="item.poster" controls="true" :show-play-btn="true" :show-center-play-btn="true" :enable-progress-gesture="true" :enable-fullscreen="true" @click="previewMedia(index)">
<!-- <cover-view class="play-icon" @click.stop="previewMedia(index)"></cover-view> -->
</video>
<!-- 删除按钮 -->
<view class="delete-btn" @click="deleteMedia(index)">
<text class="delete-icon">×</text>
</view>
</view>
<view class="upload-btn" @click="btnsc">
<image class="sc" src="https://api.ccttiot.com/smartmeter/img/static/u3z28zohbXoJ5kWcR6X1" mode=""></image>
</view>
</view>
</view>
<view class="upload-btn" @click="btnsc">
<image class="sc" src="https://api.ccttiot.com/smartmeter/img/static/u3z28zohbXoJ5kWcR6X1" mode=""></image>
</view>
</view>
</view>
<!-- <view class="weizhi">
<view class="lt" @click="btnweizhi">
<image src="https://api.ccttiot.com/smartmeter/img/static/u89SQe8SWGXW1jH3VghJ" mode=""></image> <text v-if="xqdz == ''">你在哪里 </text>
<input v-if="xqdz == ''" style="width: 400rpx;" type="text" :disabled="true" v-model="xqdz" placeholder="(必填.越详细越易被推荐)" value="" />
<input v-else type="text" :disabled="true" v-model="xqdz" placeholder="(必填.越详细越易被推荐)" value="" />
</view>
<view class="rt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uP31r333Y9Uu7hsl05TB" mode=""></image>
</view>
</view> -->
<view class="botanniu">
<view class="an" @click="btnfb">
发布
</view>
</view>
</view>
<!-- <view class="weizhi">
<view class="lt" @click="btnweizhi">
<image src="https://api.ccttiot.com/smartmeter/img/static/u89SQe8SWGXW1jH3VghJ" mode=""></image> <text v-if="xqdz == ''">你在哪里 </text>
<input v-if="xqdz == ''" style="width: 400rpx;" type="text" :disabled="true" v-model="xqdz" placeholder="(必填.越详细越易被推荐)" value="" />
<input v-else type="text" :disabled="true" v-model="xqdz" placeholder="(必填.越详细越易被推荐)" value="" />
</view>
<view class="rt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uP31r333Y9Uu7hsl05TB" mode=""></image>
</view>
</view> -->
<view class="botanniu">
<view class="an" @click="btnfb">
发布
</view>
</view>
</view>
</template>

View File

@ -122,12 +122,13 @@
active: 1,
flag: true,
devicesList: [],
newlist:[],
deviceId: '',
name: '',
mac: '',
flags: true,
userid: '',
arr: '',
arr: [],
jiaohuaqi: [],
getpre: [],
showNameDialog: false,
@ -317,30 +318,39 @@
deviceName: this.customDeviceName
}
console.log(data,'参数');
this.$u.post(`/app/device/addDevice`, data).then((res) => {
this.$u.post(`/app/device/bindDeviceByBlueTooth`, data).then((res) => {
if (res.code == 200) {
let datas = {
mac:mac
}
this.$u.post(`/app/device/bindDevice`, datas).then(resp =>{
if(resp.code == 200){
uni.showToast({
title:'绑定成功',
icon: 'none',
duration: 3000
})
this.showNameDialog = false;
setTimeout(() => {
uni.navigateBack()
}, 2000)
}else{
uni.showToast({
title: resp.msg,
icon: 'none',
duration: 3000
})
}
uni.showToast({
title:'绑定成功',
icon: 'none',
duration: 3000
})
this.showNameDialog = false;
setTimeout(() => {
uni.navigateBack()
}, 2000)
// let datas = {
// mac:mac
// }
// this.$u.post(`/app/device/bindDevice`, datas).then(resp =>{
// if(resp.code == 200){
// uni.showToast({
// title:'',
// icon: 'none',
// duration: 3000
// })
// this.showNameDialog = false;
// setTimeout(() => {
// uni.navigateBack()
// }, 2000)
// }else{
// uni.showToast({
// title: resp.msg,
// icon: 'none',
// duration: 3000
// })
// }
// })
} else {
console.log(res,'报错');
uni.showToast({
@ -434,7 +444,7 @@
//
updateDeviceList(existList) {
const newDevices = this.devicesList.filter(item => {
const newDevices = this.newlist.filter(item => {
const mac = item.name.slice(-12)
return !this.jiaohuaqi.some(device => device.name === mac) &&
!this.displayQueue.some(device => device.name === mac)
@ -474,9 +484,12 @@
let devicesarr = []
this.devicesList = options.data
options.data.forEach(item => {
devicesarr.push(item.name.slice(-12))
if(item.localName.slice(0,5) == 'WATER' || item.localName.slice(0,5) == 'SMSJ:'){
devicesarr.push(item.localName.slice(-12))
this.newlist.push(item)
}
})
this.arr = devicesarr.join(',')
this.arr = devicesarr
// 使
if (this.throttleTimer) {
@ -485,8 +498,8 @@
this.throttleTimer = setTimeout(() => {
if (this.devicesList.length > 0) {
const data = { mac: this.arr }
this.$u.post(`/app/getExistListByMacs`, data)
// const data = { macList: this.arr }
this.$u.get(`/app/device/list?macList=${this.arr}`)
.then(res => {
if (res.code === 200) {
this.updateDeviceList(res.data)

View File

@ -17,7 +17,7 @@
<text class="one" style="margin-right: 124rpx;">MAC</text>
<text>{{user.mac == undefined ? '--' : user.mac}}</text>
</view>
<view class="wifi" style="margin-top: 78rpx;" @click="btnxip">
<view class="wifi" style="margin-top: 78rpx;" @click="btnxip" v-if="pre != 'SMSJ:'">
<view class="">息屏</view>
<view class="flex">{{xinpin == null ? '--' : xinpin + '秒'}}
<image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" mode=""></image>
@ -116,7 +116,8 @@
version:'',
xinpin:'',
imgpic:'',
varflag:''
varflag:'',
pre:''
}
},
//
@ -135,8 +136,8 @@
}
},
onLoad(option) {
console.log(option,'000000000000000000000000000000000000000000');
this.varflag = option.varflag
console.log(option,'0000');
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
xBlufi.notifySendCustomData({
customData: "11get"
@ -252,7 +253,7 @@
},
//
getshebxq() {
this.$u.get(`/app/getDeviceInfo/${this.deviceid}`).then(res => {
this.$u.get(`/app/device/getDetail?deviceId=${this.deviceid}`).then(res => {
if (res.code == 200) {
this.user = res.data
this.getbanbens()
@ -274,6 +275,7 @@
getbanbens(){
this.$u.get(`/app/model/${this.user.modelId}`).then(res => {
if (res.code == 200) {
this.pre = res.data.pre
this.version = res.data.version
console.log(this.ver,'当前蓝牙版本号',this.version,'最新蓝牙版本号');
this.file = res.data.asDeviceVersion.file
@ -427,11 +429,38 @@
}
}else{
console.log('jiexijiexi',options);
const inputString = options.data.slice(0, -1) + ";"
const hasAtSymbol = inputString.includes(',');
let processedString = inputString;
let currentDay = 0;
const pairs = processedString.split(';').filter(Boolean);
const inputString = options.data.slice(0, -1) + ";"
// @
const hasAtSymbol = inputString.includes('@');
let processedString;
let currentDay = 0;
if (hasAtSymbol) {
// @
const firstAtIndex = inputString.indexOf('@');
let vvv = inputString.substring(0, firstAtIndex) || ''
this.ver = 'V' + vvv.slice(3)
processedString = inputString.substring(firstAtIndex + 1) || '';
} else {
processedString = inputString;
this.ver = '';
}
// @low:0 low:0
if (processedString.includes('@low:0') || processedString.includes('low:0')) {
// @low:0
processedString = processedString.replace(/@low:0@?/g, '');
// low:0@@
processedString = processedString.replace(/^low:0@/g, '');
// low:0
processedString = processedString.replace(/^low:0;?/g, ''); //
processedString = processedString.replace(/;low:0;?/g, ';'); //
processedString = processedString.replace(/;low:0$/g, ''); //
processedString = processedString.replace(/^low:0$/g, ''); // low:0
//
processedString = processedString.replace(/;;+/g, ';').replace(/^;+|;+$/g, '');
}
const pairs = processedString.split(';').filter(Boolean);
const showObject = {};
const pSetObjects = {};
// p_set
@ -455,11 +484,13 @@
}
})
console.log(showObject,'showObjectshowObject');
if(this.ver == 'ver290' || this.ver == 'ver290'){
this.xinpin = showObject.showArray[showObject.showArray.length - 1]
}else{
this.xinpin = showObject.showArray[showObject.showArray.length - 2]
}
// this.ver
const verNumber = parseInt(this.ver.replace(/\D/g, '')) || 0;
if(verNumber >= 290){
this.xinpin = showObject.showArray[showObject.showArray.length - 1]
}else{
this.xinpin = showObject.showArray[showObject.showArray.length - 2]
}
}
break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:

View File

@ -262,6 +262,13 @@
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},{
"path": "wgkongzhi",
"style": {
"navigationBarTitleText": "设备录入",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},{
"path": "sehzhi",
"style": {

View File

@ -7,7 +7,7 @@
<view class="gateway-header">
<view class="gateway-icon-wrapper">
<image class="gateway-icon" :src="item.picture || item.modelPicture " mode="aspectFill"></image>
<view class="status-dot" :class="(item.onlineStatus == 1 || item.onlineStatus == 0) ? 'status-online-dot' : 'status-offline-dot'"></view>
<view class="status-dot" :class="item.onlineStatus == 1 ? 'status-online-dot' : 'status-offline-dot'"></view>
</view>
<view class="gateway-main-info">
<view class="gateway-title-row">
@ -15,8 +15,8 @@
</view>
<view class="gateway-model">{{ item.modelName }}</view>
</view>
<view class="gateway-status-badge" :class="(item.onlineStatus == 1 || item.onlineStatus == 0) ? 'status-online' : 'status-offline'">
{{ (item.onlineStatus == 1 || item.onlineStatus == 0) ? '在线' : '离线' }}
<view class="gateway-status-badge" :class="item.onlineStatus == 1 ? 'status-online' : 'status-offline'">
{{ item.onlineStatus == 1 ? '在线' : '离线' }}
</view>
</view>
<view class="gateway-divider"></view>
@ -64,7 +64,7 @@
//
getlist(){
let userId = uni.getStorageSync('userId')
this.$u.get(`/app/getDeviceInfoByUser?userId=${userId}&classifyCodeList=6`).then((res) => {
this.$u.get(`/app/device/list?userId=${userId}&classifyCodeList=6`).then((res) => {
if (res.code == 200) {
this.gatewayList = res.data
}

View File

@ -8,8 +8,8 @@
<image :src="wgxq.picture || wgxq.modelPicture || ''" mode="aspectFill"></image>
<view class="wgname">
<text>{{ wgxq.deviceName || '未命名设备' }}</text>
<view class="status-badge" :class="(wgxq.onlineStatus == 1 || wgxq.onlineStatus == 0) ? 'status-online' : 'status-offline'">
{{ (wgxq.onlineStatus == 1 || wgxq.onlineStatus == 0) ? '在线' : '离线' }}
<view class="status-badge" :class="wgxq.onlineStatus == 1 ? 'status-online' : 'status-offline'">
{{ wgxq.onlineStatus == 1 ? '在线' : '离线' }}
</view>
</view>
</view>
@ -57,7 +57,7 @@
<text>{{ item.deviceName || '未命名设备' }}</text>
<text style="color: #808080;font-size: 24rpx;">{{ item.modelName || '--' }}</text>
</view>
<view class="item-status" :class="(item.onlineStatus == 1 || item.onlineStatus == 0) ? 'status-online-dot' : 'status-offline-dot'"></view>
<view class="item-status" :class="item.onlineStatus == 1 ? 'status-online-dot' : 'status-offline-dot'"></view>
</view>
<view class="empty-device" v-if="wglist.length === 0">
<text>暂无设备</text>
@ -122,7 +122,7 @@
})
},
getxq(){
this.$u.get(`/app/getDeviceInfo/${this.id}`).then((res) => {
this.$u.get(`/app/device/getDetail?deviceId=${this.id}`).then((res) => {
if (res.code == 200) {
this.wgxq = res.data
console.log(11);

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,10 @@
<button type="primary reverse" open-type="chooseAvatar" @chooseavatar="getImage">
<image :src="imageSrc" mode=""></image>
</button>
<view class="name" @click="editName"> {{userobj.nickName == undefined ? '' : userobj.nickName}} <image style="width: 50rpx;height: 50rpx;" src="https://api.ccttiot.com/smartmeter/img/static/ubGJ5hT0FVzaNuVLxQMO"></image> </view>
<view class="name-info">
<view class="name" @click="editName"> {{userobj.nickName == undefined ? '' : userobj.nickName}} <image style="width: 50rpx;height: 50rpx;" src="https://api.ccttiot.com/smartmeter/img/static/ubGJ5hT0FVzaNuVLxQMO"></image> </view>
<view class="phone" v-if="userobj.userName">{{formatPhone(userobj.userName)}}</view>
</view>
</view>
<view class="" v-if="isSysAdmin" @click="btnlr" style="width:180rpx;text-align: center;border-radius: 30rpx;height: 70rpx;background-color: #48893B;color: #fff;position: fixed;top: 200rpx;right: 16rpx;line-height: 70rpx;">
网关录入
@ -64,25 +67,25 @@
<view class="waterfall-container">
<view class="waterfall-left">
<view class="demo-warter" v-for="(item, index) in feedLists.filter((_, i) => i % 2 === 0)" :key="index" @click="btngonglue(item)">
<u-lazy-load
v-if="!isVideo(firstMedia(item))"
threshold="-450"
border-radius="0"
:image="firstMedia(item)"
:index="index"
></u-lazy-load>
<view v-else class="video-holder">
<video
class="feed-video"
:src="firstMedia(item)"
:poster="item.cover || firstMedia(item)"
autoplay
controls
playsinline
webkit-playsinline
muted
></video>
</view>
<u-lazy-load
v-if="!isVideo(firstMedia(item))"
threshold="-450"
border-radius="0"
:image="firstMedia(item)"
:index="index"
></u-lazy-load>
<view v-else class="video-holder">
<video
class="feed-video"
:src="firstMedia(item)"
:poster="item.cover || firstMedia(item)"
autoplay
controls
playsinline
webkit-playsinline
muted
></video>
</view>
<view class="dizhi">
{{item.title && item.title.length > 10 ? item.title.slice(0,20) + '...' : item.title}}
</view>
@ -101,25 +104,25 @@
</view>
<view class="waterfall-right">
<view class="demo-warter" v-for="(item, index) in feedLists.filter((_, i) => i % 2 === 1)" :key="index" @click="btngonglue(item)">
<u-lazy-load
v-if="!isVideo(firstMedia(item))"
threshold="-450"
border-radius="0"
:image="firstMedia(item)"
:index="index"
></u-lazy-load>
<view v-else class="video-holder">
<video
class="feed-video"
:src="firstMedia(item)"
:poster="item.cover || firstMedia(item)"
autoplay
controls
playsinline
webkit-playsinline
muted
></video>
</view>
<u-lazy-load
v-if="!isVideo(firstMedia(item))"
threshold="-450"
border-radius="0"
:image="firstMedia(item)"
:index="index"
></u-lazy-load>
<view v-else class="video-holder">
<video
class="feed-video"
:src="firstMedia(item)"
:poster="item.cover || firstMedia(item)"
autoplay
controls
playsinline
webkit-playsinline
muted
></video>
</view>
<view class="dizhi">
{{item.title && item.title.length > 10 ? item.title.slice(0,20) + '...' : item.title}}
</view>
@ -312,7 +315,7 @@
this.feedList = this.feedList.concat(res.rows)
this.pageNum ++
}
console.log(this.feedList);
console.log(this.feedList)
}
})
},
@ -558,7 +561,24 @@
}
})
}
}
},
// *
formatPhone(phone) {
if (!phone || typeof phone !== 'string') return ''
//
const phoneNumber = phone.replace(/\D/g, '')
// 113 + **** + 4
if (phoneNumber.length === 11) {
return phoneNumber.substring(0, 3) + '****' + phoneNumber.substring(7)
}
// 117
if (phoneNumber.length > 7) {
const start = Math.floor((phoneNumber.length - 4) / 2)
return phoneNumber.substring(0, start) + '****' + phoneNumber.substring(start + 4)
}
//
return phone
}
}
}
</script>
@ -848,11 +868,21 @@
font-size: 40rpx;
color: #3D3D3D;
font-weight: 600;
.name{
.name-info{
position: absolute;
left: 220rpx;
display: flex;
align-items: center;
flex-direction: column;
.name{
display: flex;
align-items: center;
}
.phone{
font-size: 28rpx;
color: #767676;
font-weight: 400;
margin-top: 8rpx;
}
}
}