Pārlūkot izejas kodu

Merge branch 'master' of http://git.cc-lotus.info/zkzx/common

guhongwei 2 gadi atpakaļ
vecāks
revīzija
d72fc91f27

+ 7 - 1
src/stores/admins/admin.ts

@@ -43,6 +43,11 @@ export const AdminStore = defineStore('admin', () => {
     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 {
     count,
     doubleCount,
@@ -52,6 +57,7 @@ export const AdminStore = defineStore('admin', () => {
     create,
     update,
     del,
-    login
+    login,
+    rp
   }
 })

+ 63 - 0
src/stores/admins/expert.ts

@@ -0,0 +1,63 @@
+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: `/zkzx/v2/api/expert`
+}
+export const ExpertStore = defineStore('expert', () => {
+  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
+  }
+  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 {
+    count,
+    doubleCount,
+    increment,
+    query,
+    fetch,
+    create,
+    update,
+    del,
+    login,
+    rp
+  }
+})

+ 7 - 1
src/stores/admins/personal.ts

@@ -43,6 +43,11 @@ export const PersonalStore = defineStore('personal', () => {
     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 {
     count,
     doubleCount,
@@ -52,6 +57,7 @@ export const PersonalStore = defineStore('personal', () => {
     create,
     update,
     del,
-    login
+    login,
+    rp
   }
 })