wl-design-mobile 0.0.9 → 0.1.1

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.
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <div class="info-btn-div">
3
+ <div class="info-btn-div" >
4
4
  <van-button :disabled="disabled" :icon="icon" :icon-position="position" :loading="loading"
5
5
  :type="'info'" :class="dynamicClass" size="normal" @click="handleClick"> {{ text }}
6
6
  <slot name="extend"></slot>
@@ -99,6 +99,13 @@ export default {
99
99
  border-radius: 3px;
100
100
  }
101
101
 
102
+ .info-btn-div {
103
+ display: flex;
104
+ justify-content: center;
105
+ align-items: center;
106
+ align-content: center;
107
+ }
108
+
102
109
  /* type[info] disable[true] plain[false] */
103
110
  /deep/ .info-btn-div .van-button--info {
104
111
  background-color: transparent;
@@ -32,7 +32,7 @@ export default {
32
32
  display: flex;
33
33
  padding: 0 14px;
34
34
  background-color: var(--scl-white-1);
35
- border-bottom: 1px solid rgba(229, 229, 229, 1.5);
35
+ border-bottom: 1px solid var(--scl-white-2);
36
36
  }
37
37
 
38
38
  .button-group /deep/ .btn-sel {
@@ -32,6 +32,7 @@ export default {
32
32
  align-items: center;
33
33
  justify-content: center;
34
34
  }
35
+
35
36
  .line-div {
36
37
  height: 12px;
37
38
  width: 1px;
@@ -1,12 +1,20 @@
1
1
  <template>
2
- <van-button :icon="loadIcon" class="btn-icon" :loading="loading" :disabled="disabled" @click="handleClick"></van-button>
2
+ <div>
3
+ <div class="icon-btn-div">
4
+ <van-button :icon="loadIcon" :class="dynamicClass" :loading="loading" :disabled="disabled"
5
+ @click="handleClick"></van-button>
6
+ </div>
7
+ </div>
3
8
  </template>
4
9
  <script>
5
10
 
6
11
  export default {
7
12
  name: "LamboIconBtn",
8
13
  props: {
9
- icon: String,
14
+ icon: {
15
+ type: String,
16
+ required: true
17
+ },
10
18
  loading: {
11
19
  type: Boolean,
12
20
  default: false
@@ -15,9 +23,15 @@ export default {
15
23
  type: Boolean,
16
24
  default: false
17
25
  },
26
+ border: {
27
+ type: Boolean,
28
+ default: true
29
+ }
18
30
  },
19
31
  data() {
20
- return {}
32
+ return {
33
+
34
+ }
21
35
  },
22
36
  methods: {
23
37
  handleClick(event) {
@@ -26,9 +40,18 @@ export default {
26
40
  },
27
41
  computed: {
28
42
  loadIcon() {
29
- // vite的写法,而且需要用相对路径
30
- // return new URL('../../../assets/icon/' + this.icon, import.meta.url).href
31
43
  return require('../assets/icon/' + this.icon)
44
+ },
45
+ dynamicClass() {
46
+ if (this.border === true) {
47
+ return {
48
+ "btn-icon-border": true
49
+ }
50
+ } else {
51
+ return {
52
+ "btn-icon-border0": true
53
+ }
54
+ }
32
55
  }
33
56
  }
34
57
  }
@@ -36,7 +59,7 @@ export default {
36
59
  <style scoped>
37
60
  @import "../styles/index.less";
38
61
 
39
- .btn-icon {
62
+ .btn-icon-border {
40
63
  border: 1px solid #e5e5e5;
41
64
  width: 40px;
42
65
  height: 30px;
@@ -44,7 +67,16 @@ export default {
44
67
  font-size: 12px;
45
68
  border-radius: 3px;
46
69
  }
47
- /deep/ .van-icon__image {
70
+
71
+ .btn-icon-border0 {
72
+ border: none;
73
+ width: 40px;
74
+ height: 30px;
75
+ background-color: transparent;
76
+ font-size: 12px;
77
+ }
78
+
79
+ /deep/ .icon-btn-div .van-icon__image {
48
80
  width: 1em;
49
81
  }
50
82
  </style>
@@ -8,8 +8,14 @@
8
8
  {{ title }}
9
9
  </div>
10
10
  </div>
11
+ <div slot="value" class="coll-title-icon">
12
+ <slot name="right-value">
13
+ </slot>
14
+ </div>
11
15
  <div slot="right-icon" class="coll-title-icon">
12
- <van-icon :color="'#0070D2'" class="van-icon van-cell__right-icon" name="play" />
16
+ <slot name="right-icon">
17
+ <van-icon :color="'#0070D2'" class="van-icon van-cell__right-icon" name="play" />
18
+ </slot>
13
19
  </div>
14
20
  <slot></slot>
15
21
  </van-collapse-item>
@@ -65,7 +71,7 @@ export default {
65
71
 
66
72
  /* 覆盖折叠面板的标题的padding */
67
73
  /deep/ .van-cell {
68
- padding: 12px 10px;
74
+ padding: 10px 14px 10px 10px;
69
75
  }
70
76
 
71
77
  /* 覆盖去掉折叠面板的标题下面的线 */
@@ -73,6 +79,13 @@ export default {
73
79
  border: none;
74
80
  }
75
81
 
82
+ /deep/ .van-cell__title {
83
+ display: flex;
84
+ justify-content: flex-start;
85
+ align-items: center;
86
+ align-content: center;
87
+ }
88
+
76
89
  /* 覆盖折叠面板的内容的padding */
77
90
  /deep/ .van-collapse-item__content {
78
91
  padding: 0px 0px 0px 0px;
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div>
3
+ <div v-for="(item, index) in data" :key="index">
4
+ <lambo-file-row v-if="item && item.fileId" :file-id="item.fileId" :file-name="item.fileName" :if-delete="ifDelete"
5
+ @on-delete="handleDelete($event, index)"></lambo-file-row>
6
+ </div>
7
+ </div>
8
+ </template>
9
+ <script>
10
+ import LamboFileRow from "../../../doc/file/compoents/lambo-file-row.vue";
11
+
12
+ export default {
13
+ name: 'LamboFileList',
14
+ components: {LamboFileRow},
15
+ props: {
16
+ data: {
17
+ type: Array,
18
+ default: () => []
19
+ },
20
+ ifDelete: {
21
+ type: Boolean,
22
+ default: false
23
+ }
24
+ },
25
+ data() {
26
+ return {
27
+
28
+ }
29
+ },
30
+ methods: {
31
+ handleDelete(item, index) {
32
+ console.log("lambo-file-list item:", item)
33
+ console.log("lambo-file-list index:", index)
34
+ this.data.splice(index, 1)
35
+ this.$emit("on-delete", {...item, index: index});
36
+ }
37
+ }
38
+ }
39
+ </script>
40
+ <style scoped>
41
+
42
+ </style>
@@ -0,0 +1,164 @@
1
+ <template>
2
+ <div class="file-container">
3
+ <div class="title-div">
4
+ <img :src="loadIcon" class="file-type-icon"/>
5
+ <p class="file-name">{{ fileName }}</p>
6
+ </div>
7
+ <div class="btn-div" v-if="ifDelete">
8
+ <van-icon name="cross" @click="deleteDoc"/>
9
+ </div>
10
+ </div>
11
+ </template>
12
+ <script>
13
+ import excelIcon from "../../../assets/img/doc/excel.png";
14
+ import mp3Icon from "../../../assets/img/doc/mp3.png";
15
+ import otherIcon from "../../../assets/img/doc/other.png";
16
+ import pdfIcon from "../../../assets/img/doc/pdf.png";
17
+ import pptIcon from "../../../assets/img/doc/ppt.png";
18
+ import txtIcon from "../../../assets/img/doc/txt.png";
19
+ import videoIcon from "../../../assets/img/doc/video.png";
20
+ import wordIcon from "../../../assets/img/doc/word.png";
21
+ import zipIcon from "../../../assets/img/doc/zip.png";
22
+ import photoIcon from "../../../assets/img/doc/photo.png";
23
+
24
+ export default {
25
+ name: 'LamboFileRow',
26
+ components: {},
27
+ props: {
28
+ fileId: {
29
+ type: String,
30
+ required: true
31
+ },
32
+ fileName: {
33
+ type: String,
34
+ default: ''
35
+ },
36
+ ifDelete: {
37
+ type: Boolean,
38
+ default: false
39
+ }
40
+ },
41
+ data() {
42
+ return {
43
+
44
+ }
45
+ },
46
+ computed: {
47
+ loadIcon() {
48
+ return this.getFileIcon(this.fileName)
49
+ }
50
+ },
51
+ methods: {
52
+ deleteDoc() {
53
+ this.$emit("on-delete", {fileId: this.fileId, fileName: this.fileName});
54
+ },
55
+ getFileIcon(fileName) {
56
+ let suffix = ''
57
+ let splitArr = fileName.split('.')
58
+ if(splitArr && splitArr.length > 0){
59
+ suffix = splitArr[splitArr.length - 1]
60
+ }
61
+
62
+ let icon = otherIcon
63
+ switch (suffix) {
64
+ case 'mp4':
65
+ case 'm3u8':
66
+ case 'rmvb':
67
+ case 'avi':
68
+ case 'swf':
69
+ case '3gp':
70
+ case 'mkv':
71
+ case 'flv':
72
+ icon = videoIcon;
73
+ break;
74
+ case 'mp3':
75
+ case 'wav':
76
+ case 'wma':
77
+ case 'ogg':
78
+ case 'aac':
79
+ case 'flac':
80
+ icon = mp3Icon;
81
+ break;
82
+ case 'doc':
83
+ case 'pages':
84
+ case 'epub':
85
+ case 'docx':
86
+ icon = wordIcon;
87
+ break;
88
+ case 'pdf':
89
+ icon = pdfIcon;
90
+ break;
91
+ case 'txt':
92
+ icon = txtIcon;
93
+ break;
94
+ case 'numbers':
95
+ case 'csv':
96
+ case 'xls':
97
+ case 'xlsx':
98
+ icon = excelIcon;
99
+ break;
100
+ case 'keynote':
101
+ case 'ppt':
102
+ case 'pptx':
103
+ icon = pptIcon;
104
+ break;
105
+ case 'zip':
106
+ icon = zipIcon;
107
+ break;
108
+ case 'jpg':
109
+ case 'jpeg':
110
+ case 'png':
111
+ case 'gif':
112
+ case 'bmp':
113
+ case 'tiff':
114
+ case 'tif':
115
+ case 'psd':
116
+ case 'webp':
117
+ case 'svg':
118
+ case 'raw':
119
+ icon = photoIcon;
120
+ break;
121
+ default:
122
+ icon = otherIcon;
123
+ break;
124
+ }
125
+ return icon;
126
+ },
127
+ }
128
+ }
129
+ </script>
130
+ <style scoped>
131
+ .file-container {
132
+ margin: 0px 14px 5px 14px;
133
+ background-color: var(--scl-white-7);
134
+ height: 38px;
135
+ display: flex;
136
+ justify-content: space-between;
137
+ padding: 0px 10px;
138
+ border-radius: 3px;
139
+ }
140
+
141
+ .title-div {
142
+ display: flex;
143
+ flex-direction: row;
144
+ align-content: center;
145
+ align-items: center;
146
+ }
147
+
148
+ .btn-div {
149
+ display: flex;
150
+ flex-direction: row;
151
+ align-content: center;
152
+ align-items: center;
153
+ }
154
+
155
+ .file-type-icon {
156
+ width: 17px;
157
+ height: 20px;
158
+ margin-right: 5px;
159
+ }
160
+
161
+ .file-name {
162
+ font-size: 14px;
163
+ }
164
+ </style>
@@ -0,0 +1,106 @@
1
+ <template>
2
+ <div>
3
+ <lambo-collapse :title="title">
4
+ <template #right-icon>
5
+ <van-uploader v-model="fileArr" :show-upload="false" :preview-image="false" accept="*" :after-read="afterRead"
6
+ @click-upload.stop="handleStopUploaderClick">
7
+ <lambo-icon-btn :icon="'upload.png'" :border="false"></lambo-icon-btn>
8
+ </van-uploader>
9
+ </template>
10
+ <lambo-file-list :if-delete="ifDelete" :data.sync="data" @on-delete="handleDelete($event)"></lambo-file-list>
11
+ </lambo-collapse>
12
+ </div>
13
+ </template>
14
+ <script>
15
+ import LamboCollapse from "../../collapse/lambo-collapse.vue";
16
+ import LamboBtn from "../../btn/lambo-btn.vue";
17
+ import LamboIconBtn from "../../btn/lambo-icon-btn.vue";
18
+ import {axios} from "../../util/axios";
19
+ import {fileUploadUrl} from "../../api/doc";
20
+ import {Toast} from "vant";
21
+ import LamboFileList from "../../doc/file/compoents/lambo-file-list.vue";
22
+
23
+ export default {
24
+ name: "LamboFileUploadCollapse",
25
+ components: {LamboFileList, LamboIconBtn, LamboBtn, LamboCollapse},
26
+ props: {
27
+ title: {
28
+ type: String,
29
+ default: "文件上传"
30
+ },
31
+ data: {
32
+ type: Array,
33
+ default: () => []
34
+ },
35
+ ifDelete: {
36
+ type: Boolean,
37
+ default: false
38
+ },
39
+ },
40
+ data() {
41
+ return {
42
+ fileArr: []
43
+ }
44
+ },
45
+ methods: {
46
+ handleStopUploaderClick() {
47
+ console.log('handleStopUploaderClick click stop!');
48
+ },
49
+ afterRead(fileObj, detail) {
50
+ console.log(fileObj, detail)
51
+ let file = fileObj.file;
52
+
53
+ /* //测试使用代码
54
+ let item = {
55
+ fileId: "123",
56
+ fileName: file.name,
57
+ fileSuffix: ""
58
+ }
59
+ this.data.push(item)
60
+ Toast.success('上传文件成功');
61
+ this.$emit("on-success", this.fileList)*/
62
+
63
+ let formData = new FormData();
64
+ formData.append('file', file);
65
+ axios.post(fileUploadUrl, formData, {}).then(res => {
66
+ console.log("上传路径:" + fileUploadUrl + ",上传结果:" + res)
67
+ if (res && res.code == "1") {
68
+ let fileData = res.data;
69
+ if (fileData && fileData.length > 0) {
70
+ let resFile = fileData[0]
71
+ if (resFile && resFile.fileId) {
72
+ let item = {
73
+ fileId: resFile.fileId,
74
+ fileName: resFile.fileName || file.name,
75
+ }
76
+ this.data.push(item)
77
+ Toast.success(file.name + '上传成功');
78
+ this.$emit("on-success", this.data)
79
+ } else {
80
+ Toast.fail("文件"+ file.name + "为空,上传失败")
81
+ this.$emit("on-failed", null);
82
+ }
83
+ } else {
84
+ Toast.fail("文件"+ file.name + "为空,上传失败")
85
+ this.$emit("on-failed", null);
86
+ }
87
+ } else {
88
+ Toast.fail("文件"+ file.name + "上传失败,请联系管理员")
89
+ this.$emit("on-failed", null);
90
+ }
91
+ }).catch((e) => {
92
+ Toast.fail("文件"+ file.name + "上传异常!");
93
+ console.error("文件上传异常:", e)
94
+ })
95
+ },
96
+ handleDelete(obj) {
97
+ console.log("lambo-file-upload-collapse fileId:", obj.fileId)
98
+ console.log("lambo-file-upload-collapse fileName:", obj.fileName)
99
+ console.log("lambo-file-upload-collapse index:", obj.index)
100
+ this.$emit("on-delete", obj);
101
+ }
102
+ }
103
+ }
104
+ </script>
105
+ <style scoped>
106
+ </style>
@@ -1,118 +0,0 @@
1
- .fileUplodaContainer {
2
- padding: 12px 14px;
3
- background: var(--scl-white-1);
4
- }
5
-
6
- .fileUplodaTitle {
7
- margin-bottom: 10px;
8
- display: flex;
9
- justify-content: space-between;
10
- }
11
-
12
- .fileUplodaTitle p {
13
- width: 100%;
14
- color: var(--scl-gray-3);
15
- font-size: 14px;
16
- position: absolute;
17
- top: -2px;
18
- }
19
-
20
- .fileUplodaTitle img {
21
- width: 20px;
22
- height: 20px;
23
- display: block;
24
- }
25
-
26
- /*右上角上传按钮样式*/
27
- /deep/ .van-button--primary {
28
- background: none;
29
- border: none;
30
- height: auto;
31
- }
32
-
33
- /*右上角上传按钮位置*/
34
- /deep/ .van-uploader__input-wrapper, .van-uploader {
35
- width: 100%;
36
- position: static;
37
- }
38
-
39
- /*上传按钮首次进页面控制图标大小*/
40
- /deep/ .van-icon__image {
41
- width: 1em;
42
- }
43
-
44
- /*图片上传区域占位及右上角上传按钮占位*/
45
- /deep/ .setUploader {
46
- position: relative;
47
- margin-bottom: 10px;
48
- }
49
-
50
- /*右上角上传按钮位置*/
51
- /deep/ .van-button--normal {
52
- width: 20px;
53
- position: absolute;
54
- top: -1px;
55
- right: -8px;
56
- }
57
-
58
- /*文件列表整体位置*/
59
- /deep/ .van-uploader__wrapper {
60
- margin-top: 20px;
61
- }
62
-
63
- /*文件预览框样式*/
64
- /deep/ .van-uploader__file {
65
- width: 101%;
66
- height: 38px;
67
- background-color: #F2F2F2;
68
- display: flex;
69
- flex-wrap: wrap;
70
- border-radius: 5px;
71
- align-items: stretch;
72
- align-content: space-around;
73
- flex-direction: row;
74
- }
75
-
76
- /*文件名样式*/
77
- /deep/ .van-uploader__file-name {
78
- width: 92%;
79
- margin-top: 1px;
80
- text-align: left;
81
- font-size: 14px;
82
- }
83
-
84
- /*文件类型icon样式*/
85
- /deep/ .van-uploader__file-icon {
86
- width: 17px;
87
- height: 20px;
88
- }
89
-
90
- /*控制多文件换行样式*/
91
- /deep/ .van-uploader__preview {
92
- width: 100%;
93
- margin: 0 0 10px 0;
94
- }
95
-
96
- /*覆盖旧删除按钮样式*/
97
- /deep/ .van-uploader__preview-delete {
98
- width: 38px;
99
- height: 38px;
100
- border-radius: 50%;
101
- background-color: rgba(0, 0, 0, 0)
102
- }
103
-
104
- /*新删除按钮图标样式*/
105
- /deep/ .van-uploader__preview-delete-icon {
106
- top: 6px;
107
- right: 4px;
108
- color: var(--scl-gray-2);
109
- font-size: 28px;
110
- }
111
-
112
- /*控制上传功能覆盖区域*/
113
- /deep/ .van-uploader__input {
114
- height: 25px;
115
- width: 25px;
116
- position: absolute;
117
- left: 95%;
118
- }
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <div>
3
+ <div class="img-grid-container">
4
+ <van-grid :border="false" :column-num="5" :gutter="0">
5
+ <van-grid-item v-for="(item, index) in data" :key="index" @click="imgMore(item)">
6
+ <div class="img-cell-div">
7
+ <van-image :src="item.src"/>
8
+ <span v-if="ifDelete" class="remove-x" @click.stop="deleteImg(item, index)">×</span>
9
+ </div>
10
+ </van-grid-item>
11
+ </van-grid>
12
+ </div>
13
+ </div>
14
+
15
+ </template>
16
+ <script>
17
+ import {ImagePreview, Toast} from 'vant';
18
+
19
+ export default {
20
+ components: {
21
+
22
+ },
23
+ props: {
24
+ data: {
25
+ type: Array,
26
+ default: () => []
27
+ },
28
+ ifDelete: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ width: {
33
+ type: String,
34
+ default: "10rem"
35
+ },
36
+ height: {
37
+ type: String,
38
+ default: "10rem"
39
+ }
40
+ },
41
+ data() {
42
+ return {}
43
+ },
44
+ methods: {
45
+ deleteImg(item, index) {
46
+ console.log("lambo-img-grid deleteImg item:", item)
47
+ console.log("lambo-img-grid deleteImg index:", index)
48
+ this.data.splice(index, 1)
49
+ this.$emit("on-delete", {...item, index: index});
50
+ },
51
+ imgMore(item) {
52
+ console.log("imgMore:", item)
53
+ if (item && item.src) {
54
+ ImagePreview([
55
+ item.src
56
+ ])
57
+ } else {
58
+ Toast.fail("图片资源无效,无法预览")
59
+ }
60
+ }
61
+ }
62
+ }
63
+ </script>
64
+ <style scoped>
65
+ .img-grid-container {
66
+ margin: 0px 14px 10px 14px;
67
+ }
68
+
69
+ /deep/ .img-grid-container .van-grid-item__content {
70
+ padding: 0px 5px 5px 0px;
71
+ }
72
+
73
+ .img-cell-div {
74
+ width: 68px;
75
+ height: 68px;
76
+ position: relative;
77
+ display: inline-block;
78
+ border-radius: 3px;
79
+ }
80
+
81
+ .remove-x {
82
+ position: absolute;
83
+ top: -2px; /* 图标距离顶部的距离 */
84
+ right: -2px; /* 图标距离右侧的距离 */
85
+ background: rgb(204, 204, 204, 0.5); /* 半透明背景色 */
86
+ color: white;
87
+ border: none;
88
+ border-radius: 50%; /* 圆形图标 */
89
+ width: 16px; /* 图标宽度 */
90
+ height: 16px; /* 图标高度 */
91
+ text-align: center;
92
+ line-height: 16px; /* 垂直居中 */
93
+ cursor: pointer;
94
+ font-size: 12px; /* 图标大小 */
95
+ z-index: 50; /* 确保图标在图片之上 */
96
+ }
97
+
98
+ .remove-x:hover {
99
+ background: rgb(204, 204, 204, 1); /* 半透明背景色 */
100
+ }
101
+ </style>