add:1.积分过期提醒弹窗 2.@antmjs/vantui自动引入css

master
blak-kong 2 years ago
parent 6dbbe576f3
commit 9bbbf5daf6

@ -10,4 +10,15 @@ module.exports = {
},
],
],
plugins: [
[
"import",
{
libraryName: "@antmjs/vantui",
libraryDirectory: "es",
style: (name) => `${name}/style/less`,
},
"@antmjs/vantui",
],
],
};

19
package-lock.json generated

@ -45,6 +45,7 @@
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"babel-plugin-import": "^1.13.8",
"babel-preset-taro": "3.6.19",
"cache-loader": "^4.1.0",
"eslint": "^8.12.0",
@ -10694,6 +10695,15 @@
"object.assign": "^4.1.0"
}
},
"node_modules/babel-plugin-import": {
"version": "1.13.8",
"resolved": "https://registry.npmmirror.com/babel-plugin-import/-/babel-plugin-import-1.13.8.tgz",
"integrity": "sha512-36babpjra5m3gca44V6tSTomeBlPA7cHUynrE2WiQIm3rEGD9xy28MKsx5IdO45EbnpJY7Jrgd00C6Dwt/l/2Q==",
"dev": true,
"dependencies": {
"@babel/helper-module-imports": "^7.0.0"
}
},
"node_modules/babel-plugin-minify-dead-code-elimination": {
"version": "0.5.2",
"resolved": "https://registry.npmmirror.com/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.2.tgz",
@ -43787,6 +43797,15 @@
"object.assign": "^4.1.0"
}
},
"babel-plugin-import": {
"version": "1.13.8",
"resolved": "https://registry.npmmirror.com/babel-plugin-import/-/babel-plugin-import-1.13.8.tgz",
"integrity": "sha512-36babpjra5m3gca44V6tSTomeBlPA7cHUynrE2WiQIm3rEGD9xy28MKsx5IdO45EbnpJY7Jrgd00C6Dwt/l/2Q==",
"dev": true,
"requires": {
"@babel/helper-module-imports": "^7.0.0"
}
},
"babel-plugin-minify-dead-code-elimination": {
"version": "0.5.2",
"resolved": "https://registry.npmmirror.com/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.2.tgz",

@ -72,6 +72,7 @@
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"babel-plugin-import": "^1.13.8",
"babel-preset-taro": "3.6.19",
"cache-loader": "^4.1.0",
"eslint": "^8.12.0",

@ -10,13 +10,6 @@ import store from "./store";
import "taro-ui/rn/style/components/icon.scss";
import "@antmjs/vantui/es/datetime-picker/index.less";
import "@antmjs/vantui/es/transition/index.less";
import "@antmjs/vantui/es/toast/index.less";
import "@antmjs/vantui/es/picker/index.less";
import "@antmjs/vantui/es/picker-column/index.less";
import "@antmjs/vantui/es/style/base.less";
class App extends Component<PropsWithChildren> {
// 可以使用所有的 React 生命周期方法
componentDidMount() {}

@ -1,63 +1,20 @@
.alert-box {
width: 650rpx;
// height: 800rpx;
padding: 40rpx;
padding-bottom: 80rpx;
box-sizing: border-box;
.alert-popup-title {
font-size: 36rpx;
font-weight: 700;
text-align: center;
color: #000;
}
}
.alert-popup-content-box {
margin-top: 60rpx;
}
.alert-popup-content {
font-size: 28rpx;
margin-bottom: 20rpx;
max-height: 600rpx;
overflow-y: auto;
}
.alert-popup-content.is-alert {
color: #41a9fc;
text-decoration: underline;
}
.alert-popup-content.is-last {
margin-bottom: 0;
.text-left {
text-align: left;
}
.alert-popup-btns {
.type3btn {
display: flex;
margin-top: 76rpx;
justify-content: center;
}
.alert-popup-btn {
width: 480rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 30rpx;
align-items: center;
text-align: center;
border: 1rpx solid #000;
border-radius: 40rpx;
color: #fff;
background-color: #000;
}
.pupup-close {
position: absolute;
right: 30rpx;
top: 30rpx;
color: #000;
font-size: 36rpx;
}
.text-left {
text-align: left;
padding: 10rpx;
margin-top: -20rpx;
.checked {
width: 40rpx;
height: 40rpx;
margin-right: 30rpx;
}
.text {
color: #666;
}
}

@ -1,11 +1,12 @@
import classnames from "classnames";
import { Component } from "react";
import { Block, View, Button, PageMeta } from "@tarojs/components";
import { Block, View, Image, Text, Button, PageMeta } from "@tarojs/components";
import { Popup } from "@antmjs/vantui";
import "./popup.less";
import "./popup-alert.less";
import { go } from "../../utils/traoAPI";
@ -47,9 +48,14 @@ export default class PopupAlert extends Component<any, any> {
let { type } = this.props;
switch (type) {
case "1":
case "1": // 未注册
go("/pages/register/register");
break;
case "2": // 登录过期
go("/pages/login/login");
break;
case "3": // 前端提示-关注公众号
break;
}
this.props.confirm();
};
@ -67,6 +73,7 @@ export default class PopupAlert extends Component<any, any> {
isShow,
isClose,
isLarge,
type,
} = this.props;
return (
<Block>
@ -101,11 +108,24 @@ export default class PopupAlert extends Component<any, any> {
{content}
</View>
</View>
<View className="common-popup-btns">
<Button className="common-popup-btn" onClick={this.onConfirm}>
{confirmButtonText}
</Button>
</View>
{type === "3" && (
<View className="type3btn" onClick={this.onConfirm}>
<Image
className="checked"
src={require("../../img/welcome/checked.png")}
></Image>
<Text className="text"></Text>
</View>
)}
{type !== "3" && (
<View className="common-popup-btns">
<Button className="common-popup-btn" onClick={this.onConfirm}>
{confirmButtonText}
</Button>
</View>
)}
</View>
</Popup>
</Block>

@ -25,7 +25,7 @@
.common-popup-content {
font-size: 28rpx;
margin-bottom: 20rpx;
max-height: 600rpx;
max-height: 700rpx;
overflow-y: auto;
}

@ -29,9 +29,16 @@ export default class About extends Component<any, any> {
componentDidHide() {}
async initData() {
let res = await GetAboutUs();
if (res.data.code === 200) {
this.setState({ version: res.data.data.value });
// let res = await GetAboutUs();
// if (res.data.code === 200) {
// this.setState({ version: res.data.data.value });
// }
const accountInfo = Taro.getAccountInfoSync();
console.log("accountInfo", accountInfo);
if (accountInfo?.miniProgram?.version) {
this.setState({
version: accountInfo?.miniProgram?.version || "暂无",
});
}
}

@ -1,5 +1,6 @@
import { Component, PropsWithChildren, useEffect, useState } from "react";
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 "./integral_list.less";
@ -15,7 +16,12 @@ import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert";
import { GetIntegralRule, GetObtainUserIntegral } from "../../utils/Interface";
import {
GetIntegralRule,
GetObtainUserIntegral,
GetOfficialAccount,
GetIsAttentionOfficialAccount,
} from "../../utils/Interface";
class IntegralList extends Component<any, any> {
constructor(props) {
@ -25,7 +31,8 @@ class IntegralList extends Component<any, any> {
userinfo: this.props.userInfo,
page: 1,
list: [],
isIntegral: false,
isIntegral: false, // 积分规则
isOfficialAccount: false, // 是否关注公众号-一年展示一次
nodes: "",
pageNum: 1,
@ -47,8 +54,40 @@ class IntegralList extends Component<any, any> {
async initData() {
this.GetObtainUserIntegral();
this.checkOfficialAccount();
// this.GetOfficialAccount();
// this.GetIsAttentionOfficialAccount();
}
// 检查是否关注公众号只在每年的09-30号前提醒如果没有关注则弹窗提醒
checkOfficialAccount() {
let currentTime = dayjs().valueOf();
let targetTime = dayjs().month(9).day(30).valueOf();
// 仅9月30日前触发提醒过期弹窗
if (currentTime <= targetTime) {
let isOfficialAccount = Taro.getStorageSync("isOfficialAccount");
if (isOfficialAccount) {
let oldYear = isOfficialAccount;
let currentYear = dayjs().format("YYYY");
if (currentYear < oldYear) {
// 检查:今年未提醒,则弹窗
this.setState({ isOfficialAccount: true });
}
} else {
this.setState({ isOfficialAccount: true });
}
}
}
GetOfficialAccount = async () => {
let res = await GetOfficialAccount();
console.log("GetOfficialAccount", res);
};
GetIsAttentionOfficialAccount = async () => {
let res = await GetIsAttentionOfficialAccount();
console.log("GetIsAttentionOfficialAccount", res);
};
GetObtainUserIntegral = async () => {
let { list, pageNum, pageSize } = this.state;
let res = await GetObtainUserIntegral({
@ -82,8 +121,18 @@ class IntegralList extends Component<any, any> {
this.setState({ isIntegral: false });
};
/** 关注公众号弹窗 */
officialPopupConfirm = () => {
let currentYear = dayjs().format("YYYY");
Taro.setStorageSync("isOfficialAccount", currentYear); // 标记:本年度已提醒
this.officialPopupClose();
};
officialPopupClose = () => {
this.setState({ isOfficialAccount: false });
};
render() {
let { list, userinfo, isIntegral, nodes } = this.state;
let { list, userinfo, isIntegral, isOfficialAccount, nodes } = this.state;
return (
<Block>
<PopupAlert
@ -97,6 +146,32 @@ class IntegralList extends Component<any, any> {
close={this.integralPopupClose}
confirm={this.integralPopupClose}
></PopupAlert>
<PopupAlert
isLarge={true}
isClose={true}
isShow={isOfficialAccount}
title="过期积分提醒"
type="3"
content={
<View style={{ height: "700rpx" }}>
<Image
style={{
width: "100%",
height: "600rpx",
backgroundColor: "#666",
}}
src=""
></Image>
<View style={{ marginTop: "20rpx" }}>
</View>
</View>
}
confirmButtonText="我知道了"
textAlgin="center"
close={this.officialPopupClose}
confirm={this.officialPopupConfirm}
></PopupAlert>
<Navbar titleSlot="我的积分" isBack={true}></Navbar>
<View style="background: #f3f3f3;padding: 33rpx 30rpx 31rpx 30rpx;">

@ -9,8 +9,6 @@ import { connect } from "react-redux";
import { setMobile } from "../../store/features/userInfo";
/*** redux end ***/
import { go } from "../../utils/traoAPI";
import "taro-ui/dist/style/components/button.scss"; // 按需引入
import "./login.less";
@ -39,7 +37,9 @@ class Login extends Component<any, any> {
if (data.code === 200) {
Taro.setStorageSync("token", data.data.token);
this.props.setMobile(data.data.mobile);
go("/pages/index/index");
Taro.switchTab({
url: "/pages/index/index",
});
}
};

@ -30,9 +30,8 @@ export default class Message extends Component<any, any> {
list: [],
pageNum: 1,
pageSize: 10,
total: 0,
scrollTop: 0,
// downText: "下拉刷新",
pullText: "上拉加载更多",
isBottom: false, // 是否触底
start_p: {},
scrollY: true,
@ -67,9 +66,10 @@ export default class Message extends Component<any, any> {
});
if (res.data.code === 200) {
if (res.data.rows.length) {
list = [].concat(list, res.data.rows);
console.log("list", list);
this.setState({ list: list });
let newList = [].concat(list, res.data.rows);
setTimeout(() => {
this.setState({ list: newList, dargState: 0, total: res.data.total });
}, 500);
}
}
};
@ -82,34 +82,13 @@ export default class Message extends Component<any, any> {
}
};
// onRefresh: IPullToRefreshProps["onRefresh"] = () => {
// return new Promise((resolve) => {
// setTimeout(() => {
// resolve(undefined);
// }, 1000);
// });
// };
// _onscroll = (e) => this.setTop(e.detail.scrollTop);
// setTop = (value) => {
// console.log("setTop", value);
// };
/*** 上拉加载 ***/
reduction = () => {
//还原初始设置
const time = 0.5;
// const time = 0.5;
this.setState({
// dargState: 0,
scrollY: true,
});
setTimeout(() => {
this.setState({
pullText: "上拉加载更多",
// downText: "下拉刷新",
});
}, time * 1000);
};
touchStart = (e) => {
this.setState({
@ -135,7 +114,7 @@ export default class Message extends Component<any, any> {
if (move_y - start_y > 0) {
//下拉操做
if (pY >= deviationY) {
this.setState({ dargState: 1, downText: "释放刷新" });
// this.setState({ dargState: 1, downText: "释放刷新" });
} else {
// this.setState({ dargState: 0, downText: "下拉刷新" });
}
@ -150,9 +129,7 @@ export default class Message extends Component<any, any> {
//上拉操做
// console.log("上拉操做");
if (pY >= deviationY) {
this.setState({ dargState: -1, pullText: "释放加载更多" });
} else {
// this.setState({ dargState: 0, pullText: "上拉加载更多" });
this.setState({ dargState: -1 });
}
}
}
@ -160,8 +137,15 @@ export default class Message extends Component<any, any> {
pull = () => {
//上拉
console.log("上拉");
// this.props.onPull()
let { list, total, pageNum, dargState } = this.state;
if (dargState === -1) {
if (list.length < total) {
this.setState({ pageNum: pageNum + 1 });
setTimeout(() => {
this.GetMessageList();
}, 100);
}
}
};
down = () => {
//下拉
@ -184,7 +168,7 @@ export default class Message extends Component<any, any> {
} else if (this.state.dargState === -1) {
this.pull();
}
this.reduction();
// this.reduction();
};
/*** 上拉加载 ***/
@ -193,7 +177,7 @@ export default class Message extends Component<any, any> {
// };
render() {
let { list, scrollTop, dargState, pullText } = this.state;
let { total, list, dargState } = this.state;
return (
<Block>
<Navbar isBack={true}></Navbar>
@ -281,13 +265,19 @@ export default class Message extends Component<any, any> {
</View>
</ScrollView>
<View className="upDragBox">
{dargState === 0 ? (
"上拉加载更多"
) : (
<Loading size="24px">...</Loading>
)}
</View>
{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 && (
<Text style="color: #666"></Text>
)}
</View>
{/*
<View className="message" style="padding-top: 13rpx">

@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "护理历程",
});

@ -0,0 +1,32 @@
import { Component, PropsWithChildren, useEffect, useState } from "react";
import Taro from "@tarojs/taro";
import { Block, View, Text, Image, Input, Button } from "@tarojs/components";
import { Tab, Tabs } from "@antmjs/vantui";
import "./recording.less";
export default class Recording extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
name: "护理历程",
};
}
async onLoad() {}
componentDidMount() {}
componentWillUnmount() {}
componentDidShow() {}
componentDidHide() {}
async initData() {}
render() {
let { name } = this.state;
return <View>{name}</View>;
}
}

@ -86,14 +86,6 @@ export const GetUserMobile = (data = { code: "" }) => {
});
};
export const getIntegralRule = (data) => {
//积分规则
return Ajax({
url: "/hzwx/setting/getIntegralRule",
data,
});
};
export const getAboutUs = (data) => {
//关于我们
return Ajax({
@ -156,6 +148,7 @@ export const GetMessageList = (data) => {
});
};
// 积分页面
export const GetObtainUserIntegral = (data) => {
// 分页获取用户积分列表
return Ajax({
@ -164,7 +157,6 @@ export const GetObtainUserIntegral = (data) => {
method: "get",
});
};
export const GetIntegralRule = (data) => {
// 获取积分规则
return Ajax({
@ -173,7 +165,6 @@ export const GetIntegralRule = (data) => {
method: "get",
});
};
export const GetIsAttentionOfficialAccount = (data) => {
// 查询用户是否关注公众号
return Ajax({
@ -182,7 +173,6 @@ export const GetIsAttentionOfficialAccount = (data) => {
method: "get",
});
};
export const GetOfficialAccount = (data) => {
// 查询用户是否关闭提醒关注公众号
return Ajax({

@ -46,11 +46,11 @@ export const Ajax = (params) => {
content: "登录已过期,请重新登录",
showCancel: false,
}).then((res) => {
sessionStorage.setItem("token", null);
Taro.setStorageSync("token", null);
Taro.clearStorage(); // 清空所有缓存
Taro.reLaunch({
// url: "/pages/login/login",
url: "/pages/initiate/initiate",
url: "/pages/login/login",
});
});
return;
@ -82,10 +82,10 @@ export const Ajax = (params) => {
}).then(() => {
reject(res);
if (res.data.code == 403 || res.data.msg === "登录状态已过期") {
sessionStorage.setItem("token", null);
Taro.setStorageSync("token", null);
Taro.reLaunch({
// url: "/pages/login/login",
url: "/pages/initiate/initiate",
url: "/pages/login/login",
});
}
});
@ -201,10 +201,10 @@ export const AjaxFormData = (params) => {
content: "登录已过期,请重新登录",
showCancel: false,
}).then((res) => {
sessionStorage.setItem("token", null);
Taro.setStorageSync("token", null);
Taro.clearStorage(); // 清空所有缓存
Taro.reLaunch({
url: "/pages/initiate/initiate",
url: "/pages/login/login",
});
});
return;
@ -231,9 +231,9 @@ export const AjaxFormData = (params) => {
}).then(() => {
reject(res);
if (res.data.code == 403 || res.data.msg === "登录状态已过期") {
sessionStorage.setItem("token", null);
Taro.setStorageSync("token", null);
Taro.reLaunch({
url: "/pages/initiate/initiate",
url: "/pages/login/login",
});
}
});

@ -206,7 +206,7 @@
dependencies:
"@babel/types" "^7.23.0"
"@babel/helper-module-imports@^7.22.15":
"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.22.15":
"integrity" "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w=="
"resolved" "https://registry.npmmirror.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz"
"version" "7.22.15"
@ -4168,6 +4168,13 @@
dependencies:
"object.assign" "^4.1.0"
"babel-plugin-import@^1.13.8":
"integrity" "sha512-36babpjra5m3gca44V6tSTomeBlPA7cHUynrE2WiQIm3rEGD9xy28MKsx5IdO45EbnpJY7Jrgd00C6Dwt/l/2Q=="
"resolved" "https://registry.npmmirror.com/babel-plugin-import/-/babel-plugin-import-1.13.8.tgz"
"version" "1.13.8"
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"babel-plugin-minify-dead-code-elimination@^0.5.2":
"integrity" "sha512-krq9Lwi0QIzyAlcNBXTL4usqUvevB4BzktdEsb8srcXC1AaYqRJiAQw6vdKdJSaXbz6snBvziGr6ch/aoRCfpA=="
"resolved" "https://registry.npmmirror.com/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.2.tgz"

Loading…
Cancel
Save