fix:修复bug

master
blak-kong 2 years ago
parent ce6fb9d164
commit 4725f1ec84

@ -10,6 +10,8 @@ import store from "./store";
import "taro-ui/rn/style/components/icon.scss";
import { go } from "./utils/traoAPI";
class App extends Component<PropsWithChildren> {
// 可以使用所有的 React 生命周期方法
componentDidMount() {}

@ -109,7 +109,7 @@ export default class AtCalendarController extends React.Component<any, any> {
// close-icon="/img/fr200/close.png"
round
onClick={this.onClickStop}
onClose={this.onPopupClose}
// onClose={this.onPopupClose}
>
<View className="toolbar">
<View className="toolbar_title">
@ -117,6 +117,7 @@ export default class AtCalendarController extends React.Component<any, any> {
<View
style="margin-left: 20rpx;color:#666;font-size: 34rpx"
className="at-icon at-icon-close popup-date-close"
onClick={this.onPopupClose}
></View>
</View>
<View className="select_box">

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

@ -5,11 +5,16 @@ import Taro from "@tarojs/taro";
// 不能用原生组件,遮罩层会遮不住
import { CoverView, CoverImage, Block, View, Image } from "@tarojs/components";
/** 自定义组件 **/
// import PopupAlert from "../components/popup/popup-alert";
/** 自定义组件 **/
import "./index.less";
export default class Index extends Component {
state = {
isShowPrivacyPopup: true,
isMask: false,
isNotRegister: false,
selected: 2,
color: "#999",
selectedColor: "#000",
@ -50,6 +55,19 @@ export default class Index extends Component {
};
switchTab(index, url) {
// let urlArray = ["pages/index/index", "pages/user/user"];
// if (!urlArray.includes(url)) {
// let mobile = Taro.getStorageSync("mobile");
// if (mobile) {
// this.setSelected(index);
// Taro.switchTab({ url: "/" + url });
// } else {
// this.setState({ isNotRegister: true });
// }
// } else {
// this.setSelected(index);
// Taro.switchTab({ url: "/" + url });
// }
this.setSelected(index);
Taro.switchTab({ url: "/" + url });
}
@ -60,23 +78,40 @@ export default class Index extends Component {
});
}
openMask() {
openMask = () => {
this.setState({
isMask: true,
});
}
};
closeMask() {
closeMask = () => {
this.setState({
isMask: false,
});
}
};
// closeAlert = () => {
// this.setState({
// isNotRegister: false,
// });
// };
render() {
const { list, selected, color, selectedColor, isMask } = this.state;
const { list, selected, color, selectedColor, isMask, isNotRegister } =
this.state;
return (
<Block>
{/* <PopupAlert
isShow={isNotRegister}
title="提示"
content="暂未授权注册,请点击注册"
confirmButtonText="确定"
textAlgin="center"
type="1"
close={this.closeAlert}
confirm={this.closeAlert}
/> */}
<View className={classnames({ "tab-bar-layer": isMask })}>
<View className={classnames("tab-bar")}>
<View className="tab-bar-border"></View>

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

@ -120,7 +120,7 @@ export default class Entry extends Component<any, any> {
}
render() {
let { name, menu, current, welcomeList } = this.state;
let { menu, current, welcomeList } = this.state;
return (
<Block>
<View className="main">
@ -179,6 +179,7 @@ export default class Entry extends Component<any, any> {
{welcomeList.map((item, index) => {
return (
<View
key={"indicator_" + index}
className={classnames("dot", {
"bg-show": current >= index,
})}

@ -90,11 +90,15 @@ class Index extends Component<any, any> {
showInit() {
const isFirst = Taro.getStorageSync("isWelcome");
const mobile = Taro.getStorageSync("mobile");
if (isFirst) {
this.checkShowPrivacyPopup();
this.GetOtherSetting(); // 获取小程序设置:商城地址和版本
this.GetNoReadMessageNum(); // 查询是否有消息
this.RefreshWxUserInfo();
// this.GetOtherSetting(); // 获取小程序设置:商城地址和版本
if (mobile) {
this.GetNoReadMessageNum(); // 查询是否有消息
this.RefreshWxUserInfo();
}
}
}
@ -104,7 +108,7 @@ class Index extends Component<any, any> {
if (isPrivacy !== "true") {
Taro.getPrivacySetting({
success: (res) => {
// console.log(res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
// console.log("检测是否弹出隐私协议", res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
if (res.needAuthorization) {
// 需要弹出隐私协议
const isPrivacyPopup = Taro.getStorageSync("isPrivacyPopup");
@ -200,11 +204,7 @@ class Index extends Component<any, any> {
// 护理记录
toNursingRecords = () => {
if (this.isRegister()) {
// todo
// this.setState({ isDev: true });
go("/pages/recording/recording");
}
go("/pages/recording/recording");
};
gourl = (e) => {
@ -235,6 +235,7 @@ class Index extends Component<any, any> {
confirmButtonText="确定"
textAlgin="center"
type="1"
close={this.closeAlert}
confirm={this.closeAlert}
/>
<PopupAlert
@ -243,6 +244,7 @@ class Index extends Component<any, any> {
content="页面正在开发中"
confirmButtonText="确定"
textAlgin="center"
close={this.closeDev}
confirm={this.closeDev}
/>
<PopupPrivacy

@ -17,6 +17,7 @@ import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert";
import {
GetOtherSetting,
GetIntegralRule,
GetObtainUserIntegral,
GetIsAttentionOfficialAccount,
@ -29,7 +30,9 @@ class IntegralList extends Component<any, any> {
super(props);
this.state = {
name: "我的积分",
userinfo: this.props.userInfo,
userinfo: {
...this.props.userInfo,
},
page: 1,
list: [],
isIntegral: false, // 积分规则
@ -60,6 +63,48 @@ class IntegralList extends Component<any, any> {
this.GetIsAttentionOfficialAccount();
}
openShop = () => {
let { otherSetting } = this.state;
if (otherSetting.skipAppid) {
this.goMiniProgram();
} else {
this.GetOtherSetting(); // 获取小程序设置:商城地址和版本
}
};
// 获取小程序设置
GetOtherSetting = async () => {
let res = await GetOtherSetting();
if (res.data.code === 200) {
this.props.otherSettingRefresh(res.data.data);
let { otherSetting } = this.state;
otherSetting.skipAppid = res.data.data.skipAppid;
otherSetting.skipPath = res.data.data.skipPath;
otherSetting.envVersion = res.data.data.envVersion;
this.setState({ otherSetting });
this.goMiniProgram();
}
};
goMiniProgram = () => {
let { otherSetting } = this.state;
Taro.navigateToMiniProgram({
appId: otherSetting.skipAppid,
path: otherSetting.skipPath,
envVersion: otherSetting.envVersion,
success(res) {
// 打开成功
Taro.reLaunch({
url: "/pages/index/index",
});
},
fail(res) {
Taro.reLaunch({
url: "/pages/index/index",
});
},
});
};
// 检查是否关注公众号只在每年的09-30号前提醒如果没有关注则弹窗提醒
checkOfficialAccount() {
let currentTime = dayjs().valueOf();
@ -116,8 +161,6 @@ class IntegralList extends Component<any, any> {
this.setState({ isIntegral: true });
};
navigateToMiniProgram = () => {};
integralPopupClose = () => {
this.setState({ isIntegral: false });
};
@ -192,7 +235,7 @@ class IntegralList extends Component<any, any> {
<View className="info3"></View>
<View className="info2">{userinfo.credit}</View>
<View className="info4 flex aitems jcenter">
<View className="tip1" onClick={this.navigateToMiniProgram}>
<View className="tip1" onClick={this.openShop}>
</View>
</View>

@ -4,6 +4,11 @@ import Taro from "@tarojs/taro";
// 引入 Swiper, SwiperItem 组件
import { Block, View, Text, Image, Button } from "@tarojs/components";
/*** redux ***/
import { connect } from "react-redux";
import { setMobile } from "../../store/features/userInfo";
/*** redux end ***/
import "taro-ui/dist/style/components/button.scss"; // 按需引入
import "./register.less";
@ -11,20 +16,10 @@ import "./register.less";
import Navbar from "../../components/navbar/navbar";
/** 自定义组件 **/
import {
getUserAgreement,
WCUserLogin,
getPrivacyAgreement,
GetUserMobile,
UserInfoRegister,
MpLoginDetail,
MpSplashDetail,
} from "../../utils/Interface";
import { GetUserMobile, MpSplashDetail } from "../../utils/Interface";
import { go, msg } from "../../utils/traoAPI";
const app = Taro.getApp();
export default class Register extends Component<any, any> {
class Register extends Component<any, any> {
constructor(props) {
super(props);
this.state = {
@ -51,54 +46,16 @@ export default class Register extends Component<any, any> {
* --
*/
async onLoad(options) {
// this.checkPrivacy();
// if(options.fromUrl) {
// this.setData({
// fromUrl: options.fromUrl
// })
// }
// if (options.skipby) {
// this.setData({
// skipby: options.skipby
// })
// }
// if (!Taro.getStorageSync("token")) {
// await this.WCUserLogin();
// }
this.initData();
}
onSkip = () => {
Taro.switchTab({
// go("/pages/instrument/instrument");
Taro.reLaunch({
url: "/pages/index/index",
});
};
onSkipTap = () => {
app.globalData.bindCodeSkipRegister = true;
this.onSkip();
};
// checkPrivacy = () => {
// const res = compareVersion("2.32.3");
// if (res >= 0) {
// // 弹出弹窗
// Taro.getPrivacySetting({
// success: (res) => {
// if (res.needAuthorization) {
// this.setState({
// showPrivacyPopup: true,
// });
// app.globalData.needAuthorization = true;
// }
// },
// fail: (err) => {},
// complete: (res) => {},
// });
// }
// };
onDisagreeTap = () => {
// 关闭小程序
Taro.exitMiniProgram({
@ -116,7 +73,7 @@ export default class Register extends Component<any, any> {
this.setState({
showPrivacyPopup: false,
});
app.globalData.needAuthorization = false;
// app.globalData.needAuthorization = false;
};
onCheck = () => {
@ -137,12 +94,15 @@ export default class Register extends Component<any, any> {
if (res.data) {
const mobile = res.data.data;
Taro.setStorageSync("mobile", mobile);
this.props.setMobile(mobile);
this.changeGetPhoneNumberBtn();
msg("注册成功");
// 注册成功两秒后跳转个人信息完善页
setTimeout(() => {
go("/pages/userInfo/userInfo");
}, 2000);
}, 1000);
} else {
msg("请求异常");
}
} catch (error) {
this.changeGetPhoneNumberBtn();
@ -291,45 +251,18 @@ export default class Register extends Component<any, any> {
onClick={this.onSkip}
></Image>
</View>
{/*
<View className="skip_footer_box">
<View className="checked_box">
{isChecked ? (
<Image
onClick={this.onCheck}
className="icon"
src={require("../../img/welcome/checked.png")}
></Image>
) : (
<Image
onClick={this.onCheck}
className="icon"
src={require("../../img/welcome/unchecked.png")}
></Image>
)}
<View className="tips">
</View>
</View>
<View className="skip_footer">
<Button
style="opacity: {{ isChecked ? 1 : .6 }}"
type="primary"
disabled={!isChecked}
open-type="getPhoneNumber"
className="skip_foorer_autoBtn"
onGetPhoneNumber={this.onSubmit}
>
</Button>
<View className="skip_foorer_btn" onClick={this.onSkipTap}>
{" "}
</View>
</View>
</View> */}
</View>
</Block>
);
}
}
const mapStateToProps = (state) => ({
mobile: state.userInfo.mobile,
});
const mapDispatchToProps = (dispatch) => ({
setMobile(data) {
dispatch(setMobile(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(Register);

@ -1,28 +1,28 @@
import { MpSplashDetail, WCUserLogin } from "../../utils/Interface";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import Taro from "@tarojs/taro";
// 引入 Swiper, SwiperItem 组件
import {
View,
Text,
Image,
Video,
Swiper,
SwiperItem,
} from "@tarojs/components";
import { View, Text, Image } from "@tarojs/components";
/*** redux ***/
import { connect } from "react-redux";
import { otherSettingRefresh } from "../../store/features/otherSetting";
/*** redux end ***/
import "taro-ui/dist/style/components/button.scss"; // 按需引入
import "./shop.less";
const app = Taro.getApp();
import { GetOtherSetting } from "../../utils/Interface";
import type CustomTabBar from "../../custom-tab-bar";
export default class Shop extends Component<any, any> {
class Shop extends Component<any, any> {
pageCtx = Taro.getCurrentInstance().page;
constructor(props) {
super(props);
this.state = {
name: "shop",
otherSetting: {
...this.props.otherSetting,
},
};
}
@ -34,14 +34,68 @@ export default class Shop extends Component<any, any> {
componentDidShow() {
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
tabbar?.setSelected(3);
this.showInit();
}
componentDidHide() {}
async initData() {}
showInit() {
let { otherSetting } = this.state;
if (otherSetting.skipAppid) {
this.goMiniProgram();
} else {
this.GetOtherSetting(); // 获取小程序设置:商城地址和版本
}
}
goMiniProgram() {
let { otherSetting } = this.state;
Taro.navigateToMiniProgram({
appId: otherSetting.skipAppid,
path: otherSetting.skipPath,
envVersion: otherSetting.envVersion,
success(res) {
// 打开成功
Taro.reLaunch({
url: "/pages/index/index",
});
},
fail(res) {
Taro.reLaunch({
url: "/pages/index/index",
});
},
});
}
// 获取小程序设置
GetOtherSetting = async () => {
let res = await GetOtherSetting();
if (res.data.code === 200) {
this.props.otherSettingRefresh(res.data.data);
let { otherSetting } = this.state;
otherSetting.skipAppid = res.data.data.skipAppid;
otherSetting.skipPath = res.data.data.skipPath;
otherSetting.envVersion = res.data.data.envVersion;
this.setState({ otherSetting });
this.goMiniProgram();
}
};
render() {
let { name } = this.state;
return <View>{name}</View>;
return <View></View>;
}
}
const mapStateToProps = (state) => ({
otherSetting: state.otherSetting,
});
const mapDispatchToProps = (dispatch) => ({
otherSettingRefresh(data) {
dispatch(otherSettingRefresh(data));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(Shop);

@ -37,6 +37,14 @@ page {
height: 140rpx;
border-radius: 50%;
overflow: hidden;
background-color: #fff;
.default-img {
width: 100%;
height: 100%;
margin: 0 auto;
margin-top: 20rpx;
box-sizing: border-box;
}
}
.infobox1 .info1 .tipbox {
flex-direction: column;

@ -5,9 +5,6 @@ import Taro from "@tarojs/taro";
// 引入 Swiper, SwiperItem 组件
import { View, Block, Textarea, Image } from "@tarojs/components";
// import { Toast } from "@antmjs/vantui";
// const Toast_ = Toast.createOnlyToast();
import { go, loading, msg } from "../../utils/traoAPI";
/*** redux ***/
@ -30,11 +27,16 @@ class User extends Component<any, any> {
super(props);
this.state = {
name: "user",
userInfo: this.props.userInfo,
userInfo: {
...this.props.userInfo,
},
otherSetting: {
...this.props.otherSetting,
},
MerchMobile: "",
count: 0,
year: new Date().getFullYear(),
lastDay: dayjs().endOf("month").format("YYYY-MM-DD"),
lastDay: dayjs().endOf("year").endOf("month").format("YYYY-MM-DD"),
messagecount: 0,
isNotRegister: false, // 是否未注册
isShowCustomerService: false, // 反馈留言
@ -70,8 +72,8 @@ class User extends Component<any, any> {
};
gourl = (e) => {
let { userInfo } = this.state;
if (!userInfo.mobile) {
let mobile = Taro.getStorageSync("mobile");
if (!mobile) {
this.setState({ isNotRegister: true }); // 打开弹窗
return;
}
@ -86,7 +88,8 @@ class User extends Component<any, any> {
};
gourls = (e) => {
let url = e.currentTarget.dataset.url;
if (url === "/pages/register/register" && this.state.userInfo.mobile) {
let mobile = Taro.getStorageSync("mobile");
if (url === "/pages/register/register" && mobile) {
url = "/pages/userInfoDetail/userInfoDetail";
}
Taro.navigateTo({
@ -96,11 +99,12 @@ class User extends Component<any, any> {
gominiapp() {
Taro.navigateToMiniProgram({
appId: "wx438760012de48d74",
path: "/pages/home/home",
envVersion: "release",
appId: this.state.otherSetting.skipAppid,
path: this.state.otherSetting.skipPath,
envVersion: this.state.otherSetting.sysVersion,
success(res) {
// 打开成功
console.log("res", res);
},
});
}
@ -156,12 +160,29 @@ class User extends Component<any, any> {
</View>
<View className="info_box">
<View className="infobox1">
<View className="img">
<Image src={userInfo.headimg} mode="widthFix" />
<View
className="img"
data-url="/pages/userInfoDetail/userInfoDetail"
onClick={this.gourl}
>
{userInfo.headimg ? (
<Image src={userInfo.headimg} mode="widthFix" />
) : (
// <Image
// className="default-img"
// src={require("../../img/user/user.png")}
// mode="widthFix"
// />
<Image
className="avatar"
src={require("../../img/welcome/avatar.png")}
/>
)}
</View>
<View
className="info1 flex aitems"
data-url="/pages/userInfoDetail/userInfoDetail"
onClick={this.gourl}
>
<View className="tipbox flex aitems">
<View className="tip1 flex aitems">
@ -218,7 +239,7 @@ class User extends Component<any, any> {
</View>
</View>
<View className="num">{userInfo.credit}</View>
<View className="txt">{lastDay}</View>
<View className="txt"></View>
</View>
</View>
<View className="info3">
@ -353,6 +374,7 @@ class User extends Component<any, any> {
const mapStateToProps = (state) => ({
userInfo: state.userInfo,
otherSetting: state.otherSetting,
});
const mapDispatchToProps = (dispatch) => ({
userRefresh(data) {

@ -149,3 +149,9 @@ button::after {
font-weight: bold;
color: #000;
}
.btn-disable {
background-color: gray !important; /* 设置按钮背景颜色为灰色 */
color: white !important; /* 设置按钮文字颜色为白色 */
border-color: gray !important; /* 设置按钮边框颜色为灰色 */
}

@ -3,7 +3,7 @@ import {
// MpSplashDetail,
// UpUserNick,
// UserInfoUp,
WCUserLogin,
// WCUserLogin,
UpdateUser,
GetProvince,
GetAreaListByPid,
@ -35,8 +35,7 @@ import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert";
/** 自定义组件 **/
import { getGlobalData, setGlobalData } from "../../utils/global";
import { loading, msg } from "../../utils/traoAPI";
import { loading, msg, go } from "../../utils/traoAPI";
import FormData from "../../utils/wxFormdata/formData";
// 仅注册成功后进入此页面
@ -50,9 +49,7 @@ class UserInfo extends Component<any, any> {
titleHeight: "",
style: "font-size: 26rpx; font-weight: 500; color: #ccc",
userInfo: {
headimg: "",
nickname: "",
birthday: new Date().getTime(),
...this.props.userInfo,
},
isShowIntegralText: false,
cityShow: false,
@ -164,10 +161,17 @@ class UserInfo extends Component<any, any> {
formData.append("areaId", form.areaId);
formData.append("birthday", userInfo.birthday);
formData.append("nickname", userInfo.nickname);
formData.appendFile("headimg", userInfo.headimg, "headimg.png");
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 data = formData.getData();
let res = await UpdateUser(data);
console.log("UpdateUser", res);
if (res.data.code === 200) {
msg("更新成功");
userInfo.province = res.data.data.province;
@ -181,9 +185,6 @@ class UserInfo extends Component<any, any> {
this.props.userRefresh(userInfo);
this.setState({ userInfo: userInfo });
// if (userInfo.integralText) {
// this.setState({ isShowIntegralText: true });
// }
if (userInfo.integralText) {
this.setState({ isShowIntegralText: true });
} else {
@ -193,7 +194,7 @@ class UserInfo extends Component<any, any> {
};
goUser = () => {
Taro.switchTab({
Taro.reLaunch({
url: "/pages/user/user",
});
};
@ -239,7 +240,10 @@ class UserInfo extends Component<any, any> {
// });
};
onSkip = () => {};
onSkip = () => {
go("/pages/instrument/instrument");
// this.goUser();
};
pickerChange = (event) => {
console.log("pickerChange", event);
@ -305,10 +309,6 @@ class UserInfo extends Component<any, any> {
closeTime = () => {
this.setState({ timeShow: false });
};
onInputTimePicker = (event) => {
console.log("onInputDateTimePicker", event);
this.isSubmitCheck();
};
onTimePickerCancel = () => {
console.log("onTimePickerCancel");
this.closeTime();
@ -325,7 +325,6 @@ class UserInfo extends Component<any, any> {
};
onNicknameChange = (event) => {
console.log("onNicknameChange", event);
let { userInfo } = this.state;
userInfo.nickname = event.detail.value;
this.setState({ userInfo });
@ -355,6 +354,9 @@ class UserInfo extends Component<any, any> {
closeIntegralText = () => {
this.setState({ isShowIntegralText: false });
setTimeout(() => {
this.goUser();
}, 600);
};
render() {
@ -379,6 +381,7 @@ class UserInfo extends Component<any, any> {
}
return `${value}`;
};
return (
<Block>
<PopupAlert
@ -463,7 +466,7 @@ class UserInfo extends Component<any, any> {
</View>
) : (
<View className="btn"></View>
<View className="btn btn-disable"></View>
)}
<View className="text" onClick={this.onSkip}>
@ -490,7 +493,6 @@ class UserInfo extends Component<any, any> {
value={dayjs(userInfo.birthday).valueOf()}
minDate={minDate}
maxDate={Date.now()}
onInput={this.onInputTimePicker}
onCancel={this.onTimePickerCancel}
onConfirm={this.onTimePickerConfirm}
/>

@ -164,16 +164,20 @@ button::after {
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 {
width: 690rpx;
height: 90rpx;
line-height: 90rpx;
background: #000000;
border-radius: 45rpx;
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #ffffff;
}
.btn-disable {
background-color: gray; /* 设置按钮背景颜色为灰色 */
color: white; /* 设置按钮文字颜色为白色 */
border-color: gray; /* 设置按钮边框颜色为灰色 */
}
}

@ -30,7 +30,6 @@ import Navbar from "../../components/navbar/navbar";
import PopupAlert from "../../components/popup/popup-alert";
/** 自定义组件 **/
import { getGlobalData, setGlobalData } from "../../utils/global";
import { loading, msg } from "../../utils/traoAPI";
import FormData from "../../utils/wxFormdata/formData";
@ -49,6 +48,7 @@ class UserInfoDetail extends Component<any, any> {
isShowIntegralText: false,
cityShow: false,
timeShow: false,
isSubmit: false,
columns: [
{
values: [],
@ -78,7 +78,7 @@ class UserInfoDetail extends Component<any, any> {
city: this.props.userInfo.city, // 市
areaId: this.props.userInfo.areaId, // 县区
area: this.props.userInfo.area, // 县区
headimg: null,
file: null,
},
pickerCityValue: [],
// maxDate: new Date().getTime(),
@ -98,6 +98,8 @@ class UserInfoDetail extends Component<any, any> {
this.setState({ titleHeight, menu });
this.initData();
console.log("userInfo.birthday", this.state.userInfo.birthday);
}
componentDidMount() {}
@ -132,6 +134,7 @@ class UserInfoDetail extends Component<any, any> {
this.GetAreaListByPid_level2(res.data.data[0].id);
}
}
this.isSubmitCheck();
};
GetAreaListByPid_level2 = async (level2 = 0, isInit = false) => {
@ -185,11 +188,13 @@ class UserInfoDetail extends Component<any, any> {
formData.append("areaId", form.areaId);
formData.append("birthday", userInfo.birthday);
formData.append("nickname", userInfo.nickname);
formData.append("headimg", userInfo.headimg);
if (userInfo.headimg) {
console.log("userInfo.headimg", userInfo.headimg);
console.log("indexOf", userInfo.headimg.indexOf("//tmp/"));
// 如果头像是小程序相对路径,则上传文件
if (userInfo.headimg.indexOf("//tmp/") > -1) {
formData.appendFile("headimg", userInfo.headimg, "headimg.png");
formData.appendFile("file", userInfo.headimg, "headimg.png");
} else {
formData.append("file", null);
}
}
let data = formData.getData();
@ -216,7 +221,7 @@ class UserInfoDetail extends Component<any, any> {
};
goUser = () => {
Taro.switchTab({
Taro.reLaunch({
url: "/pages/user/user",
});
};
@ -225,6 +230,7 @@ class UserInfoDetail extends Component<any, any> {
let { userInfo } = this.state;
userInfo.headimg = event.detail.avatarUrl;
this.setState({ userInfo });
this.isSubmitCheck();
};
onSubmit = async () => {
@ -239,7 +245,9 @@ class UserInfoDetail extends Component<any, any> {
await this.UpdateUser();
};
onSkip = () => {};
onSkip = () => {
this.goUser();
};
pickerChange = (event) => {
console.log("pickerChange", event);
@ -283,6 +291,7 @@ class UserInfoDetail extends Component<any, any> {
form.areaId = this.state.leve3region[index[2]].id;
this.setState({ form });
this.onCityCancel();
this.isSubmitCheck();
};
onCityCancel = () => {
@ -303,8 +312,8 @@ class UserInfoDetail extends Component<any, any> {
this.setState({ timeShow: false });
};
onTimePickerCancel = () => {
console.log("onTimePickerCancel");
this.closeTime();
this.isSubmitCheck();
};
onTimePickerConfirm = (picker) => {
let { userInfo } = this.state;
@ -313,18 +322,38 @@ class UserInfoDetail extends Component<any, any> {
this.setState({ userInfo });
}
this.closeTime();
this.isSubmitCheck();
};
onNicknameChange = (event) => {
console.log("onNicknameChange", event);
// console.log("onNicknameChange", event);
let { userInfo } = this.state;
userInfo.nickname = event.detail.value;
this.setState({ userInfo });
this.isSubmitCheck();
};
onNickNameReview = (event) => {
console.log("onNickNameReView", event);
// console.log("onNickNameReview", event);
this.isSubmitCheck();
};
isSubmitCheck() {
let { userInfo, form } = this.state;
if (
userInfo.nickname &&
userInfo.headimg &&
form.province &&
form.city &&
form.area &&
userInfo.birthday
) {
this.setState({ isSubmit: true });
} else {
this.setState({ isSubmit: false });
}
}
closeIntegralText = () => {
this.setState({ isShowIntegralText: false });
@ -342,6 +371,7 @@ class UserInfoDetail extends Component<any, any> {
form,
minDate,
isShowIntegralText,
isSubmit,
} = this.state;
const formatter = (type, value) => {
@ -380,14 +410,6 @@ class UserInfoDetail extends Component<any, any> {
></Image>
)}
</Button>
{/* <Input
type="nickname"
className="nickname"
placeholder="请填写您的昵称"
value={userInfo.nickname}
maxlength={20}
onInput={this.onNicknameChange}
></Input> */}
<Input
type="nickname"
className="ipt nickname"
@ -435,7 +457,8 @@ class UserInfoDetail extends Component<any, any> {
</View>
<View className="value">
{/* <picker className="picker" mode="date" bindchange="bindbirthdayPickerChange" end="{{dateend}}" value="{{ageindex}}" range="{{age}}">picker</picker> */}
<View>{userInfo.birthday}</View>
<View>{userInfo.birthday || dayjs().format("YYYY-MM-DD")}</View>
<View className="righticon">
<Image
src={require("../../img/user/right.png")}
@ -447,9 +470,16 @@ class UserInfoDetail extends Component<any, any> {
</View>
<View className="btn_box flex aitems jcenter">
<View className="btn" onClick={this.onSubmit}>
{/* <View className="btn" onClick={this.onSubmit}>
</View>
</View> */}
{isSubmit ? (
<View className="btn" onClick={this.onSubmit}>
</View>
) : (
<View className="btn btn-disable"></View>
)}
</View>
<Popup show={cityShow} position={"bottom"} onClose={this.closeShow}>

@ -8,7 +8,7 @@ const otherSettingReducer = createSlice({
id: "",
skipAppid: "", // 跳转商城id
skipPath: "", // 跳转商城地址
sysVersion: "", // 小程序系统版本
sysVersion: "", // 小程序系统版本(跳转的版本?)
status: "", // 状态
},
reducers: {

@ -48,6 +48,9 @@ const userInfoReducer = createSlice({
state.credit = payload.credit || 0;
state.expireCredit = payload.expireCredit || 0;
state.integralText = payload.integralText || "";
Taro.setStorageSync("mobile", state.mobile);
Taro.setStorageSync("token", state.token);
},
},
});

@ -4,6 +4,7 @@ import counterReducer from "./features/counter";
import navigationReducer from "./features/navigation";
import userInfoReducer from "./features/userInfo";
import globalReducer from "./features/global";
import otherSettingReducer from "./features/otherSetting";
const store = configureStore({
reducer: {
@ -12,6 +13,7 @@ const store = configureStore({
navigation: navigationReducer,
userInfo: userInfoReducer,
global: globalReducer,
otherSetting: otherSettingReducer,
},
});

@ -132,7 +132,7 @@ export const AjaxuploadFile = (params) => {
type: "api",
},
header: {
token: getGlobalData("token") || Taro.getStorageSync("token"),
token: Taro.getStorageSync("token"),
},
success(res) {
let o = JSON.parse(res.data);

@ -66,11 +66,23 @@ export const go = (url) => {
};
export const loading = (title) => {
Taro.showToast({
title,
mask: true,
icon: "loading",
});
};
// 加载中显示隐藏搭配使用不能和toast一起用
export const showLoading = (title) => {
Taro.showLoading({
title,
mask: true,
});
};
export const hideLoading = (title) => {
Taro.hideLoading();
};
export const showModal = (data) => {
const {

Loading…
Cancel
Save