|
@@ -10,8 +10,10 @@ import {
|
|
import { isSuccess } from "@/utils";
|
|
import { isSuccess } from "@/utils";
|
|
|
|
|
|
|
|
|
|
|
|
+type TVoiceRequestParam = Omit<TGetMyVoicesParams, 'entId'>
|
|
export interface StorageStoreState {
|
|
export interface StorageStoreState {
|
|
// 初始状态
|
|
// 初始状态
|
|
|
|
+ entId: number|string
|
|
voices: TVoiceItem[];
|
|
voices: TVoiceItem[];
|
|
myVoices: TVoiceItem[];
|
|
myVoices: TVoiceItem[];
|
|
maleVoices: TVoiceItem[];
|
|
maleVoices: TVoiceItem[];
|
|
@@ -20,9 +22,10 @@ export interface StorageStoreState {
|
|
malePagination: TPageination;
|
|
malePagination: TPageination;
|
|
femalePagination: TPageination;
|
|
femalePagination: TPageination;
|
|
isLoading: boolean,
|
|
isLoading: boolean,
|
|
- getVoices: (params?: TGetMyVoicesParams) => Promise<boolean>;
|
|
|
|
- getMaleVoices: (params?: TGetMyVoicesParams) => Promise<boolean>;
|
|
|
|
- getFemaleVoices: (params?: TGetMyVoicesParams) => Promise<boolean>;
|
|
|
|
|
|
+ setEntId: (entId: number|string)=> void
|
|
|
|
+ getVoices: (params?: TVoiceRequestParam) => Promise<boolean>;
|
|
|
|
+ getMaleVoices: (params?: TVoiceRequestParam) => Promise<boolean>;
|
|
|
|
+ getFemaleVoices: (params?: TVoiceRequestParam) => Promise<boolean>;
|
|
setPagination: (params:any) => Promise<void>;
|
|
setPagination: (params:any) => Promise<void>;
|
|
setMalePagination: (params:any) => Promise<void>;
|
|
setMalePagination: (params:any) => Promise<void>;
|
|
setFemalePagination: (params:any) => Promise<void>;
|
|
setFemalePagination: (params:any) => Promise<void>;
|
|
@@ -33,6 +36,7 @@ export interface StorageStoreState {
|
|
}
|
|
}
|
|
|
|
|
|
export const useVoiceStore = create<StorageStoreState>((set, get) => ({
|
|
export const useVoiceStore = create<StorageStoreState>((set, get) => ({
|
|
|
|
+ entId: 0,
|
|
voices: [],
|
|
voices: [],
|
|
myVoices: [],
|
|
myVoices: [],
|
|
maleVoices: [],
|
|
maleVoices: [],
|
|
@@ -59,14 +63,19 @@ export const useVoiceStore = create<StorageStoreState>((set, get) => ({
|
|
extData: null,
|
|
extData: null,
|
|
},
|
|
},
|
|
isLoading: false,
|
|
isLoading: false,
|
|
|
|
+ setEntId: (entId)=> {
|
|
|
|
+ set({entId: entId})
|
|
|
|
+ },
|
|
getVoices: async (params = {}) => {
|
|
getVoices: async (params = {}) => {
|
|
set({ isLoading: true });
|
|
set({ isLoading: true });
|
|
|
|
+ console.log(get().entId, 8888)
|
|
// 合并当前分页参数和传入参数
|
|
// 合并当前分页参数和传入参数
|
|
const currentPagination = get().pagination;
|
|
const currentPagination = get().pagination;
|
|
- const requestParams = { ...currentPagination, ...params };
|
|
|
|
|
|
+ const requestParams = { ...currentPagination, entId: get().entId, ...params };
|
|
|
|
|
|
const response = await _getVoices(requestParams)
|
|
const response = await _getVoices(requestParams)
|
|
|
|
|
|
|
|
+ // todo: 我的克隆声音后期需要单独,现只是从全部列表中过滤出
|
|
// 更新状态
|
|
// 更新状态
|
|
set({
|
|
set({
|
|
voices: response.data.data,
|
|
voices: response.data.data,
|
|
@@ -82,7 +91,7 @@ export const useVoiceStore = create<StorageStoreState>((set, get) => ({
|
|
getMaleVoices: async (params = {}) => {
|
|
getMaleVoices: async (params = {}) => {
|
|
set({ isLoading: true });
|
|
set({ isLoading: true });
|
|
const currentPagination = get().malePagination;
|
|
const currentPagination = get().malePagination;
|
|
- const requestParams = { ...currentPagination, ...params, gender: 'male' as TGender };
|
|
|
|
|
|
+ const requestParams = { ...currentPagination, entId: get().entId, ...params, gender: 'male' as TGender };
|
|
|
|
|
|
const response = await _getVoices(requestParams)
|
|
const response = await _getVoices(requestParams)
|
|
|
|
|
|
@@ -99,7 +108,7 @@ export const useVoiceStore = create<StorageStoreState>((set, get) => ({
|
|
getFemaleVoices: async (params = {}) => {
|
|
getFemaleVoices: async (params = {}) => {
|
|
set({ isLoading: true });
|
|
set({ isLoading: true });
|
|
const currentPagination = get().femalePagination;
|
|
const currentPagination = get().femalePagination;
|
|
- const requestParams = { ...currentPagination, ...params, gender: 'female' as TGender };
|
|
|
|
|
|
+ const requestParams = { ...currentPagination, entId: get().entId, ...params, gender: 'female' as TGender };
|
|
|
|
|
|
const response = await _getVoices(requestParams)
|
|
const response = await _getVoices(requestParams)
|
|
|
|
|
|
@@ -134,7 +143,6 @@ export const useVoiceStore = create<StorageStoreState>((set, get) => ({
|
|
get().getFemaleVoices();
|
|
get().getFemaleVoices();
|
|
},
|
|
},
|
|
cloneVoice: async (params) => {
|
|
cloneVoice: async (params) => {
|
|
- const response = await _cloneVoice(params)
|
|
|
|
- console.log(response,444444)
|
|
|
|
|
|
+ await _cloneVoice(params)
|
|
}
|
|
}
|
|
}));
|
|
}));
|