@uxda/appkit 1.2.34 → 1.2.38

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.
@@ -1,67 +1,67 @@
1
- <template>
2
- <DdNoticeBar
3
- v-if="showAlert"
4
- showClose
5
- :style="topStype"
6
- @close="showAlert = !showAlert"
7
- text="您当前使用的微信客户端版本较低,可能不支持全部功能或体验效果可能不佳,建议至应用商店或App Store升级至最新版本。"
8
- />
9
- </template>
10
-
11
- <script setup lang="ts">
12
- import { ref, onMounted, computed } from 'vue'
13
- import DdNoticeBar from '../../components/dd-notice-bar/index.vue'
14
- import { useSafeArea } from '../composables'
15
- import Taro from '@tarojs/taro'
16
- import { useHttp } from '../../balance/api'
17
-
18
- const showAlert = ref(false)
19
- const safeArea = useSafeArea()
20
-
21
- const topStype = computed(() => {
22
- return `top: ${safeArea.nav + safeArea.status}px;`
23
- })
24
-
25
- onMounted(async () => {
26
- await getPropertieByCode()
27
-
28
- const systemInfo = Taro.getSystemInfoSync()
29
- const version = systemInfo.SDKVersion
30
-
31
- // 版本号比较函数
32
- function compareVersion(v1, v2) {
33
- const v1Arr = v1.split('.').map(Number)
34
- const v2Arr = v2.split('.').map(Number)
35
-
36
- for (let i = 0; i < v1Arr.length || i < v2Arr.length; i++) {
37
- if ((v1Arr[i] || 0) > (v2Arr[i] || 0)) {
38
- return true
39
- } else if ((v1Arr[i] || 0) < (v2Arr[i] || 0)) {
40
- return false
41
- }
42
- }
43
- return false
44
- }
45
-
46
- if (!compareVersion(version, recommendVersions.value?.Mini || '2.24.0')) {
47
- showAlert.value = true
48
- }
49
- })
50
-
51
- const recommendVersions = ref()
52
- // 获取系统配置 - 小程序推荐版本
53
- async function getPropertieByCode() {
54
- if (recommendVersions.value) return
55
-
56
- const $http = useHttp()
57
- $http
58
- .get('/cas/properties/getPropertie', {
59
- code: 'pcRecommendVersion',
60
- })
61
- .then((res: any) => {
62
- recommendVersions.value = JSON.parse(res.value || '{}')
63
- })
64
- }
65
- </script>
66
-
67
- <style lang="less"></style>
1
+ <template>
2
+ <DdNoticeBar
3
+ v-if="showAlert"
4
+ showClose
5
+ :style="topStype"
6
+ @close="showAlert = !showAlert"
7
+ text="您当前使用的微信客户端版本较低,可能不支持全部功能或体验效果可能不佳,建议至应用商店或App Store升级至最新版本。"
8
+ />
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { ref, onMounted, computed } from 'vue'
13
+ import DdNoticeBar from '../../components/dd-notice-bar/index.vue'
14
+ import { useSafeArea } from '../composables'
15
+ import Taro from '@tarojs/taro'
16
+ import { useHttp } from '../../balance/api'
17
+
18
+ const showAlert = ref(false)
19
+ const safeArea = useSafeArea()
20
+
21
+ const topStype = computed(() => {
22
+ return `top: ${safeArea.nav + safeArea.status}px;`
23
+ })
24
+
25
+ const recommendVersions = ref()
26
+ // 获取系统配置 - 小程序推荐版本
27
+ async function getPropertieByCode() {
28
+ if (recommendVersions.value) return
29
+
30
+ const $http = useHttp()
31
+ await $http
32
+ .get('/cas/properties/getPropertie', {
33
+ code: 'pcRecommendVersion',
34
+ })
35
+ .then((res: any) => {
36
+ recommendVersions.value = JSON.parse(res.value || '{}')
37
+ })
38
+ }
39
+
40
+ onMounted(async () => {
41
+ await getPropertieByCode()
42
+
43
+ const systemInfo = Taro.getSystemInfoSync()
44
+ const version = systemInfo.SDKVersion
45
+
46
+ // 版本号比较函数
47
+ function compareVersion(v1, v2) {
48
+ const v1Arr = v1.split('.').map(Number)
49
+ const v2Arr = v2.split('.').map(Number)
50
+
51
+ for (let i = 0; i < v1Arr.length || i < v2Arr.length; i++) {
52
+ if ((v1Arr[i] || 0) > (v2Arr[i] || 0)) {
53
+ return true
54
+ } else if ((v1Arr[i] || 0) < (v2Arr[i] || 0)) {
55
+ return false
56
+ }
57
+ }
58
+ return false
59
+ }
60
+
61
+ if (!compareVersion(version, recommendVersions.value?.Mini || '2.24.0')) {
62
+ showAlert.value = true
63
+ }
64
+ })
65
+ </script>
66
+
67
+ <style lang="less"></style>
@@ -6,23 +6,24 @@ export type SafeArea = {
6
6
  /**
7
7
  * 状态条高度
8
8
  */
9
- status: number,
9
+ status: number
10
10
  /**
11
11
  * 导航条区域(胶囊)
12
12
  */
13
- nav: number,
13
+ nav: number
14
14
  /**
15
15
  * 屏幕底部范围
16
16
  */
17
17
  bottom: number
18
+ menuRect: any
18
19
  }
19
20
 
20
21
  /**
21
22
  * 获取屏幕安全区域
22
23
  * 从系统 API 获取
23
- * @returns
24
+ * @returns
24
25
  */
25
- export function useSafeArea (): SafeArea {
26
+ export function useSafeArea(): SafeArea {
26
27
  const systemInfo = Taro.getSystemInfoSync(),
27
28
  capsule = Taro.getMenuButtonBoundingClientRect()
28
29
  /**
@@ -39,6 +40,7 @@ export function useSafeArea (): SafeArea {
39
40
  return {
40
41
  status,
41
42
  nav,
42
- bottom
43
+ bottom,
44
+ menuRect: capsule,
43
45
  }
44
- }
46
+ }