eoss-ui 0.5.79 → 0.5.81-beta

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.
Files changed (131) hide show
  1. package/lib/button-group.js +279 -265
  2. package/lib/button.js +71 -69
  3. package/lib/calendar.js +2 -2
  4. package/lib/card.js +2 -2
  5. package/lib/cascader.js +2 -2
  6. package/lib/checkbox-group.js +71 -70
  7. package/lib/clients.js +11 -11
  8. package/lib/config/api.js +1 -0
  9. package/lib/data-table-form.js +69 -67
  10. package/lib/data-table.js +87 -80
  11. package/lib/date-picker.js +71 -69
  12. package/lib/dialog.js +71 -70
  13. package/lib/enterprise.js +2 -2
  14. package/lib/eoss-ui.common.js +5966 -986
  15. package/lib/error-page.js +2 -2
  16. package/lib/flow-group.js +71 -69
  17. package/lib/flow-list.js +74 -72
  18. package/lib/flow.js +95 -93
  19. package/lib/form.js +179 -98
  20. package/lib/handle-user.js +72 -70
  21. package/lib/handler.js +75 -73
  22. package/lib/icon.js +3731 -12
  23. package/lib/icons.js +3 -3
  24. package/lib/index.js +1 -1
  25. package/lib/input-number.js +71 -69
  26. package/lib/input.js +71 -73
  27. package/lib/label.js +2 -2
  28. package/lib/layout.js +2 -2
  29. package/lib/login.js +146 -106
  30. package/lib/main.js +5663 -844
  31. package/lib/menu.js +2 -2
  32. package/lib/nav.js +71 -69
  33. package/lib/notify.js +72 -70
  34. package/lib/page.js +71 -69
  35. package/lib/pagination.js +2 -2
  36. package/lib/player.js +75 -73
  37. package/lib/qr-code.js +73 -71
  38. package/lib/radio-group.js +71 -69
  39. package/lib/retrial-auth.js +73 -71
  40. package/lib/select-ganged.js +71 -69
  41. package/lib/select.js +71 -69
  42. package/lib/selector-panel.js +74 -73
  43. package/lib/selector.js +80 -78
  44. package/lib/sizer.js +71 -69
  45. package/lib/steps.js +71 -69
  46. package/lib/switch.js +78 -76
  47. package/lib/table-form.js +71 -69
  48. package/lib/tabs-panel.js +2 -2
  49. package/lib/tabs.js +71 -69
  50. package/lib/theme-chalk/base.css +1 -1
  51. package/lib/theme-chalk/clients.css +1 -1
  52. package/lib/theme-chalk/data-table.css +1 -1
  53. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  54. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  55. package/lib/theme-chalk/form.css +1 -1
  56. package/lib/theme-chalk/icon.css +1 -1
  57. package/lib/theme-chalk/index.css +1 -1
  58. package/lib/theme-chalk/login.css +1 -1
  59. package/lib/theme-chalk/main.css +1 -1
  60. package/lib/theme-chalk/menu.css +1 -1
  61. package/lib/theme-chalk/simplicity.css +1 -0
  62. package/lib/theme-chalk/sizer.css +1 -1
  63. package/lib/theme-chalk/upload.css +1 -1
  64. package/lib/tips.js +72 -70
  65. package/lib/toolbar.js +2 -2
  66. package/lib/tree-group.js +71 -69
  67. package/lib/tree.js +71 -69
  68. package/lib/upload.js +146 -118
  69. package/lib/utils/util.js +2 -2
  70. package/lib/wujie.js +71 -69
  71. package/lib/wxlogin.js +214 -212
  72. package/package.json +3 -3
  73. package/packages/clients/src/main.vue +7 -7
  74. package/packages/data-table/src/main.vue +17 -5
  75. package/packages/form/src/main.vue +27 -13
  76. package/packages/handler/src/main.vue +3 -1
  77. package/packages/icon/src/main.vue +31 -10
  78. package/packages/icons/src/icon.json +1 -1
  79. package/packages/input/src/main.vue +0 -4
  80. package/packages/login/src/main.vue +13 -7
  81. package/packages/main/src/default/index.vue +2199 -0
  82. package/packages/main/src/main.vue +30 -2209
  83. package/packages/main/src/simplicity/apps.vue +301 -0
  84. package/packages/main/src/simplicity/avatar.vue +68 -0
  85. package/packages/main/src/simplicity/handler.vue +148 -0
  86. package/packages/main/src/simplicity/index.vue +1515 -0
  87. package/packages/main/src/simplicity/lists.vue +84 -0
  88. package/packages/main/src/simplicity/menu-list.vue +74 -0
  89. package/packages/main/src/simplicity/message.vue +237 -0
  90. package/packages/main/src/simplicity/notice.vue +145 -0
  91. package/packages/main/src/simplicity/settings.vue +119 -0
  92. package/packages/main/src/simplicity/sub-menu.vue +120 -0
  93. package/packages/main/src/simplicity/user.vue +243 -0
  94. package/packages/main/src/simplicity/userinfo.vue +302 -0
  95. package/packages/theme-chalk/lib/base.css +1 -1
  96. package/packages/theme-chalk/lib/clients.css +1 -1
  97. package/packages/theme-chalk/lib/data-table.css +1 -1
  98. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  99. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  100. package/packages/theme-chalk/lib/form.css +1 -1
  101. package/packages/theme-chalk/lib/icon.css +1 -1
  102. package/packages/theme-chalk/lib/index.css +1 -1
  103. package/packages/theme-chalk/lib/login.css +1 -1
  104. package/packages/theme-chalk/lib/main.css +1 -1
  105. package/packages/theme-chalk/lib/menu.css +1 -1
  106. package/packages/theme-chalk/lib/simplicity.css +1 -0
  107. package/packages/theme-chalk/lib/sizer.css +1 -1
  108. package/packages/theme-chalk/lib/upload.css +1 -1
  109. package/packages/theme-chalk/src/base.scss +1 -0
  110. package/packages/theme-chalk/src/clients.scss +1 -1
  111. package/packages/theme-chalk/src/common/var.scss +4 -0
  112. package/packages/theme-chalk/src/data-table.scss +3 -0
  113. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  114. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  115. package/packages/theme-chalk/src/form.scss +2 -2
  116. package/packages/theme-chalk/src/icon.scss +4 -4
  117. package/packages/theme-chalk/src/login.scss +644 -632
  118. package/packages/theme-chalk/src/main.scss +6 -2
  119. package/packages/theme-chalk/src/simplicity.scss +545 -0
  120. package/packages/upload/src/main.vue +132 -80
  121. package/src/config/api.js +1 -0
  122. package/src/index.js +1 -1
  123. package/src/utils/util.js +2 -2
  124. package/lib/theme-chalk/mainComp.css +0 -0
  125. package/packages/main/src/async-component/index.vue +0 -87
  126. package/packages/theme-chalk/lib/mainComp.css +0 -0
  127. package/packages/theme-chalk/src/mainComp.scss +0 -0
  128. /package/packages/main/src/{message.vue → default/message.vue} +0 -0
  129. /package/packages/main/src/{notice.vue → default/notice.vue} +0 -0
  130. /package/packages/main/src/{settings.vue → default/settings.vue} +0 -0
  131. /package/packages/main/src/{userinfo.vue → default/userinfo.vue} +0 -0
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <div v-for="(item, index) in data" :key="item.id" @click="handleClick(item)">
3
+ <div
4
+ class="es-simplicity-menus-item"
5
+ :class="{
6
+ 'is-active': active === item.id,
7
+ 'is-open': openId === item.id
8
+ }"
9
+ >
10
+ <es-icon
11
+ class="es-simplicity_apps-icon"
12
+ :style="setStyle(index)"
13
+ :contents="item.icons || item.icon || menuIcon"
14
+ ></es-icon>
15
+ <div class="es-simplicity-menus-tips" v-if="item.tips">
16
+ {{ item.tips > 99 ? '99+' : item.tips }}
17
+ </div>
18
+ <div class="es-simplicity_apps-text">
19
+ {{ item.text || item.name }}
20
+ </div>
21
+ </div>
22
+ <lists
23
+ v-if="
24
+ (item.children && item.children.length) ||
25
+ (item.fourthTabs && item.fourthTabs.length)
26
+ "
27
+ :menuIcon="menuIcon"
28
+ :color="color"
29
+ :backgroundColor="backgroundColor"
30
+ :data="[...(item.children || []), ...(item.fourthTabs || [])]"
31
+ ></lists>
32
+ </div>
33
+ </template>
34
+
35
+ <script>
36
+ export default {
37
+ name: 'Lists',
38
+ components: {},
39
+ props: {
40
+ menuIcon: String,
41
+ color: [String, Array],
42
+ backgroundColor: [String, Array],
43
+ data: Array
44
+ },
45
+ data() {
46
+ return {
47
+ active: '',
48
+ openId: ''
49
+ };
50
+ },
51
+ computed: {},
52
+ watch: {},
53
+ created() {},
54
+ mounted() {},
55
+ methods: {
56
+ setStyle(num) {
57
+ let obj = {};
58
+ if (this.color) {
59
+ obj.color = this.color;
60
+ if (Array.isArray(this.color)) {
61
+ obj.color = this.color[num % this.color.length];
62
+ } else {
63
+ obj.color = this.color;
64
+ }
65
+ }
66
+ if (this.backgroundColor) {
67
+ if (Array.isArray(this.backgroundColor)) {
68
+ obj.backgroundColor =
69
+ this.backgroundColor[num % this.backgroundColor.length];
70
+ } else {
71
+ obj.backgroundColor = this.backgroundColor;
72
+ }
73
+ }
74
+ return obj;
75
+ },
76
+ handleClick(res) {
77
+ this.active = res.id;
78
+ this.$emit('command', res);
79
+ }
80
+ }
81
+ };
82
+ </script>
83
+
84
+ <style lang="scss" scoped></style>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <el-scrollbar>
3
+ <div
4
+ class="es-simplicity-menus-item"
5
+ v-for="(item, index) in data"
6
+ :key="item.id"
7
+ :class="{ 'is-active': active === item.id }"
8
+ @click="handleClick(item)"
9
+ >
10
+ <es-icon
11
+ class="es-simplicity_apps-icon"
12
+ :style="setStyle(index)"
13
+ :contents="item.icons || item.icon || menuIcon"
14
+ ></es-icon>
15
+ <div class="es-simplicity-menus-tips" v-if="item.tips">
16
+ {{ item.tips > 99 ? '99+' : item.tips }}
17
+ </div>
18
+ <div class="es-simplicity_apps-text">
19
+ {{ item.text || item.name }}
20
+ </div>
21
+ </div>
22
+ </el-scrollbar>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: 'MenuList',
28
+ components: {},
29
+ props: {
30
+ index: [Number, String],
31
+ menuIcon: String,
32
+ color: [String, Array],
33
+ backgroundColor: [String, Array],
34
+ data: Array
35
+ },
36
+ data() {
37
+ return {
38
+ active: ''
39
+ };
40
+ },
41
+ computed: {},
42
+ watch: {},
43
+ created() {},
44
+ mounted() {},
45
+ methods: {
46
+ setStyle(num) {
47
+ let obj = {};
48
+ if (this.color) {
49
+ obj.color = this.color;
50
+ if (Array.isArray(this.color)) {
51
+ obj.color = this.color[num % this.color.length];
52
+ } else {
53
+ obj.color = this.color;
54
+ }
55
+ }
56
+ if (this.backgroundColor) {
57
+ if (Array.isArray(this.backgroundColor)) {
58
+ obj.backgroundColor =
59
+ this.backgroundColor[num % this.backgroundColor.length];
60
+ } else {
61
+ obj.backgroundColor = this.backgroundColor;
62
+ }
63
+ }
64
+ return obj;
65
+ },
66
+ handleClick(res) {
67
+ this.active = res.id;
68
+ this.$emit('command', res, this.index);
69
+ }
70
+ }
71
+ };
72
+ </script>
73
+
74
+ <style lang="scss" scoped></style>
@@ -0,0 +1,237 @@
1
+ <template>
2
+ <el-drawer
3
+ class="es-msgs-box"
4
+ custom-class="es-msgs-main"
5
+ direction="rtl"
6
+ size="200px"
7
+ :modal="false"
8
+ :withHeader="false"
9
+ :visible.sync="show"
10
+ >
11
+ <div class="es-msg-header">
12
+ <span class="es-msg-title">消息提示</span>
13
+ <span class="es-overlook" @click="handleIgnoreAll">全部忽略</span>
14
+ </div>
15
+ <div class="es-msg-lists-box">
16
+ <div class="es-msg-lists">
17
+ <el-scrollbar class="es-scrollbar">
18
+ <div v-infinite-scroll="getMsg" :infinite-scroll-disabled="disabled">
19
+ <el-card
20
+ v-for="(item, index) in msgs"
21
+ :key="item.id"
22
+ class="es-msg-item"
23
+ >
24
+ <i
25
+ class="el-icon-circle-close"
26
+ title="忽略"
27
+ @click="handleIgnore(item, index)"
28
+ ></i>
29
+ <div class="es-msg-item-title">{{ item.title }}</div>
30
+ <div>
31
+ <span class="es-msg-item-time">{{ item.time }}</span>
32
+ <span
33
+ class="es-overlook"
34
+ v-show="item.handlerUrl"
35
+ @click="handleMessage(item, index)"
36
+ >处理</span
37
+ >
38
+ </div>
39
+ </el-card>
40
+ <p class="es-msg-tips" v-if="loading">加载中...</p>
41
+ <p class="es-msg-tips" v-if="noMore && count > 0">没有更多了</p>
42
+ </div>
43
+ </el-scrollbar>
44
+ </div>
45
+ </div>
46
+ <div class="es-msg-total">当前共有{{ count }}条消息记录</div>
47
+ <es-dialog
48
+ title="处理"
49
+ name="manage"
50
+ width="90%"
51
+ height="80%"
52
+ :visible.sync="dialog.show"
53
+ :url="dialog.url"
54
+ :param="dialog.params"
55
+ ></es-dialog>
56
+ </el-drawer>
57
+ </template>
58
+ <script>
59
+ import {
60
+ sysMsgPage,
61
+ ignoreSysMsg,
62
+ ignoreAllSysMsg
63
+ } from 'eoss-ui/src/config/api.js';
64
+ import util from 'eoss-ui/src/utils/util';
65
+ export default {
66
+ name: 'message',
67
+ provide() {
68
+ return {
69
+ deleteMessage: this.handleRemove
70
+ };
71
+ },
72
+ props: {
73
+ visible: Boolean,
74
+ total: {
75
+ type: Number,
76
+ default: 0
77
+ },
78
+ winopen: Boolean
79
+ },
80
+ computed: {
81
+ show: {
82
+ get() {
83
+ return this.visible;
84
+ },
85
+ set(val) {
86
+ this.$emit('update:visible', val);
87
+ }
88
+ },
89
+ count: {
90
+ get() {
91
+ return this.total;
92
+ },
93
+ set(val) {
94
+ this.$emit('update:total', val);
95
+ }
96
+ },
97
+ noMore() {
98
+ return this.msgs.length >= this.count;
99
+ },
100
+ disabled() {
101
+ return this.loading || this.noMore;
102
+ }
103
+ },
104
+ watch: {
105
+ total(val, old) {
106
+ if (parseInt(val, 10) < parseInt(old, 10) && this.index !== null) {
107
+ this.handleRemove();
108
+ }
109
+ }
110
+ },
111
+ data() {
112
+ return {
113
+ //加载数据
114
+ loading: false,
115
+ //消息页码
116
+ pageNum: 1,
117
+ pageSize: 20,
118
+ pageCount: 1,
119
+ //消息数据,
120
+ msgs: [],
121
+ dialog: {
122
+ params: {},
123
+ url: '',
124
+ show: false
125
+ },
126
+ index: null,
127
+ deleteId: null
128
+ };
129
+ },
130
+ mounted() {
131
+ util.win.deleteMsg = this.handleRemove;
132
+ },
133
+ methods: {
134
+ //获取消息列表
135
+ getMsg(reload) {
136
+ if (this.pageNum <= this.pageCount) {
137
+ this.loading = true;
138
+ util
139
+ .ajax({
140
+ url: sysMsgPage,
141
+ params: {
142
+ pageNum: reload ? 1 : this.pageNum,
143
+ pageSize: this.pageSize
144
+ }
145
+ })
146
+ .then((res) => {
147
+ if (res && res.rCode === 0) {
148
+ this.pageCount = res.results.pageCount;
149
+ this.loading = false;
150
+ if (reload || this.pageNum == 1) {
151
+ this.msgs = JSON.parse(JSON.stringify(res.results.records));
152
+ } else {
153
+ this.msgs = this.msgs.concat(res.results.records);
154
+ }
155
+ this.pageNum++;
156
+ } else {
157
+ let msg = res.msg || '系统错误,请联系管理员!';
158
+ this.$message.error(msg);
159
+ }
160
+ })
161
+ .catch((err) => {
162
+ this.loading = false;
163
+ if (err.message && err.message !== 'canceled') {
164
+ this.$message.error(err.message);
165
+ }
166
+ });
167
+ }
168
+ },
169
+ //忽略
170
+ handleIgnore(res, i) {
171
+ util
172
+ .ajax({
173
+ url: ignoreSysMsg,
174
+ params: {
175
+ id: res.id
176
+ }
177
+ })
178
+ .then((res) => {
179
+ if (res.rCode == 0) {
180
+ this.count -= 1;
181
+ this.msgs.splice(i, 1);
182
+ } else {
183
+ let msg = res.msg || '系统错误,请联系管理员!';
184
+ this.$message.error(msg);
185
+ }
186
+ });
187
+ },
188
+ //全部忽略
189
+ handleIgnoreAll() {
190
+ util
191
+ .ajax({
192
+ url: ignoreAllSysMsg
193
+ })
194
+ .then((res) => {
195
+ this.count = 0;
196
+ this.msgs = [];
197
+ this.$emit('ignore', { type: 'ignore', value: 'all' });
198
+ })
199
+ .catch((err) => {
200
+ if (err.message && err.message !== 'canceled') {
201
+ this.$message.error(err.message);
202
+ }
203
+ });
204
+ },
205
+ //处理消息
206
+ handleMessage(item, index) {
207
+ this.count -= 1;
208
+ this.msgs.splice(index, 1);
209
+ if (this.winopen) {
210
+ util.win.open(item.handlerUrl);
211
+ } else {
212
+ this.dialog = {
213
+ show: true,
214
+ url: item.handlerUrl,
215
+ data: {
216
+ id: item.id,
217
+ pendingId: item.pendingId,
218
+ userId: item.userId
219
+ }
220
+ };
221
+ this.index = index;
222
+ }
223
+ },
224
+ handleRemove(id) {
225
+ if (this.index !== null) {
226
+ this.count -= 1;
227
+ this.msgs.splice(this.index, 1);
228
+ this.index = null;
229
+ }
230
+ if (id) {
231
+ this.$emit('handle', id);
232
+ }
233
+ this.dialog.show = false;
234
+ }
235
+ }
236
+ };
237
+ </script>
@@ -0,0 +1,145 @@
1
+ <template>
2
+ <transition name="el-drawer-fade" @after-enter="handleMouse(false)">
3
+ <div
4
+ class="es-notice-box"
5
+ v-show="data.length"
6
+ @mouseover="handleMouse(true)"
7
+ @mouseout="handleMouse(false)"
8
+ >
9
+ <div class="es-msgs-box" :class="{ 'es-in': data.length }">
10
+ <div class="es-msg-header">
11
+ <span class="es-notice-title">通知消息</span>
12
+ </div>
13
+ <div class="es-msg-lists-box">
14
+ <div class="es-msg-lists">
15
+ <el-scrollbar class="es-scrollbar">
16
+ <el-card
17
+ v-for="(item, index) in data"
18
+ :key="item.id"
19
+ class="es-msg-item"
20
+ >
21
+ <div class="es-msg-item-title">{{ item.title }}</div>
22
+ <div>
23
+ <span class="es-msg-item-time">{{ item.time }}</span>
24
+ <span
25
+ class="es-overlook"
26
+ v-show="item.handlerUrl"
27
+ @click="handleMessage(item, index)"
28
+ >处理</span
29
+ >
30
+ </div>
31
+ </el-card>
32
+ </el-scrollbar>
33
+ </div>
34
+ </div>
35
+ <div
36
+ class="es-notice-footer"
37
+ style="display:flex;justify-content: space-between;"
38
+ >
39
+ <span @click="handleIgnoreAll">忽略全部</span
40
+ ><span @click="afterEnter">我知道了</span>
41
+ </div>
42
+ </div>
43
+ <es-dialog
44
+ title="处理"
45
+ name="manage"
46
+ width="90%"
47
+ height="80%"
48
+ :visible.sync="dialog.show"
49
+ :url="dialog.url"
50
+ :param="dialog.params"
51
+ ></es-dialog>
52
+ </div>
53
+ </transition>
54
+ </template>
55
+ <script>
56
+ import { ignoreAllSysMsg } from 'eoss-ui/src/config/api.js';
57
+ import util from 'eoss-ui/src/utils/util';
58
+ export default {
59
+ name: 'notice',
60
+ provide() {
61
+ return {
62
+ deleteNotice: this.handleRemove
63
+ };
64
+ },
65
+ props: {
66
+ visible: Boolean,
67
+ winopen: Boolean,
68
+ data: {
69
+ type: Array,
70
+ default() {
71
+ return [];
72
+ }
73
+ }
74
+ },
75
+ computed: {},
76
+ data() {
77
+ return {
78
+ //加载数据
79
+ loading: false,
80
+ //消息页码
81
+ pageNum: 1,
82
+ //消息数据,
83
+ msgs: [],
84
+ //即时消息
85
+ sysMsg: '',
86
+ dialog: {
87
+ params: {},
88
+ url: '',
89
+ show: false
90
+ },
91
+ index: null
92
+ };
93
+ },
94
+ methods: {
95
+ afterEnter() {
96
+ this.$emit('opened');
97
+ },
98
+ handleMouse(flag) {
99
+ this.$emit('opened', flag);
100
+ },
101
+ //全部忽略
102
+ handleIgnoreAll() {
103
+ util
104
+ .ajax({
105
+ url: ignoreAllSysMsg
106
+ })
107
+ .then(res => {
108
+ this.count = 0;
109
+ this.msgs = [];
110
+ this.$emit('ignore', { type: 'ignore', value: 'all' });
111
+ this.$emit('opened', false);
112
+ })
113
+ .catch(err => {
114
+ if (err.message && err.message !== 'canceled') {
115
+ this.$message.error(err.message);
116
+ }
117
+ });
118
+ },
119
+ //处理消息
120
+ handleMessage(item, index) {
121
+ if (item.urlopenmode === 1 || this.winopen) {
122
+ util.win.open(item.handlerUrl);
123
+ } else {
124
+ this.dialog = {
125
+ show: true,
126
+ url: item.handlerUrl,
127
+ params: {
128
+ id: item.id,
129
+ pendingId: item.pendingId,
130
+ userId: item.userId
131
+ }
132
+ };
133
+ this.index = index;
134
+ }
135
+ },
136
+ handleRemove() {
137
+ if (this.index === null) {
138
+ this.count -= 1;
139
+ this.msgs = this.msgs.splice(this.index, 1);
140
+ }
141
+ this.dialog.show = false;
142
+ }
143
+ }
144
+ };
145
+ </script>
@@ -0,0 +1,119 @@
1
+ <template>
2
+ <el-drawer
3
+ title="设置"
4
+ custom-class="es-sets-drawer"
5
+ size="280px"
6
+ :visible.sync="show"
7
+ :append-to-body="true"
8
+ >
9
+ <div class="es-setting-item">
10
+ <div class="es-setting-title">主题色</div>
11
+ <el-radio-group
12
+ v-if="themes"
13
+ v-model="color"
14
+ size="mini"
15
+ class="es-setting-theme"
16
+ @change="handleTheme"
17
+ >
18
+ <el-radio-button
19
+ v-for="(item, index) in themes"
20
+ :key="index"
21
+ :label="index"
22
+ :style="{ backgroundColor: item }"
23
+ >
24
+ <i class="el-icon-check"></i>
25
+ </el-radio-button>
26
+ </el-radio-group>
27
+ <div class="es-color-picker" v-else>
28
+ <el-color-picker
29
+ v-model="color"
30
+ :predefine="predefineColor"
31
+ @change="handleTheme"
32
+ ></el-color-picker>
33
+ <div class="el-color-picker-tip">请不要选择偏白或者偏黑的颜色</div>
34
+ </div>
35
+ </div>
36
+ </el-drawer>
37
+ </template>
38
+ <script>
39
+ import util from 'eoss-ui/src/utils/util';
40
+ export default {
41
+ name: 'message',
42
+ props: {
43
+ visible: Boolean,
44
+ //主题颜色选择颜色集合
45
+ themes: Array,
46
+ //默认主题色
47
+ theme: String,
48
+ //颜色板预设颜色
49
+ predefine: {
50
+ type: Array,
51
+ default() {
52
+ return ['#a60006', '#409eff'];
53
+ }
54
+ },
55
+ layout: {
56
+ type: String,
57
+ default: 'default'
58
+ }
59
+ },
60
+ computed: {
61
+ show: {
62
+ get() {
63
+ return this.visible;
64
+ },
65
+ set(val) {
66
+ this.$emit('update:visible', val);
67
+ }
68
+ },
69
+ //颜色板预设颜色
70
+ predefineColor() {
71
+ if (
72
+ this.theme &&
73
+ this.predefine.indexOf(this.theme.toLowerCase()) === -1
74
+ ) {
75
+ let arry = this.predefine;
76
+ arry.push(this.theme);
77
+ return arry;
78
+ }
79
+ return this.predefine;
80
+ }
81
+ },
82
+ watch: {
83
+ theme: {
84
+ immediate: true,
85
+ handler(val) {
86
+ if (val) {
87
+ this.color = val;
88
+ }
89
+ }
90
+ }
91
+ },
92
+ data() {
93
+ return {
94
+ color: '',
95
+ activeName: this.layout
96
+ };
97
+ },
98
+ mounted() {},
99
+ methods: {
100
+ //选择主题颜色
101
+ handleTheme(res) {
102
+ res = res.toLowerCase();
103
+ // const rgb = util.getRgb(res);
104
+ // const luma = 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2];
105
+ util.updateTheme(res);
106
+ this.color = res;
107
+ this.$emit('change', { type: 'theme', value: res });
108
+ //this.setTheme(res);
109
+ },
110
+ //选择菜单布局
111
+ handleLayout(res) {
112
+ let old = this.activeName;
113
+ this.activeName = res;
114
+ this.$emit('update:layout', res);
115
+ this.$emit('layout', res, old);
116
+ }
117
+ }
118
+ };
119
+ </script>