new-20250827 批量报警、批量发送消息,分供应商处理 #37
@ -2,12 +2,12 @@
|
|||||||
"version" : "1.0",
|
"version" : "1.0",
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
"playground" : "custom",
|
"playground" : "standard",
|
||||||
"type" : "uni-app:app-ios"
|
"type" : "uni-app:app-ios"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"customPlaygroundType" : "local",
|
"customPlaygroundType" : "local",
|
||||||
"playground" : "custom",
|
"playground" : "standard",
|
||||||
"type" : "uni-app:app-android"
|
"type" : "uni-app:app-android"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -17,6 +17,9 @@
|
|||||||
"default" : {
|
"default" : {
|
||||||
"launchtype" : "local"
|
"launchtype" : "local"
|
||||||
},
|
},
|
||||||
|
"h5" : {
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
"provider" : "aliyun",
|
"provider" : "aliyun",
|
||||||
"type" : "uniCloud"
|
"type" : "uniCloud"
|
||||||
}
|
}
|
||||||
|
|||||||
4
App.vue
@ -212,4 +212,8 @@
|
|||||||
font-family: "PingFangBold";
|
font-family: "PingFangBold";
|
||||||
src: url("~@/static/fonts/PingFangBold.ttf") format("opentype");
|
src: url("~@/static/fonts/PingFangBold.ttf") format("opentype");
|
||||||
}
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: "SongTi";
|
||||||
|
src: url("~@/static/fonts/SongTi.ttf") format("opentype");
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -15,7 +15,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="menu-items" v-if="config.menuItems && config.menuItems.length>0">
|
<view class="menu-items" v-if="config.menuItems && config.menuItems.length>0">
|
||||||
<view class="menu-item" v-for="(item, index) in config.menuItems" :key="index" :style="{
|
<view class="menu-item" v-for="(item, index) in config.menuItems" :key="index" :style="{
|
||||||
color: config.textColor,
|
color: config.textColor,
|
||||||
textAlign: config.textAlign,
|
textAlign: config.textAlign,
|
||||||
height:config.itemHeight,
|
height:config.itemHeight,
|
||||||
lineHeight:config.itemHeight,
|
lineHeight:config.itemHeight,
|
||||||
@ -23,7 +23,7 @@
|
|||||||
paddingRight: config.dividerMargin
|
paddingRight: config.dividerMargin
|
||||||
}" @click="handleItemClick(item, index)">
|
}" @click="handleItemClick(item, index)">
|
||||||
|
|
||||||
<view class="p100" :style="{backgroundColor:config.activeIndex==index?config.itemBgColor:'',
|
<view class="p100" :style="{backgroundColor:(config.activeIndex==index || item[config.valueMember]==config.value) ?config.itemBgColor:'',
|
||||||
justifyContent:config.textAlign
|
justifyContent:config.textAlign
|
||||||
}">
|
}">
|
||||||
<view class="imgContent" v-if="item.icon" :style="{
|
<view class="imgContent" v-if="item.icon" :style="{
|
||||||
@ -73,6 +73,8 @@
|
|||||||
maskBgColor: '', //mask的颜色
|
maskBgColor: '', //mask的颜色
|
||||||
menuItems: [], //菜单项 包含icon text
|
menuItems: [], //菜单项 包含icon text
|
||||||
activeIndex: -1, //当前已选中的项编号
|
activeIndex: -1, //当前已选中的项编号
|
||||||
|
valueMember:'',
|
||||||
|
value:null,
|
||||||
bgColor: '#2a2a2a', //主体背景
|
bgColor: '#2a2a2a', //主体背景
|
||||||
itemBgColor: '#3a3a3a', //各项被选中后的背景
|
itemBgColor: '#3a3a3a', //各项被选中后的背景
|
||||||
textColor: '#ffffffde', //各项的文字颜色
|
textColor: '#ffffffde', //各项的文字颜色
|
||||||
@ -91,7 +93,16 @@
|
|||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
created(){
|
||||||
|
if(this.config.value && this.config.valueMember){
|
||||||
|
this.config.menuItems.find((v,i)=>{
|
||||||
|
if(v[this.config.valueMember]==this.config.value){
|
||||||
|
this.config.activeIndex=i;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
closeMenu() {
|
closeMenu() {
|
||||||
|
|
||||||
@ -108,6 +119,16 @@
|
|||||||
let index = null;
|
let index = null;
|
||||||
if (this.config.activeIndex > -1) {
|
if (this.config.activeIndex > -1) {
|
||||||
item = this.config.menuItems[this.config.activeIndex];
|
item = this.config.menuItems[this.config.activeIndex];
|
||||||
|
}else{
|
||||||
|
for (let i = 0; i < this.config.menuItems.length; i++) {
|
||||||
|
var element = this.config.menuItems[i];
|
||||||
|
if(element[this.config.valueMember]==this.config.value){
|
||||||
|
item=element;
|
||||||
|
index=i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
index = this.config.activeIndex;
|
index = this.config.activeIndex;
|
||||||
this.$emit('btnClick', item, index);
|
this.$emit('btnClick', item, index);
|
||||||
|
|||||||
@ -1,398 +1,373 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="message-popup" v-if="visible">
|
<view class="message-popup" v-if="visible">
|
||||||
<view class="popup-mask" @click="handleMaskClick"></view>
|
<view class="popup-mask" @click="handleMaskClick"></view>
|
||||||
<view
|
<view class="popup-content" :style="{
|
||||||
class="popup-content"
|
|
||||||
:style="{
|
|
||||||
backgroundColor: bgColor || getTypeStyle('bgColor'),
|
backgroundColor: bgColor || getTypeStyle('bgColor'),
|
||||||
borderColor: borderColor || getTypeStyle('borderColor'),
|
borderColor: borderColor || getTypeStyle('borderColor'),
|
||||||
color: textColor || getTypeStyle('textColor')
|
color: textColor || getTypeStyle('textColor')
|
||||||
}"
|
}">
|
||||||
>
|
<view v-if="showHeader&&headerTxt" class="header">{{headerTxt}}</view>
|
||||||
<view v-if="showHeader&&headerTxt" class="header"
|
|
||||||
|
<view v-if="visibleClose" class="rightClose" :style="{color:textColor || getTypeStyle('textColor')}"
|
||||||
>{{headerTxt}}</view>
|
@click="closeClick">x</view>
|
||||||
|
|
||||||
<view v-if="visibleClose" class="rightClose"
|
<view v-if="!visiblePrompt">
|
||||||
:style="{color:textColor || getTypeStyle('textColor')}"
|
<image v-if="iconUrl" :src="iconUrl" mode="aspectFit" class="popup-icon"
|
||||||
@click="closeClick"
|
:style="{ tintColor: textColor || getTypeStyle('textColor') }"></image>
|
||||||
>x</view>
|
<view class="popup-message" :class="showSlot?'displayNone':''">{{ message }}</view>
|
||||||
|
<view class="popup-message" :class="showSlot?'':'displayNone'">
|
||||||
<view v-if="!visiblePrompt">
|
<slot></slot>
|
||||||
<image
|
</view>
|
||||||
v-if="iconUrl"
|
</view>
|
||||||
:src="iconUrl"
|
|
||||||
mode="aspectFit"
|
|
||||||
class="popup-icon"
|
<view v-else class="popup-prompt">
|
||||||
:style="{ tintColor: textColor || getTypeStyle('textColor') }"
|
<text class="popup-prompt-title">{{ promptTitle || '请输入信息' }}</text>
|
||||||
></image>
|
<input class="popup-prompt-input" :placeholder="promptPlaceholder" :value="modelValue"
|
||||||
<view class="popup-message" :class="showSlot?'displayNone':''">{{ message }}</view>
|
@input="handleInput" @confirm="handleButtonClick" />
|
||||||
<view class="popup-message" :class="showSlot?'':'displayNone'">
|
</view>
|
||||||
<slot></slot>
|
|
||||||
</view>
|
<view class="popBtnContent" v-show="showCancel || buttonText">
|
||||||
</view>
|
|
||||||
|
<view class="popup-button-cancel" v-if="showCancel" :style="{display:showCancel?'block':'none'}"
|
||||||
|
@click="handleCancelClick">{{ buttonCancelText?buttonCancelText:'取消' }}</view>
|
||||||
<view v-else class="popup-prompt">
|
|
||||||
<text class="popup-prompt-title">{{ promptTitle || '请输入信息' }}</text>
|
<view class="popup-button" :class="buttonText?'':'displayNone'" :style="{
|
||||||
<input
|
|
||||||
class="popup-prompt-input"
|
|
||||||
:placeholder="promptPlaceholder"
|
|
||||||
:value="modelValue"
|
|
||||||
@input="handleInput"
|
|
||||||
@confirm="handleButtonClick"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="popBtnContent" v-show="showCancel || buttonText">
|
|
||||||
|
|
||||||
<view
|
|
||||||
class="popup-button-cancel"
|
|
||||||
v-if="showCancel"
|
|
||||||
:style="{display:showCancel?'block':'none'}"
|
|
||||||
@click="handleCancelClick"
|
|
||||||
>{{ buttonCancelText?buttonCancelText:'取消' }}</view>
|
|
||||||
|
|
||||||
<view
|
|
||||||
class="popup-button"
|
|
||||||
:class="buttonText?'':'displayNone'"
|
|
||||||
:style="{
|
|
||||||
backgroundColor: buttonBgColor || getTypeStyle('buttonBgColor'),
|
backgroundColor: buttonBgColor || getTypeStyle('buttonBgColor'),
|
||||||
color: buttonTextColor || getTypeStyle('buttonTextColor')
|
color: buttonTextColor || getTypeStyle('buttonTextColor')
|
||||||
}"
|
}" @click="handleButtonClick">{{ buttonText }}</view>
|
||||||
@click="handleButtonClick"
|
|
||||||
>{{ buttonText }}</view>
|
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'MessagePopup',
|
name: 'MessagePopup',
|
||||||
props: {
|
props: {
|
||||||
visible: {
|
visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
visibleClose:{
|
visibleClose: {
|
||||||
type:Boolean,
|
type: Boolean,
|
||||||
default:true
|
default: true
|
||||||
},
|
},
|
||||||
visiblePrompt: {
|
visiblePrompt: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
promptTitle: String,
|
promptTitle: String,
|
||||||
promptPlaceholder: {
|
promptPlaceholder: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "请输入"
|
default: "请输入"
|
||||||
},
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'info',
|
default: 'info',
|
||||||
validator: value => ['success', 'error', 'info','custom'].includes(value)
|
validator: value => ['success', 'error', 'info', 'custom'].includes(value)
|
||||||
},
|
},
|
||||||
bgColor: String,
|
bgColor: String,
|
||||||
borderColor: String,
|
borderColor: String,
|
||||||
textColor: String,
|
textColor: String,
|
||||||
buttonBgColor: String,
|
buttonBgColor: String,
|
||||||
buttonTextColor: String,
|
buttonTextColor: String,
|
||||||
iconUrl: String,
|
iconUrl: String,
|
||||||
message: {
|
message: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
buttonText: {
|
buttonText: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '确定'
|
default: '确定'
|
||||||
},
|
},
|
||||||
buttonCancelText:{
|
buttonCancelText: {
|
||||||
type:String,
|
type: String,
|
||||||
default:'取消'
|
default: '取消'
|
||||||
},
|
},
|
||||||
showCancel:{
|
showCancel: {
|
||||||
type:Boolean,
|
type: Boolean,
|
||||||
default:false
|
default: false
|
||||||
},
|
},
|
||||||
showHeader:{
|
showHeader: {
|
||||||
type:Boolean,
|
type: Boolean,
|
||||||
default:false
|
default: false
|
||||||
},
|
},
|
||||||
headerTxt:{
|
headerTxt: {
|
||||||
type:String,
|
type: String,
|
||||||
default:""
|
default: ""
|
||||||
},
|
},
|
||||||
showSlot:{
|
showSlot: {
|
||||||
type:Boolean,
|
type: Boolean,
|
||||||
default:false
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
inputValue: this.modelValue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 监听外部值变化
|
||||||
|
modelValue(newVal) {
|
||||||
|
this.inputValue = newVal
|
||||||
|
},
|
||||||
|
// 监听模式切换
|
||||||
|
visiblePrompt(newVal) {
|
||||||
|
console.log('[MessagePopup] visiblePrompt changed to:', newVal)
|
||||||
|
// 重置输入值
|
||||||
|
if (newVal) {
|
||||||
|
this.inputValue = this.modelValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getTypeStyle(styleType) {
|
||||||
|
const styles = {
|
||||||
|
success: {
|
||||||
|
bgColor: '#f0fff0',
|
||||||
|
borderColor: '#52c41a',
|
||||||
|
textColor: '#389e0d',
|
||||||
|
buttonBgColor: '#52c41a',
|
||||||
|
buttonTextColor: '#FFFFFF'
|
||||||
|
},
|
||||||
|
error: {
|
||||||
|
bgColor: '#fff0f0',
|
||||||
|
borderColor: '#ff4d4f',
|
||||||
|
textColor: '#cf1322',
|
||||||
|
buttonBgColor: '#ff4d4f',
|
||||||
|
buttonTextColor: '#FFFFFF'
|
||||||
|
},
|
||||||
|
info: {
|
||||||
|
bgColor: '#e6f7ff',
|
||||||
|
borderColor: '#1890ff',
|
||||||
|
textColor: '#0050b3',
|
||||||
|
buttonBgColor: '#1890ff',
|
||||||
|
buttonTextColor: '#FFFFFF'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return styles[this.type][styleType]
|
||||||
|
},
|
||||||
|
handleButtonClick() {
|
||||||
|
|
||||||
|
this.$emit('buttonClick', this.inputValue)
|
||||||
|
},
|
||||||
|
handleMaskClick() {
|
||||||
|
|
||||||
|
this.$emit('maskClick')
|
||||||
|
},
|
||||||
|
closeClick() {
|
||||||
|
|
||||||
|
this.$emit('closePop')
|
||||||
|
},
|
||||||
|
handleCancelClick() {
|
||||||
|
|
||||||
|
this.$emit('cancelPop');
|
||||||
|
},
|
||||||
|
handleInput(e) {
|
||||||
|
|
||||||
|
this.inputValue = e.detail.value
|
||||||
|
this.$emit('update:modelValue', this.inputValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
inputValue: this.modelValue
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
// 监听外部值变化
|
|
||||||
modelValue(newVal) {
|
|
||||||
this.inputValue = newVal
|
|
||||||
},
|
|
||||||
// 监听模式切换
|
|
||||||
visiblePrompt(newVal) {
|
|
||||||
console.log('[MessagePopup] visiblePrompt changed to:', newVal)
|
|
||||||
// 重置输入值
|
|
||||||
if (newVal) {
|
|
||||||
this.inputValue = this.modelValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getTypeStyle(styleType) {
|
|
||||||
const styles = {
|
|
||||||
success: {
|
|
||||||
bgColor: '#f0fff0',
|
|
||||||
borderColor: '#52c41a',
|
|
||||||
textColor: '#389e0d',
|
|
||||||
buttonBgColor: '#52c41a',
|
|
||||||
buttonTextColor: '#FFFFFF'
|
|
||||||
},
|
|
||||||
error: {
|
|
||||||
bgColor: '#fff0f0',
|
|
||||||
borderColor: '#ff4d4f',
|
|
||||||
textColor: '#cf1322',
|
|
||||||
buttonBgColor: '#ff4d4f',
|
|
||||||
buttonTextColor: '#FFFFFF'
|
|
||||||
},
|
|
||||||
info: {
|
|
||||||
bgColor: '#e6f7ff',
|
|
||||||
borderColor: '#1890ff',
|
|
||||||
textColor: '#0050b3',
|
|
||||||
buttonBgColor: '#1890ff',
|
|
||||||
buttonTextColor: '#FFFFFF'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return styles[this.type][styleType]
|
|
||||||
},
|
|
||||||
handleButtonClick() {
|
|
||||||
|
|
||||||
this.$emit('buttonClick', this.inputValue)
|
|
||||||
},
|
|
||||||
handleMaskClick() {
|
|
||||||
|
|
||||||
this.$emit('maskClick')
|
|
||||||
},
|
|
||||||
closeClick(){
|
|
||||||
|
|
||||||
this.$emit('closePop')
|
|
||||||
},
|
|
||||||
handleCancelClick(){
|
|
||||||
|
|
||||||
this.$emit('cancelPop');
|
|
||||||
},
|
|
||||||
handleInput(e) {
|
|
||||||
|
|
||||||
this.inputValue = e.detail.value
|
|
||||||
this.$emit('update:modelValue', this.inputValue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.displayNone{
|
.displayNone {
|
||||||
display: none !important
|
display: none !important
|
||||||
}
|
}
|
||||||
.message-popup {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
z-index: 9999;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-mask {
|
.message-popup {
|
||||||
position: absolute;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
z-index: 9999;
|
||||||
}
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.popup-content {
|
.popup-mask {
|
||||||
position: relative;
|
position: absolute;
|
||||||
width: 80%;
|
top: 0;
|
||||||
max-width: 400px;
|
left: 0;
|
||||||
border-radius: 12px;
|
width: 100%;
|
||||||
padding: 30rpx;
|
height: 100%;
|
||||||
background-color: white;
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
|
}
|
||||||
border-width: 2rpx;
|
|
||||||
border-style: solid;
|
|
||||||
box-sizing: border-box;
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
.header{
|
|
||||||
width:100%;
|
|
||||||
color: rgba(255, 255, 255, 0.87);
|
|
||||||
font-family: PingFang SC;
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
height: 80rpx;
|
|
||||||
line-height: 80rpx;
|
|
||||||
letter-spacing: 0.07px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.rightClose{
|
|
||||||
position: absolute;
|
|
||||||
right: 20rpx;
|
|
||||||
top: 20rpx;
|
|
||||||
color: #FFFFFF;
|
|
||||||
font-size: 36rpx;
|
|
||||||
width: 24rpx;
|
|
||||||
height: 24rpx;
|
|
||||||
line-height: 24rpx;
|
|
||||||
}
|
|
||||||
.popup-icon {
|
|
||||||
width: 60rpx;
|
|
||||||
height: 60rpx;
|
|
||||||
margin: 20rpx auto;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-message {
|
.popup-content {
|
||||||
font-size: 28rpx;
|
position: relative;
|
||||||
text-align: center;
|
width: 80%;
|
||||||
padding: 20rpx 0rpx 30rpx 0rpx;
|
max-width: 400px;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 30rpx;
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
|
||||||
|
border-width: 2rpx;
|
||||||
|
border-style: solid;
|
||||||
|
box-sizing: border-box;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
font-weight: 400;
|
width: 100%;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
font-family: PingFang SC;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
letter-spacing: 0.07px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
letter-spacing: 0.07px;
|
.rightClose {
|
||||||
}
|
position: absolute;
|
||||||
|
right: 20rpx;
|
||||||
|
top: 20rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 36rpx;
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
line-height: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.popup-prompt {
|
.popup-icon {
|
||||||
width: 100%;
|
width: 60rpx;
|
||||||
}
|
height: 60rpx;
|
||||||
|
margin: 20rpx auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.popup-prompt-title {
|
.popup-message {
|
||||||
display: block;
|
font-size: 28rpx;
|
||||||
font-size: 32rpx;
|
text-align: center;
|
||||||
text-align: center;
|
padding: 20rpx 0rpx 30rpx 0rpx;
|
||||||
margin-bottom: 20rpx;
|
font-weight: 400;
|
||||||
font-weight: 500;
|
letter-spacing: 0.07px;
|
||||||
}
|
white-space: pre-wrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
.popup-prompt-input {
|
.popup-prompt {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 80rpx;
|
}
|
||||||
line-height: 80rpx;
|
|
||||||
border: 1rpx solid #ddd;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
padding: 0 20rpx;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popBtnContent{
|
.popup-prompt-title {
|
||||||
width:100%;
|
display: block;
|
||||||
height: 60rpx;
|
font-size: 32rpx;
|
||||||
margin-top: 20rpx;
|
text-align: center;
|
||||||
display: flex
|
margin-bottom: 20rpx;
|
||||||
;
|
font-weight: 500;
|
||||||
flex-direction: row;
|
}
|
||||||
flex-wrap: nowrap;
|
|
||||||
align-content: center;
|
|
||||||
justify-content: space-evenly;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.popup-button {
|
|
||||||
width: 30%;
|
|
||||||
height: 60rpx;
|
|
||||||
line-height: 60rpx;
|
|
||||||
border-radius: 44rpx;
|
|
||||||
|
|
||||||
text-align: center;
|
|
||||||
font-size: 24rpx;
|
|
||||||
font-weight: 500;
|
|
||||||
letter-spacing: 4rpx;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup-button-cancel{
|
.popup-prompt-input {
|
||||||
width: 30%;
|
width: 100%;
|
||||||
height: 60rpx;
|
height: 80rpx;
|
||||||
line-height: 60rpx;
|
line-height: 80rpx;
|
||||||
border-radius: 44rpx;
|
border: 1rpx solid #ddd;
|
||||||
|
border-radius: 8rpx;
|
||||||
text-align: center;
|
padding: 0 20rpx;
|
||||||
font-size: 24rpx;
|
margin-bottom: 30rpx;
|
||||||
font-weight: 500;
|
font-size: 28rpx;
|
||||||
letter-spacing: 4rpx;
|
box-sizing: border-box;
|
||||||
border: none;
|
}
|
||||||
outline: none;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
||||||
|
|
||||||
background-color: #00000000;
|
.popBtnContent {
|
||||||
|
width: 100%;
|
||||||
color: #FFFFFFde;
|
height: 60rpx;
|
||||||
}
|
margin-top: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
align-content: center;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.popup-prompt{
|
.popup-button {
|
||||||
width: 100%;
|
width: 30%;
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
line-height: 60rpx;
|
line-height: 60rpx;
|
||||||
padding-top: 40rpx;
|
border-radius: 44rpx;
|
||||||
}
|
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 4rpx;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-button-cancel {
|
||||||
|
width: 30%;
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
border-radius: 44rpx;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 4rpx;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||||
|
|
||||||
|
background-color: #00000000;
|
||||||
|
|
||||||
|
color: #FFFFFFde;
|
||||||
|
}
|
||||||
|
|
||||||
|
.popup-prompt {
|
||||||
|
width: 100%;
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
padding-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.popup-prompt-title{
|
.popup-prompt-title {
|
||||||
color: rgba(255, 255, 255, 0.6);
|
color: rgba(255, 255, 255, 0.6);
|
||||||
text-align: right;
|
text-align: right;
|
||||||
width: 30%;
|
width: 30%;
|
||||||
float: left;
|
float: left;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
white-space:nowrap;
|
white-space: nowrap;
|
||||||
padding-right: 10rpx;
|
padding-right: 10rpx;
|
||||||
}
|
}
|
||||||
.popup-prompt-input{
|
|
||||||
float: left;
|
|
||||||
width: 70%;
|
|
||||||
height: 60rpx;
|
|
||||||
line-height: 60rpx;
|
|
||||||
color: rgba(255, 255, 255, 0.87) ;
|
|
||||||
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: 2rpx solid rgba(255, 255, 255, 0.4);
|
|
||||||
border-radius: 8rpx;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
.popup-prompt-input {
|
||||||
|
float: left;
|
||||||
|
width: 70%;
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 2rpx solid rgba(255, 255, 255, 0.4);
|
||||||
|
border-radius: 8rpx;
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -1,57 +1,66 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="msgBox" v-if="Msgboxs.length>0">
|
<view class="msgBox" v-if="Msgboxs.length>0">
|
||||||
|
|
||||||
<MessagePopup v-for="item,index in Msgboxs" :visible="item.showPop" :type="item.popType" :bgColor="item.bgColor"
|
<MessagePopup v-for="item,index in Msgboxs" :visible="item.showPop" :type="item.popType" :bgColor="item.bgColor"
|
||||||
:borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
|
:borderColor="item.borderColor" :textColor="item.textColor" :buttonBgColor="item.buttonBgColor"
|
||||||
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
|
:buttonTextColor="item.buttonTextColor" :iconUrl="item.iconUrl" :message="item.message"
|
||||||
:buttonText="item.buttonText" @buttonClick="okCallback(item,index)" :visiblePrompt="item.visiblePrompt"
|
:buttonText="item.buttonText" @buttonClick="okCallback(item,index)" :visiblePrompt="item.visiblePrompt"
|
||||||
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
|
:promptTitle="item.promptTitle" v-model="item.modelValue" @closePop="closePop(item)"
|
||||||
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel" @cancelPop="cancelClick(item,index)" />
|
:buttonCancelText="item.buttonCancelText" :showCancel="item.showCancel"
|
||||||
</view>
|
:showHeader="item.showHeader" :headerTxt="item.headerTxt"
|
||||||
</template>
|
|
||||||
|
@cancelPop="cancelClick(item,index)" />
|
||||||
<script>
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Common from '@/utils/Common.js'
|
||||||
export default {
|
export default {
|
||||||
name: 'MsgBox',
|
name: 'MsgBox',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
Msgboxs:[]
|
Msgboxs: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//确认按钮事件,如果回调函数返回true,将阻止关闭弹窗
|
//确认按钮事件,如果回调函数返回true,将阻止关闭弹窗
|
||||||
okCallback(item,index){
|
okCallback(item, index) {
|
||||||
let flag=false;
|
let flag = false;
|
||||||
if(item.okCallback){
|
if (item.okCallback) {
|
||||||
flag=item.okCallback(item,index)
|
flag = item.okCallback(item, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flag){
|
if (flag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.closePop(item);
|
this.closePop(item);
|
||||||
},
|
},
|
||||||
//取消按钮,如果回调函数返回true,将阻止关闭弹窗
|
//取消按钮,如果回调函数返回true,将阻止关闭弹窗
|
||||||
cancelClick(item,index){
|
cancelClick(item, index) {
|
||||||
let flag=false;
|
let flag = false;
|
||||||
if(item.cancelCallback){
|
if (item.cancelCallback) {
|
||||||
flag=item.cancelCallback(item,index)
|
flag = item.cancelCallback(item, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flag){
|
if (flag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.closePop(item);
|
this.closePop(item);
|
||||||
},
|
},
|
||||||
closePop: function(item) {
|
closePop: function(item) {
|
||||||
|
debugger;
|
||||||
if (item) {
|
if (item) {
|
||||||
this.Msgboxs.find((v, i) => {
|
this.Msgboxs.find((v, i) => {
|
||||||
if (item.key === v.key) {
|
debugger;
|
||||||
this.Msgboxs.splice(i, 1);
|
if (item.key && v.key) {
|
||||||
|
if (item.key === v.key) {
|
||||||
|
this.Msgboxs.splice(i, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (item.cancelCallback) {
|
if (item.cancelCallback) {
|
||||||
item.cancelCallback();
|
item.cancelCallback();
|
||||||
}
|
}
|
||||||
@ -59,12 +68,12 @@
|
|||||||
if (this.Msgboxs.length > 0) {
|
if (this.Msgboxs.length > 0) {
|
||||||
this.Msgboxs.splice(this.Msgboxs.length - 1, 1);
|
this.Msgboxs.splice(this.Msgboxs.length - 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
//根据传入的配置,自定义一个弹窗
|
//根据传入的配置,自定义一个弹窗
|
||||||
showPop: function(option,isClear) {
|
showPop: function(option, isClear) {
|
||||||
let def = {
|
let def = {
|
||||||
key: '',
|
key: '',
|
||||||
showPop: true, //是否显示弹窗
|
showPop: true, //是否显示弹窗
|
||||||
@ -86,41 +95,44 @@
|
|||||||
showSlot: false,
|
showSlot: false,
|
||||||
buttonCancelText: '',
|
buttonCancelText: '',
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
cancelCallback: null
|
cancelCallback: null,
|
||||||
|
visible:false,
|
||||||
|
promptPlaceholder:'',
|
||||||
|
type:'custom',
|
||||||
|
showHeader:false,
|
||||||
|
headerTxt:''
|
||||||
}
|
}
|
||||||
let json = {};
|
let json = {};
|
||||||
let keys = Object.keys(def);
|
let keys = Object.keys(def);
|
||||||
|
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
|
|
||||||
json[key] = def[key];
|
json[key] = def[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option) {
|
if (option) {
|
||||||
keys = Object.keys(option);
|
Object.assign(json, option);
|
||||||
for (let i = 0; i < keys.length; i++) {
|
|
||||||
let key = keys[i];
|
|
||||||
|
|
||||||
json[key] = option[key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!json.borderColor) {
|
if (!json.borderColor) {
|
||||||
json.borderColor = '#BBE600';
|
json.borderColor = '#BBE600';
|
||||||
json.buttonBgColor = '#BBE600';
|
json.buttonBgColor = '#BBE600';
|
||||||
}
|
}
|
||||||
json.showPop = true;
|
json.showPop = true;
|
||||||
if (!('key' in json)) {
|
|
||||||
json.key = new Date().getTime();
|
|
||||||
|
if(!json.key){
|
||||||
|
json.key =Common.guid();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Msgboxs.push(json);
|
this.Msgboxs.push(json);
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
},
|
},
|
||||||
//弹出预定好的三种弹窗
|
//弹出预定好的三种弹窗
|
||||||
showMsg(msg,btnTxt, type,okCallback) {
|
showMsg(msg, btnTxt, type, okCallback) {
|
||||||
|
|
||||||
let cfg = {
|
let cfg = {
|
||||||
error: {
|
error: {
|
||||||
icoUrl: '/static/images/6155/DeviceDetail/uploadErr.png',
|
icoUrl: '/static/images/6155/DeviceDetail/uploadErr.png',
|
||||||
@ -138,50 +150,50 @@
|
|||||||
buttonBgColor: "#FFC84E",
|
buttonBgColor: "#FFC84E",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!type) {
|
if (!type) {
|
||||||
type = 'error';
|
type = 'error';
|
||||||
}
|
}
|
||||||
if (!cfg[type]) {
|
if (!cfg[type]) {
|
||||||
type = 'error';
|
type = 'error';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let guid = new Date().getTime()+"";
|
let guid =Common.guid();
|
||||||
let options = {
|
let options = {
|
||||||
key: guid,
|
key: guid,
|
||||||
message: msg,
|
message: msg,
|
||||||
iconUrl: cfg[type].icoUrl,
|
iconUrl: cfg[type].icoUrl,
|
||||||
borderColor: cfg[type].borderColor,
|
borderColor: cfg[type].borderColor,
|
||||||
buttonBgColor: cfg[type].buttonBgColor,
|
buttonBgColor: cfg[type].buttonBgColor,
|
||||||
buttonText: btnTxt?btnTxt:'确定',
|
buttonText: btnTxt ? btnTxt : '确定',
|
||||||
okCallback: okCallback?okCallback:this.closePop
|
okCallback: okCallback ? okCallback : this.closePop
|
||||||
};
|
};
|
||||||
return this.showPop(options);
|
return this.showPop(options);
|
||||||
|
|
||||||
},
|
},
|
||||||
//清除所有弹窗
|
//清除所有弹窗
|
||||||
clearPops(){
|
clearPops() {
|
||||||
this.Msgboxs=[];
|
this.Msgboxs = [];
|
||||||
},
|
},
|
||||||
//获取当前所有弹窗的数量
|
//获取当前所有弹窗的数量
|
||||||
getPops(){
|
getPops() {
|
||||||
return this.Msgboxs.length;
|
return this.Msgboxs.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.msgBox{
|
.msgBox {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
z-index: 9999;
|
z-index: 99999;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
291
components/TextToHex/TextToHexV2.vue
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<canvas type="2d" canvas-id="reusableCanvas" :width="currentCanvasWidth" :height="currentCanvasHeight"
|
||||||
|
class="offscreen-canvas"></canvas>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "TextToHexV2",
|
||||||
|
props: {
|
||||||
|
txts: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
validator: (value) => value.every(item => typeof item === 'string')
|
||||||
|
},
|
||||||
|
fontSize: {
|
||||||
|
type: Number,
|
||||||
|
default: 12,
|
||||||
|
validator: (value) => value > 0 && value <= 100
|
||||||
|
},
|
||||||
|
bgColor: {
|
||||||
|
type: String,
|
||||||
|
default: "#ffffff"
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: "#000000"
|
||||||
|
},
|
||||||
|
currentCanvasWidth: {
|
||||||
|
type: Number,
|
||||||
|
default: 80
|
||||||
|
},
|
||||||
|
currentCanvasHeight: {
|
||||||
|
type: Number,
|
||||||
|
default: 12
|
||||||
|
},
|
||||||
|
returnType: { //返回值的进制,默认16进制
|
||||||
|
type: Number,
|
||||||
|
default: 16
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
// Canvas上下文(复用)
|
||||||
|
ctx: null,
|
||||||
|
// 标记是否已经预热过画布
|
||||||
|
canvasWarmed: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
validTxts() {
|
||||||
|
return this.txts.filter(line => line.trim() !== '');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// 初始化Canvas上下文(只创建一次)
|
||||||
|
this.ctx = uni.createCanvasContext('reusableCanvas', this);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**
|
||||||
|
* 估算单行文本所需的Canvas宽度
|
||||||
|
*/
|
||||||
|
calcLineWidth(textLine) {
|
||||||
|
return textLine.length * 16;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除Canvas内容
|
||||||
|
*/
|
||||||
|
clearCanvas() {
|
||||||
|
this.ctx.setFillStyle(this.bgColor);
|
||||||
|
this.ctx.fillRect(0, 0, this.currentCanvasWidth, this.currentCanvasHeight);
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预热画布,确保画布和字体完全准备好(解决APP重新打开后第一次获取数据不完整的问题)
|
||||||
|
*/
|
||||||
|
async warmupCanvas() {
|
||||||
|
if (this.canvasWarmed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 清空画布
|
||||||
|
this.clearCanvas();
|
||||||
|
|
||||||
|
// 绘制一个测试字符来预热字体和画布
|
||||||
|
this.ctx.setFillStyle(this.color);
|
||||||
|
this.ctx.setFontSize(this.fontSize);
|
||||||
|
this.ctx.font = `${this.fontSize}px "PingFangBold","PingFang SC", Arial, sans-serif`;
|
||||||
|
this.ctx.setTextBaseline('middle');
|
||||||
|
this.ctx.fillText('测', 0, 8);
|
||||||
|
|
||||||
|
// 等待画布绘制完成
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
this.ctx.draw(false, () => {
|
||||||
|
// 获取一次测试数据,确保canvasGetImageData API已准备好
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.canvasGetImageData({
|
||||||
|
canvasId: 'reusableCanvas',
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
success: () => {
|
||||||
|
this.canvasWarmed = true;
|
||||||
|
resolve();
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
this.canvasWarmed = true;
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 额外等待确保字体完全加载
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 200));
|
||||||
|
} catch (ex) {
|
||||||
|
console.log("画布预热异常:", ex);
|
||||||
|
this.canvasWarmed = true; // 即使失败也标记为已预热,避免重复尝试
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复用单个Canvas处理所有文本行
|
||||||
|
*/
|
||||||
|
async drawAndGetPixels() {
|
||||||
|
// 第一次调用时先预热画布(解决APP重新打开后第一次获取数据不完整的问题)
|
||||||
|
await this.warmupCanvas();
|
||||||
|
|
||||||
|
let convertCharToMatrix = (imageData) => {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// console.log("imgData=",imageData.length)
|
||||||
|
let matrix = [];
|
||||||
|
let k = 0;
|
||||||
|
let tmpArr = [];
|
||||||
|
while (k < imageData.length) {
|
||||||
|
|
||||||
|
let r = imageData[k];
|
||||||
|
let g = imageData[k + 1];
|
||||||
|
let b = imageData[k + 2];
|
||||||
|
let a = imageData[k + 3];
|
||||||
|
|
||||||
|
|
||||||
|
// if (r === 255 && a >= 0) {
|
||||||
|
// r = 255;
|
||||||
|
// } else {
|
||||||
|
// r = 0;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// if (r === 255) {
|
||||||
|
// tmpArr.push(1);
|
||||||
|
// } else {
|
||||||
|
// tmpArr.push(0);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// 黑色像素(R值较低)视为1,白色视为0
|
||||||
|
let isBlack = r < 128;
|
||||||
|
|
||||||
|
let byte1 = 0;
|
||||||
|
|
||||||
|
if (isBlack) {
|
||||||
|
byte1 = 1; // 从左到右设置位
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpArr.push(byte1);
|
||||||
|
|
||||||
|
if (tmpArr.length == 8) {
|
||||||
|
tmpArr = parseInt(tmpArr.join(''), 2);
|
||||||
|
|
||||||
|
if (this.returnType == 16) {
|
||||||
|
matrix.push('0x' + tmpArr.toString(16).padStart(2, '0').toUpperCase());
|
||||||
|
|
||||||
|
} else if (this.returnType == 10) {
|
||||||
|
matrix.push(tmpArr);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (this.returnType == 2) {
|
||||||
|
matrix.push(tmpArr.toString(2).padStart(8, '0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpArr = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
k += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log("matrix=",matrix);
|
||||||
|
|
||||||
|
return matrix;
|
||||||
|
} catch (ex) {
|
||||||
|
console.error("ex=", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let drawTxt = async (textLine) => {
|
||||||
|
let result = {};
|
||||||
|
let ctx = this.ctx;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 2. 清空Canvas(绘制背景)
|
||||||
|
this.clearCanvas();
|
||||||
|
|
||||||
|
// 3. 设置文字样式
|
||||||
|
ctx.setFillStyle(this.color);
|
||||||
|
ctx.setTextBaseline('middle');
|
||||||
|
// ctx.setTextAlign('center')
|
||||||
|
ctx.setFontSize(this.fontSize);
|
||||||
|
ctx.font = `${this.fontSize}px "PingFangBold", "PingFang SC", Arial, sans-serif`;
|
||||||
|
|
||||||
|
// 4. 绘制当前行文本
|
||||||
|
let currentX = 0;
|
||||||
|
let currentY = this.fontSize / 2;
|
||||||
|
console.log("textLine=", textLine)
|
||||||
|
ctx.fillText(textLine, currentX, currentY);
|
||||||
|
// for (let j = 0; j < textLine.length; j++) {
|
||||||
|
// let char = textLine[j];
|
||||||
|
// ctx.fillText(char, currentX, currentY);
|
||||||
|
// // 按实际字符宽度计算间距
|
||||||
|
// let charWidth = ctx.measureText(char).width;
|
||||||
|
// currentX += charWidth;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 5. 异步绘制并获取像素数据(串行处理避免冲突)
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
ctx.draw(false, () => {
|
||||||
|
uni.canvasGetImageData({
|
||||||
|
canvasId: 'reusableCanvas',
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width: this.currentCanvasWidth,
|
||||||
|
height: this.currentCanvasHeight,
|
||||||
|
success: res => {
|
||||||
|
|
||||||
|
result = {
|
||||||
|
line: textLine,
|
||||||
|
pixelData: res.data,
|
||||||
|
width: this.currentCanvasWidth,
|
||||||
|
height: this.currentCanvasHeight
|
||||||
|
};
|
||||||
|
resolve();
|
||||||
|
},
|
||||||
|
fail: err => {
|
||||||
|
console.error(`处理第${i+1}行失败:`, err);
|
||||||
|
reject(err)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
let arr = [];
|
||||||
|
// 循环处理每行文本
|
||||||
|
for (let i = 0; i < this.validTxts.length; i++) {
|
||||||
|
|
||||||
|
let linePixls = [];
|
||||||
|
let item = this.validTxts[i];
|
||||||
|
|
||||||
|
console.log("item=", item);
|
||||||
|
let result = await drawTxt(item);
|
||||||
|
linePixls.push(convertCharToMatrix(result.pixelData));
|
||||||
|
|
||||||
|
|
||||||
|
arr.push(linePixls);
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.offscreen-canvas {
|
||||||
|
position: fixed;
|
||||||
|
left: -9999px;
|
||||||
|
top: -9999px;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -2,7 +2,7 @@
|
|||||||
const config = {
|
const config = {
|
||||||
// 开发环境
|
// 开发环境
|
||||||
development: {
|
development: {
|
||||||
BASE_URL: 'http://192.168.110.172:8000',//http://139.224.253.23:8000
|
BASE_URL: 'http://192.168.110.57:8000',//http://139.224.253.23:8000
|
||||||
API_PREFIX: '',
|
API_PREFIX: '',
|
||||||
// MQTT 配置
|
// MQTT 配置
|
||||||
MQTT_HOST: '47.120.79.150',
|
MQTT_HOST: '47.120.79.150',
|
||||||
|
|||||||
@ -101,7 +101,12 @@
|
|||||||
"push" : {
|
"push" : {
|
||||||
"unipush" : {
|
"unipush" : {
|
||||||
"version" : "2",
|
"version" : "2",
|
||||||
"offline" : true
|
"offline" : true,
|
||||||
|
"honor" : {},
|
||||||
|
"mi" : {},
|
||||||
|
"vivo" : {},
|
||||||
|
"oppo" : {},
|
||||||
|
"hms" : {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -170,7 +175,8 @@
|
|||||||
"fallbackLocale" : "zh-Hans",
|
"fallbackLocale" : "zh-Hans",
|
||||||
"app-harmony" : {
|
"app-harmony" : {
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
"modules" : {}
|
"modules" : {},
|
||||||
|
"bundleName" : "uni.app.UNIA21EF43.Hommey"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -440,6 +440,13 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "蓝牙添加设备"
|
"navigationBarTitleText": "蓝牙添加设备"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/6075J/BJQ6075J",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
@ -336,7 +336,7 @@
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
}],
|
}],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
bgColor: '#2a2a2a',
|
bgColor: '#2a2a2a',
|
||||||
|
|||||||
@ -269,7 +269,7 @@
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
}],
|
}],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
bgColor: '#2a2a2a',
|
bgColor: '#2a2a2a',
|
||||||
|
|||||||
@ -355,15 +355,15 @@
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/lightImg/ruo.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png'
|
icon: '/static/images/lightImg/shan.png'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
|
|||||||
@ -279,15 +279,15 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/lightImg/ruo.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png'
|
icon: '/static/images/lightImg/shan.png'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
|
|||||||
2939
pages/6075J/BJQ6075J.vue
Normal file
@ -312,20 +312,20 @@
|
|||||||
dic: {
|
dic: {
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png',
|
icon: '/static/images/lightImg/qiang.png',
|
||||||
math: 100,
|
math: 100,
|
||||||
type: 'main'
|
type: 'main'
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png',
|
icon: '/static/images/lightImg/ruo.png',
|
||||||
math: 50,
|
math: 50,
|
||||||
type: 'main'
|
type: 'main'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png',
|
icon: '/static/images/lightImg/shan.png',
|
||||||
math: 30,
|
math: 30,
|
||||||
type: 'main'
|
type: 'main'
|
||||||
},
|
},
|
||||||
@ -337,13 +337,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '泛光',
|
text: '泛光',
|
||||||
icon: '/static/images/6155/DeviceDetail/fan.png',
|
icon: '/static/images/lightImg/fan.png',
|
||||||
math: 100,
|
math: 100,
|
||||||
type: 'fu'
|
type: 'fu'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '强+泛光',
|
text: '强+泛光',
|
||||||
icon: '/static/images/6155/DeviceDetail/fan.png',
|
icon: '/static/images/lightImg/fan.png',
|
||||||
math: 70,
|
math: 70,
|
||||||
type: 'fu'
|
type: 'fu'
|
||||||
}
|
}
|
||||||
@ -785,9 +785,12 @@
|
|||||||
message: "上传成功",
|
message: "上传成功",
|
||||||
iconUrl: "/static/images/common/success.png",
|
iconUrl: "/static/images/common/success.png",
|
||||||
});
|
});
|
||||||
|
|
||||||
ble.sendString(f.deviceId, "transmit complete", f.writeServiceId, f
|
setTimeout(()=>{
|
||||||
|
ble.sendString(f.deviceId, "transmit complete", f.writeServiceId, f
|
||||||
.wirteCharactId);
|
.wirteCharactId);
|
||||||
|
},1000);
|
||||||
|
|
||||||
these.rgb565Data = null;
|
these.rgb565Data = null;
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
@ -915,7 +918,7 @@
|
|||||||
});
|
});
|
||||||
console.log("data=", data);
|
console.log("data=", data);
|
||||||
these.Status.BottomMenu.show = false;
|
these.Status.BottomMenu.show = false;
|
||||||
these.rgb565Data = ble.convertToRGB565(data.piexls);
|
these.rgb565Data = Common.convertToRGB565(data.piexls);
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
sendImagePackets().catch(() => {
|
sendImagePackets().catch(() => {
|
||||||
|
|||||||
@ -250,15 +250,15 @@
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/lightImg/ruo.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png'
|
icon: '/static/images/lightImg/shan.png'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
@ -1378,19 +1378,19 @@
|
|||||||
title = '主灯模式';
|
title = '主灯模式';
|
||||||
items = [{
|
items = [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// text: '工作光',
|
// text: '工作光',
|
||||||
// icon: '/static/images/6155/DeviceDetail/fan.png'
|
// icon: '/static/images/lightImg/fan.png'
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/lightImg/ruo.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png'
|
icon: '/static/images/lightImg/shan.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '关闭',
|
text: '关闭',
|
||||||
@ -1402,11 +1402,11 @@
|
|||||||
title = '辅灯模式';
|
title = '辅灯模式';
|
||||||
items = [{
|
items = [{
|
||||||
text: '泛光',
|
text: '泛光',
|
||||||
icon: '/static/images/6155/DeviceDetail/fan.png'
|
icon: '/static/images/lightImg/fan.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '强+泛光',
|
text: '强+泛光',
|
||||||
icon: '/static/images/6155/DeviceDetail/fan.png'
|
icon: '/static/images/lightImg/fan.png'
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -71,7 +71,7 @@
|
|||||||
<view class="item" @click="lightSetting('jieN')" :class="formData.lightCurr=='jieN'?'active':''">
|
<view class="item" @click="lightSetting('jieN')" :class="formData.lightCurr=='jieN'?'active':''">
|
||||||
<view class="imgContent center">
|
<view class="imgContent center">
|
||||||
<image class="img"
|
<image class="img"
|
||||||
:src="formData.lightCurr=='jieN'?'/static/images/6331/jieNActive.png':'/static/images/6331/jieN.png'"
|
:src="formData.lightCurr=='jieN'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
|
||||||
mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">节能光</view>
|
<view class="txt">节能光</view>
|
||||||
@ -275,15 +275,15 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/lightImg/ruo.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png'
|
icon: '/static/images/lightImg/shan.png'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
|
|||||||
@ -257,15 +257,15 @@ import request, { baseURL } from '@/utils/request.js';
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/lightImg/ruo.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png'
|
icon: '/static/images/lightImg/shan.png'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
|
|||||||
@ -177,7 +177,7 @@
|
|||||||
<view class="item" @click="lightSetting('close')" :class="formData.lightCurr=='close'?'active':''">
|
<view class="item" @click="lightSetting('close')" :class="formData.lightCurr=='close'?'active':''">
|
||||||
<view class="imgContent center">
|
<view class="imgContent center">
|
||||||
<image class="img"
|
<image class="img"
|
||||||
:src="formData.lightCurr=='close'?'/static/images/670/jieNActive.png':'/static/images/670/jieN.png'"
|
:src="formData.lightCurr=='close'?'/static/images/lightImg/jieNActive.png':'/static/images/lightImg/jieN.png'"
|
||||||
mode="aspectFit"></image>
|
mode="aspectFit"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="txt">关闭</view>
|
<view class="txt">关闭</view>
|
||||||
@ -363,15 +363,15 @@
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/lightImg/ruo.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png'
|
icon: '/static/images/lightImg/shan.png'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
|
|||||||
@ -230,20 +230,20 @@
|
|||||||
showHeader: true,
|
showHeader: true,
|
||||||
menuItems: [{
|
menuItems: [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/lightImg/ruo.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png'
|
icon: '/static/images/lightImg/shan.png'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
activeIndex: -1,
|
activeIndex: -1,
|
||||||
bgColor: '#2a2a2a',
|
bgColor: '#2a2a2a',
|
||||||
itemBgColor: '#3a3a3a',
|
itemBgColor: '#00000000',
|
||||||
textColor: '#ffffffde',
|
textColor: '#ffffffde',
|
||||||
textAlign: 'flex-start',
|
textAlign: 'flex-start',
|
||||||
title: '主灯模式',
|
title: '主灯模式',
|
||||||
@ -957,19 +957,19 @@
|
|||||||
title = '主灯模式';
|
title = '主灯模式';
|
||||||
items = [{
|
items = [{
|
||||||
text: '强光',
|
text: '强光',
|
||||||
icon: '/static/images/6155/DeviceDetail/qiang.png'
|
icon: '/static/images/lightImg/qiang.png'
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// text: '工作光',
|
// text: '工作光',
|
||||||
// icon: '/static/images/6155/DeviceDetail/fan.png'
|
// icon: '/static/images/lightImg/fan.png'
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
icon: '/static/images/6155/DeviceDetail/ruo.png'
|
icon: '/static/images/lightImg/ruo.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
icon: '/static/images/6155/DeviceDetail/shan.png'
|
icon: '/static/images/lightImg/shan.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '关闭',
|
text: '关闭',
|
||||||
@ -981,7 +981,7 @@
|
|||||||
title = '辅灯模式';
|
title = '辅灯模式';
|
||||||
items = [{
|
items = [{
|
||||||
text: '泛光',
|
text: '泛光',
|
||||||
icon: '/static/images/6155/DeviceDetail/fan.png'
|
icon: '/static/images/lightImg/fan.png'
|
||||||
}];
|
}];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1089,14 +1089,7 @@
|
|||||||
},
|
},
|
||||||
handleItemClick(item, index) {
|
handleItemClick(item, index) {
|
||||||
|
|
||||||
switch (this.Status.BottomMenu.type) {
|
|
||||||
case "main":
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "fu":
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this.Status.BottomMenu.activeIndex = index;
|
this.Status.BottomMenu.activeIndex = index;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@ -668,7 +668,7 @@ import BleReceive from '@/utils/BleReceive';
|
|||||||
// 列表跳转
|
// 列表跳转
|
||||||
handleFile(item) {
|
handleFile(item) {
|
||||||
let url = item.detailPageUrl;
|
let url = item.detailPageUrl;
|
||||||
// console.log("url=",url);
|
// url="/pages/6075/BJQ6075L";
|
||||||
// if(!url){
|
// if(!url){
|
||||||
// url="/pages/6075/BJQ6075"
|
// url="/pages/6075/BJQ6075"
|
||||||
// }
|
// }
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
<view class="example-body">
|
<view class="example-body">
|
||||||
<!-- 图片列表 -->
|
<!-- 图片列表 -->
|
||||||
<view class="image-list">
|
<view class="image-list">
|
||||||
|
|
||||||
<view class="image-item" v-for="(image, index) in instructionImages" :key="index"
|
<view class="image-item" v-for="(image, index) in instructionImages" :key="index"
|
||||||
@click="handleImageClick(index,image)">
|
@click="handleImageClick(index,image)">
|
||||||
<image :src="image.fileUrl" mode="aspectFit" class="instruction-image"
|
<image :src="image.fileUrl" mode="aspectFit" class="instruction-image"
|
||||||
@ -71,6 +72,7 @@
|
|||||||
fileList: [],
|
fileList: [],
|
||||||
deviceID: "",
|
deviceID: "",
|
||||||
instructionImages: [],
|
instructionImages: [],
|
||||||
|
typeImgs:[],//该设备类型的官方数据
|
||||||
isDeleteMode: false, // 是否删除模式
|
isDeleteMode: false, // 是否删除模式
|
||||||
selectedImages: [], // 选中的图片索引
|
selectedImages: [], // 选中的图片索引
|
||||||
deleteShow: false,
|
deleteShow: false,
|
||||||
@ -225,7 +227,8 @@
|
|||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.deviceID = options.id
|
this.deviceID = options.id
|
||||||
this.callOtherApi()
|
this.callOtherApi();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
BIN
static/images/common/jig.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
static/images/common/jigA.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
static/images/common/sg.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
static/images/common/sgActive.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
static/images/lightImg/closeLight.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 275 B After Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 612 B |
|
Before Width: | Height: | Size: 528 B After Width: | Height: | Size: 528 B |
|
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 304 B |
BIN
static/images/lightImg/sos.png
Normal file
|
After Width: | Height: | Size: 793 B |
BIN
static/images/lightImg/super.png
Normal file
|
After Width: | Height: | Size: 897 B |
BIN
static/images/lightImg/warn.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
static/images/lightImg/work.png
Normal file
|
After Width: | Height: | Size: 813 B |
@ -1601,7 +1601,7 @@ class BleHelper {
|
|||||||
// console.log("正在连接" + deviceId);
|
// console.log("正在连接" + deviceId);
|
||||||
uni.createBLEConnection({
|
uni.createBLEConnection({
|
||||||
deviceId: deviceId,
|
deviceId: deviceId,
|
||||||
timeout: 30000,
|
timeout: 15000,
|
||||||
success: (info) => {
|
success: (info) => {
|
||||||
//释放连接锁
|
//释放连接锁
|
||||||
|
|
||||||
|
|||||||
@ -218,31 +218,31 @@ export default {
|
|||||||
value: "1",
|
value: "1",
|
||||||
label: "灯光模式",
|
label: "灯光模式",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['6170', '670','102','6155','650','7305']
|
type: ['6170', '670','102','6155','650','7305','6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "2",
|
value: "2",
|
||||||
label: "激光模式",
|
label: "激光模式",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['6170']
|
type: ['6170','6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "3",
|
value: "3",
|
||||||
label: "开机画面",
|
label: "开机画面",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['210', '6170', '670','6155','650','7305']
|
type: ['210', '6170', '670','6155','650','7305','6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "4",
|
value: "4",
|
||||||
label: "人员信息登记",
|
label: "人员信息登记",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['210', '6170', '670','6155','650','7305']
|
type: ['210', '6170', '670','6155','650','7305','6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "5",
|
value: "5",
|
||||||
label: "发送信息",
|
label: "发送信息",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['210', '6170', '670']
|
type: ['210', '6170', '670','6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "6",
|
value: "6",
|
||||||
@ -258,7 +258,7 @@ export default {
|
|||||||
value: "42",
|
value: "42",
|
||||||
label: "SOS",
|
label: "SOS",
|
||||||
checked: false,
|
checked: false,
|
||||||
type: ['670','4877']
|
type: ['670','4877','6075']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "43",
|
value: "43",
|
||||||
|
|||||||
@ -281,7 +281,36 @@ class MqttClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publish(topic, message,retained) {
|
async publish(topic, message,retained) {
|
||||||
|
let getLan=()=>{
|
||||||
|
return new Promise((succ,error)=>{
|
||||||
|
uni.getNetworkType({
|
||||||
|
success: (res) => {
|
||||||
|
let networkType = res.networkType;
|
||||||
|
// 判断网络是否连接
|
||||||
|
if (networkType === 'none') {
|
||||||
|
console.error('无网络连接')
|
||||||
|
succ(false);
|
||||||
|
} else {
|
||||||
|
succ(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('获取网络状态失败:', err);
|
||||||
|
|
||||||
|
succ(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let flag=await getLan();
|
||||||
|
if(!flag){
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (this.client && this.client.isConnected()) {
|
if (this.client && this.client.isConnected()) {
|
||||||
const mqttMessage = new Paho.Message(message);
|
const mqttMessage = new Paho.Message(message);
|
||||||
mqttMessage.destinationName = topic;
|
mqttMessage.destinationName = topic;
|
||||||
|
|||||||