@zscreate/zhxy-app-component 1.0.0

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.
Files changed (70) hide show
  1. package/components/dying318-picker/Demo.vue +342 -0
  2. package/components/dying318-picker/Picker.nvue +441 -0
  3. package/components/dying318-picker/Picker.vue +442 -0
  4. package/components/dying318-picker/Pickers.vue +321 -0
  5. package/components/dying318-picker/README.md +479 -0
  6. package/components/easydrag-sort/easydrag-sort.vue +248 -0
  7. package/components/evan-form/evan-form.vue +102 -0
  8. package/components/evan-form/utils.js +125 -0
  9. package/components/evan-form-item/evan-form-item.vue +1457 -0
  10. package/components/evan-form-item/mixins/computedMixin.js +44 -0
  11. package/components/evan-form-item/mixins/pubSubMixin.js +104 -0
  12. package/components/evan-form-item/mixins/validateByApiMinxins.js +21 -0
  13. package/components/evan-form-item/mixins/validateFormMixin.js +71 -0
  14. package/components/evan-form-item/mixins/valueChangeMixin.js +64 -0
  15. package/components/evan-form-item/modules/edit.png +0 -0
  16. package/components/evan-form-item/utilForForm.js +35 -0
  17. package/components/evan-form-item/utils.js +51 -0
  18. package/components/form-container/data.js +709 -0
  19. package/components/form-container/form-container.vue +897 -0
  20. package/components/jin-edit/jin-edit.vue +327 -0
  21. package/components/jin-edit/jin-icons.vue +48 -0
  22. package/components/jin-edit/readme.md +65 -0
  23. package/components/l-file/l-file.vue +260 -0
  24. package/components/lb-picker/index.vue +286 -0
  25. package/components/signatrue-write/signatrue-write.vue +220 -0
  26. package/components/t-color-picker/t-color-picker.vue +784 -0
  27. package/components/uni-datetime-picker/changelog.md +76 -0
  28. package/components/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue +182 -0
  29. package/components/uni-datetime-picker/components/uni-datetime-picker/calendar.js +546 -0
  30. package/components/uni-datetime-picker/components/uni-datetime-picker/calendar.vue +1024 -0
  31. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json +19 -0
  32. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js +8 -0
  33. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json +19 -0
  34. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json +19 -0
  35. package/components/uni-datetime-picker/components/uni-datetime-picker/keypress.js +45 -0
  36. package/components/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue +927 -0
  37. package/components/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue +966 -0
  38. package/components/uni-datetime-picker/components/uni-datetime-picker/util.js +437 -0
  39. package/components/uni-datetime-picker/components/uni-datetime-picker/year-mont-picker.vue +901 -0
  40. package/components/uni-datetime-picker/components/uni-datetime-picker/year-picker.vue +271 -0
  41. package/components/uni-datetime-picker/package.json +89 -0
  42. package/components/uni-datetime-picker/readme.md +159 -0
  43. package/components/uni-icons/icons.js +96 -0
  44. package/components/uni-icons/uni-icons.vue +57 -0
  45. package/components/uni-popup/message.js +29 -0
  46. package/components/uni-popup/popup.js +25 -0
  47. package/components/uni-popup/uni-popup-dialog.vue +243 -0
  48. package/components/uni-popup/uni-popup-message.vue +116 -0
  49. package/components/uni-popup/uni-popup-share.vue +165 -0
  50. package/components/uni-popup/uni-popup.vue +297 -0
  51. package/components/uni-rate/uni-rate.vue +140 -0
  52. package/components/uni-transition/uni-transition.vue +279 -0
  53. package/components/uploadFile/uploadFile.vue +124 -0
  54. package/components/viewcomponents/applicateGrid.vue +96 -0
  55. package/components/viewcomponents/card.vue +166 -0
  56. package/components/viewcomponents/formCard.vue +82 -0
  57. package/components/viewcomponents/infocell.vue +122 -0
  58. package/components/viewcomponents/navsearch.vue +59 -0
  59. package/components/viewcomponents/newscontent.vue +85 -0
  60. package/components/xp-picker/util.js +105 -0
  61. package/components/xp-picker/xp-picker.vue +330 -0
  62. package/index.js +9 -0
  63. package/package.json +29 -0
  64. package/static/iconfont.css +32 -0
  65. package/static/mttf.ttf +0 -0
  66. package/static/uni.ttf +0 -0
  67. package/utils/js-interp.js +6501 -0
  68. package/utils/js-interp.md +10 -0
  69. package/utils/moment.js +4601 -0
  70. package/utils/util.js +106 -0
@@ -0,0 +1,327 @@
1
+ <template>
2
+ <view class="container">
3
+ <editor class="ql-container" :show-img-size="true" :show-img-toolbar="true" :show-img-resize="true" id="editor"
4
+ @statuschange="statuschange" @blur="editBlur" @ready="onEditorReady" ref="editot" :read-only="disabled"></editor>
5
+ <!-- 操作工具 -->
6
+ <view class="tool-view">
7
+ <view class="tool">
8
+ <!-- <jinIcon class="single" type="&#xe6f3;" font-size="44rpx" title="插入图片" @click="insertImage"></jinIcon> -->
9
+ <jinIcon class="single" type="&#xe6f9;" font-size="44rpx" title="修改文字样式" @click="showMore" :color="showMoreTool ? activeColor : '#666666'"></jinIcon>
10
+ <jinIcon class="single" type="&#xe6eb;" font-size="44rpx" title="分割线" @click="insertDivider"></jinIcon>
11
+ <jinIcon class="single" type="&#xe6e8;" font-size="44rpx" title="撤销" @click="undo"></jinIcon>
12
+ <jinIcon class="single" type="&#xe705;" font-size="44rpx" title="重做" @click="redo"></jinIcon>
13
+ <jinIcon class="single" type="&#xeb8a;" font-size="44rpx" title="设置" @click="release(true)"></jinIcon>
14
+ </view>
15
+
16
+ <view class="font-more" :style="{ height: showMoreTool ? '100rpx' : 0 }">
17
+ <jinIcon class="single" type="&#xe6e7;" font-size="44rpx" title="加粗" @click="setBold" :color="showBold ? activeColor : '#666666'"></jinIcon>
18
+ <jinIcon class="single" type="&#xe6fe;" font-size="44rpx" title="斜体" @click="setItalic" :color="showItalic ? activeColor : '#666666'"></jinIcon>
19
+ <jinIcon class="single" type="&#xe6f8;" font-size="44rpx" title="分割线" @click="setIns" :color="showIns ? activeColor : '#666666'"></jinIcon>
20
+ <jinIcon class="single" type="&#xe6e3;" font-size="44rpx" title="标题" @click="setHeader" :color="showHeader ? activeColor : '#666666'"></jinIcon>
21
+ <jinIcon class="single" type="&#xe6f1;" font-size="44rpx" title="居中" @click="setCenter" :color="showCenter ? activeColor : '#666666'"></jinIcon>
22
+ <jinIcon class="single" type="&#xe6ed;" font-size="44rpx" title="居右" @click="setRight" :color="showRight ? activeColor : '#666666'"></jinIcon>
23
+ </view>
24
+ <!-- <view class="setting-layer-mask" v-if="showSettingLayer" @click="showSetting"></view>
25
+ <view class="setting-layer" v-if="showSettingLayer">
26
+ <view class="single" @click="release(true)">
27
+ <jinIcon class="icon" type="&#xe639;" ></jinIcon>
28
+ <view>公开发布</view>
29
+ </view>
30
+ <view class="single" @click="release(false)">
31
+ <jinIcon class="icon" type="&#xe655;" ></jinIcon>
32
+ <view>私密保存</view>
33
+ </view>
34
+ </view> -->
35
+ </view>
36
+ </view>
37
+ </template>
38
+
39
+ <script>
40
+ import jinIcon from './jin-icons.vue';
41
+ export default {
42
+ props: {
43
+ // 点击图片时显示图片大小控件
44
+ showImgSize: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ // 点击图片时显示工具栏控件
49
+ showImgToolbar: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ // 点击图片时显示修改尺寸控件
54
+ showImgResize: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ // 占位符
59
+ placeholder: {
60
+ type: String,
61
+ default: '开始输入...'
62
+ },
63
+ // 图片上传的地址
64
+ uploadFileUrl: {
65
+ type: String,
66
+ default: '#'
67
+ },
68
+ // 上传文件时的name
69
+ fileKeyName: {
70
+ type: String,
71
+ default: 'file'
72
+ },
73
+ //是否只读
74
+ disabled:{
75
+ type:Boolean,
76
+ default:false
77
+ },
78
+ // 上传图片时,http请求的header
79
+ header: {
80
+ type: Object
81
+ },
82
+ // 初始化html
83
+ html: {
84
+ type: String
85
+ }
86
+ },
87
+ computed: {
88
+
89
+ },
90
+ data() {
91
+ return {
92
+ showMoreTool: true,
93
+ showBold: false,
94
+ showItalic: false,
95
+ showIns: false,
96
+ showHeader: false,
97
+ showCenter: false,
98
+ showRight: false,
99
+ showSettingLayer: false,
100
+ activeColor: '#F56C6C'
101
+ };
102
+ },
103
+ components: {
104
+ jinIcon
105
+ },
106
+ watch: {
107
+ html: {
108
+ handler(val) {
109
+ console.log(val)
110
+ },
111
+ deep: true
112
+ }
113
+ },
114
+ created() {
115
+
116
+ },
117
+ methods: {
118
+ onEditorReady() {
119
+ uni.createSelectorQuery().in(this).select('#editor').context((res) => {
120
+ this.editorCtx = res.context
121
+ this.editorCtx.setContents({
122
+ html: this.html
123
+ })
124
+ }).exec()
125
+ // uni.createSelectorQuery()
126
+ // .in(this)
127
+ // .select('.ql-container')
128
+ // .fields({
129
+ // size: false,
130
+ // context: true
131
+ // },res => {
132
+ // this.editorCtx = res.context;
133
+ // this.editorCtx.setContents({
134
+ // html: this.html
135
+ // })
136
+ // })
137
+ // .exec();
138
+ },
139
+ undo() {
140
+ this.editorCtx.undo();
141
+ },
142
+ // 插入图片
143
+ insertImage() {
144
+ uni.chooseImage({
145
+ count: 9, //默认9
146
+ sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
147
+ sourceType: ['album', 'camera'], //从相册选择
148
+ success: async (res) => {
149
+ var tempFilePaths = res.tempFilePaths;
150
+ uni.showLoading({
151
+ title: '正在上传中...'
152
+ })
153
+ for (let temp of tempFilePaths) {
154
+ // 图片上传服务器
155
+ await uni.uploadFile({
156
+ url: this.uploadFileUrl,
157
+ filePath: temp,
158
+ name: this.fileKeyName,
159
+ header: this.header,
160
+ success: res => {
161
+ // 上传完成后处理
162
+ this.editorCtx.insertImage({
163
+ src: temp, // 此处需要将图片地址切换成服务器返回的真实图片地址
164
+ alt: '图片',
165
+ success: function(e) {}
166
+ });
167
+ uni.hideLoading()
168
+ },
169
+
170
+ });
171
+ }
172
+ }
173
+ });
174
+ },
175
+ insertDivider() {
176
+ this.editorCtx.insertDivider();
177
+ },
178
+ redo() {
179
+ this.editorCtx.redo();
180
+ },
181
+ showMore() {
182
+ this.showMoreTool = !this.showMoreTool;
183
+ this.editorCtx.setContents()
184
+ },
185
+ setBold() {
186
+ this.showBold = !this.showBold;
187
+ this.editorCtx.format('bold');
188
+ },
189
+ setItalic() {
190
+ this.showItalic = !this.showItalic;
191
+ this.editorCtx.format('italic');
192
+ },
193
+ checkStatus(name, detail, obj) {
194
+ if (detail.hasOwnProperty(name)) {
195
+ this[obj] = true;
196
+ } else {
197
+ this[obj] = false;
198
+ }
199
+ },
200
+ statuschange(e) {
201
+ var detail = e.detail;
202
+ this.checkStatus('bold', detail, 'showBold');
203
+ this.checkStatus('italic', detail, 'showItalic');
204
+ this.checkStatus('ins', detail, 'showIns');
205
+ this.checkStatus('header', detail, 'showHeader');
206
+ if (detail.hasOwnProperty('align')) {
207
+ if (detail.align == 'center') {
208
+ this.showCenter = true;
209
+ this.showRight = false;
210
+ } else if (detail.align == 'right') {
211
+ this.showCenter = false;
212
+ this.showRight = true;
213
+ } else {
214
+ this.showCenter = false;
215
+ this.showRight = false;
216
+ }
217
+ } else {
218
+ this.showCenter = false;
219
+ this.showRight = false;
220
+ }
221
+ },
222
+ setIns() {
223
+ this.showIns = !this.showIns;
224
+ this.editorCtx.format('ins');
225
+ },
226
+ setHeader() {
227
+ this.showHeader = !this.showHeader;
228
+ this.editorCtx.format('header', this.showHeader ? 'H2' : false);
229
+ },
230
+ setCenter() {
231
+ this.showCenter = !this.showCenter;
232
+ this.editorCtx.format('align', this.showCenter ? 'center' : false);
233
+ },
234
+ setRight() {
235
+ this.showRight = !this.showRight;
236
+ this.editorCtx.format('align', this.showRight ? 'right' : false);
237
+ },
238
+ showSetting() {
239
+ this.showSettingLayer = !this.showSettingLayer;
240
+ },
241
+ async editFocus() {
242
+
243
+ },
244
+ editBlur() {
245
+ this.release(true)
246
+ },
247
+ release(isPublic) {
248
+ this.showSettingLayer = false;
249
+ this.editorCtx.getContents({
250
+ success: res => {
251
+ Object.assign(res, {
252
+ isPublic: isPublic
253
+ })
254
+ this.$emit('editOk', res);
255
+ }
256
+ })
257
+ },
258
+ }
259
+ };
260
+ </script>
261
+
262
+ <style scoped>
263
+ .container {
264
+ padding: 30rpx 0;
265
+ box-sizing: border-box;
266
+ margin-left: 30upx;
267
+ /* padding-bottom: 120rpx; */
268
+ }
269
+
270
+ .ql-container {
271
+ font-size: 22px;
272
+ width: 65vw;
273
+ padding-left: 60upx;
274
+ }
275
+
276
+ .tool-view {
277
+ /* width: 100vw; */
278
+
279
+
280
+ }
281
+
282
+ .tool {
283
+ display: flex;
284
+ align-items: center;
285
+ justify-content: space-around;
286
+ width: 100%;
287
+ background: #eee;
288
+ margin-left: 30upx;
289
+ }
290
+
291
+ .font-more {
292
+ display: flex;
293
+ align-items: center;
294
+ justify-content: space-around;
295
+ width: 100%;
296
+ background: rgb(235, 235, 235);
297
+ overflow: hidden;
298
+ transition: all 0.15s;
299
+ margin-left: 30upx;
300
+ }
301
+
302
+ .setting-layer {
303
+ background: #fff;
304
+ width: 250rpx;
305
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
306
+ border-radius: 8rpx;
307
+ }
308
+
309
+ .setting-layer .single {
310
+ height: 80rpx;
311
+ font-size: 32rpx;
312
+ padding: 0 30rpx;
313
+ display: flex;
314
+ align-items: center;
315
+ line-height: 80rpx;
316
+ flex-direction: row;
317
+ color: #666;
318
+ }
319
+
320
+ .setting-layer .single .icon {
321
+ margin-right: 20rpx;
322
+ }
323
+
324
+ .setting-layer-mask {
325
+ background: transparent;
326
+ }
327
+ </style>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <view class="content">
3
+ <view class="icon" :style="{color: color, fontSize: fontSize}" v-html="type" @click="toclick"></view>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ props: {
10
+ type: {
11
+ type: String,
12
+ default: '&#xe644;'
13
+ },
14
+ color: {
15
+ type: String,
16
+ default: '#666666'
17
+ },
18
+ fontSize: {
19
+ type: String,
20
+ default: '34rpx'
21
+ }
22
+ },
23
+ methods: {
24
+ toclick() {
25
+ this.$emit('click');
26
+ }
27
+ }
28
+ }
29
+ </script>
30
+
31
+ <style scoped>
32
+ .content{
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ }
37
+ @font-face {
38
+ font-family: 'jin';
39
+ /** 阿里巴巴矢量图标库的字体库地址,可以替换自己的字体库地址 **/
40
+ src: url('https://at.alicdn.com/t/font_1491431_6m7ltjo8wi.ttf') format('truetype');
41
+ }
42
+
43
+ .icon {
44
+ font-family: jin !important;
45
+ font-size: 34rpx;
46
+ }
47
+
48
+ </style>
@@ -0,0 +1,65 @@
1
+ ## jin-edit 基于editor的富文本编辑器
2
+
3
+ ### 兼容性
4
+
5
+ 这是一个uni-app的通用组件,兼容微信小程序端、安卓端、ios端(未测试)、H5端。作者因没有ios设备无法对ios端进行测试,其他端测试无问题。
6
+
7
+ 微信小程序 | APP | H5
8
+ :--: | :--: | :--:
9
+ √ | √ | √
10
+
11
+ 我的HbuilderX版本2.6.7,不同的版本可能会造成不兼容的问题。
12
+
13
+ ### 使用方式
14
+
15
+ 1. 将此组件进入你的项目中的 /components/ 目录中
16
+ 2. 在某个页面中使用该插件
17
+ - 在 `script` 中引用组件
18
+ ```javascript
19
+ import jinEdit from '../../components/jin-edit/jin-edit.vue';
20
+ export default {
21
+ data() {
22
+ return {
23
+
24
+ }
25
+ },
26
+ components: {
27
+ jinEdit
28
+ },
29
+ methods: {
30
+ // 点击发布
31
+ editOk(res) {
32
+ console.log(res);
33
+ }
34
+ }
35
+ }
36
+ ```
37
+ - 在 `template` 中使用组件
38
+ ```html
39
+ <jinEdit placeholder="请输入内容" @editOk="editOk" uploadFileUrl="/#"></jinEdit>
40
+ ```
41
+
42
+ ### Demo
43
+
44
+ [uni-jin(一个uni-app组件集合)](https://github.com/wangjinxin613/uni-jin)
45
+
46
+ ### 参数
47
+
48
+ 属性 | 类型 | 默认值 | 说明
49
+ :--: | :--: | :--: | :--:
50
+ showImgSize | Boolean | false | 点击图片时显示图片大小控件
51
+ showImgToolbar | Boolean | false | 点击图片时显示工具栏控件
52
+ showImgResize | Boolean | false | 点击图片时显示修改尺寸控件
53
+ placeholder | String | '' | 编辑器占位符
54
+ uploadFileUrl | String | '#' | 图片上传的服务器地址
55
+ fileKeyName | String | 'file' | 图片上传时的name
56
+ header | Object | - | 图片上传http请求的header
57
+ html | String | - | 初始化的html
58
+
59
+ ### 方法
60
+
61
+ 方法名 | 参数 | 说明
62
+ :--: | :--: | :--:
63
+ editOk | e={html,text,delta,isPublic} | 点击发布按钮触发
64
+
65
+ 以上
@@ -0,0 +1,260 @@
1
+ <template>
2
+ <view>
3
+ <view class="file_conten">
4
+ <view class="file_upload option-font-size" @click="chooseMessageFile"
5
+ v-if="isShow">
6
+ 点击上传
7
+ </view>
8
+ <view>
9
+ <view class="file_item" v-for="(item,idx) in defaultFile" :key="idx">
10
+ <view @click="downLoadFile(item.url,item.name)">{{item.name}}</view>
11
+ <icon type="clear" size="16" @click="handleDelete(idx)" v-if="!disabled" />
12
+ </view>
13
+ </view>
14
+ </view>
15
+ <!-- <view class="name" v-show="!show">{{name}}</view>
16
+ <view class="name SXcolor" v-if="fileName" @click="downLoadFile(defaultFile[0]['url'])">{{fileName}}</view>
17
+ </view>
18
+ <view v-if="fileName" class="tips option-font-size">更多文件详情请于电脑端查看</view> -->
19
+ <view v-if="!disabled">
20
+ <progress :percent="percent" stroke-width="5" activeColor="#007AFF" backgroundColor="#FFFFFF"
21
+ style="width: 200upx;" v-show="show"></progress>
22
+ </view>
23
+ </view>
24
+ </template>
25
+
26
+ <script>
27
+ export default {
28
+ props: {
29
+ widget: {
30
+ type: Object,
31
+ default: {}
32
+ },
33
+ url: {
34
+ type: String,
35
+ default: ''
36
+ },
37
+ disabled: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ defaultFile: {
42
+ type: Array,
43
+ default: () => []
44
+ }
45
+ },
46
+ data() {
47
+ return {
48
+ name: "",
49
+ percent: 0,
50
+ show: true,
51
+ imgViewUrl: this.LFileBaseUrl,
52
+ isShow:true,//是否展示点击上传
53
+ }
54
+ },
55
+ watch:{
56
+ //当上传的数量超过了设置的数量 就不让上传
57
+ defaultFile(val){
58
+ this.getShow(val)
59
+ }
60
+ },
61
+ mounted() {
62
+ if(this.disabled){
63
+ this.isShow =!this.disabled
64
+ }
65
+ else{
66
+ this.getShow(this.defaultFile)
67
+ }
68
+ },
69
+ methods: {
70
+ getShow(val){
71
+ if(val && val.length>=this.widget.length){
72
+ this.isShow = false
73
+ }
74
+ else{
75
+ this.isShow = true
76
+ }
77
+ },
78
+ //删除文件
79
+ handleDelete(idx) {
80
+ this.$emit('fileDelete', idx)
81
+ },
82
+ downLoadFile(path, name) {
83
+ // if (path.includes('.pdf')) {
84
+ // uni.navigateTo({
85
+ // url: '/pages/home/Singlepoint?url=' + this.downLoadUrl + path + "&download=true"
86
+ // })
87
+ // return false;
88
+ // }
89
+ let type = '';
90
+ let fileType = '';
91
+ let fileTypesIndex = -1;
92
+ const fileTypes = ['doc', 'docx', 'pdf', 'xls', 'xlsx', 'ppt', 'pptx'];
93
+ if (path) {
94
+ let str = path.split('.');
95
+ type = str[str.length - 1]
96
+ }
97
+
98
+ if (type) {
99
+ fileTypesIndex = fileTypes.indexOf(type);
100
+ console.log(fileTypesIndex)
101
+ }
102
+
103
+ if (fileTypesIndex != -1) {
104
+ fileType = fileTypes[fileTypesIndex]
105
+ }
106
+ // #ifdef H5
107
+ window.open(this.uniEnv.imgUrl + path)
108
+ return
109
+ // #endif
110
+ uni.downloadFile({
111
+ url: this.uniEnv.imgUrl + path, //下载地址接口返回
112
+ filePath: wx.env.USER_DATA_PATH + "/" + name,
113
+ success: (data) => {
114
+ console.log(data)
115
+ if (data.statusCode === 200) {
116
+ uni.openDocument({
117
+ filePath: data.filePath,
118
+ showMenu: true,
119
+ fileType: fileType,
120
+ success: function(res) {
121
+ // console.log('打开文档成功');
122
+ },
123
+ fail(res) {
124
+ console.log(res)
125
+ uni.showToast({
126
+ icon: 'none',
127
+ mask: true,
128
+ title: '下载失败',
129
+ duration: 3000,
130
+ });
131
+ },
132
+ });
133
+ }
134
+ },
135
+ })
136
+ // uni.downloadFile({
137
+ // url: this.downLoadUrl + path, //下载地址接口返回
138
+ // success: (data) => {
139
+ // if (data.statusCode === 200) {
140
+ // //文件保存到本地
141
+ // uni.saveFile({
142
+ // tempFilePath: data.tempFilePath, //临时路径
143
+ // success: function(res) {
144
+ // uni.showToast({
145
+ // icon: 'none',
146
+ // mask: true,
147
+ // title: '文件已保存:' + res.savedFilePath, //保存路径
148
+ // duration: 3000,
149
+ // });
150
+ // setTimeout(() => {
151
+ // // escape(res.savedFilePath)
152
+ // //打开文档查看
153
+ // uni.openDocument({
154
+ // filePath: res.savedFilePath,
155
+ // fileType: fileType,
156
+ // success: function(res) {
157
+ // // console.log('打开文档成功');
158
+ // },
159
+ // fail(res) {
160
+ // console.log(res)
161
+ // uni.showToast({
162
+ // icon: 'none',
163
+ // mask: true,
164
+ // title: '文件打开失败!', //保存路径
165
+ // duration: 3000,
166
+ // });
167
+ // },
168
+ // });
169
+ // }, 3000)
170
+ // }
171
+ // });
172
+ // }
173
+ // }
174
+ // })
175
+ },
176
+ chooseMessageFile: function(e) {
177
+ console.log(this.widget, )
178
+ if (this.disabled || (this.defaultFile.length && this.defaultFile.length >= this.widget.length)) return false;
179
+ var that = this;
180
+ wx.chooseMessageFile({
181
+ count: 1,
182
+ type: 'all',
183
+ success(res) {
184
+ console.log(res.tempFiles)
185
+ const path = res.tempFiles
186
+ that.name = res.tempFiles[0].name
187
+ const uploadTask = uni.uploadFile({
188
+ url: that.url,
189
+ filePath: path[0].path,
190
+ name: 'file',
191
+ formData: {},
192
+ success: function(res) {
193
+ let imgObj = {
194
+ key: String(Math.random()).substr(2) - 0,
195
+ name: that.name,
196
+ status: "success",
197
+ url: JSON.parse(res.data).message
198
+ }
199
+ that.$emit('filePost', imgObj)
200
+ }
201
+ });
202
+
203
+ uploadTask.onProgressUpdate(function(res) {
204
+ that.percent = res.progress;
205
+ if (Number(res.progress) == 100) {
206
+ that.show = false
207
+ }
208
+ });
209
+ },
210
+ error: function(e) {
211
+ console.log(e);
212
+ }
213
+ });
214
+ }
215
+ }
216
+ }
217
+ </script>
218
+
219
+ <style scoped lang="scss">
220
+ .file_conten {
221
+ // display: flex;
222
+ // flex-direction: row;
223
+ // align-items: center;
224
+ // justify-content: flex-start;
225
+ }
226
+
227
+ .file_upload {
228
+ color: #666;
229
+ margin-right: 20rpx;
230
+
231
+ }
232
+
233
+ .option-font-size {
234
+ font-size: $uni-form-content-font-size;
235
+ }
236
+
237
+ .name {
238
+ padding-top: 4upx;
239
+ font-size: 22upx;
240
+ }
241
+
242
+ .SXcolor {
243
+ color: #539DFA;
244
+ }
245
+
246
+ .tips {
247
+ color: #999;
248
+ font-size: 22upx;
249
+ }
250
+
251
+ .file_item {
252
+ width: 700upx;
253
+ display: flex;
254
+ justify-content: space-between;
255
+ align-items: center;
256
+ view{
257
+ margin-top: 10upx;
258
+ }
259
+ }
260
+ </style>