xs-common-plugins 1.2.2 → 1.2.3

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 (56) hide show
  1. package/README.md +298 -298
  2. package/common.js +110 -110
  3. package/index.js +1 -1
  4. package/package.json +16 -16
  5. package/src/common/common.js +548 -548
  6. package/src/components/CheckBox_Cmp/index.vue +62 -62
  7. package/src/components/FormItem/index.vue +92 -92
  8. package/src/components/ReportCmp/index.vue +76 -76
  9. package/src/components/Search/index.scss +219 -219
  10. package/src/components/Search/index.vue +410 -410
  11. package/src/components/Search/product_option/index.scss +1 -1
  12. package/src/components/Search_filter/index.scss +104 -104
  13. package/src/components/TableItem/TableItem.vue +55 -55
  14. package/src/components/TextOVer/index.vue +55 -55
  15. package/src/components/UploadImg/index.vue +177 -177
  16. package/src/components/im/index.vue +155 -155
  17. package/src/components/im/pages/chatList/index.vue +45 -45
  18. package/src/components/im/pages/chatRoom/index.vue +159 -159
  19. package/src/components/xsSelect/index.vue +125 -125
  20. package/src/mixin/keepAlive.js +52 -0
  21. package/src/plugins/im/components/chat/index.scss +163 -163
  22. package/src/plugins/im/components/chat/index.vue +144 -144
  23. package/src/plugins/im/components/chat/methods.js +149 -149
  24. package/src/plugins/im/components/msg-image/index.vue +40 -40
  25. package/src/plugins/im/components/send-msg/index.scss +164 -164
  26. package/src/plugins/im/components/send-msg/index.vue +107 -107
  27. package/src/plugins/im/components/send-msg/methods.js +125 -125
  28. package/src/plugins/im/components/template-message/index.vue +76 -76
  29. package/src/plugins/im/components/without.vue +19 -19
  30. package/src/plugins/im/index.js +31 -31
  31. package/src/plugins/im/utils/services.js +625 -625
  32. package/src/plugins/index.js +60 -60
  33. package/src/plugins/row-col-cmp/index.js +20 -20
  34. package/src/router/permission.js +126 -126
  35. package/src/store/modules/dic.js +74 -74
  36. package/src/store/modules/oss.js +40 -40
  37. package/src/styles/index.scss +91 -91
  38. package/src/styles/table.scss +90 -90
  39. package/src/utils/api.js +54 -54
  40. package/src/utils/auth.js +38 -38
  41. package/src/utils/concat_batch_btns.js +88 -88
  42. package/src/utils/enum.js +150 -150
  43. package/src/utils/filter.js +5 -5
  44. package/src/utils/filterRules.js +55 -55
  45. package/src/utils/getMenu.js +82 -82
  46. package/src/utils/global_directive.js +10 -0
  47. package/src/utils/ossService.js +55 -55
  48. package/src/utils/prototype.js +46 -46
  49. package/src/utils/search.js +33 -33
  50. package/src/utils/signalR.js +24 -24
  51. package/src/views/callback/index.vue +35 -35
  52. package/src/views/home/index.vue +25 -25
  53. package/src/views/layout/components/AppMain.vue +21 -5
  54. package/src/views/layout/components/Navbar.vue +20 -13
  55. package/src/views/layout/components/TagsView/index.vue +130 -91
  56. package/src/views/slienceAuth/index.vue +42 -42
@@ -1,177 +1,177 @@
1
- <template>
2
- <div class="pro-upload-wrapper">
3
- <el-upload
4
- action="#"
5
- multiple
6
- :limit="limit"
7
- :http-request="httpRequest"
8
- list-type="picture-card"
9
- :on-preview="handlePictureCardPreview"
10
- :before-upload="handleBeforeUpload"
11
- :file-list="fileList"
12
- :class="{ hide: hiddenUpload }"
13
- :on-remove="handleRemove"
14
- >
15
- <i class="el-icon-plus"></i>
16
- </el-upload>
17
-
18
- <el-dialog :visible.sync="dialogVisible">
19
- <img :src="dialogImageUrl" alt />
20
- </el-dialog>
21
- </div>
22
- </template>
23
-
24
- <script>
25
- export default {
26
- $$route: {
27
- meta: {
28
- title: "标题名称",
29
- icon: "菜单图标",
30
- },
31
- },
32
- props: {
33
- value: {
34
- type: [Array, String],
35
- default: () => [],
36
- },
37
- fileUrls: {
38
- type: [Array, String],
39
- default: () => [],
40
- },
41
- limit: {
42
- type: Number,
43
- default: 1,
44
- },
45
- },
46
- data() {
47
- return {
48
- dialogImageUrl: '',
49
- dialogVisible: false,
50
- hiddenUpload: false,
51
- fileList: [],
52
-
53
- };
54
- },
55
- watch: {
56
- value: {
57
-
58
- handler(newVal) {
59
- if (typeof newVal === "string") {
60
- if (newVal) {
61
- this.fileList = [{ url: [newVal] }];
62
- } else {
63
- this.fileList = [];
64
- }
65
- } else if (newVal instanceof Array) {
66
- let list = [];
67
- newVal.forEach((item) => {
68
- list.push({ url: [item] });
69
- });
70
- this.fileList = list;
71
- }
72
- },
73
- immediate: true,
74
- deep: true,
75
- },
76
- fileList: {
77
- handler(newVal) {
78
- if (newVal.length == this.limit) {
79
- this.hiddenUpload = true;
80
- } else {
81
- this.hiddenUpload = false;
82
- }
83
- },
84
- immediate: true,
85
- deep: true,
86
- },
87
- },
88
- methods: {
89
- /**
90
- * 图片预览
91
- * @param {*} file
92
- */
93
- handlePictureCardPreview(file) {
94
- this.dialogImageUrl = file.url;
95
- this.dialogVisible = true;
96
- },
97
-
98
- /**
99
- * 删除图片
100
- * @param {*} file
101
- * @param {*} fileList
102
- */
103
- handleRemove(file, fileList) {
104
- this.fileList = fileList;
105
- if (fileList.length < this.limit) {
106
- this.hiddenUpload = false;
107
- }
108
- let fileValList = [];
109
- this.fileList.forEach((item) => {
110
- fileValList.push(item.url[0]);
111
- });
112
- this.$emit(
113
- "input",
114
- this.limit == 1 ? (fileValList[0] ? fileValList[0] : "") : fileValList
115
- );
116
- },
117
- /**
118
- * 覆盖默认的上传行为,自定义上传的实现
119
- * @param {*} data
120
- */
121
- httpRequest(data) {
122
- const that = this;
123
- let fd = new FormData();
124
- fd.append("files", data.file); //传文件
125
- this.$http
126
- .post("api.img.upload", fd, {
127
- headers: {
128
- "Content-Type": "multipart/form-data",
129
- },
130
- })
131
- .then(function (res) {
132
- if (res.code === 0) {
133
- that.fileList.push({
134
- url: res.data,
135
- });
136
- if (that.fileList.length >= that.limit) {
137
- that.hiddenUpload = true;
138
- }
139
- let fileValList = [];
140
- that.fileList.forEach((item) => {
141
- fileValList.push(item.url[0]);
142
- });
143
- that.$emit("input", that.limit == 1 ? fileValList[0] : fileValList);
144
- }
145
- });
146
- },
147
-
148
- /**
149
- * 图片上传之前
150
- */
151
- handleBeforeUpload(file) {
152
- const isFormat = /^image\/(jpeg|png|jpg|ico|gif)$/.test(file.type);
153
- const isLt4M = file.size / 1024 / 1024 < 4;
154
- if (!isFormat) {
155
- this.$message.error("上传图片只能是 JPEG/PNG/JPG/ICO/gif 格式!");
156
- }
157
- if (!isLt4M) {
158
- this.$message.error("上传图片大小不能超过 4MB!");
159
- }
160
- return isFormat && isLt4M;
161
- },
162
-
163
- handleDownload(file) {
164
- // console.log(file);
165
- },
166
- uploadSuccess() {},
167
- },
168
- };
169
- </script>
170
- <style scoped>
171
- .el-upload--picture-card {
172
- transform: scale(0.8);
173
- }
174
- .pro-upload-wrapper >>> .hide .el-upload--picture-card {
175
- display: none;
176
- }
177
- </style>
1
+ <template>
2
+ <div class="pro-upload-wrapper">
3
+ <el-upload
4
+ action="#"
5
+ multiple
6
+ :limit="limit"
7
+ :http-request="httpRequest"
8
+ list-type="picture-card"
9
+ :on-preview="handlePictureCardPreview"
10
+ :before-upload="handleBeforeUpload"
11
+ :file-list="fileList"
12
+ :class="{ hide: hiddenUpload }"
13
+ :on-remove="handleRemove"
14
+ >
15
+ <i class="el-icon-plus"></i>
16
+ </el-upload>
17
+
18
+ <el-dialog :visible.sync="dialogVisible">
19
+ <img :src="dialogImageUrl" alt />
20
+ </el-dialog>
21
+ </div>
22
+ </template>
23
+
24
+ <script>
25
+ export default {
26
+ $$route: {
27
+ meta: {
28
+ title: "标题名称",
29
+ icon: "菜单图标",
30
+ },
31
+ },
32
+ props: {
33
+ value: {
34
+ type: [Array, String],
35
+ default: () => [],
36
+ },
37
+ fileUrls: {
38
+ type: [Array, String],
39
+ default: () => [],
40
+ },
41
+ limit: {
42
+ type: Number,
43
+ default: 1,
44
+ },
45
+ },
46
+ data() {
47
+ return {
48
+ dialogImageUrl: '',
49
+ dialogVisible: false,
50
+ hiddenUpload: false,
51
+ fileList: [],
52
+
53
+ };
54
+ },
55
+ watch: {
56
+ value: {
57
+
58
+ handler(newVal) {
59
+ if (typeof newVal === "string") {
60
+ if (newVal) {
61
+ this.fileList = [{ url: [newVal] }];
62
+ } else {
63
+ this.fileList = [];
64
+ }
65
+ } else if (newVal instanceof Array) {
66
+ let list = [];
67
+ newVal.forEach((item) => {
68
+ list.push({ url: [item] });
69
+ });
70
+ this.fileList = list;
71
+ }
72
+ },
73
+ immediate: true,
74
+ deep: true,
75
+ },
76
+ fileList: {
77
+ handler(newVal) {
78
+ if (newVal.length == this.limit) {
79
+ this.hiddenUpload = true;
80
+ } else {
81
+ this.hiddenUpload = false;
82
+ }
83
+ },
84
+ immediate: true,
85
+ deep: true,
86
+ },
87
+ },
88
+ methods: {
89
+ /**
90
+ * 图片预览
91
+ * @param {*} file
92
+ */
93
+ handlePictureCardPreview(file) {
94
+ this.dialogImageUrl = file.url;
95
+ this.dialogVisible = true;
96
+ },
97
+
98
+ /**
99
+ * 删除图片
100
+ * @param {*} file
101
+ * @param {*} fileList
102
+ */
103
+ handleRemove(file, fileList) {
104
+ this.fileList = fileList;
105
+ if (fileList.length < this.limit) {
106
+ this.hiddenUpload = false;
107
+ }
108
+ let fileValList = [];
109
+ this.fileList.forEach((item) => {
110
+ fileValList.push(item.url[0]);
111
+ });
112
+ this.$emit(
113
+ "input",
114
+ this.limit == 1 ? (fileValList[0] ? fileValList[0] : "") : fileValList
115
+ );
116
+ },
117
+ /**
118
+ * 覆盖默认的上传行为,自定义上传的实现
119
+ * @param {*} data
120
+ */
121
+ httpRequest(data) {
122
+ const that = this;
123
+ let fd = new FormData();
124
+ fd.append("files", data.file); //传文件
125
+ this.$http
126
+ .post("api.img.upload", fd, {
127
+ headers: {
128
+ "Content-Type": "multipart/form-data",
129
+ },
130
+ })
131
+ .then(function (res) {
132
+ if (res.code === 0) {
133
+ that.fileList.push({
134
+ url: res.data,
135
+ });
136
+ if (that.fileList.length >= that.limit) {
137
+ that.hiddenUpload = true;
138
+ }
139
+ let fileValList = [];
140
+ that.fileList.forEach((item) => {
141
+ fileValList.push(item.url[0]);
142
+ });
143
+ that.$emit("input", that.limit == 1 ? fileValList[0] : fileValList);
144
+ }
145
+ });
146
+ },
147
+
148
+ /**
149
+ * 图片上传之前
150
+ */
151
+ handleBeforeUpload(file) {
152
+ const isFormat = /^image\/(jpeg|png|jpg|ico|gif)$/.test(file.type);
153
+ const isLt4M = file.size / 1024 / 1024 < 4;
154
+ if (!isFormat) {
155
+ this.$message.error("上传图片只能是 JPEG/PNG/JPG/ICO/gif 格式!");
156
+ }
157
+ if (!isLt4M) {
158
+ this.$message.error("上传图片大小不能超过 4MB!");
159
+ }
160
+ return isFormat && isLt4M;
161
+ },
162
+
163
+ handleDownload(file) {
164
+ // console.log(file);
165
+ },
166
+ uploadSuccess() {},
167
+ },
168
+ };
169
+ </script>
170
+ <style scoped>
171
+ .el-upload--picture-card {
172
+ transform: scale(0.8);
173
+ }
174
+ .pro-upload-wrapper >>> .hide .el-upload--picture-card {
175
+ display: none;
176
+ }
177
+ </style>
@@ -1,155 +1,155 @@
1
- <template>
2
- <div class="im-wrapper">
3
- <div class="switch">
4
- <span> {{ delivery ? '下线' : '上线' }}:</span>
5
- <el-switch v-model="delivery" @change="changeSwitch"></el-switch>
6
- </div>
7
- <chatList
8
- @chatroom="linkChatroom"
9
- v-if="isChatList"
10
- :conversationList="conversationList"
11
- ></chatList>
12
- <chatRoom v-else @goback="goback" :currentItem="currentItem"></chatRoom>
13
- </div>
14
- </template>
15
- <script>
16
- import chatList from './pages/chatList/index.vue'
17
- import chatRoom from './pages/chatRoom/index.vue'
18
-
19
- export default {
20
- $$route: {
21
- meta: {
22
- title: '标题名称',
23
- icon: '菜单图标',
24
- },
25
- },
26
- props: {},
27
- data() {
28
- return {
29
- isChatList: true,
30
- currentItem: null,
31
- conversationList: [],
32
- delivery: false,
33
- }
34
- },
35
- methods: {
36
- // 获取im token
37
- getImToken() {
38
- this.delivery = localStorage.getItem('delivery') == 'true' ? true : false
39
- if (!this.delivery) return
40
- this.$http.get('api.im.GetToken').then((res) => {
41
- this.initIm(res.data)
42
- localStorage.setItem('imToken', res.data)
43
- })
44
- },
45
- // im 初始化
46
- initIm(token) {
47
- const baseUrls = ['http://isvlp194.365xs.cn', 'http://erp.lp194.365xs.cn', 'http://erp.lp192.365xs.cn']
48
- let appkey = baseUrls.includes(location.origin) ? 'cpj2xarlcm61n' : 'pgyu6atqp289u'
49
-
50
- this.$Service.Init({
51
- appkey,
52
- token,
53
- })
54
- this.initRYConnect()
55
- },
56
- //链接
57
- initRYConnect() {
58
- const Status = this.$Service.Status
59
- const CONNECTION_STATUS = this.$Service.CONNECTION_STATUS
60
- Status.disconnect()
61
- Status.watch((status) => {
62
- switch (status) {
63
- case CONNECTION_STATUS.CONNECTED:
64
- this.getConversationList()
65
- break
66
- case CONNECTION_STATUS.NETWORK_UNAVAILABLE:
67
- this.$message('重连中...')
68
- break
69
- case CONNECTION_STATUS.KICKED_OFFLINE_BY_OTHER_CLIENT:
70
- this.$message('当前用户已在其他端登录...')
71
- break
72
- }
73
- })
74
- Status.connect({ name: '客服张三' })
75
- .then((user) => {
76
- console.log(' 链接成功', user)
77
- })
78
- .catch((error) => {
79
- console.log('连接失败', err)
80
- })
81
- },
82
- // 获取消息列表
83
- getConversationList() {
84
- this.$Service.Conversation.getList().then((list) => {
85
- let _list = []
86
- list.forEach((item) => {
87
- let avatarUrl
88
- if (item.latestMessage.content.userInfo) {
89
- avatarUrl = item.latestMessage.content.userInfo ? item.latestMessage.content.userInfo.avatarUrl : ''
90
- }
91
- _list.push({
92
- ...item,
93
- avatarUrl,
94
- })
95
- })
96
- this.conversationList = _list
97
- })
98
- },
99
- // im开关
100
- changeSwitch(val) {
101
- localStorage.setItem('delivery', this.delivery)
102
- if (val) {
103
- this.getImToken()
104
- } else {
105
- this.closeCounect()
106
- }
107
- },
108
- linkChatroom(item) {
109
- this.currentItem = item
110
- this.isChatList = false
111
- },
112
- goback() {
113
- this.isChatList = true
114
- this.getConversationList()
115
- },
116
- // 关闭链接
117
- closeCounect() {
118
- const Status = this.$Service.Status
119
- Status.disconnect()
120
- this.conversationList = []
121
- },
122
- watchMessage() {
123
- this.$Service.Message.watch((message) => {
124
- if (message.isOffLineMessage) {
125
- return
126
- }
127
- this.getConversationList()
128
- })
129
- },
130
- },
131
- mixins: [],
132
- components: {
133
- chatList,
134
- chatRoom,
135
- },
136
-
137
- mounted() {
138
- this.getImToken()
139
- this.watchMessage()
140
- },
141
- }
142
- </script>
143
- <style lang="scss" scoped>
144
- .switch {
145
- width: 100%;
146
- margin-top: 15px;
147
- margin-left: 28px;
148
-
149
- span {
150
- position: relative;
151
- top: 2px;
152
- left: 5px;
153
- }
154
- }
155
- </style>
1
+ <template>
2
+ <div class="im-wrapper">
3
+ <div class="switch">
4
+ <span> {{ delivery ? '下线' : '上线' }}:</span>
5
+ <el-switch v-model="delivery" @change="changeSwitch"></el-switch>
6
+ </div>
7
+ <chatList
8
+ @chatroom="linkChatroom"
9
+ v-if="isChatList"
10
+ :conversationList="conversationList"
11
+ ></chatList>
12
+ <chatRoom v-else @goback="goback" :currentItem="currentItem"></chatRoom>
13
+ </div>
14
+ </template>
15
+ <script>
16
+ import chatList from './pages/chatList/index.vue'
17
+ import chatRoom from './pages/chatRoom/index.vue'
18
+
19
+ export default {
20
+ $$route: {
21
+ meta: {
22
+ title: '标题名称',
23
+ icon: '菜单图标',
24
+ },
25
+ },
26
+ props: {},
27
+ data() {
28
+ return {
29
+ isChatList: true,
30
+ currentItem: null,
31
+ conversationList: [],
32
+ delivery: false,
33
+ }
34
+ },
35
+ methods: {
36
+ // 获取im token
37
+ getImToken() {
38
+ this.delivery = localStorage.getItem('delivery') == 'true' ? true : false
39
+ if (!this.delivery) return
40
+ this.$http.get('api.im.GetToken').then((res) => {
41
+ this.initIm(res.data)
42
+ localStorage.setItem('imToken', res.data)
43
+ })
44
+ },
45
+ // im 初始化
46
+ initIm(token) {
47
+ const baseUrls = ['http://isvlp194.365xs.cn', 'http://erp.lp194.365xs.cn', 'http://erp.lp192.365xs.cn']
48
+ let appkey = baseUrls.includes(location.origin) ? 'cpj2xarlcm61n' : 'pgyu6atqp289u'
49
+
50
+ this.$Service.Init({
51
+ appkey,
52
+ token,
53
+ })
54
+ this.initRYConnect()
55
+ },
56
+ //链接
57
+ initRYConnect() {
58
+ const Status = this.$Service.Status
59
+ const CONNECTION_STATUS = this.$Service.CONNECTION_STATUS
60
+ Status.disconnect()
61
+ Status.watch((status) => {
62
+ switch (status) {
63
+ case CONNECTION_STATUS.CONNECTED:
64
+ this.getConversationList()
65
+ break
66
+ case CONNECTION_STATUS.NETWORK_UNAVAILABLE:
67
+ this.$message('重连中...')
68
+ break
69
+ case CONNECTION_STATUS.KICKED_OFFLINE_BY_OTHER_CLIENT:
70
+ this.$message('当前用户已在其他端登录...')
71
+ break
72
+ }
73
+ })
74
+ Status.connect({ name: '客服张三' })
75
+ .then((user) => {
76
+ console.log(' 链接成功', user)
77
+ })
78
+ .catch((error) => {
79
+ console.log('连接失败', err)
80
+ })
81
+ },
82
+ // 获取消息列表
83
+ getConversationList() {
84
+ this.$Service.Conversation.getList().then((list) => {
85
+ let _list = []
86
+ list.forEach((item) => {
87
+ let avatarUrl
88
+ if (item.latestMessage.content.userInfo) {
89
+ avatarUrl = item.latestMessage.content.userInfo ? item.latestMessage.content.userInfo.avatarUrl : ''
90
+ }
91
+ _list.push({
92
+ ...item,
93
+ avatarUrl,
94
+ })
95
+ })
96
+ this.conversationList = _list
97
+ })
98
+ },
99
+ // im开关
100
+ changeSwitch(val) {
101
+ localStorage.setItem('delivery', this.delivery)
102
+ if (val) {
103
+ this.getImToken()
104
+ } else {
105
+ this.closeCounect()
106
+ }
107
+ },
108
+ linkChatroom(item) {
109
+ this.currentItem = item
110
+ this.isChatList = false
111
+ },
112
+ goback() {
113
+ this.isChatList = true
114
+ this.getConversationList()
115
+ },
116
+ // 关闭链接
117
+ closeCounect() {
118
+ const Status = this.$Service.Status
119
+ Status.disconnect()
120
+ this.conversationList = []
121
+ },
122
+ watchMessage() {
123
+ this.$Service.Message.watch((message) => {
124
+ if (message.isOffLineMessage) {
125
+ return
126
+ }
127
+ this.getConversationList()
128
+ })
129
+ },
130
+ },
131
+ mixins: [],
132
+ components: {
133
+ chatList,
134
+ chatRoom,
135
+ },
136
+
137
+ mounted() {
138
+ this.getImToken()
139
+ this.watchMessage()
140
+ },
141
+ }
142
+ </script>
143
+ <style lang="scss" scoped>
144
+ .switch {
145
+ width: 100%;
146
+ margin-top: 15px;
147
+ margin-left: 28px;
148
+
149
+ span {
150
+ position: relative;
151
+ top: 2px;
152
+ left: 5px;
153
+ }
154
+ }
155
+ </style>