diff --git a/.env b/.env index 86e2b46..51b63d7 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ #TARO_APP_API=https://yjx.dev.yaojiankang.top -TARO_APP_API=https://mooc.yaojiankang.top -#TARO_APP_API=https://shopfix.yaojiankang.top +#TARO_APP_API=https://mooc.yaojiankang.top +TARO_APP_API=https://shopfix.yaojiankang.top #TARO_APP_API=https://playedu.yaojiankang.top TARO_APP_LGOIN=true diff --git a/src/api/user.ts b/src/api/user.ts index 0fd4151..bfdc66c 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -75,9 +75,6 @@ export const userApi = { hourCourse(course_id: string, unique_ident: number) { return request(`/api/v1/course/${course_id}/info/${unique_ident}`, "GET") }, - meetingSave(data: any) { - return request(`/api/v1/auth/login/meeting/save`, "POST", data) - }, info(user_id: string) { return request(`/api/v1/statistics/${user_id}`, "GET") }, @@ -89,5 +86,12 @@ export const userApi = { }, getCode(phone_number: number) { return request('/api/v1/sms/send?phone_number=' + phone_number, "GET") - } + }, + /** 公司列表 */ + companyList() { + return request(`/api/v1/company/mine_list`, "GET") + }, + companyReplace(id: number) { + return request(`/api/v1/company/replace/${id}`, "PATCH") + }, } diff --git a/src/pages/my/components/header/header.tsx b/src/pages/my/components/header/header.tsx index c590a7c..b2b8712 100644 --- a/src/pages/my/components/header/header.tsx +++ b/src/pages/my/components/header/header.tsx @@ -4,8 +4,8 @@ import styles from "@/pages/my/my.module.scss"; import avatar from "@/static/img/avatar.png" import blacktriang from "@/static/img/blacktriangle.png" -const Header = () => { - const {user} = Profile.useContainer() +const Header = ({showCompany}:{showCompany:()=> void}) => { + const {user,company} = Profile.useContainer() return ( @@ -14,8 +14,10 @@ const Header = () => { {user?.name} - - 江苏康缘药业股份有限公司 + { + showCompany() + }}> + {company?.name} {/**/} diff --git a/src/pages/my/my.module.scss b/src/pages/my/my.module.scss index c5098a2..3c52ea1 100644 --- a/src/pages/my/my.module.scss +++ b/src/pages/my/my.module.scss @@ -127,6 +127,9 @@ page { margin-left: 24rpx; width:24rpx; height:24rpx; + &.hide{ + background: none; + } } } diff --git a/src/pages/my/my.tsx b/src/pages/my/my.tsx index df47fc9..2b450f9 100644 --- a/src/pages/my/my.tsx +++ b/src/pages/my/my.tsx @@ -2,18 +2,28 @@ import {PageContainer, View, Image} from "@tarojs/components"; import Taro from "@tarojs/taro"; import styles from './my.module.scss' import Header from "./components/header/header"; -import {FC} from "react"; +import {FC, useState} from "react"; import Time from "@/pages/my/components/header/time"; import Service from "@/pages/my/components/header/service"; import LoginView from "@/components/loginView"; import {Profile} from "@/store"; -import {rfc33392time} from "@/utils/day"; import Img from "@/components/image/image"; import GreenNike from "@/static/img/greenNike.png" +import {userApi} from "@/api"; const My: FC = () => { const globalData = Taro.getApp().globalData - const {token,empty} = Profile.useContainer() + const {token,company,setCompany} = Profile.useContainer() + const [companyShow,setCompanyShow] = useState(false) + const [companyList,setCompanyList] = useState([]) + Taro.useDidShow(() => { + try { + userApi.companyList().then(res => { + setCompanyList(res as Company[]) + }) + } catch (e) { + } + }) return ( @@ -21,26 +31,50 @@ const My: FC = () => { : <> -
+
{setCompanyShow(true)}}/>