迭代1-大部分功能完成,ui调试中

master
blak-kong 2 years ago
parent 11bcd78cfe
commit 68ef3c869d

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

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

@ -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<any, any> {
}
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<any, any> {
height: navigationBarHeightRpx + "rpx",
lineHeight: navigationBarHeightRpx + "rpx",
paddingTop: statusBarHeightRpx + "rpx",
background: transparent ? "transparent" : "#fff",
}}
>
<View className="back">

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

@ -227,7 +227,6 @@ class Index extends Component<any, any> {
content="页面正在开发中"
confirmButtonText="确定"
textAlgin="center"
type="1"
confirm={this.closeDev}
/>
<PopupPrivacy

@ -17,7 +17,7 @@ const Toast_ = Toast.createOnlyToast();
/*** redux ***/
import { connect } from "react-redux";
import { setMobile } from "../../store/features/userInfo";
import { userRefresh } from "../../store/features/userInfo";
/*** redux end ***/
import "taro-ui/dist/style/components/button.scss"; // 按需引入
@ -111,7 +111,7 @@ class Initiate extends Component<any, any> {
// 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);

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

@ -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<any, any> {
class IntegralList extends Component<any, any> {
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<any, any> {
confirm={this.integralPopupClose}
></PopupAlert>
<Navbar titleSlot="我的积分" isBack={true}></Navbar>
<View style="background: #f3f3f3;padding: 33rpx 30rpx 31rpx;">
<View style="background: #f3f3f3;padding: 33rpx 30rpx 31rpx 30rpx;">
<View className="infobox1">
<View
className="info1 flex aitems"
@ -108,7 +114,7 @@ export default class IntegralList extends Component<any, any> {
</View>
</View>
<View className="info3"></View>
<View className="info2">{userinfo.credit2}</View>
<View className="info2">{userinfo.credit}</View>
<View className="info4 flex aitems jcenter">
<View className="tip1" onClick={this.navigateToMiniProgram}>
@ -138,11 +144,13 @@ export default class IntegralList extends Component<any, any> {
<View className="list" key={key}>
<View className="list_block flex aitems sb">
<View className="left">
<View className="tip1">{item.log}</View>
<View className="tip2">{item.addtime}</View>
<View className="tip1">{item.remarkContent}</View>
<View className="tip2">{item.createTime}</View>
</View>
<View className="rights" style={item.style}>
{item.credit}
{item.source === "1"
? "+" + item.floatScore
: "-" + item.floatScore}
</View>
</View>
</View>
@ -153,3 +161,13 @@ export default class IntegralList extends Component<any, any> {
);
}
}
// export default IntegralList
const mapStateToProps = (state) => ({
userInfo: state.userInfo,
});
const mapDispatchToProps = (dispatch) => ({
userRefresh(data) {
dispatch(userRefresh(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(IntegralList);

@ -50,6 +50,7 @@ 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 });
}
}
@ -68,36 +69,33 @@ export default class Message extends Component<any, any> {
return (
<Block>
<Navbar isBack={true}></Navbar>
<View style="padding-top: 13rpx">
<View className="message" style="padding-top: 13rpx">
{list.map((item: any, key: number) => {
<Block>
<View
className="infobox1"
onClick={this.godetail}
data-item={item}
key={key}
>
<View className="info1 flex aitems sb">
<View className="left flex aitems">
<View className="icon">
<Image
src={require("../../img/logos.png")}
mode="aspectFill"
/>
return (
<Block>
<View className="infobox1" onClick={this.godetail} key={key}>
<View className="info1 flex aitems sb">
<View className="left flex aitems">
<View className="icon">
<Image
src={require("../../img/logos.png")}
mode="aspectFill"
/>
</View>
<View className="tip1"></View>
</View>
<View className="tip1"></View>
<View className="right">{item.createTime}</View>
</View>
<View className="right">{item.addtime}</View>
</View>
<View className="info2">
<View className="content">
<Text>
[]: {item.content ? item.content : ""}
</Text>
<View className="info2">
<View className="content">
<Text>
[]: {item.content ? item.content : ""}
</Text>
</View>
</View>
</View>
</View>
</Block>;
</Block>
);
})}
</View>

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

@ -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<any, any> {
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<any, any> {
};
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<any, any> {
};
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<any, any> {
render() {
let {
userinfo,
userInfo,
count,
lastDay,
num,
messagecount,
isNotRegister,
isShowCustomerService,
@ -150,11 +145,17 @@ class User extends Component<any, any> {
return (
<Block>
<Navbar></Navbar>
<Navbar transparent={true}></Navbar>
<View className="user_bg_card">
<Image
src={require("../../img/user/user-bg.png")}
mode="aspectFill"
></Image>
</View>
<View className="info_box">
<View className="infobox1">
<View className="img">
<Image src={userinfo.headimg} mode="widthFix" />
<Image src={userInfo.headimg} mode="widthFix" />
</View>
<View
className="info1 flex aitems"
@ -163,13 +164,13 @@ class User extends Component<any, any> {
<View className="tipbox flex aitems">
<View className="tip1 flex aitems">
<View className="name">
{userinfo.nickname
? userinfo.nickname
: "用户" + (userinfo.id || "001")}
{userInfo.nickname
? userInfo.nickname
: "用户" + (userInfo.id || "001")}
</View>
</View>
{userinfo.id ? (
<View className="tip2"> :{userinfo.id}</View>
{userInfo.id ? (
<View className="tip2"> :{userInfo.id}</View>
) : (
<View className="tip2"> : 001</View>
)}
@ -214,12 +215,12 @@ class User extends Component<any, any> {
/>
</View>
</View>
<View className="num">{userinfo.credit2}</View>
<View className="num">{userInfo.credit}</View>
<View className="txt">{lastDay}</View>
</View>
</View>
<View className="info3">
{lastDay}: {num}
{lastDay}: {userInfo.expireCredit}
</View>
</View>

@ -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<any, any> {
class UserInfo extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
@ -48,6 +54,7 @@ export default class UserInfo extends Component<any, any> {
nickname: "",
birthday: new Date().getTime(),
},
isShowIntegralText: false,
cityShow: false,
timeShow: false,
columns: [
@ -161,6 +168,21 @@ export default class UserInfo extends Component<any, any> {
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<any, any> {
}
}
closeIntegralText = () => {
this.setState({ isShowIntegralText: false });
};
render() {
let {
titleHeight,
@ -329,6 +355,7 @@ export default class UserInfo extends Component<any, any> {
form,
minDate,
isSubmit,
isShowIntegralText,
} = this.state;
const formatter = (type, value) => {
if (type === "year") {
@ -341,6 +368,14 @@ export default class UserInfo extends Component<any, any> {
};
return (
<Block>
<PopupAlert
isShow={isShowIntegralText}
title="提示"
content={userInfo.integralText}
confirmButtonText="确定"
textAlgin="center"
confirm={this.closeIntegralText}
/>
<Navbar></Navbar>
<View style={titleHeight}></View>
<View className="main">
@ -451,3 +486,13 @@ export default class UserInfo extends Component<any, any> {
);
}
}
const mapStateToProps = (state) => ({
userInfo: state.userInfo,
});
const mapDispatchToProps = (dispatch) => ({
userRefresh(data) {
dispatch(userRefresh(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(UserInfo);

@ -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<any, any> {
userInfo: {
...this.props.userInfo,
},
isShowIntegralText: false,
cityShow: false,
timeShow: false,
columns: [
@ -192,16 +194,20 @@ class UserInfoDetail extends Component<any, any> {
}
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<any, any> {
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<any, any> {
return (
<Block>
<Navbar isBack={true}></Navbar>
<PopupAlert
isShow={isShowIntegralText}
title="提示"
content={userInfo.integralText}
confirmButtonText="确定"
textAlgin="center"
confirm={this.closeIntegralText}
/>
<View className="infobox1">
<Button
className="avatar_box"
@ -442,10 +468,6 @@ class UserInfoDetail extends Component<any, any> {
const mapStateToProps = (state) => ({
userInfo: state.userInfo,
// mobile: state.userInfo.mobile,
// nickname: state.userInfo.nickname,
// headimg: state.userInfo.headimg,
// birthday: state.userInfo.birthday,
});
const mapDispatchToProps = (dispatch) => ({
userRefresh(data) {

@ -18,8 +18,9 @@ const userInfoReducer = createSlice({
area: "", // 区
areaId: "",
token: "", // token
integralText: 0, // 积分
credit: 0, // 积分
expireCredit: 0, // 过期积分
integralText: "",
},
reducers: {
setMobile(state, { payload }) {
@ -45,8 +46,9 @@ const userInfoReducer = createSlice({
state.area = payload.area || "";
state.areaId = payload.areaId || "";
state.token = payload.token || "";
state.integralText = payload.integralText || 0;
state.expireCredit = payload.integralText || 0;
state.credit = payload.credit || 0;
state.expireCredit = payload.expireCredit || 0;
state.integralText = payload.integralText || "";
},
},
});

Loading…
Cancel
Save