wl-design-mobile 0.2.0 → 0.2.2
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 +6 -6
- package/doc/img/styles/css/index.css +3 -3
- package/edit/list/styles/css/index.css +39 -39
- package/list/components/table/lambo-table-head.vue +3 -2
- package/list/components/table/lambo-table-row.vue +5 -2
- package/list/lambo-list.vue +2 -2
- package/list/lambo-table-list2.vue +5 -5
- package/package.json +1 -1
- package/search/styles/css/index.css +136 -136
- package/table/lambo-ag-table.vue +96 -0
- package/util/assist.js +43 -43
- package/util/bus.js +4 -4
- package/util/jssdk.js +247 -214
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# wl-design-mobile
|
|
2
|
-
|
|
3
|
-
## Setup
|
|
4
|
-
```
|
|
5
|
-
npm i wl-design-mobile
|
|
6
|
-
```
|
|
1
|
+
# wl-design-mobile
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
```
|
|
5
|
+
npm i wl-design-mobile
|
|
6
|
+
```
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
.img-upload-container {
|
|
2
|
-
padding: 0px 14px 12px 14px;
|
|
3
|
-
}
|
|
1
|
+
.img-upload-container {
|
|
2
|
+
padding: 0px 14px 12px 14px;
|
|
3
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
.coll-div {
|
|
2
|
-
margin-bottom: 8px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.indicator-title {
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
color: var(--scl-blue);
|
|
9
|
-
font-size: 14px;
|
|
10
|
-
font-family: 微软雅黑, serif Regular;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.indicator-title .color-line {
|
|
14
|
-
width: 3px;
|
|
15
|
-
height: 14px;
|
|
16
|
-
margin-right: 8px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.coll-title-icon {
|
|
20
|
-
justify-content: center;
|
|
21
|
-
align-items: center;
|
|
22
|
-
align-content: center;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/* 覆盖折叠面板的标题的padding */
|
|
26
|
-
/deep/ .van-cell {
|
|
27
|
-
padding: 12px 10px;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/* 覆盖去掉折叠面板的标题下面的线 */
|
|
31
|
-
/deep/ .van-cell::after {
|
|
32
|
-
border: none;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/* 覆盖折叠面板的内容的padding */
|
|
36
|
-
/deep/ .van-collapse-item__content {
|
|
37
|
-
padding: 0px 0px 0px 0px;
|
|
38
|
-
}
|
|
39
|
-
|
|
1
|
+
.coll-div {
|
|
2
|
+
margin-bottom: 8px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.indicator-title {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
color: var(--scl-blue);
|
|
9
|
+
font-size: 14px;
|
|
10
|
+
font-family: 微软雅黑, serif Regular;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.indicator-title .color-line {
|
|
14
|
+
width: 3px;
|
|
15
|
+
height: 14px;
|
|
16
|
+
margin-right: 8px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.coll-title-icon {
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
align-content: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* 覆盖折叠面板的标题的padding */
|
|
26
|
+
/deep/ .van-cell {
|
|
27
|
+
padding: 12px 10px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* 覆盖去掉折叠面板的标题下面的线 */
|
|
31
|
+
/deep/ .van-cell::after {
|
|
32
|
+
border: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* 覆盖折叠面板的内容的padding */
|
|
36
|
+
/deep/ .van-collapse-item__content {
|
|
37
|
+
padding: 0px 0px 0px 0px;
|
|
38
|
+
}
|
|
39
|
+
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
<div class="table-header" ref="listRowDiv">
|
|
4
4
|
<div v-for="(item, index) in columns" :key="index" class="header-cell" :style="{
|
|
5
5
|
gridColumn: index + 1,
|
|
6
|
-
minWidth: item.minWidth,
|
|
7
6
|
textAlign: item.align || 'left' }">
|
|
8
7
|
{{ item.title }}
|
|
9
8
|
</div>
|
|
@@ -30,7 +29,9 @@ export default {
|
|
|
30
29
|
display: grid;
|
|
31
30
|
grid-auto-rows: 30px;
|
|
32
31
|
gap: 1px;
|
|
33
|
-
align-items:
|
|
32
|
+
align-items: end;
|
|
33
|
+
justify-content: stretch;
|
|
34
|
+
align-content: start;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
.header-cell {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="table-row" ref="listRowDiv">
|
|
3
3
|
<div v-for="(item, index) in columns" :key="index" class="table-cell" :style="{
|
|
4
4
|
gridColumn: index + 1,
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
textAlign: item.align || 'left' }">
|
|
7
7
|
<p v-if="item?.type === 'index'">{{seq + 1}}</p>
|
|
8
8
|
<p v-else> {{ data[item.key] }} </p>
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
</template>
|
|
12
12
|
<script>
|
|
13
|
+
// width: item.width,
|
|
13
14
|
export default {
|
|
14
15
|
name: 'LamboTableRow',
|
|
15
16
|
props: {
|
|
@@ -53,6 +54,8 @@ export default {
|
|
|
53
54
|
grid-auto-rows: 30px;
|
|
54
55
|
gap: 1px;
|
|
55
56
|
align-items: center;
|
|
57
|
+
justify-content: stretch;
|
|
58
|
+
align-content: start;
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
.table-cell {
|
|
@@ -60,7 +63,7 @@ export default {
|
|
|
60
63
|
border: 1px solid #ddd;
|
|
61
64
|
border-radius: 3px;
|
|
62
65
|
font-size: 14px;
|
|
63
|
-
white-space: nowrap
|
|
66
|
+
/* white-space: nowrap;*/
|
|
64
67
|
place-items: center;
|
|
65
68
|
display: inline-block;
|
|
66
69
|
align-items: center;
|
package/list/lambo-list.vue
CHANGED
|
@@ -141,14 +141,14 @@ export default {
|
|
|
141
141
|
console.error("lambo-init-list -- onLoad -- 查询[" + this.title + "]数据失败", res)
|
|
142
142
|
Toast.fail("查询[" + this.title + "]数据失败:" + res.data || '')
|
|
143
143
|
this.error = true;
|
|
144
|
-
this.errorText = res.data
|
|
144
|
+
this.errorText = '请求失败\n'+res.data
|
|
145
145
|
}
|
|
146
146
|
this.loading = false; // 加载状态结束
|
|
147
147
|
}).catch(err => {
|
|
148
148
|
console.error("lambo-init-list -- onLoad -- 查询[" + this.title + "]异常:", err)
|
|
149
149
|
Toast.fail("查询[" + this.url + "]数据异常")
|
|
150
150
|
this.error = true;
|
|
151
|
-
this.errorText = err
|
|
151
|
+
this.errorText = '请求失败\n'+err
|
|
152
152
|
this.loading = false; // 加载状态结束
|
|
153
153
|
})
|
|
154
154
|
}
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
<script>
|
|
15
15
|
import {axios} from "../util/axios/index"
|
|
16
16
|
import {Toast} from "vant"
|
|
17
|
-
import LamboTableHead from "
|
|
18
|
-
import LamboTableRow from "
|
|
19
|
-
import LamboTableFooter from "
|
|
17
|
+
import LamboTableHead from "../list/components/table/lambo-table-head.vue";
|
|
18
|
+
import LamboTableRow from "../list/components/table/lambo-table-row.vue";
|
|
19
|
+
import LamboTableFooter from "../list/components/table/lambo-table-footer.vue";
|
|
20
20
|
|
|
21
21
|
export default {
|
|
22
22
|
name: "LamboTableList2",
|
|
@@ -69,8 +69,8 @@ export default {
|
|
|
69
69
|
offset: 0,
|
|
70
70
|
limit: 10,
|
|
71
71
|
list: [
|
|
72
|
-
{title: "盐城市亭湖区大树酒业商行", time: "2024-01-01", person:"01", dpt: "储配部", note: "测试"},
|
|
73
|
-
{title: "盐城市亭湖区大树酒业商行", time: "2024-01-02", person:"02", dpt: "储配部", note: "测试"},
|
|
72
|
+
{title: "盐城市亭湖区大树酒业商行", time: "2024-01-01", person:"01", dpt: "储配部XXXXXX", note: "测试"},
|
|
73
|
+
{title: "盐城市亭湖区大树酒业商行", time: "2024-01-02", person:"02", dpt: "储配部XXXXXXXXXXXXXXXXXXXXX", note: "测试"},
|
|
74
74
|
{title: "盐城市亭湖区大树酒业商行", time: "2024-01-01", person:"01", dpt: "储配部", note: "测试"},
|
|
75
75
|
{title: "盐城市亭湖区大树酒业商行", time: "2024-01-02", person:"02", dpt: "储配部", note: "测试"},
|
|
76
76
|
{title: "盐城市亭湖区大树酒业商行", time: "2024-01-01", person:"01", dpt: "储配部", note: "测试"},
|
package/package.json
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
.search-top-pop {
|
|
2
|
-
min-height: 112px;
|
|
3
|
-
max-height: 33%;
|
|
4
|
-
background-color: var(--scl-white-1)
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.search-body {
|
|
8
|
-
border-top: none;
|
|
9
|
-
overflow-y: auto;
|
|
10
|
-
flex: 1
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.search-bottom-btn {
|
|
14
|
-
padding: 12px 14px 12px 14px;
|
|
15
|
-
box-shadow: 0 -2px 10px rgba(125, 126, 128, .16);
|
|
16
|
-
background-color: rgb(255, 255, 255, 1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/*日期选择*/
|
|
20
|
-
.search-row {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: row;
|
|
23
|
-
justify-content: flex-start;
|
|
24
|
-
flex-wrap: nowrap;
|
|
25
|
-
align-items: center;
|
|
26
|
-
align-content: center;
|
|
27
|
-
height: 50px;
|
|
28
|
-
padding: 10px 0;
|
|
29
|
-
margin: 0 14px;
|
|
30
|
-
border-bottom: 1px solid var(--scl-white-2);
|
|
31
|
-
border-top: none;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.search-input-title {
|
|
35
|
-
height: 16px;
|
|
36
|
-
font-size: 12px;
|
|
37
|
-
color: var(--scl-gray-2);
|
|
38
|
-
display: flex;
|
|
39
|
-
justify-content: flex-start;
|
|
40
|
-
align-items: center;
|
|
41
|
-
margin-left: 12px;
|
|
42
|
-
width: 76px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.search-lambo-input {
|
|
46
|
-
border: none;
|
|
47
|
-
outline: none;
|
|
48
|
-
background: none;
|
|
49
|
-
height: 16px;
|
|
50
|
-
font-size: 12px;
|
|
51
|
-
color: var(--scl-gray-1);
|
|
52
|
-
display: flex;
|
|
53
|
-
justify-content: flex-start;
|
|
54
|
-
align-items: center;
|
|
55
|
-
margin-left: 8px;
|
|
56
|
-
flex: 1;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/*输入框*/
|
|
60
|
-
.search-lambo-input .van-cell {
|
|
61
|
-
padding: 10px 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/*多选*/
|
|
65
|
-
.search-top-div {
|
|
66
|
-
display: flex;
|
|
67
|
-
justify-content: space-between;
|
|
68
|
-
height: 44px;
|
|
69
|
-
line-height: 44px;
|
|
70
|
-
width: 100%;
|
|
71
|
-
position: fixed;
|
|
72
|
-
z-index: 2;
|
|
73
|
-
box-shadow: 0 2px 10px rgba(125, 126, 128, .16);
|
|
74
|
-
background-color: rgb(255, 255, 255, 1);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.search-cancel-btn {
|
|
78
|
-
border: none;
|
|
79
|
-
color: var(--scl-gray-3);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.search-confirm-btn {
|
|
83
|
-
border: none;
|
|
84
|
-
color: var(--scl-blue);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.search-select-title {
|
|
88
|
-
font-size: 16px;
|
|
89
|
-
font-weight: bold;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/*修改单选多选的滚动条样式*/
|
|
93
|
-
/deep/ .van-radio-group {
|
|
94
|
-
position: relative;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/*修改单选多选的滚动条样式*/
|
|
98
|
-
/deep/ .van-cell-group {
|
|
99
|
-
padding-top: 44px;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/*修改单选多选的滚动条样式*/
|
|
103
|
-
/deep/ .van-cell:first-child {
|
|
104
|
-
padding-top: 10px;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/*滚动条样式*/
|
|
108
|
-
/deep/ ::-webkit-scrollbar {
|
|
109
|
-
width: 6px;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/*滚动条样式*/
|
|
113
|
-
/deep/ ::-webkit-scrollbar-thumb {
|
|
114
|
-
border-radius: var(--ind-border-radius-xl);
|
|
115
|
-
background: rgba(45, 140, 240, 0.6);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/*滚动条样式*/
|
|
119
|
-
/deep/ ::-webkit-scrollbar-track {
|
|
120
|
-
-webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);
|
|
121
|
-
border-radius: var(--ind-border-radius-xl);
|
|
122
|
-
background: rgba(231, 242, 250, 0.4);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.bottom-div {
|
|
126
|
-
display: flex;
|
|
127
|
-
flex-direction: column;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.cell-group-div {
|
|
131
|
-
flex: 1;
|
|
132
|
-
overflow-y: auto;
|
|
133
|
-
margin-top: 44px;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
1
|
+
.search-top-pop {
|
|
2
|
+
min-height: 112px;
|
|
3
|
+
max-height: 33%;
|
|
4
|
+
background-color: var(--scl-white-1)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.search-body {
|
|
8
|
+
border-top: none;
|
|
9
|
+
overflow-y: auto;
|
|
10
|
+
flex: 1
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.search-bottom-btn {
|
|
14
|
+
padding: 12px 14px 12px 14px;
|
|
15
|
+
box-shadow: 0 -2px 10px rgba(125, 126, 128, .16);
|
|
16
|
+
background-color: rgb(255, 255, 255, 1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/*日期选择*/
|
|
20
|
+
.search-row {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
justify-content: flex-start;
|
|
24
|
+
flex-wrap: nowrap;
|
|
25
|
+
align-items: center;
|
|
26
|
+
align-content: center;
|
|
27
|
+
height: 50px;
|
|
28
|
+
padding: 10px 0;
|
|
29
|
+
margin: 0 14px;
|
|
30
|
+
border-bottom: 1px solid var(--scl-white-2);
|
|
31
|
+
border-top: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.search-input-title {
|
|
35
|
+
height: 16px;
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
color: var(--scl-gray-2);
|
|
38
|
+
display: flex;
|
|
39
|
+
justify-content: flex-start;
|
|
40
|
+
align-items: center;
|
|
41
|
+
margin-left: 12px;
|
|
42
|
+
width: 76px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.search-lambo-input {
|
|
46
|
+
border: none;
|
|
47
|
+
outline: none;
|
|
48
|
+
background: none;
|
|
49
|
+
height: 16px;
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
color: var(--scl-gray-1);
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: flex-start;
|
|
54
|
+
align-items: center;
|
|
55
|
+
margin-left: 8px;
|
|
56
|
+
flex: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/*输入框*/
|
|
60
|
+
.search-lambo-input .van-cell {
|
|
61
|
+
padding: 10px 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/*多选*/
|
|
65
|
+
.search-top-div {
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: space-between;
|
|
68
|
+
height: 44px;
|
|
69
|
+
line-height: 44px;
|
|
70
|
+
width: 100%;
|
|
71
|
+
position: fixed;
|
|
72
|
+
z-index: 2;
|
|
73
|
+
box-shadow: 0 2px 10px rgba(125, 126, 128, .16);
|
|
74
|
+
background-color: rgb(255, 255, 255, 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.search-cancel-btn {
|
|
78
|
+
border: none;
|
|
79
|
+
color: var(--scl-gray-3);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.search-confirm-btn {
|
|
83
|
+
border: none;
|
|
84
|
+
color: var(--scl-blue);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.search-select-title {
|
|
88
|
+
font-size: 16px;
|
|
89
|
+
font-weight: bold;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/*修改单选多选的滚动条样式*/
|
|
93
|
+
/deep/ .van-radio-group {
|
|
94
|
+
position: relative;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/*修改单选多选的滚动条样式*/
|
|
98
|
+
/deep/ .van-cell-group {
|
|
99
|
+
padding-top: 44px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/*修改单选多选的滚动条样式*/
|
|
103
|
+
/deep/ .van-cell:first-child {
|
|
104
|
+
padding-top: 10px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/*滚动条样式*/
|
|
108
|
+
/deep/ ::-webkit-scrollbar {
|
|
109
|
+
width: 6px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/*滚动条样式*/
|
|
113
|
+
/deep/ ::-webkit-scrollbar-thumb {
|
|
114
|
+
border-radius: var(--ind-border-radius-xl);
|
|
115
|
+
background: rgba(45, 140, 240, 0.6);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/*滚动条样式*/
|
|
119
|
+
/deep/ ::-webkit-scrollbar-track {
|
|
120
|
+
-webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);
|
|
121
|
+
border-radius: var(--ind-border-radius-xl);
|
|
122
|
+
background: rgba(231, 242, 250, 0.4);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.bottom-div {
|
|
126
|
+
display: flex;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.cell-group-div {
|
|
131
|
+
flex: 1;
|
|
132
|
+
overflow-y: auto;
|
|
133
|
+
margin-top: 44px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ag-theme-balham" :style="{width: '100%', height: '500px'}">
|
|
3
|
+
<ag-grid-vue
|
|
4
|
+
:columnDefs="columns"
|
|
5
|
+
:rowData="rowData"
|
|
6
|
+
:pinnedBottomRowData="sumData"
|
|
7
|
+
:defaultColDef="defaultColDef"
|
|
8
|
+
@grid-ready="onGridReady"
|
|
9
|
+
class="ag-theme-balham"
|
|
10
|
+
style="width: 100%; height: 100%;"
|
|
11
|
+
></ag-grid-vue>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script>
|
|
15
|
+
import 'ag-grid-community/styles/ag-grid.css'
|
|
16
|
+
import 'ag-grid-community/styles/ag-theme-balham.css'
|
|
17
|
+
import {AgGridVue} from 'ag-grid-vue'
|
|
18
|
+
import {axios} from "../util/axios/index"
|
|
19
|
+
import {Toast} from "vant"
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
name: 'LamboAgTable',
|
|
23
|
+
components: {AgGridVue},
|
|
24
|
+
props: {
|
|
25
|
+
tableHeight: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: '50%',
|
|
28
|
+
},
|
|
29
|
+
url: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
columns: {
|
|
34
|
+
type: Array,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
searchParams: {
|
|
38
|
+
type: Object
|
|
39
|
+
},
|
|
40
|
+
sumData: {
|
|
41
|
+
type: Array,
|
|
42
|
+
required: true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
rowData: null,
|
|
48
|
+
defaultColDef: {
|
|
49
|
+
lockPosition: true,
|
|
50
|
+
editable: false,
|
|
51
|
+
sortable: true,
|
|
52
|
+
resizable: false,
|
|
53
|
+
filter: false,
|
|
54
|
+
autoHeight: true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
onGridReady(params) {
|
|
60
|
+
params.api.sizeColumnsToFit();
|
|
61
|
+
},
|
|
62
|
+
dataRefresh() {
|
|
63
|
+
axios.get(this.url, this.searchParams).then(res => {
|
|
64
|
+
console.log("lambo-ag-table -- onLoad -- dataRefresh:", res)
|
|
65
|
+
if (res && res.code === 1) {
|
|
66
|
+
this.rowData = []
|
|
67
|
+
this.sumData = []
|
|
68
|
+
this.rowData = res.data.data || []
|
|
69
|
+
this.sumData = res.data.sumData || []
|
|
70
|
+
} else {
|
|
71
|
+
console.error("lambo-ag-table -- onLoad -- 查询[" + this.url + "]数据失败", res)
|
|
72
|
+
Toast.fail("查询[" + this.url + "]数据失败:" + res.data || '')
|
|
73
|
+
}
|
|
74
|
+
}).catch(err => {
|
|
75
|
+
console.error("lambo-ag-table -- onLoad -- 查询[" + this.title + "]异常:", err)
|
|
76
|
+
Toast.fail("查询[" + this.url + "]数据异常")
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
watch: {
|
|
81
|
+
searchParams: {
|
|
82
|
+
handler: function (val, oldVal) {
|
|
83
|
+
console.log("lambo-ag-table -- searchParams -- val,oldVal:", {val, oldVal})
|
|
84
|
+
console.log("lambo-ag-table -- searchParams -- val===oldVal:", val === oldVal)
|
|
85
|
+
this.rowData = []
|
|
86
|
+
this.sumData = []
|
|
87
|
+
this.dataRefresh()
|
|
88
|
+
},
|
|
89
|
+
deep: true
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
94
|
+
<style scoped>
|
|
95
|
+
|
|
96
|
+
</style>
|
package/util/assist.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
// 深拷贝
|
|
2
|
-
export function deepCopy(data) {
|
|
3
|
-
let i;
|
|
4
|
-
const t = typeOf(data);
|
|
5
|
-
let o;
|
|
6
|
-
|
|
7
|
-
if (t === 'array') {
|
|
8
|
-
o = [];
|
|
9
|
-
} else if (t === 'object') {
|
|
10
|
-
o = {};
|
|
11
|
-
} else {
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (t === 'array') {
|
|
16
|
-
for (i = 0; i < data.length; i++) {
|
|
17
|
-
o.push(deepCopy(data[i]));
|
|
18
|
-
}
|
|
19
|
-
} else if (t === 'object') {
|
|
20
|
-
for (i in data) {
|
|
21
|
-
o[i] = deepCopy(data[i]);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return o;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 判断对象类型
|
|
28
|
-
export function typeOf(obj) {
|
|
29
|
-
const toString = Object.prototype.toString;
|
|
30
|
-
const map = {
|
|
31
|
-
'[object Boolean]': 'boolean',
|
|
32
|
-
'[object Number]': 'number',
|
|
33
|
-
'[object String]': 'string',
|
|
34
|
-
'[object Function]': 'function',
|
|
35
|
-
'[object Array]': 'array',
|
|
36
|
-
'[object Date]': 'date',
|
|
37
|
-
'[object RegExp]': 'regExp',
|
|
38
|
-
'[object Undefined]': 'undefined',
|
|
39
|
-
'[object Null]': 'null',
|
|
40
|
-
'[object Object]': 'object'
|
|
41
|
-
};
|
|
42
|
-
return map[toString.call(obj)];
|
|
43
|
-
}
|
|
1
|
+
// 深拷贝
|
|
2
|
+
export function deepCopy(data) {
|
|
3
|
+
let i;
|
|
4
|
+
const t = typeOf(data);
|
|
5
|
+
let o;
|
|
6
|
+
|
|
7
|
+
if (t === 'array') {
|
|
8
|
+
o = [];
|
|
9
|
+
} else if (t === 'object') {
|
|
10
|
+
o = {};
|
|
11
|
+
} else {
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (t === 'array') {
|
|
16
|
+
for (i = 0; i < data.length; i++) {
|
|
17
|
+
o.push(deepCopy(data[i]));
|
|
18
|
+
}
|
|
19
|
+
} else if (t === 'object') {
|
|
20
|
+
for (i in data) {
|
|
21
|
+
o[i] = deepCopy(data[i]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return o;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 判断对象类型
|
|
28
|
+
export function typeOf(obj) {
|
|
29
|
+
const toString = Object.prototype.toString;
|
|
30
|
+
const map = {
|
|
31
|
+
'[object Boolean]': 'boolean',
|
|
32
|
+
'[object Number]': 'number',
|
|
33
|
+
'[object String]': 'string',
|
|
34
|
+
'[object Function]': 'function',
|
|
35
|
+
'[object Array]': 'array',
|
|
36
|
+
'[object Date]': 'date',
|
|
37
|
+
'[object RegExp]': 'regExp',
|
|
38
|
+
'[object Undefined]': 'undefined',
|
|
39
|
+
'[object Null]': 'null',
|
|
40
|
+
'[object Object]': 'object'
|
|
41
|
+
};
|
|
42
|
+
return map[toString.call(obj)];
|
|
43
|
+
}
|
package/util/bus.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Vue from 'vue'
|
|
2
|
-
|
|
3
|
-
const Bus = new Vue();
|
|
4
|
-
export default Bus;
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
|
|
3
|
+
const Bus = new Vue();
|
|
4
|
+
export default Bus;
|
package/util/jssdk.js
CHANGED
|
@@ -1,214 +1,247 @@
|
|
|
1
|
-
import wx from "weixin-js-sdk";
|
|
2
|
-
import * as dd from 'dingtalk-jsapi';
|
|
3
|
-
import config from '../config/config'
|
|
4
|
-
import {axios} from '../util/axios'
|
|
5
|
-
|
|
6
|
-
let appId,agentId,corpId,appKey
|
|
7
|
-
|
|
8
|
-
function init({appId:a,agentId:b,corpId:c,appKey:d}){
|
|
9
|
-
appId = a
|
|
10
|
-
agentId = b
|
|
11
|
-
corpId = c
|
|
12
|
-
appKey = d
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function getAppType() {
|
|
17
|
-
let ua = navigator.userAgent.toLowerCase();
|
|
18
|
-
let isWxWork = ua.match(/WxWork/i) == 'wxwork';
|
|
19
|
-
if (isWxWork) {
|
|
20
|
-
return '20'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let isWx = ua.match(/MicroMessenger/i) == 'micromessenger';
|
|
24
|
-
if (isWx) {
|
|
25
|
-
if(agentId){//如果有agentId认为是企业微信
|
|
26
|
-
return '20'
|
|
27
|
-
}
|
|
28
|
-
return '10'
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (dd.env.platform != 'notInDingTalk') {
|
|
32
|
-
return '30'
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return ''
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function getJsConfig(){
|
|
39
|
-
let url = window.location.href.split('#')[0]
|
|
40
|
-
return new Promise((resolve, reject)=>{
|
|
41
|
-
axios.post(config.platformServerContext + '/api/weixin/getJsConfig', {
|
|
42
|
-
appType: getAppType(),
|
|
43
|
-
appId: appId,
|
|
44
|
-
agentId: agentId,
|
|
45
|
-
corpId: corpId,
|
|
46
|
-
appKey: appKey,
|
|
47
|
-
url: url
|
|
48
|
-
}).then((resp) => {
|
|
49
|
-
resolve(resp.data)
|
|
50
|
-
}).catch((error) => {
|
|
51
|
-
reject(error)
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function configWx(){
|
|
57
|
-
return new Promise((resolve, reject) =>{
|
|
58
|
-
getJsConfig().then((resp)=>{
|
|
59
|
-
wx.config({
|
|
60
|
-
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
61
|
-
appId: appId, // 必填,公众号的唯一标识
|
|
62
|
-
timestamp: resp.timestamp, // 必填,生成签名的时间戳
|
|
63
|
-
nonceStr: resp.noncestr, // 必填,生成签名的随机串
|
|
64
|
-
signature: resp.signature, // 必填,签名
|
|
65
|
-
jsApiList: ['chooseImage', 'uploadImage', 'downloadImage', 'getLocalImgData', 'openLocation', 'getLocation', 'scanQRCode', 'chooseWXPay', 'onHistoryBack','invoke','onLocationChange','previewFile'] // 必填,需要使用的JS接口列表
|
|
66
|
-
//jsApiList: ['chooseImage', 'uploadImage', 'downloadImage', 'getLocalImgData', 'openLocation', 'getLocation', 'scanQRCode', 'chooseWXPay', 'onHistoryBack','startLocationUpdateBackground','startLocationUpdate','onLocationChange','offLocationChange'] // 必填,需要使用的JS接口列表
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
wx.ready(() => {
|
|
70
|
-
console.log('初始化js-sdk成功');
|
|
71
|
-
resolve()
|
|
72
|
-
});
|
|
73
|
-
wx.error(res => {
|
|
74
|
-
console.log('初始化js-sdk失败' + res.errMsg);
|
|
75
|
-
console.log('友情提示:若想成功,则需通过params传参(而不是query)!!!');
|
|
76
|
-
reject('初始化js-sdk失败' + res.errMsg)
|
|
77
|
-
});
|
|
78
|
-
}).catch((error)=>{
|
|
79
|
-
reject('请求服务端jssdk签名失败:'+error)
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function configDd(){
|
|
85
|
-
return new Promise((resolve, reject)=>{
|
|
86
|
-
getJsConfig().then((resp)=>{
|
|
87
|
-
//钉钉js-api配置
|
|
88
|
-
console.log("当前页面:"+location.href);
|
|
89
|
-
dd.config({
|
|
90
|
-
agentId:agentId,
|
|
91
|
-
corpId: corpId, // 必填,公众号的唯一标识
|
|
92
|
-
timeStamp: resp.timestamp, // 必填,生成签名的时间戳
|
|
93
|
-
nonceStr: resp.noncestr, // 必填,生成签名的随机串
|
|
94
|
-
signature: resp.signature, // 必填,签名
|
|
95
|
-
jsApiList: [
|
|
96
|
-
'getDeviceUUID',
|
|
97
|
-
'getLocation',
|
|
98
|
-
|
|
99
|
-
] // 必填,需要使用的jsapi列表,注意:不要带dd。
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
dd.ready(() => {
|
|
103
|
-
console.log('初始化钉钉 js-sdk成功');
|
|
104
|
-
resolve()
|
|
105
|
-
});
|
|
106
|
-
dd.error(res => {
|
|
107
|
-
console.log('初始化钉钉 js-sdk失败' + JSON.stringify(res));
|
|
108
|
-
console.log('友情提示:若想成功,则需通过params传参(而不是query)!!!');
|
|
109
|
-
reject('初始化钉钉 js-sdk失败' + JSON.stringify(res))
|
|
110
|
-
});
|
|
111
|
-
}).catch((error)=>{
|
|
112
|
-
reject('请求服务端jssdk签名失败:'+error)
|
|
113
|
-
})
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
let JsSDK = (function () {
|
|
118
|
-
function scanQRCode(){
|
|
119
|
-
return new Promise((resolve, reject) =>{
|
|
120
|
-
if(getAppType() === '30'){
|
|
121
|
-
dd.scan({
|
|
122
|
-
type: 'all',
|
|
123
|
-
success: (res) => {
|
|
124
|
-
console.log('钉钉扫码结果',res)
|
|
125
|
-
resolve(res.text)
|
|
126
|
-
},
|
|
127
|
-
fail: (err) => {
|
|
128
|
-
console.log('钉钉扫码失败',err)
|
|
129
|
-
reject('钉钉扫码失败:'+err)
|
|
130
|
-
},
|
|
131
|
-
complete: () => {},
|
|
132
|
-
});
|
|
133
|
-
}else{
|
|
134
|
-
configWx().then(()=>{
|
|
135
|
-
wx.scanQRCode({
|
|
136
|
-
desc: 'scanQRCode desc',
|
|
137
|
-
needResult: 1,
|
|
138
|
-
scanType: ["qrCode", "barCode"],
|
|
139
|
-
success: function (resp) {
|
|
140
|
-
console.log("微信扫码结果:",resp)
|
|
141
|
-
let result = resp.resultStr
|
|
142
|
-
resolve(result)
|
|
143
|
-
},
|
|
144
|
-
fail: function (res) {
|
|
145
|
-
console.log("失败res=>",res)
|
|
146
|
-
if (res.errMsg.indexOf('function_not_exist') > 0) {
|
|
147
|
-
reject('版本过低请升级');
|
|
148
|
-
} else {
|
|
149
|
-
reject("微信扫码失败,请联系系统管理员!");
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
})
|
|
153
|
-
}).catch((error)=>{
|
|
154
|
-
reject('微信扫码失败:'+error)
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
})
|
|
158
|
-
}
|
|
159
|
-
function getLocation(){
|
|
160
|
-
return new Promise((resolve, reject)=>{
|
|
161
|
-
if(getAppType() === '30'){
|
|
162
|
-
configDd().then(()=>{
|
|
163
|
-
dd.getLocation({
|
|
164
|
-
targetAccuracy: '200',
|
|
165
|
-
cacheTimeout: 20,
|
|
166
|
-
coordinate: '1',
|
|
167
|
-
useCache: true,
|
|
168
|
-
withReGeocode: true,
|
|
169
|
-
type: 1,
|
|
170
|
-
success: (res) => {
|
|
171
|
-
console.log('钉钉获取当前位置结果:', res)
|
|
172
|
-
resolve(res)
|
|
173
|
-
},
|
|
174
|
-
fail: (error) => {
|
|
175
|
-
console.log('钉钉获取位置失败:', error)
|
|
176
|
-
reject('钉钉获取位置失败:'+error)
|
|
177
|
-
},
|
|
178
|
-
complete: () => {},
|
|
179
|
-
})
|
|
180
|
-
}).catch((error)=>{
|
|
181
|
-
reject('钉钉获取位置失败:'+error)
|
|
182
|
-
})
|
|
183
|
-
}else{
|
|
184
|
-
configWx().then(()=>{
|
|
185
|
-
wx.getLocation({
|
|
186
|
-
type: 'gcj02', //获取gcj02的坐标
|
|
187
|
-
success: (res) => {
|
|
188
|
-
//res.longitude 获取经度
|
|
189
|
-
//res.latitude 获取纬度
|
|
190
|
-
console.log(res);
|
|
191
|
-
resolve(res)
|
|
192
|
-
}, fail: (res) => {
|
|
193
|
-
console.log("微信获取位置失败。"+JSON.stringify(res));
|
|
194
|
-
reject("微信获取位置失败" + JSON.stringify(res))
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
}).catch((error)=>{
|
|
198
|
-
reject('微信获取位置失败:'+error)
|
|
199
|
-
})
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
1
|
+
import wx from "weixin-js-sdk";
|
|
2
|
+
import * as dd from 'dingtalk-jsapi';
|
|
3
|
+
import config from '../config/config'
|
|
4
|
+
import {axios} from '../util/axios'
|
|
5
|
+
|
|
6
|
+
let appId,agentId,corpId,appKey
|
|
7
|
+
|
|
8
|
+
function init({appId:a,agentId:b,corpId:c,appKey:d}){
|
|
9
|
+
appId = a
|
|
10
|
+
agentId = b
|
|
11
|
+
corpId = c
|
|
12
|
+
appKey = d
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
function getAppType() {
|
|
17
|
+
let ua = navigator.userAgent.toLowerCase();
|
|
18
|
+
let isWxWork = ua.match(/WxWork/i) == 'wxwork';
|
|
19
|
+
if (isWxWork) {
|
|
20
|
+
return '20'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let isWx = ua.match(/MicroMessenger/i) == 'micromessenger';
|
|
24
|
+
if (isWx) {
|
|
25
|
+
if(agentId){//如果有agentId认为是企业微信
|
|
26
|
+
return '20'
|
|
27
|
+
}
|
|
28
|
+
return '10'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (dd.env.platform != 'notInDingTalk') {
|
|
32
|
+
return '30'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return ''
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getJsConfig(){
|
|
39
|
+
let url = window.location.href.split('#')[0]
|
|
40
|
+
return new Promise((resolve, reject)=>{
|
|
41
|
+
axios.post(config.platformServerContext + '/api/weixin/getJsConfig', {
|
|
42
|
+
appType: getAppType(),
|
|
43
|
+
appId: appId,
|
|
44
|
+
agentId: agentId,
|
|
45
|
+
corpId: corpId,
|
|
46
|
+
appKey: appKey,
|
|
47
|
+
url: url
|
|
48
|
+
}).then((resp) => {
|
|
49
|
+
resolve(resp.data)
|
|
50
|
+
}).catch((error) => {
|
|
51
|
+
reject(error)
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function configWx(){
|
|
57
|
+
return new Promise((resolve, reject) =>{
|
|
58
|
+
getJsConfig().then((resp)=>{
|
|
59
|
+
wx.config({
|
|
60
|
+
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
61
|
+
appId: appId, // 必填,公众号的唯一标识
|
|
62
|
+
timestamp: resp.timestamp, // 必填,生成签名的时间戳
|
|
63
|
+
nonceStr: resp.noncestr, // 必填,生成签名的随机串
|
|
64
|
+
signature: resp.signature, // 必填,签名
|
|
65
|
+
jsApiList: ['chooseImage', 'uploadImage', 'downloadImage', 'getLocalImgData', 'openLocation', 'getLocation', 'scanQRCode', 'chooseWXPay', 'onHistoryBack','invoke','onLocationChange','previewFile'] // 必填,需要使用的JS接口列表
|
|
66
|
+
//jsApiList: ['chooseImage', 'uploadImage', 'downloadImage', 'getLocalImgData', 'openLocation', 'getLocation', 'scanQRCode', 'chooseWXPay', 'onHistoryBack','startLocationUpdateBackground','startLocationUpdate','onLocationChange','offLocationChange'] // 必填,需要使用的JS接口列表
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
wx.ready(() => {
|
|
70
|
+
console.log('初始化js-sdk成功');
|
|
71
|
+
resolve()
|
|
72
|
+
});
|
|
73
|
+
wx.error(res => {
|
|
74
|
+
console.log('初始化js-sdk失败' + res.errMsg);
|
|
75
|
+
console.log('友情提示:若想成功,则需通过params传参(而不是query)!!!');
|
|
76
|
+
reject('初始化js-sdk失败' + res.errMsg)
|
|
77
|
+
});
|
|
78
|
+
}).catch((error)=>{
|
|
79
|
+
reject('请求服务端jssdk签名失败:'+error)
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function configDd(){
|
|
85
|
+
return new Promise((resolve, reject)=>{
|
|
86
|
+
getJsConfig().then((resp)=>{
|
|
87
|
+
//钉钉js-api配置
|
|
88
|
+
console.log("当前页面:"+location.href);
|
|
89
|
+
dd.config({
|
|
90
|
+
agentId:agentId,
|
|
91
|
+
corpId: corpId, // 必填,公众号的唯一标识
|
|
92
|
+
timeStamp: resp.timestamp, // 必填,生成签名的时间戳
|
|
93
|
+
nonceStr: resp.noncestr, // 必填,生成签名的随机串
|
|
94
|
+
signature: resp.signature, // 必填,签名
|
|
95
|
+
jsApiList: [
|
|
96
|
+
'getDeviceUUID',
|
|
97
|
+
'getLocation',
|
|
98
|
+
|
|
99
|
+
] // 必填,需要使用的jsapi列表,注意:不要带dd。
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
dd.ready(() => {
|
|
103
|
+
console.log('初始化钉钉 js-sdk成功');
|
|
104
|
+
resolve()
|
|
105
|
+
});
|
|
106
|
+
dd.error(res => {
|
|
107
|
+
console.log('初始化钉钉 js-sdk失败' + JSON.stringify(res));
|
|
108
|
+
console.log('友情提示:若想成功,则需通过params传参(而不是query)!!!');
|
|
109
|
+
reject('初始化钉钉 js-sdk失败' + JSON.stringify(res))
|
|
110
|
+
});
|
|
111
|
+
}).catch((error)=>{
|
|
112
|
+
reject('请求服务端jssdk签名失败:'+error)
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let JsSDK = (function () {
|
|
118
|
+
function scanQRCode(){
|
|
119
|
+
return new Promise((resolve, reject) =>{
|
|
120
|
+
if(getAppType() === '30'){
|
|
121
|
+
dd.scan({
|
|
122
|
+
type: 'all',
|
|
123
|
+
success: (res) => {
|
|
124
|
+
console.log('钉钉扫码结果',res)
|
|
125
|
+
resolve(res.text)
|
|
126
|
+
},
|
|
127
|
+
fail: (err) => {
|
|
128
|
+
console.log('钉钉扫码失败',err)
|
|
129
|
+
reject('钉钉扫码失败:'+err)
|
|
130
|
+
},
|
|
131
|
+
complete: () => {},
|
|
132
|
+
});
|
|
133
|
+
}else{
|
|
134
|
+
configWx().then(()=>{
|
|
135
|
+
wx.scanQRCode({
|
|
136
|
+
desc: 'scanQRCode desc',
|
|
137
|
+
needResult: 1,
|
|
138
|
+
scanType: ["qrCode", "barCode"],
|
|
139
|
+
success: function (resp) {
|
|
140
|
+
console.log("微信扫码结果:",resp)
|
|
141
|
+
let result = resp.resultStr
|
|
142
|
+
resolve(result)
|
|
143
|
+
},
|
|
144
|
+
fail: function (res) {
|
|
145
|
+
console.log("失败res=>",res)
|
|
146
|
+
if (res.errMsg.indexOf('function_not_exist') > 0) {
|
|
147
|
+
reject('版本过低请升级');
|
|
148
|
+
} else {
|
|
149
|
+
reject("微信扫码失败,请联系系统管理员!");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
}).catch((error)=>{
|
|
154
|
+
reject('微信扫码失败:'+error)
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
function getLocation(){
|
|
160
|
+
return new Promise((resolve, reject)=>{
|
|
161
|
+
if(getAppType() === '30'){
|
|
162
|
+
configDd().then(()=>{
|
|
163
|
+
dd.getLocation({
|
|
164
|
+
targetAccuracy: '200',
|
|
165
|
+
cacheTimeout: 20,
|
|
166
|
+
coordinate: '1',
|
|
167
|
+
useCache: true,
|
|
168
|
+
withReGeocode: true,
|
|
169
|
+
type: 1,
|
|
170
|
+
success: (res) => {
|
|
171
|
+
console.log('钉钉获取当前位置结果:', res)
|
|
172
|
+
resolve(res)
|
|
173
|
+
},
|
|
174
|
+
fail: (error) => {
|
|
175
|
+
console.log('钉钉获取位置失败:', error)
|
|
176
|
+
reject('钉钉获取位置失败:'+error)
|
|
177
|
+
},
|
|
178
|
+
complete: () => {},
|
|
179
|
+
})
|
|
180
|
+
}).catch((error)=>{
|
|
181
|
+
reject('钉钉获取位置失败:'+error)
|
|
182
|
+
})
|
|
183
|
+
}else{
|
|
184
|
+
configWx().then(()=>{
|
|
185
|
+
wx.getLocation({
|
|
186
|
+
type: 'gcj02', //获取gcj02的坐标
|
|
187
|
+
success: (res) => {
|
|
188
|
+
//res.longitude 获取经度
|
|
189
|
+
//res.latitude 获取纬度
|
|
190
|
+
console.log(res);
|
|
191
|
+
resolve(res)
|
|
192
|
+
}, fail: (res) => {
|
|
193
|
+
console.log("微信获取位置失败。"+JSON.stringify(res));
|
|
194
|
+
reject("微信获取位置失败" + JSON.stringify(res))
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}).catch((error)=>{
|
|
198
|
+
reject('微信获取位置失败:'+error)
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
function openLocation({longitude,latitude,name,address,scale= 15} = {}){
|
|
204
|
+
return new Promise((resolve, reject)=>{
|
|
205
|
+
if(getAppType() === '30'){
|
|
206
|
+
configDd().then(()=>{
|
|
207
|
+
dd.openLocation({
|
|
208
|
+
title: name,
|
|
209
|
+
address: address,
|
|
210
|
+
latitude: latitude,
|
|
211
|
+
longitude: longitude,
|
|
212
|
+
success: () => {},
|
|
213
|
+
fail: () => {},
|
|
214
|
+
complete: () => {},
|
|
215
|
+
});
|
|
216
|
+
resolve()
|
|
217
|
+
}).catch((error)=>{
|
|
218
|
+
reject('钉钉启动内置地图位置失败:'+error)
|
|
219
|
+
})
|
|
220
|
+
}else{
|
|
221
|
+
configWx().then(()=>{
|
|
222
|
+
wx.openLocation({
|
|
223
|
+
latitude: latitude,//目的地latitude
|
|
224
|
+
longitude: longitude,//目的地longitude
|
|
225
|
+
name: name,
|
|
226
|
+
address: address,
|
|
227
|
+
scale: scale//地图缩放大小,可根据情况具体调整
|
|
228
|
+
});
|
|
229
|
+
resolve()
|
|
230
|
+
}).catch((error)=>{
|
|
231
|
+
reject('微信启动内置地图失败:'+error)
|
|
232
|
+
})
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// 公开API
|
|
238
|
+
return {
|
|
239
|
+
init:init,
|
|
240
|
+
scanQRCode: scanQRCode,
|
|
241
|
+
getLocation:getLocation,
|
|
242
|
+
openLocation:openLocation
|
|
243
|
+
};
|
|
244
|
+
})();
|
|
245
|
+
|
|
246
|
+
export default JsSDK
|
|
247
|
+
|