diff --git a/package.json b/package.json
index 8809e6d..34b2c55 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,8 @@
"react-dom": "^18.2.0",
"react-i18next": "^14.1.2",
"react-router-dom": "^6.10.0",
- "react-to-pdf": "^1.0.1"
+ "react-to-pdf": "^1.0.1",
+ "zustand": "^4.5.0"
},
"devDependencies": {
"@types/react": "^18.0.28",
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index f691c79..a8b3a66 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -26,7 +26,6 @@
"ChangePassword": "Change password",
"Profile": "Profile",
"Logout": "Logout",
- "ChangeVendor": "Change Vendor",
"LoginTimeout": "Login timeout",
"LoginTimeoutTip": "Please input your password",
diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json
index ffccf32..58c5f6b 100644
--- a/public/locales/zh/common.json
+++ b/public/locales/zh/common.json
@@ -26,7 +26,6 @@
"ChangePassword": "修改密码",
"Profile": "账户中心",
"Logout": "退出",
- "ChangeVendor": "切换账户",
"LoginTimeout": "登录超时",
"LoginTimeoutTip": "请输入密码",
diff --git a/src/main.jsx b/src/main.jsx
index 97d59e1..1e4e687 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -27,7 +27,6 @@ import InvoiceIndex from "@/views/invoice/Index";
import InvoiceDetail from "@/views/invoice/Detail";
import InvoicePaid from "@/views/invoice/Paid";
import InvoicePaidDetail from "@/views/invoice/PaidDetail";
-import ChangeVendor from "@/views/account/ChangeVendor";
import './i18n';
@@ -61,7 +60,6 @@ const router = createBrowserRouter([
{ path: "invoice/detail/:GMDSN/:GSN",element:},
{ path: "invoice/paid",element:},
{ path: "invoice/paid/detail/:flid",element:},
- { path: "account/change-vendor",element:},
]
},
{
diff --git a/src/stores/Auth.js b/src/stores/Auth.js
index 0110238..2338254 100644
--- a/src/stores/Auth.js
+++ b/src/stores/Auth.js
@@ -3,11 +3,47 @@ import { fetchJSON, postForm } from '@/utils/request';
import { HT_HOST } from "@/config";
import { isNotEmpty, prepareUrl } from '@/utils/commons';
import { loadPageSpy } from '@/pageSpy';
+import { create } from 'zustand'
const KEY_LOGIN_TOKEN = 'KEY_LOGIN_TOKEN';
const KEY_TRAVEL_AGENCY_ID = 'KEY_TRAVEL_AGENCY_ID';
const KEY_USER_ID = 'KEY_USER_ID';
+const useAuthStore = create((set, get) => ({
+
+ loginUser: {
+ userId: -1,
+ username: '',
+ avatarUrl: '',
+ mobile: '',
+ email: '',
+ permissionList: [],
+ },
+
+ isPermitted: (perm) => {
+ return true
+ // 以上是 Hardcode 判断
+ // 以下是权限列表从数据库读取后使用的方法
+ // return this.permissionList.some((value, key, arry) => {
+ // if (value.indexOf(WILDCARD_TOKEN) > -1) {
+ // return true;
+ // }
+ // if (value === perm) {
+ // return true;
+ // }
+ // return false;
+ // });
+
+ },
+
+ login: async (authCode) => {
+ },
+
+ logout: () => {
+ },
+
+}))
+
class Auth {
constructor(root) {
@@ -143,34 +179,6 @@ class Auth {
});
}
- //切换供应商
- changeVendor(VEISN){
- // const formData = new FormData();
- // formData.append('VEI_SN',VEISN);
- // formData.append('LMI_SN',this.login.userId);
- // formData.append('token', this.login.token);
- const fetchUrl = prepareUrl(HT_HOST+'/service-cusservice/PTChangeVendor')
- .append('LMI_SN',this.login.userId)
- .append('VEI_SN',VEISN)
- .append('token', this.login.token)
- .build();
- //console.log(fetchUrl);
- // return false;
-
- return fetchJSON(fetchUrl)
- .then(()=>{
- let json = {"errcode": 0, "errmsg": "ok", "Result":[]};
- if (json.errcode==0){
- //console.log(json);
- return json;
- }else{
- throw new Error(json.errmsg+":"+json.errcode);
- }
- });
- }
-
- VendorList = [];//海外供应商列表
-
login = {
token: '',
userId: 0, // LMI_SN
diff --git a/src/views/account/ChangeVendor.jsx b/src/views/account/ChangeVendor.jsx
deleted file mode 100644
index 190eb71..0000000
--- a/src/views/account/ChangeVendor.jsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import { useNavigate } from "react-router-dom";
-import { useEffect, useState, useRef } from "react";
-import { observer } from "mobx-react";
-import { Button, Space, Form, Input, Row, Typography, App,Select } from "antd";
-import { useStore } from "@/stores/StoreContext.js";
-
-const { Title } = Typography;
-
-function ChangeVendor() {
- const navigate = useNavigate();
- const { authStore,VendorList } = useStore();
- const { notification } = App.useApp();
- const [form] = Form.useForm();
- const { formVeiSn, onVeiSnChange } = useState();
-
-
- useEffect(() => {
- authStore.fetchVendorList();
- },[]);
-
- //币种
- function bindVendor() {
-
- let arr=[];
- arr = authStore.VendorList.map((data,index) =>{
- return {
- value: data.VEI_SN,
- label: data.VEI2_CompanyBN,
- }
- })
- return arr;
-
- }
-
- const onFinish = (values) => {
- if (values.VEISN == authStore.login.travelAgencyId){
- notification.error({
- message: `Notification`,
- description: "切换的供应商是当前供应商.",
- placement: "top",
- duration: 4,
- });
- return ;
- }
- // console.log(values);
- // console.log(authStore.login.travelAgencyId);
-
- authStore.changeVendor(values.VEISN)
- .then(()=>{
- authStore.logout();
- })
- .catch(()=>{
- //console.log(json);
- notification.error({
- message: `Notification`,
- description: "切换的供应商错误,请重试!",
- placement: "top",
- duration: 4,
- });
- })
- };
-
- const onFinishFailed = (errorInfo) => {
- console.log("Failed:", errorInfo);
- // form.resetFields();
- };
-
- return (
-
-
- Change your password
-
-
-
-
-
-
-
-
-
-
-
- );
-}
-
-export default observer(ChangeVendor);