Merge branch 'liubiao-main'
This commit is contained in:
82
pages/6155/ImgCrop.vue
Normal file
82
pages/6155/ImgCrop.vue
Normal file
@ -0,0 +1,82 @@
|
||||
<template>
|
||||
<view>
|
||||
<canvas id="splashCanvas" canvas-id="splashCanvas" style="width: 160px; height: 80px; z-index: 9999;position: fixed; visibility: hidden;"></canvas>
|
||||
|
||||
|
||||
<qf-image-cropper :src="src" :showAngle="false" :width="1600" :height="800" fileType="jpg"
|
||||
@crop="handleCrop" :gpu="true">
|
||||
</qf-image-cropper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue';
|
||||
export default {
|
||||
components: {
|
||||
QfImageCropper
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
src: "",
|
||||
Statu: false
|
||||
|
||||
}
|
||||
},
|
||||
onLoad: function(option) {
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
var these = this;
|
||||
eventChannel.on('checkImg', function(data) {
|
||||
console.log("我收到你的消息了,消息内容是:" + JSON.stringify(data));
|
||||
these.src = data.data;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleCrop(e) {
|
||||
var these = this;
|
||||
this.Statu = true;
|
||||
console.log("裁剪完成");
|
||||
console.log(e.tempFilePath);
|
||||
|
||||
const ctx = uni.createCanvasContext('splashCanvas', this);
|
||||
ctx.drawImage(
|
||||
e.tempFilePath,
|
||||
0,0,160,80
|
||||
);
|
||||
setTimeout(() => {
|
||||
ctx.draw(false, ()=>{
|
||||
console.log("abcdefg")
|
||||
uni.canvasGetImageData({
|
||||
canvasId: 'splashCanvas',
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 160,
|
||||
height: 80,
|
||||
success: (res) => {
|
||||
// 处理像素数据并发送
|
||||
console.log("res.data.length="+res.data.length);
|
||||
// this.processAndSendImageData(res.data).then(
|
||||
// resolve).catch(reject);
|
||||
const eventChannel = these.getOpenerEventChannel();
|
||||
eventChannel.emit('ImgCutOver',res.data);
|
||||
uni.navigateBack();
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(`获取canvas数据失败: ${err.errMsg}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 500);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.canvas {
|
||||
width: 1600px;
|
||||
height: 800px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
</style>
|
@ -1,257 +0,0 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<custom-navbar :showBack="true"></custom-navbar>
|
||||
<view class="pageContent" :style="{ paddingTop: navBarHeight + 'px' }">
|
||||
<view class="scanner">
|
||||
<view class="pulse"></view>
|
||||
<view class="device-name">
|
||||
<!-- <image src="/static/images/svgg.png" class="bluth"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="device">我的设备</view>
|
||||
<scroll-view class="device-list" scroll-y>
|
||||
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
||||
<!-- 设备卡片内容保持不变 -->
|
||||
<view @click.stop="handleFile(item)" class="device-card">
|
||||
<view class="device-header">
|
||||
<view class="deviceIMG">
|
||||
<!-- <image src="/static/images/bip.png" mode="" class="IMG"></image> -->
|
||||
</view>
|
||||
<view class="device-name1">
|
||||
<view>设备:001-00</view>
|
||||
<view class="ID">
|
||||
<view>ID:0222222</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
<view class="device">其他设备</view>
|
||||
<scroll-view class="device-list" scroll-y>
|
||||
<block v-for="(item, index) in 3" :key="index" :ref="'swipeItem_' + index">
|
||||
<!-- 设备卡片内容保持不变 -->
|
||||
<view @click.stop="handleFile(item)" class="device-card">
|
||||
<view class="device-header">
|
||||
<view class="deviceIMG">
|
||||
<!-- <image src="/static/images/bip.png" mode="" class="IMG"></image> -->
|
||||
</view>
|
||||
<view class="device-name1">
|
||||
<view>设备:001-00</view>
|
||||
<view class="ID">
|
||||
<view>ID:0222222</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 这里可以添加数据绑定
|
||||
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
||||
deviceList:[{}]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 扫描
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pageContent {
|
||||
min-height: 100vh;
|
||||
background-color: rgb(18, 18, 18);
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.scanner {
|
||||
position: relative;
|
||||
width: 600rpx;
|
||||
height: 600rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* 设备名称 */
|
||||
.device-name {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
background: rgba(187, 230, 0, 1);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.bluth {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
|
||||
/* 脉冲波纹效果 */
|
||||
.pulse {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
border: 1px solid rgba(206, 242, 49, 0.05);
|
||||
background: rgba(206, 242, 49, 0.05);
|
||||
animation: pulse 4s infinite cubic-bezier(0.2, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
/* 通过伪元素创建4层波纹 */
|
||||
.pulse::before,
|
||||
.pulse::after,
|
||||
.pulse .ripple-1,
|
||||
.pulse .ripple-2 {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-radius: 50%;
|
||||
background: rgba(187, 230, 0, 0.4);
|
||||
border: 1px solid rgba(206, 242, 49, 0.04);
|
||||
animation: inherit;
|
||||
}
|
||||
|
||||
.pulse::before {
|
||||
animation-delay: 1s;
|
||||
}
|
||||
|
||||
.pulse::after {
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
.pulse .ripple-1 {
|
||||
animation-delay: 0.5s;
|
||||
}
|
||||
|
||||
.pulse .ripple-2 {
|
||||
animation-delay: 1.5s;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
transform: scale(0.1);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
70% {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(1);
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.device {
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
/* 设备卡片 */
|
||||
.device-card {
|
||||
background-color: rgb(26, 26, 26);
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 20rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.device-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 15rpx;
|
||||
padding: 30rpx 0 10rpx 30rpx;
|
||||
}
|
||||
|
||||
.device-name1 {
|
||||
font-size: 32rpx;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
margin-left:40rpx;
|
||||
line-height: 50rpx;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.ID {
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 26rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
|
||||
.device-status {
|
||||
width: 122rpx;
|
||||
height: 52rpx;
|
||||
font-size: 26rpx;
|
||||
border-radius: 0px 8px 0px 8px;
|
||||
background-color: rgb(42, 42, 42);
|
||||
position: absolute;
|
||||
top: 0rpx;
|
||||
right: 0rpx;
|
||||
text-align: center;
|
||||
line-height: 52rpx;
|
||||
}
|
||||
|
||||
.circle {
|
||||
width:8rpx;
|
||||
height: 40rpx;
|
||||
position: absolute;
|
||||
right:25rpx;
|
||||
top:85rpx;
|
||||
}
|
||||
|
||||
.online {
|
||||
color: rgb(187, 230, 0);
|
||||
}
|
||||
|
||||
.device-id {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin-bottom: 20rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.device-info {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
font-size: 28rpx;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
position: relative;
|
||||
padding: 0rpx 0rpx 30rpx 30rpx;
|
||||
}
|
||||
|
||||
.deviceIMG {
|
||||
/* width: 100rpx;
|
||||
height: 100rpx;
|
||||
border-radius: 16rpx;
|
||||
position: relative;
|
||||
background-color: rgba(42, 42, 42, 0.6);
|
||||
display: flex;
|
||||
align-items: center; */
|
||||
}
|
||||
|
||||
.IMG {
|
||||
width:38rpx;
|
||||
height: 80rpx;
|
||||
margin-left: 17%;
|
||||
}
|
||||
</style>
|
1334
pages/6155/deviceDetail.vue
Normal file
1334
pages/6155/deviceDetail.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>6155</h1>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
</script>
|
11
pages/6170/editVideo/index.vue
Normal file
11
pages/6170/editVideo/index.vue
Normal file
@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<view>
|
||||
<text>编辑视频</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
350
pages/6170/operatingInstruct/index.vue
Normal file
350
pages/6170/operatingInstruct/index.vue
Normal file
@ -0,0 +1,350 @@
|
||||
<template>
|
||||
<!-- 使用自定义导航栏 -->
|
||||
<view>
|
||||
<custom-navbar :title="navTitle" :showBack="true" backgroundColor="#202020" color="#FFFFFF" right-text="编辑"
|
||||
right-color="rgba(255, 255, 255, 0.87)" @right-click="handleEdit"></custom-navbar>
|
||||
<view class="device-page" :style="{ paddingTop: navBarHeight + 'px' }">
|
||||
<view class="pathContent">
|
||||
<image src="/static/images/path3.png" mode="" class="path3"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!--上传文件弹框 -->
|
||||
<view class="agreement-mask" v-if="opeartShow">
|
||||
<!-- 上传画面弹窗 -->
|
||||
<view class="agreement-popup">
|
||||
<!-- 标题 -->
|
||||
<view class="popup-title">编辑</view>
|
||||
<view class="popup-content">
|
||||
<view v-for="(item, index) in items" :key="index">
|
||||
<view class="item" :class="{'selected': index === selectedItemIndex}"
|
||||
@click="handleItemAction(index)"> <!-- 修改点击事件 -->
|
||||
<image :src="item.image" class="setIMG"></image>
|
||||
{{item.text}}
|
||||
<!-- 隐藏的文件输入(仅用于上传模式) -->
|
||||
<!-- <input v-if="index === 0" type="file" ref="fileInput" style="display: none"
|
||||
@change="onFileSelect"> -->
|
||||
<uni-file-picker v-if="index === 0" limit="1" file-mediatype="all"></uni-file-picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮组 -->
|
||||
<view class="popup-buttons">
|
||||
<button class="agree" @click="handleupload">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="agreement-mask" v-if="opeartSuccess">
|
||||
<view class="agreement-popupC">
|
||||
<view class="popup-content">
|
||||
<image src="/static/images/path5.png" mode="" class="path2"></image>
|
||||
<view class="popup-Title">
|
||||
<view>上传成功!</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮组 -->
|
||||
<view class="popup-buttons">
|
||||
<button class="btn agreeBtn" @click="handleBtn">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- =============删除文件,列表文件=============== -->
|
||||
<view class="agreement-mask" v-if="opeartDelect">
|
||||
<!-- 上传画面弹窗 -->
|
||||
<view class="agreement-popup">
|
||||
<view class="popup-title">删除文件</view>
|
||||
<view class="popup-content">
|
||||
<!-- 设备列表 -->
|
||||
<scroll-view class="device-list" scroll-y>
|
||||
<view class="device-card" v-for="(item, index) in delectList" :key="index"
|
||||
@click="toggleSelect(index)">
|
||||
<!-- 复选框 -->
|
||||
<view class="checkbox" :class="{ checked: item.checked }">
|
||||
<uni-icons v-if="item.checked" type="checkmarkempty" size="18"
|
||||
color="rgb(0, 0, 0)"></uni-icons>
|
||||
</view>
|
||||
<!-- 设备信息 -->
|
||||
<view class="device-content">
|
||||
<view class="device-header">
|
||||
<view class="device-name">
|
||||
<view>设备:001-00</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 按钮组 -->
|
||||
<view class="popup-buttons">
|
||||
<button class="agree" @click="handleopearBtn">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
navTitle: '操作说明',
|
||||
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
||||
opeartShow: false,
|
||||
items: [{
|
||||
text: '点击选择上传文件',
|
||||
selected: true,
|
||||
image: '/static/images/upload.png'
|
||||
},
|
||||
{
|
||||
text: '删除文件',
|
||||
selected: false,
|
||||
image: '/static/images/delete.png'
|
||||
}
|
||||
],
|
||||
selectedItemIndex: 0, // 默认选中第一个
|
||||
fileInput: false,
|
||||
opeartSuccess: false,
|
||||
opeartDelect: false,
|
||||
delectList: Array(6).fill().map((_, i) => ({
|
||||
id: `1321615${i}`,
|
||||
checked: false,
|
||||
showConfirm: false
|
||||
})),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 编辑
|
||||
handleEdit() {
|
||||
this.opeartShow = true
|
||||
},
|
||||
handleItemAction(index) {
|
||||
this.selectedItemIndex = index;
|
||||
if (index === 0) {
|
||||
// 调用 Uni-app 文件选择 API
|
||||
// uni.chooseFile({
|
||||
// count: 1, // 最多选择1个文件
|
||||
// success: (res) => {
|
||||
// const file = res.tempFiles[0];
|
||||
// this.items[0].text = `已选择: ${file.name}`;
|
||||
// this.selectedFile = file; // 存储文件对象
|
||||
// }
|
||||
// });
|
||||
} else {
|
||||
// 这里是走删除弹框列表
|
||||
this.opeartDelect = true //显示批量删除弹框列表
|
||||
this.opeartShow = false //隐藏编辑弹框
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
onFileSelect(e) {
|
||||
const files = e.target.files;
|
||||
if (files.length > 0) {
|
||||
// 这里拿到文件对象,可以立即上传或显示文件名
|
||||
console.log("选择的文件:", files[0].name);
|
||||
// 示例:显示文件名在item.text中
|
||||
this.items[0].text = `已选择: ${files[0].name}`;
|
||||
}
|
||||
},
|
||||
// 确认
|
||||
handleupload() {
|
||||
this.opeartSuccess = true
|
||||
//this.opeartShow = false;
|
||||
},
|
||||
// 上传成功后确实弹框提示确认
|
||||
handleBtn() {
|
||||
this.opeartSuccess = false
|
||||
},
|
||||
toggleSelect(index) {
|
||||
this.delectList[index].checked = !this.delectList[index].checked
|
||||
this.$forceUpdate()
|
||||
},
|
||||
// 批量删除文件确认按钮
|
||||
handleopearBtn() {
|
||||
this.opeartDelect = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.device-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
background-color: rgb(18, 18, 18);
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.pathContent {
|
||||
background-color: rgb(52, 52, 52);
|
||||
width: 100%;
|
||||
min-height: 87vh;
|
||||
}
|
||||
|
||||
.files-button uni-button {
|
||||
background: red !important;
|
||||
position: absolute;
|
||||
left: 50rpx;
|
||||
top: 50rpx
|
||||
}
|
||||
|
||||
.path2 {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.popup-Title {
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
padding: 20rpx 0rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.path3 {
|
||||
width: 172rpx;
|
||||
height: 114rpx;
|
||||
transform: translate(-50%, -50%);
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%
|
||||
}
|
||||
|
||||
/* 遮罩层 */
|
||||
.agreement-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
/* 弹窗主体 */
|
||||
.agreement-popup {
|
||||
width: 100%;
|
||||
height: 50%;
|
||||
background-color: rgb(42, 42, 42);
|
||||
border-radius: 60rpx 60rpx 0rpx 0rpx;
|
||||
padding: 40rpx;
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
bottom: 0rpx;
|
||||
}
|
||||
|
||||
.agreement-popupC {
|
||||
width: 70%;
|
||||
background-color: rgb(42, 42, 42);
|
||||
border-radius: 40rpx;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid rgba(187, 230, 0, 0.3);
|
||||
}
|
||||
|
||||
.popup-title {
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.agree {
|
||||
background-color: rgb(187, 230, 0);
|
||||
color: #232323;
|
||||
border: none;
|
||||
font-size: 24rpx;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
bottom: 0rpx;
|
||||
left: 0rpx
|
||||
}
|
||||
|
||||
.item {
|
||||
padding: 10px;
|
||||
margin: 5px 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.setIMG {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.item.selected {
|
||||
background-color: rgb(58, 58, 58);
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
margin-top: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 通用按钮样式 */
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
border-radius: 40rpx;
|
||||
font-size: 32rpx;
|
||||
margin: 10rpx auto;
|
||||
width: 200rpx;
|
||||
}
|
||||
|
||||
/* 同意按钮 */
|
||||
.agreeBtn {
|
||||
background-color: rgb(187, 230, 0);
|
||||
color: #232323;
|
||||
border: none;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
/* 删除文件,弹框列表样式文件
|
||||
*/
|
||||
.device-card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
|
||||
.device-content {
|
||||
border-radius: 8rpx;
|
||||
background: rgba(58, 58, 58, 1);
|
||||
margin-bottom: 20rpx;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
width: 93%;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border: 2rpx solid rgba(255, 255, 255, 0.5);
|
||||
margin-right: 20rpx;
|
||||
border-radius: 4rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: -25rpx;
|
||||
}
|
||||
|
||||
.checkbox.checked {
|
||||
background-color: rgb(187, 230, 0);
|
||||
border-color: rgb(187, 230, 0);
|
||||
}
|
||||
</style>
|
22
pages/common/addBLE/LinkBle.vue
Normal file
22
pages/common/addBLE/LinkBle.vue
Normal file
@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
598
pages/common/addBLE/addEquip.vue
Normal file
598
pages/common/addBLE/addEquip.vue
Normal file
@ -0,0 +1,598 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="topAnimate">
|
||||
<view class="animate center">
|
||||
<view class="animateContent">
|
||||
<view class="circle"></view>
|
||||
<view class="circle"></view>
|
||||
<view class="circle"></view>
|
||||
</view>
|
||||
|
||||
<view class="imgContent center">
|
||||
<view class="img center">
|
||||
<image src="/static/images/bluetooth.png" class="titleIco" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mainContent">
|
||||
<view class="p100">
|
||||
|
||||
<view class="lblTitle">配对设备</view>
|
||||
<view class="list" style="margin-bottom: 30rpx;">
|
||||
|
||||
<view class="item " v-for="item, index in PairEquip" v-show="PairEquip.length>0">
|
||||
<view class="leftImg ">
|
||||
<image src="/static/images/BLEAdd/device.png" class="titleIco" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
<view class="centertxt ">
|
||||
<view class="name" v-text="item.name"></view>
|
||||
<view class="id" v-text="item.deviceId"></view>
|
||||
</view>
|
||||
<view class="rightIco center">
|
||||
<image src="/static/images/BLEAdd/linked.png" class="img" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
<view v-show="PairEquip.length==0" class="item center">
|
||||
<view class="noLink">无已配对设备</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="lblTitle">搜索设备</view>
|
||||
<view class="list searchList">
|
||||
<view class="item" v-on:click="Link(item,index)" v-for="item, index in EquipMents"
|
||||
v-show="!item['linkStatu']">
|
||||
<view class="leftImg ">
|
||||
<image src="/static/images/BLEAdd/device.png" class="titleIco" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
<view class="centertxt ">
|
||||
<view class="name" v-text="item.name?item.name:'Unnamed'"></view>
|
||||
<view class="id" v-text="item.deviceId"></view>
|
||||
</view>
|
||||
<view class="rightIco center">
|
||||
<image :src="isItemLink(item,index)" class="img" mode="aspectFit">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<BottomSlideMenuPlus :config="Status.BottomMenu">
|
||||
<view class="openBlue">
|
||||
<view class="txt">
|
||||
当前手机蓝牙关闭,是否打开以扫描附近的蓝牙设备?
|
||||
</view>
|
||||
<view class="btns">
|
||||
<view class="btn cancel" @click="Status.BottomMenu.show=false">
|
||||
<view>取消</view>
|
||||
</view>
|
||||
<view class="ok btn" @click="gotoSetting">
|
||||
<view>开启</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</BottomSlideMenuPlus>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ble from '../../../api/6155/BlueHelper.js';
|
||||
import request from '../../../utils/request.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Status: {
|
||||
BottomMenu: {
|
||||
show: false,
|
||||
showHeader: false,
|
||||
menuItems: [],
|
||||
activeIndex: -1,
|
||||
bgColor: '#2a2a2a',
|
||||
itemBgColor: '#3a3a3a',
|
||||
textColor: '#ffffffde',
|
||||
textAlign: 'flex-start',
|
||||
title: '主灯模式',
|
||||
showDivider: false,
|
||||
dividerColor: '#00000000',
|
||||
dividerThickness: '0rpx',
|
||||
dividerMargin: '10rpx',
|
||||
itemHeight: '80rpx',
|
||||
type: '',
|
||||
showBtn: false,
|
||||
btnBgColor: "#bbe600",
|
||||
btnText: "确定",
|
||||
btnTextColor: "#232323de",
|
||||
showMask: true,
|
||||
maskBgColor: '#00000066',
|
||||
showClose: false
|
||||
}
|
||||
|
||||
},
|
||||
PairEquip: [], //已配对设备
|
||||
EquipMents: [] //搜索出来的设备
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
ble.StopSearch();
|
||||
},
|
||||
onBackPress: (e) => {
|
||||
ble.StopSearch();
|
||||
ble.disconnectDevice();
|
||||
},
|
||||
|
||||
onShow: function() {
|
||||
// return;
|
||||
var these = this;
|
||||
uni.getStorage({
|
||||
key: "linkedDevices",
|
||||
success: (res) => {
|
||||
this.PairEquip = JSON.parse(res.data);
|
||||
},
|
||||
fail: (ex) => {
|
||||
this.PairEquip = [];
|
||||
}
|
||||
});
|
||||
|
||||
if (process.env.UNI_PLATFORM == 'mp-weixin' ||
|
||||
process.env.UNI_PLATFORM == 'mp-alipay' ||
|
||||
process.env.UNI_PLATFORM == 'app-plus' ||
|
||||
process.env.UNI_PLATFORM == 'app'
|
||||
|
||||
) {
|
||||
//打开蓝牙开始搜索设备
|
||||
ble.OpenBlue(true, () => {
|
||||
ble.StartSearch(function(arr) {
|
||||
|
||||
arr = arr.devices;
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
|
||||
arr[i].linkStatu = false;
|
||||
let f = these.EquipMents.find(function(v) {
|
||||
return v.deviceId == arr[i].deviceId;
|
||||
});
|
||||
|
||||
if (!f) {
|
||||
these.EquipMents.push(arr[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
console.log("设备列表:" + JSON.stringify(these.EquipMents));
|
||||
});
|
||||
},
|
||||
() => {
|
||||
these.showOpenSetting();
|
||||
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
console.log('当前环境:' + process.env.UNI_PLATFORM + '不支持蓝牙');
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
isItemLink: function(item, index) {
|
||||
let src = '/static/images/BLEAdd/noLink.png';
|
||||
if (this.PairEquip && this.PairEquip instanceof Array) {
|
||||
if (this.PairEquip.length > 0) {
|
||||
let f = this.PairEquip.find(function(v) {
|
||||
return v.deviceId == item.deviceId;
|
||||
});
|
||||
if (f) {
|
||||
src = '/static/images/BLEAdd/linked.png';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return src;
|
||||
},
|
||||
alert: function(title, content, callback) {
|
||||
if (!title) {
|
||||
title = '提示'
|
||||
}
|
||||
if (!content) {
|
||||
content = title;
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: title,
|
||||
content: content,
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
callback(res);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
showOpenSetting: function() {
|
||||
this.Status.BottomMenu.show = true;
|
||||
},
|
||||
gotoSetting: function() {
|
||||
this.Status.BottomMenu.show = false;
|
||||
ble.showBluetoothGuide(false);
|
||||
},
|
||||
Link: function(item, index) {
|
||||
var these = this;
|
||||
if (process.env.UNI_PLATFORM == 'mp-weixin' ||
|
||||
process.env.UNI_PLATFORM == 'mp-alipay' ||
|
||||
process.env.UNI_PLATFORM == 'app-plus' ||
|
||||
process.env.UNI_PLATFORM == 'app'
|
||||
) {
|
||||
|
||||
uni.showLoading({
|
||||
title: "正在连接",
|
||||
mask: true
|
||||
});
|
||||
setTimeout(() => {
|
||||
|
||||
|
||||
ble.LinkBlue(item.deviceId, function() {
|
||||
let c = these.PairEquip.find(function(v) {
|
||||
return v.deviceId == item.deviceId;
|
||||
});
|
||||
if (!c) {
|
||||
these.PairEquip.push(item);
|
||||
uni.setStorage({
|
||||
key: 'linkedDevices',
|
||||
data: JSON.stringify(these.PairEquip),
|
||||
success: () => {}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 调用绑定设备接口
|
||||
let promise = request({
|
||||
url: '/app/device/bind',
|
||||
method: 'POST',
|
||||
data: {
|
||||
deviceImei: '',
|
||||
deviceMac: item.deviceId,
|
||||
communicationMode: '1', //0是4g,1是蓝牙
|
||||
}
|
||||
});
|
||||
promise.then((res) => {
|
||||
console.log("1111" + JSON.stringify(res));
|
||||
if (res.code == 0) {
|
||||
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.data,
|
||||
icon: 'success'
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
});
|
||||
}
|
||||
}).catch((ex) => {
|
||||
|
||||
uni.showToast({
|
||||
title: '出现了未知的异常,操作失败',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}, (ex) => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
}, 0);
|
||||
|
||||
} else {
|
||||
these.alert("提示", "当前平台不支持蓝牙");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.noLink {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
background-color: #1d1d1d;
|
||||
color: #ffffffde;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.p100 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fleft {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.fright {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.topAnimate {
|
||||
position: absolute;
|
||||
left: 0rpx;
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
top: 20px;
|
||||
/* 距离视口顶部 20px 时固定 */
|
||||
z-index: 100;
|
||||
/* 确保元素显示在最上层 */
|
||||
}
|
||||
|
||||
.animate {
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.animate .animateContent {
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.animate .imgContent {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.animate .imgContent .img {
|
||||
height: 100rpx;
|
||||
width: 100rpx;
|
||||
background: #bbe600;
|
||||
border-radius: 50%;
|
||||
|
||||
}
|
||||
|
||||
.animate .titleIco {
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
|
||||
.circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background-color: #bbe60033;
|
||||
animation: expand 3s infinite ease-out;
|
||||
}
|
||||
|
||||
.circle:nth-child(2) {
|
||||
animation-delay: 1s;
|
||||
}
|
||||
|
||||
.circle:nth-child(3) {
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
@keyframes expand {
|
||||
0% {
|
||||
width: 0;
|
||||
height: 0;
|
||||
opacity: 0.8;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
100% {
|
||||
width: 18.75rem;
|
||||
height: 18.75rem;
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.mainContent {
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: calc(100% - 400rpx);
|
||||
overflow-y: scroll;
|
||||
position: absolute;
|
||||
top: 400rpx;
|
||||
left: 0rpx;
|
||||
}
|
||||
|
||||
|
||||
.mainContent .p100 {}
|
||||
|
||||
.mainContent .lblTitle {
|
||||
color: #ffffffde;
|
||||
font-family: PingFang SC;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
height: 28rpx;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
|
||||
.list {
|
||||
min-height: 120rpx;
|
||||
}
|
||||
|
||||
.searchList {
|
||||
width: 100%;
|
||||
height: calc(100% - 186rpx);
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.list .item {
|
||||
width: 100%;
|
||||
height: 120rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx;
|
||||
border-radius: 8px;
|
||||
background: #1a1a1a;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.list .item .leftImg {
|
||||
width: 100rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.list .item .centertxt {
|
||||
width: calc(100% - 150rpx);
|
||||
height: 100%;
|
||||
padding-left: 10rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-evenly;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
|
||||
}
|
||||
|
||||
.list .item .rightIco {
|
||||
width: 50rpx;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
.list .item .leftImg .titleIco {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.list .item .name {
|
||||
color: #ffffffde;
|
||||
font-family: PingFang SC;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
line-height: 50rpx;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.list .item .id {
|
||||
color: #ffffff99;
|
||||
font-family: PingFang SC;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
line-height: 30rpx;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
|
||||
.list .item .rightIco .img {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
|
||||
.openBlue {
|
||||
padding: 30rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.openBlue .txt {
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
font-family: PingFang SC;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0.14rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.openBlue .btns {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
margin-top: 50rpx;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.openBlue .btn {
|
||||
border-radius: 91rpx;
|
||||
box-sizing: border-box;
|
||||
width: 25%;
|
||||
height: 60rpx;
|
||||
text-align: center;
|
||||
font-family: PingFang SC;
|
||||
font-size: 28rpx;
|
||||
letter-spacing: 12rpx;
|
||||
display: flex !important;
|
||||
align-items: center;
|
||||
letter-spacing: 0.375rem;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
|
||||
.openBlue .cancel {
|
||||
border: 1px solid rgba(255, 255, 255, 1);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
.openBlue .ok {
|
||||
background-color: #BBE600;
|
||||
color: #232323;
|
||||
|
||||
}
|
||||
</style>
|
@ -24,8 +24,8 @@
|
||||
style="height:80vh;">
|
||||
<uni-swipe-action ref="swipeAction">
|
||||
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
||||
<uni-swipe-action-item :right-options="Options" @click="handleSwipeClick($event, item, index)"
|
||||
class="device-card">
|
||||
<uni-swipe-action-item :right-options="Options"
|
||||
@click.stop="handleSwipeClick($event, item, index)" class="device-card">
|
||||
<!-- 设备卡片内容保持不变 -->
|
||||
<!-- <view @click.stop="handleFile(item)">
|
||||
<view class="device-header">
|
||||
@ -192,6 +192,7 @@
|
||||
getTab() {
|
||||
deviceTypeList({}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
console.log("deviceTypeList=" + JSON.stringify(res.data));
|
||||
this.tabs = [{
|
||||
id: '',
|
||||
name: '全部设备',
|
||||
@ -264,9 +265,18 @@
|
||||
});
|
||||
break;
|
||||
case 'bluetooth':
|
||||
// uni.navigateTo({
|
||||
// url: 'pages/common/addBLE/AddDevice',
|
||||
// success:(res)=>{
|
||||
// res.eventChannel.emit('key', { data: 'data from starter page' })
|
||||
// },fail: (ex) => {
|
||||
// console.log("跳转失败了",JSON.stringify(ex));
|
||||
// }
|
||||
// });
|
||||
|
||||
uni.navigateTo({
|
||||
url: '/pages/6155/bluetooth/bluetooth'
|
||||
});
|
||||
url: "/pages/common/addBLE/addEquip"
|
||||
})
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -363,31 +373,46 @@
|
||||
})
|
||||
},
|
||||
handleFile(item) {
|
||||
console.log(item, 'item');
|
||||
console.log('item' + JSON.stringify(item));
|
||||
// communicationMode 0是4G 1是蓝牙
|
||||
if (item.communicationMode == 0) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/6170/deviceControl/index?id=${item.id}`
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/6155/index'
|
||||
})
|
||||
}
|
||||
url: `/pages/6170/deviceControl/index?id=${item.id}`
|
||||
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.typeName == '6155') {
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/deviceDetail",
|
||||
events: {
|
||||
ack: function(data) {
|
||||
|
||||
}
|
||||
},
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('detailData', {
|
||||
data: item
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
onIntall() {
|
||||
this.page = 1;
|
||||
this.finished = false;
|
||||
this.getData(); // 重新加载第一页数据
|
||||
},
|
||||
},
|
||||
onIntall() {
|
||||
this.page = 1;
|
||||
this.finished = false;
|
||||
this.getData(); // 重新加载第一页数据
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
this.getTab()
|
||||
this.onIntall()
|
||||
onShow() {
|
||||
this.getTab()
|
||||
this.onIntall()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
@ -61,12 +61,12 @@
|
||||
return {
|
||||
showView: false,
|
||||
//codebtn: '获取验证码',
|
||||
phone: '', //手机号码
|
||||
code: "", //验证码
|
||||
phone: '17671332251', //手机号码
|
||||
code: "123456", //验证码
|
||||
agreed: false,
|
||||
isCounting: false,
|
||||
countdown: 0,
|
||||
isChecked: false,
|
||||
isChecked: true,
|
||||
showAgreement: false, // 控制弹窗显示
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user