diff --git a/src/app.config.ts b/src/app.config.ts index 8f13668..f11f761 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -39,14 +39,14 @@ export default defineAppConfig({ { pagePath: "pages/activity/activity", text: "活动", - iconPath: "img/tabar/3.png", - selectedIconPath: "img/tabar/33.png", + iconPath: "img/tabar/2.png", + selectedIconPath: "img/tabar/22.png", }, { pagePath: "pages/detect/detect", text: "发现", - iconPath: "img/tabar/2.png", - selectedIconPath: "img/tabar/22.png", + iconPath: "img/tabar/3.png", + selectedIconPath: "img/tabar/33.png", }, { pagePath: "pages/shop/shop", diff --git a/src/app.less b/src/app.less index 1574c7d..4a2871c 100644 --- a/src/app.less +++ b/src/app.less @@ -2,6 +2,8 @@ // background: transparent !important; // } +@import url("./common/common.less"); + image { width: 100%; height: 100%; diff --git a/src/common/common.less b/src/common/common.less new file mode 100644 index 0000000..fca5810 --- /dev/null +++ b/src/common/common.less @@ -0,0 +1,21 @@ +button[type="primary"] { + background-color: #000; /* 设置按钮背景颜色为灰色 */ + color: #fff; /* 设置按钮文字颜色为白色 */ + border-color: #000; /* 设置按钮边框颜色为灰色 */ +} +button[disabled][type="primary"] { + background-color: #ccc !important; /* 设置按钮背景颜色为灰色 */ + color: #fff !important; /* 设置按钮文字颜色为白色 */ + border-color: #ccc !important; /* 设置按钮边框颜色为灰色 */ +} + +.btn { + background-color: #000; /* 设置按钮背景颜色为灰色 */ + color: #fff; /* 设置按钮文字颜色为白色 */ + border-color: #000; /* 设置按钮边框颜色为灰色 */ +} +.btn-disable { + background-color: #ccc !important; /* 设置按钮背景颜色为灰色 */ + color: #fff !important; /* 设置按钮文字颜色为白色 */ + border-color: #ccc !important; /* 设置按钮边框颜色为灰色 */ +} diff --git a/src/components/base/base.tsx b/src/components/base/base.tsx new file mode 100644 index 0000000..38548d9 --- /dev/null +++ b/src/components/base/base.tsx @@ -0,0 +1,54 @@ +import classnames from "classnames"; +import Taro from "@tarojs/taro"; +import { Component } from "react"; + +import { Block, View, Image, Text, Button, PageMeta } from "@tarojs/components"; + +export default class BaseComponent extends Component { + constructor(props) { + super(props); + this.state = { + name: "全局组件", + }; + } + + async onLoad() {} + componentDidMount() {} + + componentWillUnmount() {} + + componentDidShow() {} + + componentDidHide() {} + + async initData() {} + + showInit() { + const isFirst = Taro.getStorageSync("isWelcome"); + if (isFirst) { + this.checkShowPrivacyPopup(); + } + } + // 检测是否弹出隐私协议 + checkShowPrivacyPopup() { + Taro.getPrivacySetting({ + success: (res) => { + // console.log("检测是否弹出隐私协议", res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' } + if (res.needAuthorization) { + this.setState({ isShowPrivacyPopup: true }); + } else { + // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口 + this.initData(); + } + }, + fail: () => {}, + complete: () => { + // 授权完成运行页面初始化 + }, + }); + } + + render() { + return ; + } +} diff --git a/src/components/calendar/body/index.tsx b/src/components/calendar/body/index.tsx index 079b376..a533b1b 100644 --- a/src/components/calendar/body/index.tsx +++ b/src/components/calendar/body/index.tsx @@ -267,9 +267,10 @@ export default class AtCalendarBody extends React.Component { : clientX - this.swipeStartPoint > 0; }; - // 收起展开改变界面 + // 关键代码:收起展开改变界面 private onChangeFoldingCalendar = () => { let { isFolding, listGroup } = this.state; + let { complete, incomplete } = this.props; isFolding = !isFolding; if (isFolding) { let toDay = dayjs().format("YYYY-MM-DD"); @@ -284,12 +285,25 @@ export default class AtCalendarBody extends React.Component { let currentItemDay = dayjs(startWeekDay) .add(dayIndex, "day") .format("YYYY-MM-DD"); + + let isComplete = false; + let isInComplete = false; + if (complete.length) { + // 已完成日期 + isComplete = complete.includes(currentItemDay); + } + if (incomplete.length) { + // 未完成日期 + isInComplete = incomplete.includes(currentItemDay); + } return { isDisabled: false, isSelected: currentItemDay === selectedDay, isSelectedHead: currentItemDay === selectedDay, isSelectedTail: currentItemDay === selectedDay, isToday: toDay === currentItemDay, + isComplete: isComplete, + isInComplete: isInComplete, marks: [], text: Number(dayjs(currentItemDay).format("DD")), type: 0, @@ -298,7 +312,25 @@ export default class AtCalendarBody extends React.Component { }); this.setState({ temporaryCalendar }); } else { - let temporaryCalendar = listGroup[1].list; + let temporaryCalendar = listGroup[1].list.map((item: any) => { + let isComplete = false; + let isInComplete = false; + let toDay = dayjs().format("YYYY-MM-DD"); + if (complete.length) { + // 已完成日期 + isComplete = complete.includes(item.value); + } + if (incomplete.length) { + // 未完成日期 + isInComplete = incomplete.includes(item.value); + } + return { + ...item, + isComplete, + isInComplete, + isToday: toDay === item.value, + }; + }); this.setState({ temporaryCalendar }); } this.setState({ isFolding }); @@ -323,8 +355,9 @@ export default class AtCalendarBody extends React.Component { this.props.onDayClick(item); } - // 修改日历-重新渲染 + // 关键代码:修改日历-重新渲染 onSelectDataChange(value: any) { + let { complete, incomplete } = this.props; let { temporaryCalendar } = this.state; let newDateValue = dayjs(value).valueOf(); @@ -333,6 +366,26 @@ export default class AtCalendarBody extends React.Component { end: newDateValue, }); temporaryCalendar = JSON.parse(JSON.stringify(listGroup[1].list)); + temporaryCalendar = temporaryCalendar.map((item: any) => { + let isComplete = false; + let isInComplete = false; + let toDay = dayjs().format("YYYY-MM-DD"); + if (complete.length) { + // 已完成日期 + isComplete = complete.includes(item.value); + } + if (incomplete.length) { + // 未完成日期 + isInComplete = incomplete.includes(item.value); + } + return { + ...item, + isComplete, + isInComplete, + isToday: toDay === item.value, + }; + }); + this.setState({ listGroup, temporaryCalendar, isFolding: false }); let newValueItemIndex = temporaryCalendar.findIndex( diff --git a/src/components/calendar/body/isFolding.less b/src/components/calendar/body/isFolding.less index 3d7374e..77ffa8a 100644 --- a/src/components/calendar/body/isFolding.less +++ b/src/components/calendar/body/isFolding.less @@ -2,28 +2,97 @@ .at-calendar { // 仅缩放宽度,防止上下抖动 // transform: scale(0.9, 1); - width: 90%; + width: 92%; margin: 0 auto; color: #333; } .at-calendar__header .header__flex-item { - font-size: 26rpx; -} -.at-calendar__header .header__flex, -.at-calendar__list.flex .flex__item-container .container-text { - // color: #333; + // font-size: 26rpx; + width: 22rpx; + height: 19rpx; + font-size: 24rpx !important; + font-family: PingFang SC; + font-weight: 500; + color: #666666; } .at-calendar__list.flex .flex__item { - font-size: 26rpx; -} -.at-calendar__list.flex .flex__item--today { + font-size: 24rpx !important; color: #333; font-weight: 400; } -.at-calendar__list.flex + +.at-calendar__list.flex .flex__item--blur { + color: #ccc !important; +} + +.at-calendar__list.flex .flex__item--today { + color: #333 !important; + font-weight: 400 !important; + .flex__item-container { + position: relative; + background: linear-gradient(0deg, #fff0da, #ffe4c0); + border-radius: 50%; + } +} + +.at-calendar__list.flex .flex__item--complete { + color: #333 !important; + font-weight: 400 !important; + .flex__item-container { + position: relative; + &::before { + display: block; + content: ""; + border-radius: 50%; + border: 6rpx solid transparent; + background: linear-gradient(0deg, #fff0da, #ffe4c0) border-box; /* 2 */ + -webkit-mask: linear-gradient(#fff 0 0) padding-box, + linear-gradient(#fff 0 0); /* 3 */ + -webkit-mask-composite: xor; /* 4 */ + mask-composite: exclude; + position: absolute; + width: 72rpx; + height: 72rpx; + box-sizing: border-box; + } + } +} + +.at-calendar__list.flex .flex__item--incomplete { + color: #333 !important; + font-weight: 400 !important; + .flex__item-container { + position: relative; + &::before { + display: block; + content: ""; + border-radius: 50%; + border: 6rpx solid transparent; + background: #f2f2f2; + -webkit-mask: linear-gradient(#fff 0 0) padding-box, + linear-gradient(#fff 0 0); /* 3 */ + -webkit-mask-composite: xor; /* 4 */ + mask-composite: exclude; + position: absolute; + width: 72rpx; + height: 72rpx; + box-sizing: border-box; + } + } +} + +.at-calendar__list.flex .flex__item--selected .flex__item-container { + color: #333 !important; + background-color: #fff; + border: none; +} + +// 覆盖组件原本样式 +.at-calendar + .at-calendar__list.flex .flex__item--selected-head.flex__item--selected-tail .flex__item-container { - background: linear-gradient(0deg, #fff0da, #ffe4c0); + background-color: #fff; } .at-calendar__list.flex .flex__item-container { diff --git a/src/components/calendar/controller/index.tsx b/src/components/calendar/controller/index.tsx index 82b9a47..86494c0 100644 --- a/src/components/calendar/controller/index.tsx +++ b/src/components/calendar/controller/index.tsx @@ -2,7 +2,7 @@ import classnames from "classnames"; import Taro from "@tarojs/taro"; import dayjs, { Dayjs } from "dayjs"; import React from "react"; -import { Text, View, Block } from "@tarojs/components"; +import { Text, View, Block, Image } from "@tarojs/components"; import { DatetimePicker, Popup } from "@antmjs/vantui"; import _ from "lodash"; @@ -51,6 +51,13 @@ export default class AtCalendarController extends React.Component { console.log("confirm", e); } + openDate = () => { + this.setState({ + showDatePicker: true, + curDate: dayjs(this.props.currentDate).valueOf(), + }); + }; + public render(): JSX.Element { const { generateDate, @@ -98,17 +105,19 @@ export default class AtCalendarController extends React.Component { )} this.setState({ showDatePicker: true })} + onClick={this.openDate} > {/* */} {/* {dayjsDate.format(monthFormat)} */} {dayjsDate.format("YYYY.MM.DD")} - + + + diff --git a/src/components/calendar/img/calendar.png b/src/components/calendar/img/calendar.png new file mode 100644 index 0000000..ea5c435 Binary files /dev/null and b/src/components/calendar/img/calendar.png differ diff --git a/src/components/calendar/index.tsx b/src/components/calendar/index.tsx index fd8cebe..7862b8c 100644 --- a/src/components/calendar/index.tsx +++ b/src/components/calendar/index.tsx @@ -28,10 +28,7 @@ const defaultProps: AtCalendarDefaultProps = { monthFormat: "YYYY-MM-DD", }; -export default class AtCalendar extends React.Component< - AtCalendarProps, - Readonly -> { +export default class AtCalendar extends React.Component { static defaultProps: AtCalendarDefaultProps = defaultProps; public constructor(props: AtCalendarProps) { @@ -292,7 +289,9 @@ export default class AtCalendar extends React.Component< monthFormat, selectedDates, currentDate, - } = this.props as AtCalendarPropsWithDefaults; + complete, + incomplete, + } = this.props as any; return ( { return ( - {list.map((item: Calendar.Item) => ( + {list.map((item: any) => ( { `flex__item--${MAP[item.type]}`, { "flex__item--today": item.isToday, + "flex__item--complete": item.isComplete, + "flex__item--incomplete": item.isInComplete, "flex__item--active": item.isActive, "flex__item--selected": item.isSelected, "flex__item--selected-head": item.isSelectedHead, diff --git a/src/components/popup/popup-alert.less b/src/components/popup/popup-alert.less index f083123..ba5c75a 100644 --- a/src/components/popup/popup-alert.less +++ b/src/components/popup/popup-alert.less @@ -24,13 +24,13 @@ margin-top: 76rpx; justify-content: center; .alert-popup-btn { - width: 480rpx; - height: 80rpx; - line-height: 80rpx; - font-size: 30rpx; + width: 270rpx; + height: 90rpx; + line-height: 90rpx; + font-size: 32rpx; text-align: center; border: 1rpx solid #000; - border-radius: 40rpx; + border-radius: 45rpx; color: #fff; background-color: #000; } diff --git a/src/components/popup/popup-alert.tsx b/src/components/popup/popup-alert.tsx index 77664dd..53642ac 100644 --- a/src/components/popup/popup-alert.tsx +++ b/src/components/popup/popup-alert.tsx @@ -85,21 +85,17 @@ export default class PopupAlert extends Component { overlayStyle="width: 100vw;padding: 0;" onClick={this.onClickStop} > - - {/* {isClose && ( + > */} + {isClose && ( - )} */} - + )} + {title} { + constructor(props) { + super(props); + this.state = { + name: "确认组件", + // isShowconfirmPopup: true, + }; + } + + async onLoad() {} + componentDidMount() {} + + componentWillUnmount() {} + + componentDidShow() { + // 是否已授权隐私 + // if (Taro.getStorageSync("isconfirmPopup") !== "true") { + // // this.setState({ + // // showconfirmPopup: true, + // // }); + // this.props.closeconfirm(); + // } + } + + componentDidHide() {} + + async initData() {} + + onClose = () => { + this.props.close(); + }; + onConfirm = () => { + this.props.confirm(); + }; + + onConfirm2 = () => { + this.props.confirm(); + }; + + onClickStop = (e) => { + e.stopPropagation(); + }; + + render() { + let { + title, + content, + cancelButtonText, + confirmButtonText, + isShow, + isClose, + // isLarge, + type = 0, + } = this.props; + console.log("type", type); + return ( + + + {type === 1 && ( + + // 仪器:小紫弹内测版 + // 序列号:xxxxx + // 请问是否确认绑定该仪器? + // + // } + content={content} + confirmButtonText="确定" + cancelButtonText="暂不绑定" + onClose={this.onClose.bind(this)} + onConfirm={this.onConfirm.bind(this)} + > + )} + {type === 2 && ( + + )} + + {/* + {isClose && ( + + )} + + + {type === 1 && ( + + {title} + + + {content} + + + + + + + + )} + + {type === 2 && ( + + {title} + + + {content} + + + + + + + )} + + */} + + ); + } +} diff --git a/src/components/popup/popup-confirm.less b/src/components/popup/popup-confirm.less index 0223670..493bd24 100644 --- a/src/components/popup/popup-confirm.less +++ b/src/components/popup/popup-confirm.less @@ -39,13 +39,15 @@ } .confirm-popup-btn { - width: 240rpx; - height: 80rpx; - line-height: 80rpx; - font-size: 30rpx; + width: 270rpx; + height: 90rpx; + line-height: 90rpx; + font-size: 32rpx; text-align: center; border: 1rpx solid #000; - border-radius: 40rpx; + border-radius: 45rpx; + color: #fff; + background-color: #000; } .confirm-popup-btn:first-child { diff --git a/src/components/popup/popup-confirm.tsx b/src/components/popup/popup-confirm.tsx index cf8ab7b..77a74f4 100644 --- a/src/components/popup/popup-confirm.tsx +++ b/src/components/popup/popup-confirm.tsx @@ -91,11 +91,7 @@ export default class PopupConfirm extends Component { > )} - + {title} { > )} {title} diff --git a/src/components/popup/popup-privacy-test.tsx b/src/components/popup/popup-privacy-test.tsx new file mode 100644 index 0000000..0cfbef2 --- /dev/null +++ b/src/components/popup/popup-privacy-test.tsx @@ -0,0 +1,161 @@ +import classnames from "classnames"; +import { Component } from "react"; +import Taro from "@tarojs/taro"; + +import { Block, View, Button, PageMeta } from "@tarojs/components"; + +import { Popup } from "@antmjs/vantui"; + +import "./popup.less"; + +import { go } from "../../utils/traoAPI"; + +/*** props + * isLarge 是否大尺寸 + * isShow 是否显示 + * isClose 是否显示关闭按钮 + * @closePrivacy 关闭回调 + * ***/ + +export default class PopupPrivacyTest extends Component { + constructor(props) { + super(props); + this.state = { + name: "隐私组件", + isShowPrivacyPopup: true, + isShow: false, + isLarge: false, + isClose: false, + }; + } + + componentWillMount() { + console.log("componentWillMount"); + this.showInit(); + } + componentDidMount() { + console.log("componentDidMount"); + } + + async initData() {} + + showInit() { + const isFirst = Taro.getStorageSync("isWelcome"); + if (isFirst) { + this.checkShowPrivacyPopup(); + } + } + // 检测是否弹出隐私协议 + checkShowPrivacyPopup() { + Taro.getPrivacySetting({ + success: (res) => { + // console.log("检测是否弹出隐私协议", res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' } + if (res.needAuthorization) { + this.setState({ isShow: true }); + } else { + // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口 + this.props.initData(); + } + }, + fail: () => {}, + complete: () => { + // 授权完成运行页面初始化 + }, + }); + } + + onClose = () => { + this.props.closePrivacy(); + }; + onPrivacyTap = () => { + // 跳转用户隐私协议 + go("/pages/privacyPolicy/privacyPolicy"); + }; + onDisagreeTap = () => { + // 关闭小程序 + Taro.exitMiniProgram({ + success: (res) => { + console.log("exitMiniProgram", res); + }, + fail: (err) => { + console.log("exitMiniProgram err", err); + }, + complete: (res) => { + console.log("exitMiniProgram complete", res); + this.onClose(); + }, + }); + }; + handleAgreePrivacyAuthorization = (event) => { + // Taro.setStorageSync("isPrivacyPopup", "true"); + this.setState({ isShow: false }); + this.props.closePrivacy(); // 通知父组件关闭 + }; + + onClickStop = (e) => { + e.stopPropagation(); + }; + + render() { + let { isShow, isClose, isLarge } = this.state; + return ( + + + + {isClose && ( + + )} + + + 用户隐私保护提示 + + + 感谢您使用花至FLOSSOM小程序,您使用小程序前应当阅读并同意 + + + 《用户隐私协议》 + + + 当您点击同意并开始使用小程序服务时,即表示您已理解并同意该条款内容,该条款内容将您产生法律约束力。如您拒绝,将无法使用小程序服务 + + + + + + + + + + ); + } +} diff --git a/src/components/popup/popup-privacy.tsx b/src/components/popup/popup-privacy.tsx index 0795904..fdd41d6 100644 --- a/src/components/popup/popup-privacy.tsx +++ b/src/components/popup/popup-privacy.tsx @@ -26,17 +26,40 @@ export default class PopupPrivacy extends Component { }; } - async onLoad() {} - componentDidMount() {} - - componentWillUnmount() {} - - componentDidShow() {} - - componentDidHide() {} + componentWillMount() { + console.log("componentWillMount"); + } + componentDidMount() { + console.log("componentDidMount"); + } async initData() {} + // showInit() { + // const isFirst = Taro.getStorageSync("isWelcome"); + // if (isFirst) { + // this.checkShowPrivacyPopup(); + // } + // } + // // 检测是否弹出隐私协议 + // checkShowPrivacyPopup() { + // Taro.getPrivacySetting({ + // success: (res) => { + // // console.log("检测是否弹出隐私协议", res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' } + // if (res.needAuthorization) { + // this.setState({ isShowPrivacyPopup: true }); + // } else { + // // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口 + // this.initData(); + // } + // }, + // fail: () => {}, + // complete: () => { + // // 授权完成运行页面初始化 + // }, + // }); + // } + onClose = () => { this.props.closePrivacy(); }; @@ -88,11 +111,7 @@ export default class PopupPrivacy extends Component { > )} - + 用户隐私保护提示 diff --git a/src/components/popup/popup-site-swiper.tsx b/src/components/popup/popup-site-swiper.tsx index fe63033..c5e6a3e 100644 --- a/src/components/popup/popup-site-swiper.tsx +++ b/src/components/popup/popup-site-swiper.tsx @@ -19,7 +19,7 @@ import "./popup.less"; import "./popup-site-swiper.less"; import "./fade.css"; -import { go } from "../../utils/traoAPI"; +import { go, goJump } from "../../utils/traoAPI"; /*** props * isLarge 是否大尺寸 @@ -89,86 +89,7 @@ export default class PopupSiteSwiper extends Component { this.setState({ current }); } onClickSwiperItem(item) { - // 跳转类型:0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间', - /** - * `link` : '跳转链接(跳转外部链接、跳转内部链接)', - `link_params` : '跳转链接参数(跳转内部链接)', - `redirect_appid` : '外链小程序appid(跳转小程序)', - `redirect_url` : '外链小程序url(跳转小程序)', - `video_no` : '视频号(导向视频号、导向视频号直播间)', - `feed_id` : '视频号feedId(导向视频号)', - */ - let { type } = item; - if (type === 0) { - return; - } - switch (type) { - case 1: // 跳转内部链接 - if (item.linkParams) { - Taro.reLaunch({ - url: item.link + "?" + item.linkParams, - }); - } else { - Taro.reLaunch({ - url: item.link, - }); - } - break; - case 3: // 跳转外部链接 - if (item.linkParams) { - Taro.navigateTo({ - url: - "/pages/webViewPage/webViewPage?url=" + - item.link + - "?" + - item.linkParams, - }); - } else { - Taro.navigateTo({ - url: "/pages/webViewPage/webViewPage?url=" + item.link, - }); - } - break; - case 4: // 跳转小程序 - Taro.navigateToMiniProgram({ - appId: item.redirectAppid, - path: item.redirectUrl, - success: (res) => { - // 打开成功 - console.log("跳转小程序success", res); - }, - fail: (res) => { - console.log("跳转小程序fail", res); - }, - }); - break; - case 5: // 跳转视频号 - Taro.openChannelsActivity({ - finderUserName: item.videoNo, - feedId: item.feedId, - success: (res) => { - // 打开成功 - console.log("跳转视频号success", res); - }, - fail: (res) => { - console.log("跳转视频号fail", res); - }, - }); - break; - case 6: // 跳转视频号直播间 - Taro.openChannelsLive({ - finderUserName: item.videoNo, - feedId: item.feedId, - success: (res) => { - // 打开成功 - console.log("视频号直播间success", res); - }, - fail: (res) => { - console.log("视频号直播间fail", res); - }, - }); - break; - } + goJump(item); } onFinish(event) { const { current } = event.detail; diff --git a/src/components/popup/popup.less b/src/components/popup/popup.less index 21b3e92..e0b7307 100644 --- a/src/components/popup/popup.less +++ b/src/components/popup/popup.less @@ -3,7 +3,7 @@ @import "@antmjs/vantui/lib/overlay/index.less"; .large { - width: 670rpx; + width: 640rpx; } .middle { width: 580rpx; @@ -48,25 +48,37 @@ } .common-popup-btn { + width: 270rpx; + height: 90rpx; + line-height: 90rpx; + font-size: 32rpx; + text-align: center; + border: 1rpx solid #000; + border-radius: 45rpx; + color: #fff; + background-color: #000; +} + +.common-popup-btn-large { width: 480rpx; - height: 80rpx; - line-height: 80rpx; - font-size: 30rpx; + height: 90rpx; + line-height: 90rpx; + font-size: 32rpx; text-align: center; border: 1rpx solid #000; - border-radius: 40rpx; + border-radius: 45rpx; color: #fff; background-color: #000; } .common-popup-btn2 { - width: 240rpx; - height: 80rpx; - line-height: 80rpx; - font-size: 30rpx; + width: 270rpx; + height: 90rpx; + line-height: 90rpx; + font-size: 32rpx; text-align: center; border: 1rpx solid #000; - border-radius: 40rpx; + border-radius: 45rpx; } .common-popup-btn2:first-child { diff --git a/src/custom-tab-bar/index.tsx b/src/custom-tab-bar/index.tsx index 2c49281..d326ad4 100644 --- a/src/custom-tab-bar/index.tsx +++ b/src/custom-tab-bar/index.tsx @@ -30,14 +30,14 @@ export default class Index extends Component { { pagePath: "pages/activity/activity", text: "活动", - iconPath: "/img/tabar/3.png", - selectedIconPath: "/img/tabar/33.png", + iconPath: "/img/tabar/2.png", + selectedIconPath: "/img/tabar/22.png", }, { pagePath: "pages/detect/detect", text: "发现", - iconPath: "/img/tabar/2.png", - selectedIconPath: "/img/tabar/22.png", + iconPath: "/img/tabar/3.png", + selectedIconPath: "/img/tabar/33.png", }, { pagePath: "pages/shop/shop", diff --git a/src/img/qrcode-test.jpg b/src/img/qrcode-test.jpg new file mode 100644 index 0000000..7d3741d Binary files /dev/null and b/src/img/qrcode-test.jpg differ diff --git a/src/pages/entry/entry.less b/src/pages/entry/entry.less index de463f9..4a249e7 100644 --- a/src/pages/entry/entry.less +++ b/src/pages/entry/entry.less @@ -1,10 +1,14 @@ .main { - position: fixed; - top: 0; width: 100%; - height: 100%; } +// /* 当设备屏幕宽度小于等于750px时应用该样式 */ +// @media screen and (max-height: 736rpx) { +// .absolutely { +// height: 120vh !important; +// } +// } + .absolutely { width: 100%; height: 100%; @@ -82,58 +86,57 @@ } .body .bottom-card { + position: relative; display: inline-table; width: 660rpx; - height: 410rpx; + height: 470rpx; background: linear-gradient(0deg, #f8f8f8 0%, #efefef 100%); border-radius: 50rpx; -} - -.bottom-card .text { - height: 45rpx; - font-size: 48rpx; - font-weight: 500; - color: #000; - line-height: 60rpx; - // margin-top: 80rpx; - margin-top: 70rpx; - margin-bottom: 48rpx; -} -.bottom-card .txt { - height: 27rpx; - font-size: 26rpx; - font-weight: 500; - color: #666; -} - -.footer { - position: absolute; - left: 0; - right: 0; - bottom: 30rpx; - flex-direction: column; - // padding-bottom: calc(44rpx + env(safe-area-inset-bottom)); -} - -.main .indicator { - display: inline-flex; - - width: 360rpx; - height: 4rpx; - background: #dfdfdf; - margin-top: 16rpx; - .dot { - display: inline-flex; - flex: 1; - height: 100%; - background: #fff; - transition-duration: 0.5s; - margin-right: 4rpx; + .text { + height: 45rpx; + font-size: 48rpx; + font-weight: 500; + color: #000; + line-height: 60rpx; + margin-top: 80rpx; + // margin-top: 70rpx; + margin-bottom: 48rpx; } - - .bg-show { - background: #666; + .txt { + font-size: 26rpx; + font-weight: 500; + color: #666; + // margin-bottom: 40rpx; + margin-bottom: 59rpx; + } + .footer { + // position: absolute; + // left: 0; + // right: 0; + // bottom: 20rpx; + flex-direction: column; + // padding-bottom: calc(44rpx + env(safe-area-inset-bottom)); + .indicator { + display: inline-flex; + + width: 360rpx; + height: 4rpx; + background: #dfdfdf; + margin-top: 74rpx; + .dot { + display: inline-flex; + flex: 1; + height: 100%; + background: #fff; + transition-duration: 0.5s; + margin-right: 4rpx; + } + + .bg-show { + background: #666; + } + } } } diff --git a/src/pages/entry/entry.tsx b/src/pages/entry/entry.tsx index 3c004e9..ebd51b3 100644 --- a/src/pages/entry/entry.tsx +++ b/src/pages/entry/entry.tsx @@ -13,6 +13,8 @@ import { SwiperItem, } from "@tarojs/components"; +import Navbar from "../../components/navbar/navbar"; + import "taro-ui/dist/style/components/button.scss"; // 按需引入 import "./entry.less"; import "./Animista.less"; @@ -31,24 +33,12 @@ export default class Entry extends Component { current: 0, toRight: false, isClick: false, - welcomeList: [ - { - title: "花至小程序", - desc: "三步了解花至小程序,这里写文案1", - image: "", - }, - { - title: "花至小程序", - desc: "三步了解花至小程序,这里写文案2", - image: "", - }, - ], + welcomeList: [], }; } async onLoad() { - const menu = Taro.getMenuButtonBoundingClientRect(); - this.setState({ menu }); + this.setStatusBar(); this.intData(); } @@ -60,6 +50,29 @@ export default class Entry extends Component { componentDidHide() {} + setStatusBar() { + // const menu = Taro.getMenuButtonBoundingClientRect(); + // this.setState({ menu }); + Taro.getSystemInfoAsync({ + success: (res) => { + const statusBarHeight = res.statusBarHeight || 0; + // 获取微信胶囊的位置信息 width,height,top,right,left,bottom + const custom = Taro.getMenuButtonBoundingClientRect(); + // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2 + const navigationBarHeight = + custom.height + (custom.top - statusBarHeight) * 2; + // 总体高度 = 状态栏高度 + 导航栏高度 + const navHeight = navigationBarHeight + statusBarHeight; + + this.setState({ + statusBarHeight, + navigationBarHeight, + navHeight, + }); + }, + }); + } + async intData() { let MpSplashDetail_type1 = Taro.getStorageSync("MpSplashDetail_type1") || undefined; @@ -120,30 +133,35 @@ export default class Entry extends Component { } render() { - let { menu, current, welcomeList } = this.state; + let { menu, current, welcomeList, navHeight } = this.state; + const navHeightRpx = navHeight * 2; + return ( - - + + {/* - + */} {welcomeList.map((item, index) => { return ( @@ -165,13 +183,33 @@ export default class Entry extends Component { {item.title} {item.desc} + + + 前往主页 + + + {welcomeList.map((item, index) => { + return ( + = index, + })} + > + ); + })} + + ); })} - + {/* 前往主页 @@ -186,14 +224,8 @@ export default class Entry extends Component { > ); })} - {/* */} - + */} ); diff --git a/src/pages/index/index.less b/src/pages/index/index.less index b9d2c7c..2fabf46 100644 --- a/src/pages/index/index.less +++ b/src/pages/index/index.less @@ -994,12 +994,13 @@ page { .date-title { position: absolute; right: 0; - width: 200rpx; + width: 140rpx; display: flex; align-items: center; height: 40rpx; - .at-icon { - margin-top: 6rpx; + .text { + color: #666; + font-size: 26rpx; } } } diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 741f641..4761264 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -14,13 +14,14 @@ import { /*** redux ***/ import { connect } from "react-redux"; import { userRefresh } from "../../store/features/userInfo"; -import { otherSettingRefresh } from "../../store/features/otherSetting"; 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 PopupPrivacyTest from "../../components/popup/popup-privacy-test"; import PopupSiteSwiper from "../../components/popup/popup-site-swiper"; import PopupAlert from "../../components/popup/popup-alert"; @@ -39,7 +40,7 @@ import { // css引入 import "taro-ui/rn/style/components/calendar.scss"; import "./index.less"; -import { go, msg } from "../../utils/traoAPI"; +import { go, goJump, msg } from "../../utils/traoAPI"; // PropsWithChildren class Index extends Component { @@ -48,7 +49,6 @@ class Index extends Component { constructor(props) { super(props); this.state = { - isShowIndexFlag: this.props.isShowIndexFlag, isShowPrivacyPopup: false, isShowSiteSwiper: false, isNotRegister: false, // 是否未注册 @@ -60,11 +60,6 @@ class Index extends Component { }, connectInstrument: {}, yiqiinfo: {}, - titleHeight: "", - menu: { - top: 44, - height: 0, - }, list: [], params: "", messageCount: Taro.getStorageSync("messageCount") || 0, @@ -73,7 +68,10 @@ class Index extends Component { versioninfo: {}, //仪器版本号, info: {}, // 护理推荐点击参与活动的信息 weekinfo: undefined, + // 日历 currentDate: dayjs().format("YYYY-MM-DD"), + calendarComplete: [dayjs().subtract(1, "day").format("YYYY-MM-DD")], + calendarInComplete: [dayjs().add(1, "day").format("YYYY-MM-DD")], // 横幅轮播 bannerList: [], bannerCurrent: 0, @@ -117,14 +115,6 @@ class Index extends Component { // console.log("检测是否弹出隐私协议", res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' } if (res.needAuthorization) { this.setState({ isShowPrivacyPopup: true }); - // Taro.setStorageSync("isPrivacy", "true"); - // 需要弹出隐私协议 - // const isPrivacyPopup = Taro.getStorageSync("isPrivacyPopup"); - // if (!isPrivacyPopup) { - // // 隐私确认弹窗 - // this.setState({ isShowPrivacyPopup: true }); - // Taro.setStorageSync("isPrivacy", "true"); - // } } else { // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口 this.initData(); @@ -139,17 +129,16 @@ class Index extends Component { // 页面初始化 initData() { const mobile = Taro.getStorageSync("mobile"); - this.GetSitePopupList(); this.GetSiteCarousel(); if (mobile) { this.GetNoReadMessageNum(); // 查询是否有消息 - // if (!this.state.isShowIndexFlag) { - // // 仅初次进入首页运行 - // this.GetSitePopupList(); - // this.props.setIndexFlag(true); - // } + if (!this.props.isShowIndexFlag) { + this.GetSitePopupList(); + // 全局内存缓存,仅初次进入首页运行 + this.props.setIndexFlag(true); + } } } @@ -290,83 +279,16 @@ class Index extends Component { `video_no` : '视频号(导向视频号、导向视频号直播间)', `feed_id` : '视频号feedId(导向视频号)', */ - let { type, id } = item; + let { id } = item; this.GetSiteAddTag(id); - if (type === 0) { - return; - } - switch (type) { - case 1: // 跳转内部链接 - if (item.linkParams) { - Taro.reLaunch({ - url: item.link + "?" + item.linkParams, - }); - } else { - Taro.reLaunch({ - url: item.link, - }); - } - break; - case 3: // 跳转外部链接 - if (item.linkParams) { - Taro.navigateTo({ - url: - "/pages/webViewPage/webViewPage?url=" + - item.link + - "?" + - item.linkParams, - }); - } else { - Taro.navigateTo({ - url: "/pages/webViewPage/webViewPage?url=" + item.link, - }); - } - break; - case 4: // 跳转小程序 - Taro.navigateToMiniProgram({ - appId: item.redirectAppid, - path: item.redirectUrl, - success: (res) => { - // 打开成功 - console.log("跳转小程序success", res); - }, - fail: (res) => { - console.log("跳转小程序fail", res); - }, - }); - break; - case 5: // 跳转视频号 - Taro.openChannelsActivity({ - finderUserName: item.videoNo, - feedId: item.feedId, - success: (res) => { - // 打开成功 - console.log("跳转视频号success", res); - }, - fail: (res) => { - console.log("跳转视频号fail", res); - }, - }); - break; - case 6: // 跳转视频号直播间 - Taro.openChannelsLive({ - finderUserName: item.videoNo, - feedId: item.feedId, - success: (res) => { - // 打开成功 - console.log("视频号直播间success", res); - }, - fail: (res) => { - console.log("视频号直播间fail", res); - }, - }); - break; - } + goJump(item); } render() { let { + calendarComplete, + calendarInComplete, currentDate, messagecount, sitePopupList, @@ -384,6 +306,7 @@ class Index extends Component { { closePrivacy={this.closePrivacy} /> + + + {/* */} + { > - 护理记录 + 护理记录 @@ -443,6 +373,8 @@ class Index extends Component { hideArrow={true} isSwiper={false} currentDate={currentDate} + complete={calendarComplete} + incomplete={calendarInComplete} maxDate={Date.now()} onTimeChange={this.onTimeChange} /> @@ -543,6 +475,7 @@ class Index extends Component { })} + ); } diff --git a/src/pages/initiate/initiate.tsx b/src/pages/initiate/initiate.tsx index 3446912..3c650d5 100644 --- a/src/pages/initiate/initiate.tsx +++ b/src/pages/initiate/initiate.tsx @@ -51,8 +51,6 @@ class Initiate extends Component { if (!Taro.getStorageSync("token")) { await this.WCUserLogin(); - Taro.setStorageSync("isWelcome", true); - await this.initData(); } else { go("/pages/entry/entry"); } @@ -78,6 +76,7 @@ class Initiate extends Component { let bgObj = data.rows.find((item: any) => item.fileSuffix === "video"); if (bgObj) { url = bgObj.filePath; + console.log("url", url); this.setState({ url }); } } else { @@ -86,7 +85,7 @@ class Initiate extends Component { }); } } else { - msg("获取首页视频失败!"); + // msg("获取首页视频失败!"); } } @@ -103,9 +102,14 @@ class Initiate extends Component { const { code } = await Taro.login(); const { data } = await WCUserLogin({ code }); if (data.code === 200) { + Taro.setStorageSync("isWelcome", true); Taro.setStorageSync("token", data.data.token); Taro.setStorageSync("mobile", data.data.mobile); this.props.userRefresh(data.data); + + this.initData(); + } else { + msg("登录失败!"); } } @@ -145,6 +149,7 @@ class Initiate extends Component { mode="widthFix" /> + { } confirmButtonText="我知道了" @@ -250,7 +371,7 @@ class IntegralList extends Component { - + { - - {list.length === 0 && ( + + {/* {list.length === 0 && ( { ); - })} + })} */} + + + + {list.length === 0 && ( + + + 暂无积分记录 + + )} + {list.map((item: any, key: number) => { + return ( + + + + {item.remarkContent} + {item.createTime} + + + {item.source === "1" + ? "+" + item.floatScore + : "-" + item.floatScore} + + + + ); + })} + + + + + + {list.length > 0 && list.length < total && ( + + {dargState === 0 ? ( + 上拉加载更多 + ) : ( + 加载中... + )} + + )} + + {list.length > 0 && list.length === total && ( + + 已到底部 + + )} ); } } -// export default IntegralList + const mapStateToProps = (state) => ({ userInfo: state.userInfo, otherSetting: state.otherSetting, diff --git a/src/pages/message/message.tsx b/src/pages/message/message.tsx index a51422c..a2af57e 100644 --- a/src/pages/message/message.tsx +++ b/src/pages/message/message.tsx @@ -19,6 +19,7 @@ import { Loading } from "@antmjs/vantui"; import "@antmjs/vantui/es/loading/index.css"; import { GetHasBeenRead, GetMessageList } from "../../utils/Interface"; +import { goJump } from "../../utils/traoAPI"; import "./message.less"; @@ -39,14 +40,14 @@ export default class Message extends Component { }; } - async onLoad() {} + async onLoad() { + this.initData(); // 每次进入清空所有消息 + } componentDidMount() {} componentWillUnmount() {} - componentDidShow() { - this.initData(); // 每次进入清空所有消息 - } + componentDidShow() {} componentDidHide() {} @@ -55,7 +56,11 @@ export default class Message extends Component { this.GetMessageList(); } - godetail = () => {}; + // 跳转 + godetail = (item) => { + console.log("godetail", item); + goJump(item); + }; // 获取消息分页 GetMessageList = async () => { @@ -199,7 +204,7 @@ export default class Message extends Component { return ( @@ -217,7 +222,7 @@ export default class Message extends Component { - [花至官方旗舰店]: {item.content ? item.content : ""} + [{item.titile}]: {item.content ? item.content : ""} diff --git a/src/pages/privacyPolicy/privacyPolicy.tsx b/src/pages/privacyPolicy/privacyPolicy.tsx index 9e9887a..bfa2489 100644 --- a/src/pages/privacyPolicy/privacyPolicy.tsx +++ b/src/pages/privacyPolicy/privacyPolicy.tsx @@ -31,7 +31,17 @@ export default class PrivacyPolicy extends Component { initData = async () => { let res = await getPrivacyAgreement(); if (res.data.code === 200) { - this.setState({ nodes: res.data.data.value }); + let nodes = decodeURIComponent(res.data.data.value || ""); + nodes = nodes.replace(/\ { onPopup = async (event) => { const { type } = event.target.dataset; console.log("onPopup", event, type); - // const request = - // type === "agreement" - // ? await getUserAgreement() - // : await getPrivacyAgreement(); - // const { data } = request; - // if (data.code === 200) { - // this.setState({ - // userAgreement: data.data.data?.user_agreement?.value - // ? formatRichText(data.data.data?.user_agreement?.value) - // : null, - // policy: data.data.data?.user_privacy_agreement?.value - // ? formatRichText(data.data.data?.user_privacy_agreement?.value) - // : null, - // isShow: true, - // }); - // } }; onPrivacyTap = () => { @@ -215,11 +200,10 @@ class Register extends Component {