wui-components-v2 1.2.68 → 1.2.70

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.
@@ -260,11 +260,7 @@ function detail() {
260
260
  props.detailButtonHandle(props.data)
261
261
  return
262
262
  }
263
- router.push(
264
- `/pages/details-page/index?sourceId=${encodeURIComponent(props.sourceId)}&id=${encodeURIComponent(
265
- props.code
266
- )}&title=${encodeURIComponent(props.item.title || '')}`
267
- )
263
+ router.push(`/pages/details-page/index?sourceId=${props.sourceId}&id=${props.code}&title=${props.item.title}`)
268
264
  }
269
265
 
270
266
  // 判断按钮是否满足条件显示
@@ -98,22 +98,19 @@ function goDetail(item: Columns) {
98
98
  .map(param => {
99
99
  const fieldValue = props.data.fieldMap[param.id]
100
100
  const value = fieldValue ?? param.defaultValue ?? ''
101
- return `${encodeURIComponent(param.title ?? '')}=${encodeURIComponent(String(value))}`
101
+ return `${param.title ?? ''}=${value}`
102
102
  })
103
103
  .join('&')
104
104
  const sep = params ? (fieldJump.mobilePath.includes('?') ? '&' : '?') : ''
105
- // 对完整 URL 编码,避免 mobilePath 中的中文/全角字符在 H5 hash 路由下解析错乱
105
+ // 明文拼接;encodeURI 仅编码空格等 URL 非法字符,接收端(wui-list 等)解码一次还原
106
106
  uni.navigateTo({
107
107
  url: encodeURI(`${fieldJump.mobilePath}${sep}${params}`),
108
108
  })
109
109
  return
110
110
  }
111
- // 使用字段自身的 sourceId(参考 w-card.vue goto('link'))
112
- // 参数统一 encodeURIComponent,避免中文/特殊字符在 App 端被截断导致乱码、参数错位
111
+ // 使用字段自身的 sourceId(参考 w-card.vue goto('link')),明文拼接,不手动编码
113
112
  uni.navigateTo({
114
- url: `/pages/details-page/index?sourceId=${encodeURIComponent(item.sourceId)}&id=${encodeURIComponent(
115
- String(code)
116
- )}&title=${encodeURIComponent(item.title || '')}`,
113
+ url: `/pages/details-page/index?sourceId=${item.sourceId}&id=${code}&title=${item.title || ''}`,
117
114
  })
118
115
  }
119
116
  </script>
@@ -59,9 +59,8 @@ const loading = ref(false)
59
59
  // 折叠面板
60
60
  const collapses = ref()
61
61
  /**
62
- * 安全解码:仅当字符串仍为编码态时解码。
63
- * H5 / 小程序等平台 onLoad 参数可能已被框架自动解码一次,
64
- * 对已解码的中文再 decodeURIComponent 会抛 URIError,此处兜底原样返回。
62
+ * 简单解码:跳转端明文传参,URL 传输时浏览器/App 框架会自动编码一层,
63
+ * 接收端解一次即可还原明文。已解码的值(无 % 或解码抛错)原样返回。
65
64
  */
66
65
  function safeDecode(value?: string): string {
67
66
  if (!value) return ''
@@ -389,23 +389,35 @@ async function batchAction(item: rowActions) {
389
389
  }
390
390
  // 优先使用 props 传入的 sourceId,未传则走 onLoad 路由获取
391
391
  const internalSourceId = ref(props.sourceId)
392
+ /**
393
+ * 简单解码:跳转端明文传参,URL 传输时浏览器/App 框架会自动编码一层,
394
+ * 接收端解一次即可还原明文。已解码的值(无 % 或解码抛错)原样返回。
395
+ */
396
+ function safeDecode(value?: string | number): string {
397
+ if (value === undefined || value === null) return ''
398
+ try {
399
+ return decodeURIComponent(String(value))
400
+ } catch {
401
+ return String(value)
402
+ }
403
+ }
392
404
  onLoad((option: any) => {
393
405
  // 如果 props 没传 sourceId,则从路由参数获取
394
406
  if (!internalSourceId.value) {
395
- internalSourceId.value = option.sourceId
407
+ internalSourceId.value = safeDecode(option.sourceId)
396
408
  }
397
- pageTitle.value = option.title
409
+ pageTitle.value = safeDecode(option.title)
398
410
  pageType.value = option.pageType
399
411
  mainCode.value = option.mainCode || ''
400
412
  menuId.value = option.menuId || ''
401
413
  uni.setNavigationBarTitle({
402
- title: option.title,
414
+ title: pageTitle.value,
403
415
  })
404
416
  // 解析 URL 中 c_* 参数作为筛选字段默认值(c_{sourceId}={value})
405
417
  const criteria: { [key: string]: any } = {}
406
418
  Object.keys(option || {}).forEach(key => {
407
419
  if (key.startsWith('c_')) {
408
- criteria[key.slice(2)] = option[key]
420
+ criteria[key.slice(2)] = safeDecode(option[key])
409
421
  }
410
422
  })
411
423
  urlDefaultCriteria.value = criteria
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.68",
3
+ "version": "1.2.70",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",