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.
@@ -0,0 +1,171 @@
1
+ <template>
2
+ <div class="container">
3
+ <div class="table-head">
4
+ <div class="table-cell" :style="{'--width': item.width + 'px' || 'auto'}" v-for="(item,index) in columns" :key="index" >{{ item.title }}</div>
5
+ </div>
6
+ <van-list
7
+ ref="vanList1"
8
+ v-model="loading"
9
+ :finished="finished"
10
+ finished-text="没有更多了"
11
+ @load="onLoad"
12
+ offset="10"
13
+ >
14
+ <div class="table-row" v-for="(item,index) in list" :key="index">
15
+ <template v-for="column in columns">
16
+ <div v-if="column.type === 'index'" v-bind:key="column.key" class="table-cell table-cell-list" :style="{'--width': column.width + 'px' || 'auto'}">{{index + 1}}</div>
17
+ <div v-else class="table-cell table-cell-list" v-bind:key="column.key" :style="{'--width': column.width + 'px' || 'auto'}">{{item[column.key]}} </div>
18
+ </template>
19
+ </div>
20
+ </van-list>
21
+ </div>
22
+ </template>
23
+ <script>
24
+ import {axios} from "../util/axios/index"
25
+ import {Toast} from "vant"
26
+
27
+ export default {
28
+ name: "LamboTableList",
29
+ components: {},
30
+ props: {
31
+ heightRatio: {
32
+ type: Number,
33
+ default: 0.5,
34
+ },
35
+ url: {
36
+ type: String
37
+ },
38
+ searchParams: {
39
+ type: Object
40
+ },
41
+ columns: {
42
+ type: Array,
43
+ default: () => []
44
+ }
45
+ },
46
+ data() {
47
+ return {
48
+ loading: false,
49
+ finished: true,
50
+ finishedTxt: "",
51
+ pageNum: 1, // 当前页数
52
+ pageSize: 10, // 每页数据条数
53
+ listHeight: '100vh', // 默认列表高度为视口高度的80%
54
+ refreshing: false,
55
+ offset: 0,
56
+ limit: 10,
57
+ list: [],
58
+ };
59
+ },
60
+ mounted() {
61
+ this.getListHeight();
62
+ },
63
+ watch: {
64
+ searchParams: {
65
+ handler: function (val, oldVal) {
66
+ console.log("searchParams -- val,oldVal:", {val, oldVal})
67
+ console.log("searchParams -- val===oldVal:", val === oldVal)
68
+ //查询时重置页码
69
+ this.pageNum = 1
70
+ this.offset = 0
71
+ this.limit = 10
72
+ this.list = []
73
+
74
+ this.onLoad()
75
+ },
76
+ deep: true
77
+ }
78
+ },
79
+ methods: {
80
+ onLoad() {
81
+ if (this.refreshing) {
82
+ this.list = [];
83
+ this.refreshing = false;
84
+ }
85
+
86
+ let params = {offset: this.offset, limit: this.limit, ...this.searchParams}
87
+ axios.get(this.url, {params}).then(res => {
88
+ console.log("lambo-init-table-list -- onLoad -- loadData:", res)
89
+ if (res && res.code === 1) {
90
+ let pageData = res.data
91
+
92
+ if (pageData && pageData.rows.length > 0) {
93
+ for (let item of pageData.rows) {
94
+ if (this.list.length < pageData.total) {
95
+ this.list.push(item)
96
+ this.finished = false
97
+ } else {
98
+ this.finished = true // 数据加载完毕
99
+ }
100
+ }
101
+ this.offset = this.pageNum * 10
102
+ this.pageNum++;
103
+ this.finishedTxt = "没有更多了"
104
+ } else {
105
+ this.finished = true; // 数据加载完毕
106
+ }
107
+ this.loading = false; // 加载状态结束
108
+ } else {
109
+ console.error("lambo-init-list -- onLoad -- 查询[" + this.title + "]数据失败", res)
110
+ Toast.fail("查询[" + this.title + "]数据失败:" + res.data || '')
111
+ }
112
+ }).catch(err => {
113
+ console.error("lambo-init-list -- onLoad -- 查询[" + this.title + "]异常:", err)
114
+ Toast.fail("查询[" + this.url + "]数据异常")
115
+ })
116
+ },
117
+ getListHeight() {
118
+ const windowHeight = window.innerHeight;
119
+ this.listHeight = `${windowHeight * this.heightRatio}px`;
120
+ },
121
+ onRefresh() {
122
+ console.log("lambo-init-list -- onRefresh")
123
+
124
+ this.finished = false
125
+ this.pageNum = 1
126
+ this.offset = 0
127
+ this.limit = 10
128
+
129
+ this.loading = true
130
+ this.onLoad()
131
+ }
132
+ },
133
+ beforeDestroy() {
134
+ this.pageNum = 1
135
+ this.offset = 0
136
+ this.limit = 10
137
+ this.list = []
138
+ },
139
+ };
140
+ </script>
141
+ <style scoped>
142
+ :root {
143
+ --width: auto
144
+ }
145
+
146
+ .container {
147
+ background: var(--scl-white-1);
148
+ }
149
+
150
+ .table-head {
151
+ display: flex;
152
+ margin-bottom: 5px;
153
+ color: var(--scl-blue);
154
+ }
155
+
156
+ .table-row {
157
+ display: flex;
158
+ }
159
+
160
+ .table-cell {
161
+ flex: 0 0 var(--width);
162
+ text-align: center;
163
+ padding: 5px;
164
+ min-width: 0;
165
+ word-wrap: break-word;
166
+ }
167
+
168
+ .table-cell-list {
169
+ font-size: var(--ind-font-size-sm);
170
+ }
171
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wl-design-mobile",
3
- "version": "0.0.9",
4
- "description": "0.0.9",
3
+ "version": "0.1.1",
4
+ "description": "",
5
5
  "main": "index.js",
6
6
  "author": "finch",
7
7
  "license": "ISC",
package/styles/base.less CHANGED
@@ -26,6 +26,7 @@
26
26
  --scl-white-4: #F5F5F5FF;
27
27
  --scl-white-5: #EDEDEDFF;
28
28
  --scl-white-6: #D7D7D7;
29
+ --scl-white-7: #F2F2F2;
29
30
 
30
31
  --scl-gray-1: #333333;
31
32
  --scl-gray-2: #666666;
@@ -5,7 +5,7 @@
5
5
  margin-left: 1%;
6
6
  font-size: 14px;
7
7
  color: var(--scl-white-1);
8
- border-radius: 6px;
8
+ border-radius: 3px;
9
9
  background-color: var(--scl-blue);
10
10
  border: none;
11
11
  }
@@ -22,7 +22,7 @@
22
22
  margin-right: 1%;
23
23
  font-size: 14px;
24
24
  color: var(--scl-blue);
25
- border-radius: 6px;
25
+ border-radius: 3px;
26
26
  background-color: var(--scl-white-4);
27
27
  border: 1px solid var(--scl-blue);
28
28
  }
package/tag/lambo-tag.vue CHANGED
@@ -3,7 +3,6 @@
3
3
  <van-tag :class="tagClass">{{ title }}</van-tag>
4
4
  </div>
5
5
  </template>
6
-
7
6
  <script>
8
7
  export default {
9
8
  name: "LamboTag",
@@ -19,7 +18,6 @@ export default {
19
18
  }
20
19
  }
21
20
  </script>
22
-
23
21
  <style scoped>
24
22
 
25
- </style>
23
+ </style>
@@ -32,11 +32,11 @@ export default {
32
32
  },
33
33
  marginBottom: {
34
34
  type: Boolean,
35
- default: false,
35
+ default: true,
36
36
  },
37
37
  border: {
38
38
  type: Boolean,
39
- default: false,
39
+ default: true,
40
40
  },
41
41
  },
42
42
  data() {
@@ -123,7 +123,7 @@ export default {
123
123
  /* 控制 .opt-btn-div 内的元素的右边距为 6px */
124
124
  .opt-btn-div > * {
125
125
  margin-right: 6px;
126
- border-radius: 6px;
126
+ border-radius: 3px;
127
127
  }
128
128
 
129
129
  /* 控制 .opt-btn-div 内的最后一个元素的右边距为 0px */
Binary file
Binary file
package/assets/logo.png DELETED
Binary file
@@ -1,176 +0,0 @@
1
- <template>
2
- <div>
3
- <div class="fileUplodaContainer">
4
- <div class="setUploader">
5
- <div class="fileUplodaTitle"><p>{{ title }}</p></div>
6
- <van-uploader v-model="fileList" :after-read="afterRead" :before-read="beforeRead" accept="*">
7
- <van-button :icon="fileImg" type="primary"></van-button>
8
- </van-uploader>
9
- </div>
10
- </div>
11
- </div>
12
- </template>
13
- <script>
14
- import fileImg from '../../assets/icon/fileImg.png';
15
- import {axios} from "../../util/axios/index";
16
- import {fileUploadUrl} from "../../api/doc";
17
- import {Toast} from "vant";
18
- import excelIcon from "../../assets/img/doc/excel.png";
19
- import mp3Icon from "../../assets/img/doc/mp3.png";
20
- import otherIcon from "../../assets/img/doc/other.png";
21
- import pdfIcon from "../../assets/img/doc/pdf.png";
22
- import pptIcon from "../../assets/img/doc/ppt.png";
23
- import txtIcon from "../../assets/img/doc/txt.png";
24
- import videoIcon from "../../assets/img/doc/video.png";
25
- import wordIcon from "../../assets/img/doc/word.png";
26
- import zipIcon from "../../assets/img/doc/zip.png";
27
-
28
- export default {
29
- name: 'LamboFileUpload',
30
- components: {},
31
- props: {
32
- title: {
33
- type: String,
34
- default: ' '
35
- },
36
- },
37
- data() {
38
- return {
39
- fileImg: fileImg,
40
- fileList: [],
41
- resultFileList: []
42
- }
43
- },
44
- methods: {
45
- afterRead(files, detail) {
46
- console.log(files, detail);
47
- let file = files.file;
48
- let formData = new FormData();
49
- formData.append('file', file);
50
- axios.post(fileUploadUrl, formData, {}).then(response => {
51
- if (response && response.code == "1") {
52
- let fileData = response.data;
53
- if (fileData && fileData.length > 0) {
54
- let file1 = fileData[0]
55
- if (file1 && file1.fileId) {
56
- let resFile = fileData[0]
57
- let fileName = resFile.fileName || ''
58
- let suffix = ''
59
- if (fileName.indexOf(".") > -1) {
60
- suffix = fileName.split('.')[1]
61
- }
62
- this.updateFileIcon(suffix);
63
- let item = {
64
- fileId: resFile.fileId,
65
- lastModified: file.lastModified,
66
- fileName: fileName,
67
- fileSuffix: suffix
68
- }
69
- this.resultFileList.push(item)
70
- Toast.success('上传文件成功');
71
- this.$emit("onSuccess", this.resultFileList);
72
- } else {
73
- Toast.fail("上传文件为空,上传失败")
74
- this.$emit("on-failed", null);
75
- }
76
- } else {
77
- Toast.fail("上传文件为空,上传失败")
78
- this.$emit("on-failed", null);
79
- }
80
- } else {
81
- Toast.fail("上传失败,请联系管理员")
82
- this.$emit("on-failed", null);
83
- }
84
- }).catch((e) => {
85
- Toast.fail("文件上传异常!");
86
- console.error("文件上传异常:", e)
87
- });
88
- },
89
- beforeRead(file) {
90
- let fileName = file.name;
91
- let type = fileName.substring(fileName.lastIndexOf('.') + 1);
92
- const fileList = ['mp4', 'm3u8', 'rmvb', 'avi', 'swf', '3gp', 'mkv', 'flv',
93
- 'mp3', 'wav', 'wma', 'ogg', 'aac', 'flac',
94
- 'doc', 'pages', 'epub', 'docx', 'pdf', 'txt', 'numbers', 'csv', 'xls', 'xlsx',
95
- 'keynote', 'ppt', 'pptx', 'zip',
96
- 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'tif', 'psd', 'webp', 'svg', 'raw'
97
- ];
98
- let result = fileList.includes(type.toLowerCase());
99
- if (!result) {
100
- Toast.fail("文件类型不支持!(请选择'mp4', 'm3u8', 'rmvb', 'avi', 'swf', '3gp', 'mkv', 'flv','mp3', 'wav', 'wma', 'ogg', 'aac', 'flac','doc', 'pages', 'epub', 'docx', 'pdf', 'txt', 'numbers', 'csv', 'xls', 'xlsx','keynote', 'ppt', 'pptx', 'zip','jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'tif', 'psd', 'webp', 'svg', 'raw')")
101
- }
102
- return result;
103
- },
104
- updateFileIcon(suffix) {
105
- const fileIcons = document.querySelectorAll('.van-uploader__file-icon');
106
- switch (suffix) {
107
- case 'mp4':
108
- case 'm3u8':
109
- case 'rmvb':
110
- case 'avi':
111
- case 'swf':
112
- case '3gp':
113
- case 'mkv':
114
- case 'flv':
115
- fileIcons[fileIcons.length - 1].style.content = 'url("' + videoIcon + '")';
116
- break;
117
- case 'mp3':
118
- case 'wav':
119
- case 'wma':
120
- case 'ogg':
121
- case 'aac':
122
- case 'flac':
123
- fileIcons[fileIcons.length - 1].style.content = 'url("' + mp3Icon + '")';
124
- break;
125
- case 'doc':
126
- case 'pages':
127
- case 'epub':
128
- case 'docx':
129
- fileIcons[fileIcons.length - 1].style.content = 'url("' + wordIcon + '")';
130
- break;
131
- case 'pdf':
132
- fileIcons[fileIcons.length - 1].style.content = 'url("' + pdfIcon + '")';
133
- break;
134
- case 'txt':
135
- fileIcons[fileIcons.length - 1].style.content = 'url("' + txtIcon + '")';
136
- break;
137
- case 'numbers':
138
- case 'csv':
139
- case 'xls':
140
- case 'xlsx':
141
- fileIcons[fileIcons.length - 1].style.content = 'url("' + excelIcon + '")';
142
- break;
143
- case 'keynote':
144
- case 'ppt':
145
- case 'pptx':
146
- fileIcons[fileIcons.length - 1].style.content = 'url("' + pptIcon + '")';
147
- break;
148
- case 'zip':
149
- fileIcons[fileIcons.length - 1].style.content = 'url("' + zipIcon + '")';
150
- break;
151
- case 'jpg':
152
- case 'jpeg':
153
- case 'png':
154
- case 'gif':
155
- case 'bmp':
156
- case 'tiff':
157
- case 'tif':
158
- case 'psd':
159
- case 'webp':
160
- case 'svg':
161
- case 'raw':
162
- // fileIcons[fileIcons.length - 1].style.content = 'url("' + photoIcon + '")';
163
- break;
164
- default:
165
- fileIcons[fileIcons.length - 1].style.content = 'url("' + otherIcon + '")';
166
- break;
167
- }
168
- },
169
- },
170
- };
171
- </script>
172
- <style scoped>
173
- @import "../../styles/index.less";
174
- @import './styles/css/index.css';
175
-
176
- </style>
@@ -1,109 +0,0 @@
1
- <template>
2
- <div>
3
- <div class="imgUplodaContainer">
4
- <div class="setUploader">
5
- <div class="imgUplodaTitle"><p>{{ title }}</p></div>
6
- <van-uploader v-model="fileList" :after-read="afterRead" :before-read="beforeRead" accept="image/*">
7
- <van-button :icon="uploadImg" type="primary"></van-button>
8
- </van-uploader>
9
- </div>
10
- </div>
11
- </div>
12
- </template>
13
- <script>
14
- import uploadImg from '../../assets/icon/upload-img.png';
15
- import {axios} from "../../util/axios/index";
16
- import {fileUploadUrl} from "../../api/doc";
17
- import {Toast} from "vant";
18
-
19
- export default {
20
- name: 'LamboImgUpload',
21
- components: {},
22
- props: {
23
- title: {
24
- type: String,
25
- default: ' '
26
- },
27
- },
28
- data() {
29
- return {
30
- uploadImg: uploadImg,
31
- fileList: [],
32
- resultFileList: []
33
- }
34
- },
35
- methods: {
36
- afterRead(files, detail) {
37
- console.log(files, detail);
38
- let file = files.file;
39
- let formData = new FormData();
40
- formData.append('file', file);
41
- axios.post(fileUploadUrl, formData, {}).then(response => {
42
- console.log("doUpload -- response:", response)
43
- if (response && response.code == "1") {
44
- let fileData = response.data;
45
- if (fileData && fileData.length > 0) {
46
- let file1 = fileData[0]
47
- if (file1 && file1.fileId) {
48
- let resFile = fileData[0]
49
- let fileName = resFile.fileName || ''
50
- let suffix = ''
51
- if (fileName.indexOf(".") > -1) {
52
- suffix = fileName.split('.')[1]
53
- }
54
- let item = {
55
- fileId: resFile.fileId,
56
- lastModified: file.lastModified,
57
- fileName: fileName,
58
- fileSuffix: suffix
59
- }
60
- this.resultFileList.push(item)
61
- Toast.success('上传图片成功');
62
- this.$emit("onSuccess", this.resultFileList);
63
- } else {
64
- Toast.fail("上传图片为空,上传失败")
65
- this.$emit("on-failed", null);
66
- }
67
- } else {
68
- Toast.fail("上传图片为空,上传失败")
69
- this.$emit("on-failed", null);
70
- }
71
- } else {
72
- Toast.fail("上传失败,请联系管理员")
73
- this.$emit("on-failed", null);
74
- }
75
- }).catch((e) => {
76
- Toast.fail("图片上传异常!");
77
- console.error("图片上传异常:", e)
78
- });
79
- },
80
- beforeRead(file) {
81
- let fileName = file.name;
82
- let type = fileName.substring(fileName.lastIndexOf('.') + 1);
83
- let result = false;
84
- const imgList = ['bmp', 'jpg', 'png', 'tif', 'gif', 'pcx', 'tga', 'exif', 'fpx', 'svg', 'psd', 'cdr', 'pcd', 'dxf', 'ufo', 'eps', 'ai', 'raw', 'wmf', 'webp', 'avif', 'apng', 'jpeg',
85
- 'BMP', 'JPG', 'PNG', 'TIF', 'GIF', 'PCX', 'TGA', 'EXIF', 'FPX', 'SVG', 'PSD', 'CDR', 'PCD', 'DXF', 'UFO', 'EPS', 'AI', 'RAW', 'WMF', 'WEBP', 'AVIF', 'APNG', 'JPEG'];
86
- // 进行图片匹配
87
- result = imgList.some(function (item) {
88
- return item === type
89
- })
90
- if (!result) {
91
- Toast.fail("请上传图片!")
92
- }
93
- return result
94
- }
95
- }
96
- ,
97
- created() {
98
-
99
- }
100
- ,
101
- mounted() {
102
-
103
- }
104
- }
105
- </script>
106
- <style scoped>
107
- @import "../../styles/index.less";
108
- @import './styles/css/index.css';
109
- </style>