@uxda/appkit 1.2.75 → 1.2.76

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "1.2.75",
3
+ "version": "1.2.76",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -0,0 +1,19 @@
1
+ # ddSkeleton 骨架屏
2
+
3
+ #
4
+ ## 使用
5
+
6
+ ``` javascript
7
+ import ddSkeleton from '~/components/ddSkeleton/index.vue'
8
+ ```
9
+ ``` html
10
+ <dd-skeleton @onSuccess="onSuccess" />
11
+ ```
12
+
13
+ ## Prop
14
+
15
+ | 字段 | 说明 | 类型 | 默认值 |
16
+ |-----------|-------------|---------|----------|
17
+ | row | 大骨架个数 | number | 3 |
18
+ | shortRow | 短骨架的行数 | string | 2 |
19
+ | longRow | 长骨架的行数 | string | 3 |
@@ -0,0 +1,36 @@
1
+ <script setup lang="ts">
2
+ interface PropType {
3
+ row?: number
4
+ shortRow?: string
5
+ longRow?: string
6
+ }
7
+
8
+ withDefaults(defineProps<PropType>(), {
9
+ row: 3,
10
+ shortRow: '2',
11
+ longRow: '4',
12
+ })
13
+ </script>
14
+
15
+ <template>
16
+ <div class="dd-skeleton">
17
+ <div class="dd-skeleton__item" v-for="(item, key) in row" :key="key">
18
+ <nut-skeleton
19
+ width="40%"
20
+ height="15px"
21
+ animated
22
+ v-if="Number(shortRow) > 0"
23
+ :row="shortRow"
24
+ ></nut-skeleton>
25
+ <nut-skeleton width="100%" height="15px" title animated :row="longRow"></nut-skeleton>
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <style lang="scss">
31
+ .dd-skeleton {
32
+ &__item {
33
+ margin-top: 10px;
34
+ }
35
+ }
36
+ </style>
@@ -16,6 +16,8 @@ export function useDragBox() {
16
16
  screenHeight: 0, // 屏幕高度
17
17
  isDrag: false, // 是否开始拖拽
18
18
  oldLeft: 0,
19
+ limitHorizontal: [0, 0], // 横向拖动限制范围
20
+ limitVertical: [0, 0], // 纵向拖动限制范围
19
21
  })
20
22
 
21
23
  // 初始化元素拖拽模型
@@ -32,6 +34,13 @@ export function useDragBox() {
32
34
  dragData.left = data.left * scale || 0
33
35
  dragData.top = data.top * scale || 0
34
36
  dragData.oldLeft = data.left * scale || 0
37
+
38
+ if (data?.limitHorizontal?.length) {
39
+ dragData.limitHorizontal = data?.limitHorizontal
40
+ }
41
+ if (data?.limitVertical?.length) {
42
+ dragData.limitVertical = data?.limitVertical
43
+ }
35
44
  }
36
45
 
37
46
  // 触屏开始
@@ -50,16 +59,16 @@ export function useDragBox() {
50
59
  let top = dragData.top + moveY
51
60
 
52
61
  // 防止浮动按钮移出屏幕
53
- if (left < 0) {
54
- left = 0
55
- } else if (left > dragData.screenWidth - dragData.width) {
56
- left = dragData.screenWidth - dragData.width
62
+ if (left < dragData.limitHorizontal[0]) {
63
+ left = dragData.limitHorizontal[0]
64
+ } else if (left > dragData.screenWidth - dragData.width - dragData.limitHorizontal[1]) {
65
+ left = dragData.screenWidth - dragData.width - dragData.limitHorizontal[1]
57
66
  }
58
67
 
59
- if (top < 0) {
60
- top = 0
61
- } else if (top > dragData.screenHeight - dragData.height) {
62
- top = dragData.screenHeight - dragData.height
68
+ if (top < dragData.limitVertical[0]) {
69
+ top = dragData.limitVertical[0]
70
+ } else if (top > dragData.screenHeight - dragData.height - dragData.limitVertical[1]) {
71
+ top = dragData.screenHeight - dragData.height - dragData.limitVertical[1]
63
72
  }
64
73
 
65
74
  dragData.left = left
@@ -32,12 +32,13 @@ const vendor = {
32
32
 
33
33
  function useHttp() {
34
34
  const appkitOptions = useAppKitOptions()
35
- const headers = {
35
+ const headers: any = {
36
36
  Token: appkitOptions.tempToken() || appkitOptions.token(),
37
37
  Appcode: appkitOptions.app(),
38
38
  cookie: `tid=${appkitOptions.tenant()}`,
39
39
  gray: appkitOptions.gray ? appkitOptions.gray() : '0',
40
40
  }
41
+
41
42
  /**
42
43
  * 传入配置获取 Http instanse
43
44
  */
@@ -92,13 +92,13 @@ const emits = defineEmits(['show'])
92
92
  top: 10px;
93
93
  bottom: 10px;
94
94
  align-items: center;
95
- justify-content: center;
96
95
  width: calc(100% - 24px);
97
96
  background: #ffffff;
98
97
  border-radius: 5px;
99
98
  display: flex;
100
99
  flex-direction: column;
101
100
  &-img {
101
+ margin-top: 50%;
102
102
  height: 111px;
103
103
  width: 198px;
104
104
  }
@@ -108,6 +108,7 @@ const emits = defineEmits(['show'])
108
108
  opacity: 0.4;
109
109
  font-size: 12px;
110
110
  padding: 0 30px;
111
+ text-align: center;
111
112
  }
112
113
  }
113
114
  </style>
@@ -12,11 +12,11 @@
12
12
  <img
13
13
  class="user-entry-head-img"
14
14
  mode="aspectFit"
15
+ @click="toUser1"
15
16
  v-else
16
17
  src="https://cdn.ddjf.com/static/images/wx-yunservice/account-head.png"
17
18
  alt=""
18
19
  />
19
- <div @click="toUser" class="user-entry-head-icon" v-if="mobile"></div>
20
20
  </div>
21
21
  <div class="user-entry-bd">
22
22
  <div v-if="!mobile" class="user-entry-bd-bigtxt" @click="toLogin">
@@ -29,7 +29,14 @@
29
29
  />
30
30
  </div>
31
31
  <template v-else>
32
- <div @click="toUser" class="user-entry-bd-txt">{{ name }}</div>
32
+ <div @click="toUser" class="user-entry-bd-txt">
33
+ {{ name }}
34
+ <img
35
+ style="width: 14px; height: 14px; margin-left: 2px"
36
+ src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjgiIGhlaWdodD0iMjgiIHZpZXdCb3g9IjAgMCAyOCAyOCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTExLjA4MzUgN0wxOC4wODM1IDE0TDExLjA4MzUgMjEiIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS43NSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPgo="
37
+ alt=""
38
+ />
39
+ </div>
33
40
  <div @click="toUser" class="user-entry-bd-smalltxt">{{ encodePhone(mobile) }}</div>
34
41
  </template>
35
42
  </div>
@@ -59,6 +66,10 @@ function toUser() {
59
66
  emits('jump')
60
67
  }
61
68
 
69
+ function toUser1() {
70
+ props?.mobile && toUser()
71
+ }
72
+
62
73
  // 未登录时,点击前往登录
63
74
  function toLogin() {
64
75
  emits('login')
@@ -118,6 +129,8 @@ const emits = defineEmits(['jump', 'login'])
118
129
  font-weight: 500;
119
130
  line-height: 25px;
120
131
  margin-bottom: 5px;
132
+ display: flex;
133
+ align-items: center;
121
134
  }
122
135
  &-smalltxt {
123
136
  margin-top: 0;
@@ -26,19 +26,27 @@
26
26
  v-for="(item, key) in formState.attachment"
27
27
  :key="key"
28
28
  >
29
+ <template v-if="item.status === 'done'">
30
+ <img
31
+ v-if="item.type === 'image'"
32
+ class="user-feedback-handle-item-img"
33
+ mode="aspectFit"
34
+ :src="item.url"
35
+ />
36
+ <video class="user-feedback-handle-item-img" :src="item.url" v-else />
37
+ <div class="user-feedback-handle-item-close" @click="onDelete(key)">
38
+ <img
39
+ class="user-feedback-handle-item-close-img"
40
+ src="https://cdn.ddjf.com/static/images/customer-center/close-filled.png"
41
+ />
42
+ </div>
43
+ </template>
29
44
  <img
30
- v-if="item.type === 'image'"
31
- class="user-feedback-handle-item-img"
45
+ class="user-feedback-handle-item-loading"
32
46
  mode="aspectFit"
33
- :src="item.url"
47
+ src="https://cdn.ddjf.com/static/images/customer-center/loading.png"
48
+ alt=""
34
49
  />
35
- <video class="user-feedback-handle-item-img" :src="item.url" v-else />
36
- <div class="user-feedback-handle-item-close" @click="onDelete(key)">
37
- <img
38
- class="user-feedback-handle-item-close-img"
39
- src="https://cdn.ddjf.com/static/images/customer-center/close-filled.png"
40
- />
41
- </div>
42
50
  </div>
43
51
  <div class="user-feedback-handle-item" @click="toUpload">+</div>
44
52
  </div>
@@ -148,7 +156,12 @@ function toUpload() {
148
156
  }
149
157
  }
150
158
 
151
- await uploadFile(item)
159
+ formState.attachment.push({
160
+ url: item.tempFilePath,
161
+ type: item.fileType,
162
+ status: 'uploading',
163
+ })
164
+ await uploadFile(formState.attachment[formState.attachment.length - 1])
152
165
  }
153
166
  },
154
167
  })
@@ -161,7 +174,7 @@ async function uploadFile(item: any) {
161
174
 
162
175
  let Res: any = await Taro.uploadFile({
163
176
  url: `${appkitOptions.baseUrl()}/saas-base/file/upload`,
164
- filePath: item.tempFilePath,
177
+ filePath: item.url,
165
178
  name: 'file',
166
179
  formData: {
167
180
  objectNo: `${token}${Date.now()}`,
@@ -172,10 +185,8 @@ async function uploadFile(item: any) {
172
185
 
173
186
  const res = JSON.parse(Res.data)
174
187
  if (res.success) {
175
- formState.attachment.push({
176
- url: res.result,
177
- type: item.fileType,
178
- })
188
+ item.url = res.result
189
+ item.status = 'done'
179
190
  }
180
191
  }
181
192
 
@@ -227,7 +238,13 @@ function requestFeedback() {
227
238
  title: '反馈中...',
228
239
  })
229
240
 
230
- const attachment = JSON.parse(JSON.stringify(formState.attachment))
241
+ const attachment = JSON.parse(
242
+ JSON.stringify(
243
+ formState.attachment
244
+ .filter((item) => item.status === 'done')
245
+ .map((item) => ({ url: item.url, type: item.type }))
246
+ )
247
+ )
231
248
  if (props.captureScreen && Object.keys(props.captureScreen).length) {
232
249
  attachment.push({
233
250
  captureScreen: props.captureScreen,
@@ -244,7 +261,6 @@ function requestFeedback() {
244
261
  device: 'MINI',
245
262
  attachment: JSON.stringify(attachment),
246
263
  }
247
- console.log(sendData, 'sendData')
248
264
  $http
249
265
  .post('/saas-base/problemFeedback/add', sendData)
250
266
  .then(() => {
@@ -365,6 +381,11 @@ const emits = defineEmits(['minimize', 'success'])
365
381
  height: 10px;
366
382
  }
367
383
  }
384
+ &-loading {
385
+ width: 17px;
386
+ height: 17px;
387
+ animation: rotate 2s linear infinite;
388
+ }
368
389
  }
369
390
  }
370
391
  .ql-editor.ql-blank:before {
@@ -406,5 +427,14 @@ const emits = defineEmits(['minimize', 'success'])
406
427
  font-weight: 500;
407
428
  }
408
429
  }
430
+
431
+ @keyframes rotate {
432
+ from {
433
+ transform: rotate(0);
434
+ }
435
+ to {
436
+ transform: rotate(360deg);
437
+ }
438
+ }
409
439
  }
410
440
  </style>
@@ -15,7 +15,14 @@
15
15
  />
16
16
  <div>反馈</div>
17
17
  </div>
18
- <div class="user-feedback-entry hasStorage" v-else>
18
+ <div
19
+ :style="dragStyle1"
20
+ @touchstart="onDragStart1"
21
+ @touchmove="onDragMove1"
22
+ @touchend="onDragEnd1"
23
+ class="user-feedback-entry hasStorage"
24
+ v-else
25
+ >
19
26
  <img
20
27
  class="user-feedback-entry-icon"
21
28
  @click="onJump"
@@ -39,17 +46,18 @@ import { useSafeArea } from '../../shared/composables'
39
46
  const props = withDefaults(
40
47
  defineProps<{
41
48
  hasStorage?: boolean
49
+ withTabbar?: boolean
42
50
  withNavbar?: boolean
43
51
  }>(),
44
52
  {
45
53
  hasStorage: false,
54
+ withTabbar: false,
46
55
  withNavbar: false,
47
56
  }
48
57
  )
49
58
 
50
59
  // 点击关闭
51
60
  function onClose() {
52
- console.log('close')
53
61
  emits('close')
54
62
  }
55
63
 
@@ -65,13 +73,39 @@ const dragStyle = computed(() => {
65
73
  return `left:${dragData.left}px; top:${dragData.top}px; width:${dragData.width}px; height:${dragData.height}px;`
66
74
  })
67
75
 
76
+ const {
77
+ dragData: dragData1,
78
+ initDragData: initDragData1,
79
+ onDragStart: onDragStart1,
80
+ onDragMove: onDragMove1,
81
+ onDragEnd: onDragEnd1,
82
+ } = useDragBox()
83
+ const dragStyle1 = computed(() => {
84
+ return `left:${dragData1.left}px; top:${dragData1.top}px; width:${dragData1.width}px; height:${dragData1.height}px;`
85
+ })
86
+
68
87
  onMounted(async () => {
88
+ const navbarHeight = safeArea.nav + safeArea.status
69
89
  // 初始化拖拽元素
70
90
  initDragData({
71
91
  width: 40,
72
92
  height: 40,
73
93
  left: 324,
74
- top: props.withNavbar ? 620 - safeArea.nav - safeArea.status : 620,
94
+ top: props.withNavbar ? 620 - navbarHeight : 620,
95
+ limitVertical: [
96
+ !props.withNavbar ? navbarHeight : 0,
97
+ props.withTabbar ? safeArea.menuRect.bottom : 0,
98
+ ],
99
+ })
100
+ initDragData1({
101
+ width: 92,
102
+ height: 43,
103
+ left: 272,
104
+ top: props.withNavbar ? 620 - navbarHeight : 620,
105
+ limitVertical: [
106
+ !props.withNavbar ? navbarHeight : 0,
107
+ props.withTabbar ? safeArea.menuRect.bottom : 0,
108
+ ],
75
109
  })
76
110
  })
77
111
 
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <scroll-view :scroll-y="!userState.visible && !avatarVisible" class="user-info">
3
- <div class="user-info-wrap">
3
+ <DdSkeleton v-if="firstLoading" :row="3"></DdSkeleton>
4
+ <div v-else class="user-info-wrap">
4
5
  <div class="user-info-tit">账号信息</div>
5
6
  <div class="user-info-head">
6
7
  <div class="user-info-head-avatar" @click="avatarVisible = true">
@@ -40,11 +41,19 @@
40
41
  <div v-for="(item, key) in userInfo.tenantInfoList" :key="key" class="user-info-team-item">
41
42
  <div class="user-info-team-item-avatar">
42
43
  <img
44
+ v-if="item.tenantLogo"
43
45
  class="user-info-team-item-avatar-img"
44
46
  mode="aspectFit"
45
47
  :src="item.tenantLogo"
46
48
  alt=""
47
49
  />
50
+ <img
51
+ v-else
52
+ class="user-info-team-item-avatar-img empty"
53
+ mode="aspectFit"
54
+ src="https://cdn.ddjf.com/static/images/customer-center/tenant-logo.png"
55
+ alt=""
56
+ />
48
57
  </div>
49
58
  <div class="user-info-team-item-bd">
50
59
  <div class="user-info-team-item-title">{{ item.tenantName }}</div>
@@ -159,6 +168,7 @@ import Taro, { useDidShow } from '@tarojs/taro'
159
168
  import { ref, onMounted, reactive, onUnmounted } from 'vue'
160
169
  import { useAppKitOptions } from '../../Appkit'
161
170
  import { useEncode } from '../../shared/composables/useEncode'
171
+ import DdSkeleton from '../../components/dd-skeleton/index.vue'
162
172
  import { useHttp } from '../api'
163
173
 
164
174
  const props = withDefaults(
@@ -186,14 +196,21 @@ onUnmounted(() => {
186
196
  Taro.eventCenter.off('USER-HEAD-CROP-OK')
187
197
  })
188
198
 
199
+ const firstLoading = ref(true)
189
200
  const userInfo = ref<any>({})
190
201
  // 根据用户id,查询用户所在租户列表
191
202
  function getUserInfoByUserId() {
192
203
  const $http = useHttp()
193
204
 
194
- $http.get(`/cas/sysAccount/getAccountInfo/${props.userId}`).then((result: any) => {
195
- userInfo.value = result
196
- })
205
+ $http
206
+ .get(`/cas/sysAccount/getAccountInfo/${props.userId}`)
207
+ .then((result: any) => {
208
+ userInfo.value = result
209
+ firstLoading.value = false
210
+ })
211
+ .catch(() => {
212
+ firstLoading.value = false
213
+ })
197
214
  }
198
215
 
199
216
  // 修改头像弹框
@@ -420,6 +437,10 @@ defineExpose({
420
437
  width: 100%;
421
438
  height: 100%;
422
439
  }
440
+ .empty {
441
+ width: 20px;
442
+ height: 40px;
443
+ }
423
444
  }
424
445
  &-title {
425
446
  font-size: 16px;
@@ -427,7 +448,6 @@ defineExpose({
427
448
  margin-bottom: 5px;
428
449
  }
429
450
  &-app {
430
- margin-bottom: 8px;
431
451
  display: flex;
432
452
  align-items: center;
433
453
  flex-wrap: wrap;
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <div class="login-setting" :style="style" v-if="show">
2
+ <div class="user-resource-empty" :style="style" v-if="show">
3
3
  <img
4
- class="login-setting-img"
4
+ class="user-resource-empty-img"
5
5
  src="https://cdn.ddjf.com/static/images/nutshell/empty-permission.png"
6
6
  />
7
- <div class="login-setting-text">
7
+ <div class="user-resource-empty-text">
8
8
  应用已于{{ dayjs(appInfo.endTime).format('YYYY年MM月DD日') }}到期,如需继续使用,
9
9
  请联系大道客户总监进行续费
10
10
  </div>
@@ -46,20 +46,20 @@ const style = computed(() => {
46
46
  </script>
47
47
 
48
48
  <style lang="scss">
49
- .login-setting {
49
+ .user-resource-empty {
50
50
  position: fixed;
51
51
  z-index: 4;
52
52
  left: 12px;
53
53
  top: 10px;
54
54
  bottom: 10px;
55
55
  align-items: center;
56
- justify-content: center;
57
56
  width: calc(100% - 24px);
58
57
  background: #ffffff;
59
58
  border-radius: 5px;
60
59
  display: flex;
61
60
  flex-direction: column;
62
61
  &-img {
62
+ margin-top: 50%;
63
63
  height: 111px;
64
64
  width: 198px;
65
65
  }
@@ -69,6 +69,7 @@ const style = computed(() => {
69
69
  opacity: 0.4;
70
70
  font-size: 12px;
71
71
  padding: 0 30px;
72
+ text-align: center;
72
73
  }
73
74
  }
74
75
  </style>