master
rongweikang 2 years ago
commit 94ff99f0d1

1
.gitignore vendored

@ -6,3 +6,4 @@ node_modules/
.DS_Store
.swc
.idea
package-lock.json

@ -17,6 +17,7 @@ const config = {
defineConstants: {
},
alias: {
'@/img': path.resolve(__dirname, '..', 'src/img'),
'@/components': path.resolve(__dirname, '..', 'src/components'),
'@/utils': path.resolve(__dirname, '..', 'src/utils'),
'@/store': path.resolve(__dirname, '..', 'src/store'),

@ -36,7 +36,8 @@
"author": "",
"dependencies": {
"@antmjs/vantui": "^3.2.2",
"@babel/runtime": "^7.7.7",
"@flossom-npm/iot-translater": "^1.0.14",
"@flossom-npm/iot-translater-we100": "^1.0.74",
"@reduxjs/toolkit": "^2.0.1",
"@taroify/core": "^0.1.1-alpha.8",
"@tarojs/components": "3.6.19",
@ -60,10 +61,7 @@
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-redux": "^9.0.3",
"taro-ui": "^3.2.0",
"terser-webpack-plugin": "^5.3.9",
"@flossom-npm/iot-translater": "^1.0.8",
"@flossom-npm/iot-translater-we100": "^1.0.66"
"taro-ui": "^3.2.0"
},
"devDependencies": {
"@babel/core": "^7.8.0",
@ -91,6 +89,8 @@
"thread-loader": "^4.0.2",
"ts-node": "^10.9.1",
"typescript": "^4.1.0",
"webpack": "^5.78.0"
"webpack": "^5.78.0",
"terser-webpack-plugin": "^5.3.9",
"@babel/runtime": "^7.7.7"
}
}

@ -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',
@ -27,6 +27,7 @@ export default defineAppConfig({
"pages/webViewPage/webViewPage",
'pages/template/template',
'pages/face_report/face_report',
"pages/connection_help/connection_help",
],
"tabBar": {
"custom": true,
@ -78,5 +79,6 @@ export default defineAppConfig({
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black',
// enablePullDownRefresh: true
}
},
requiredPrivateInfos: ["getLocation"]
})

@ -0,0 +1,10 @@
const InstrumentTypeEnum = {
//仪器类型
FR200: 1,
MATRIX: 2,
WL200: 3,
FR380: 4,
FR390: 5,
M01: 6,
};
export default InstrumentTypeEnum;

@ -0,0 +1,7 @@
const OtaDeviceTypeEnum = {
WL200: "WL200",
WE100: "WE100",
FACIALMASK: "FacialMask",
STAND: "Stand",
};
export default OtaDeviceTypeEnum;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,66 @@
/**蓝牙命令合集*/
export const bleCommandSamples = {
/**发送配对码*/
match: {
commandType: "BleMatch",
bleCommandType: "SendMatchCode",
},
/**查询附属设备的配对状态*/
querySubDevice: {
commandType: "BleMatch",
bleCommandType: "QueryMatchStatus",
},
/**查询设备状态指令*/
queryDeviceStatus: {
commandType: "DeviceStatusSync",
deviceSyncCommandType: 'queryDeviceStatus'
},
/**查询版本指令*/
queryDeviceVersionStatus: {
commandType: "InfoQuery",
infoQueryType: 'versionInfo',
otaDeviceType: ''
},
/**查询当前记录*/
queryCurrentMaskReportInfo: {
commandType: "InfoQuery",
infoQueryType: 'currentMaskReportInfo'
}
};
/**控制设备命令合集*/
export const deviceCommandSamples = {
/**控制设备暂停 pause暂停 working启动 end关闭*/
pause:{
commandType: "DeviceControl",
workStatus: "pause",
},
standby:{
commandType: "DeviceControl",
workStatus: "standby",
},
end:{
commandType: "DeviceControl",
workStatus: "end",
},
/*
* powerfulSoothing 强效舒缓 01
* Stability 维稳维护 02
* Brighten 均色提亮 03
* FirmSkin 紧致淡纹 04
* Custom 自定义模式 05
* WaterLightEssence 水光精华模式 11
* ShapeBeautyEssence 塑颜精华模式 12
* DiyFacial DIY面膜模式 13
* FacialMaskCustom 面膜定制模式 1A
*/
work:{
commandType: "DeviceControl",
workStatus: "working",
workMode: "",
},
gear:{
commandType: "DeviceControl",
partitionStatus: [{gear: 1},{gear: 1},{gear: 1},{gear: 1},]
}
};

@ -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,157 @@
import classnames from "classnames";
import Taro from "@tarojs/taro";
import { Component } from "react";
import {
Block,
View,
Image,
Text,
Button,
PageMeta,
Video,
} from "@tarojs/components";
import { Popup } from "@antmjs/vantui";
import "../../popup/popup.less";
import "./device-connection-popup.less";
import { go } from "@/utils/traoAPI";
/*** props
* isLarge
* isShow
* data
* @confirm
* ***/
export default class DeviceConnectPopup 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();
};
onConfirm = () => {
this.props.confirm();
};
onClickStop = (e) => {
e.stopPropagation();
};
render() {
let { isShow, data, isLarge, title, connectionStatus, isConnection } =
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={classnames("common-popup-title", "margin-samll")}>
{data.bluetoothConnectingTitle}
</View>
<View className="site-popup-content-box">
<Video src={data.bluetoothConnecting} />
<View className="block">
<View className="icon">
{connectionStatus ? (
<Image
className="images"
src={require("../../../img/selected_success.png")}
mode="aspectFill"
/>
) : (
<Image
className="images"
src={require("../../../img/select_success.png")}
mode="aspectFill"
/>
)}
</View>
{isConnection && <View></View>}
<View className="tip1">skinpilot</View>
</View>
</View>
<View className="common-popup-btns">
<Button className="common-popup-btn2" onClick={this.onClose}>
</Button>
<Button className="common-popup-btn2" onClick={this.onConfirm}>
</Button>
</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>
);
}
}

@ -38,6 +38,10 @@
font-weight: bold;
color: #000000;
}
.logo-title {
width: 320rpx;
text-align: center;
}
.back {
width: 100rpx;
text-align: center;

@ -1,4 +1,5 @@
import { Component } from "react";
import classnames from "classnames";
import Taro from "@tarojs/taro";
import { Block, View, Image } from "@tarojs/components";
@ -92,7 +93,11 @@ export default class Navbar extends Component<any, any> {
)}
{leftSlot}
</View>
<View className="logo">
<View
className={classnames("logo", {
"logo-title": titleSlot,
})}
>
{titleSlot ? (
titleSlot
) : isWhite ? (
@ -109,7 +114,7 @@ export default class Navbar extends Component<any, any> {
/>
)}
</View>
<View className="back"/>
<View className="back" />
</View>
<View
className="nav_top_padding"

@ -10,7 +10,7 @@ import "./popup-alert.less";
import { go } from "../../utils/traoAPI";
/*** props
/** props
* isLarge
* isShow
* isClose
@ -20,7 +20,7 @@ import { go } from "../../utils/traoAPI";
* textAlgin left right center
* type: 1
* @confirm
* ***/
*/
export default class PopupAlert extends Component<any, any> {
constructor(props) {
super(props);

@ -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>
);
}
}

@ -0,0 +1,12 @@
.nodes {
padding: 30rpx;
word-break: break-all;
box-sizing: border-box;
table {
border-collapse: collapse; /* 边框合并 */
}
td {
text-align: center; /* 字体居中 */
border: 1px solid #ccc; /* 边框样式 */
}
}

@ -0,0 +1,105 @@
import { Component, PropsWithChildren, useEffect, useState } from "react";
import Taro from "@tarojs/taro";
import { Block, View, RichText } from "@tarojs/components";
import Navbar from "../../components/navbar/navbar";
import "./connection_help.less";
import {
GetBluetoothGuidance,
GetLocationGuidance,
} from "../../utils/Interface";
export default class ConnectionHelp extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "蓝牙连接帮助",
nodes: "",
type: "bluetoot", // bluetoot location
title: "蓝牙权限开启指引", // 定位授权开启指引
};
}
$instance = Taro.getCurrentInstance();
async onLoad() {
this.getType();
}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async getType() {
let type = this.$instance.router?.params?.type;
if (type) {
let title = type === "bluetoot" ? "蓝牙权限开启指引" : "定位授权开启指引";
this.setState({ type, title });
setTimeout(() => {
this.initData();
}, 0);
}
}
initData = async () => {
let { type } = this.state;
if (type === "bluetoot") {
this.GetBluetoothGuidance();
} else {
this.GetLocationGuidance();
}
};
GetBluetoothGuidance = async () => {
let res = await GetBluetoothGuidance();
if (res.data.code === 200) {
let nodes = decodeURIComponent(res.data.data.value || "");
nodes = nodes.replace(/\<img/gi, '<img style="width:100%;height:auto" ');
nodes = nodes.replace(
/\<table/gi,
'<table style="border-spacing: 0;border-collapse: collapse;border: 1px solid #000" '
);
nodes = nodes.replace(
/\<td/gi,
'<td style="border: 1px solid #000;text-align:center" '
);
this.setState({ nodes: nodes });
}
};
GetLocationGuidance = async () => {
let res = await GetLocationGuidance();
if (res.data.code === 200) {
let nodes = decodeURIComponent(res.data.data.value || "");
nodes = nodes.replace(/\<img/gi, '<img style="width:100%;height:auto" ');
nodes = nodes.replace(
/\<table/gi,
'<table style="border-spacing: 0;border-collapse: collapse;border: 1px solid #000" '
);
nodes = nodes.replace(
/\<td/gi,
'<td style="border: 1px solid #000;text-align:center" '
);
this.setState({ nodes: nodes });
}
};
render() {
let { nodes, title } = this.state;
return (
<Block>
<Navbar titleSlot={title} isBack={true} />
<View className="nodes">
<RichText nodes={nodes} />
</View>
</Block>
);
}
}

@ -13,20 +13,22 @@ import {
/*** redux ***/
import { connect } from "react-redux";
import { userRefresh, tokenRefresh } from "../../store/features/userInfo";
import { setIndexFlag } from "../../store/features/globalStore";
import { userRefresh, tokenRefresh } from "@/store/features/userInfo";
import { setIndexFlag } from "@/store/features/globalStore";
/*** redux end ***/
/** 自定义组件 **/
import AtCalendar from "../../components/calendar";
import PopupPrivacy from "../../components/popup/popup-privacy";
import PopupBinding from "../../components/popup/popup-binding";
import AtCalendar from "@/components/calendar";
import PopupPrivacy from "@/components/popup/popup-privacy";
import PopupBinding from "@/components/popup/popup-binding";
// import PopupPrivacyTest from "../../components/popup/popup-privacy-test";
import PopupSiteSwiper from "../../components/popup/popup-site-swiper";
import PopupAlert from "../../components/popup/popup-alert";
import type CustomTabBar from "../../custom-tab-bar";
import Navbar from "../../components/navbar/navbar";
import PopupSiteSwiper from "@/components/popup/popup-site-swiper";
import PopupAlert from "@/components/popup/popup-alert";
import type CustomTabBar from "@/custom-tab-bar";
import Navbar from "@/components/navbar/navbar";
import ConnectionBluetoot from "@/components/bluetoot/connection";
/** 自定义组件 **/
import {
@ -48,8 +50,15 @@ import {
msg,
getStorageSync,
setStorageSync,
showModal,
} from "@/utils/traoAPI";
const log = require("@/utils/log");
import commandMap from "@/utils/commandMap";
import InstrumentTypeEnum from "@/components/bluetoot/instrumentTypeEnum";
import OtaDeviceTypeEnum from "@/components/bluetoot/OtaDeviceTypeEnum";
class Index extends Component<any, any> {
// pageCtx = Taro.getCurrentInstance().page;
$instance = Taro.getCurrentInstance();
@ -63,12 +72,10 @@ class Index extends Component<any, any> {
isNotRegister: false, // 是否未注册
isDev: false, // 正在开发提示
sitePopupList: [], // 站点管理列表
// imgUrl: this.app.globalData.imgUrl,
userinfo: {
mobile: this.props.mobile,
mobile: Taro.getStorageSync("mobile"),
},
connectInstrument: {},
yiqiinfo: {},
list: [],
params: "",
messageCount: Taro.getStorageSync("messageCount") || 0,
@ -95,7 +102,6 @@ class Index extends Component<any, any> {
isVisibleBinding: false, // 绑定弹窗
isBindingError: false, // 绑定失败
isBeforeBinding: false, // 已绑定弹窗
typeBinding: 0,
instrumentList: [], // 仪器列表
instrumentInfo: {
// 扫码获得的序列号仪器
@ -118,6 +124,16 @@ class Index extends Component<any, any> {
validStatus: 1, // 1有效0无效
},
/** 绑定仪器 End */
/** 已绑定仪器 */
instrument_detail: {},
/* 已绑定仪器 END */
/** 蓝牙相关 */
isConnectShow: false,
connectInstrument: {},
yiqiinfo: {},
/* END */
};
}
@ -556,12 +572,455 @@ 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));
// setStorageSync("connectInstrument", JSON.stringify(item));
// this.setState({ instrument_detail: item });
// this.setState({ connectInstrument: item });
// setTimeout(() => this.bindBlockLeft());
// isConnectShow
setTimeout(() => {
go("/pages/instrumentClickinUpload/index?id=" + item.id);
}, 10);
// go("/pages/instrument/intro?id=" + item.id);
};
/* 扫码进入逻辑 */
/** 蓝牙逻辑 */
bindBlockLeft() {
console.log("this.state.userinfo", this.state.userinfo);
if (!this.state.userinfo.mobile) {
//未注册授权
this.alertRegister();
return false;
}
if (this.state.connectInstrument.type === 1) {
//非IOT
} else {
Taro.getSystemInfo({
success: (res) => {
console.log("getSystemInfo", res);
this.setState({ isConnectShow: true });
return;
let { locationEnabled, locationAuthorized, bluetoothEnabled } = res;
if (!locationEnabled || !locationAuthorized) {
showModal({
t2: "您的手机定位授权未开启,请前往手机设置,打开定位访问授权",
btn2text: "查看指引",
}).then(() => {
go("/pages/connection_help/connection_help?type=location");
});
} else if (!bluetoothEnabled) {
showModal({
t2: "您的手机蓝牙授权未开启,请前往手机设置,打开蓝牙访问授权",
btn2text: "查看指引",
}).then(() => {
go("/pages/connection_help/connection_help?type=bluetoot");
});
} else {
// 打开连接弹窗
this.setState({ isConnectShow: true });
}
},
});
}
}
/**
* WE100,WL200
*/
async pairingChange(e) {
console.log("epairingChange", e);
return;
const { connectInstrument } = this.state;
let latestVersionNo, isNeedToUpdateBl;
//当前版本号
const deviceVersionNo = e.detail.deviceVersionNo;
console.info("配对完成回调", e, deviceVersionNo);
//最新版本号
latestVersionNo = connectInstrument.iot_versions;
//TODO 这些信息需要放在WL200的接口里现在没有。 暂时的方案如果是WL200 需要查WE200的相关信息
if (connectInstrument.type == instrumentTypeEnum.WL200) {
this.pureData.mianmo_id = app.globalData.bindinfo.mianmo_id;
const { data: resData } = await InstrumentInfo({
id: this.pureData.mianmo_id,
});
// if (resData) {}
// const mianmo_item = this.data.instruments.find(item=>{
// return this.pureData.mianmo_id == item.id;
// })
// if (mianmo_item) {
// const {iot_versions,type} = mianmo_item
// this.pureData.mianmo_iot_versions = iot_versions;
// this.pureData.mianmo_type = type;
// latestVersionNo = iot_versions
// }
// const {data: resData} = await UserInstrumentInfo({id: this.pureData.mianmo_id});
if (resData.code == 200) {
const { data } = resData;
const { iot_versions, type } = data.info;
this.pureData.mianmo_iot_versions = iot_versions;
this.pureData.mianmo_type = type;
latestVersionNo = iot_versions;
}
isNeedToUpdateBl = isNeedToUpdate(deviceVersionNo, latestVersionNo);
console.log(
`设备版本号: ${deviceVersionNo}`,
`后台版本号: ${latestVersionNo}`,
`是否需要升级: ${isNeedToUpdateBl}`
);
// 2023.11.29 18:00 经与黄工讨论, 后续版本暂时都需要进行强更
// this.gotoOta();
// return
if (isNeedToUpdateBl) {
this.gotoOta();
return;
this.setData({
params: "offlineDialog",
offlineDialogType: 2,
otaDeviceName: "skinpilot",
});
return;
}
go(`/pages/MatrixWL200/pages/index/index?devId=${connectInstrument.id}`);
this.setData({
params: "",
});
} else if (connectInstrument.type == instrumentTypeEnum.M01) {
isNeedToUpdateBl = isNeedToUpdate(deviceVersionNo, latestVersionNo);
console.log(
`设备版本号: ${deviceVersionNo}`,
`后台版本号: ${latestVersionNo}`,
`是否需要升级: ${isNeedToUpdateBl}`
);
if (isNeedToUpdateBl) {
// 2023.11.17 22:00 经与黄工讨论, 后续版本暂时都需要进行强更
this.gotoOta();
return;
this.setData({
params: "offlineDialog",
offlineDialogType: 2,
otaDeviceName: "skinpilot",
offlineDialogForce: 1,
});
return;
}
go(
`/pages/MatrixM01/pages/index/index?devId=${this.data.connectInstrument.id}`
);
// this.setData({
// params: "",
// });
}
}
//连接完成时数据的回调
offlineChange = async (e) => {
const that = this;
log.info(
commandMap.versionInfoHome,
`offlineChange::e::${JSON.stringify(e)}`
);
//offlineDataList 离线数据
//versioninfo 版本号
let { offlineDataList, versionInfo } = e.detail;
this.setState({
versionInfo,
});
let offlinelist: any = [];
offlineDataList.map((item, index) => {
let obj: any = {
clock_day: "",
status: 3,
second: 120,
screne_id: "",
screne_name: "离线打卡",
model_face_ward: 0,
model_face_use: 0,
model_face_type: "",
model_eye_ward: 0,
model_eye_use: 0,
model_eye_type: "",
instrument_id: this.state.connectInstrument.id,
};
//判断日期是否正常,如果不正常不处理 --- 脸部
if (
item.faceyear > 0 &&
item.faceyear <= 99 &&
item.facemonth >= 1 &&
item.facemonth <= 12 &&
item.faceday >= 1 &&
item.faceday <= 31
) {
if (
item.facehour > 0 ||
(item.faceminutes > 0 && item.faceminutes < 60) ||
(item.faceseconds > 0 && item.faceseconds < 60)
) {
//脸部离线记录有值
obj.model_face_use =
Number(item.facehour) * 60 * 60 +
Number(item.faceminutes) * 60 +
Number(item.faceseconds);
obj.model_face_ward = item.faceposition1;
obj.clock_day = `20${String(item.faceyear).padStart(2, "0")}-${String(
item.facemonth
).padStart(2, "0")}-${String(item.faceday).padStart(2, "0")}`;
}
}
//判断日期是否正常,如果不正常不处理 --- 眼部
if (
item.eyeyear > 0 &&
item.eyeyear <= 99 &&
item.eyemonth >= 1 &&
item.eyemonth <= 12 &&
item.eyeday >= 1 &&
item.eyeday <= 31
) {
if (
item.eyehour > 0 ||
(item.eyeminutes > 0 && item.eyeminutes < 60) ||
(item.eyeseconds > 0 && item.eyeseconds < 60)
) {
//眼部离线记录有值
obj.model_eye_use =
Number(item.eyehour) * 60 * 60 +
Number(item.eyeminutes) * 60 +
Number(item.eyeseconds);
obj.model_eye_ward = item.eyeposition1;
obj.clock_day = `20${String(item.eyeyear).padStart(2, "0")}-${String(
item.eyemonth
).padStart(2, "0")}-${String(item.eyeday).padStart(2, "0")}`;
}
}
obj.second = obj.model_face_use + obj.model_eye_use;
if (
item.faceyear > 0 &&
item.faceyear <= 99 &&
(item.facemonth == 1 || item.facemonth <= 12) &&
(item.faceday == 1 || item.faceday <= 31)
) {
let dayTime = new Date(`${obj.clock_day.replace(/-/g, "/")}`).getTime(); //离线记录的日期
let now = new Date(
`${new Date().getFullYear()}/${String(
new Date().getMonth() + 1
).padStart(2, "0")}/${String(new Date().getDate()).padStart(2, "0")}`
).getTime(); //当前日期
/**
* 7线
*
*/
if (dayTime <= now && dayTime >= now - 24 * 60 * 60 * 1000 * 6) {
offlinelist.push(obj);
}
}
});
console.log(offlinelist);
let nowyear = new Date().getFullYear();
let nowmonth = String(new Date().getMonth() + 1).padStart(2, "0");
let nowday = String(new Date().getDate()).padStart(2, "0");
// await IOTHistorySynchronization({
// //把离线数据同步到后台
// instrument_id: app.globalData.bindid,
// clock_times: offlinelist,
// });
// offlinelist.map((item, index) => {
// // console.log(new Date(item.clock_day.replace(/-/g,'/')).getTime())
// if (item.clock_day == `${nowyear}-${nowmonth}-${nowday}`) {
// //今日有离线护理 弹出 检测到您今天已进行护理,是否跳过护理直接前往打卡,或选择继续进行护理
// if (item.second >= this.data.connectInstrument.times * 60) {
// console.log("今日有离线护理");
// let screneList2 = {
// lianbuobj: {
// fen: String(s_to_h(item.model_face_use)).padStart("2", 0),
// miao: String(s_to_s(item.model_face_use)).padStart("2", 0),
// total: item.model_face_use,
// },
// yanbuobj: {
// fen: String(s_to_h(item.model_eye_use)).padStart("2", 0),
// miao: String(s_to_s(item.model_eye_use)).padStart("2", 0),
// total: item.model_eye_use,
// },
// ledobj: {
// fen: 0,
// miao: 0,
// total: 0,
// },
// };
// this.setData({
// screneList2,
// });
// let screneList3 = {
// second: item.second, //总秒
// screne_id: "", //场景id
// screne_name: "离线记录", //场景名称
// model_face_ward: item.model_face_ward, //脸部场景档位
// model_face_use: item.model_face_use, //脸部场景使用时长
// model_face_type: "", //脸部模式类型
// model_eye_ward: item.model_eye_ward, //眼部场景档位
// model_eye_use: item.model_eye_use, //眼部场景使用时长
// model_eye_type: "", //眼部模式类型
// };
// /**
// * 如果今天有打过卡,需要累加
// */
// // if (this.data?.todayclockin?.id) {
// // screneList3.second += this.data.todayclockin.clock_info[0].second
// // screneList3.model_face_use += this.data.todayclockin.clock_info[0].model_face_use
// // screneList3.model_eye_use += this.data.todayclockin.clock_info[0].model_eye_use
// // }
// //
// // console.log(this.data.todayclockin)
// this.setData({
// screneList3,
// });
// console.log(this.data.screneList3, "2222222222222222222");
// this.setData({
// params: "offlineDialog",
// offlineDialogType: 1,
// todayofflineData: item,
// });
// }
// }
// });
// if (this.data.params == "connection_guide") {
// // this.setData({
// // params: 'offlineDialog',
// // offlineDialogType:2
// // })
// console.log("设备版本号" + versioninfo.version);
// console.log("后台版本号" + this.data.connectInstrument.iot_versions);
// log.info(
// commandMap.versionInfoHome,
// `设备版本号: ${versioninfo.version}`
// );
// log.info(
// commandMap.versionInfoHome,
// `后台版本号: ${that.data.connectInstrument.iot_versions}`
// );
// console.log(
// "后台版本号H" +
// Number(this.data.connectInstrument.iot_versions.substring(0, 2)) +
// "版本号H" +
// Number(String(versioninfo.v1).padStart("2", 0))
// );
// log.info(
// commandMap.versionInfoHome,
// `后台版本号H: ${Number(
// that.data.connectInstrument.iot_versions.substring(0, 2)
// )} ,版本号H: ${Number(String(versioninfo.v1).padStart("2", 0))}`
// );
// console.log(
// "后台版本号M" +
// Number(this.data.connectInstrument.iot_versions.substring(2, 4)) +
// "版本号M" +
// Number(String(versioninfo.v2).padStart("2", 0))
// );
// log.info(
// commandMap.versionInfoHome,
// "后台版本号M" +
// Number(this.data.connectInstrument.iot_versions.substring(2, 4)) +
// "版本号M" +
// Number(String(versioninfo.v2).padStart("2", 0))
// );
// console.log(
// "后台版本号L" +
// Number(this.data.connectInstrument.iot_versions.substring(4, 6)) +
// "版本号L" +
// Number(String(versioninfo.v3).padStart("2", 0))
// );
// log.info(
// commandMap.versionInfoHome,
// "后台版本号L" +
// Number(this.data.connectInstrument.iot_versions.substring(4, 6)) +
// "版本号L" +
// Number(String(versioninfo.v3).padStart("2", 0))
// );
// //这是有问题的固件,强制升级
// if (
// versioninfo.v1 == "01" &&
// versioninfo.v2 == "02" &&
// versioninfo.v3 == "00"
// ) {
// this.gotoOta();
// return;
// }
// if (
// this.data.connectInstrument.iot_versions.substring(0, 2) ==
// versioninfo.v1
// ) {
// if (
// Number(this.data.connectInstrument.iot_versions.substring(2, 4)) >
// Number(versioninfo.v2)
// ) {
// this.setData({
// params: "offlineDialog",
// offlineDialogType: 2,
// otaDeviceName: "设备",
// });
// } else if (
// Number(this.data.connectInstrument.iot_versions.substring(2, 4)) ==
// Number(versioninfo.v2)
// ) {
// if (
// Number(this.data.connectInstrument.iot_versions.substring(4, 6)) >
// Number(versioninfo.v3)
// ) {
// this.setData({
// params: "offlineDialog",
// offlineDialogType: 2,
// otaDeviceName: "设备",
// });
// } else {
// this.setData({
// params: "",
// });
// go(
// "/pages/nursing/nursing?id=&iid=" +
// app.globalData.bindid +
// `&type=fr200&version=${versioninfo?.version}`
// );
// }
// } else {
// this.setData({
// params: "",
// });
// go(
// "/pages/nursing/nursing?id=&iid=" +
// app.globalData.bindid +
// `&type=fr200&version=${versioninfo?.version}`
// );
// }
// } else {
// this.setData({
// params: "",
// });
// go(
// "/pages/nursing/nursing?id=&iid=" +
// app.globalData.bindid +
// `&type=fr200&version=${versioninfo?.version}`
// );
// }
// }
};
connectionClose = async (data) => {
console.log("connectionClose", data);
this.setState({ isConnectShow: false });
};
connectionConfirm = async (data) => {
console.log("connectionConfirm", data);
this.setState({ isConnectShow: false });
};
/*蓝牙 END*/
render() {
let {
calendarComplete,
@ -582,9 +1041,12 @@ class Index extends Component<any, any> {
isBeforeBinding,
isRegisterBoolean,
isExchangeBinding,
typeBinding,
instrumentInfo,
instrumentList,
// 蓝牙连接
isConnectShow,
connectInstrument,
} = this.state;
return (
@ -663,6 +1125,16 @@ class Index extends Component<any, any> {
close={this.closeSiteSwiper}
confirm={this.closeSiteSwiper}
/>
{isConnectShow && (
<ConnectionBluetoot
yiqiInfo={connectInstrument}
close={this.connectionClose}
confirm={this.connectionConfirm}
/>
)}
{/* <ConnectionBluetoot /> */}
<Navbar
leftSlot={
<Block>

@ -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({
@ -95,6 +138,10 @@ export default class InstrumentClickInUpload extends Component<any, any> {
bindMoshi = async (index) => {
let { currentInfo, modeInfo, punchInInfo } = this.state;
currentInfo = modeInfo[index];
if (currentInfo.lock) {
this.onModeLockOpen(); // 点击了锁定模式
return;
}
this.setState({ zkmoshiindex: index, currentInfo });
};
@ -113,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 });
};
@ -132,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 {
@ -144,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>
@ -167,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
@ -175,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}
@ -194,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>
)}
@ -262,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"
@ -270,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>
@ -289,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}
@ -302,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>
);
}

@ -31,6 +31,7 @@ import {
GetIsAttentionOfficialAccount,
GetOfficialAccount,
GetCloseOfficialAccount,
RefreshWxUserInfo,
} from "../../utils/Interface";
import { msg } from "../../utils/traoAPI";
@ -75,10 +76,20 @@ class IntegralList extends Component<any, any> {
componentDidHide() {}
async initData() {
this.RefreshWxUserInfo();
this.GetObtainUserIntegral();
this.GetIsAttentionOfficialAccount();
}
// 刷新用户信息
RefreshWxUserInfo = async () => {
let res = await RefreshWxUserInfo();
if (res.data.code === 200) {
this.props.userRefresh(res.data.data);
this.setState({ userInfo: res.data.data });
}
};
openShop = () => {
let { otherSetting } = this.state;
if (otherSetting.skipAppid) {
@ -368,7 +379,8 @@ class IntegralList extends Component<any, any> {
title="过期积分提醒"
type="3"
content={
<View style={{ height: "700rpx" }}>
// <View style={{ height: "700rpx" }}> // 删除测试阶段标签后需改回700rpx
<View style={{ height: "750rpx" }}>
<Image
style={{
width: "100%",
@ -382,7 +394,7 @@ class IntegralList extends Component<any, any> {
<View style={{ marginTop: "20rpx" }}>
</View>
<View style={{ marginTop: "20rpx", color: "#666" }}>
<View style={{ marginTop: "10rpx", color: "#666" }}>
(广)
</View>
</View>

@ -52,14 +52,7 @@ export default class PrivacyPolicy extends Component<any, any> {
<Navbar titleSlot="隐私政策" isBack={true} />
<View className="nodes">
<RichText
nodes={
nodes
// "<pre style=' white-space: pre-wrap;word-wrap: break-word;'>" +
// nodes +
// "</pre>"
}
/>
<RichText nodes={nodes} />
</View>
</Block>
);

@ -47,14 +47,13 @@ class User extends Component<any, any> {
};
}
async onLoad() {
this.initData();
}
async onLoad() {}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {
this.initData();
this.setState({ userInfo: this.props.userInfo });
let messagecount = Taro.getStorageSync("messageCount");
@ -83,7 +82,6 @@ class User extends Component<any, any> {
// 刷新用户信息
RefreshWxUserInfo = async () => {
let res = await RefreshWxUserInfo();
console.log("res", res);
if (res.data.code === 200) {
this.props.userRefresh(res.data.data);
this.setState({ userInfo: res.data.data });

@ -515,7 +515,9 @@ class UserInfo extends Component<any, any> {
</View>
) : (
<View className="btn btn-disable"></View>
<View className="btn btn-disable" onClick={this.onSubmit}>
</View>
)}
<View className="text" onClick={this.onSkip}>

@ -513,7 +513,9 @@ class UserInfoDetail extends Component<any, any> {
</View>
) : (
<View className="btn btn-disable"></View>
<View className="btn btn-disable" onClick={this.onSubmit}>
</View>
)}
</View>

@ -0,0 +1,27 @@
import Taro from "@tarojs/taro";
import { createSlice } from "@reduxjs/toolkit";
// 设备连接蓝牙
const deviceInfoReducer = createSlice({
name: "deviceinfo", // store的名字
initialState: {
bluetoothInfo: {
deviceId: "5FF5FD4F-9EF9-3CB6-AD89-F915B55E5DE9", // 先测试一下
servicesuuid: "",
characteristicsuuid0: "",
characteristicsuuid1: "",
characteristicId: "",
},
},
reducers: {
setDeviceInfo(state, { payload }) {
state = JSON.parse(JSON.stringify(payload));
},
setBluetoothInfo(state, { payload }) {
state.bluetoothInfo = JSON.parse(JSON.stringify(payload));
},
},
});
export const { setBluetoothInfo } = 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,
},
});

@ -34,7 +34,6 @@ export const GetAboutUs = (data) => {
//获取用户信息接口
return Ajax({
url: "/setting/getAboutUs",
data,
method: "get",
});
};
@ -61,7 +60,6 @@ export const RefreshWxUserInfo = (data) => {
// 刷新用户信息
return Ajax({
url: "/user/refreshWxUserInfo",
data,
method: "get",
});
};
@ -69,7 +67,6 @@ export const GetProvince = (data) => {
// 获取全部省份
return Ajax({
url: "/region/getProvince",
data,
method: "get",
});
};
@ -77,7 +74,6 @@ export const GetAreaListByPid = (data) => {
// 获取全部省份 ?pid=xxx
return Ajax({
url: "/region/getAreaListByPid" + paramsToUrlQueryString(data),
data,
method: "get",
});
};
@ -105,7 +101,6 @@ export const getPrivacyAgreement = (data) => {
//用户隐私协议获取
return Ajax({
url: "/setting/getPrivacyAgreement",
data,
method: "get",
});
};
@ -113,7 +108,6 @@ export const GetOtherSetting = (data) => {
// 获取其他设置
return Ajax({
url: "/setting/getOtherSetting",
data,
method: "get",
});
};
@ -121,7 +115,6 @@ export const getContactWorker = (data) => {
// 联系客服
return Ajax({
url: "/setting/getContactWorker",
data,
method: "get",
});
};
@ -139,7 +132,6 @@ export const GetNoReadMessageNum = (data) => {
// 查询是否有消息未读
return Ajax({
url: "/userScriptLog/getNoReadMessageNum",
data,
method: "get",
});
};
@ -148,7 +140,6 @@ export const GetHasBeenRead = (data) => {
// 将消息设置为已读
return Ajax({
url: "/userScriptLog/hasBeenRead",
data,
method: "get",
});
};
@ -157,79 +148,86 @@ export const GetMessageList = (data) => {
// 分页获取消息
return Ajax({
url: "/userScriptLog/list" + paramsToUrlQueryString(data),
data,
method: "get",
});
};
// 积分页面
/**分页获取用户积分列表*/
export const GetObtainUserIntegral = (data) => {
// 分页获取用户积分列表
return Ajax({
url: "/integralLog/obtainUserIntegral" + paramsToUrlQueryString(data),
data,
method: "get",
});
};
/**获取积分规则*/
export const GetIntegralRule = (data) => {
// 获取积分规则
return Ajax({
url: "/setting/getIntegralRule",
data,
method: "get",
});
};
/**查询用户是否关注公众号*/
export const GetIsAttentionOfficialAccount = (data) => {
// 查询用户是否关注公众号
return Ajax({
url: "/noRemind/isAttentionOfficialAccount",
data,
method: "get",
});
};
/**查询用户是否关闭提醒关注公众号*/
export const GetOfficialAccount = (data) => {
// 查询用户是否关闭提醒关注公众号
return Ajax({
url: "/noRemind/getOfficialAccount",
data,
method: "get",
});
};
/**查询关闭提醒关注公众号*/
export const GetCloseOfficialAccount = (data) => {
// 查询关闭提醒关注公众号
return Ajax({
url: "/noRemind/closeOfficialAccount",
data,
method: "get",
});
};
/**站点管理-弹窗列表 1-首页 2-发现模块 3-活动模块*/
export const GetSitePopupList = (data) => {
// 站点管理-弹窗列表 1-首页 2-发现模块 3-活动模块
return Ajax({
url: "/siteInfo/popup/" + data,
data,
method: "get",
});
};
/**站点管理-轮播图*/
export const GetSiteCarousel = (data) => {
// 站点管理-轮播图
return Ajax({
url: "/siteInfo/carousel",
data,
method: "get",
});
};
/**站点管理-轮播图-添加标签 传值是id*/
export const GetSiteAddTag = (data) => {
// 站点管理-轮播图-添加标签 传值是id
return Ajax({
url: "/siteInfo/addTag/" + data,
data,
method: "get",
});
};
// 仪器管理
/**获取蓝牙指引权限引导*/
export const GetBluetoothGuidance = () => {
return Ajax({
url: "/setting/getBluetoothGuidance",
method: "get",
});
};
/**获取蓝牙定位权限引导*/
export const GetLocationGuidance = () => {
return Ajax({
url: "/setting/getLocationGuidance",
method: "get",
});
};
/**仪器管理*/
export const InstrumentInfo = {
/**根据序列号获取仪器信息 serial 序列号*/
getInstrumentInfoBySerial: (data) => {
@ -261,7 +259,6 @@ export const InstrumentInfo = {
exchangeBinding: (data) => {
return Ajax({
url: "/instrument/exchangeBinding" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
@ -269,7 +266,6 @@ export const InstrumentInfo = {
bindingInstrumentList: () => {
return Ajax({
url: "/instrument/bindingInstrumentList",
data,
method: "get",
});
},
@ -278,7 +274,6 @@ export const InstrumentInfo = {
unbindingInstrumentInfoList: () => {
return Ajax({
url: "/instrument/unbindingInstrumentInfoList",
data,
method: "get",
});
},
@ -346,12 +341,22 @@ export const InstrumentInfo = {
},
/**打卡相关*/
clock: {
apiClock: {
/**单文件上传*/
clockFileUpload: (formData) => {
return AjaxUploadFile(
{
url: "/clock/upload",
filePath: formData.clockImg,
name: "clockImg",
},
formData
);
},
/**添加用户使用仪器记录 instrumentId*/
addClockInstrument: (data) => {
return Ajax({
url: "/clock/addClockInstrument" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
@ -367,7 +372,6 @@ export const InstrumentInfo = {
getLatestClockRecord: (data) => {
return Ajax({
url: "/clock/latestClockRecord",
data,
method: "get",
});
},
@ -375,7 +379,6 @@ export const InstrumentInfo = {
getList: (data) => {
return Ajax({
url: "/clock/list" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
@ -383,13 +386,12 @@ export const InstrumentInfo = {
getClockStatistics: (data) => {
return Ajax({
url: "/clock/clockStatistics",
data,
method: "get",
});
},
},
/**护理相关*/
nursingLog: {
apiNursingLog: {
/**新增用户护理日志*/
addLog: (data) => {
return Ajax({
@ -402,7 +404,6 @@ export const InstrumentInfo = {
getRecord: (data) => {
return Ajax({
url: "/nursingLog/record" + paramsToUrlQueryString(data),
data,
method: "get",
});
},
@ -410,7 +411,6 @@ export const InstrumentInfo = {
getStatistics: (data) => {
return Ajax({
url: "/nursingLog/statistics" + paramsToUrlQueryString(data),
data,
method: "get",
});
},

@ -1,12 +1,16 @@
import Taro from "@tarojs/taro";
import store from "../store";
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 +20,7 @@ export const getSystemInfo = () => {
export const openBluetoothAdapter = () => {
return new Promise((reslove, reject) => {
wx.openBluetoothAdapter({
Taro.openBluetoothAdapter({
success(res) {
reslove(res);
},
@ -29,7 +33,7 @@ export const openBluetoothAdapter = () => {
export const startBluetoothDevicesDiscovery = () => {
return new Promise((reslove, reject) => {
wx.startBluetoothDevicesDiscovery({
Taro.startBluetoothDevicesDiscovery({
//开始搜索蓝牙
allowDuplicatesKey: false,
success(res) {
@ -44,7 +48,7 @@ export const startBluetoothDevicesDiscovery = () => {
export const createBLEConnection = (deviceId) => {
return new Promise((reslove, reject) => {
wx.createBLEConnection({
Taro.createBLEConnection({
deviceId,
success(res) {
reslove(res);
@ -58,7 +62,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 +78,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 +113,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 +130,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 +156,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