hh-doctor-sdk 0.3.6 → 0.3.8

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.
@@ -2,7 +2,7 @@ const pdfViewer = require('../../../public/pdf-viewer')
2
2
  const dicomApi = require('../../../apis/dicom-api')
3
3
  const caseImageFilter = require('../widget/case-image-filter')
4
4
  const hhNavigation = require('../../../hh-navigation')
5
- const cache = require('../../../public/cache-data')
5
+ const deviceUtil = require('../../../utils/device-utils')
6
6
 
7
7
  module.exports = Behavior({
8
8
 
@@ -116,13 +116,12 @@ module.exports = Behavior({
116
116
  const find = this.data._mediaFiles.findIndex((value, index, array) => {
117
117
  return value.url == firstPic
118
118
  })
119
- if (find >= 0) {
120
- wx.previewMedia({
121
- current: find,
122
- sources: this.data._mediaFiles,
123
- })
119
+
120
+ if (deviceUtil.isPC()) {
121
+ hhNavigation.mediaPreview(this.data._mediaFiles, find)
124
122
  } else {
125
123
  wx.previewMedia({
124
+ current: find >= 0 ? find : 0,
126
125
  sources: this.data._mediaFiles,
127
126
  })
128
127
  }
@@ -6,7 +6,8 @@ const pages = {
6
6
  evaluate: 'consultation/evaluate/evaluate-page',
7
7
  videoChat: 'video-chat-page/video-chat-page',
8
8
  pathology: 'pathology/pathology-page',
9
- copyUrl: 'copy-url-page/copy-url-page'
9
+ copyUrl: 'copy-url-page/copy-url-page',
10
+ mediaPreview: 'uikit/media-preview-page/media-preview-page'
10
11
  }
11
12
 
12
13
 
@@ -100,6 +101,14 @@ function copyUrl(url) {
100
101
  navigateTo(pages.copyUrl, params)
101
102
  }
102
103
 
104
+ function mediaPreview(urls, index = 0) {
105
+ let params = {
106
+ 'current': index,
107
+ 'mediaInfo': JSON.stringify(urls)
108
+ }
109
+ navigateTo(pages.mediaPreview, params)
110
+ }
111
+
103
112
  module.exports = {
104
113
  navigateTo,
105
114
  orderList,
@@ -109,5 +118,6 @@ module.exports = {
109
118
  evaluate,
110
119
  videoChat,
111
120
  pathology,
112
- copyUrl
121
+ copyUrl,
122
+ mediaPreview
113
123
  }
@@ -24,7 +24,7 @@ Page({
24
24
  const orderId = options.orderId
25
25
  const hospitalId = options.hospitalId
26
26
  let path = options.path || null
27
- let forDicom = options.forDicom || false
27
+ let forDicom = JSON.parse(options.forDicom) || false
28
28
  if (path != null) {
29
29
  path = decodeURIComponent(path)
30
30
  }
@@ -166,6 +166,11 @@ Page({
166
166
  title: '加载中...',
167
167
  })
168
168
  } else {
169
+ if (this.data.path) {
170
+ wx.setNavigationBarTitle({
171
+ title: this.data.path,
172
+ })
173
+ }
169
174
  wx.stopPullDownRefresh()
170
175
  wx.hideNavigationBarLoading()
171
176
  }
@@ -0,0 +1,75 @@
1
+ // components/uikit/media-preview-page/media-preview-page.js
2
+ Page({
3
+
4
+ /**
5
+ * 页面的初始数据
6
+ */
7
+ data: {
8
+ indexCurrent: 1,
9
+ urls: null,
10
+ },
11
+
12
+ /**
13
+ * 生命周期函数--监听页面加载
14
+ */
15
+ onLoad(options) {
16
+ wx.setNavigationBarTitle({
17
+ title: '预览',
18
+ })
19
+ let urls = JSON.parse(decodeURIComponent(options.mediaInfo || ''))
20
+ let current = JSON.parse(options.current)
21
+ this.setData({
22
+ indexCurrent: current,
23
+ urls: urls
24
+ })
25
+ },
26
+
27
+ /**
28
+ * 生命周期函数--监听页面初次渲染完成
29
+ */
30
+ onReady() {
31
+
32
+ },
33
+
34
+ /**
35
+ * 生命周期函数--监听页面显示
36
+ */
37
+ onShow() {
38
+
39
+ },
40
+
41
+ /**
42
+ * 生命周期函数--监听页面隐藏
43
+ */
44
+ onHide() {
45
+
46
+ },
47
+
48
+ /**
49
+ * 生命周期函数--监听页面卸载
50
+ */
51
+ onUnload() {
52
+
53
+ },
54
+
55
+ /**
56
+ * 页面相关事件处理函数--监听用户下拉动作
57
+ */
58
+ onPullDownRefresh() {
59
+
60
+ },
61
+
62
+ /**
63
+ * 页面上拉触底事件的处理函数
64
+ */
65
+ onReachBottom() {
66
+
67
+ },
68
+
69
+ /**
70
+ * 用户点击右上角分享
71
+ */
72
+ onShareAppMessage() {
73
+
74
+ }
75
+ })
@@ -0,0 +1,3 @@
1
+ {
2
+ "usingComponents": {}
3
+ }
@@ -0,0 +1,30 @@
1
+ <swiper
2
+ indicator-dots="true"
3
+ indicator-color="transparent"
4
+ indicator-active-color="transparent"
5
+ class="swiper"
6
+ bindchange="handleSwiper"
7
+ current="{{indexCurrent}}"
8
+ id="{{indexCurrent}}"
9
+ >
10
+ <block wx:for="{{urls}}" wx:key="index" wx:for-index="index">
11
+ <swiper-item item-id="3">
12
+ <image
13
+ wx:if="{{item.type == 'image'}}"
14
+ name="chatImg"
15
+ src="{{item.url}}"
16
+ class="slide-image"
17
+ mode="aspectFill"
18
+ />
19
+ <video
20
+ wx:else
21
+ id="myVideo{{index}}"
22
+ data-index="{{index}}"
23
+ enable-play-gesture="{{true}}"
24
+ src="{{item.url}}"
25
+ class="slide-image"
26
+ ></video>
27
+ </swiper-item>
28
+ </block>
29
+ </swiper>
30
+ <view class="JSSwiper">{{indexCurrent + 1}} / {{urls.length}}</view>
@@ -0,0 +1,17 @@
1
+ .swiper {
2
+ height: 100vh;
3
+ position: relative;
4
+ }
5
+ .slide-image {
6
+ width: 100%;
7
+ display: inline-block;
8
+ width: 100%;
9
+ height: 100%;
10
+ }
11
+ .JSSwiper {
12
+ position: absolute;
13
+ top: 10px;
14
+ width: 100%;
15
+ margin-left: 49%;
16
+ color: #fff;
17
+ }
@@ -0,0 +1,8 @@
1
+ function isPC() {
2
+ let info = wx.getSystemInfoSync()
3
+ return info.platform == 'windows' || info.platform == 'mac'
4
+ }
5
+
6
+ module.exports = {
7
+ isPC
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-doctor-sdk",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "和缓名医小程序SDK",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"