feat: NTRP测试入口接入
This commit is contained in:
43
src/store/evaluateStore.ts
Normal file
43
src/store/evaluateStore.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
export enum EvaluateScene {
|
||||
list,
|
||||
publish,
|
||||
detail,
|
||||
user,
|
||||
userEdit,
|
||||
share,
|
||||
}
|
||||
|
||||
export interface EvaluateCallback {
|
||||
type: EvaluateScene | ''
|
||||
next: (flag?: boolean) => void,
|
||||
onCancel: () => void,
|
||||
}
|
||||
|
||||
export interface EvaluateCallbackType extends EvaluateCallback {
|
||||
setCallback: (options: { type: EvaluateScene | '', next: () => void, onCancel: () => void }) => void,
|
||||
clear: () => void,
|
||||
}
|
||||
|
||||
export const useEvaluateCallback = create<EvaluateCallbackType>()((set) => ({
|
||||
type: '',
|
||||
next: () => { },
|
||||
onCancel: () => { },
|
||||
setCallback: ({ type, next, onCancel }) => {
|
||||
set({
|
||||
type,
|
||||
next,
|
||||
onCancel,
|
||||
})
|
||||
},
|
||||
clear: () => { set({ type: '', next: () => { }, onCancel: () => { } }) }
|
||||
}));
|
||||
|
||||
export const useEvaluate = () => useEvaluateCallback(({ type, next, onCancel, setCallback, clear }) => ({
|
||||
type,
|
||||
next,
|
||||
onCancel,
|
||||
setCallback,
|
||||
clear,
|
||||
}))
|
||||
Reference in New Issue
Block a user