You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.9 KiB
69 lines
1.9 KiB
12 months ago
|
import { APP_INITIALIZER, ApplicationConfig, importProvidersFrom } from '@angular/core'
|
||
|
import { provideRouter } from '@angular/router'
|
||
|
|
||
|
import { registerLocaleData } from '@angular/common'
|
||
|
import zh from '@angular/common/locales/zh'
|
||
|
import { FormsModule } from '@angular/forms'
|
||
|
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http'
|
||
|
import { provideAnimations } from '@angular/platform-browser/animations'
|
||
|
import { zh_CN, provideNzI18n } from 'ng-zorro-antd/i18n'
|
||
|
import { routes } from './app.routes'
|
||
|
import { ServerPaginatedTableService } from './components/server-paginated-table'
|
||
|
import { LocalHttpInterceptorService } from './services'
|
||
|
import { PermissionModule } from './shared/permission/permission.module'
|
||
|
import { TINYMCE_SCRIPT_SRC } from '@tinymce/tinymce-angular'
|
||
|
|
||
|
registerLocaleData(zh)
|
||
|
|
||
|
export const APPOINTMENT_FROM = [
|
||
|
{ value: 1, label: '美团' },
|
||
|
{ value: 2, label: '大众点评' },
|
||
|
{ value: 3, label: '小红书' },
|
||
|
{ value: 4, label: '抖音' },
|
||
|
]
|
||
|
|
||
|
export function initializeApp(configService: ServerPaginatedTableService) {
|
||
|
return () => {
|
||
|
configService.initial()
|
||
|
configService.setConfig({
|
||
|
formatPaginationData(v) {
|
||
|
return {
|
||
|
current: v.pageIndex,
|
||
|
pageSize: v.pageSize,
|
||
|
}
|
||
|
},
|
||
|
formatServiceData(v) {
|
||
|
console.log('v', v)
|
||
|
return {
|
||
|
total: v.data.total,
|
||
|
totalPages: Math.ceil(v.data.records / 5),
|
||
|
data: v.data.records,
|
||
|
}
|
||
|
},
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const appConfig: ApplicationConfig = {
|
||
|
providers: [
|
||
|
provideRouter(routes),
|
||
|
provideNzI18n(zh_CN),
|
||
|
importProvidersFrom(FormsModule),
|
||
|
importProvidersFrom(HttpClientModule),
|
||
|
importProvidersFrom(PermissionModule.forRoot()),
|
||
|
provideAnimations(),
|
||
|
{
|
||
|
provide: HTTP_INTERCEPTORS,
|
||
|
useClass: LocalHttpInterceptorService,
|
||
|
multi: true,
|
||
|
},
|
||
|
{
|
||
|
provide: APP_INITIALIZER,
|
||
|
useFactory: initializeApp,
|
||
|
deps: [ServerPaginatedTableService],
|
||
|
multi: true,
|
||
|
},
|
||
|
{ provide: TINYMCE_SCRIPT_SRC, useValue: 'tinymce/tinymce.min.js' },
|
||
|
],
|
||
|
}
|