@jx3box/jx3box-common-ui 5.7.4 → 5.7.7

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.
@@ -251,7 +251,7 @@ body {
251
251
  }
252
252
  .mt(0px) !important;
253
253
  }
254
- @media screen and (max-width: @ipad) {
254
+ @media screen and (max-width: @mininote) {
255
255
  .c-header-nav {
256
256
  display: none;
257
257
  }
@@ -794,4 +794,4 @@ body {
794
794
  top: @header-height;
795
795
  left: 0;
796
796
  position: absolute;
797
- }
797
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "5.7.4",
3
+ "version": "5.7.7",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,44 +9,54 @@
9
9
  <div v-else class="u-upload el-upload el-upload--picture-card" @click="select">
10
10
  <i class="el-icon-plus"></i>
11
11
  </div>
12
- <input class="u-upload-input" type="file" @change="upload" ref="uploadInput" accept=".jpg, .jpeg, .png, .gif, .bmp" />
12
+ <input
13
+ class="u-upload-input"
14
+ type="file"
15
+ @change="upload"
16
+ ref="uploadInput"
17
+ accept=".jpg, .jpeg, .png, .gif, .bmp,.webp"
18
+ />
13
19
  </div>
14
20
  </template>
15
21
 
16
22
  <script>
17
23
  import { getThumbnail } from "@jx3box/jx3box-common/js/utils";
18
- import { uploadImage } from '../../service/cms.js';
24
+ import { uploadImage } from "../../service/cms.js";
19
25
  export default {
20
- name: 'upload-banner',
26
+ name: "upload-banner",
21
27
  props: {
22
28
  content: {
23
29
  type: String,
24
- default: '',
30
+ default: "",
25
31
  },
26
32
  info: {
27
33
  type: String,
28
- default: '用于展示tips',
34
+ default: "用于展示tips",
29
35
  },
30
36
  size: {
31
37
  type: [Array, Number],
32
38
  default: 148,
33
- }
39
+ },
40
+ maxSize: {
41
+ type: Number,
42
+ default: 10,
43
+ },
34
44
  },
35
45
  data() {
36
46
  return {
37
- data: this.content || '',
47
+ data: this.content || "",
38
48
  };
39
49
  },
40
50
  model: {
41
- prop: 'content',
42
- event: 'input',
51
+ prop: "content",
52
+ event: "input",
43
53
  },
44
54
  watch: {
45
55
  content(val) {
46
56
  this.data = val;
47
57
  },
48
58
  data(val) {
49
- this.$emit('input', val);
59
+ this.$emit("input", val);
50
60
  },
51
61
  },
52
62
  computed: {
@@ -60,25 +70,31 @@ export default {
60
70
  uploadStyle() {
61
71
  let size = Array.isArray(this.size) ? this.size : [this.size, this.size];
62
72
  return {
63
- width: size[0] + 'px',
64
- height: size[1] + 'px',
73
+ width: size[0] + "px",
74
+ height: size[1] + "px",
65
75
  };
66
76
  },
67
77
  },
68
78
  methods: {
69
79
  select() {
70
- this.fileInput.dispatchEvent(new MouseEvent('click', {
71
- bubbles: true,
72
- cancelable: true,
73
- view: window,
74
- }));
80
+ this.fileInput.dispatchEvent(
81
+ new MouseEvent("click", {
82
+ bubbles: true,
83
+ cancelable: true,
84
+ view: window,
85
+ })
86
+ );
75
87
  },
76
88
  upload() {
77
89
  const file = this.fileInput.files[0];
78
90
  if (!file) return;
91
+ if (file.size > this.maxSize * 1024 * 1024) {
92
+ this.$message.error("图片大小不能超过" + this.maxSize + "M");
93
+ return;
94
+ }
79
95
  const formData = new FormData();
80
- formData.append('avatar', file);
81
- uploadImage(formData).then(res => {
96
+ formData.append("avatar", file);
97
+ uploadImage(formData).then((res) => {
82
98
  this.data = res.data.data[0];
83
99
  this.$message({
84
100
  message: "上传成功",
@@ -87,16 +103,16 @@ export default {
87
103
  });
88
104
  },
89
105
  remove() {
90
- this.data = '';
106
+ this.data = "";
91
107
  },
92
- }
93
- }
108
+ },
109
+ };
94
110
  </script>
95
111
 
96
112
  <style lang="less">
97
113
  .c-upload-banner {
98
- .u-tip{
99
- padding:5px 15px;
114
+ .u-tip {
115
+ padding: 5px 15px;
100
116
  }
101
117
  .u-upload {
102
118
  .pr;