zs пре 1 година
родитељ
комит
16ffcd8b6f

+ 1 - 1
src/router/index.ts

@@ -70,7 +70,7 @@ router.beforeEach(async (to, from, next) => {
     if (token) {
     if (token) {
       const res = await axios.request({
       const res = await axios.request({
         method: 'get',
         method: 'get',
-        url: '/follow/v1/api/tool/token',
+        url: '/visit/tool/token',
         responseType: 'json',
         responseType: 'json',
         headers: {
         headers: {
           token: token
           token: token

+ 0 - 52
src/stores/basic/dictData.ts

@@ -1,52 +0,0 @@
-import { ref, computed } from 'vue';
-import { defineStore } from 'pinia';
-import { AxiosWrapper } from '@/util/axios-wrapper';
-import _ from 'lodash';
-
-import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
-const axios = new AxiosWrapper();
-const api = {
-  url: `/follow/api/dictData`
-};
-export const DictDataStore = defineStore('dictData', () => {
-  const count = ref(0);
-  const doubleCount = computed(() => count.value * 2);
-  function increment() {
-    count.value++;
-  }
-  const query = async ({ skip = 0, limit = undefined, ...info }: IQueryParams = {}): Promise<IQueryResult> => {
-    let cond: IQueryType = {};
-    if (skip) cond.skip = skip;
-    if (limit) cond.limit = limit;
-    cond = { ...cond, ...info };
-    const res = await axios.$get(`${api.url}`, cond);
-    return res;
-  };
-  const fetch = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$get(`${api.url}/${payload}`);
-    return res;
-  };
-  const create = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$post(`${api.url}`, payload);
-    return res;
-  };
-  const update = async (payload: any): Promise<IQueryResult> => {
-    const id = _.get(payload, 'id', _.get(payload, '_id'));
-    const res = await axios.$post(`${api.url}/${id}`, payload);
-    return res;
-  };
-  const del = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$delete(`${api.url}/${payload}`);
-    return res;
-  };
-  return {
-    count,
-    doubleCount,
-    increment,
-    query,
-    fetch,
-    create,
-    update,
-    del
-  };
-});

+ 0 - 52
src/stores/basic/dictType.ts

@@ -1,52 +0,0 @@
-import { ref, computed } from 'vue';
-import { defineStore } from 'pinia';
-import { AxiosWrapper } from '@/util/axios-wrapper';
-import _ from 'lodash';
-
-import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
-const axios = new AxiosWrapper();
-const api = {
-  url: `/follow/api/dictType`
-};
-export const DictTypeStore = defineStore('dictType', () => {
-  const count = ref(0);
-  const doubleCount = computed(() => count.value * 2);
-  function increment() {
-    count.value++;
-  }
-  const query = async ({ skip = 0, limit = undefined, ...info }: IQueryParams = {}): Promise<IQueryResult> => {
-    let cond: IQueryType = {};
-    if (skip) cond.skip = skip;
-    if (limit) cond.limit = limit;
-    cond = { ...cond, ...info };
-    const res = await axios.$get(`${api.url}`, cond);
-    return res;
-  };
-  const fetch = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$get(`${api.url}/${payload}`);
-    return res;
-  };
-  const create = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$post(`${api.url}`, payload);
-    return res;
-  };
-  const update = async (payload: any): Promise<IQueryResult> => {
-    const id = _.get(payload, 'id', _.get(payload, '_id'));
-    const res = await axios.$post(`${api.url}/${id}`, payload);
-    return res;
-  };
-  const del = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$delete(`${api.url}/${payload}`);
-    return res;
-  };
-  return {
-    count,
-    doubleCount,
-    increment,
-    query,
-    fetch,
-    create,
-    update,
-    del
-  };
-});

+ 1 - 1
src/stores/basic/menus.ts

@@ -6,7 +6,7 @@ import _ from 'lodash';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 const axios = new AxiosWrapper();
 const axios = new AxiosWrapper();
 const api = {
 const api = {
-  url: `/follow/api/menus`
+  url: `/visit/menus`
 };
 };
 export const MenusStore = defineStore('menus', () => {
 export const MenusStore = defineStore('menus', () => {
   const count = ref(0);
   const count = ref(0);

+ 1 - 1
src/stores/basic/role.ts

@@ -6,7 +6,7 @@ import _ from 'lodash';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 const axios = new AxiosWrapper();
 const axios = new AxiosWrapper();
 const api = {
 const api = {
-  url: `/follow/api/role`
+  url: `/visit/role`
 };
 };
 export const RoleStore = defineStore('role', () => {
 export const RoleStore = defineStore('role', () => {
   const count = ref(0);
   const count = ref(0);

+ 2 - 8
src/stores/users/admin.ts

@@ -6,7 +6,7 @@ import _ from 'lodash';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 const axios = new AxiosWrapper();
 const axios = new AxiosWrapper();
 const api = {
 const api = {
-  url: `/follow/api/admin`
+  url: `/visit/admin`
 };
 };
 export const AdminStore = defineStore('admin', () => {
 export const AdminStore = defineStore('admin', () => {
   const count = ref(0);
   const count = ref(0);
@@ -43,11 +43,6 @@ export const AdminStore = defineStore('admin', () => {
     const res = await axios.$post(`${api.url}/login`, payload);
     const res = await axios.$post(`${api.url}/login`, payload);
     return res;
     return res;
   };
   };
-  //password
-  const rp = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$post(`${api.url}/rp`, payload);
-    return res;
-  };
   return {
   return {
     count,
     count,
     doubleCount,
     doubleCount,
@@ -57,7 +52,6 @@ export const AdminStore = defineStore('admin', () => {
     create,
     create,
     update,
     update,
     del,
     del,
-    login,
-    rp
+    login
   };
   };
 });
 });

+ 2 - 13
src/stores/users/doctor.ts

@@ -6,7 +6,7 @@ import _ from 'lodash';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 const axios = new AxiosWrapper();
 const axios = new AxiosWrapper();
 const api = {
 const api = {
-  url: `/follow/api/doctor`
+  url: `/visit/doctor`
 };
 };
 export const DoctorStore = defineStore('doctor', () => {
 export const DoctorStore = defineStore('doctor', () => {
   const count = ref(0);
   const count = ref(0);
@@ -39,15 +39,6 @@ export const DoctorStore = defineStore('doctor', () => {
     const res = await axios.$delete(`${api.url}/${payload}`);
     const res = await axios.$delete(`${api.url}/${payload}`);
     return res;
     return res;
   };
   };
-  const login = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$post(`${api.url}/login`, payload);
-    return res;
-  };
-  //password
-  const rp = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$post(`${api.url}/rp`, payload);
-    return res;
-  };
   return {
   return {
     count,
     count,
     doubleCount,
     doubleCount,
@@ -56,8 +47,6 @@ export const DoctorStore = defineStore('doctor', () => {
     fetch,
     fetch,
     create,
     create,
     update,
     update,
-    del,
-    login,
-    rp
+    del
   };
   };
 });
 });

+ 48 - 0
src/stores/users/login.ts

@@ -0,0 +1,48 @@
+import { ref, computed } from 'vue';
+import { defineStore } from 'pinia';
+import { AxiosWrapper } from '@/util/axios-wrapper';
+
+import type { IQueryResult } from '@/util/types.util';
+const axios = new AxiosWrapper();
+const api = {
+  url: `/visit/login`
+};
+export const LoginStore = defineStore('login', () => {
+  const count = ref(0);
+  const doubleCount = computed(() => count.value * 2);
+  function increment() {
+    count.value++;
+  }
+  // login
+  const admin = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$post(`${api.url}/Admin`, payload);
+    return res;
+  };
+  const doctor = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$post(`${api.url}/Doctor`, payload);
+    return res;
+  };
+  const nurse = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$post(`${api.url}/Nurse`, payload);
+    return res;
+  };
+  const patient = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$post(`${api.url}/Patient`, payload);
+    return res;
+  };
+  //password
+  const rp = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$post(`${api.url}/rp`, payload);
+    return res;
+  };
+  return {
+    count,
+    doubleCount,
+    increment,
+    admin,
+    doctor,
+    nurse,
+    patient,
+    rp
+  };
+});

+ 2 - 13
src/stores/users/nurse.ts

@@ -6,7 +6,7 @@ import _ from 'lodash';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
 const axios = new AxiosWrapper();
 const axios = new AxiosWrapper();
 const api = {
 const api = {
-  url: `/follow/api/nurse`
+  url: `/visit/nurse`
 };
 };
 export const NurseStore = defineStore('nurse', () => {
 export const NurseStore = defineStore('nurse', () => {
   const count = ref(0);
   const count = ref(0);
@@ -39,15 +39,6 @@ export const NurseStore = defineStore('nurse', () => {
     const res = await axios.$delete(`${api.url}/${payload}`);
     const res = await axios.$delete(`${api.url}/${payload}`);
     return res;
     return res;
   };
   };
-  const login = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$post(`${api.url}/login`, payload);
-    return res;
-  };
-  //password
-  const rp = async (payload: any): Promise<IQueryResult> => {
-    const res = await axios.$post(`${api.url}/rp`, payload);
-    return res;
-  };
   return {
   return {
     count,
     count,
     doubleCount,
     doubleCount,
@@ -56,8 +47,6 @@ export const NurseStore = defineStore('nurse', () => {
     fetch,
     fetch,
     create,
     create,
     update,
     update,
-    del,
-    login,
-    rp
+    del
   };
   };
 });
 });

+ 7 - 13
src/views/login/index.vue

@@ -39,9 +39,8 @@
 
 
 <script setup lang="ts">
 <script setup lang="ts">
 // 基础
 // 基础
-
 import type { Ref } from 'vue';
 import type { Ref } from 'vue';
-import { onMounted, ref, reactive } from 'vue';
+import { ref, reactive } from 'vue';
 import type { FormInstance, FormRules } from 'element-plus';
 import type { FormInstance, FormRules } from 'element-plus';
 import { ElMessage } from 'element-plus';
 import { ElMessage } from 'element-plus';
 import { Lock } from '@element-plus/icons-vue';
 import { Lock } from '@element-plus/icons-vue';
@@ -50,13 +49,9 @@ import { useRouter } from 'vue-router';
 import { siteInfo } from '@/layout/site';
 import { siteInfo } from '@/layout/site';
 
 
 // 接口
 // 接口
-import { AdminStore } from '@/stores/users/admin'; // 管理员
-import { DoctorStore } from '@/stores/users/doctor'; //医生
-import { NurseStore } from '@/stores/users/nurse'; //护士
+import { LoginStore } from '@/stores/users/login'; // 登录
 import type { IQueryResult } from '@/util/types.util';
 import type { IQueryResult } from '@/util/types.util';
-const adminAxios = AdminStore();
-const doctorAxios = DoctorStore();
-const nurseAxios = NurseStore();
+const loginAxios = LoginStore();
 // 路由
 // 路由
 const router = useRouter();
 const router = useRouter();
 // 表单
 // 表单
@@ -78,8 +73,7 @@ const validCode: Ref<String> = ref('');
 const code: Ref<String> = ref('');
 const code: Ref<String> = ref('');
 // 加载中
 // 加载中
 const loading: Ref<Boolean> = ref(false);
 const loading: Ref<Boolean> = ref(false);
-// 请求
-onMounted(async () => { });
+
 //接收验证码组件提交的4位验证码
 //接收验证码组件提交的4位验证码
 const createValidCode = (data) => {
 const createValidCode = (data) => {
   validCode.value = data;
   validCode.value = data;
@@ -107,9 +101,9 @@ const toSave = async (formEl: FormInstance) => {
 const toLogin = async (data: formData) => {
 const toLogin = async (data: formData) => {
   let res: IQueryResult;
   let res: IQueryResult;
   const form = { account: data.account, password: data.password };
   const form = { account: data.account, password: data.password };
-  if (data.type == '0') res = await adminAxios.login(form); //管理员
-  else if (data.type == '1') res = await doctorAxios.login(form); //医生
-  else res = await nurseAxios.login(form); //护士
+  if (data.type == '0') res = await loginAxios.admin(form); //管理员
+  else if (data.type == '1') res = await loginAxios.doctor(form); //医生
+  else res = await loginAxios.nurse(form); //护士
   if (res.errcode == '0') {
   if (res.errcode == '0') {
     loading.value = true;
     loading.value = true;
     ElMessage({ message: `登录成功`, type: 'success' });
     ElMessage({ message: `登录成功`, type: 'success' });

+ 3 - 4
vite.config.ts

@@ -14,14 +14,13 @@ export default defineConfig(({ mode }) => {
     server: {
     server: {
       port: 8006,
       port: 8006,
       proxy: {
       proxy: {
-        '/files': {
-          target: 'https://broadcast.waityou24.cn',
+        '/visit/api/files': {
+          target: 'http://192.168.1.113:8890',
           changeOrigin: true
           changeOrigin: true
         },
         },
-        '/follow/api': {
+        '/visit': {
           target: 'http://192.168.1.113:8890',
           target: 'http://192.168.1.113:8890',
           changeOrigin: true,
           changeOrigin: true,
-          pathRewrite: { '^/follow/api': '' },
           ws: false
           ws: false
         }
         }
       },
       },