zcw-shared 2.0.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +17 -180
  2. package/dist/constants/apiErrorCodes.d.ts +17 -0
  3. package/dist/constants/apiErrorCodes.js +26 -0
  4. package/dist/constants/apiErrorCodes.js.map +1 -0
  5. package/dist/constants/authStorage.d.ts +4 -0
  6. package/dist/constants/authStorage.js +5 -0
  7. package/dist/constants/authStorage.js.map +1 -0
  8. package/dist/functions/file/getIconfontNameByExtension.d.ts +7 -0
  9. package/dist/functions/file/getIconfontNameByExtension.js +140 -0
  10. package/dist/functions/file/getIconfontNameByExtension.js.map +1 -0
  11. package/dist/functions/im/formatImChatConversationListTime.d.ts +1 -0
  12. package/dist/functions/im/formatImChatConversationListTime.js +19 -0
  13. package/dist/functions/im/formatImChatConversationListTime.js.map +1 -0
  14. package/dist/functions/image/getImageDimensions.js +15 -5
  15. package/dist/functions/image/getImageDimensions.js.map +1 -1
  16. package/dist/functions/qiankun/createQiankunVueApp.d.ts +17 -0
  17. package/dist/functions/qiankun/createQiankunVueApp.js +40 -0
  18. package/dist/functions/qiankun/createQiankunVueApp.js.map +1 -0
  19. package/dist/functions/storage/useDexieShortcuts.d.ts +28 -0
  20. package/dist/functions/storage/useDexieShortcuts.js +54 -0
  21. package/dist/functions/storage/useDexieShortcuts.js.map +1 -0
  22. package/dist/functions/storage/useLocalStorage.js +11 -12
  23. package/dist/functions/storage/useLocalStorage.js.map +1 -1
  24. package/dist/functions/storage/useSessionStorage.js +11 -12
  25. package/dist/functions/storage/useSessionStorage.js.map +1 -1
  26. package/dist/functions/storage/useStorageWithIndexedDB.js +4 -5
  27. package/dist/functions/storage/useStorageWithIndexedDB.js.map +1 -1
  28. package/dist/functions/uniapp/app-plus/buildIOSApp.js +12 -0
  29. package/dist/functions/uniapp/app-plus/buildIOSApp.js.map +1 -1
  30. package/dist/schemas/auth.schema.d.ts +10 -5
  31. package/dist/schemas/auth.schema.js +2 -1
  32. package/dist/schemas/auth.schema.js.map +1 -1
  33. package/dist/schemas/video.schema.d.ts +21 -21
  34. package/dist/schemas/video.schema.js +2 -2
  35. package/dist/vue-hooks/browser/useBridgeMessage.js +7 -8
  36. package/dist/vue-hooks/browser/useBridgeMessage.js.map +1 -1
  37. package/package.json +34 -1
  38. package/types/address.d.ts +38 -0
  39. package/types/auth.d.ts +3 -1
  40. package/types/checkin-config.d.ts +28 -0
  41. package/types/cloud-disk-config.d.ts +36 -0
  42. package/types/im-api.d.ts +118 -0
  43. package/types/im-chat.d.ts +49 -0
  44. package/types/music.d.ts +33 -0
  45. package/types/notification.d.ts +37 -0
  46. package/types/order.d.ts +61 -0
  47. package/types/oss.d.ts +26 -0
  48. package/types/page-config.d.ts +14 -0
  49. package/types/payment.d.ts +21 -0
  50. package/types/performance.d.ts +12 -0
  51. package/types/points-config.d.ts +44 -0
  52. package/types/product.d.ts +41 -0
  53. package/types/rbac.d.ts +24 -0
  54. package/types/report.d.ts +29 -0
  55. package/types/review.d.ts +13 -0
  56. package/types/uniapp-ios-build.d.ts +2 -0
  57. package/types/user.d.ts +36 -0
  58. package/types/video.d.ts +2 -2
@@ -0,0 +1,33 @@
1
+ export interface MusicTrack {
2
+ id: number
3
+ title: string
4
+ artist: string
5
+ cover_url?: string
6
+ audio_url?: string
7
+ duration?: number
8
+ lyrics?: string
9
+ tags?: string[]
10
+ like_count?: number
11
+ comment_count?: number
12
+ share_count?: number
13
+ play_count?: number
14
+ created_at?: string
15
+ updated_at?: string
16
+ }
17
+
18
+ export interface MusicListResponse {
19
+ data: MusicTrack[]
20
+ total: number
21
+ limit: number
22
+ offset: number
23
+ }
24
+
25
+ export interface MusicDetailResponse {
26
+ data: MusicTrack
27
+ }
28
+
29
+ export interface CreateMusicPayload
30
+ extends Omit<MusicTrack, 'id' | 'created_at' | 'updated_at'> {}
31
+
32
+ export interface UpdateMusicPayload
33
+ extends Partial<Omit<MusicTrack, 'id' | 'created_at' | 'updated_at'>> {}
@@ -0,0 +1,37 @@
1
+ export type NotificationType =
2
+ | 'system'
3
+ | 'comment'
4
+ | 'reply'
5
+ | 'like'
6
+ | 'follow'
7
+ | 'post'
8
+ | 'order'
9
+ | 'payment'
10
+
11
+ export interface Notification {
12
+ id: number
13
+ user_id?: string
14
+ type?: NotificationType
15
+ title?: string
16
+ content?: string
17
+ status?: string
18
+ related_id?: string
19
+ related_type?: string
20
+ extra_data?: Record<string, unknown>
21
+ created_at?: string
22
+ updated_at?: string
23
+ }
24
+
25
+ export interface NotificationListResponse {
26
+ data: Notification[]
27
+ }
28
+
29
+ export interface CreateNotificationPayload {
30
+ user_id: string
31
+ type: NotificationType
32
+ title: string
33
+ content?: string
34
+ related_id?: string
35
+ related_type?: string
36
+ extra_data?: Record<string, unknown>
37
+ }
@@ -0,0 +1,61 @@
1
+ export enum OrderStatus {
2
+ PENDING = 'pending',
3
+ PAID = 'paid',
4
+ SHIPPED = 'shipped',
5
+ DELIVERED = 'delivered',
6
+ COMPLETED = 'completed',
7
+ CANCELLED = 'cancelled',
8
+ REFUNDED = 'refunded',
9
+ }
10
+
11
+ export interface OrderItem {
12
+ id: number
13
+ order_id: number
14
+ product_id: number
15
+ sku_id?: number
16
+ quantity: number
17
+ subtotal: number
18
+ product_name?: string
19
+ product_image?: string
20
+ }
21
+
22
+ export interface Order {
23
+ id: number
24
+ user_id: string
25
+ order_no: string
26
+ status: OrderStatus
27
+ total_amount: number
28
+ address_id?: number
29
+ remark?: string
30
+ tracking_number?: string
31
+ created_at?: string
32
+ updated_at?: string
33
+ items?: OrderItem[]
34
+ }
35
+
36
+ export interface OrderListResponse {
37
+ data: Order[]
38
+ pagination: {
39
+ total: number
40
+ page: number
41
+ page_size: number
42
+ total_pages: number
43
+ }
44
+ }
45
+
46
+ export interface CreateOrderPayload {
47
+ remark?: string
48
+ address_id?: number
49
+ items?: Array<{
50
+ product_id: number
51
+ quantity: number
52
+ sku_id?: number
53
+ }>
54
+ status?: OrderStatus
55
+ }
56
+
57
+ export interface UpdateOrderPayload {
58
+ status?: OrderStatus
59
+ tracking_number?: string
60
+ remark?: string
61
+ }
package/types/oss.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /** 与 api.zengchaowu.com OSS listFiles 返回结构一致 */
2
+ export interface OssFile {
3
+ id?: string
4
+ name: string
5
+ updated_at?: string
6
+ created_at?: string
7
+ last_accessed_at?: string
8
+ metadata?: Record<string, unknown>
9
+ }
10
+
11
+ export interface OssListParams {
12
+ bucket: string
13
+ path?: string
14
+ limit?: number
15
+ offset?: number
16
+ }
17
+
18
+ export interface OssListResponse {
19
+ data: OssFile[]
20
+ count: number
21
+ }
22
+
23
+ export interface OssDeleteFilesPayload {
24
+ bucket: string
25
+ paths: string[]
26
+ }
@@ -0,0 +1,14 @@
1
+ /** 与 api.zengchaowu.com GET /page-config 返回的 data 结构一致 */
2
+ export interface PageConfig {
3
+ appKey?: string
4
+ version?: string
5
+ tabBar?: unknown
6
+ permissions?: unknown
7
+ displays?: unknown
8
+ [key: string]: unknown
9
+ }
10
+
11
+ export interface PageConfigResponse {
12
+ code?: number
13
+ data?: PageConfig
14
+ }
@@ -0,0 +1,21 @@
1
+ export interface Payment {
2
+ id: number
3
+ user_id?: string
4
+ order_id?: number
5
+ amount?: number
6
+ status?: string
7
+ payment_method?: string
8
+ transaction_id?: string
9
+ created_at?: string
10
+ updated_at?: string
11
+ }
12
+
13
+ export interface PaymentListResponse {
14
+ data: Payment[]
15
+ pagination: {
16
+ total: number
17
+ page: number
18
+ page_size: number
19
+ total_pages: number
20
+ }
21
+ }
@@ -0,0 +1,12 @@
1
+ export interface PerformanceMetric {
2
+ type?: string
3
+ value?: number
4
+ timestamp?: number
5
+ [key: string]: unknown
6
+ }
7
+
8
+ export interface PerformanceMetricsResponse {
9
+ data?: PerformanceMetric[]
10
+ /** 或直接返回数组 */
11
+ [key: string]: unknown
12
+ }
@@ -0,0 +1,44 @@
1
+ export interface PointsConfig {
2
+ // 基础配置
3
+ enabled: boolean // 是否启用积分系统
4
+
5
+ // 积分获取规则
6
+ earn_rules: {
7
+ checkin: number // 签到获得积分
8
+ purchase: {
9
+ enabled: boolean // 是否启用购买获得积分
10
+ ratio: number // 购买金额与积分比例(1元 = ?积分)
11
+ max_per_order?: number // 单笔订单最大获得积分
12
+ }
13
+ reward: {
14
+ enabled: boolean // 是否启用奖励积分
15
+ default_amount: number // 默认奖励积分
16
+ }
17
+ }
18
+
19
+ // 积分消费规则
20
+ spend_rules: {
21
+ enabled: boolean // 是否允许消费积分
22
+ min_spend: number // 最小消费积分
23
+ max_spend_per_order?: number // 单笔订单最大消费积分
24
+ exchange_ratio: number // 积分兑换比例(?积分 = 1元)
25
+ }
26
+
27
+ // 积分过期规则
28
+ expire_rules: {
29
+ enabled: boolean // 是否启用积分过期
30
+ expire_days: number // 积分过期天数
31
+ expire_type: 'fifo' | 'lifo' // 过期类型:先进先出/后进先出
32
+ }
33
+
34
+ // 其他配置
35
+ max_points_per_user?: number // 用户最大积分上限
36
+ points_name: string // 积分名称(如:金币、积分等)
37
+ }
38
+
39
+ export interface PointsConfigResponse {
40
+ data: PointsConfig
41
+ }
42
+
43
+ export interface UpdatePointsConfigPayload
44
+ extends Partial<PointsConfig> {}
@@ -0,0 +1,41 @@
1
+ export enum ProductStatus {
2
+ DRAFT = 'draft',
3
+ ACTIVE = 'active',
4
+ INACTIVE = 'inactive',
5
+ DELETED = 'deleted',
6
+ }
7
+
8
+ export interface Product {
9
+ id: number
10
+ name: string
11
+ description?: string
12
+ detail?: string
13
+ price: number
14
+ original_price?: number
15
+ images?: string[]
16
+ main_image?: string
17
+ category_id?: number
18
+ tags?: string[]
19
+ stock?: number
20
+ status?: ProductStatus
21
+ sort_order?: number
22
+ sales_count?: number
23
+ created_at?: string
24
+ updated_at?: string
25
+ }
26
+
27
+ export interface ProductListResponse {
28
+ data: Product[]
29
+ pagination: {
30
+ total: number
31
+ page: number
32
+ page_size: number
33
+ total_pages: number
34
+ }
35
+ }
36
+
37
+ export interface CreateProductPayload
38
+ extends Omit<Product, 'id' | 'created_at' | 'updated_at'> {}
39
+
40
+ export interface UpdateProductPayload
41
+ extends Partial<Omit<Product, 'id' | 'created_at' | 'updated_at'>> {}
@@ -0,0 +1,24 @@
1
+ export interface Role {
2
+ id: string
3
+ name: string
4
+ code: string
5
+ permissionCount: number
6
+ createdAt: string
7
+ }
8
+
9
+ export interface Permission {
10
+ id: string
11
+ code: string
12
+ name: string
13
+ module: string
14
+ description?: string
15
+ }
16
+
17
+ export interface AssignUserRolesPayload {
18
+ roleIds: string[]
19
+ }
20
+
21
+ export interface AssignRolePermissionsPayload {
22
+ permissionIds: string[]
23
+ }
24
+
@@ -0,0 +1,29 @@
1
+ /** 举报状态(与 api.zengchaowu.com 一致) */
2
+ export type ReportStatus = 'pending' | 'processing' | 'resolved' | 'rejected'
3
+
4
+ /** 举报目标类型 */
5
+ export type ReportTargetType = 'post' | 'comment' | 'product' | 'user'
6
+
7
+ export interface Report {
8
+ id: number
9
+ reporter_id?: string
10
+ target_type?: ReportTargetType
11
+ target_id?: string | number
12
+ reason?: string
13
+ description?: string
14
+ status?: ReportStatus
15
+ created_at?: string
16
+ updated_at?: string
17
+ }
18
+
19
+ export interface ReportListResponse {
20
+ data: Report[]
21
+ total: number
22
+ limit?: number
23
+ offset?: number
24
+ }
25
+
26
+ export interface ProcessReportPayload {
27
+ status: ReportStatus
28
+ remark?: string
29
+ }
@@ -0,0 +1,13 @@
1
+ export interface Review {
2
+ id: number
3
+ product_id?: number
4
+ user_id?: string
5
+ rating?: number
6
+ content?: string
7
+ created_at?: string
8
+ updated_at?: string
9
+ }
10
+
11
+ export interface ReviewListResponse {
12
+ data: Review[]
13
+ }
@@ -140,6 +140,8 @@ export interface UniAppIOSBuildOptions extends IOSBuildOptions {
140
140
  permissions?: string[]
141
141
  /** 是否开启 IDFA(可选,默认为 false) */
142
142
  enableIDFA?: boolean
143
+ /** 强制界面风格:Light 浅色 / Dark 深色(可选,不设置则跟随系统;对应 Info.plist UIUserInterfaceStyle) */
144
+ userInterfaceStyle?: 'Light' | 'Dark'
143
145
  /** 微信分享配置(可选) */
144
146
  wechatShare?: WechatShareIOSOptions
145
147
  /** 微信登录配置(可选) */
@@ -0,0 +1,36 @@
1
+ export interface User {
2
+ id: string
3
+ name?: string
4
+ email?: string
5
+ phone?: string
6
+ wechat_openid?: string
7
+ wechat_unionid?: string
8
+ wechat_nickname?: string
9
+ wechat_avatar?: string
10
+ created_at?: string
11
+ updated_at?: string
12
+ // 兼容旧字段名
13
+ createdAt?: string
14
+ updatedAt?: string
15
+ }
16
+
17
+ export interface UserListResponse {
18
+ data: User[]
19
+ count: number
20
+ }
21
+
22
+ export interface UserDetailResponse {
23
+ data: User
24
+ }
25
+
26
+ export interface CreateUserPayload {
27
+ name: string
28
+ email: string
29
+ }
30
+
31
+ export interface UpdateUserPayload {
32
+ name?: string
33
+ email?: string
34
+ phone?: string
35
+ avatar?: string
36
+ }
package/types/video.d.ts CHANGED
@@ -7,7 +7,7 @@ export interface VideoCategory {
7
7
  }
8
8
 
9
9
  export interface Video {
10
- id: number
10
+ id: string
11
11
  title: string
12
12
  description?: string
13
13
  cover_url?: string
@@ -27,7 +27,7 @@ export interface Video {
27
27
 
28
28
  export interface VideoComment {
29
29
  id: number
30
- video_id: number
30
+ video_id: string
31
31
  user_id: string
32
32
  content: string
33
33
  parent_id?: number | null