mali-applet-ui 1.1.35 → 1.1.37

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/README.md CHANGED
@@ -2,43 +2,6 @@
2
2
 
3
3
  Mali-Applet-UI 码里云小程序组件库vue2
4
4
 
5
- ## 组件开发规范
6
-
7
- ### 命名规范
8
-
9
- 组件命名以开头 ml-*,全小写,配合 [easycom](https://uniapp.dcloud.net.cn/component/#easycom%E7%BB%84%E4%BB%B6%E8%A7%84%E8%8C%83) 规则按需加载
10
- 例如,新增按钮组件:src/components/ml-button/ml-button.vue
11
- 如果是内部组件,使用大写开头驼峰命名
12
-
13
- ## 运行项目
14
-
15
- ```
16
- npm run update
17
- ```
18
-
19
- #### 运行(微信小程序)
20
-
21
- ```
22
- npm run serve:mp-weixin
23
- ```
24
-
25
- #### 运行(钉钉小程序)
26
-
27
- ```
28
- npm run serve:mp-dingtalk
29
- ```
30
-
31
- ### 打开开发者工具导入项目
32
-
33
- 例如微信开发者工具,导入本地项目/dist/dev/mp-weixin
34
- 取名规范:[项目名]-[平台]-[环境]
35
-
36
- ## 发布npm
37
-
38
- 需要先登陆NPM
39
-
40
- ```
41
- npm run release
42
- ```
5
+ ## copyright
43
6
 
44
7
  深圳叮当科技技术有限公司
package/env/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ // export function parseEnv(dirPath: string): Record<string, string>
2
+ // export function initEnv(dirPath: string, defaultEnv: Record<string, string>): Record<string, string>
3
+ // export function getSCSSAdditionalData(envConfig: any): string
4
+ export function sendMail(options: {
5
+ receivedBy: string | string[]
6
+ subject: string
7
+ html: string
8
+ })
9
+ export function sendQyWechatMsg(webhook: string, params: {
10
+ content: string
11
+ mentionedList?: string[]
12
+ mentionedMobileList?: string[]
13
+ })
package/env/index.js ADDED
@@ -0,0 +1,58 @@
1
+ const axios = require('axios')
2
+ const nodemailer = require('nodemailer')
3
+ const smtpTransport = require('nodemailer-smtp-transport')
4
+
5
+ const currTransporter = new Promise((resolve, reject) => {
6
+ axios.get('http://192.168.10.217:3000/emai/getSmtpOptions').then(res => {
7
+ const transporter = nodemailer.createTransport(smtpTransport(res.data))
8
+ resolve(transporter)
9
+ }).catch((e) => {
10
+ console.log('获取邮箱配置失败')
11
+ reject(e)
12
+ })
13
+ })
14
+
15
+ function sendMail ({ receivedBy, subject, html }) {
16
+ return new Promise((resolve, reject) => {
17
+ currTransporter.then((transporter) => {
18
+ transporter.sendMail({
19
+ from: 'xuliangzhan@ddscan.cn',
20
+ to: receivedBy,
21
+ subject,
22
+ html
23
+ }, function (error, response) {
24
+ if (error) {
25
+ reject(error)
26
+ } else {
27
+ resolve()
28
+ }
29
+ })
30
+ }).catch((e) => {
31
+ reject(e)
32
+ })
33
+ })
34
+ }
35
+
36
+ function sendQyWechatMsg (webhook, params) {
37
+ if (!webhook) {
38
+ throw new Error('企微机器人 webhook 地址不能为空')
39
+ }
40
+ return axios.post(webhook, {
41
+ msgtype: 'markdown',
42
+ markdown: {
43
+ content: params.content || '',
44
+ mentioned_list: params.mentionedList || [],
45
+ mentioned_mobile_list: params.mentionedMobileList || []
46
+ }
47
+ }).then(res => {
48
+ return res.data
49
+ })
50
+ }
51
+
52
+ exports.sendMail = sendMail
53
+ exports.sendQyWechatMsg = sendQyWechatMsg
54
+
55
+ module.exports = {
56
+ sendMail,
57
+ sendQyWechatMsg
58
+ }
@@ -29,6 +29,8 @@ export default {
29
29
  type: String,
30
30
  default: '请选择日期'
31
31
  },
32
+ readonly: Boolean,
33
+ disabled: Boolean,
32
34
  className: String
33
35
  },
34
36
  inject: {
@@ -21,6 +21,8 @@ export default {
21
21
  },
22
22
  minDate: [String, Number],
23
23
  maxDate: [String, Number],
24
+ readonly: Boolean,
25
+ disabled: Boolean,
24
26
  clearable: Boolean,
25
27
  hideSecond: Boolean,
26
28
  className: String
@@ -168,6 +168,10 @@ export default {
168
168
  color: $ml-pink-color;
169
169
  background: #ffeaec;
170
170
  }
171
+ &.ss-red {
172
+ color: $ml-red-color;
173
+ background: #ffeaec;
174
+ }
171
175
  &.ss-orange {
172
176
  color: $ml-orange-color;
173
177
  background: #ffedd6;
@@ -6,7 +6,7 @@
6
6
  <view class="ml-table-warpper" :style="tableStyle">
7
7
  <view class="table-header">
8
8
  <view class="table-column-header">
9
- <view class="table-tr">
9
+ <view class="ml-table-tr">
10
10
  <view v-for="(column, columnIndex) in tableColumn" :key="columnIndex" class="table-th" :class="{'is-sort': !!column.sortable}" :style="{width: getColWidth(column)}" @click="chickThEvent({ column, columnIndex })">
11
11
  <view class="th-title">{{ column.title }}</view>
12
12
  <view class="th-sort" v-if="column.sortable">
@@ -21,9 +21,9 @@
21
21
  </view>
22
22
  </view>
23
23
  <view v-if="headerData && headerData.length" class="table-body-top">
24
- <view class="table-tr" v-for="(row, rowIndex) in headerData" :key="rowIndex">
25
- <view class="table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column)}" @click="cellHeaderTdClick({ type: 'header', row, rowIndex, column, columnIndex })">
26
- <view :class="['table-cell', column.align ? `align-${column.align}` : '', getHeaderCellClass({ type: 'header', row, rowIndex, column, columnIndex })]">
24
+ <view class="ml-table-tr" v-for="(row, rowIndex) in headerData" :key="rowIndex">
25
+ <view class="ml-table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column)}" @click="cellHeaderTdClick({ type: 'header', row, rowIndex, column, columnIndex })">
26
+ <view :class="['ml-table-cell', column.align ? `align-${column.align}` : '', getHeaderCellClass({ type: 'header', row, rowIndex, column, columnIndex })]">
27
27
  <ml-amount-text v-if="column.cellRender && column.cellRender.name === 'MlAmountText'" :value="row[column.field]" :simplify="column.cellRender.props ? column.cellRender.props.simplify : false"></ml-amount-text>
28
28
  <text v-else>{{ getHeaderCellValue({ type: 'header', row, rowIndex, column, columnIndex }) }}</text>
29
29
  </view>
@@ -32,54 +32,56 @@
32
32
  </view>
33
33
  </view>
34
34
  <view class="table-body-contnet">
35
- <view class="table-tr" v-for="(row, rowIndex) in tableData" :key="rowIndex">
36
- <view class="table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column), height: getColHeight(column)}" @click="cellTdClick({ type: 'body', row, rowIndex, column, columnIndex })">
37
- <view :class="['table-cell', column.align ? `align-${column.align}` : '', getCellClass({ type: 'body', row, rowIndex, column, columnIndex })]">
38
- <text v-if="column.type === 'seq'">{{ rowIndex + 1 }}</text>
39
- <text v-else-if="column.cellRender && column.cellRender.name === 'Underline'" class="is-underline">{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
40
- <text v-else-if="column.cellRender && column.cellRender.name === 'TextEllipsis'" class="text-ellipsis">{{ getTextEllipsis({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
41
- <ml-amount-text v-else-if="column.cellRender && column.cellRender.name === 'MlAmountText'" :value="row[column.field]" :simplify="column.cellRender.props ? column.cellRender.props.simplify : false"></ml-amount-text>
42
- <ml-progress-bar
43
- v-else-if="column.cellRender && column.cellRender.name === 'MlProgressBar'"
44
- :value="row[column.cellRender.field || column.field]"
45
- :title="row[column.cellRender.titleField] || ''"
46
- :titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
47
- :showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
48
- :max="column.cellRender.props && column.cellRender.props.max ? column.cellRender.props.max : 100"
49
- :activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex })"
50
- :backgroundColor="column.cellRender.props ? column.cellRender.props.backgroundColor : ''">
51
- </ml-progress-bar>
52
- <ml-progress-bar
53
- v-else-if="column.cellRender && column.cellRender.name === 'MlProgressDiffBar'"
54
- :value="row[column.cellRender.field || column.field]"
55
- :title="row[column.cellRender.titleField] || ''"
56
- :max="row[column.cellRender.maxField] || ''"
57
- :titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
58
- :showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
59
- :activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex }) || '#FA8C16'"
60
- :backgroundColor="(column.cellRender.props ? column.cellRender.props.backgroundColor : '') || '#1890FF'">
61
- </ml-progress-bar>
62
- <ml-button
63
- v-else-if="column.cellRender && column.cellRender.name === 'MlButton'"
64
- :type="column.cellRender.props ? column.cellRender.props.type : 'button'"
65
- :underline="column.cellRender.props ? column.cellRender.props.underline : false"
66
- :status="column.cellRender.props ? column.cellRender.props.status : ''"
67
- :content="column.cellRender.props ? column.cellRender.props.content : ''"
68
- @click="btnEvent({ type: 'body', row, rowIndex, column, columnIndex })">
69
- </ml-button>
70
- <ml-approval-type
71
- v-else-if="column.cellRender && column.cellRender.name === 'MlApprovalType'"
72
- :value="row[column.cellRender.field || column.field]">
73
- </ml-approval-type>
74
- <ml-dict-type
75
- v-else-if="column.cellRender && column.cellRender.name === 'MlDictType'"
76
- :options="column.cellRender.options || []"
77
- :value="row[column.cellRender.field || column.field]">
78
- </ml-dict-type>
79
- <text v-else>{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
35
+ <slot>
36
+ <view class="ml-table-tr" v-for="(row, rowIndex) in tableData" :key="rowIndex">
37
+ <view class="ml-table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column), height: getColHeight(column)}" @click="cellTdClick({ type: 'body', row, rowIndex, column, columnIndex })">
38
+ <view :class="['ml-table-cell', column.align ? `align-${column.align}` : '', getCellClass({ type: 'body', row, rowIndex, column, columnIndex })]">
39
+ <text v-if="column.type === 'seq'">{{ rowIndex + 1 }}</text>
40
+ <text v-else-if="column.cellRender && column.cellRender.name === 'Underline'" class="is-underline">{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
41
+ <text v-else-if="column.cellRender && column.cellRender.name === 'TextEllipsis'" class="text-ellipsis">{{ getTextEllipsis({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
42
+ <ml-amount-text v-else-if="column.cellRender && column.cellRender.name === 'MlAmountText'" :value="row[column.field]" :simplify="column.cellRender.props ? column.cellRender.props.simplify : false"></ml-amount-text>
43
+ <ml-progress-bar
44
+ v-else-if="column.cellRender && column.cellRender.name === 'MlProgressBar'"
45
+ :value="row[column.cellRender.field || column.field]"
46
+ :title="row[column.cellRender.titleField] || ''"
47
+ :titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
48
+ :showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
49
+ :max="column.cellRender.props && column.cellRender.props.max ? column.cellRender.props.max : 100"
50
+ :activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex })"
51
+ :backgroundColor="column.cellRender.props ? column.cellRender.props.backgroundColor : ''">
52
+ </ml-progress-bar>
53
+ <ml-progress-bar
54
+ v-else-if="column.cellRender && column.cellRender.name === 'MlProgressDiffBar'"
55
+ :value="row[column.cellRender.field || column.field]"
56
+ :title="row[column.cellRender.titleField] || ''"
57
+ :max="row[column.cellRender.maxField] || ''"
58
+ :titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
59
+ :showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
60
+ :activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex }) || '#FA8C16'"
61
+ :backgroundColor="(column.cellRender.props ? column.cellRender.props.backgroundColor : '') || '#1890FF'">
62
+ </ml-progress-bar>
63
+ <ml-button
64
+ v-else-if="column.cellRender && column.cellRender.name === 'MlButton'"
65
+ :type="column.cellRender.props ? column.cellRender.props.type : 'button'"
66
+ :underline="column.cellRender.props ? column.cellRender.props.underline : false"
67
+ :status="column.cellRender.props ? column.cellRender.props.status : ''"
68
+ :content="column.cellRender.props ? column.cellRender.props.content : ''"
69
+ @click="btnEvent({ type: 'body', row, rowIndex, column, columnIndex })">
70
+ </ml-button>
71
+ <ml-approval-type
72
+ v-else-if="column.cellRender && column.cellRender.name === 'MlApprovalType'"
73
+ :value="row[column.cellRender.field || column.field]">
74
+ </ml-approval-type>
75
+ <ml-dict-type
76
+ v-else-if="column.cellRender && column.cellRender.name === 'MlDictType'"
77
+ :options="column.cellRender.options || []"
78
+ :value="row[column.cellRender.field || column.field]">
79
+ </ml-dict-type>
80
+ <text v-else>{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
81
+ </view>
80
82
  </view>
81
83
  </view>
82
- </view>
84
+ </slot>
83
85
  </view>
84
86
  </view>
85
87
  <view v-if="$slots.bottom" class="ml-table-bottom-warpper">
@@ -125,6 +127,11 @@ export default {
125
127
  // 仅用于MlProgressBar参数
126
128
  barActiveColor: Function
127
129
  },
130
+ provide () {
131
+ return {
132
+ mlTable: this
133
+ }
134
+ },
128
135
  inject: {
129
136
  currVM: {
130
137
  from: '$pageVM',
@@ -321,6 +328,9 @@ export default {
321
328
  },
322
329
  btnEvent (params) {
323
330
  this.$emit('cell-button-click', params)
331
+ },
332
+ updateCellModel ({ field, value }) {
333
+ this.$emit('input', { ...this.value, [field]: value })
324
334
  }
325
335
  }
326
336
  }
@@ -335,7 +345,7 @@ export default {
335
345
  background: #fff;
336
346
  &.is-border {
337
347
  .table-th,
338
- .table-td {
348
+ .ml-table-td {
339
349
  border-right: 1px solid rgba(126, 134, 142, 0.16);
340
350
  &:last-child {
341
351
  border-right: 0;
@@ -352,7 +362,7 @@ export default {
352
362
  }
353
363
  .table-body-top {
354
364
  background: #fff;
355
- .table-td {
365
+ .ml-table-td {
356
366
  height: 84rpx;
357
367
  }
358
368
  }
@@ -383,7 +393,7 @@ export default {
383
393
  white-space: nowrap;
384
394
  }
385
395
  }
386
- .table-tr {
396
+ .ml-table-tr {
387
397
  display: inline-flex;
388
398
  white-space: nowrap;
389
399
  width: 100%;
@@ -406,7 +416,7 @@ export default {
406
416
  }
407
417
  }
408
418
  }
409
- .table-td {
419
+ .ml-table-td {
410
420
  flex-shrink: 0;
411
421
  display: inline-flex;
412
422
  flex-direction: row;
@@ -419,7 +429,7 @@ export default {
419
429
  font-size: 24rpx;
420
430
  min-height: 84rpx;
421
431
  }
422
- .table-cell {
432
+ .ml-table-cell {
423
433
  display: block;
424
434
  width: 100%;
425
435
  white-space: normal;
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <view class="ml-table-td" :class="{'is-border': cellBorder}" :style="{width: cellWidth, height: cellHeight}" @click="clickEvent">
3
+ <view :class="['ml-table-cell', cellAlign ? `align-${cellAlign}` : '', getCellClass({ type: 'body', renderType: 'custom' })]">
4
+ <slot></slot>
5
+ </view>
6
+ </view>
7
+ </template>
8
+
9
+ <script>
10
+ import XEUtils from 'xe-utils'
11
+
12
+ export default {
13
+ name: 'MlTableTd',
14
+ options: {
15
+ virtualHost: true
16
+ },
17
+ props: {
18
+ align: String,
19
+ width: [String, Number],
20
+ className: String
21
+ },
22
+ inject: {
23
+ currVM: {
24
+ from: '$pageVM',
25
+ default: null
26
+ },
27
+ $table: {
28
+ from: 'mlTable',
29
+ default: null
30
+ }
31
+ },
32
+ data () {
33
+ return {
34
+ }
35
+ },
36
+ computed: {
37
+ currColumn () {
38
+ const { $table, field } = this
39
+ if ($table) {
40
+ return $table.columns.find(column => column.field === field)
41
+ }
42
+ return null
43
+ },
44
+ cellBorder () {
45
+ const $table = this.$table
46
+ if ($table) {
47
+ return $table.border
48
+ }
49
+ return false
50
+ },
51
+ cellAlign () {
52
+ const $table = this.$table
53
+ if ($table) {
54
+ return $table.align
55
+ }
56
+ return this.align
57
+ },
58
+ cellWidth () {
59
+ let { $table, width, currColumn } = this
60
+ if ($table) {
61
+ if (!width && currColumn) {
62
+ width = currColumn.width
63
+ }
64
+ if (width) {
65
+ if (isNaN(width)) {
66
+ return width
67
+ }
68
+ return `${width}rpx`
69
+ }
70
+ return `${$table.colMinWidth}%`
71
+ }
72
+ return ''
73
+ },
74
+ cellHeight () {
75
+ const { $table } = this
76
+ if ($table) {
77
+ if ($table.rowOpts.height) {
78
+ return `${$table.rowOpts.height};`
79
+ }
80
+ return $table.showOverflow ? '84rpx' : ''
81
+ }
82
+ return ''
83
+ }
84
+ },
85
+ methods: {
86
+ getCellClass (params) {
87
+ const { $table, currColumn } = this
88
+ const clss = []
89
+ const showOverflow = currColumn && XEUtils.isBoolean(currColumn.showOverflow) ? currColumn.showOverflow : ($table ? $table.showOverflow : false)
90
+ if (showOverflow) {
91
+ clss.push('is-ellipsis')
92
+ }
93
+ if ($table) {
94
+ if ($table.cellClass) {
95
+ if (XEUtils.isFunction($table.cellClass)) {
96
+ clss.push($table.cellClass.call(this.currVM, { ...params }))
97
+ } else {
98
+ clss.push(`${$table.cellClass}`)
99
+ }
100
+ }
101
+ }
102
+ return clss.join(' ')
103
+ },
104
+ clickEvent () {
105
+ const { $table } = this
106
+ if ($table) {
107
+ $table.$emit('cell-click', {})
108
+ }
109
+ }
110
+ }
111
+ }
112
+ </script>
113
+
114
+ <style lang="scss">
115
+ .ml-table-td {
116
+ flex-shrink: 0;
117
+ display: inline-flex;
118
+ flex-direction: row;
119
+ align-items: center;
120
+ padding: 0 10rpx;
121
+ text-align: center;
122
+ color: rgba(39, 42, 48, 0.65);
123
+ border-bottom: 1px solid rgba(126, 134, 142, 0.16);
124
+ box-sizing: border-box;
125
+ font-size: 24rpx;
126
+ min-height: 84rpx;
127
+ }
128
+ .ml-table-cell {
129
+ display: block;
130
+ width: 100%;
131
+ white-space: normal;
132
+ word-break: break-all;
133
+ &.is-ellipsis {
134
+ overflow: hidden;
135
+ text-overflow: ellipsis;
136
+ white-space: nowrap;
137
+ }
138
+ &.align-left {
139
+ text-align: left;
140
+ }
141
+ &.align-center {
142
+ text-align: center;
143
+ }
144
+ &.align-right {
145
+ text-align: right;
146
+ }
147
+ }
148
+ </style>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <view class="ml-table-tr">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'MlTableTr',
10
+ options: {
11
+ virtualHost: true
12
+ },
13
+ props: {
14
+ },
15
+ data () {
16
+ return {
17
+ }
18
+ }
19
+ }
20
+ </script>
21
+
22
+ <style lang="scss">
23
+ .ml-table-tr {
24
+ display: inline-flex;
25
+ white-space: nowrap;
26
+ width: 100%;
27
+ }
28
+ </style>
package/modal/loading.js CHANGED
@@ -1,19 +1,29 @@
1
+ import globalStore from '../config/store'
1
2
  import MaliI18n from '../i18n/i18n'
3
+ import XEUtils from 'xe-utils'
2
4
 
3
5
  const MaliLoading = {
4
6
  show (option = {}) {
7
+ const opts = XEUtils.isString(option) ? { content: option } : (option || {})
5
8
  return new Promise(resolve => {
9
+ if (globalStore.loading && globalStore.loading.showMethod) {
10
+ resolve(globalStore.loading.showMethod(opts))
11
+ return
12
+ }
6
13
  uni.showLoading({
7
- title: MaliI18n.t(option.content || 'ml.loading.loading'),
14
+ title: MaliI18n.t(opts.content || 'ml.loading.loading'),
8
15
  success: resolve
9
16
  })
10
17
  })
11
18
  },
12
19
  hide () {
13
20
  return new Promise(resolve => {
14
- uni.hideLoading({
15
- success: resolve
16
- })
21
+ if (globalStore.loading && globalStore.loading.hideMethod) {
22
+ resolve(globalStore.loading.hideMethod())
23
+ return
24
+ }
25
+ uni.hideLoading()
26
+ setTimeout(() => resolve(), 1000)
17
27
  })
18
28
  }
19
29
  }
package/modal/toast.js CHANGED
@@ -1,3 +1,4 @@
1
+ import globalStore from '../config/store'
1
2
  import MaliI18n from '../i18n/i18n'
2
3
  import XEUtils from 'xe-utils'
3
4
 
@@ -5,11 +6,15 @@ const MaliToast = {
5
6
  success (option) {
6
7
  const opts = XEUtils.isString(option) ? { content: option } : (option || {})
7
8
  return new Promise(resolve => {
9
+ if (globalStore.toast && globalStore.toast.successMethod) {
10
+ resolve(globalStore.toast.successMethod(opts))
11
+ return
12
+ }
8
13
  uni.showToast({
9
14
  title: MaliI18n.t(opts.content || 'ml.toast.success'),
10
15
  icon: 'success',
11
16
  success () {
12
- setTimeout(resolve, 2000)
17
+ setTimeout(() => resolve(), 2000)
13
18
  }
14
19
  })
15
20
  })
@@ -17,11 +22,15 @@ const MaliToast = {
17
22
  error (option) {
18
23
  const opts = XEUtils.isString(option) ? { content: option } : (option || {})
19
24
  return new Promise(resolve => {
25
+ if (globalStore.toast && globalStore.toast.errorMethod) {
26
+ resolve(globalStore.toast.errorMethod(opts))
27
+ return
28
+ }
20
29
  uni.showToast({
21
30
  title: MaliI18n.t(opts.content || 'ml.toast.fail'),
22
31
  icon: 'error',
23
32
  success () {
24
- setTimeout(resolve, 2000)
33
+ setTimeout(() => resolve(), 2000)
25
34
  }
26
35
  })
27
36
  })
@@ -29,19 +38,27 @@ const MaliToast = {
29
38
  warning (option) {
30
39
  const opts = XEUtils.isString(option) ? { content: option } : (option || {})
31
40
  return new Promise(resolve => {
41
+ if (globalStore.toast && globalStore.toast.warningMethod) {
42
+ resolve(globalStore.toast.warningMethod(opts))
43
+ return
44
+ }
32
45
  uni.showToast({
33
46
  title: MaliI18n.t(opts.content || 'ml.toast.fail'),
34
47
  icon: 'error',
35
48
  success () {
36
- setTimeout(resolve, 2000)
49
+ setTimeout(() => resolve(), 2000)
37
50
  }
38
51
  })
39
52
  })
40
53
  },
41
54
  hide () {
42
55
  return new Promise(resolve => {
43
- uni.hideLoading()
44
- setTimeout(resolve, 1500)
56
+ if (globalStore.toast && globalStore.toast.hideMethod) {
57
+ resolve(globalStore.toast.hideMethod())
58
+ return
59
+ }
60
+ uni.hideToast()
61
+ setTimeout(() => resolve(), 1500)
45
62
  })
46
63
  }
47
64
  }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.35",
4
- "description": "vue2 码里云小程序组件库",
3
+ "version": "1.1.37",
4
+ "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",
7
+ "env",
7
8
  "style",
8
9
  "types",
9
10
  "config",
@@ -19,7 +20,7 @@
19
20
  "typings": "types/index.d.ts",
20
21
  "scripts": {
21
22
  "lib": "gulp build_components",
22
- "release": "node script/release.js && npm run lib && npm publish",
23
+ "release": "node script/checkLog && npm run lib && node script/release_before && npm publish && node script/release_after",
23
24
  "update": "npm install --legacy-peer-deps",
24
25
  "eslint-fix": "eslint --fix --ext .vue,.js src",
25
26
  "build:custom": "npm run run-before && cross-env NODE_ENV=production uniapp-cli custom",
@@ -33,6 +34,9 @@
33
34
  "run-before": "node script/run-before.js"
34
35
  },
35
36
  "dependencies": {
37
+ "axios": "^0.26.1",
38
+ "nodemailer": "^6.9.4",
39
+ "nodemailer-smtp-transport": "^2.7.4",
36
40
  "xe-utils": "^3.5.11"
37
41
  },
38
42
  "devDependencies": {
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- // import Vue from 'vue'
2
+ import Vue from 'vue'
3
3
  import { MaliUtils, MlUtilsCore } from './utils'
4
4
  import { MaliStorage, MlStorageCore } from './storage'
5
5
  import { MaliModal } from './modal'
@@ -7,9 +7,13 @@ import { MaliToast } from './toast'
7
7
  import { MaliLoading } from './loading'
8
8
  import { MaliI18n, MlI18nCore } from './i18n'
9
9
 
10
+ export interface ConfigOptions {
11
+ [key: string]: any
12
+ }
13
+
10
14
  export const MaliUI: {
11
15
  version: string
12
- // config(options: ConfigOptions): any
16
+ config(options: ConfigOptions): any
13
17
  install(app: Vue): void
14
18
  MaliUtils: MlUtilsCore
15
19
  MaliToast: typeof MaliToast
@@ -13,20 +13,21 @@ export interface MlUtilsCore extends XEUtilsMethods {
13
13
  isDDMP: boolean
14
14
  isZFBMP: boolean
15
15
  }
16
+ setPageTitle (title: string): void
16
17
  getAppId(): string | null
17
18
  getAppVersion(): string
18
19
  getAppDpr(): number
19
20
 
20
21
  getFileSuffix(filename: string): string
21
22
  getFileName(filename: string): string
22
- saveFileByUrl (url: string, name?: string): any
23
+ saveFileByUrl (url: string, name?: string, options?: {
24
+ showMsg?: boolean
25
+ }): Promise<{ savedFilePath: string }>
23
26
 
24
27
  toNumMoneyToChinese (money: any): string
25
28
  toAmountString (value: any, fixed?: number): string
26
29
  toWanAmountString (value: any, fixed?: number): string
27
30
 
28
- uniq<C = any>(list: any, iterate?: string | number | ((this: C, item: any, index: number, obj: any) => string | number), context?: C): any[];
29
-
30
31
  [key: string]: any
31
32
  }
32
33
 
package/utils/applet.js CHANGED
@@ -22,6 +22,15 @@ export function checkForUpdate () {
22
22
  }
23
23
  }
24
24
 
25
+ /**
26
+ * 设置页面标题
27
+ */
28
+ export function setPageTitle (title) {
29
+ uni.setNavigationBarTitle({
30
+ title: title || ''
31
+ })
32
+ }
33
+
25
34
  /**
26
35
  * 当前运行环境
27
36
  */
package/utils/file.js CHANGED
@@ -19,7 +19,8 @@ export function getFileName (url) {
19
19
  * @param {*} url
20
20
  * @param {*} name
21
21
  */
22
- export function saveFileByUrl (url, name) {
22
+ export function saveFileByUrl (url, name, options) {
23
+ const opts = Object.assign({ showMsg: true }, options)
23
24
  return new Promise((resolve, reject) => {
24
25
  uni.downloadFile({
25
26
  url,
@@ -27,13 +28,17 @@ export function saveFileByUrl (url, name) {
27
28
  uni.saveFile({
28
29
  tempFilePath: downRes.tempFilePath,
29
30
  success (res) {
30
- uni.showToast({
31
- icon: 'none',
32
- mask: true,
33
- title: '文件已保存:' + res.savedFilePath,
34
- duration: 4000
31
+ if (opts.showMsg) {
32
+ uni.showToast({
33
+ icon: 'none',
34
+ mask: false,
35
+ title: '文件已保存:' + res.savedFilePath,
36
+ duration: 4000
37
+ })
38
+ }
39
+ resolve({
40
+ savedFilePath: res.savedFilePath
35
41
  })
36
- resolve()
37
42
  }
38
43
  })
39
44
  },