diff --git a/src/app.tsx b/src/app.tsx index 796767c..e30334b 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -13,11 +13,7 @@ import store from "./store"; import "taro-ui/rn/style/components/icon.scss"; import "@antmjs/vantui/es/datetime-picker/index.less"; -import "@antmjs/vantui/es/popup/index.less"; -import "@antmjs/vantui/es/dialog/index.less"; import "@antmjs/vantui/es/transition/index.less"; -import "@antmjs/vantui/es/overlay/index.less"; -import "@antmjs/vantui/es/nav-bar/index.less"; import "@antmjs/vantui/es/toast/index.less"; import "@antmjs/vantui/es/picker/index.less"; import "@antmjs/vantui/es/picker-column/index.less"; diff --git a/src/components/modal/registerModal/registerModal.less b/src/components/modal/registerModal/registerModal.less deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/modal/registerModal/registerModal.tsx b/src/components/modal/registerModal/registerModal.tsx deleted file mode 100644 index b295a5a..0000000 --- a/src/components/modal/registerModal/registerModal.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import { Component } from "react"; - -import { Dialog } from "@antmjs/vantui"; -const Dialog_ = Dialog.createOnlyDialog(); - -/*** redux ***/ -import { connect } from "react-redux"; -import { setColor, resetColor } from "../../../store/features/navigation"; -import { userRefresh } from "../../../store/features/userInfo"; -/*** redux end ***/ - -import "./registerModal.less"; -import { Block } from "@tarojs/components"; -import { go } from "../../../utils/traoAPI"; - -class RegisterModal extends Component { - constructor(props) { - super(props); - - this.state = { - name: "导航组件", - statusBarHeight: 40, // 状态栏高度 - navigationBarHeight: 0, // 导航栏高度 - navHeight: 40, - }; - this.initData(); - } - - async onLoad() { - // // 状态栏高度 - } - componentDidMount() {} - - componentWillUnmount() {} - - componentDidShow() {} - - componentDidHide() {} - - async initData() { - this.alertRegister(); - } - - public alertRegister = () => { - if (!this.props.mobile) { - this.setColor("#4C4C4C"); - setTimeout(() => { - Dialog_.alert({ - title: "提示", - message: "暂未授权注册,请点击注册", - theme: "round-button", - }).then((value) => { - this.resetColor(); - this.goRegister(); - }); - }, 300); - } else { - go("/pages/instrument/instrument"); - } - }; - - setColor = (color) => { - this.props.setColor(color); - }; - resetColor = () => { - this.props.resetColor(); - }; - - goRegister() { - go("/pages/register/register"); - } - - render() { - return ( - - - - ); - } -} - -const mapStateToProps = (state) => ({ - mobile: state.userInfo.mobile, -}); -const mapDispatchToProps = (dispatch) => ({ - setColor(color) { - dispatch(setColor(color)); - }, - resetColor() { - dispatch(resetColor()); - }, - userRefresh(data) { - dispatch(userRefresh(data)); - }, -}); -export default connect(mapStateToProps, mapDispatchToProps)(RegisterModal); diff --git a/src/components/navbar/navbar.tsx b/src/components/navbar/navbar.tsx index 0690145..e22d07d 100644 --- a/src/components/navbar/navbar.tsx +++ b/src/components/navbar/navbar.tsx @@ -1,7 +1,7 @@ import { Component } from "react"; import Taro from "@tarojs/taro"; -import { Block, View, Text, Image } from "@tarojs/components"; +import { Block, View, Image } from "@tarojs/components"; import { back } from "../../utils/traoAPI"; import "./navbar.less"; @@ -60,7 +60,7 @@ export default class Navbar extends Component { } render() { - let { isBack, leftSlot, titleSlot } = this.props; + let { isBack, leftSlot, titleSlot, transparent } = this.props; let { statusBarHeight, navigationBarHeight, navHeight } = this.state; const statusBarHeightRpx = statusBarHeight * 2; const navigationBarHeightRpx = navigationBarHeight * 2; @@ -73,6 +73,7 @@ export default class Navbar extends Component { height: navigationBarHeightRpx + "rpx", lineHeight: navigationBarHeightRpx + "rpx", paddingTop: statusBarHeightRpx + "rpx", + background: transparent ? "transparent" : "#fff", }} > diff --git a/src/img/user/user-bg.png b/src/img/user/user-bg.png new file mode 100644 index 0000000..993b169 Binary files /dev/null and b/src/img/user/user-bg.png differ diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index e8437c2..a4f219c 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -227,7 +227,6 @@ class Index extends Component { content="页面正在开发中" confirmButtonText="确定" textAlgin="center" - type="1" confirm={this.closeDev} /> { // setGlobalData("token", data.data.token); Taro.setStorageSync("token", data.data.token); Taro.setStorageSync("mobile", data.data.mobile); - this.props.setMobile(data.data.mobile); + this.props.userRefresh(data.data); } } @@ -201,8 +201,8 @@ const mapStateToProps = (state) => ({ mobile: state.userInfo.mobile, }); const mapDispatchToProps = (dispatch) => ({ - setMobile(value) { - dispatch(setMobile(value)); + userRefresh(value) { + dispatch(userRefresh(value)); }, }); export default connect(mapStateToProps, mapDispatchToProps)(Initiate); diff --git a/src/pages/integral_list/integral_list.less b/src/pages/integral_list/integral_list.less index 89284ce..5c63aea 100644 --- a/src/pages/integral_list/integral_list.less +++ b/src/pages/integral_list/integral_list.less @@ -1,5 +1,6 @@ page { background: #ffffff; + font-family: PingFang SC; } .infobox1 { height: 320rpx; @@ -27,19 +28,22 @@ page { padding-right: 23rpx; font-size: 26rpx; font-weight: 500; - color: #818181; + color: #000; } .icon { width: 10rpx; height: 20rpx; + color: #000; } } .info2 { text-align: center; - padding-top: 22rpx; + padding-top: 28rpx; font-size: 72rpx; font-weight: 600; color: #000000; + height: 56rpx; + line-height: 56rpx; } .info3 { text-align: center; @@ -49,7 +53,7 @@ page { padding-top: 55rpx; } .info4 { - margin: 30rpx auto 0; + margin: 42rpx auto 0; text-align: center; .tip1 { font-weight: bold; @@ -78,14 +82,16 @@ page { margin-bottom: 34rpx; } } - .list_block { - width: 100%; - border-bottom: 2rpx solid #dddddd; - padding: 27rpx 0; - } + .list { background: #fff; - padding: 0rpx 30rpx; + // padding: 34rpx; + .list_block { + width: 100%; + border-bottom: 2rpx solid #dddddd; + padding: 30rpx 34rpx; + box-sizing: border-box; + } .left { .tip1 { font-size: 28rpx; @@ -93,7 +99,7 @@ page { color: #030000; } .tip2 { - margin-top: 14rpx; + margin-top: 34rpx; font-size: 24rpx; font-weight: 500; color: #999999; diff --git a/src/pages/integral_list/integral_list.tsx b/src/pages/integral_list/integral_list.tsx index 90c9e0b..3ff9777 100644 --- a/src/pages/integral_list/integral_list.tsx +++ b/src/pages/integral_list/integral_list.tsx @@ -4,6 +4,11 @@ import { Block, View, Text, Image, RichText } from "@tarojs/components"; import "./integral_list.less"; +/*** redux ***/ +import { connect } from "react-redux"; +import { userRefresh } from "../../store/features/userInfo"; +/*** redux end ***/ + /** 自定义组件 **/ import Navbar from "../../components/navbar/navbar"; /** 自定义组件 **/ @@ -12,12 +17,12 @@ import PopupAlert from "../../components/popup/popup-alert"; import { GetIntegralRule, GetObtainUserIntegral } from "../../utils/Interface"; -export default class IntegralList extends Component { +class IntegralList extends Component { constructor(props) { super(props); this.state = { name: "我的积分", - userinfo: {}, + userinfo: this.props.userInfo, page: 1, list: [], isIntegral: false, @@ -93,7 +98,8 @@ export default class IntegralList extends Component { confirm={this.integralPopupClose} > - + + { 可用积分 - {userinfo.credit2} + {userinfo.credit} 前往积分商城 @@ -138,11 +144,13 @@ export default class IntegralList extends Component { - {item.log} - {item.addtime} + {item.remarkContent} + {item.createTime} - {item.credit} + {item.source === "1" + ? "+" + item.floatScore + : "-" + item.floatScore} @@ -153,3 +161,13 @@ export default class IntegralList extends Component { ); } } +// export default IntegralList +const mapStateToProps = (state) => ({ + userInfo: state.userInfo, +}); +const mapDispatchToProps = (dispatch) => ({ + userRefresh(data) { + dispatch(userRefresh(data)); + }, +}); +export default connect(mapStateToProps, mapDispatchToProps)(IntegralList); diff --git a/src/pages/message/message.tsx b/src/pages/message/message.tsx index 92d964c..839de92 100644 --- a/src/pages/message/message.tsx +++ b/src/pages/message/message.tsx @@ -50,6 +50,7 @@ export default class Message extends Component { if (res.data.code === 200) { if (res.data.rows.length) { list = [].concat(list, res.data.rows); + console.log("list", list); this.setState({ list: list }); } } @@ -68,36 +69,33 @@ export default class Message extends Component { return ( - + {list.map((item: any, key: number) => { - - - - - - + return ( + + + + + + + + 系统通知 - 系统通知 + {item.createTime} - {item.addtime} - - - - - [花至官方旗舰店]: {item.content ? item.content : ""} - + + + + [花至官方旗舰店]: {item.content ? item.content : ""} + + - - ; + + ); })} diff --git a/src/pages/user/user.less b/src/pages/user/user.less index 34b8e4e..2306caa 100644 --- a/src/pages/user/user.less +++ b/src/pages/user/user.less @@ -21,7 +21,7 @@ page { .infobox1 { border-radius: 20rpx; - margin-top: 140rpx; + margin-top: 168rpx; /*height: 490rpx;*/ } .infobox1 .info1 { @@ -216,3 +216,16 @@ page { color: #cccccc; line-height: 60rpx; } + +.user_bg_card { + position: absolute; + top: 0; + left: 0; + right: 0; + width: 100vw; + height: 400rpx; + image { + width: 100%; + height: 100%; + } +} diff --git a/src/pages/user/user.tsx b/src/pages/user/user.tsx index b3c48e9..9338689 100644 --- a/src/pages/user/user.tsx +++ b/src/pages/user/user.tsx @@ -1,4 +1,5 @@ import { SaveMessage } from "../../utils/Interface"; +import dayjs from "dayjs"; import { Component, PropsWithChildren, useEffect, useState } from "react"; import Taro from "@tarojs/taro"; // 引入 Swiper, SwiperItem 组件 @@ -29,16 +30,11 @@ class User extends Component { super(props); this.state = { name: "user", - userinfo: { - mobile: this.props.userInfo.mobile, - nickname: this.props.userInfo.nickname, - headimg: this.props.userInfo.headimg, - id: this.props.userInfo.id, - }, + userInfo: this.props.userInfo, MerchMobile: "", count: 0, year: new Date().getFullYear(), - lastDay: "", + lastDay: dayjs().endOf("month").format("YYYY-MM-DD"), messagecount: 0, isNotRegister: false, // 是否未注册 isShowCustomerService: false, // 反馈留言 @@ -72,8 +68,8 @@ class User extends Component { }; gourl = (e) => { - let { userinfo } = this.state; - if (!userinfo.mobile) { + let { userInfo } = this.state; + if (!userInfo.mobile) { this.setState({ isNotRegister: true }); // 打开弹窗 return; } @@ -88,7 +84,7 @@ class User extends Component { }; gourls = (e) => { let url = e.currentTarget.dataset.url; - if (url === "/pages/register/register" && this.state.userinfo.mobile) { + if (url === "/pages/register/register" && this.state.userInfo.mobile) { url = "/pages/userInfoDetail/userInfoDetail"; } Taro.navigateTo({ @@ -139,10 +135,9 @@ class User extends Component { render() { let { - userinfo, + userInfo, count, lastDay, - num, messagecount, isNotRegister, isShowCustomerService, @@ -150,11 +145,17 @@ class User extends Component { return ( - + + + + - + { - {userinfo.nickname - ? userinfo.nickname - : "用户" + (userinfo.id || "001")} + {userInfo.nickname + ? userInfo.nickname + : "用户" + (userInfo.id || "001")} - {userinfo.id ? ( - 用户编号 :{userinfo.id} + {userInfo.id ? ( + 用户编号 :{userInfo.id} ) : ( 用户编号 : 001 )} @@ -214,12 +215,12 @@ class User extends Component { /> - {userinfo.credit2} + {userInfo.credit} {lastDay}过期 - {lastDay}过期积分: {num} + {lastDay}过期积分: {userInfo.expireCredit} diff --git a/src/pages/userInfo/userInfo.tsx b/src/pages/userInfo/userInfo.tsx index b17f878..159009f 100644 --- a/src/pages/userInfo/userInfo.tsx +++ b/src/pages/userInfo/userInfo.tsx @@ -25,8 +25,14 @@ import { Toast, Picker, Popup, DatetimePicker } from "@antmjs/vantui"; import "taro-ui/dist/style/components/button.scss"; // 按需引入 import "./userInfo.less"; +/*** redux ***/ +import { connect } from "react-redux"; +import { userRefresh } from "../../store/features/userInfo"; +/*** redux end ***/ + /** 自定义组件 **/ import Navbar from "../../components/navbar/navbar"; +import PopupAlert from "../../components/popup/popup-alert"; /** 自定义组件 **/ import { getGlobalData, setGlobalData } from "../../utils/global"; @@ -35,7 +41,7 @@ import FormData from "../../utils/wx-formdata/formData"; // 仅注册成功后进入此页面 -export default class UserInfo extends Component { +class UserInfo extends Component { constructor(props) { super(props); this.state = { @@ -48,6 +54,7 @@ export default class UserInfo extends Component { nickname: "", birthday: new Date().getTime(), }, + isShowIntegralText: false, cityShow: false, timeShow: false, columns: [ @@ -161,6 +168,21 @@ export default class UserInfo extends Component { let data = formData.getData(); let res = await UpdateUser(data); console.log("UpdateUser", res); + 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; + this.props.userRefresh(userInfo); + this.setState({ userInfo: userInfo }); + + if (userInfo.integralText) { + this.setState({ isShowIntegralText: true }); + } + } }; getChooseAvatar = (event) => { @@ -318,6 +340,10 @@ export default class UserInfo extends Component { } } + closeIntegralText = () => { + this.setState({ isShowIntegralText: false }); + }; + render() { let { titleHeight, @@ -329,6 +355,7 @@ export default class UserInfo extends Component { form, minDate, isSubmit, + isShowIntegralText, } = this.state; const formatter = (type, value) => { if (type === "year") { @@ -341,6 +368,14 @@ export default class UserInfo extends Component { }; return ( + @@ -451,3 +486,13 @@ export default class UserInfo extends Component { ); } } + +const mapStateToProps = (state) => ({ + userInfo: state.userInfo, +}); +const mapDispatchToProps = (dispatch) => ({ + userRefresh(data) { + dispatch(userRefresh(data)); + }, +}); +export default connect(mapStateToProps, mapDispatchToProps)(UserInfo); diff --git a/src/pages/userInfoDetail/userInfoDetail.tsx b/src/pages/userInfoDetail/userInfoDetail.tsx index 2f65d28..a404e98 100644 --- a/src/pages/userInfoDetail/userInfoDetail.tsx +++ b/src/pages/userInfoDetail/userInfoDetail.tsx @@ -27,6 +27,7 @@ import { userRefresh } from "../../store/features/userInfo"; /** 自定义组件 **/ import Navbar from "../../components/navbar/navbar"; +import PopupAlert from "../../components/popup/popup-alert"; /** 自定义组件 **/ import { getGlobalData, setGlobalData } from "../../utils/global"; @@ -45,6 +46,7 @@ class UserInfoDetail extends Component { userInfo: { ...this.props.userInfo, }, + isShowIntegralText: false, cityShow: false, timeShow: false, columns: [ @@ -192,16 +194,20 @@ class UserInfoDetail extends Component { } let data = formData.getData(); let res = await UpdateUser(data); - console.log("UpdateUser", res); if (res.data.code === 200) { - // todo - userInfo.province = form.province; - userInfo.city = form.city; - userInfo.area = form.area; - userInfo.provinceId = form.provinceId; - userInfo.cityId = form.cityId; - userInfo.areaId = form.areaId; + 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; this.props.userRefresh(userInfo); + this.setState({ userInfo: userInfo }); + + if (userInfo.integralText) { + this.setState({ isShowIntegralText: true }); + } } }; @@ -309,8 +315,20 @@ class UserInfoDetail extends Component { console.log("onNickNameReView", event); }; + closeIntegralText = () => { + this.setState({ isShowIntegralText: false }); + }; + render() { - let { userInfo, columns, cityShow, timeShow, form, minDate } = this.state; + let { + userInfo, + columns, + cityShow, + timeShow, + form, + minDate, + isShowIntegralText, + } = this.state; const formatter = (type, value) => { if (type === "year") { @@ -324,6 +342,14 @@ class UserInfoDetail extends Component { return ( +