mali-applet-ui 1.1.35 → 1.1.36

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,8 @@
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
+ })
package/env/index.js ADDED
@@ -0,0 +1,40 @@
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
+ exports.sendMail = sendMail
37
+
38
+ module.exports = {
39
+ sendMail
40
+ }
@@ -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;
@@ -125,6 +125,11 @@ export default {
125
125
  // 仅用于MlProgressBar参数
126
126
  barActiveColor: Function
127
127
  },
128
+ provide () {
129
+ return {
130
+ mlTable: this
131
+ }
132
+ },
128
133
  inject: {
129
134
  currVM: {
130
135
  from: '$pageVM',
@@ -321,6 +326,9 @@ export default {
321
326
  },
322
327
  btnEvent (params) {
323
328
  this.$emit('cell-button-click', params)
329
+ },
330
+ updateCellModel ({ field, value }) {
331
+ this.$emit('input', { ...this.value, [field]: value })
324
332
  }
325
333
  }
326
334
  }
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <view class="table-td" :style="{width: cellWidth, height: cellHeight}" @click="clickEvent">
3
+ <view :class="['table-cell', cellAlign ? `align-${cellAlign}` : '']">
4
+ <slot></slot>
5
+ </view>
6
+ </view>
7
+ </template>
8
+
9
+ <script>
10
+
11
+ export default {
12
+ name: 'MlTableTd',
13
+ props: {
14
+ align: String,
15
+ width: [String, Number],
16
+ className: String
17
+ },
18
+ inject: {
19
+ currVM: {
20
+ from: '$pageVM',
21
+ default: null
22
+ },
23
+ $table: {
24
+ from: 'mlTable',
25
+ default: null
26
+ }
27
+ },
28
+ data () {
29
+ return {
30
+ }
31
+ },
32
+ computed: {
33
+ cellAlign () {
34
+ const $table = this.$table
35
+ if ($table) {
36
+ return $table.align
37
+ }
38
+ return this.align
39
+ },
40
+ cellWidth () {
41
+ const { $table, width } = this
42
+ if ($table) {
43
+ if (width) {
44
+ if (isNaN(width)) {
45
+ return width
46
+ }
47
+ return `${width}rpx`
48
+ }
49
+ return `${$table.colMinWidth}%`
50
+ }
51
+ return ''
52
+ },
53
+ cellHeight () {
54
+ const { $table } = this
55
+ if ($table) {
56
+ if ($table.rowOpts.height) {
57
+ return `${$table.rowOpts.height};`
58
+ }
59
+ return $table.showOverflow ? '84rpx' : ''
60
+ }
61
+ return ''
62
+ }
63
+ },
64
+ methods: {
65
+ clickEvent () {
66
+ const { $table } = this
67
+ if ($table) {
68
+ $table.$emit('cell-click', {})
69
+ }
70
+ }
71
+ }
72
+ }
73
+ </script>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <view class="table-tr">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'MlTableTr',
10
+ props: {
11
+ },
12
+ data () {
13
+ return {
14
+ }
15
+ }
16
+ }
17
+ </script>
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.36",
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
  },