小程序富文本支持表格

master
blak-kong 2 years ago
parent e593596af7
commit 584daf9d13

@ -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",

@ -2,6 +2,8 @@
// background: transparent !important;
// }
@import url("./common/common.less");
image {
width: 100%;
height: 100%;

@ -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; /* 设置按钮边框颜色为灰色 */
}

@ -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<any, any> {
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 <Block></Block>;
}
}

@ -267,9 +267,10 @@ export default class AtCalendarBody extends React.Component<any, any> {
: 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<any, any> {
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<any, any> {
});
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<any, any> {
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<any, any> {
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(

@ -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 {

@ -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<any, any> {
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<any, any> {
)}
<View
style="display: flex;align-items: center;"
onClick={() => this.setState({ showDatePicker: true })}
onClick={this.openDate}
>
{/* <Text className="controller__info"></Text> */}
{/* <Text>{dayjsDate.format(monthFormat)}</Text> */}
<Text style={{ fontSize: "38rpx", fontWeight: "400" }}>
{dayjsDate.format("YYYY.MM.DD")}
</Text>
<View
style="margin-left: 20rpx;color:#666;font-size: 34rpx"
className="at-icon at-icon-calendar"
></View>
<View style="margin-left: 34rpx;">
<Image
src={require("../img/calendar.png")}
style="width:34rpx;height:34rpx;"
/>
</View>
</View>
<View></View>
</View>

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

@ -28,10 +28,7 @@ const defaultProps: AtCalendarDefaultProps = {
monthFormat: "YYYY-MM-DD",
};
export default class AtCalendar extends React.Component<
AtCalendarProps,
Readonly<AtCalendarState>
> {
export default class AtCalendar extends React.Component<any, any> {
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 (
<View className={classnames("at-calendar", className)}>
<AtCalendarController
@ -318,6 +317,8 @@ export default class AtCalendar extends React.Component<
selectedDate={selectedDate}
selectedDates={selectedDates}
generateDate={generateDate}
complete={complete}
incomplete={incomplete}
onDayClick={this.handleDayClick}
onSwipeMonth={this.setMonth}
onLongClick={this.handleDayLongClick}

@ -37,7 +37,7 @@ export default class AtCalendarList extends React.Component<Props> {
return (
<View className="at-calendar__list flex">
{list.map((item: Calendar.Item) => (
{list.map((item: any) => (
<View
key={`list-item-${item.value}`}
onClick={this.handleClick.bind(this, item)}
@ -47,6 +47,8 @@ export default class AtCalendarList extends React.Component<Props> {
`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,

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

@ -85,21 +85,17 @@ export default class PopupAlert extends Component<any, any> {
overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop}
>
<View
{/* <View
className="at-icon at-icon-close common-close"
onClick={this.onClose}
></View>
{/* {isClose && (
></View> */}
{isClose && (
<View
className="at-icon at-icon-close common-close"
onClick={this.onClose}
></View>
)} */}
<View
className={classnames("common-box", {
large: isLarge,
})}
>
)}
<View className={classnames("common-box", "large")}>
<View className="common-popup-title">{title}</View>
<View className="common-popup-content-box">
<View

@ -0,0 +1,84 @@
.binding-box {
width: 650rpx;
// height: 800rpx;
padding: 40rpx;
padding-bottom: 80rpx;
box-sizing: border-box;
.binding-popup-title {
font-size: 36rpx;
font-weight: 700;
text-align: center;
color: #000;
}
}
.binding-popup-content-box {
margin-top: 60rpx;
}
.binding-popup-content {
font-size: 28rpx;
margin-bottom: 20rpx;
max-height: 600rpx;
overflow-y: auto;
}
.binding-popup-content.is-binding {
color: #41a9fc;
text-decoration: underline;
}
.binding-popup-content.is-last {
margin-bottom: 0;
}
.binding-popup-btns {
display: flex;
margin-top: 76rpx;
justify-content: space-around;
}
.binding-popup-btn {
width: 240rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 30rpx;
text-align: center;
border: 1rpx solid #000;
border-radius: 40rpx;
}
.binding-popup-btn:first-child {
margin-left: 22rpx;
background-color: transparent;
}
.binding-popup-btn:last-child {
color: #fff;
background-color: #000;
}
.pupup-close {
position: absolute;
right: 30rpx;
top: 30rpx;
color: #000;
font-size: 36rpx;
}
.binding-popup-footer {
display: flex;
margin-top: 76rpx;
justify-content: center;
.binding-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;
}
}

@ -0,0 +1,187 @@
import classnames from "classnames";
import { Component } from "react";
import { Block, View, Button, PageMeta } from "@tarojs/components";
// import { Popup } from "@antmjs/vantui";
import PopupConfirm from "./popup-confirm";
import PopupAlert from "./popup-alert";
import "./popup.less";
/*** props
* isLarge
* isShow
* isClose
* type 10 11 12 13 21
* title
* content
* cancelButtonText
* confirmButtonText
* textAlgin left right center
* @close
* @confirm
* ***/
export default class PopupBinding extends Component<any, any> {
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 (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
{type === 1 && (
<PopupConfirm
isShow={isShow}
isClose={false}
title="提示"
// content={
// <Block>
// <View>仪器:小紫弹内测版</View>
// <View>序列号xxxxx</View>
// <View>请问是否确认绑定该仪器?</View>
// </Block>
// }
content={content}
confirmButtonText="确定"
cancelButtonText="暂不绑定"
onClose={this.onClose.bind(this)}
onConfirm={this.onConfirm.bind(this)}
></PopupConfirm>
)}
{type === 2 && (
<PopupAlert
isShow={isShow}
title="提示"
// content="序列号库仍在更新,请联系微信助手"
content={content}
confirmButtonText="知道了"
textAlgin="center"
isClose={false}
onClose={this.onConfirm2.bind(this)}
onConfirm={this.onConfirm2.bind(this)}
></PopupAlert>
)}
{/* <Popup
show={isShow}
closeOnClickOverlay={false}
round
overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop}
>
{isClose && (
<View
className="at-icon at-icon-close binding-close"
onClick={this.onClose}
></View>
)}
<View className={classnames("binding-box", "large")}>
{type === 1 && (
<Block>
<View className="binding-popup-title">{title}</View>
<View className="binding-popup-content-box">
<View
className={classnames(
"binding-popup-content",
"text-center"
)}
>
{content}
</View>
</View>
<View className="binding-popup-btns">
<Button className="binding-popup-btn2" onClick={this.onClose}>
{cancelButtonText}
</Button>
<Button
className="binding-popup-btn2"
onClick={this.onConfirm}
>
{confirmButtonText}
</Button>
</View>
</Block>
)}
{type === 2 && (
<Block>
<View className="binding-popup-title">{title}</View>
<View className="binding-popup-content-box">
<View
className={classnames(
"binding-popup-content",
"text-center"
)}
>
{content}
</View>
</View>
<View className="binding-popup-footer">
<Button
className="binding-popup-btn"
onClick={this.onConfirm}
>
{confirmButtonText}
</Button>
</View>
</Block>
)}
</View>
</Popup> */}
</Block>
);
}
}

@ -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 {

@ -91,11 +91,7 @@ export default class PopupConfirm extends Component<any, any> {
></View>
)}
<View
className={classnames("common-box", {
large: isLarge,
})}
>
<View className={classnames("common-box", "large")}>
<View className="common-popup-title">{title}</View>
<View className="common-popup-content-box">
<View

@ -1,8 +1,20 @@
.common-box {
padding: 38rpx 0;
// padding-bottom: 40rpx;
padding-bottom: calc(env(safe-area-inset-bottom) + 40rpx);
box-sizing: border-box;
}
.common-popup-content-box {
margin-top: 42rpx;
}
.common-popup-btns {
margin-top: 38rpx;
}
.drawer-popup-btn {
width: 690rpx;
height: 90rpx;
line-height: 90rpx;
font-size: 30rpx;
font-size: 32rpx;
text-align: center;
border: 1rpx solid #000;
border-radius: 45rpx;

@ -79,9 +79,8 @@ export default class PopupDrawer extends Component<any, any> {
></View>
)}
<View
className={classnames("common-box", {
large: isLarge,
})}
className={classnames("common-box", "large")}
style="margin: auto;"
>
<View className="common-popup-title">{title}</View>
<View className="common-popup-content-box">

@ -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<any, any> {
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 (
<Block>
<PageMeta pageStyle={isShow ? "overflow: hidden;" : ""} />
<Popup
show={isShow}
closeOnClickOverlay={false}
round
overlayStyle="width: 100vw;padding: 0;"
onClick={this.onClickStop}
>
{isClose && (
<View
style="color:#fff;"
className="at-icon at-icon-close common-close"
onClick={this.onClose}
></View>
)}
<View
className={classnames("common-box", {
large: isLarge,
})}
>
<View className="common-popup-title"></View>
<View className="common-popup-content-box">
<View className="common-popup-content">
使FLOSSOM使
</View>
<View
className="common-popup-content is-common"
onClick={this.onPrivacyTap}
>
</View>
<View className="common-popup-content is-last">
使使
</View>
</View>
<View className="common-popup-btns">
<Button
className="common-popup-btn2"
onClick={this.onDisagreeTap}
>
退
</Button>
<Button
className="common-popup-btn2"
openType="agreePrivacyAuthorization"
onAgreePrivacyAuthorization={
this.handleAgreePrivacyAuthorization
}
>
</Button>
</View>
</View>
</Popup>
</Block>
);
}
}

@ -26,17 +26,40 @@ export default class PopupPrivacy extends Component<any, any> {
};
}
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<any, any> {
></View>
)}
<View
className={classnames("common-box", {
large: isLarge,
})}
>
<View className={classnames("common-box", "large")}>
<View className="common-popup-title"></View>
<View className="common-popup-content-box">
<View className="common-popup-content">

@ -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<any, any> {
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;

@ -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 {

@ -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",

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

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

@ -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<any, any> {
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<any, any> {
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<any, any> {
}
render() {
let { menu, current, welcomeList } = this.state;
let { menu, current, welcomeList, navHeight } = this.state;
const navHeightRpx = navHeight * 2;
return (
<Block>
<View className="main">
<View
<Navbar></Navbar>
<View
className="main"
style={{ height: `calc(100vh - ${navHeightRpx}rpx)` }}
>
{/* <View
className="logo"
style={"top:" + menu.top + "px; height:" + menu.height + "px"}
>
<Image src="https://oss.flossom.com/logo2.png" mode="widthFix" />
</View>
</View> */}
<Swiper
className="absolutely"
current={current}
onChange={this.onChange.bind(this)}
onAnimationFinish={this.onFinish.bind(this)}
duration={800}
indicatorDots={true}
indicatorDots={false}
indicatorColor="#999"
indicatorActiveColor="#333"
>
{welcomeList.map((item, index) => {
return (
<SwiperItem
className="absolutely"
onClick={this.onClickSwiperItem.bind(this)}
key={"swiper_" + index}
>
@ -165,13 +183,33 @@ export default class Entry extends Component<any, any> {
<View className="bottom-card">
<View className="text slide-left">{item.title}</View>
<View className="txt slide-left">{item.desc}</View>
<View className="footer flex aitems jcenter">
<View
className="btn"
onClick={this.toHomePage.bind(this)}
>
</View>
<View className="indicator">
{welcomeList.map((item, index) => {
return (
<View
key={"indicator_" + index}
className={classnames("dot", {
"bg-show": current >= index,
})}
></View>
);
})}
</View>
</View>
</View>
</View>
</SwiperItem>
);
})}
</Swiper>
<View className="footer flex aitems jcenter">
{/* <View className="footer flex aitems jcenter">
<View className="btn" onClick={this.toHomePage.bind(this)}>
</View>
@ -186,14 +224,8 @@ export default class Entry extends Component<any, any> {
></View>
);
})}
{/* <View
className="dot"
style={`transform: translateX( ${
((current + 1) * 360) / welcomeList.length
}rpx); width: calc(100% / ${welcomeList.length}`}
></View> */}
</View>
</View>
</View> */}
</View>
</Block>
);

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

@ -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<any, any> {
@ -48,7 +49,6 @@ class Index extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
isShowIndexFlag: this.props.isShowIndexFlag,
isShowPrivacyPopup: false,
isShowSiteSwiper: false,
isNotRegister: false, // 是否未注册
@ -60,11 +60,6 @@ class Index extends Component<any, any> {
},
connectInstrument: {},
yiqiinfo: {},
titleHeight: "",
menu: {
top: 44,
height: 0,
},
list: [],
params: "",
messageCount: Taro.getStorageSync("messageCount") || 0,
@ -73,7 +68,10 @@ class Index extends Component<any, any> {
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<any, any> {
// 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<any, any> {
// 页面初始化
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<any, any> {
`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<any, any> {
<Block>
<PopupAlert
isShow={isNotRegister}
isClose={true}
title="提示"
content="暂未授权注册,请点击注册"
confirmButtonText="确定"
@ -406,6 +329,13 @@ class Index extends Component<any, any> {
closePrivacy={this.closePrivacy}
/>
<PopupBinding />
{/* <PopupPrivacyTest
closePrivacy={this.closePrivacy.bind(this)}
initData={this.initData.bind(this)}
></PopupPrivacyTest> */}
<PopupSiteSwiper
isShow={isShowSiteSwiper}
siteData={sitePopupList}
@ -435,7 +365,7 @@ class Index extends Component<any, any> {
></Navbar>
<View className="index">
<View className="date-title" onClick={this.toNursingRecords}>
<Text style={{ fontSize: "26rpx", color: "#666" }}></Text>
<Text className="text"></Text>
<View className="at-icon at-icon-chevron-right"></View>
</View>
<View className="bg-while">
@ -443,6 +373,8 @@ class Index extends Component<any, any> {
hideArrow={true}
isSwiper={false}
currentDate={currentDate}
complete={calendarComplete}
incomplete={calendarInComplete}
maxDate={Date.now()}
onTimeChange={this.onTimeChange}
/>
@ -543,6 +475,7 @@ class Index extends Component<any, any> {
})}
</Swiper>
</View>
<View style="height:200rpx"></View>
</Block>
);
}

@ -51,8 +51,6 @@ class Initiate extends Component<any, any> {
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<any, any> {
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<any, any> {
});
}
} else {
msg("获取首页视频失败!");
// msg("获取首页视频失败!");
}
}
@ -103,9 +102,14 @@ class Initiate extends Component<any, any> {
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<any, any> {
mode="widthFix"
/>
</View>
<View
className="main"
onTouchStart={this.touchstart.bind(this)}
@ -166,10 +171,11 @@ class Initiate extends Component<any, any> {
</View>
<View className="bg">
<Video
id="initvideo"
className="bg_item"
src={url}
initialTime={0}
controls={true}
controls={false}
autoplay={true}
loop={true}
muted={true}

@ -2,7 +2,7 @@ page {
background: #ffffff;
font-family: PingFang SC;
}
.infobox1 {
.integral_box1 {
height: 320rpx;
border-radius: 30rpx;
position: relative;
@ -72,7 +72,7 @@ page {
}
}
.infobox2 {
.integral_box2 {
.nodata {
width: 160rpx;
height: 160rpx;
@ -118,54 +118,5 @@ page {
}
}
.popbox3 {
.title {
text-align: center;
padding: 38rpx 0;
font-size: 36rpx;
font-weight: bold;
color: #030000;
line-height: 60rpx;
}
.tipimg {
margin: 20rpx 28rpx 0;
}
.tiptext {
/* text-align: center;
color: #4E4E4E; */
margin-top: 4rpx;
padding: 0 20rpx;
/* font-size: 32rpx; */
max-height: 800rpx;
overflow-y: scroll;
}
.popbox3btn {
display: flex;
align-items: center;
justify-content: space-between;
.nextbtn {
background: #000000;
width: 270rpx;
height: 90rpx;
text-align: center;
color: #fff;
font-size: 32rpx;
line-height: 90rpx;
margin: 41rpx auto 44rpx;
border-radius: 45rpx;
font-weight: bold;
}
.prebtn {
width: 180rpx;
height: 60rpx;
text-align: center;
color: #d3bc8d;
font-size: 30rpx;
line-height: 60rpx;
margin: 50rpx auto 30rpx;
border-radius: 30rpx;
border: 1px solid #d3bc8d;
}
}
.richtext {
}

@ -1,7 +1,15 @@
import Taro from "@tarojs/taro";
import dayjs from "dayjs";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import { Block, View, Text, Image, RichText } from "@tarojs/components";
import {
Block,
View,
Text,
Image,
RichText,
ScrollView,
} from "@tarojs/components";
import { Loading } from "@antmjs/vantui";
import "./integral_list.less";
@ -49,18 +57,20 @@ class IntegralList extends Component<any, any> {
pageNum: 1,
pageSize: 10,
total: 0,
dargState: 0,
};
}
async onLoad() {}
async onLoad() {
this.initData();
this.GetIntegralRule();
}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {
this.initData();
this.GetIntegralRule();
}
componentDidShow() {}
componentDidHide() {}
@ -169,11 +179,10 @@ class IntegralList extends Component<any, any> {
pageNum,
pageSize,
});
console.log("GetObtainUserIntegral", res);
if (res.data.code === 200) {
if (res.data.rows.length) {
list = [].concat(list, res.data.rows);
this.setState({ list: list });
this.setState({ list: list, total: res.data.total, dargState: 0 });
}
}
};
@ -182,7 +191,17 @@ class IntegralList extends Component<any, any> {
let res = await GetIntegralRule();
console.log("GetIntegralRule", res);
if (res.data.code === 200) {
this.setState({ nodes: res.data.data.value });
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 });
}
};
@ -205,8 +224,106 @@ class IntegralList extends Component<any, any> {
this.setState({ isOfficialAccount: false });
};
/*** 上拉加载 ***/
reduction = () => {
//还原初始设置
// const time = 0.5;
this.setState({
scrollY: true,
});
};
touchStart = (e) => {
this.setState({
start_p: e.touches[0],
});
};
touchmove = (e) => {
let move_p = e.touches[0], //移动时的位置
deviationX = 0.3, //左右偏移量(超过这个偏移量不执行下拉操做)
deviationY = 70, //拉动长度(低于这个值的时候不执行)
maxY = 100; //拉动的最大高度
let start_x = this.state.start_p.clientX,
start_y = this.state.start_p.clientY,
move_x = move_p.clientX,
move_y = move_p.clientY;
//获得偏移数值
let dev = Math.abs(move_x - start_x) / Math.abs(move_y - start_y);
if (dev < deviationX) {
//当偏移数值大于设置的偏移数值时则不执行操做
let pY = Math.abs(move_y - start_y) / 3.5; //拖动倍率(使拖动的时候有粘滞的感受--试了不少次 这个倍率恰好)
if (move_y - start_y > 0) {
//下拉操做
if (pY >= deviationY) {
// this.setState({ dargState: 1, downText: "释放刷新" });
} else {
// this.setState({ dargState: 0, downText: "下拉刷新" });
}
if (pY >= maxY) {
pY = maxY;
}
this.setState({
scrollY: false, //拖动的时候禁用
});
}
if (start_y - (move_y + 100) > 0) {
//上拉操做
// console.log("上拉操做");
if (pY >= deviationY) {
this.setState({ dargState: -1 });
}
}
}
};
pull = () => {
//上拉
console.log("上拉");
let { list, total, pageNum, dargState } = this.state;
if (dargState === -1) {
if (list.length < total) {
this.setState({ pageNum: pageNum + 1 });
setTimeout(() => {
this.GetObtainUserIntegral();
}, 100);
}
}
};
down = () => {
//下拉
console.log("下拉");
// this.props.onDown()
};
ScrollToUpper = () => {
//滚动到顶部事件
console.log("滚动到顶部事件");
// this.props.Upper()
};
ScrollToLower = () => {
//滚动到底部事件
console.log("滚动到底部事件");
// this.props.Lower()
};
touchEnd = (e) => {
if (this.state.dargState === 1) {
this.down();
} else if (this.state.dargState === -1) {
this.pull();
}
// this.reduction();
};
/*** 上拉加载 ***/
render() {
let { list, userinfo, isIntegral, isOfficialAccount, nodes } = this.state;
let {
list,
userinfo,
isIntegral,
isOfficialAccount,
nodes,
dargState,
total,
} = this.state;
return (
<Block>
<PopupAlert
@ -234,12 +351,16 @@ class IntegralList extends Component<any, any> {
height: "600rpx",
// backgroundColor: "#666",
}}
src={require("../../img/qrcode.jpg")}
showMenuByLongpress={true} // 长按识别二维码
src={require("../../img/qrcode-test.jpg")}
mode="aspectFit"
></Image>
<View style={{ marginTop: "20rpx" }}>
</View>
<View style={{ marginTop: "20rpx", color: "#666" }}>
(广)
</View>
</View>
}
confirmButtonText="我知道了"
@ -250,7 +371,7 @@ class IntegralList extends Component<any, any> {
<Navbar titleSlot="我的积分" isBack={true}></Navbar>
<View style="background: #f3f3f3;padding: 33rpx 30rpx 31rpx 30rpx;">
<View className="infobox1">
<View className="integral_box1">
<View
className="info1 flex aitems"
onClick={this.integralPopupShow}
@ -278,8 +399,8 @@ class IntegralList extends Component<any, any> {
</View>
</View>
<View className="infobox2">
{list.length === 0 && (
<View className="integral_box2">
{/* {list.length === 0 && (
<View className="nodata">
<Image
className="nodata_img"
@ -305,13 +426,72 @@ class IntegralList extends Component<any, any> {
</View>
</View>
);
})}
})} */}
<ScrollView
onTouchMove={this.touchmove}
onTouchEnd={this.touchEnd}
onTouchStart={this.touchStart}
onScrollToUpper={this.ScrollToUpper}
onScrollToLower={this.ScrollToLower}
className="dragUpdata"
scrollY={this.state.scrollY}
scrollWithAnimation
>
<View style={{ padding: "0 12px" }}>
<View>
{list.length === 0 && (
<View className="nodata">
<Image
className="nodata_img"
src={require("../../img/user/points.png")}
mode="aspectFill"
></Image>
<View></View>
</View>
)}
{list.map((item: any, key: number) => {
return (
<View className="list" key={key}>
<View className="list_block flex aitems sb">
<View className="left">
<View className="tip1">{item.remarkContent}</View>
<View className="tip2">{item.createTime}</View>
</View>
<View className="rights" style={item.style}>
{item.source === "1"
? "+" + item.floatScore
: "-" + item.floatScore}
</View>
</View>
</View>
);
})}
</View>
<View style="height: 20rpx"></View>
</View>
</ScrollView>
{list.length > 0 && list.length < total && (
<View className="upDragBox">
{dargState === 0 ? (
<Text style="color: #666"></Text>
) : (
<Loading size="24px">...</Loading>
)}
</View>
)}
{list.length > 0 && list.length === total && (
<View style="margin: 10rpx 0;text-align: center;">
<Text style="color: #666;"></Text>
</View>
)}
</View>
</Block>
);
}
}
// export default IntegralList
const mapStateToProps = (state) => ({
userInfo: state.userInfo,
otherSetting: state.otherSetting,

@ -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<any, any> {
};
}
async onLoad() {}
async onLoad() {
this.initData(); // 每次进入清空所有消息
}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {
this.initData(); // 每次进入清空所有消息
}
componentDidShow() {}
componentDidHide() {}
@ -55,7 +56,11 @@ export default class Message extends Component<any, any> {
this.GetMessageList();
}
godetail = () => {};
// 跳转
godetail = (item) => {
console.log("godetail", item);
goJump(item);
};
// 获取消息分页
GetMessageList = async () => {
@ -199,7 +204,7 @@ export default class Message extends Component<any, any> {
return (
<View
className="infobox1"
onClick={this.godetail}
onClick={this.godetail.bind(this, item)}
key={item.id}
>
<View className="info1 flex aitems sb">
@ -217,7 +222,7 @@ export default class Message extends Component<any, any> {
<View className="info2">
<View className="content">
<Text>
[]: {item.content ? item.content : ""}
[{item.titile}]: {item.content ? item.content : ""}
</Text>
</View>
</View>

@ -31,7 +31,17 @@ export default class PrivacyPolicy extends Component<any, any> {
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(/\<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 });
}
};

@ -24,7 +24,7 @@ page {
display: inline-block;
width: 100%;
// height: 943rpx;
height: 670rpx;
height: 991rpx;
}
.footer {
@ -32,7 +32,7 @@ page {
margin-top: -60rpx;
z-index: 1;
width: 100%;
height: 600rpx;
height: 570rpx;
background: #fff;
// background: #000;
border-radius: 50rpx 50rpx 0rpx 0rpx;
@ -64,7 +64,7 @@ page {
.btn_login {
width: 690rpx;
height: 90rpx;
background: #000000 !important;
background: #000000;
border-radius: 45rpx;
color: #fff;
line-height: 90rpx;

@ -1,3 +1,4 @@
import classnames from "classnames";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import Taro from "@tarojs/taro";
@ -140,22 +141,6 @@ class Register extends Component<any, any> {
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<any, any> {
</View>
</View>
<Button
style={{ opacity: isChecked ? 1 : 0.6 }}
type="primary"
disabled={!isChecked || isButtonDisabled}
open-type="getPhoneNumber"
className="btn_login"
className={classnames("btn_login")}
onGetPhoneNumber={this.onSubmit}
onClick={this.changeGetPhoneNumberBtn}
>

@ -237,3 +237,16 @@ page {
height: 100%;
}
}
.message {
position: relative;
.tip {
position: absolute;
top: -6rpx;
right: -12rpx;
width: 12rpx;
height: 12rpx;
background: #eb5858;
border-radius: 50%;
}
}

@ -39,7 +39,7 @@ class User extends Component<any, any> {
count: 0,
year: new Date().getFullYear(),
lastDay: dayjs().endOf("year").endOf("month").format("YYYY-MM-DD"),
messagecount: 0,
messagecount: Taro.getStorageSync("messageCount") || 0,
isNotRegister: false, // 是否未注册
isShowCustomerService: false, // 反馈留言
messageInfo: "", // 用户留言
@ -70,6 +70,7 @@ 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 });
@ -180,6 +181,7 @@ class User extends Component<any, any> {
<Block>
<PopupAlert
isShow={isDev}
isClose={true}
title="提示"
content="页面正在开发中"
confirmButtonText="确定"
@ -287,8 +289,8 @@ class User extends Component<any, any> {
</View>
</View>
<View className="num">{userInfo.credit}</View>
<View className="txt"></View>
{/* <View className="txt">过期</View> */}
{/* <View className="txt"></View> */}
<View className="txt"></View>
</View>
</View>
<View className="info3">
@ -326,13 +328,13 @@ class User extends Component<any, any> {
<View className="tip1"></View>
</View>
<View
className="block flex aitems"
className="block flex aitems message"
data-url="/pages/message/message"
onClick={this.gourl}
>
<View className="img">
<Image src={require("../../img/4.png")} mode="aspectFill" />
{messagecount > 0 ? <View className="num"></View> : ""}
{messagecount ? <View className="tip"></View> : ""}
</View>
<View className="tip1"></View>
</View>
@ -399,7 +401,7 @@ class User extends Component<any, any> {
></Textarea>
</Block>
}
confirmButtonText="确定"
confirmButtonText="提交"
textAlgin="left"
close={this.closeCustomerService}
confirm={this.confirmCustomerService}

@ -0,0 +1,139 @@
/* pages/userInfo/userInfo.wxss */
page {
background: #f3f3f3;
}
.nav {
position: fixed;
z-index: 99;
width: 100%;
top: 0;
}
.nav .logo {
width: 223rpx;
}
.nav .nav_box {
position: relative;
display: flex;
align-items: center;
justify-content: center;
padding: 0 32rpx;
}
.main {
text-align: center;
padding-bottom: 153rpx;
}
.main .title {
font-size: 48rpx;
font-weight: 500;
color: #000;
margin: 73rpx auto 48rpx;
}
.main .txt {
font-size: 26rpx;
font-weight: 500;
color: #666;
margin-bottom: 10rpx;
}
.main .avatar_box {
position: relative;
width: max-content;
margin: 78rpx auto 59rpx;
}
.main .avatar_box .avatar {
width: 147rpx;
height: 147rpx;
border-radius: 50%;
margin: 0 auto 13rpx;
}
.main .avatar_box .btn_avatar {
background: transparent;
}
/* 去掉背景色和内外边距 */
button {
margin: 0;
padding: 0;
background-color: inherit;
position: static;
}
button:after {
content: none;
}
/* 去掉边框 */
button::after {
border: none;
}
.main .avatar_box .btn_avatar::after {
border: none;
background: transparent;
}
.form {
width: 690rpx;
text-align: left;
margin: 0 30rpx 0;
}
.form .form_item {
position: relative;
margin-bottom: 35rpx;
}
.form_item .arrow {
position: absolute;
bottom: 30rpx;
right: 51rpx;
width: 30rpx;
height: 20rpx;
}
.form .form_item .label {
font-size: 28rpx;
font-weight: 500;
color: #030000;
margin-bottom: 28rpx;
}
.form .form_item .label::after {
content: "*";
color: #eb5858;
margin-left: 10rpx;
}
.form .form_item .ipt {
width: 100%;
height: 80rpx;
line-height: 80rpx;
background: #ffffff;
border: 1px solid #dddddd;
border-radius: 3rpx;
padding-left: 28rpx;
box-sizing: border-box;
}
.footer {
position: fixed;
bottom: 0;
z-index: 99;
display: flex;
align-items: baseline;
width: 100%;
height: 153rpx;
background: #ffffff;
box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21);
}
.btn {
width: 540rpx;
height: 90rpx;
background: #000;
border-radius: 45rpx;
color: #fff;
line-height: 90rpx;
text-align: center;
margin: 21rpx 49rpx 42rpx 30rpx;
}
.text {
font-size: 32rpx;
font-weight: bold;
color: #000;
}
.btn-disable {
background-color: #ccc !important;
/* 设置按钮背景颜色为灰色 */
color: #fff !important;
/* 设置按钮文字颜色为白色 */
border-color: #ccc !important;
/* 设置按钮边框颜色为灰色 */
}

@ -44,14 +44,14 @@ page {
.main .avatar_box {
position: relative;
width: max-content;
margin: 78rpx auto 59rpx;
margin: 78rpx auto 50rpx;
}
.main .avatar_box .avatar {
width: 147rpx;
height: 147rpx;
border-radius: 50%;
margin: 0 auto 13rpx;
margin: 0 auto;
}
.main .avatar_box .btn_avatar {
@ -92,7 +92,7 @@ button::after {
.form_item .arrow {
position: absolute;
bottom: 30rpx;
right: 51rpx;
right: 21rpx;
width: 30rpx;
height: 20rpx;
}
@ -151,7 +151,7 @@ button::after {
}
.btn-disable {
background-color: gray !important; /* 设置按钮背景颜色为灰色 */
color: white !important; /* 设置按钮文字颜色为白色 */
border-color: gray !important; /* 设置按钮边框颜色为灰色 */
background-color: #ccc !important; /* 设置按钮背景颜色为灰色 */
color: #fff !important; /* 设置按钮文字颜色为白色 */
border-color: #ccc !important; /* 设置按钮边框颜色为灰色 */
}

@ -5,22 +5,15 @@ import {
// UserInfoUp,
// WCUserLogin,
UpdateUser,
UpdateUserUploadFile,
GetProvince,
GetAreaListByPid,
} from "../../utils/Interface";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import Taro from "@tarojs/taro";
// 引入 Swiper, SwiperItem 组件
import {
Block,
View,
Text,
Image,
Input,
Button,
// Picker,
} from "@tarojs/components";
import { Toast, Picker, Popup, DatetimePicker } from "@antmjs/vantui";
import { Block, View, Text, Image, Input, Button } from "@tarojs/components";
import { Toast, Popup, Picker, DatetimePicker } from "@antmjs/vantui";
import "taro-ui/dist/style/components/button.scss"; // 按需引入
import "./userInfo.less";
@ -45,8 +38,6 @@ class UserInfo extends Component<any, any> {
super(props);
this.state = {
name: "用户信息",
menu: {},
titleHeight: "",
style: "font-size: 26rpx; font-weight: 500; color: #ccc",
userInfo: {
...this.props.userInfo,
@ -97,10 +88,6 @@ class UserInfo extends Component<any, any> {
if (!Taro.getStorageSync("token")) {
// await this.WCUserLogin();
}
const menu = Taro.getMenuButtonBoundingClientRect();
const titleHeight =
"height:" + (Number(menu.top) + Number(menu.height) + 10) + "px;";
this.setState({ titleHeight, menu });
this.initData();
}
@ -152,44 +139,76 @@ class UserInfo extends Component<any, any> {
UpdateUser = async () => {
let { form, userInfo } = this.state;
let formData = new FormData();
formData.append("province", form.province);
formData.append("city", form.city);
formData.append("area", form.area);
formData.append("provinceId", form.provinceId);
formData.append("cityId", form.cityId);
formData.append("areaId", form.areaId);
formData.append("birthday", userInfo.birthday);
formData.append("nickname", userInfo.nickname);
formData.append("headimg", userInfo.headimg);
if (userInfo.headimg) {
// 如果头像是小程序相对路径,则上传文件
if (userInfo.headimg.indexOf("//tmp/") > -1) {
formData.appendFile("file", userInfo.headimg, "headimg.png");
} else {
formData.append("file", null);
let isTmpFile = userInfo.headimg.indexOf("//tmp") > -1;
let isWXFile = userInfo.headimg.indexOf("wxfile://") > -1;
if (isTmpFile || isWXFile) {
let formData = {
province: form.province,
city: form.city,
area: form.area,
provinceId: form.provinceId,
cityId: form.cityId,
areaId: form.areaId,
birthday: userInfo.birthday,
nickname: userInfo.nickname,
headimg: userInfo.headimg,
file: userInfo.headimg || null,
};
let res = await UpdateUserUploadFile(formData);
console.log("Res", res);
if (res.code === 200) {
msg("更新成功");
userInfo.province = res.data.province;
userInfo.city = res.data.city;
userInfo.area = res.data.area;
userInfo.provinceId = res.data.provinceId;
userInfo.cityId = res.data.cityId;
userInfo.areaId = res.data.areaId;
userInfo.nickname = res.data.nickname;
userInfo.headimg = res.data.headimg;
userInfo.integralText = res.data.integralText;
this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo });
if (res.data.integralText) {
this.setState({ isShowIntegralText: true });
} else {
this.goUser();
}
}
}
let data = formData.getData();
let res = await UpdateUser(data);
if (res.data.code === 200) {
msg("更新成功");
userInfo.province = res.data.data.province;
userInfo.city = res.data.data.city;
userInfo.area = res.data.data.area;
userInfo.provinceId = res.data.data.provinceId;
userInfo.cityId = res.data.data.cityId;
userInfo.areaId = res.data.data.areaId;
userInfo.nickname = res.data.data.nickname;
userInfo.headimg = res.data.data.headimg;
userInfo.integralText = res.data.data.integralText;
this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo });
if (res.data.data.integralText) {
this.setState({ isShowIntegralText: true });
} else {
this.goUser();
} else {
let formData = new FormData();
formData.append("province", form.province);
formData.append("city", form.city);
formData.append("area", form.area);
formData.append("provinceId", form.provinceId);
formData.append("cityId", form.cityId);
formData.append("areaId", form.areaId);
formData.append("birthday", userInfo.birthday);
formData.append("nickname", userInfo.nickname);
formData.append("headimg", userInfo.headimg);
formData.append("file", null);
let data = formData.getData();
let res = await UpdateUser(data);
if (res.data.code === 200) {
msg("更新成功");
userInfo.province = res.data.data.province;
userInfo.city = res.data.data.city;
userInfo.area = res.data.data.area;
userInfo.provinceId = res.data.data.provinceId;
userInfo.cityId = res.data.data.cityId;
userInfo.areaId = res.data.data.areaId;
userInfo.nickname = res.data.data.nickname;
userInfo.headimg = res.data.data.headimg;
userInfo.integralText = res.data.data.integralText;
this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo });
if (res.data.data.integralText) {
this.setState({ isShowIntegralText: true });
} else {
this.goUser();
}
}
}
};
@ -360,9 +379,12 @@ class UserInfo extends Component<any, any> {
}, 600);
};
onDateChange = (e) => {
console.log("onDateChange", e);
};
render() {
let {
titleHeight,
style,
userInfo,
columns,
@ -383,18 +405,21 @@ class UserInfo extends Component<any, any> {
return `${value}`;
};
let birthday = dayjs(userInfo.birthday).valueOf();
return (
<Block>
<PopupAlert
isShow={isShowIntegralText}
isClose={true}
title="提示"
content={userInfo.integralText}
confirmButtonText="确定"
textAlgin="center"
close={this.closeIntegralText}
confirm={this.closeIntegralText}
/>
<Navbar titleSlot="个人信息完善"></Navbar>
<View style={titleHeight}></View>
<View className="main">
<View className="title"></View>
<View className="txt"></View>
@ -454,6 +479,20 @@ class UserInfo extends Component<any, any> {
placeholder-style={style}
value={userInfo.birthday}
></Input>
{/* <Picker
mode="date"
value={userInfo.birthday}
onChange={this.onDateChange}
>
<Input
// onClick={this.onTimeShow}
disabled
className="ipt"
placeholder="请选择您的生日"
placeholder-style={style}
value={userInfo.birthday}
></Input>
</Picker> */}
<Image
className="arrow"
src={require("../../img/welcome/arrow-down.png")}
@ -491,7 +530,7 @@ class UserInfo extends Component<any, any> {
<DatetimePicker
type="date"
formatter={formatter}
value={dayjs(userInfo.birthday).valueOf()}
value={birthday}
minDate={minDate}
maxDate={Date.now()}
onCancel={this.onTimePickerCancel}

@ -0,0 +1,181 @@
page {
background: #f8f8f8;
}
image {
width: 100%;
height: 100%;
}
.infobox1 {
margin: 30rpx;
border-radius: 30rpx;
/*box-shadow: 0px 1px 8px #E5E5E5;*/
display: flex;
align-items: center;
padding: 20rpx 34rpx;
background: #fff;
}
/* 去掉背景色和内外边距 */
button {
margin: 0;
padding: 0;
background-color: inherit;
position: static;
}
button:after {
content: none;
}
/* 去掉边框 */
button::after {
border: none;
}
.infobox1 .avatar_box {
width: max-content;
}
.infobox1 .avatar_box .headimg {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
.nickname {
margin-left: 32rpx;
font-size: 28rpx;
font-weight: bold;
color: #000000;
}
.infobox2 {
margin: 30rpx;
border-radius: 30rpx;
/*box-shadow: 0px 1px 8px #E5E5E5;*/
background: #fff;
}
.infobox2 > .title {
padding: 39rpx 34rpx 62rpx;
font-size: 32rpx;
font-weight: bold;
color: #000000;
line-height: 1;
}
.infobox2 > .block_list {
display: flex;
align-items: center;
padding: 0 34rpx 60rpx;
font-size: 28rpx;
color: #000000;
font-weight: 500;
}
.infobox2 > .block_list > .label {
/*color: #3D3E3E;*/
}
.infobox2 > .block_list > .label > text {
color: #eb5858;
margin-left: 6rpx;
}
.infobox2 > .block_list > .value {
margin-left: 45rpx;
/*color: #666666;*/
position: relative;
}
.infobox2 > .block_list > .getmobile {
background: #d3bc8d;
font-size: 24rpx;
color: #fff;
padding: 14rpx 28rpx;
border-radius: 30rpx;
margin-left: 50rpx;
position: relative;
}
.infobox2 > .block_list > .getmobile > .mobilebtn {
position: absolute;
width: 100%;
top: 0;
bottom: 0;
left: 0;
z-index: 99;
opacity: 0;
}
.infobox3 {
margin: 30rpx;
border-radius: 30rpx;
/*box-shadow: 0px 1px 8px #E5E5E5;*/
background: #fff;
}
.infobox3 > .title {
padding: 39rpx 33rpx 62rpx;
font-size: 32rpx;
font-weight: bold;
color: #000000;
line-height: 1;
}
.infobox3 > .block_list {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 30rpx 35rpx;
font-size: 28rpx;
}
.infobox3 > .block_list > .label {
color: #030000;
}
.infobox3 > .block_list > .label > text {
color: #eb5858;
margin-left: 6rpx;
}
.infobox3 > .block_list > .value {
color: #000000;
display: flex;
align-items: center;
position: relative;
}
.infobox3 > .block_list > .value > .picker {
position: absolute;
width: 100%;
top: 0;
bottom: 0;
left: 0;
z-index: 99;
opacity: 0;
}
.infobox3 > .block_list > .value > .input input {
text-align: right;
}
.infobox3 > .block_list > .value > .righticon {
width: 10rpx;
height: 20rpx;
margin-left: 22rpx;
}
.submitbtn {
position: absolute;
bottom: 100rpx;
width: 400rpx;
left: 50%;
margin-left: -200rpx;
}
.btn_box {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 153rpx;
background: #ffffff;
box-shadow: 0rpx -3rpx 7rpx 1rpx rgba(173, 191, 207, 0.21);
padding-bottom: 21rpx;
}
.btn_box .btn {
width: 690rpx;
height: 90rpx;
line-height: 90rpx;
background: #000000;
border-radius: 45rpx;
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #ffffff;
}
.btn_box .btn-disable {
background-color: #ccc !important;
/* 设置按钮背景颜色为灰色 */
color: #fff !important;
/* 设置按钮文字颜色为白色 */
border-color: #ccc !important;
/* 设置按钮边框颜色为灰色 */
}

@ -176,8 +176,8 @@ button::after {
color: #ffffff;
}
.btn-disable {
background-color: gray; /* 设置按钮背景颜色为灰色 */
color: white; /* 设置按钮文字颜色为白色 */
border-color: gray; /* 设置按钮边框颜色为灰色 */
background-color: #ccc !important; /* 设置按钮背景颜色为灰色 */
color: #fff !important; /* 设置按钮文字颜色为白色 */
border-color: #ccc !important; /* 设置按钮边框颜色为灰色 */
}
}

@ -1,6 +1,7 @@
import dayjs from "dayjs";
import {
UpdateUser,
UpdateUserUploadFile,
GetProvince,
GetAreaListByPid,
} from "../../utils/Interface";
@ -16,7 +17,7 @@ import {
Button,
// Picker,
} from "@tarojs/components";
import { Toast, Picker, Popup, DatetimePicker } from "@antmjs/vantui";
import { Picker, Popup, DatetimePicker } from "@antmjs/vantui";
import "./userInfoDetail.less";
@ -39,8 +40,6 @@ class UserInfoDetail extends Component<any, any> {
this.state = {
name: "用户信息",
menu: {},
titleHeight: "",
style: "font-size: 26rpx; font-weight: 500; color: #ccc",
userInfo: {
...this.props.userInfo,
@ -92,22 +91,14 @@ class UserInfoDetail extends Component<any, any> {
if (!Taro.getStorageSync("token")) {
// await this.WCUserLogin();
}
const menu = Taro.getMenuButtonBoundingClientRect();
const titleHeight =
"height:" + (Number(menu.top) + Number(menu.height) + 10) + "px;";
this.setState({ titleHeight, menu });
this.initData();
console.log("userInfo.birthday", this.state.userInfo.birthday);
}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {
console.log("this.props", this.props);
}
componentDidShow() {}
componentDidHide() {}
@ -179,44 +170,80 @@ class UserInfoDetail extends Component<any, any> {
UpdateUser = async () => {
let { form, userInfo } = this.state;
let formData = new FormData();
formData.append("province", form.province);
formData.append("city", form.city);
formData.append("area", form.area);
formData.append("provinceId", form.provinceId);
formData.append("cityId", form.cityId);
formData.append("areaId", form.areaId);
formData.append("birthday", userInfo.birthday);
formData.append("nickname", userInfo.nickname);
formData.append("headimg", userInfo.headimg);
if (userInfo.headimg) {
// 如果头像是小程序相对路径,则上传文件
if (userInfo.headimg.indexOf("//tmp/") > -1) {
formData.appendFile("file", userInfo.headimg, "headimg.png");
} else {
formData.append("file", null);
let isTmpFile = userInfo.headimg.indexOf("//tmp") > -1;
let isWXFile = userInfo.headimg.indexOf("wxfile://") > -1;
if (isTmpFile || isWXFile) {
let formData = {
province: form.province,
city: form.city,
area: form.area,
provinceId: form.provinceId,
cityId: form.cityId,
areaId: form.areaId,
birthday: userInfo.birthday,
nickname: userInfo.nickname,
headimg: userInfo.headimg,
file: userInfo.headimg || null,
};
let res = await UpdateUserUploadFile(formData);
if (res.code === 200) {
userInfo.province = res.data.province;
userInfo.city = res.data.city;
userInfo.area = res.data.area;
userInfo.provinceId = res.data.provinceId;
userInfo.cityId = res.data.cityId;
userInfo.areaId = res.data.areaId;
userInfo.nickname = res.data.nickname;
userInfo.headimg = res.data.headimg;
userInfo.integralText = res.data.integralText;
this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo });
if (res.data.integralText) {
this.setState({ isShowIntegralText: true });
} else {
msg("更新成功");
setTimeout(() => {
this.goUser();
}, 600);
}
}
}
let data = formData.getData();
let res = await UpdateUser(data);
if (res.data.code === 200) {
msg("更新成功");
userInfo.province = res.data.data.province;
userInfo.city = res.data.data.city;
userInfo.area = res.data.data.area;
userInfo.provinceId = res.data.data.provinceId;
userInfo.cityId = res.data.data.cityId;
userInfo.areaId = res.data.data.areaId;
userInfo.nickname = res.data.data.nickname;
userInfo.headimg = res.data.data.headimg;
userInfo.integralText = res.data.data.integralText;
this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo });
if (res.data.data.integralText) {
this.setState({ isShowIntegralText: true });
} else {
this.goUser();
} else {
let formData = new FormData();
formData.append("province", form.province);
formData.append("city", form.city);
formData.append("area", form.area);
formData.append("provinceId", form.provinceId);
formData.append("cityId", form.cityId);
formData.append("areaId", form.areaId);
formData.append("birthday", userInfo.birthday);
formData.append("nickname", userInfo.nickname);
formData.append("headimg", userInfo.headimg);
formData.append("file", null);
let data = formData.getData();
let res = await UpdateUser(data);
if (res.data.code === 200) {
userInfo.province = res.data.data.province;
userInfo.city = res.data.data.city;
userInfo.area = res.data.data.area;
userInfo.provinceId = res.data.data.provinceId;
userInfo.cityId = res.data.data.cityId;
userInfo.areaId = res.data.data.areaId;
userInfo.nickname = res.data.data.nickname;
userInfo.headimg = res.data.data.headimg;
userInfo.integralText = res.data.data.integralText;
this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo });
if (res.data.data.integralText) {
this.setState({ isShowIntegralText: true });
} else {
msg("更新成功");
setTimeout(() => {
this.goUser();
}, 600);
}
}
}
};
@ -251,11 +278,11 @@ class UserInfoDetail extends Component<any, any> {
};
pickerChange = (event) => {
console.log("pickerChange", event);
// console.log("pickerChange", event);
};
onPickerColumnChange = (event) => {
console.log("onPickerColumnChange", event);
// console.log("onPickerColumnChange", event);
};
onCityChange = async (picker) => {
@ -389,10 +416,12 @@ class UserInfoDetail extends Component<any, any> {
<Navbar isBack={true} titleSlot="个人信息"></Navbar>
<PopupAlert
isShow={isShowIntegralText}
isClose={true}
title="提示"
content={userInfo.integralText}
confirmButtonText="确定"
textAlgin="center"
close={this.closeIntegralText}
confirm={this.closeIntegralText}
/>
<View className="infobox1">
@ -426,7 +455,7 @@ class UserInfoDetail extends Component<any, any> {
<View className="title border"></View>
<View className="block_list flex aitems sb">
<View className="label">
<text>*</text>
<Text>*</Text>
</View>
<View className="value">{userInfo.mobile}</View>
</View>
@ -436,7 +465,7 @@ class UserInfoDetail extends Component<any, any> {
<View className="title border"></View>
<View className="block_list" onClick={this.onCityShow}>
<View className="label">
()<text>*</text>
()<Text>*</Text>
</View>
<View className="value">
<View>
@ -454,7 +483,7 @@ class UserInfoDetail extends Component<any, any> {
</View>
<View className="block_list" onClick={this.onTimeShow}>
<View className="label">
<text>*</text>
<Text>*</Text>
</View>
<View className="value">
{/* <picker className="picker" mode="date" bindchange="bindbirthdayPickerChange" end="{{dateend}}" value="{{ageindex}}" range="{{age}}">picker</picker> */}

@ -31,7 +31,17 @@ export default class UserPolicy extends Component<any, any> {
initData = async () => {
let res = await getUserAgreement();
if (res.data.code === 200) {
this.setState({ nodes: res.data.data.value });
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 });
}
};

@ -1,4 +1,4 @@
import { Ajax, AjaxuploadFile, AjaxFormData } from "./request";
import { Ajax, AjaxUploadFile, AjaxFormData } from "./request";
import Taro from "@tarojs/taro";
// params转换url参数
@ -32,6 +32,16 @@ export const UpdateUser = (data) => {
method: "post",
});
};
export const UpdateUserUploadFile = (formData) => {
// 更新用户信息且上传头像文件
return AjaxUploadFile(
{
url: "hzwx/user/updateUser",
filePath: formData.file,
},
formData
);
};
export const RefreshWxUserInfo = (data) => {
// 刷新用户信息
return Ajax({
@ -366,7 +376,7 @@ export const PunchingCardOnLineAdd = (data) => {
export const Uploads = (filePath) => {
//上传图片
return AjaxuploadFile({
return AjaxUploadFile({
url: "/Uploads",
filePath,
method: "post",
@ -375,7 +385,7 @@ export const Uploads = (filePath) => {
export const UploadVoide = (filePath) => {
//上传视频
return AjaxuploadFile({
return AjaxUploadFile({
url: "/UploadVoide",
filePath,
method: "post",

@ -12,14 +12,14 @@ const global_requestUrlList = []; // 全局正在请求的url地址防止
export const Ajax = (params) => {
const app = Taro.getApp();
const domain = global.domain;
// console.log("Ajaxdomain", app, domain);
// Taro.showLoading({
// title: '请求中...',
// mask: true
// title: "请求中...",
// mask: true,
// });
// 防止多次点击
const requestUrlList = global_requestUrlList;
const whiteList = []; // 白名单
const whiteList = []; // 白名单:不自动重新请求
if (
requestUrlList.indexOf(params.url) > -1 &&
whiteList.indexOf(params.url) < 0
@ -48,8 +48,7 @@ export const Ajax = (params) => {
Taro.setStorageSync("token", null);
Taro.clearStorage(); // 清空所有缓存
Taro.reLaunch({
// url: "/pages/login/login",
url: "/pages/login/login",
url: "/pages/initiate/initiate",
});
});
return;
@ -85,8 +84,7 @@ export const Ajax = (params) => {
if (res.data.code == 401 || res.data.msg === "登录状态已过期") {
Taro.setStorageSync("token", null);
Taro.reLaunch({
// url: "/pages/login/login",
url: "/pages/login/login",
url: "/pages/initiate/initiate",
});
}
});
@ -95,6 +93,10 @@ export const Ajax = (params) => {
}
return false;
}
if (requestUrlList.length > 0) {
requestUrlList.splice(requestUrlList.indexOf(params.url), 1);
}
reslove(res);
},
fail(err) {
@ -107,37 +109,38 @@ export const Ajax = (params) => {
},
complete() {
Taro.hideLoading();
const requestUrlList = global_requestUrlList;
const newRequestUrlList = requestUrlList.splice(
requestUrlList.indexOf(params.url),
1
);
// const requestUrlList = global_requestUrlList;
// const newRequestUrlList = requestUrlList.splice(
// requestUrlList.indexOf(params.url),
// 1
// );
},
});
});
};
export const AjaxuploadFile = (params) => {
export const AjaxUploadFile = (params, formData) => {
const app = Taro.getApp();
const domain = global.domain;
// Taro.showLoading({
// title: "请求中...",
// mask: true,
// });
Taro.showLoading({
title: "请求中...",
mask: true,
});
return new Promise((reslove, reject) => {
Taro.uploadFile({
filePath: params.filePath,
name: "file",
url: domain + params.url,
formData: {
type: "api",
...formData,
},
header: {
token: Taro.getStorageSync("token"),
Authorization: "Bearer " + Taro.getStorageSync("token"),
...params.header,
// token: Taro.getStorageSync("token"),
},
success(res) {
let o = JSON.parse(res.data);
Taro.hideLoading();
if (res.statusCode !== 200) {
Taro.showModal({
title: "提示",
@ -159,13 +162,15 @@ export const AjaxuploadFile = (params) => {
reslove(o);
},
fail() {
Taro.hideLoading();
Taro.showModal({
title: "提示",
content: "请检查网络是否连接",
showCancel: false,
});
},
complete() {
Taro.hideLoading();
},
});
});
};
@ -206,7 +211,7 @@ export const AjaxFormData = (params) => {
Taro.setStorageSync("token", null);
Taro.clearStorage(); // 清空所有缓存
Taro.reLaunch({
url: "/pages/login/login",
url: "/pages/initiate/initiate",
});
});
return;
@ -237,7 +242,7 @@ export const AjaxFormData = (params) => {
if (res.data.code == 401 || res.data.msg === "登录状态已过期") {
Taro.setStorageSync("token", null);
Taro.reLaunch({
url: "/pages/login/login",
url: "/pages/initiate/initiate",
});
}
});

@ -65,6 +65,113 @@ export const go = (url) => {
});
};
// jumpType 0轮播图跳转 1消息列表跳转
export const goJump = (data, jumpType = 0) => {
// 跳转类型0无跳转、1跳转内部链接、3跳转外部链接、4跳转小程序、5导向视频号、6导向视频号直播间',
/**
* `link` '跳转链接(跳转外部链接、跳转内部链接)',
`link_params` '跳转链接参数(跳转内部链接)',
`redirect_appid` '外链小程序appid跳转小程序',
`redirect_url` '外链小程序url跳转小程序',
`video_no` '视频号(导向视频号、导向视频号直播间)',
`feed_id` '视频号feedId导向视频号',
*/
let { type } = data;
if (type === 0) {
return;
}
jupmFun(type, data);
// if (jumpType === 0) {
// let { type } = data;
// if (type === 0) {
// return;
// }
// jupmFun(type, data);
// } else if (jumpType === 1) {
// let { messageType } = data;
// if (messageType === 0) {
// return;
// }
// jupmFun(messageType, data);
// }
};
const jupmFun = (type, data) => {
try {
switch (type) {
case 1: // 跳转内部链接
if (data.linkParams) {
Taro.reLaunch({
url: data.link + "?" + data.linkParams,
});
} else {
Taro.reLaunch({
url: data.link,
});
}
break;
case 3: // 跳转外部链接
if (data.linkParams) {
Taro.navigateTo({
url:
"/pages/webViewPage/webViewPage?url=" +
data.link +
"?" +
data.linkParams,
});
} else {
Taro.navigateTo({
url: "/pages/webViewPage/webViewPage?url=" + data.link,
});
}
break;
case 4: // 跳转小程序
Taro.navigateToMiniProgram({
appId: data.redirectAppid,
path: data.redirectUrl,
success: (res) => {
// 打开成功
console.log("跳转小程序success", res);
},
fail: (res) => {
console.log("跳转小程序fail", res);
msg("跳转失败:" + res.errMsg);
},
});
break;
case 5: // 跳转视频号
Taro.openChannelsActivity({
finderUserName: data.videoNo,
feedId: data.feedId,
success: (res) => {
// 打开成功
console.log("跳转视频号success", res);
},
fail: (res) => {
console.log("跳转视频号fail", res);
msg("跳转失败:" + res.errMsg);
},
});
break;
case 6: // 跳转视频号直播间
Taro.openChannelsLive({
finderUserName: data.videoNo,
feedId: data.feedId,
success: (res) => {
// 打开成功
console.log("视频号直播间success", res);
},
fail: (res) => {
console.log("视频号直播间fail", res);
},
});
break;
}
} catch (error) {
console.log("error", error);
}
};
export const loading = (title) => {
Taro.showToast({
title,

Loading…
Cancel
Save