|
|
|
|
@ -0,0 +1,347 @@
|
|
|
|
|
import Taro from "@tarojs/taro";
|
|
|
|
|
import classnames from "classnames";
|
|
|
|
|
import { Block, View, ScrollView, Image } from "@tarojs/components";
|
|
|
|
|
import { useState, useEffect } from "react";
|
|
|
|
|
import "./FR200.less";
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
ModeID: any;
|
|
|
|
|
activeModeID: any;
|
|
|
|
|
ModeList: any;
|
|
|
|
|
ModeType: string; // all visor cabin yimeish
|
|
|
|
|
isShowNurse: boolean; // 是否已进入护理详情页
|
|
|
|
|
isPop: boolean; // 是否弹窗
|
|
|
|
|
onEmit: Function; // 每次点击item,回调事件和数据给父组件
|
|
|
|
|
onEmitShowAll: Function; // 打开弹窗按钮
|
|
|
|
|
}
|
|
|
|
|
function Index({
|
|
|
|
|
isShowNurse,
|
|
|
|
|
isPop,
|
|
|
|
|
ModeList,
|
|
|
|
|
ModeType,
|
|
|
|
|
ModeID,
|
|
|
|
|
activeModeID,
|
|
|
|
|
onEmit,
|
|
|
|
|
onEmitShowAll,
|
|
|
|
|
}: Props) {
|
|
|
|
|
let BaseList = ModeList.filter((item) => item.modeClass === 1); // 基础护理
|
|
|
|
|
let ZoneList = ModeList.filter((item) => item.modeClass === 2); // 专区护理
|
|
|
|
|
let PermeationList = ModeList.filter((item) => item.modeClass === 3); // 专研促渗
|
|
|
|
|
let SensitiveList = ModeList.filter((item) => item.modeClass === 4); // 敏感期护理
|
|
|
|
|
let IntelligenceList = ModeList.filter((item) => item.modeClass === 5); // 智能测肤
|
|
|
|
|
|
|
|
|
|
const onItemClick = (item) => {
|
|
|
|
|
onEmit(item);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const showAll = () => {
|
|
|
|
|
onEmitShowAll();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Block>
|
|
|
|
|
<View className="mode-list-main">
|
|
|
|
|
{!isPop && ModeList.length > 0 && isShowNurse && (
|
|
|
|
|
<View className="change-all-mode-btn" onClick={showAll}>
|
|
|
|
|
<View className="title">全部模式</View>
|
|
|
|
|
<Image
|
|
|
|
|
className="icon"
|
|
|
|
|
src={require("@/img/iot/mode-switch.png")}
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
|
)}
|
|
|
|
|
{BaseList.length > 0 &&
|
|
|
|
|
(ModeType === "all" || ModeType === "Base" || isPop) && (
|
|
|
|
|
<ScrollView
|
|
|
|
|
className="mode-list-box"
|
|
|
|
|
scroll-x="true"
|
|
|
|
|
scrollIntoView={ModeID} // itemID自动滚动到该元素位置
|
|
|
|
|
>
|
|
|
|
|
<View className="mode-list">
|
|
|
|
|
<View className="mode-item-title">基础护理</View>
|
|
|
|
|
{BaseList.map((item: any, index: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<View
|
|
|
|
|
key={"Base_" + index}
|
|
|
|
|
id={"Base_" + item.id}
|
|
|
|
|
className={classnames("mode-item", {
|
|
|
|
|
"mode-item-active": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
onClick={onItemClick.bind(this, item)}
|
|
|
|
|
>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("new", {
|
|
|
|
|
"is-new": item.isNew === 1,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
NEW
|
|
|
|
|
</View>
|
|
|
|
|
<View className="mode-info">
|
|
|
|
|
<View className="mode-info-title">{item.modeName}</View>
|
|
|
|
|
<View className="mode-info-time">
|
|
|
|
|
{item.modeTimeStr}
|
|
|
|
|
</View>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("mode-info-select", {
|
|
|
|
|
"is-select": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-info-select-point"></View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-pic">
|
|
|
|
|
<Image
|
|
|
|
|
src={item.modeBanner}
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
style="animation-iteration-count:1;"
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
<View style="width:120rpx;min-width:120rpx;height:40rpx;display:flex"></View>
|
|
|
|
|
</View>
|
|
|
|
|
</ScrollView>
|
|
|
|
|
)}
|
|
|
|
|
{ZoneList.length > 0 &&
|
|
|
|
|
(ModeType === "all" || ModeType === "Zone" || isPop) && (
|
|
|
|
|
<ScrollView
|
|
|
|
|
className="mode-list-box"
|
|
|
|
|
scrollX={true}
|
|
|
|
|
scrollIntoView={ModeID}
|
|
|
|
|
>
|
|
|
|
|
<View className="mode-list">
|
|
|
|
|
<View className="mode-item-title">专区护理</View>
|
|
|
|
|
{ZoneList.map((item: any, index: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<View
|
|
|
|
|
key={"Zone_" + index}
|
|
|
|
|
id={"Zone_" + item.id}
|
|
|
|
|
onClick={onItemClick.bind(this, item)}
|
|
|
|
|
className={classnames("mode-item", {
|
|
|
|
|
"mode-item-active": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("new", {
|
|
|
|
|
"is-new": item.isNew === 1,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
NEW
|
|
|
|
|
</View>
|
|
|
|
|
<View className="mode-info">
|
|
|
|
|
<View className="mode-info-title">{item.modeName}</View>
|
|
|
|
|
<View className="mode-info-time">
|
|
|
|
|
{item.modeTimeStr}
|
|
|
|
|
</View>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("mode-info-select", {
|
|
|
|
|
"is-select": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-info-select-point"></View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-pic">
|
|
|
|
|
<Image
|
|
|
|
|
src={item.modeBanner}
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
style="animation-iteration-count:1;"
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</View>
|
|
|
|
|
</ScrollView>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{PermeationList.length > 0 &&
|
|
|
|
|
(ModeType === "all" || ModeType === "Permeation" || isPop) && (
|
|
|
|
|
<ScrollView
|
|
|
|
|
className="mode-list-box"
|
|
|
|
|
scrollX={true}
|
|
|
|
|
scrollIntoView={ModeID}
|
|
|
|
|
>
|
|
|
|
|
<View className="mode-list">
|
|
|
|
|
<View className="mode-item-title">专研促渗</View>
|
|
|
|
|
{PermeationList.map((item: any, index: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<View
|
|
|
|
|
key={"Permeation_" + index}
|
|
|
|
|
id={"Permeation_" + item.id}
|
|
|
|
|
onClick={onItemClick.bind(this, item)}
|
|
|
|
|
className={classnames("mode-item", {
|
|
|
|
|
"mode-item-active": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("new", {
|
|
|
|
|
"is-new": item.isNew === 1,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
NEW
|
|
|
|
|
</View>
|
|
|
|
|
<View className="mode-info">
|
|
|
|
|
<View className="mode-info-title">{item.modeName}</View>
|
|
|
|
|
<View className="mode-info-time">
|
|
|
|
|
{item.modeTimeStr}
|
|
|
|
|
</View>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("mode-info-select", {
|
|
|
|
|
"is-select": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-info-select-point"></View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-pic">
|
|
|
|
|
<Image
|
|
|
|
|
src={item.modeBanner}
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
style="animation-iteration-count:1;"
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</View>
|
|
|
|
|
</ScrollView>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{SensitiveList.length > 0 &&
|
|
|
|
|
(ModeType === "all" || ModeType === "Sensitive" || isPop) && (
|
|
|
|
|
<ScrollView
|
|
|
|
|
className="mode-list-box"
|
|
|
|
|
scrollX={true}
|
|
|
|
|
scrollIntoView={ModeID}
|
|
|
|
|
>
|
|
|
|
|
<View className="mode-list">
|
|
|
|
|
<View className="mode-item-title">敏期护理</View>
|
|
|
|
|
{PermeationList.map((item: any, index: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<View
|
|
|
|
|
key={"Sensitive_" + index}
|
|
|
|
|
id={"Sensitive_" + item.id}
|
|
|
|
|
onClick={onItemClick.bind(this, item)}
|
|
|
|
|
className={classnames("mode-item", {
|
|
|
|
|
"mode-item-active": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("new", {
|
|
|
|
|
"is-new": item.isNew === 1,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
NEW
|
|
|
|
|
</View>
|
|
|
|
|
<View className="mode-info">
|
|
|
|
|
<View className="mode-info-title">{item.modeName}</View>
|
|
|
|
|
<View className="mode-info-time">
|
|
|
|
|
{item.modeTimeStr}
|
|
|
|
|
</View>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("mode-info-select", {
|
|
|
|
|
"is-select": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-info-select-point"></View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-pic">
|
|
|
|
|
<Image
|
|
|
|
|
src={item.modeBanner}
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
style="animation-iteration-count:1;"
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</View>
|
|
|
|
|
</ScrollView>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{IntelligenceList.length > 0 &&
|
|
|
|
|
(ModeType === "all" || ModeType === "Intelligence" || isPop) && (
|
|
|
|
|
<ScrollView
|
|
|
|
|
className="mode-list-box"
|
|
|
|
|
scrollX={true}
|
|
|
|
|
scrollIntoView={ModeID}
|
|
|
|
|
>
|
|
|
|
|
<View className="mode-list">
|
|
|
|
|
<View className="mode-item-title">智能测肤</View>
|
|
|
|
|
{IntelligenceList.map((item: any, index: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<View
|
|
|
|
|
key={"Intelligence_" + index}
|
|
|
|
|
id={"Intelligence_" + item.id}
|
|
|
|
|
onClick={onItemClick.bind(this, item)}
|
|
|
|
|
className={classnames("mode-item", {
|
|
|
|
|
"mode-item-active": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("new", {
|
|
|
|
|
"is-new": item.isNew === 1,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
NEW
|
|
|
|
|
</View>
|
|
|
|
|
<View className="mode-info">
|
|
|
|
|
<View className="mode-info-title">{item.modeName}</View>
|
|
|
|
|
<View className="mode-info-time">
|
|
|
|
|
{item.modeTimeStr}
|
|
|
|
|
</View>
|
|
|
|
|
<View
|
|
|
|
|
className={classnames("mode-info-select", {
|
|
|
|
|
"is-select": activeModeID === item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-info-select-point"></View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
{activeModeID === item.id && (
|
|
|
|
|
<View className="mode-pic">
|
|
|
|
|
<Image
|
|
|
|
|
src={item.modeBanner}
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
style="animation-iteration-count:1;"
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</View>
|
|
|
|
|
</ScrollView>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
</Block>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Index;
|