hh-doctor-sdk 0.8.0 → 0.8.2

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.
@@ -108,11 +108,13 @@ module.exports = Behavior({
108
108
  },
109
109
 
110
110
  pdfData(url) {
111
- const index = url.indexOf('?')
111
+ // 展示用文件名去掉 query,下载地址保留签名参数
112
+ let path = url || ''
113
+ const index = path.indexOf('?')
112
114
  if (index >= 0) {
113
- url = url.substring(0, index)
115
+ path = path.substring(0, index)
114
116
  }
115
- const name = url.substring(url.lastIndexOf('/') + 1)
117
+ const name = path.substring(path.lastIndexOf('/') + 1)
116
118
  return {
117
119
  url: url,
118
120
  name: name
@@ -89,10 +89,7 @@ function pdfList(caseImageList) {
89
89
  }
90
90
 
91
91
  function pdfData(url, imagedesc) {
92
- const index = url.indexOf('?')
93
- if (index >= 0) {
94
- url = url.substring(0, index)
95
- }
92
+ // 保留签名等 query,下载/打开时需要完整地址
96
93
  return {
97
94
  url: url,
98
95
  name: imagedesc,
@@ -7,10 +7,15 @@ function viewPdfs(files) {
7
7
  this.viewPdf(files[0].url)
8
8
  } else {
9
9
  const items = files.map((file) => {
10
- const last = file.url.lastIndexOf('/')
11
- const fullFileName = file.url.substring(last + 1)
12
- const fileName = fullFileName.substring(0, fullFileName.lastIndexOf('.'))
13
- return fileName
10
+ let path = file.url || ''
11
+ const q = path.indexOf('?')
12
+ if (q >= 0) {
13
+ path = path.substring(0, q)
14
+ }
15
+ const last = path.lastIndexOf('/')
16
+ const fullFileName = path.substring(last + 1)
17
+ const dot = fullFileName.lastIndexOf('.')
18
+ return dot >= 0 ? fullFileName.substring(0, dot) : fullFileName
14
19
  })
15
20
  wx.showActionSheet({
16
21
  itemList: items,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-doctor-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "和缓名医小程序SDK",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"