@uxda/appkit 4.2.81 → 4.2.83
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.
- package/dist/appkit.css +43 -0
- package/dist/index.js +993 -537
- package/package.json +31 -32
- package/src/balance/api/index.ts +8 -2
- package/src/notice/api/endpoints.ts +38 -1
- package/src/notice/api/index.ts +14 -5
- package/src/notice/components/NoticeList2.vue +249 -0
- package/src/notice/components/index.ts +2 -1
- package/src/shared/composables/useUpload.ts +0 -3
- package/src/shared/http/Http.ts +8 -2
- package/src/shared/http/types.ts +4 -1
- package/src/shared/weixin/jssdk.ts +0 -1
- package/src/user/api/index.ts +8 -2
- package/src/user/components/UserBinding.vue +0 -1
- package/src/user/components/UserFeedback.vue +0 -1
- package/types/global.d.ts +11 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxda/appkit",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.83",
|
|
4
4
|
"description": "小程序应用开发包",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.ts",
|
|
@@ -20,59 +20,58 @@
|
|
|
20
20
|
],
|
|
21
21
|
"author": "",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babel/runtime": "^7.
|
|
23
|
+
"@babel/runtime": "^7.28.4",
|
|
24
24
|
"@nutui/auto-import-resolver": "^1.0.0",
|
|
25
25
|
"@nutui/icons-vue-taro": "^0.0.9",
|
|
26
|
-
"@nutui/nutui-taro": "^4.3.
|
|
27
|
-
"@tarojs/components": "^4.
|
|
28
|
-
"@tarojs/helper": "^4.
|
|
29
|
-
"@tarojs/plugin-framework-vue3": "^4.
|
|
30
|
-
"@tarojs/plugin-html": "^4.
|
|
31
|
-
"@tarojs/plugin-platform-weapp": "^4.
|
|
32
|
-
"@tarojs/router": "^4.
|
|
33
|
-
"@tarojs/runtime": "^4.
|
|
34
|
-
"@tarojs/shared": "^4.
|
|
35
|
-
"@tarojs/taro": "^4.
|
|
26
|
+
"@nutui/nutui-taro": "^4.3.14",
|
|
27
|
+
"@tarojs/components": "^4.1.7",
|
|
28
|
+
"@tarojs/helper": "^4.1.7",
|
|
29
|
+
"@tarojs/plugin-framework-vue3": "^4.1.7",
|
|
30
|
+
"@tarojs/plugin-html": "^4.1.7",
|
|
31
|
+
"@tarojs/plugin-platform-weapp": "^4.1.7",
|
|
32
|
+
"@tarojs/router": "^4.1.7",
|
|
33
|
+
"@tarojs/runtime": "^4.1.7",
|
|
34
|
+
"@tarojs/shared": "^4.1.7",
|
|
35
|
+
"@tarojs/taro": "^4.1.7",
|
|
36
36
|
"@types/wechat-miniprogram": "^3.4.7",
|
|
37
|
-
"@uxda/
|
|
38
|
-
"
|
|
39
|
-
"dayjs": "^1.11.10",
|
|
37
|
+
"@uxda/nutshell": "^1.6.86",
|
|
38
|
+
"dayjs": "^1.11.18",
|
|
40
39
|
"lodash-es": "^4.17.21",
|
|
41
|
-
"validator": "^13.
|
|
42
|
-
"vue": "^3.5.
|
|
40
|
+
"validator": "^13.15.15",
|
|
41
|
+
"vue": "^3.5.22"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@babel/core": "^7.
|
|
46
|
-
"@tarojs/cli": "^4.
|
|
47
|
-
"@tarojs/taro-loader": "^4.
|
|
48
|
-
"@tarojs/webpack5-runner": "^4.
|
|
49
|
-
"@types/node": "^
|
|
44
|
+
"@babel/core": "^7.28.4",
|
|
45
|
+
"@tarojs/cli": "^4.1.7",
|
|
46
|
+
"@tarojs/taro-loader": "^4.1.7",
|
|
47
|
+
"@tarojs/webpack5-runner": "^4.1.7",
|
|
48
|
+
"@types/node": "^24.5.2",
|
|
50
49
|
"@types/webpack-env": "^1.13.6",
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
52
|
-
"@typescript-eslint/parser": "^8.
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^8.44.1",
|
|
51
|
+
"@typescript-eslint/parser": "^8.44.1",
|
|
53
52
|
"@vue/babel-plugin-jsx": "^1.0.6",
|
|
54
|
-
"@vue/compiler-sfc": "^3.
|
|
53
|
+
"@vue/compiler-sfc": "^3.5.22",
|
|
55
54
|
"babel-preset-taro": "^4.0.4",
|
|
56
55
|
"css-loader": "^7.1.2",
|
|
57
56
|
"eslint": "^9.9.0",
|
|
58
57
|
"eslint-config-taro": "^4.0.4",
|
|
59
|
-
"eslint-plugin-vue": "^
|
|
60
|
-
"postcss": "^8.
|
|
61
|
-
"postcss-import": "^16.1.
|
|
58
|
+
"eslint-plugin-vue": "^10.5.0",
|
|
59
|
+
"postcss": "^8.5.6",
|
|
60
|
+
"postcss-import": "^16.1.1",
|
|
62
61
|
"rollup": "^4.6.1",
|
|
63
|
-
"rollup-plugin-css-only": "^4.5.
|
|
62
|
+
"rollup-plugin-css-only": "^4.5.5",
|
|
64
63
|
"rollup-plugin-dts": "^6.1.0",
|
|
65
64
|
"rollup-plugin-esbuild": "^6.1.0",
|
|
66
65
|
"rollup-plugin-postcss": "^4.0.2",
|
|
67
66
|
"rollup-plugin-scss": "^4.0.0",
|
|
68
|
-
"rollup-plugin-visualizer": "^
|
|
67
|
+
"rollup-plugin-visualizer": "^6.0.3",
|
|
69
68
|
"rollup-plugin-vue": "^6.0.0",
|
|
70
69
|
"style-loader": "^4.0.0",
|
|
71
70
|
"stylelint": "^16.8.2",
|
|
72
71
|
"ts-node": "^10.9.1",
|
|
73
72
|
"typescript": "^5.0.0",
|
|
74
|
-
"unplugin-auto-import": "^
|
|
75
|
-
"unplugin-vue-components": "^
|
|
73
|
+
"unplugin-auto-import": "^20.2.0",
|
|
74
|
+
"unplugin-vue-components": "^29.1.0",
|
|
76
75
|
"webpack": "^5.78.0"
|
|
77
76
|
},
|
|
78
77
|
"peerDependencies": {
|
package/src/balance/api/index.ts
CHANGED
|
@@ -87,11 +87,17 @@ function useHttp() {
|
|
|
87
87
|
paging: {
|
|
88
88
|
translate: (params: PagingParams) => ({
|
|
89
89
|
pageNum: params.page,
|
|
90
|
-
pageSize: params.pageSize,
|
|
90
|
+
pageSize: params.pageSize || 10,
|
|
91
91
|
}),
|
|
92
92
|
transform(data: any): PagingData {
|
|
93
|
+
const totalRecords = +data.total || 0,
|
|
94
|
+
pageSize = +data.pageSize || 10,
|
|
95
|
+
total = data.pages || Math.ceil(totalRecords / pageSize),
|
|
96
|
+
isLastPage = data.pages === data.pageNum
|
|
93
97
|
return {
|
|
94
|
-
|
|
98
|
+
total,
|
|
99
|
+
totalRecords,
|
|
100
|
+
isLastPage,
|
|
95
101
|
}
|
|
96
102
|
},
|
|
97
103
|
},
|
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
import { HttpEndpoints } from '../../shared/http'
|
|
2
|
+
import dayjs from 'dayjs'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
// 字段映射表
|
|
5
|
+
const mappings = {}
|
|
6
|
+
|
|
7
|
+
const endpointsList: HttpEndpoints = {
|
|
8
|
+
消息列表: {
|
|
9
|
+
path: '/cas/msg/queryUserMsg',
|
|
10
|
+
translate: (data: any) => {
|
|
11
|
+
data.pageNum = data.page || 1
|
|
12
|
+
return data
|
|
13
|
+
},
|
|
14
|
+
transform: (response: any) => {
|
|
15
|
+
const data = response.list.map((row) => {
|
|
16
|
+
row['标题'] = row.title == row.context ? '' : row.title
|
|
17
|
+
row['内容'] = row.context
|
|
18
|
+
row['时间'] = row.receiveTime && dayjs(row.receiveTime).format('YYYY-MM-DD HH:mm:ss')
|
|
19
|
+
row['已读'] = row.isRead == '1'
|
|
20
|
+
row['是公告'] = row.msgType == '3'
|
|
21
|
+
return row
|
|
22
|
+
})
|
|
23
|
+
return data
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
全部已读: {
|
|
27
|
+
path: '/cas/msg/read-all',
|
|
28
|
+
translate: (data: any) => data,
|
|
29
|
+
transform: (result: any) => transformRow(result, mappings),
|
|
30
|
+
},
|
|
31
|
+
已读: {
|
|
32
|
+
path: '/cas/msg/read',
|
|
33
|
+
translate: (data: any) => data,
|
|
34
|
+
transform: (result: any) => transformRow(result, mappings),
|
|
35
|
+
},
|
|
36
|
+
}
|
|
4
37
|
|
|
5
38
|
const endpoints = Object.fromEntries(
|
|
6
39
|
Object.entries(endpointsList).map(([name, def]) => [name, def.path])
|
|
@@ -14,4 +47,8 @@ const transforms = Object.fromEntries(
|
|
|
14
47
|
Object.entries(endpointsList).map(([, def]) => [def.path, def.transform])
|
|
15
48
|
)
|
|
16
49
|
|
|
50
|
+
const transformRow = (row: any, mappings: any) => {
|
|
51
|
+
return Object.fromEntries(Object.entries(row).map(([k, v]) => [mappings[k] || k, v]))
|
|
52
|
+
}
|
|
53
|
+
|
|
17
54
|
export { endpoints, translates, transforms }
|
package/src/notice/api/index.ts
CHANGED
|
@@ -85,13 +85,22 @@ function useHttp() {
|
|
|
85
85
|
},
|
|
86
86
|
],
|
|
87
87
|
paging: {
|
|
88
|
-
translate: (params: PagingParams) =>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
translate: (params: PagingParams) => {
|
|
89
|
+
console.log(params)
|
|
90
|
+
return {
|
|
91
|
+
pageNum: params.page,
|
|
92
|
+
pageSize: params.pageSize || 10,
|
|
93
|
+
}
|
|
94
|
+
},
|
|
92
95
|
transform(data: any): PagingData {
|
|
96
|
+
const totalRecords = +data.total || 0,
|
|
97
|
+
pageSize = +data.pageSize || 10,
|
|
98
|
+
total = data.pages || Math.ceil(totalRecords / pageSize),
|
|
99
|
+
isLastPage = data.pages === data.pageNum
|
|
93
100
|
return {
|
|
94
|
-
|
|
101
|
+
total,
|
|
102
|
+
totalRecords,
|
|
103
|
+
isLastPage,
|
|
95
104
|
}
|
|
96
105
|
},
|
|
97
106
|
},
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ns-page class="news-list">
|
|
3
|
+
<div class="tabContainer" :class="{ inH5: isWeb() }">
|
|
4
|
+
<!-- <ns-search
|
|
5
|
+
v-track-search="{
|
|
6
|
+
trackInput: false,
|
|
7
|
+
trackSubmit: true,
|
|
8
|
+
minLength: 2,
|
|
9
|
+
}"
|
|
10
|
+
style="margin: 0 12px"
|
|
11
|
+
placeholder="请输入关键字搜索"
|
|
12
|
+
v-model="state.search"
|
|
13
|
+
></ns-search> -->
|
|
14
|
+
<ns-tabs v-model="state.tab" fill="#fff" square size="xl" style="height: 46px" @change="onTabChange">
|
|
15
|
+
<ns-tabs-item key="全部" tab="全部"></ns-tabs-item>
|
|
16
|
+
<ns-tabs-item key="业务消息" tab="业务消息"></ns-tabs-item>
|
|
17
|
+
<ns-tabs-item key="系统公告" tab="系统公告"></ns-tabs-item>
|
|
18
|
+
<ns-tabs-item key="未读" tab="未读"></ns-tabs-item>
|
|
19
|
+
</ns-tabs>
|
|
20
|
+
<div v-if="state.list.length > 0" class="read-all">
|
|
21
|
+
<div v-track-click="'click'" class="btn" @click="readAll">全部已读</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<ns-page-content class="mt-68px" scrollable refreshable :refresh-triggered="isRefresh"
|
|
25
|
+
@pull-down-refresh="onRefresh" @bottom-reached="nextPage">
|
|
26
|
+
<ns-skeleton :row="8" v-if="显示骨架屏" />
|
|
27
|
+
|
|
28
|
+
<template v-else>
|
|
29
|
+
<ns-repeator v-slot="item" align="stretch" direction="column" :gap="10" :data="state.list"
|
|
30
|
+
:show-no-more="paging.isLastPage">
|
|
31
|
+
<ns-card v-track-click="{
|
|
32
|
+
event: 'click',
|
|
33
|
+
elementText: '消息详情',
|
|
34
|
+
}" :r="5" fill="#fff" class="news-item w-full" @click="itemClick(item)">
|
|
35
|
+
<div v-if="item.标题" :style="{ color: item.已读 ? '#35353599' : '#353535' }" class="news-item-title">
|
|
36
|
+
<img v-if="item.是公告" class="news-item-title-icon"
|
|
37
|
+
src="https://cdn.ddjf.com/static/images/loan-manage-app/ic_msg_system_notice.webp" />
|
|
38
|
+
{{ item.标题 }}
|
|
39
|
+
</div>
|
|
40
|
+
<nut-ellipsis :style="{ color: item.已读 ? '#35353566' : '#353535CC' }" class="news-item-content"
|
|
41
|
+
direction="end" rows="3" expand-text="展开" collapse-text="收起" :content="item.内容"></nut-ellipsis>
|
|
42
|
+
<div class="news-item-time">{{ item.时间 }}</div>
|
|
43
|
+
</ns-card>
|
|
44
|
+
</ns-repeator>
|
|
45
|
+
<ns-empty v-if="state.list.length == 0" />
|
|
46
|
+
<div class="safe-area-space"></div>
|
|
47
|
+
</template>
|
|
48
|
+
</ns-page-content>
|
|
49
|
+
</ns-page>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup lang="ts">
|
|
53
|
+
import { useDidShow } from '@tarojs/taro'
|
|
54
|
+
import Taro from '@tarojs/taro'
|
|
55
|
+
import { type WithPaging, usePaging } from '@uxda/nutshell/taro'
|
|
56
|
+
import { useHttp, endpoints } from '../api'
|
|
57
|
+
import { reactive, ref } from 'vue'
|
|
58
|
+
import { useAppKitOptions } from '../../Appkit'
|
|
59
|
+
import {
|
|
60
|
+
NsTabs,
|
|
61
|
+
NsTabsItem,
|
|
62
|
+
NsRepeator,
|
|
63
|
+
NsCard,
|
|
64
|
+
NsPage,
|
|
65
|
+
NsPageContent,
|
|
66
|
+
NsSkeleton,
|
|
67
|
+
NsEmpty,
|
|
68
|
+
} from "@uxda/nutshell/taro";
|
|
69
|
+
import { isWeb } from '../../utils/utils';
|
|
70
|
+
|
|
71
|
+
const props = withDefaults(
|
|
72
|
+
defineProps<{
|
|
73
|
+
deviceType?: string;
|
|
74
|
+
userId: string;
|
|
75
|
+
app: string;
|
|
76
|
+
}>(),
|
|
77
|
+
{
|
|
78
|
+
deviceType: "2",
|
|
79
|
+
userId: "",
|
|
80
|
+
app: "",
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const $http = useHttp(),
|
|
85
|
+
显示骨架屏 = ref(true)
|
|
86
|
+
|
|
87
|
+
useDidShow(() => {
|
|
88
|
+
nextPage(1)
|
|
89
|
+
})
|
|
90
|
+
const state = reactive({
|
|
91
|
+
search: '',
|
|
92
|
+
tab: '全部',
|
|
93
|
+
list: [] as any[],
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
async function load(page: number) {
|
|
97
|
+
if (!props.app?.replace(',cloudkitPro', '')) {
|
|
98
|
+
state.list = []
|
|
99
|
+
return { paging: { page: 1, pageSize: 10, total: 0 }, data: [] }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const appkitOptions = useAppKitOptions()
|
|
103
|
+
const data = {
|
|
104
|
+
page,
|
|
105
|
+
pageSize: 10,
|
|
106
|
+
appCode: props.app,
|
|
107
|
+
tenantId: appkitOptions.tenant(),
|
|
108
|
+
userId: props.userId,
|
|
109
|
+
deviceType: props.deviceType,
|
|
110
|
+
readOrderStatus: '1',
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (state.tab == '业务消息') {
|
|
114
|
+
data['msgType'] = '1'
|
|
115
|
+
} else if (state.tab == '系统公告') {
|
|
116
|
+
data['msgType'] = '3'
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (state.tab == '未读') {
|
|
120
|
+
data['isRead'] = '0'
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const ep = endpoints['消息列表']
|
|
124
|
+
return $http.post<WithPaging<any[]>>(ep, data).then((res) => {
|
|
125
|
+
显示骨架屏.value = false
|
|
126
|
+
if (page === 1) {
|
|
127
|
+
state.list = []
|
|
128
|
+
}
|
|
129
|
+
state.list = [...state.list, ...res.data]
|
|
130
|
+
return { paging: res.paging, data: res.data }
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const { paging, nextPage } = usePaging(load)
|
|
135
|
+
|
|
136
|
+
function onTabChange() {
|
|
137
|
+
显示骨架屏.value = true
|
|
138
|
+
nextPage(1)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const isRefresh = ref(false)
|
|
142
|
+
async function onRefresh() {
|
|
143
|
+
isRefresh.value = true
|
|
144
|
+
await nextPage(1)
|
|
145
|
+
isRefresh.value = false
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function itemClick(item: any) {
|
|
149
|
+
read(item)
|
|
150
|
+
|
|
151
|
+
emits('itemClick', item)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function read(item: any) {
|
|
155
|
+
if (item.isRead == '1') return
|
|
156
|
+
const ep = endpoints['已读']
|
|
157
|
+
$http.post(ep, [item.id]).then(() => {
|
|
158
|
+
item['已读'] = true
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function readAll() {
|
|
163
|
+
try {
|
|
164
|
+
Taro.showLoading({
|
|
165
|
+
title: '请稍后...',
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
const appkitOptions = useAppKitOptions()
|
|
169
|
+
const ep = endpoints['全部已读']
|
|
170
|
+
const data = {
|
|
171
|
+
tenantId: appkitOptions.tenant(),
|
|
172
|
+
userId: props.userId,
|
|
173
|
+
deviceType: props.deviceType,
|
|
174
|
+
}
|
|
175
|
+
$http.post(ep, data).then(() => {
|
|
176
|
+
state.list.forEach((item) => {
|
|
177
|
+
item['已读'] = true
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
} finally {
|
|
181
|
+
Taro.hideLoading()
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const emits = defineEmits(['itemClick'])
|
|
186
|
+
|
|
187
|
+
defineExpose({
|
|
188
|
+
readAll,
|
|
189
|
+
})
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<style lang="scss">
|
|
193
|
+
.news-list {
|
|
194
|
+
.safe-area-space {
|
|
195
|
+
padding-bottom: calc(var(--bottom) + 60px);
|
|
196
|
+
padding-bottom: calc(env(safe-area-inset-bottom) + 60px);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.tabContainer {
|
|
200
|
+
&.inH5 {
|
|
201
|
+
width: 100%;
|
|
202
|
+
position: fixed;
|
|
203
|
+
z-index: 100;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.read-all {
|
|
207
|
+
width: 100%;
|
|
208
|
+
text-align: end;
|
|
209
|
+
height: 22px;
|
|
210
|
+
line-height: 22px;
|
|
211
|
+
padding: 5px 0;
|
|
212
|
+
background-color: var(--fill, var(--ns-background));
|
|
213
|
+
|
|
214
|
+
.btn {
|
|
215
|
+
color: #017fff;
|
|
216
|
+
font-size: 14px;
|
|
217
|
+
font-weight: 500;
|
|
218
|
+
margin-right: 16px;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.news-item {
|
|
224
|
+
&-title {
|
|
225
|
+
font-size: 16px;
|
|
226
|
+
font-weight: 500;
|
|
227
|
+
display: flex;
|
|
228
|
+
flex-direction: row;
|
|
229
|
+
align-items: center;
|
|
230
|
+
|
|
231
|
+
&-icon {
|
|
232
|
+
width: 20px;
|
|
233
|
+
height: 20px;
|
|
234
|
+
margin-right: 4px;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
&-content {
|
|
239
|
+
font-size: 14px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
&-time {
|
|
243
|
+
font-size: 13px;
|
|
244
|
+
color: #35353566;
|
|
245
|
+
text-align: end;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
</style>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import NoticeBanner from './NoticeBanner.vue'
|
|
2
2
|
import NoticeEntry from './NoticeEntry.vue'
|
|
3
3
|
import NoticeList from './NoticeList.vue'
|
|
4
|
+
import NoticeList2 from './NoticeList2.vue'
|
|
4
5
|
|
|
5
|
-
export { NoticeBanner, NoticeEntry, NoticeList }
|
|
6
|
+
export { NoticeBanner, NoticeEntry, NoticeList, NoticeList2 }
|
|
@@ -26,11 +26,9 @@ type UploadFunction = (url: string, file: Media) => Promise<Media>
|
|
|
26
26
|
|
|
27
27
|
export const useUpload = (config: UploadConfig) => {
|
|
28
28
|
const appkitOptions = useAppKitOptions()
|
|
29
|
-
console.log('===config', config)
|
|
30
29
|
|
|
31
30
|
const upload: UploadFunction = (url: string, file: Media) => {
|
|
32
31
|
return new Promise<Media>((resolve, reject) => {
|
|
33
|
-
console.log(file, '----file')
|
|
34
32
|
uploadFile({
|
|
35
33
|
url: config.baseUrl + url,
|
|
36
34
|
filePath: file.path!,
|
|
@@ -44,7 +42,6 @@ export const useUpload = (config: UploadConfig) => {
|
|
|
44
42
|
},
|
|
45
43
|
success: (rsp: any) => {
|
|
46
44
|
const { data } = rsp
|
|
47
|
-
console.log('===data', data)
|
|
48
45
|
try {
|
|
49
46
|
const response = JSON.parse(data)
|
|
50
47
|
console.log('===response', response)
|
package/src/shared/http/Http.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
HttpTranslate,
|
|
11
11
|
RequestHeaders,
|
|
12
12
|
} from './types'
|
|
13
|
+
|
|
13
14
|
/**
|
|
14
15
|
* Useage:
|
|
15
16
|
* const $http = createHttp({
|
|
@@ -29,13 +30,17 @@ const request: HttpInstance['request'] = <T>(config: HttpRequestConfig) => {
|
|
|
29
30
|
const c = {
|
|
30
31
|
...clientConfig,
|
|
31
32
|
...config,
|
|
33
|
+
headers: {
|
|
34
|
+
...clientConfig?.headers,
|
|
35
|
+
...config?.headers,
|
|
36
|
+
},
|
|
32
37
|
}
|
|
33
38
|
return new Promise<T>((resolve, reject) => {
|
|
34
39
|
const data =
|
|
35
40
|
config.data && clientConfig.translates && clientConfig.translates[c.url]
|
|
36
41
|
? (clientConfig.translates[c.url] as HttpTranslate)(c.data || {})
|
|
37
42
|
: c.data
|
|
38
|
-
console.log(`[][][][][]HTTP.${c.method}, ${c.baseUrl}${c.url}`, data)
|
|
43
|
+
// console.log(`[][][][][]HTTP.${c.method}, ${c.baseUrl}${c.url}`, data)
|
|
39
44
|
|
|
40
45
|
clientConfig.vendor &&
|
|
41
46
|
clientConfig.vendor
|
|
@@ -71,10 +76,11 @@ const request: HttpInstance['request'] = <T>(config: HttpRequestConfig) => {
|
|
|
71
76
|
config.data && config.data.page
|
|
72
77
|
? (clientConfig.paging as Paging).transform(raw.data)
|
|
73
78
|
: void 0
|
|
79
|
+
|
|
74
80
|
resolve(
|
|
75
81
|
paging
|
|
76
82
|
? ({
|
|
77
|
-
|
|
83
|
+
paging,
|
|
78
84
|
data: response,
|
|
79
85
|
} as T)
|
|
80
86
|
: response
|
package/src/shared/http/types.ts
CHANGED
|
@@ -67,7 +67,6 @@ function requestWxH5Pay(options: PrePayOptions) {
|
|
|
67
67
|
timeStamp: options.timeStamp,
|
|
68
68
|
},
|
|
69
69
|
function (res) {
|
|
70
|
-
console.log(res, '-------res')
|
|
71
70
|
if (res.err_msg == 'get_brand_wcpay_request:ok') {
|
|
72
71
|
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠,商户需进一步调用后端查单确认支付结果。
|
|
73
72
|
resolve(true)
|
package/src/user/api/index.ts
CHANGED
|
@@ -92,11 +92,17 @@ function useHttp() {
|
|
|
92
92
|
paging: {
|
|
93
93
|
translate: (params: PagingParams) => ({
|
|
94
94
|
pageNum: params.page,
|
|
95
|
-
pageSize: params.pageSize,
|
|
95
|
+
pageSize: params.pageSize || 10,
|
|
96
96
|
}),
|
|
97
97
|
transform(data: any): PagingData {
|
|
98
|
+
const totalRecords = +data.total || 0,
|
|
99
|
+
pageSize = +data.pageSize || 10,
|
|
100
|
+
total = data.pages || Math.ceil(totalRecords / pageSize),
|
|
101
|
+
isLastPage = data.pages === data.pageNum
|
|
98
102
|
return {
|
|
99
|
-
|
|
103
|
+
total,
|
|
104
|
+
totalRecords,
|
|
105
|
+
isLastPage,
|
|
100
106
|
}
|
|
101
107
|
},
|
|
102
108
|
},
|
|
@@ -112,7 +112,6 @@ function toUpload() {
|
|
|
112
112
|
mediaType: ['mix'],
|
|
113
113
|
maxDuration: 60,
|
|
114
114
|
success: async (res) => {
|
|
115
|
-
console.log(res.tempFiles, 'res.tempFiles')
|
|
116
115
|
for (const item of res.tempFiles) {
|
|
117
116
|
if (item.fileType === 'video') {
|
|
118
117
|
if (item.size > 1024 * 1024 * 50) {
|
package/types/global.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/// <reference types="@tarojs/taro" />
|
|
2
2
|
|
|
3
|
-
declare module '*.png'
|
|
4
|
-
declare module '*.gif'
|
|
5
|
-
declare module '*.jpg'
|
|
6
|
-
declare module '*.jpeg'
|
|
7
|
-
declare module '*.svg'
|
|
8
|
-
declare module '*.css'
|
|
9
|
-
declare module '*.less'
|
|
10
|
-
declare module '*.scss'
|
|
11
|
-
declare module '*.sass'
|
|
12
|
-
declare module '*.styl'
|
|
3
|
+
declare module '*.png'
|
|
4
|
+
declare module '*.gif'
|
|
5
|
+
declare module '*.jpg'
|
|
6
|
+
declare module '*.jpeg'
|
|
7
|
+
declare module '*.svg'
|
|
8
|
+
declare module '*.css'
|
|
9
|
+
declare module '*.less'
|
|
10
|
+
declare module '*.scss'
|
|
11
|
+
declare module '*.sass'
|
|
12
|
+
declare module '*.styl'
|
|
13
13
|
|
|
14
14
|
declare namespace NodeJS {
|
|
15
15
|
interface ProcessEnv {
|
|
@@ -19,4 +19,4 @@ declare namespace NodeJS {
|
|
|
19
19
|
|
|
20
20
|
declare module '@tarojs/components' {
|
|
21
21
|
export * from '@tarojs/components/types/index.vue3'
|
|
22
|
-
}
|
|
22
|
+
}
|