|
|
@@ -0,0 +1,121 @@
|
|
|
+import { View } from "@tarojs/components";
|
|
|
+import './log_publish.scss'
|
|
|
+import { rpxToPx } from "@/utils/tools";
|
|
|
+import { useState } from "react";
|
|
|
+import { useSelector } from "react-redux";
|
|
|
+import Taro from "@tarojs/taro";
|
|
|
+import { IconClose } from "@/components/basic/Icons";
|
|
|
+
|
|
|
+let useRoute;
|
|
|
+let useNavigation;
|
|
|
+let LinearGradient;
|
|
|
+if (process.env.TARO_ENV == 'rn') {
|
|
|
+ useRoute = require("@react-navigation/native").useRoute
|
|
|
+ useNavigation = require("@react-navigation/native").useNavigation
|
|
|
+ LinearGradient = require('react-native-linear-gradient').default
|
|
|
+}
|
|
|
+
|
|
|
+export default function LogPublish(props: { onClose: any }) {
|
|
|
+ const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
|
|
|
+ const navigationBarHeight = systemInfo.statusBarHeight + 44;
|
|
|
+ const screenHeight = systemInfo.screenHeight
|
|
|
+
|
|
|
+ const [showChoose, setShowChoose] = useState(false)
|
|
|
+ const record = useSelector((state: any) => state.record);
|
|
|
+
|
|
|
+ function getBackground() {
|
|
|
+ var time = record.time
|
|
|
+ if (!time) return '#fff'
|
|
|
+ const { background_colors } = time
|
|
|
+ if (!background_colors) {
|
|
|
+ return '#fff'
|
|
|
+ }
|
|
|
+ else if (background_colors.length == 1) {
|
|
|
+ return background_colors[0]
|
|
|
+ }
|
|
|
+ return `linear-gradient(to bottom, ${background_colors[0]}, ${background_colors[1]})`
|
|
|
+ }
|
|
|
+
|
|
|
+ function bgView() {
|
|
|
+ if (process.env.TARO_ENV == 'weapp') {
|
|
|
+ return <View className="main_bg" style={{ background: getBackground() }} />
|
|
|
+ }
|
|
|
+ var time = record.time
|
|
|
+ if (!time) return <View />
|
|
|
+ const { background_colors } = time
|
|
|
+ if (!background_colors) {
|
|
|
+ return <View />
|
|
|
+ }
|
|
|
+ else if (background_colors.length == 1) {
|
|
|
+ return <View />
|
|
|
+ }
|
|
|
+ return <LinearGradient style={{
|
|
|
+ position: 'absolute',
|
|
|
+ left: 0,
|
|
|
+ top: 0,
|
|
|
+
|
|
|
+ width: rpxToPx(750),
|
|
|
+ height: screenHeight,
|
|
|
+ zIndex: 0,
|
|
|
+ pointerEvents: 'none'
|
|
|
+ }}
|
|
|
+ colors={[background_colors[0], background_colors[1]]}
|
|
|
+ start={{ x: 0, y: 0 }}
|
|
|
+ end={{ x: 0, y: 1 }} pointerEvents="none" />
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return <View className="log_publish_bg" style={{ position: 'relative', overflow: showChoose ? 'hidden' : 'visible' }}>
|
|
|
+ {
|
|
|
+ bgView()
|
|
|
+ }
|
|
|
+ <View className="navi_bar" style={{ height: navigationBarHeight, zIndex: 1000 }}>
|
|
|
+ <View style={{
|
|
|
+ position: 'absolute',
|
|
|
+ left: 0,
|
|
|
+ right: 0,
|
|
|
+ bottom: 0,
|
|
|
+ height: 44,
|
|
|
+ display: 'flex',
|
|
|
+ alignItems: 'center',
|
|
|
+ justifyContent: 'center'
|
|
|
+ }}>
|
|
|
+ <View style={{
|
|
|
+ position: 'absolute',
|
|
|
+ width: rpxToPx(92),
|
|
|
+ height: rpxToPx(64),
|
|
|
+ left: 22,
|
|
|
+ top: 22 - rpxToPx(32)
|
|
|
+ }}
|
|
|
+ onClick={() => {
|
|
|
+ props.onClose()
|
|
|
+ // if (showResult) {
|
|
|
+ // process.env.TARO_ENV == 'weapp' ? Taro.navigateBack() : navigation.goBack()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if (chooseTitle.length > 0 && step == 0) {
|
|
|
+ // setStep(2)
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if (step == 2 && (desc.length > 0 || pics.length > 0)) {
|
|
|
+ // showAlert({
|
|
|
+ // title: t('health.back_no_save'),
|
|
|
+ // content: '',
|
|
|
+ // showCancel: true,
|
|
|
+ // cancelText: t('health.cancel'),
|
|
|
+ // confirmText: t('health.exit'),
|
|
|
+ // confirm: () => {
|
|
|
+ // process.env.TARO_ENV == 'weapp' ? Taro.navigateBack() : navigation.goBack()
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // process.env.TARO_ENV == 'weapp' ? Taro.navigateBack() : navigation.goBack()
|
|
|
+ }}>
|
|
|
+ <IconClose color={"#000"} width={rpxToPx(64)} height={rpxToPx(64)} />
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ <View style={{ height: navigationBarHeight }} />
|
|
|
+ </View>
|
|
|
+}
|