非IOT打卡

master
blak-kong 2 years ago
parent ffa68186c6
commit fa4a1bcecd

@ -16,7 +16,7 @@ export default defineAppConfig({
"pages/instrument/intro",
"pages/instrument_manage/index",
"pages/instrument_detail/index",
"pages/instrument_clickin_upload/index",
"pages/instrumentClickinUpload/index",
'pages/privacyPolicy/privacyPolicy',
'pages/userPolicy/userPolicy',
'pages/about/about',

@ -0,0 +1,64 @@
.site-popup-content-box {
margin: 0;
}
// .van-popup {
// background-color: transparent;
// }
.site-close {
position: absolute;
right: 36rpx;
top: 36rpx;
color: #fff;
font-size: 36rpx;
z-index: 100009;
background-color: #ababab;
border-radius: 50%;
padding: 8rpx;
box-sizing: border-box;
}
.site-popup-btn {
position: absolute;
bottom: 100rpx;
left: calc(50% - 120rpx);
width: 240rpx;
height: 70rpx;
line-height: 70rpx;
font-size: 28rpx;
text-align: center;
border: 1rpx solid #000;
border-radius: 40rpx;
background-color: #000;
color: #fff;
box-sizing: border-box;
}
.upload-tips-common-box {
padding: 50rpx 20rpx 44rpx 20rpx;
.tips-message {
margin-top: 30rpx;
text-align: center;
font-size: 28rpx;
line-height: 45rpx;
color: #666;
}
}
.popup-btn-one {
display: flex;
margin-top: 60rpx;
justify-content: center;
.popup-btn {
width: 270rpx;
height: 90rpx;
line-height: 90rpx;
font-size: 32rpx;
font-weight: 500;
text-align: center;
border: 1rpx solid #000;
border-radius: 45rpx;
color: #fff;
background-color: #000;
font-family: PingFang SC;
}
}

@ -0,0 +1,200 @@
import classnames from "classnames";
import Taro from "@tarojs/taro";
import { Component } from "react";
import {
Block,
View,
Image,
Text,
Button,
PageMeta,
Swiper,
SwiperItem,
} from "@tarojs/components";
import { Popup } from "@antmjs/vantui";
import "./popup.less";
import "./popup-instrument-upload-tips.less";
import "./fade.css";
import { go, goJump } from "../../utils/traoAPI";
/*** props
* isLarge
* isShow
* data
* @confirm
* ***/
export default class PopupInstrumentUploadTips extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "打卡介绍弹窗",
current: 0,
toRight: false,
isClick: false,
};
}
async onLoad() {}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
initData = () => {
if (this.props.siteData) {
let arr = JSON.parse(JSON.stringify(this.props.siteData));
this.setState({ siteList: arr });
}
};
onClose = () => {
this.props.close();
};
onClickStop = (e) => {
e.stopPropagation();
};
onChange(event) {
const current = event.detail.current;
const { current: curCurrent } = this.state;
const { siteData } = this.props;
if (curCurrent + 2 === siteData.length && current + 1 === siteData.length) {
this.setState({ toRight: true });
}
this.setState({ current });
}
onClickSwiperItem(item) {
goJump(item);
}
onFinish(event) {
const { current } = event.detail;
const { toRight, isClick } = this.state;
const { siteData } = this.props;
if (current === siteData.length - 1) {
if (toRight || isClick) {
this.setState({ toRight: false, isClick: false });
} else {
// this.toHomePage();
}
}
}
onPrev = async () => {
let { current } = this.state;
this.setState({ current: current - 1 });
};
onNext = async () => {
let { current } = this.state;
if (current === this.props.data.length) {
this.onClose();
} else {
this.setState({ current: current + 1 });
}
};
render() {
let { isShow, data, isLarge, title } = this.props;
let { current } = this.state;
return (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
<Popup
style="background-color: #fff;"
show={isShow}
closeOnClickOverlay={false}
round
overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop}
>
<View
className="at-icon at-icon-close site-close"
onClick={this.onClose}
></View>
<View className={classnames("common-box upload-tips-common-box")}>
<View className="site-popup-content-box">
<Swiper
className="absolutely"
style="width: 600rpx;height: 720rpx"
current={current}
onChange={this.onChange.bind(this)}
onAnimationFinish={this.onFinish.bind(this)}
duration={800}
indicatorDots={false}
indicatorColor="#999"
indicatorActiveColor="#333"
disableTouch={true} // 禁止滑动
>
{data.map((item, index) => {
return (
<SwiperItem
className="absolutely"
onClick={this.onClickSwiperItem.bind(this, item)}
key={"swiper_" + index}
>
<View
style={{
width: "100%",
height: "600rpx",
}}
>
<Image
className="cover"
src={item.file}
mode="aspectFit"
></Image>
</View>
<View className="tips-message">
{item.message}
{item.message}
{item.message}
{item.message}
</View>
</SwiperItem>
);
})}
</Swiper>
</View>
<View>
{data.length === 1 && (
<View className="popup-btn-one">
<Button className="popup-btn" onClick={this.onClose}>
</Button>
</View>
)}
{data.length > 1 && current === 0 && (
<View className="popup-btn-one">
<Button className="popup-btn" onClick={this.onPrev}>
</Button>
</View>
)}
{data.length > 1 && (
<View className="common-popup-btns">
<Button className="common-popup-btn2" onClick={this.onPrev}>
{current > 0 && current < data.length - 1 && "上一步"}
</Button>
<Button className="common-popup-btn2" onClick={this.onNext}>
{current > 0 && current < data.length - 1 && "下一步"}
{current > 0 && current === data.length - 1 && "知道了"}
</Button>
</View>
)}
</View>
</View>
</Popup>
</Block>
);
}
}

@ -556,8 +556,11 @@ class Index extends Component<any, any> {
// 跳转仪器介绍页
goNursing = (item) => {
console.log("goNursing", item);
setStorageSync("instrument_item", JSON.stringify(item));
go("/pages/instrument_clickin_upload/index?id=" + item.id);
setStorageSync("instrument_detail", JSON.stringify(item));
setTimeout(() => {
go("/pages/instrumentClickinUpload/index?id=" + item.id);
}, 10);
// go("/pages/instrument/intro?id=" + item.id);
};
/* 扫码进入逻辑 */

@ -16,11 +16,6 @@ import Navbar from "../../components/navbar/navbar";
// import PopupAlert from "../../components/popup/popup-alert";
/* 组件 */
/*** redux ***/
import { connect } from "react-redux";
import { setInstrument } from "../../store/features/instrument";
/*** redux end ***/
import { InstrumentInfo } from "../../utils/Interface";
import { setStorageSync, getStorageSync, go } from "../../utils/traoAPI";
@ -166,12 +161,4 @@ class Intro extends Component<any, any> {
}
}
const mapStateToProps = (state) => ({
instrument: state.instrument,
});
const mapDispatchToProps = (dispatch) => ({
setInstrument(data) {
dispatch(setInstrument(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(Intro);
export default Intro;

@ -139,27 +139,20 @@ page {
/*box-shadow: -2rpx 0 12rpx .5rpx rgba(129, 129, 129, 0.1);*/
border: 2rpx solid #dddddd;
position: relative;
}
.infobox2 .info4 .content .textarea {
width: 100%;
height: 100%;
color: #000;
font-size: 28rpx;
}
.infobox2 .info4 .content .contenttip {
color: #e1e1e1;
font-size: 20rpx;
position: absolute;
right: 24rpx;
bottom: 18rpx;
}
.infobox2 .info4 .content textarea {
width: 100%;
height: 100%;
font-size: 28rpx;
color: #000;
border-radius: 3rpx;
textarea {
width: 100%;
height: 100%;
font-size: 28rpx;
color: #000;
border-radius: 3rpx;
}
.tips-num {
color: #999;
font-size: 20rpx;
position: absolute;
right: 24rpx;
bottom: 18rpx;
}
}
.placeholder {
font-size: 28rpx;

@ -16,12 +16,14 @@ import {
} from "@tarojs/components";
import Navbar from "@/components/navbar/navbar";
import PopupInstrumentUploadTips from "@/components/popup/popup-instrument-upload-tips";
import { InstrumentInfo } from "@/utils/Interface";
import "./index.less";
import { contraction, getImgInfo } from "@/utils/compressImage";
import PopupAlert from "@/components/popup/popup-alert";
import { setStorageSync, getStorageSync, msg } from "@/utils/traoAPI";
export default class InstrumentClickInUpload extends Component<any, any> {
constructor(props) {
@ -40,17 +42,27 @@ export default class InstrumentClickInUpload extends Component<any, any> {
showVideoPlayBtn: true,
duration: 0,
videoContext: {}, // 视频播放器
isTipShow: false,
clockContent: "", // 默认展示
instrumentDetail: {},
punchInInfo: {
imageList: [],
content: "",
clockImageList: [],
clockContent: "",
instrumentId: "84",
firstClockImg: null,
secondClockImg: null,
thirdClockImg: null,
},
// 现在选中的数据
currentInfo: {
modeVideo: "",
},
modeInfo: [],
nurseInfo: [], // 首次进入介绍弹窗
isModeLock: false,
isSubmit: false, // 已提交则禁用提交按钮
};
}
@ -61,27 +73,58 @@ export default class InstrumentClickInUpload extends Component<any, any> {
componentWillUnmount() {}
componentDidShow() {}
componentDidShow() {
let videoContext = Taro.createVideoContext("myVideo");
this.setState({ videoContext });
}
componentDidHide() {}
async initData() {
this.firstNurseInfo();
this.modeInfoList();
let objStr = getStorageSync("instrument_detail");
if (objStr) {
let instrumentDetail = JSON.parse(objStr);
this.setState({ instrumentDetail });
}
setTimeout(() => {
this.firstNurseInfo();
this.getLatestClockRecord();
this.modeInfoList();
}, 10);
}
// 打卡介绍
firstNurseInfo = async () => {
let { instrumentDetail } = this.state;
let res = await InstrumentInfo.firstNurseInfo({
instrumentId: "84",
instrumentId: instrumentDetail.id,
});
console.log("firstNurseInfo", res);
if (res.data.code === 200) {
let isTipShow = getStorageSync("first_instrument_" + instrumentDetail.id);
if (!isTipShow) {
// 首次进入页面:自动打开打卡介绍弹窗
this.setState({ nurseInfo: res.data.data, isTipShow: true });
} else {
this.setState({ nurseInfo: res.data.data });
}
}
};
// 获取最新一条打卡记录
getLatestClockRecord = async () => {
let { punchInInfo } = this.state;
let res = await InstrumentInfo.apiClock.getLatestClockRecord();
if (res.data.code === 200) {
punchInInfo.clockContent = res.data.data.clockContent;
punchInInfo.clockImageList = res.data.data.clockImg;
}
this.setState({ punchInInfo });
};
// 获取仪器模式列表
modeInfoList = async () => {
let res = await InstrumentInfo.modeInfoList({
instrumentId: "84",
});
console.log("modeInfo", res);
if (res.data.code === 200) {
if (res.data.data.length) {
this.setState({
@ -96,7 +139,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
let { currentInfo, modeInfo, punchInInfo } = this.state;
currentInfo = modeInfo[index];
if (currentInfo.lock) {
this.onModeLockOpen();
this.onModeLockOpen(); // 点击了锁定模式
return;
}
this.setState({ zkmoshiindex: index, currentInfo });
@ -117,15 +160,98 @@ export default class InstrumentClickInUpload extends Component<any, any> {
let compressImage = await contraction(img, "compressImage");
// 压缩后文件地址
let compressTempFilePath = compressImage.tempFilePath;
punchInInfo.imageList.push(compressTempFilePath);
punchInInfo.clockImageList.push(compressTempFilePath);
this.setState({ punchInInfo });
},
});
};
// 删除打卡图片
handleDeleteImage = async (index) => {
let { punchInInfo } = this.state;
punchInInfo.imageList.splice(index, 1);
punchInInfo.clockImageList.splice(index, 1);
this.setState({ punchInInfo });
};
// 提交打卡
handleSubmit = async () => {
let { punchInInfo } = this.state;
let obj = punchInInfo;
if (obj.clockImageList.length === 0) {
msg("至少上传一张图片");
return;
}
let promiseTasks: any = [];
let imgList: any[] = [];
obj.clockImageList.map((imgUrl: string) => {
let isTmpFile = imgUrl.indexOf("//tmp") > -1;
let isWXFile = imgUrl.indexOf("wxfile://") > -1;
if (isTmpFile || isWXFile) {
let params = {
clockImg: imgUrl,
};
promiseTasks.push(InstrumentInfo.apiClock.clockFileUpload(params));
imgList.push("null");
} else {
imgList.push(imgUrl);
}
});
if (promiseTasks.length) {
let res = await Promise.all(promiseTasks);
//具体处理写在如下
if (res.length) {
res.map((item) => {
if (item.code === 200) {
let index = imgList.findIndex((url) => url === "null");
if (index > -1) {
imgList[index] = item.data.url;
}
}
});
}
}
let clockParmas = {
clockImageList: imgList,
clockContent: obj.clockContent,
};
let res = await InstrumentInfo.apiClock.postInsertClockLog(clockParmas);
if (res.data.code === 200) {
msg("打卡成功");
setTimeout(() => {
Taro.switchTab({
url: "/pages/index/index",
});
}, 2000);
}
};
onPlayTap = async () => {
let { videoContext } = this.state;
videoContext.play();
this.setState({
showVideoPlayBtn: false,
});
};
videoBindTimeUpdate = async () => {};
videoEnded = async () => {};
videoPause = async () => {};
videoPlay = async () => {};
videoLoadedMetaData = async () => {};
handleTextareaInput = async (e) => {
let { punchInInfo } = this.state;
punchInInfo.clockContent = e.detail.value;
this.setState({ punchInInfo });
};
@ -136,9 +262,16 @@ export default class InstrumentClickInUpload extends Component<any, any> {
this.setState({ isModeLock: false });
};
onTipShow = async () => {};
handleSubmit = async () => {};
onTipShowOpen = async () => {
this.setState({ isTipShow: true });
};
onTipShowClose = async () => {
setStorageSync(
"first_instrument_" + this.state.instrumentDetail.id,
"true"
);
this.setState({ isTipShow: false });
};
render() {
let {
@ -148,10 +281,12 @@ export default class InstrumentClickInUpload extends Component<any, any> {
scrollleft,
zkmoshiindex,
punchInInfo,
tipshow,
isTipShow,
currentInfo,
modeInfo,
nurseInfo,
isModeLock,
isSubmit,
} = this.state;
return (
<Block>
@ -171,7 +306,15 @@ export default class InstrumentClickInUpload extends Component<any, any> {
isClose={false}
close={this.onModeLockClose}
confirm={this.onModeLockClose}
></PopupAlert>
/>
<PopupInstrumentUploadTips
isShow={isTipShow}
title="打卡介绍"
data={nurseInfo}
close={this.onTipShowClose}
confirm={this.onTipShowClose}
/>
<View className="infobox1 flex aitems jcenter">
<View className="img">
<Video
@ -179,10 +322,12 @@ export default class InstrumentClickInUpload extends Component<any, any> {
id="myVideo"
enableProgressGesture={false}
controls={true}
autoplay={false}
// autoplay={false}
direction={0}
loop={false}
showMuteBtn={true}
onTimeUpdate={this.Videobindtimeupdate}
referrerPolicy="origin"
onTimeUpdate={this.videoBindTimeUpdate}
onEnded={this.videoEnded}
onPause={this.videoPause}
onPlay={this.videoPlay}
@ -198,7 +343,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
onClick={this.onPlayTap}
></Image>
{duration && (
<View className="Video-cover-time">{duration}</View>
<View className="video-cover-time">{duration}</View>
)}
</View>
)}
@ -266,7 +411,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
<View className="info4">
<View className="upload_header flex aitems sb">
<View className="upload_title"></View>
<View className="icon" onClick={this.onTipShow}>
<View className="icon" onClick={this.onTipShowOpen}>
<Image
src={require("../../img/clock_in_upload/info.png")}
mode="aspectFill"
@ -274,8 +419,8 @@ export default class InstrumentClickInUpload extends Component<any, any> {
</View>
</View>
<View className="imgbox flex aitems">
{punchInInfo.imageList.length > 0 &&
punchInInfo.imageList.map((item, index) => {
{punchInInfo.clockImageList.length > 0 &&
punchInInfo.clockImageList.map((item, index) => {
return (
<View className="img" key={"clickin_" + index}>
<Image src={item}></Image>
@ -293,7 +438,7 @@ export default class InstrumentClickInUpload extends Component<any, any> {
);
})}
{punchInInfo.imageList.length < 3 && (
{punchInInfo.clockImageList.length < 3 && (
<View
className="img2 flex aitems jcenter"
onClick={this.handleChooseImage}
@ -306,31 +451,40 @@ export default class InstrumentClickInUpload extends Component<any, any> {
)}
</View>
<View className="content">
{!tipshow && (
<Textarea
placeholder-className="placeholder"
maxlength={120}
onInput={this.handleTextareaInput}
value={punchInInfo.content}
placeholder="请记录一下今天打卡的心得吧~"
></Textarea>
)}
{tipshow && (
<Textarea
placeholder-className="placeholder"
maxlength={100}
onInput={this.handleTextareaInput}
value={punchInInfo.clockContent}
placeholder="请记录一下今天打卡的心得吧~"
></Textarea>
{/* {tipshow && (
<View className="Textarea">
{punchInInfo.content
? punchInInfo.content
{punchInInfo.clockContent
? punchInInfo.clockContent
: "请记录一下今天打卡的心得吧~"}
</View>
)}
)} */}
<View className="tips-num">
{punchInInfo.clockContent.length}/100
</View>
</View>
</View>
</View>
</View>
<View className="confirm_btn flex aitems" onClick={this.handleSubmit}>
<View className="btn"></View>
</View>
<View style="height: 150rpx"></View>
{!isSubmit && (
<View className="confirm_btn flex aitems" onClick={this.handleSubmit}>
<View className="btn"></View>
</View>
)}
{isSubmit && (
<View className="confirm_btn flex aitems">
<View className="btn"></View>
</View>
)}
</Block>
);
}

@ -0,0 +1,25 @@
import Taro from "@tarojs/taro";
import { createSlice } from "@reduxjs/toolkit";
// 设备连接蓝牙
const deviceInfoReducer = createSlice({
name: "deviceinfo", // store的名字
initialState: {
bluetoothInfo: {
deviceId: "",
servicesuuid: "",
characteristicsuuid0: "",
characteristicsuuid1: "",
characteristicId: "",
},
},
reducers: {
setDeviceInfo(state, { payload }) {
console.log("payload", payload);
state = JSON.parse(JSON.stringify(payload));
},
},
});
export const { setDeviceInfo } = deviceInfoReducer.actions;
export default deviceInfoReducer.reducer;

@ -5,7 +5,7 @@ import navigationReducer from "./features/navigation";
import userInfoReducer from "./features/userInfo";
import globalStoreReducer from "./features/globalStore";
import otherSettingReducer from "./features/otherSetting";
import instrumentReducer from "./features/instrument";
import deviceInfoReducer from "./features/deviceInfo";
const store = configureStore({
reducer: {
@ -15,7 +15,7 @@ const store = configureStore({
userInfo: userInfoReducer,
globalStore: globalStoreReducer,
otherSetting: otherSettingReducer,
instrument: instrumentReducer,
deviceInfo: deviceInfoReducer,
},
});

@ -153,65 +153,66 @@ export const GetMessageList = (data) => {
};
// 积分页面
/**分页获取用户积分列表*/
export const GetObtainUserIntegral = (data) => {
// 分页获取用户积分列表
return Ajax({
url: "/integralLog/obtainUserIntegral" + paramsToUrlQueryString(data),
method: "get",
});
};
/**获取积分规则*/
export const GetIntegralRule = (data) => {
// 获取积分规则
return Ajax({
url: "/setting/getIntegralRule",
method: "get",
});
};
/**查询用户是否关注公众号*/
export const GetIsAttentionOfficialAccount = (data) => {
// 查询用户是否关注公众号
return Ajax({
url: "/noRemind/isAttentionOfficialAccount",
method: "get",
});
};
/**查询用户是否关闭提醒关注公众号*/
export const GetOfficialAccount = (data) => {
// 查询用户是否关闭提醒关注公众号
return Ajax({
url: "/noRemind/getOfficialAccount",
method: "get",
});
};
/**查询关闭提醒关注公众号*/
export const GetCloseOfficialAccount = (data) => {
// 查询关闭提醒关注公众号
return Ajax({
url: "/noRemind/closeOfficialAccount",
method: "get",
});
};
/**站点管理-弹窗列表 1-首页 2-发现模块 3-活动模块*/
export const GetSitePopupList = (data) => {
// 站点管理-弹窗列表 1-首页 2-发现模块 3-活动模块
return Ajax({
url: "/siteInfo/popup/" + data,
method: "get",
});
};
/**站点管理-轮播图*/
export const GetSiteCarousel = (data) => {
// 站点管理-轮播图
return Ajax({
url: "/siteInfo/carousel",
method: "get",
});
};
/**站点管理-轮播图-添加标签 传值是id*/
export const GetSiteAddTag = (data) => {
// 站点管理-轮播图-添加标签 传值是id
return Ajax({
url: "/siteInfo/addTag/" + data,
method: "get",
});
};
// 仪器管理
/**仪器管理*/
export const InstrumentInfo = {
/**根据序列号获取仪器信息 serial 序列号*/
getInstrumentInfoBySerial: (data) => {
@ -325,7 +326,18 @@ export const InstrumentInfo = {
},
/**打卡相关*/
clock: {
apiClock: {
/**单文件上传*/
clockFileUpload: (formData) => {
return AjaxUploadFile(
{
url: "/clock/upload",
filePath: formData.clockImg,
name: "clockImg",
},
formData
);
},
/**添加用户使用仪器记录 instrumentId*/
addClockInstrument: (data) => {
return Ajax({
@ -364,7 +376,7 @@ export const InstrumentInfo = {
},
},
/**护理相关*/
nursingLog: {
apiNursingLog: {
/**新增用户护理日志*/
addLog: (data) => {
return Ajax({

@ -1,12 +1,15 @@
import Taro from "@tarojs/taro";
const deviceInfo = store.getState().deviceInfo;
import { msg, back, showModal, go, loading } from "./traoAPI";
const app = getApp();
// const app = getApp();
import { keywordTofilter } from "./util";
const log = require("./log");
import commandMap from "./commandMap";
export const getSystemInfo = () => {
return new Promise((reslove, reject) => {
wx.getSystemInfo({
Taro.getSystemInfo({
success(res) {
reslove(res);
},
@ -16,7 +19,7 @@ export const getSystemInfo = () => {
export const openBluetoothAdapter = () => {
return new Promise((reslove, reject) => {
wx.openBluetoothAdapter({
Taro.openBluetoothAdapter({
success(res) {
reslove(res);
},
@ -29,7 +32,7 @@ export const openBluetoothAdapter = () => {
export const startBluetoothDevicesDiscovery = () => {
return new Promise((reslove, reject) => {
wx.startBluetoothDevicesDiscovery({
Taro.startBluetoothDevicesDiscovery({
//开始搜索蓝牙
allowDuplicatesKey: false,
success(res) {
@ -44,7 +47,7 @@ export const startBluetoothDevicesDiscovery = () => {
export const createBLEConnection = (deviceId) => {
return new Promise((reslove, reject) => {
wx.createBLEConnection({
Taro.createBLEConnection({
deviceId,
success(res) {
reslove(res);
@ -58,7 +61,7 @@ export const createBLEConnection = (deviceId) => {
export const closeBLEConnection = (deviceId) => {
return new Promise((reslove, reject) => {
wx.closeBLEConnection({
Taro.closeBLEConnection({
deviceId,
success(res) {
reslove(res);
@ -74,14 +77,14 @@ export const closeBLEConnection = (deviceId) => {
//数组下标1读取 0写入
export const getBLEDeviceServices = (deviceId) => {
return new Promise((reslove, reject) => {
wx.getBLEDeviceServices({
Taro.getBLEDeviceServices({
//获取服务以及服务的uuid
deviceId,
success(res) {
console.log("主要服务");
console.log(res);
let servicesuuid = res.services[0].uuid; //主要服务
wx.getBLEDeviceCharacteristics({
Taro.getBLEDeviceCharacteristics({
//获取蓝牙低功耗设备某个服务中所有特征 (characteristic)。
deviceId,
serviceId: servicesuuid,
@ -109,7 +112,7 @@ export const getBLEDeviceServices = (deviceId) => {
export const notifyBLECharacteristicValueChange = (info) => {
return new Promise((reslove, reject) => {
wx.notifyBLECharacteristicValueChange({
Taro.notifyBLECharacteristicValueChange({
state: true, // 启用 notify 功能
deviceId: info.deviceId,
serviceId: info.servicesuuid,
@ -126,7 +129,7 @@ export const notifyBLECharacteristicValueChange = (info) => {
export const writeBLECharacteristicValue = (info, completeCallback) => {
return new Promise((reslove, reject) => {
wx.writeBLECharacteristicValue({
Taro.writeBLECharacteristicValue({
deviceId: info.deviceId,
serviceId: info.servicesuuid,
characteristicId: info.characteristicsuuid0,
@ -152,10 +155,10 @@ export const writeBLECharacteristicValue = (info, completeCallback) => {
export const sendCommand = (info) => {
return new Promise((reslove, reject) => {
wx.writeBLECharacteristicValue({
deviceId: app.globalData.deviceInfo.deviceId,
serviceId: app.globalData.deviceInfo.servicesuuid,
characteristicId: app.globalData.deviceInfo.characteristicsuuid0,
Taro.writeBLECharacteristicValue({
deviceId: deviceInfo.bluetoothInfo.deviceId,
serviceId: deviceInfo.bluetoothInfo.servicesuuid,
characteristicId: deviceInfo.bluetoothInfo.characteristicsuuid0,
value: info.value,
success(res) {
console.log(info.value);

Loading…
Cancel
Save