icve-urc 1.0.0

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 (57) hide show
  1. package/README.en.md +36 -0
  2. package/README.md +24 -0
  3. package/dist/demo.html +10 -0
  4. package/dist/icve-urc.common.js +114103 -0
  5. package/dist/icve-urc.common.js.map +1 -0
  6. package/dist/icve-urc.css +1 -0
  7. package/dist/icve-urc.umd.js +114113 -0
  8. package/dist/icve-urc.umd.js.map +1 -0
  9. package/dist/icve-urc.umd.min.js +75 -0
  10. package/dist/icve-urc.umd.min.js.map +1 -0
  11. package/package.json +33 -0
  12. package/src/App copy.vue +116 -0
  13. package/src/App.vue +125 -0
  14. package/src/api/resourceManagement/index.js +33 -0
  15. package/src/assets/img/error.png +0 -0
  16. package/src/assets/img/file.png +0 -0
  17. package/src/assets/img/icon-pic.png +0 -0
  18. package/src/assets/img/icon_audio.png +0 -0
  19. package/src/assets/img/icon_excel.png +0 -0
  20. package/src/assets/img/icon_other.png +0 -0
  21. package/src/assets/img/icon_pdf.png +0 -0
  22. package/src/assets/img/icon_ppt.png +0 -0
  23. package/src/assets/img/icon_txt_s.png +0 -0
  24. package/src/assets/img/icon_vedio.png +0 -0
  25. package/src/assets/img/icon_word.png +0 -0
  26. package/src/assets/img/icon_zip.png +0 -0
  27. package/src/assets/img/loading.gif +0 -0
  28. package/src/assets/logo.png +0 -0
  29. package/src/assets/styles/btn.scss +99 -0
  30. package/src/assets/styles/element-ui.scss +92 -0
  31. package/src/assets/styles/element-variables.scss +31 -0
  32. package/src/assets/styles/icon/demo.css +539 -0
  33. package/src/assets/styles/icon/demo_index.html +556 -0
  34. package/src/assets/styles/icon/iconfont.css +79 -0
  35. package/src/assets/styles/icon/iconfont.js +1 -0
  36. package/src/assets/styles/icon/iconfont.json +121 -0
  37. package/src/assets/styles/icon/iconfont.ttf +0 -0
  38. package/src/assets/styles/icon/iconfont.woff +0 -0
  39. package/src/assets/styles/icon/iconfont.woff2 +0 -0
  40. package/src/assets/styles/index.scss +252 -0
  41. package/src/assets/styles/mixin.scss +66 -0
  42. package/src/assets/styles/ruoyi.scss +273 -0
  43. package/src/assets/styles/sidebar.scss +249 -0
  44. package/src/assets/styles/transition.scss +53 -0
  45. package/src/assets/styles/variables.scss +54 -0
  46. package/src/components/AliPlayer.vue +158 -0
  47. package/src/components/Pagination/index.vue +119 -0
  48. package/src/components/fileImport.vue +466 -0
  49. package/src/components/filePreview.vue +670 -0
  50. package/src/components/fileUpload.vue +752 -0
  51. package/src/components/treeCompontent.vue +277 -0
  52. package/src/main.js +26 -0
  53. package/src/router/index.js +22 -0
  54. package/src/utils/auth.js +15 -0
  55. package/src/utils/errorCode.js +6 -0
  56. package/src/utils/request.js +63 -0
  57. package/src/utils/scroll-to.js +58 -0
@@ -0,0 +1,277 @@
1
+ <template>
2
+ <div class="tree">
3
+ <!-- <div class="input">
4
+ <el-input
5
+ v-model="queryParams.fileName"
6
+ @keyup.enter.native="search"
7
+ placeholder="请输入文件名称"
8
+ ></el-input>
9
+ <el-button
10
+ class="addBlue"
11
+ @click="search"
12
+ style="margin-left: 6px"
13
+ size="mini"
14
+ >搜索</el-button
15
+ >
16
+ </div> -->
17
+ <el-tree
18
+ lazy
19
+ :load="loadNode"
20
+ node-key="id"
21
+ :highlight-current="true"
22
+ draggable
23
+ @allow-drop="allowDrop"
24
+ ref="treeRef"
25
+ v-if="treeShow"
26
+ class="tree-line"
27
+ :indent="0"
28
+ :default-expanded-keys="checkDefault"
29
+ @node-click="handleNodeClick"
30
+ >
31
+ <span
32
+ slot-scope="{ node, data }"
33
+ style="width: 100%"
34
+ >
35
+ <span class="icon">
36
+ <img
37
+ src="../assets/img/file.png"
38
+ alt=""
39
+ />
40
+ <el-tooltip
41
+ class="item"
42
+ effect="light"
43
+ :content="data.fileName"
44
+ placement="bottom"
45
+ :open-delay="1000"
46
+ >
47
+ <span
48
+ style="
49
+ padding-left: 4px;
50
+ font-size: 16px;
51
+ overflow: hidden;
52
+ white-space: nowrap;
53
+ text-overflow: ellipsis;
54
+ "
55
+ >{{
56
+ data.fileName.length > 10
57
+ ? data.fileName.substring(0, 10) + '...'
58
+ : data.fileName
59
+ }}</span
60
+ >
61
+ </el-tooltip>
62
+ </span>
63
+ </span>
64
+ </el-tree>
65
+ </div>
66
+ </template>
67
+
68
+ <script>
69
+ import { myResourceList } from '@/api/resourceManagement'
70
+
71
+ export default {
72
+ props: {
73
+ userId: {
74
+ type: String,
75
+ default: '',
76
+ },
77
+ productId: {
78
+ type: String,
79
+ default: '',
80
+ },
81
+ },
82
+ data() {
83
+ return {
84
+ queryParams: {
85
+ pageNum: 1,
86
+ pageSize: 10000,
87
+ isDir: 1,
88
+ parentId: 0,
89
+ userId: this.userId,
90
+ productId: this.productId,
91
+ },
92
+ treeShow: true,
93
+ parentId: 0,
94
+ checkDefault: [],
95
+ list: [],
96
+ }
97
+ },
98
+ mounted() {},
99
+ watch: {
100
+ checkDefault: function (newVal, oldVal) {
101
+ if (newVal) {
102
+ this.$nextTick(() => {
103
+ document.querySelector('.el-tree-node__content').click()
104
+ })
105
+ }
106
+ },
107
+ },
108
+ methods: {
109
+ allowDrop(draggingNode, dropNode, type) {
110
+ if (draggingNode.level == '1') {
111
+ return false
112
+ } else {
113
+ if (draggingNode.level == dropNode.level) {
114
+ return type === 'prev' || type === 'next'
115
+ } else if (draggingNode.level == dropNode.level + 1) {
116
+ return type === 'inner'
117
+ } else {
118
+ return false
119
+ }
120
+ }
121
+ },
122
+ loadNode(node, resolve) {
123
+ //如果展开第一级节点,从后台加载一级节点列表
124
+ if (node.level == 0) {
125
+ this.loadfirstnode(resolve)
126
+ }
127
+ //如果展开其他级节点,动态从后台加载下一级节点列表
128
+ if (node.level >= 1) {
129
+ this.loadchildnode(node, resolve)
130
+ }
131
+ },
132
+ //加载第一级节点
133
+ async loadfirstnode(resolve) {
134
+ let params = this.queryParams
135
+ const res = await myResourceList(params)
136
+ if (res.rows.length == 0) {
137
+ } else {
138
+ this.list = res.rows
139
+ this.$emit('handleNodeClick', res.rows[0])
140
+ this.checkDefault.push(res.rows[0].id)
141
+ this.$emit('isExist', res.rows.length)
142
+ return resolve(res.rows)
143
+ }
144
+ },
145
+ search() {
146
+ this.treeShow = false
147
+ if (this.queryParams.fileName) {
148
+ this.queryParams.parentId = ''
149
+ } else {
150
+ this.queryParams.parentId = 0
151
+ }
152
+ this.$nextTick(() => {
153
+ this.treeShow = true
154
+ })
155
+ },
156
+ //加载节点的子节点集合
157
+ async loadchildnode(node, resolve) {
158
+ // console.log("超过二级的", node, node.level);
159
+ let params = {
160
+ parentId: node.key,
161
+ pageNum: 1,
162
+ pageSize: 10000,
163
+ isDir: 1,
164
+ userId: this.queryParams.userId,
165
+ productId: this.queryParams.productId,
166
+ }
167
+ const res = await myResourceList(params)
168
+
169
+ return resolve(res.rows)
170
+ },
171
+ // 节点事件
172
+ handleNodeClick(data) {
173
+ this.$emit('handleNodeClick', data)
174
+ },
175
+ },
176
+ }
177
+ </script>
178
+
179
+ <style scoped lang="scss">
180
+ .addBlue {
181
+ background: #ebf1fe;
182
+ // border: 1px solid #145FDF;
183
+ // border-color: #145FDF;
184
+ color: #145fdf;
185
+ }
186
+
187
+ .icon-font1 {
188
+ width: 31px;
189
+ height: 30px;
190
+ }
191
+
192
+ .icon {
193
+ display: flex;
194
+ align-items: center;
195
+ }
196
+
197
+ .input {
198
+ display: flex;
199
+ margin-bottom: 10px;
200
+ }
201
+
202
+ .button {
203
+ padding-right: 10px;
204
+ flex: 1;
205
+ display: flex;
206
+ justify-content: end;
207
+ }
208
+
209
+ ::v-deep .el-tree-node__content {
210
+ margin-bottom: 6px;
211
+ }
212
+ </style>
213
+ <style scoped lang="scss">
214
+ .tree {
215
+ min-width: 300px;
216
+ }
217
+
218
+ // 树样式
219
+ .tree-line {
220
+ ::v-deep .el-tree-node {
221
+ position: relative;
222
+ padding-left: 16px; // 缩进量
223
+ }
224
+
225
+ ::v-deep .el-tree-node__children {
226
+ padding-left: 16px; // 缩进量
227
+ }
228
+
229
+ // 竖线
230
+ ::v-deep .el-tree-node::before {
231
+ content: '';
232
+ height: 100%;
233
+ width: 1px;
234
+ position: absolute;
235
+ left: -3px;
236
+ top: -26px;
237
+ border-width: 1px;
238
+ border-left: 1px dashed #ccc;
239
+ }
240
+
241
+ // 当前层最后⼀个节点的竖线⾼度固定
242
+ ::v-deep .el-tree-node:last-child::before {
243
+ height: 38px; // 可以⾃⼰调节到合适数值
244
+ }
245
+
246
+ // 横线
247
+ ::v-deep .el-tree-node::after {
248
+ content: '';
249
+ width: 24px;
250
+ height: 20px;
251
+ position: absolute;
252
+ left: -3px;
253
+ top: 12px;
254
+ border-width: 1px;
255
+ border-top: 1px dashed #ccc;
256
+ }
257
+
258
+ // 去掉最顶层的虚线,放最下⾯样式才不会被上⾯的覆盖了
259
+ & > ::v-deep .el-tree-node::after {
260
+ border-top: none;
261
+ }
262
+
263
+ & > ::v-deep .el-tree-node::before {
264
+ border-left: none;
265
+ }
266
+
267
+ // 展开关闭的icon
268
+ ::v-deep .el-tree-node__expand-icon {
269
+ font-size: 16px;
270
+ // 叶⼦节点(⽆⼦节点)
271
+ ::v-deep &.is-leaf {
272
+ color: transparent;
273
+ // display: none; // 也可以去掉
274
+ }
275
+ }
276
+ }
277
+ </style>
package/src/main.js ADDED
@@ -0,0 +1,26 @@
1
+ import "@/assets/styles/index.scss"; // global css
2
+ import "@/assets/styles/ruoyi.scss"; // ruoyi css
3
+ import Element from "element-ui";
4
+ import Cookies from "js-cookie";
5
+ import Vue from "vue";
6
+ import VueLazyload from "vue-lazyload";
7
+ import App from "./App.vue";
8
+ import "./assets/styles/element-variables.scss";
9
+ import router from "./router";
10
+ // 分页组件
11
+ import Pagination from "@/components/Pagination";
12
+
13
+ Vue.component("Pagination", Pagination);
14
+ Vue.use(Element, {
15
+ size: Cookies.get("size") || "medium", // set element-ui default size
16
+ });
17
+ Vue.config.productionTip = false;
18
+ Vue.use(VueLazyload, {
19
+ loading: require("./assets/img/loading.gif"),
20
+ error: require("./assets/img/error.png"),
21
+ });
22
+
23
+ new Vue({
24
+ router,
25
+ render: (h) => h(App),
26
+ }).$mount("#app");
@@ -0,0 +1,22 @@
1
+ import Vue from 'vue'
2
+ import Router from 'vue-router'
3
+
4
+ Vue.use(Router)
5
+
6
+ // 公共路由
7
+ export const constantRoutes = []
8
+
9
+ // 动态路由,基于用户权限动态去加载
10
+ export const dynamicRoutes = []
11
+
12
+ // 防止连续点击多次路由报错
13
+ let routerPush = Router.prototype.push
14
+ Router.prototype.push = function push(location) {
15
+ return routerPush.call(this, location).catch((err) => err)
16
+ }
17
+
18
+ export default new Router({
19
+ mode: 'history', // 去掉url中的#
20
+ scrollBehavior: () => ({ y: 0 }),
21
+ routes: constantRoutes,
22
+ })
@@ -0,0 +1,15 @@
1
+ import Cookies from 'js-cookie'
2
+
3
+ const TokenKey = 'token'
4
+
5
+ export function getToken() {
6
+ return Cookies.get(TokenKey)
7
+ }
8
+
9
+ export function setToken(token) {
10
+ return Cookies.set(TokenKey, token)
11
+ }
12
+
13
+ export function removeToken() {
14
+ return Cookies.remove(TokenKey)
15
+ }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ 401: '认证失败,无法访问系统资源',
3
+ 403: '当前操作没有权限',
4
+ 404: '访问资源不存在',
5
+ default: '系统未知错误,请反馈给管理员',
6
+ }
@@ -0,0 +1,63 @@
1
+ // 封装 axios 请求模块
2
+ import errorCode from "@/utils/errorCode";
3
+ import axios from "axios";
4
+ import { Message, MessageBox, Notification } from "element-ui";
5
+ // 创建一个 axios 实例对象
6
+ const request = axios.create({
7
+ // axios中请求配置有baseURL选项,表示请求URL公共部分
8
+ baseURL: process.env.VUE_APP_BASE_API,
9
+ // 超时
10
+ timeout: 10000,
11
+ });
12
+
13
+ // 配置请求拦截器
14
+ request.interceptors.request.use(
15
+ function (config) {
16
+ // if (getToken()) {
17
+ // config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
18
+ // }
19
+ if (sessionStorage.getItem("environment") === "test") {
20
+ // config.url = "http://192.168.130.168:19203" + config.url;
21
+ config.url = "https://urc-test.icve.com.cn/stage-api" + config.url;
22
+ } else {
23
+ config.url = "https://urc.icve.com.cn/prod-api" + config.url;
24
+ }
25
+ return config;
26
+ },
27
+ function (error) {
28
+ // 对请求错误做些什么
29
+ return Promise.reject(error);
30
+ }
31
+ );
32
+
33
+ // 添加响应拦截器
34
+ // 响应拦截器
35
+ request.interceptors.response.use(
36
+ (res) => {
37
+ // 未设置状态码则默认成功状态
38
+ const code = res.data.code || 200;
39
+ // 获取错误信息
40
+ const msg = errorCode[code] || res.data.msg || errorCode["default"];
41
+ return res.data;
42
+ },
43
+ (error) => {
44
+ console.log("err" + error);
45
+ let { message } = error;
46
+ if (message == "Network Error") {
47
+ message = "后端接口连接异常";
48
+ } else if (message.includes("timeout")) {
49
+ message = "系统接口请求超时";
50
+ } else if (message.includes("Request failed with status code")) {
51
+ message = "系统接口" + message.substr(message.length - 3) + "异常";
52
+ }
53
+ Message({
54
+ message: message,
55
+ type: "error",
56
+ duration: 5 * 1000,
57
+ });
58
+ return Promise.reject(error);
59
+ }
60
+ );
61
+
62
+ // 暴露出去
63
+ export default request;
@@ -0,0 +1,58 @@
1
+ Math.easeInOutQuad = function(t, b, c, d) {
2
+ t /= d / 2
3
+ if (t < 1) {
4
+ return c / 2 * t * t + b
5
+ }
6
+ t--
7
+ return -c / 2 * (t * (t - 2) - 1) + b
8
+ }
9
+
10
+ // requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
11
+ var requestAnimFrame = (function() {
12
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
13
+ })()
14
+
15
+ /**
16
+ * Because it's so fucking difficult to detect the scrolling element, just move them all
17
+ * @param {number} amount
18
+ */
19
+ function move(amount) {
20
+ document.documentElement.scrollTop = amount
21
+ document.body.parentNode.scrollTop = amount
22
+ document.body.scrollTop = amount
23
+ }
24
+
25
+ function position() {
26
+ return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
27
+ }
28
+
29
+ /**
30
+ * @param {number} to
31
+ * @param {number} duration
32
+ * @param {Function} callback
33
+ */
34
+ export function scrollTo(to, duration, callback) {
35
+ const start = position()
36
+ const change = to - start
37
+ const increment = 20
38
+ let currentTime = 0
39
+ duration = (typeof (duration) === 'undefined') ? 500 : duration
40
+ var animateScroll = function() {
41
+ // increment the time
42
+ currentTime += increment
43
+ // find the value with the quadratic in-out easing function
44
+ var val = Math.easeInOutQuad(currentTime, start, change, duration)
45
+ // move the document.body
46
+ move(val)
47
+ // do the animation unless its over
48
+ if (currentTime < duration) {
49
+ requestAnimFrame(animateScroll)
50
+ } else {
51
+ if (callback && typeof (callback) === 'function') {
52
+ // the animation is done so lets callback
53
+ callback()
54
+ }
55
+ }
56
+ }
57
+ animateScroll()
58
+ }