剪板流程
This commit is contained in:
commit
04af838eec
@ -9,8 +9,13 @@ export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发
|
||||
// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发
|
||||
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
||||
// export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境
|
||||
<<<<<<< HEAD
|
||||
// export const BASE_URL = `http://192.168.1.4:40001/lymarket` // 王霞
|
||||
// export const BASE_URL = `http://192.168.1.224:50002/lymarket` // 添
|
||||
=======
|
||||
// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
|
||||
// export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添
|
||||
>>>>>>> 7322f1336ded31d51696f8417db3f5179a2e18c5
|
||||
// export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰
|
||||
|
||||
// CDN
|
||||
|
@ -102,7 +102,7 @@ const AddressList = memo((props:Params)=>{
|
||||
{/* {item.address_detail} */}
|
||||
</View>
|
||||
{
|
||||
item.is_default&&<Text className="address-list-phone">{item.phone.replace(item.phone.substring(4,7), "****")}</Text>
|
||||
item.is_default&&<Text className="address-list-phone">{item.phone.replace(item.phone.substring(3,7), "****")}</Text>
|
||||
}
|
||||
</View>
|
||||
<Navigator onClick={e=>e.stopPropagation()} url={`/pages/addressAdd/index?type=edit&id=${item.id}`} hoverClass="none" className="address-edit">
|
||||
|
@ -2,7 +2,7 @@
|
||||
import InfiniteScroll from "@/components/infiniteScroll"
|
||||
import { ReactNode, useEffect, useMemo, useRef, useState } from "react"
|
||||
import { dataLoadingStatus, getFilterData } from "@/common/util";
|
||||
import { isEmptyObject } from "@/common/common";
|
||||
import { alert, isEmptyObject } from "@/common/common";
|
||||
|
||||
interface Params{
|
||||
children?: ReactNode,
|
||||
@ -36,9 +36,9 @@ export default (props: Params)=>{
|
||||
page: tRefreshDataRef.page,
|
||||
size: tRefreshDataRef.size,
|
||||
});
|
||||
if(result.success){
|
||||
// 返回数据
|
||||
props.change&&props.change(result);
|
||||
if(result.success){
|
||||
if(result.data.total<=0){
|
||||
setRefreshData({
|
||||
...tRefreshDataRef,
|
||||
@ -59,6 +59,7 @@ export default (props: Params)=>{
|
||||
})
|
||||
}
|
||||
}else{
|
||||
alert.none(result.msg);
|
||||
setRefreshData({
|
||||
...tRefreshDataRef,
|
||||
refreshStatus: false,
|
||||
|
@ -42,7 +42,8 @@ export default ()=>{
|
||||
const credit_quota_used_line = convertPrice(formatPriceDiv(result.data.credit_quota_used_line));
|
||||
const credit_quota_line = convertPrice(formatPriceDiv(result.data.credit_quota_line));
|
||||
const credit_quota_available_line = convertPrice(formatPriceDiv(result.data.credit_quota_available_line));
|
||||
const progress = ((credit_quota_available_line[0]??0) / (credit_quota_line[0]??0) * 100).toFixed(0);
|
||||
const progress = credit_quota_available_line[0]==0&&credit_quota_line[0]==0?100:((credit_quota_available_line[0]??0) / (credit_quota_line[0]??0) * 100).toFixed(0);
|
||||
|
||||
|
||||
switch(Number(result.data.quota_status)){
|
||||
case 0://暂未开通
|
||||
|
@ -31,7 +31,7 @@ export default ()=>{
|
||||
<View className="credit-used-list-top">
|
||||
<View className="credit-used-list-type">下单</View>
|
||||
<View className={`credit-used-list-price ${item.amount>0?'green':item.amount<0?'red':''}`}>
|
||||
{item.amount>0?"-":"+"}{toDecimal2(formatPriceDiv(item.amount)).toLocaleString()}
|
||||
{item.trans_type==2?"-":"+"}{toDecimal2(formatPriceDiv(item.amount)).toLocaleString()}
|
||||
</View>
|
||||
</View>
|
||||
<View className="credit-used-list-bottom">
|
||||
|
@ -3,22 +3,6 @@
|
||||
background-color: #f3f3f3;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.deposit-beforehand-tips{
|
||||
width: 100%;
|
||||
height: 66px;
|
||||
background: #FFE6CE;
|
||||
border: 2px solid #ffe6ce;
|
||||
padding: 0 30px;
|
||||
display: flex;align-items: center;
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #EE7500;
|
||||
margin: 0;
|
||||
}
|
||||
.deposit-beforehand-tips text{
|
||||
margin-right: 10px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.deposit-beforehand-card{
|
||||
width: 702px;
|
||||
|
@ -6,6 +6,7 @@ import { depositInfoApi } from "@/api/deposit"
|
||||
import { useEffect } from "react";
|
||||
import { formatPriceDiv, toDecimal2 } from "@/common/fotmat";
|
||||
import { setClipboardData } from "@tarojs/taro";
|
||||
import Message from "@/components/Message";
|
||||
|
||||
export default ()=>{
|
||||
const {fetchData, state} = depositInfoApi();
|
||||
@ -23,9 +24,7 @@ export default ()=>{
|
||||
|
||||
return (
|
||||
<View className="deposit-beforehand">
|
||||
<View className="deposit-beforehand-tips">
|
||||
<Text className="iconfont icon-zhuyi"></Text> 汇款成功后,1-5分钟自动到账。
|
||||
</View>
|
||||
<Message text="汇款成功后,1-5分钟自动到账。"/>
|
||||
<View className="deposit-beforehand-card">
|
||||
<View className="deposit-beforehand-balance">
|
||||
<View className="deposit-beforehand-balance-title">余额 (元)</View>
|
||||
|
@ -3,6 +3,7 @@
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
.header{
|
||||
background: #68b4ff;
|
||||
background-size: cover;
|
||||
@ -12,6 +13,10 @@
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
.auth-suspension{
|
||||
position: absolute;
|
||||
z-index: 1;inset: 0;
|
||||
}
|
||||
.header-card{
|
||||
position: absolute;left: 50%;bottom: -18%;
|
||||
transform: translateX(-50%);
|
||||
@ -239,12 +244,13 @@
|
||||
display: flex;align-items: center;justify-content: center;
|
||||
}
|
||||
|
||||
.modal{
|
||||
.tips-modal{
|
||||
background: rgba(0,0,0,0.6);
|
||||
position: fixed;inset: 0;
|
||||
display: flex;justify-content: center;align-items: center;
|
||||
z-index: 2;
|
||||
}
|
||||
.modal-content{
|
||||
.tips-modal-content{
|
||||
width: 598px;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
@ -259,7 +265,7 @@
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
.modal-title{
|
||||
.tips-modal-title{
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
@ -267,51 +273,51 @@
|
||||
margin-bottom: 58px;
|
||||
padding-top: 48px;
|
||||
}
|
||||
.modal-letter{
|
||||
.tips-modal-letter{
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
color: #707070;
|
||||
padding: 0 30px;
|
||||
line-height: 50px;
|
||||
}
|
||||
.modal-letter-text{
|
||||
.tips-modal-letter-text{
|
||||
text-indent: 60px;
|
||||
}
|
||||
.modal-letter-beginn{
|
||||
.tips-modal-letter-beginn{
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.modal-letter-end{
|
||||
.tips-modal-letter-end{
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
text-align: right;
|
||||
margin-top: 61px;
|
||||
}
|
||||
.modal-button{
|
||||
.tips-modal-button{
|
||||
display: flex;
|
||||
border-top: 1px solid #DDDDDD;
|
||||
margin-top: 45px;
|
||||
}
|
||||
.modal-button button, .modal-button view{
|
||||
.tips-modal-button button, .tips-modal-button view{
|
||||
display: flex;align-items: center;justify-content: center;
|
||||
width: 50%;
|
||||
height: 90px;
|
||||
background-color: white;
|
||||
}
|
||||
.modal-button button{
|
||||
.tips-modal-button button{
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
color: #707070;
|
||||
border-radius: 0;
|
||||
border-right: 1px solid #DDDDDD;
|
||||
}
|
||||
.modal-button button::after{
|
||||
.tips-modal-button button::after{
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.modal-button view{
|
||||
.tips-modal-button view{
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
color: #007aff;
|
||||
|
@ -3,40 +3,38 @@ import { memo, useEffect, useState } from "react"
|
||||
import styles from './index.module.scss'
|
||||
import classnames from "classnames";
|
||||
import { useSelector } from "@/reducers/hooks";
|
||||
import { GetAdminUserInfoApi } from "@/api/user";
|
||||
import { alert, goLink } from "@/common/common";
|
||||
import useLogin from '@/use/useLogin'
|
||||
import {BASE_URL} from '@/common/constant'
|
||||
|
||||
export default () => {
|
||||
// 用户信息
|
||||
const { fetchData, state } = GetAdminUserInfoApi();
|
||||
const {adminUserInfo, userInfo} = useSelector(state => state.userInfo);
|
||||
const [mUserInfo, setMUserInfo] = useState({
|
||||
phone: ""
|
||||
});
|
||||
const getData = ()=>{
|
||||
fetchData();
|
||||
}
|
||||
const { getSelfUserInfo } = useLogin();
|
||||
const {adminUserInfo} = useSelector(state => state.userInfo);
|
||||
useEffect(()=>{
|
||||
setMUserInfo({
|
||||
...mUserInfo,
|
||||
// phone: userInfo?.phone?.replace(userInfo?.phone?.substring(3,7), "****") as string
|
||||
})
|
||||
getData();
|
||||
getSelfUserInfo().then().catch(()=>{
|
||||
alert.none("授权失败,请授权后再使用");
|
||||
});
|
||||
},[]);
|
||||
const handleAuth = async ()=>{
|
||||
getSelfUserInfo().then().catch(()=>{
|
||||
alert.none("授权失败,请授权后再使用");
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<Header data={adminUserInfo} userInfo={userInfo} />
|
||||
<Header data={adminUserInfo} />
|
||||
<Assets />
|
||||
<Main />
|
||||
<Modal data={adminUserInfo}/>
|
||||
{/* 测试暂时添加 */}
|
||||
<View style={{fontSize:'26rpx', textAlign:'center'}}>{BASE_URL}</View>
|
||||
{!adminUserInfo.is_authorize_name&&<View onClick={handleAuth} className={styles["auth-suspension"]}></View>}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
// 提示弹窗
|
||||
const Modal = memo((props:any)=>{
|
||||
const {data} = props;
|
||||
const [modalShow, setModalShow]=useState(true);
|
||||
@ -45,16 +43,16 @@ const Modal = memo((props:any)=>{
|
||||
return(
|
||||
<>
|
||||
{!data?.is_authorize_phone&&modalShow&&
|
||||
<View onClick={handleouter} catchMove className={styles['modal']}>
|
||||
<View className={styles['modal-content']} onClick={e=>e.stopPropagation()}>
|
||||
<View className={styles['modal-title']}>首次登录提醒</View>
|
||||
<View className={styles['modal-letter']}>
|
||||
<View className={styles['modal-letter-beginn']}>To: 万丰园纺织科技</View>
|
||||
<View className={styles['modal-letter-text']}>尊敬的老朋友,欢迎你使用小程序商城;由于您是我们长期合作的伙伴,你的组织已自动为你生成,关联后可查看历史订单哟。</View>
|
||||
<View className={styles['modal-letter-end']}>信息错误请联系客服</View>
|
||||
<View onClick={handleouter} catchMove className={styles['tips-modal']}>
|
||||
<View className={styles['tips-modal-content']} onClick={e=>e.stopPropagation()}>
|
||||
<View className={styles['tips-modal-title']}>首次登录提醒</View>
|
||||
<View className={styles['tips-modal-letter']}>
|
||||
<View className={styles['tips-modal-letter-beginn']}>To: 万丰园纺织科技</View>
|
||||
<View className={styles['tips-modal-letter-text']}>尊敬的老朋友,欢迎你使用小程序商城;由于您是我们长期合作的伙伴,你的组织已自动为你生成,关联后可查看历史订单哟。</View>
|
||||
<View className={styles['tips-modal-letter-end']}>信息错误请联系客服</View>
|
||||
</View>
|
||||
<View className={styles['modal-button']}>
|
||||
<Button hoverClass="none" openType="concat">联系客服</Button>
|
||||
<View className={styles['tips-modal-button']}>
|
||||
<Button hoverClass="none" openType="contact">联系客服</Button>
|
||||
<View onClick={()=>setModalShow(false)}>我知道</View>
|
||||
</View>
|
||||
</View>
|
||||
@ -66,19 +64,18 @@ const Modal = memo((props:any)=>{
|
||||
|
||||
// 头部 | 订单
|
||||
const Header = memo((props:any) => {
|
||||
const {data, userInfo} = props;
|
||||
let menu = [{ text: "待配布", icon: "icon-daipeibu" }, { text: "待付款", icon: "icon-daifukuan" },
|
||||
{ text: "待发货", icon: "icon-daifahuo" }, { text: "已发货", icon: "icon-yifahuo" },
|
||||
{ text: "退款/售后", icon: "icon-a-tuikuanshouhou" }];
|
||||
const {data} = props;
|
||||
let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index" },
|
||||
{ text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index" },
|
||||
{ text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/orderList/index" }];
|
||||
const { getPhoneNumber } = useLogin();
|
||||
const mGetPhoneNumber = (ev)=>{
|
||||
try {
|
||||
if(ev.detail?.code){
|
||||
getPhoneNumber(ev.detail.code);
|
||||
} catch (error) {
|
||||
}else{
|
||||
alert.none("绑定失败!");
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.header}>
|
||||
<View className={`${styles.crad} ${styles['header-card']}`}>
|
||||
@ -93,7 +90,7 @@ const Header = memo((props:any) => {
|
||||
{data?.user_name}
|
||||
</View>
|
||||
<View className={styles['arcd-info-left-phone']}>
|
||||
{userInfo?.phone?.replace(userInfo?.phone?.substring(3,7), "****")||<Button openType="getPhoneNumber" onGetPhoneNumber={mGetPhoneNumber}>绑定手机号码</Button>}
|
||||
{data?.phone?data?.phone?.replace(data?.phone?.substring(3,7), "****"):<Button openType="getPhoneNumber" onGetPhoneNumber={mGetPhoneNumber}>绑定手机号码</Button>}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
@ -129,15 +126,14 @@ const Header = memo((props:any) => {
|
||||
{
|
||||
menu.map((item, index) => {
|
||||
return (
|
||||
<View className={styles['card-main-title-content-item']}>
|
||||
<Navigator hoverClass="none" url={item.url} className={styles['card-main-title-content-item']}>
|
||||
<Text className={`iconfont ${item.icon}`}></Text>
|
||||
<View>{item.text}</View>
|
||||
<View className={styles['card-main-title-content-item-badge']}>{index==2?"99+":10}</View>
|
||||
</View>
|
||||
</Navigator>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
76
src/pages/userEdit/components/ModifyModal.scss
Normal file
76
src/pages/userEdit/components/ModifyModal.scss
Normal file
@ -0,0 +1,76 @@
|
||||
.modify-ickname-content {
|
||||
margin: 0 auto;
|
||||
width: 658px;
|
||||
padding-bottom: 50px;
|
||||
|
||||
.modify-ickname-input {
|
||||
width: 658px;
|
||||
height: 182px;
|
||||
background: #f3f3f3;
|
||||
border: 2px solid #e6e6e6;
|
||||
border-radius: 10px;
|
||||
padding: 15px;
|
||||
box-sizing: border-box;
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
color: #ababab;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.modify-ickname-input textarea {
|
||||
width: 100%;
|
||||
height: 80%;
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
color: #3c3c3c;
|
||||
}
|
||||
|
||||
.modify-ickname-tips {
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
color: #ababab;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.modify-ickname-operation {
|
||||
width: 658px;
|
||||
height: 82px;
|
||||
background: #ffffff;
|
||||
border: 2px solid #cde5ff;
|
||||
border-radius: 40px;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
margin-top: 105px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.modify-ickname-operation button {
|
||||
height: 100%;
|
||||
width: 50%;
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
color: #007aff;
|
||||
background-color: white;
|
||||
border: none;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.modify-ickname-operation button::after,
|
||||
.user-edit-logout::after {
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.modify-ickname-operation .modify-ickname-operation-save {
|
||||
background: #007aff;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.modify-ickname-operation button::after {
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
49
src/pages/userEdit/components/ModifyModal.tsx
Normal file
49
src/pages/userEdit/components/ModifyModal.tsx
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useState } from "react"
|
||||
import Popup from "@/components/popup";
|
||||
import { Button, Image, Text, Textarea, View } from "@tarojs/components"
|
||||
import "./ModifyModal.scss"
|
||||
|
||||
interface Params{
|
||||
title?: string,
|
||||
save: (value: any)=>void, // 确定保存
|
||||
}
|
||||
export default memo(forwardRef((props:any,ref)=>{
|
||||
const {title="修改昵称"} = props;
|
||||
const [value, setValue] = useState("");
|
||||
useEffect(()=>{
|
||||
setValue(props.value);
|
||||
},[props.value])
|
||||
// popup输入长度
|
||||
const handleTextareaInput = (ev:any)=>{
|
||||
setValue(ev.detail.value.slice(0,20));
|
||||
}
|
||||
// 重置
|
||||
const handleTextareaReset = ()=>{
|
||||
setValue("");
|
||||
}
|
||||
const [textareaBottom, setTextareaBottom] = useState(0);
|
||||
const handleBlur = ()=>{
|
||||
setTextareaBottom(0);
|
||||
}
|
||||
const handleFocus = (ev)=>{
|
||||
setTextareaBottom(ev.detail.height);
|
||||
}
|
||||
const [modalShow,setModalShow] = useState(false);
|
||||
useImperativeHandle(ref, ()=>({setModalShow}))
|
||||
return (
|
||||
<Popup onClose={()=>setModalShow(false)} title={title} show={modalShow}>
|
||||
<View style={{marginBottom: `${textareaBottom}px`}} className="modify-ickname-content">
|
||||
<View className="modify-ickname-input">
|
||||
<Textarea showConfirmBar={false} auto-focus adjustPosition={false} value={value} onBlur={handleBlur} onFocus={handleFocus} onInput={handleTextareaInput} maxlength={20}/>
|
||||
<Text>{value?.length}/20</Text>
|
||||
</View>
|
||||
<Text className="modify-ickname-tips">请设置2-20个字符,可由中文、英文、数字组成</Text>
|
||||
<View className="modify-ickname-operation">
|
||||
<Button onClick={handleTextareaReset} hoverClass="none" className="modify-ickname-operation-reset">重置</Button>
|
||||
<Button onClick={()=>props.save(value)} hoverClass="none" className="modify-ickname-operation-save">保存</Button>
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
)
|
||||
}))
|
@ -33,6 +33,45 @@
|
||||
.user-edit-content-title text{
|
||||
margin-right: 10px;
|
||||
}
|
||||
.user-edit-content-phone{
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
display: flex;justify-content: space-between;
|
||||
}
|
||||
.user-edit-content-phone text{
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #ababab;
|
||||
}
|
||||
.user-edit-content-bindphone{
|
||||
padding: 0;width: auto;height: auto;
|
||||
margin: 0;background: none;border: 0;
|
||||
text-align: left;
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
color: #ababab;
|
||||
}
|
||||
.user-edit-content-bindphone::after{
|
||||
border: 0;
|
||||
}
|
||||
.user-edit-content-company{
|
||||
width: 118px;
|
||||
height: 40px;
|
||||
background: #dddddd;
|
||||
border-radius: 6px;
|
||||
display: flex;align-items: center;justify-content: center;
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #707070;
|
||||
}
|
||||
.user-edit-content-company text{
|
||||
margin-left: 5px;
|
||||
}
|
||||
.user-edit-content-company.user-edit-content-company-auth{
|
||||
background-color: #CDF3DF;
|
||||
color: #07C160;
|
||||
}
|
||||
.user-edit-list{
|
||||
height: 90px;
|
||||
display: flex;align-items: center;
|
||||
@ -50,12 +89,15 @@
|
||||
color: #000000;
|
||||
}
|
||||
.user-edit-list-right{
|
||||
display: flex;justify-content: space-between;
|
||||
display: flex;justify-content: space-between;align-items: center;
|
||||
flex: auto;
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
}
|
||||
.user-edit-list-right>view{
|
||||
flex: 1;
|
||||
}
|
||||
.user-edit-list-right-placeholder{
|
||||
color: #cccccc;
|
||||
}
|
||||
@ -77,69 +119,4 @@
|
||||
text-align: center;
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
.user-edit-popup-content{
|
||||
margin: 0 auto;
|
||||
width: 658px;
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
.user-edit-popup-input{
|
||||
width: 658px;
|
||||
height: 182px;
|
||||
background: #f3f3f3;
|
||||
border: 2px solid #e6e6e6;
|
||||
border-radius: 10px;
|
||||
padding: 15px;
|
||||
box-sizing: border-box;
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
color: #ababab;
|
||||
display: flex;flex-direction: column;
|
||||
align-items: flex-end;
|
||||
}
|
||||
.user-edit-popup-input textarea{
|
||||
width: 100%;
|
||||
height: 80%;
|
||||
font-size: 26px;
|
||||
font-weight: 400;
|
||||
color: #3c3c3c;
|
||||
}
|
||||
.user-edit-popup-tips{
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
color: #ababab;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.user-edit-popup-operation{
|
||||
width: 658px;
|
||||
height: 82px;
|
||||
background: #ffffff;
|
||||
border: 2px solid #cde5ff;
|
||||
border-radius: 40px;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
margin-top: 105px;
|
||||
display: flex;
|
||||
}
|
||||
.user-edit-popup-operation button{
|
||||
height: 100%;
|
||||
width: 50%;
|
||||
font-size: 32px;
|
||||
font-weight: 400;
|
||||
color: #007aff;
|
||||
background-color: white;
|
||||
border: none;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.user-edit-popup-operation button::after,.user-edit-logout::after{
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
}
|
||||
.user-edit-popup-operation .user-edit-popup-operation-save{
|
||||
background: #007aff;
|
||||
color: #ffffff;
|
||||
}
|
||||
.user-edit-popup-operation button::after{ border-radius: 0; }
|
||||
}
|
@ -3,45 +3,45 @@ import { alert, goLink, isEmptyObject, retrieval } from "@/common/common";
|
||||
import Popup from "@/components/popup";
|
||||
import { Button, Image, Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, { chooseMedia } from "@tarojs/taro";
|
||||
import { GetAdminUserInfoApi, realNameUpdateApi } from "@/api/user";
|
||||
import { memo, useCallback, useEffect, useState } from "react"
|
||||
import { realNameUpdateApi } from "@/api/user";
|
||||
import { companyDetailApi, companyUpdateApi } from "@/api/company"
|
||||
import { memo, useCallback, useEffect, useRef, useState } from "react"
|
||||
import "./index.scss"
|
||||
import ModifyModal from "./components/ModifyModal";
|
||||
import useLogin from "@/use/useLogin";
|
||||
import { useSelector } from "@/reducers/hooks";
|
||||
|
||||
export default ()=>{
|
||||
const { getPhoneNumber, getAdminUserInfo } = useLogin();
|
||||
const {adminUserInfo} = useSelector(state => state.userInfo);
|
||||
// 用户信息
|
||||
const { fetchData, state } = GetAdminUserInfoApi();
|
||||
const getData = async ()=>{
|
||||
const result = await fetchData();
|
||||
setFormData({
|
||||
...formData,
|
||||
real_name: result.data.user_name
|
||||
})
|
||||
}
|
||||
useEffect(()=>{
|
||||
getData();
|
||||
},[])
|
||||
setFormData({
|
||||
...adminUserInfo as any
|
||||
})
|
||||
}, [adminUserInfo])
|
||||
// 表单数据
|
||||
const [formData, setFormData] = useState({
|
||||
real_name: "麦兜"
|
||||
user_name: "麦兜"
|
||||
});
|
||||
// 显示popup
|
||||
const [popupShow,setPopupShow] = useState(false);
|
||||
const triggerList = useCallback((key:string)=>{
|
||||
setPopupShow(true);
|
||||
},[])
|
||||
// popup保存
|
||||
// 昵称修改保存
|
||||
const { fetchData: realNameUpdateFetch } = realNameUpdateApi();
|
||||
const rules = {
|
||||
real_name: [{
|
||||
message: "请输入昵称"
|
||||
user_name: [{
|
||||
message: "请输入"
|
||||
}]
|
||||
}
|
||||
const handleTextareaSave = async (real_name)=>{
|
||||
retrieval({real_name},rules).then(async ()=>{
|
||||
const result = await realNameUpdateFetch({real_name});
|
||||
const {fetchData: saveFetch} = companyUpdateApi();
|
||||
const handleTextareaSave = async (text, type)=>{
|
||||
retrieval({text},rules).then(async ()=>{
|
||||
let result;
|
||||
if(type=="Ickname"){
|
||||
result = await realNameUpdateFetch({real_name: text});
|
||||
}else{
|
||||
result = saveFetch({company_name: text});
|
||||
}
|
||||
if(result.success){
|
||||
getData();
|
||||
setPopupShow(false);
|
||||
getAdminUserInfo();
|
||||
alert.success("保存成功");
|
||||
}else{
|
||||
alert.none(result.msg);
|
||||
@ -66,6 +66,15 @@ export default ()=>{
|
||||
}
|
||||
})
|
||||
}
|
||||
const mGetPhoneNumber = (ev)=>{
|
||||
if(ev.detail?.code){
|
||||
getPhoneNumber(ev.detail.code);
|
||||
}else{
|
||||
alert.none("绑定失败!");
|
||||
}
|
||||
}
|
||||
const ModifyIcknameEl = useRef(null);
|
||||
const ModifyCompanyNameEl = useRef(null);
|
||||
|
||||
return (
|
||||
<View className="user-edit">
|
||||
@ -75,21 +84,31 @@ export default ()=>{
|
||||
</View>
|
||||
<View className="user-edit-content">
|
||||
<View className="user-edit-content-title"><Text/> 个人资料</View>
|
||||
<UserEditList onClick={()=>triggerList('real_name')} data={state.data.user_name} label="昵称" placeholder="请输入" icon=""/>
|
||||
<UserEditList onClick={()=>onNavigate("/pages/company/index")} label="手机号" placeholder="去绑定" icon=""/>
|
||||
<UserEditList onClick={()=>(ModifyIcknameEl.current as any).setModalShow(true)} data={(formData as any)?.user_name} label="昵称" placeholder="请输入" icon=""/>
|
||||
<UserEditList label="手机号" placeholder="去绑定" icon="">
|
||||
{((formData as any)?.phone)?<View className="user-edit-content-phone">
|
||||
<View>{(formData as any)?.phone}</View>
|
||||
<Text>已绑定</Text>
|
||||
</View>:
|
||||
<Button className="user-edit-content-bindphone" openType="getPhoneNumber" onGetPhoneNumber={mGetPhoneNumber}>去绑定</Button>
|
||||
}
|
||||
</UserEditList>
|
||||
</View>
|
||||
<View className="user-edit-content">
|
||||
<View className="user-edit-content-title"><Text/> 组织资料</View>
|
||||
<UserEditList onClick={()=>triggerList('real_name')} data={state.data.user_name} label="名称" placeholder="待绑定" icon=""/>
|
||||
<UserEditList onClick={()=>(ModifyCompanyNameEl.current as any).setModalShow(true)} data={(formData as any)?.company_name} label="名称" placeholder="待绑定" icon=""/>
|
||||
<UserEditList onClick={()=>onNavigate("/pages/company/index")} label="类型" placeholder="完善公司/组织信息" icon=""/>
|
||||
<UserEditList onClick={()=>onNavigate("/pages/certification/index")} label="我的认证" placeholder="待绑定" icon="">
|
||||
已认证
|
||||
<View className="user-edit-content-company">
|
||||
<Text className="iconfont "/> 未认证
|
||||
</View>
|
||||
</UserEditList>
|
||||
<UserEditList onClick={()=>onNavigate("/pages/weightList/index")} label="创建人" placeholder="完善公司/组织信息" icon=""/>
|
||||
<UserEditList onClick={()=>onNavigate("/pages/weightList/index")} label="创建人" data={(formData as any)?.founder_user_name} placeholder="完善公司/组织信息" icon=""/>
|
||||
</View>
|
||||
<Button hoverClass="none" className="user-edit-logout">退出当前账号</Button>
|
||||
|
||||
<PopupContent value={formData.real_name} show={popupShow} setPopupShow={setPopupShow} save={handleTextareaSave}/>
|
||||
<ModifyModal title="修改昵称" ref={ModifyIcknameEl} value={(formData as any)?.user_name} save={(value)=>handleTextareaSave(value, "Ickname")}/>
|
||||
<ModifyModal title="修改名称" ref={ModifyCompanyNameEl} value={(formData as any)?.company_name} save={(value)=>handleTextareaSave(value, "companyName")}/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@ -114,34 +133,3 @@ const UserEditList = memo((props:any)=>{
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
// popup内容
|
||||
const PopupContent = memo((props:any)=>{
|
||||
const [value, setValue] = useState("");
|
||||
useEffect(()=>{
|
||||
setValue(props.value);
|
||||
},[props.value])
|
||||
// popup输入长度
|
||||
const handleTextareaInput = (ev:any)=>{
|
||||
setValue(ev.detail.value.slice(0,20));
|
||||
}
|
||||
// 重置
|
||||
const handleTextareaReset = ()=>{
|
||||
setValue("");
|
||||
}
|
||||
return (
|
||||
<Popup onClose={()=>props.setPopupShow(false)} title="修改昵称" show={props.show}>
|
||||
<View className="user-edit-popup-content">
|
||||
<View className="user-edit-popup-input">
|
||||
<Textarea value={value} onInput={handleTextareaInput} maxlength={20}/>
|
||||
<Text>{value.length}/20</Text>
|
||||
</View>
|
||||
<Text className="user-edit-popup-tips">请设置2-20个字符,由中文、英文、数字、-和_组成</Text>
|
||||
<View className="user-edit-popup-operation">
|
||||
<Button onClick={handleTextareaReset} hoverClass="none" className="user-edit-popup-operation-reset">重置</Button>
|
||||
<Button onClick={()=>props.save(value)} hoverClass="none" className="user-edit-popup-operation-save">保存</Button>
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
)
|
||||
})
|
@ -124,6 +124,7 @@ export default () => {
|
||||
wxLogin,
|
||||
getSelfUserInfo,
|
||||
getPhoneNumber,
|
||||
userInfo
|
||||
userInfo,
|
||||
getAdminUserInfo
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user