From 7322f1336ded31d51696f8417db3f5179a2e18c5 Mon Sep 17 00:00:00 2001
From: li tong bao <2903733959@qq.com>
Date: Tue, 14 Jun 2022 15:18:55 +0800
Subject: [PATCH] =?UTF-8?q?--=E7=BC=96=E8=BE=91=E4=B8=AA=E4=BA=BA=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=E5=AF=B9=E6=8E=A550%?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/common/constant.js | 6 +-
src/pages/user/index.module.scss | 30 +++--
src/pages/user/index.tsx | 47 +++++---
.../userEdit/components/ModifyModal.scss | 76 ++++++++++++
src/pages/userEdit/components/ModifyModal.tsx | 49 ++++++++
src/pages/userEdit/index.scss | 109 +++++++----------
src/pages/userEdit/index.tsx | 114 ++++++++----------
src/use/useLogin.ts | 3 +-
8 files changed, 269 insertions(+), 165 deletions(-)
create mode 100644 src/pages/userEdit/components/ModifyModal.scss
create mode 100644 src/pages/userEdit/components/ModifyModal.tsx
diff --git a/src/common/constant.js b/src/common/constant.js
index dc069fb..2f4fa08 100644
--- a/src/common/constant.js
+++ b/src/common/constant.js
@@ -5,12 +5,12 @@
// export const BASE_URL = `http://192.168.0.89:40001/lymarket`
// export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞
// export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境
-// export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发
+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` // 正式环境
-// export const BASE_URL = `http://192.168.1.4:40001/lymarket` // 王霞
-export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添
+// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
+// export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添
// export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰
// CDN
diff --git a/src/pages/user/index.module.scss b/src/pages/user/index.module.scss
index 464844d..a34a08c 100644
--- a/src/pages/user/index.module.scss
+++ b/src/pages/user/index.module.scss
@@ -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;
diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx
index e8fd7a7..c9a8c35 100644
--- a/src/pages/user/index.tsx
+++ b/src/pages/user/index.tsx
@@ -9,20 +9,29 @@ import useLogin from '@/use/useLogin'
export default () => {
// 用户信息
const { getSelfUserInfo } = useLogin();
- const {adminUserInfo, userInfo} = useSelector(state => state.userInfo);
+ const {adminUserInfo} = useSelector(state => state.userInfo);
useEffect(()=>{
- getSelfUserInfo();
+ getSelfUserInfo().then().catch(()=>{
+ alert.none("授权失败,请授权后再使用");
+ });
},[]);
+ const handleAuth = async ()=>{
+ getSelfUserInfo().then().catch(()=>{
+ alert.none("授权失败,请授权后再使用");
+ });
+ }
return (
-
+
+ {!adminUserInfo.is_authorize_name&&}
)
}
+// 提示弹窗
const Modal = memo((props:any)=>{
const {data} = props;
const [modalShow, setModalShow]=useState(true);
@@ -31,16 +40,16 @@ const Modal = memo((props:any)=>{
return(
<>
{!data?.is_authorize_phone&&modalShow&&
-
- e.stopPropagation()}>
- 首次登录提醒
-
- To: 万丰园纺织科技
- 尊敬的老朋友,欢迎你使用小程序商城;由于您是我们长期合作的伙伴,你的组织已自动为你生成,关联后可查看历史订单哟。
- 信息错误请联系客服
+
+ e.stopPropagation()}>
+ 首次登录提醒
+
+ To: 万丰园纺织科技
+ 尊敬的老朋友,欢迎你使用小程序商城;由于您是我们长期合作的伙伴,你的组织已自动为你生成,关联后可查看历史订单哟。
+ 信息错误请联系客服
-
-
+
+
setModalShow(false)}>我知道
@@ -52,10 +61,10 @@ 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)=>{
if(ev.detail?.code){
@@ -64,7 +73,6 @@ const Header = memo((props:any) => {
alert.none("绑定失败!");
}
}
-
return (
@@ -115,15 +123,14 @@ const Header = memo((props:any) => {
{
menu.map((item, index) => {
return (
-
+
{item.text}
{index==2?"99+":10}
-
+
)
})
}
-
diff --git a/src/pages/userEdit/components/ModifyModal.scss b/src/pages/userEdit/components/ModifyModal.scss
new file mode 100644
index 0000000..fe370e9
--- /dev/null
+++ b/src/pages/userEdit/components/ModifyModal.scss
@@ -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;
+ }
+ }
\ No newline at end of file
diff --git a/src/pages/userEdit/components/ModifyModal.tsx b/src/pages/userEdit/components/ModifyModal.tsx
new file mode 100644
index 0000000..0e51ac1
--- /dev/null
+++ b/src/pages/userEdit/components/ModifyModal.tsx
@@ -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 (
+ setModalShow(false)} title={title} show={modalShow}>
+
+
+
+ 请设置2-20个字符,可由中文、英文、数字组成
+
+
+
+
+
+
+ )
+}))
\ No newline at end of file
diff --git a/src/pages/userEdit/index.scss b/src/pages/userEdit/index.scss
index c34ca9b..ecc9473 100644
--- a/src/pages/userEdit/index.scss
+++ b/src/pages/userEdit/index.scss
@@ -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; }
}
\ No newline at end of file
diff --git a/src/pages/userEdit/index.tsx b/src/pages/userEdit/index.tsx
index 62974a6..bea22f1 100644
--- a/src/pages/userEdit/index.tsx
+++ b/src/pages/userEdit/index.tsx
@@ -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 (
@@ -75,21 +84,31 @@ export default ()=>{
个人资料
- triggerList('real_name')} data={state.data.user_name} label="昵称" placeholder="请输入" icon=""/>
- onNavigate("/pages/company/index")} label="手机号" placeholder="去绑定" icon=""/>
+ (ModifyIcknameEl.current as any).setModalShow(true)} data={(formData as any)?.user_name} label="昵称" placeholder="请输入" icon=""/>
+
+ {((formData as any)?.phone)?
+ {(formData as any)?.phone}
+ 已绑定
+ :
+
+ }
+
组织资料
- triggerList('real_name')} data={state.data.user_name} label="名称" placeholder="待绑定" icon=""/>
+ (ModifyCompanyNameEl.current as any).setModalShow(true)} data={(formData as any)?.company_name} label="名称" placeholder="待绑定" icon=""/>
onNavigate("/pages/company/index")} label="类型" placeholder="完善公司/组织信息" icon=""/>
onNavigate("/pages/certification/index")} label="我的认证" placeholder="待绑定" icon="">
- 已认证
+
+ 未认证
+
- onNavigate("/pages/weightList/index")} label="创建人" placeholder="完善公司/组织信息" icon=""/>
+ onNavigate("/pages/weightList/index")} label="创建人" data={(formData as any)?.founder_user_name} placeholder="完善公司/组织信息" icon=""/>
-
+ handleTextareaSave(value, "Ickname")}/>
+ handleTextareaSave(value, "companyName")}/>
)
}
@@ -114,34 +133,3 @@ const UserEditList = memo((props:any)=>{
)
})
-
-// 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 (
- props.setPopupShow(false)} title="修改昵称" show={props.show}>
-
-
-
- 请设置2-20个字符,由中文、英文、数字、-和_组成
-
-
-
-
-
-
- )
-})
\ No newline at end of file
diff --git a/src/use/useLogin.ts b/src/use/useLogin.ts
index 5bf2cc3..e16e10c 100644
--- a/src/use/useLogin.ts
+++ b/src/use/useLogin.ts
@@ -124,6 +124,7 @@ export default () => {
wxLogin,
getSelfUserInfo,
getPhoneNumber,
- userInfo
+ userInfo,
+ getAdminUserInfo
}
}