wui-components-v2 1.2.2 → 1.2.4
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/components/login-form-box/login-form-box.vue +11 -10
- package/components/wui-auto-update-component/wui-auto-update-component.vue +7 -8
- package/components/wui-login/wui-login.vue +1 -1
- package/components/wui-update-component/wui-update-component.vue +90 -34
- package/composables/types/theme.ts +2 -2
- package/package.json +1 -1
|
@@ -14,8 +14,8 @@ const props = defineProps<Props>()
|
|
|
14
14
|
interface Props {
|
|
15
15
|
tabbarItems: TabbarItem[]
|
|
16
16
|
showRagister?: boolean
|
|
17
|
-
gurl?: string// 获取验证码接口
|
|
18
|
-
url?: string// 手机号登录接口
|
|
17
|
+
gurl?: string // 获取验证码接口
|
|
18
|
+
url?: string // 手机号登录接口
|
|
19
19
|
}
|
|
20
20
|
const router = useRouter()
|
|
21
21
|
|
|
@@ -34,16 +34,19 @@ function changeLoginMode(mode: string) {
|
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
36
|
<template>
|
|
37
|
-
<view class="bg-white
|
|
37
|
+
<view class="bg-white dark:bg-[var(--wot-dark-background2)]">
|
|
38
38
|
<!-- //手机登录 -->
|
|
39
|
-
<phoneLoginForm
|
|
39
|
+
<phoneLoginForm
|
|
40
|
+
v-if="loginMode === 'phone'"
|
|
41
|
+
:tabbar-items="props.tabbarItems"
|
|
42
|
+
:url="props.url"
|
|
43
|
+
:gurl="props.gurl"
|
|
44
|
+
/>
|
|
40
45
|
<!-- //账号登录 -->
|
|
41
46
|
<loginForm v-if="loginMode === 'account'" :tabbar-items="props.tabbarItems" />
|
|
42
47
|
|
|
43
48
|
<view v-if="props.gurl" class="pa-3 pt-0">
|
|
44
|
-
<wd-divider>
|
|
45
|
-
或
|
|
46
|
-
</wd-divider>
|
|
49
|
+
<wd-divider>或</wd-divider>
|
|
47
50
|
<view v-if="props.gurl" class="p-4 pt-0">
|
|
48
51
|
<wd-button v-show="loginMode === 'account'" block :round="false" type="info" @click="changeLoginMode('phone')">
|
|
49
52
|
手机短信登录
|
|
@@ -55,9 +58,7 @@ function changeLoginMode(mode: string) {
|
|
|
55
58
|
<view v-if="showRagister" class="p-4 pt-0">
|
|
56
59
|
<view class="flex items-center justify-center text-size-24rpx">
|
|
57
60
|
<text>还没有账户?</text>
|
|
58
|
-
<wd-button block :round="false" type="text" size="small" @click="handleRe">
|
|
59
|
-
立即注册
|
|
60
|
-
</wd-button>
|
|
61
|
+
<wd-button block :round="false" type="text" size="small" @click="handleRe">立即注册</wd-button>
|
|
61
62
|
</view>
|
|
62
63
|
</view>
|
|
63
64
|
</view>
|
|
@@ -38,7 +38,7 @@ const latestVersion = ref('')
|
|
|
38
38
|
async function beforeEnter() {
|
|
39
39
|
// 获取当前应用版本号
|
|
40
40
|
const v1 = await new Promise<string>((resolve, reject) => {
|
|
41
|
-
plus.runtime.getProperty(plus.runtime.appid || '',
|
|
41
|
+
plus.runtime.getProperty(plus.runtime.appid || '', widgetInfo => {
|
|
42
42
|
resolve(widgetInfo.version || '')
|
|
43
43
|
})
|
|
44
44
|
console.log(reject)
|
|
@@ -46,9 +46,9 @@ async function beforeEnter() {
|
|
|
46
46
|
currentVersion.value = v1
|
|
47
47
|
// 获取接口最新版本号
|
|
48
48
|
uni.request({
|
|
49
|
-
url:
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
url: `${
|
|
50
|
+
prop.baseUrl
|
|
51
|
+
}/v3/mstruc/data?sourceId=${prop.sourceId}&depth=1&sortColIds=创建时间_DESC&pageNo=1&pageSize=1&c_app编码_equals=${prop.appId}&c_标记删除_equals=否`,
|
|
52
52
|
method: 'GET',
|
|
53
53
|
header: {
|
|
54
54
|
'hydrocarbon-program-token': prop.hydrocarbonProgramToken,
|
|
@@ -59,13 +59,13 @@ async function beforeEnter() {
|
|
|
59
59
|
latestVersion.value = res.data.entities[0]['版本号'] // 最新版本号
|
|
60
60
|
isUpdate.value = compareVersions(currentVersion.value, latestVersion.value) // 比较版本号
|
|
61
61
|
if (isUpdate.value !== 0) {
|
|
62
|
-
show.value = true// 显示弹窗
|
|
62
|
+
show.value = true // 显示弹窗
|
|
63
63
|
}
|
|
64
64
|
entities.value = res.data.entities // 获取接口数据
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
-
fail:
|
|
68
|
+
fail: err => {
|
|
69
69
|
console.log('接口版本err:', err)
|
|
70
70
|
},
|
|
71
71
|
})
|
|
@@ -86,8 +86,7 @@ function compareVersions(v1: string, v2: string) {
|
|
|
86
86
|
for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
|
|
87
87
|
const part1 = v1Parts[i] || 0
|
|
88
88
|
const part2 = v2Parts[i] || 0
|
|
89
|
-
if (part1 !== part2)
|
|
90
|
-
return part1 < part2 ? 1 : -1
|
|
89
|
+
if (part1 !== part2) return part1 < part2 ? 1 : -1
|
|
91
90
|
}
|
|
92
91
|
return 0
|
|
93
92
|
}
|
|
@@ -42,7 +42,7 @@ const { currentThemeColor } = useManualTheme()
|
|
|
42
42
|
</view>
|
|
43
43
|
</view> -->
|
|
44
44
|
<view class="flex items-center justify-center">
|
|
45
|
-
<image class="h-250px w-250px" src="./footerImg.png" />
|
|
45
|
+
<image :class="showLoginImg ? 'h-200px w-200px' : 'h-250px w-250px'" src="./footerImg.png" />
|
|
46
46
|
</view>
|
|
47
47
|
<view class="flex-1 border-rd-t-2 p-y-2 bg-white dark:bg-[var(--wot-dark-background2)]">
|
|
48
48
|
<view class="flex items-center justify-center" v-if="showLoginImg">
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, defineEmits, ref } from 'vue'
|
|
3
|
+
import { useManualTheme } from '../../composables/useManualTheme'
|
|
3
4
|
|
|
4
5
|
defineOptions({
|
|
5
6
|
name: 'WuiUpdateComponent',
|
|
6
7
|
})
|
|
8
|
+
|
|
9
|
+
const { currentThemeColor } = useManualTheme()
|
|
10
|
+
const primaryColor = computed(() => currentThemeColor.value.primary)
|
|
7
11
|
const prop = defineProps({
|
|
8
12
|
show: {
|
|
9
13
|
type: Boolean,
|
|
@@ -62,7 +66,7 @@ async function beforeEnter() {
|
|
|
62
66
|
loading.value = true
|
|
63
67
|
// 获取当前应用版本号
|
|
64
68
|
const v1 = await new Promise<string>((resolve, reject) => {
|
|
65
|
-
plus.runtime.getProperty(plus.runtime.appid || '',
|
|
69
|
+
plus.runtime.getProperty(plus.runtime.appid || '', widgetInfo => {
|
|
66
70
|
resolve(widgetInfo.version || '')
|
|
67
71
|
})
|
|
68
72
|
console.log(reject)
|
|
@@ -70,9 +74,9 @@ async function beforeEnter() {
|
|
|
70
74
|
currentVersion.value = v1
|
|
71
75
|
// 获取接口最新版本号
|
|
72
76
|
uni.request({
|
|
73
|
-
url:
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
url: `${
|
|
78
|
+
prop.baseUrl
|
|
79
|
+
}/v3/mstruc/data?sourceId=${prop.sourceId}&depth=1&sortColIds=创建时间_DESC&pageNo=1&pageSize=1&c_app编码_equals=${prop.appId}&c_标记删除_equals=否`,
|
|
76
80
|
method: 'GET',
|
|
77
81
|
header: {
|
|
78
82
|
'hydrocarbon-program-token': prop.hydrocarbonProgramToken,
|
|
@@ -89,7 +93,7 @@ async function beforeEnter() {
|
|
|
89
93
|
|
|
90
94
|
loading.value = false
|
|
91
95
|
},
|
|
92
|
-
fail:
|
|
96
|
+
fail: err => {
|
|
93
97
|
loading.value = false
|
|
94
98
|
console.log('接口版本err:', err)
|
|
95
99
|
},
|
|
@@ -101,10 +105,9 @@ function downloadApk(code: string, name: string) {
|
|
|
101
105
|
// 发起下载请求
|
|
102
106
|
const downloadTask = uni.downloadFile({
|
|
103
107
|
url: `${prop.baseUrl}/v3/files/hwane27308/${code}/${name}`,
|
|
104
|
-
success:
|
|
108
|
+
success: res => {
|
|
105
109
|
if (res.statusCode === 200) {
|
|
106
|
-
if (!res.tempFilePath)
|
|
107
|
-
return
|
|
110
|
+
if (!res.tempFilePath) return
|
|
108
111
|
// 下载完成后安装 APK
|
|
109
112
|
plus.runtime.install(
|
|
110
113
|
res.tempFilePath,
|
|
@@ -119,14 +122,14 @@ function downloadApk(code: string, name: string) {
|
|
|
119
122
|
percentage.value = 0
|
|
120
123
|
enterUpdate.value = false
|
|
121
124
|
closable.value = true
|
|
122
|
-
}
|
|
125
|
+
}
|
|
123
126
|
)
|
|
124
127
|
}
|
|
125
128
|
},
|
|
126
129
|
})
|
|
127
130
|
|
|
128
131
|
// 监听下载进度变化
|
|
129
|
-
downloadTask.onProgressUpdate(
|
|
132
|
+
downloadTask.onProgressUpdate(res => {
|
|
130
133
|
console.log('当前进度:', `${res.progress}%`)
|
|
131
134
|
// 更新 UI(例如进度条)
|
|
132
135
|
percentage.value = res.progress // 假设 this.progress 是绑定的数据
|
|
@@ -142,8 +145,7 @@ function compareVersions(v1: string, v2: string) {
|
|
|
142
145
|
for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
|
|
143
146
|
const part1 = v1Parts[i] || 0
|
|
144
147
|
const part2 = v2Parts[i] || 0
|
|
145
|
-
if (part1 !== part2)
|
|
146
|
-
return part1 < part2 ? 1 : -1
|
|
148
|
+
if (part1 !== part2) return part1 < part2 ? 1 : -1
|
|
147
149
|
}
|
|
148
150
|
return 0
|
|
149
151
|
}
|
|
@@ -174,19 +176,34 @@ function actionUpdate() {
|
|
|
174
176
|
@close="handleClose"
|
|
175
177
|
@before-enter="beforeEnter"
|
|
176
178
|
>
|
|
177
|
-
<view v-if="loading" class="loadingBox">
|
|
178
|
-
<
|
|
179
|
+
<view v-if="loading" class="loadingBox" :style="{ '--update-primary': primaryColor }">
|
|
180
|
+
<view class="header" />
|
|
181
|
+
<view class="body">
|
|
182
|
+
<wd-loading />
|
|
183
|
+
</view>
|
|
179
184
|
</view>
|
|
180
|
-
<view v-else class="updateBox">
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
185
|
+
<view v-else class="updateBox" :style="{ '--update-primary': primaryColor }">
|
|
186
|
+
<view class="header" />
|
|
187
|
+
<view class="body">
|
|
188
|
+
<wd-text text="更新提示" :bold="true" color="#333" class="body-title" />
|
|
189
|
+
<wd-text class="body-center" :text="`当前版本:${currentVersion} 最新版本:${latestVersion}`" color="#333" />
|
|
190
|
+
<wd-text
|
|
191
|
+
v-if="isUpdate > 0 && !enterUpdate"
|
|
192
|
+
class="body-center"
|
|
193
|
+
:text="updateContent"
|
|
194
|
+
line-height="20px"
|
|
195
|
+
:lines="4"
|
|
196
|
+
/>
|
|
197
|
+
<wd-button
|
|
198
|
+
v-if="isUpdate !== 0 && !enterUpdate"
|
|
199
|
+
:custom-style="`background-color:${primaryColor};border-color:${primaryColor};margin-top:auto`"
|
|
200
|
+
@click="actionUpdate"
|
|
201
|
+
>
|
|
202
|
+
更新
|
|
203
|
+
</wd-button>
|
|
204
|
+
<view v-if="enterUpdate" class="calc">
|
|
205
|
+
<wd-progress :percentage="percentage" />
|
|
206
|
+
</view>
|
|
190
207
|
</view>
|
|
191
208
|
</view>
|
|
192
209
|
</wd-popup>
|
|
@@ -196,26 +213,65 @@ function actionUpdate() {
|
|
|
196
213
|
.updateBox {
|
|
197
214
|
display: flex;
|
|
198
215
|
flex-direction: column;
|
|
199
|
-
align-items: center;
|
|
200
216
|
width: 600rpx;
|
|
201
|
-
min-height:
|
|
202
|
-
|
|
217
|
+
min-height: 600rpx;
|
|
218
|
+
overflow: hidden;
|
|
203
219
|
background-color: #fff;
|
|
204
220
|
border-radius: 32rpx;
|
|
205
|
-
.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
221
|
+
.body {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex: 1;
|
|
224
|
+
flex-direction: column;
|
|
225
|
+
padding: 48rpx 32rpx 32rpx;
|
|
226
|
+
.body-title {
|
|
227
|
+
margin-bottom: 20rpx;
|
|
228
|
+
text-align: center;
|
|
229
|
+
}
|
|
230
|
+
.body-center {
|
|
231
|
+
text-align: center;
|
|
232
|
+
}
|
|
233
|
+
.calc {
|
|
234
|
+
width: 100%;
|
|
235
|
+
margin-top: 40rpx;
|
|
236
|
+
text-align: center;
|
|
237
|
+
}
|
|
209
238
|
}
|
|
210
239
|
}
|
|
211
|
-
.
|
|
240
|
+
.header {
|
|
241
|
+
position: relative;
|
|
212
242
|
display: flex;
|
|
213
243
|
align-items: center;
|
|
214
244
|
justify-content: center;
|
|
245
|
+
height: 110rpx;
|
|
246
|
+
background-color: var(--update-primary);
|
|
247
|
+
border-radius: 32rpx 32rpx 0 0;
|
|
248
|
+
&::after {
|
|
249
|
+
position: absolute;
|
|
250
|
+
right: 0;
|
|
251
|
+
bottom: -24rpx;
|
|
252
|
+
left: 0;
|
|
253
|
+
height: 48rpx;
|
|
254
|
+
content: '';
|
|
255
|
+
background-image: radial-gradient(circle at 50% 0, var(--update-primary) 35rpx, transparent 36rpx);
|
|
256
|
+
background-repeat: repeat-x;
|
|
257
|
+
background-position: center bottom;
|
|
258
|
+
background-size: 70rpx 48rpx;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
.loadingBox {
|
|
262
|
+
display: flex;
|
|
263
|
+
flex-direction: column;
|
|
215
264
|
width: 600rpx;
|
|
216
|
-
|
|
217
|
-
padding: 32rpx;
|
|
265
|
+
overflow: hidden;
|
|
218
266
|
background-color: #fff;
|
|
219
267
|
border-radius: 32rpx;
|
|
268
|
+
.body {
|
|
269
|
+
display: flex;
|
|
270
|
+
flex: 1;
|
|
271
|
+
align-items: center;
|
|
272
|
+
justify-content: center;
|
|
273
|
+
min-height: 240rpx;
|
|
274
|
+
padding: 48rpx 32rpx 32rpx;
|
|
275
|
+
}
|
|
220
276
|
}
|
|
221
277
|
</style>
|
|
@@ -60,6 +60,6 @@ export const themeColorOptions: ThemeColorOption[] = [
|
|
|
60
60
|
*/
|
|
61
61
|
export const LocaleOptions: LocaleOption[] = [
|
|
62
62
|
{ name: '简体中文', value: 'zh-CN' },
|
|
63
|
-
{ name: 'English', value: 'en-US' },
|
|
64
|
-
{ name: '阿拉伯语', value: 'ar-SA' },
|
|
63
|
+
// { name: 'English', value: 'en-US' },
|
|
64
|
+
// { name: '阿拉伯语', value: 'ar-SA' },
|
|
65
65
|
]
|