qj-common 4.3.0 → 4.3.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.
Files changed (229) hide show
  1. package/.babelrc +12 -12
  2. package/.eslintrc.js +25 -25
  3. package/.idea/common.iml +11 -11
  4. package/.idea/modules.xml +7 -7
  5. package/.idea/vcs.xml +5 -5
  6. package/.postcssrc.js +9 -9
  7. package/.prettierrc.js +7 -7
  8. package/.project +37 -37
  9. package/README.md +2 -2
  10. package/gulpfile.js +20 -20
  11. package/package.json +18 -18
  12. package/src/api/apimanage.js +146 -146
  13. package/src/api/common/index.js +192 -192
  14. package/src/api/login.js +160 -160
  15. package/src/api/shopFbu.js +515 -515
  16. package/src/api/upload.js +8 -8
  17. package/src/components/Bounced/index.vue +145 -145
  18. package/src/components/Breadcrumb/index.vue +71 -71
  19. package/src/components/Checkbox/index.vue +53 -53
  20. package/src/components/Hamburger/index.vue +48 -48
  21. package/src/components/Logistics/logic.vue +186 -186
  22. package/src/components/ScrollBar/index.vue +60 -60
  23. package/src/components/Sticky/index.vue +76 -76
  24. package/src/components/SvgIcon/index.vue +42 -42
  25. package/src/components/ThemePicker/index.vue +243 -243
  26. package/src/components/Tinymce/components/editorImage.vue +94 -94
  27. package/src/components/Tinymce/index.vue +166 -166
  28. package/src/components/Tinymce/plugins.js +7 -7
  29. package/src/components/Tinymce/toolbar.js +6 -6
  30. package/src/components/TreeTable/customEval.js +44 -44
  31. package/src/components/TreeTable/eval.js +29 -29
  32. package/src/components/TreeTable/index.vue +124 -124
  33. package/src/components/TreeTable/readme.md +89 -89
  34. package/src/components/TreeTableApi/customEval.js +49 -49
  35. package/src/components/TreeTableApi/eval.js +29 -29
  36. package/src/components/TreeTableApi/index.vue +124 -124
  37. package/src/components/TreeTableApi/readme.md +89 -89
  38. package/src/components/Upload/singleImage.vue +123 -123
  39. package/src/components/Upload/singleImage2.vue +118 -118
  40. package/src/components/Upload/singleImage3.vue +138 -138
  41. package/src/components/Upload/upload.vue +295 -295
  42. package/src/components/workOrderList/index.vue +158 -158
  43. package/src/dependencies.js +119 -119
  44. package/src/iconShop/demo.css +539 -539
  45. package/src/iconShop/demo_index.html +8445 -8445
  46. package/src/iconShop/iconfont.css +1451 -1451
  47. package/src/iconShop/iconfont.json +2522 -2522
  48. package/src/iconShop/iconfont.svg +1070 -1070
  49. package/src/iconfont/demo.css +539 -539
  50. package/src/iconfont/demo_index.html +5276 -5276
  51. package/src/iconfont/iconfont.css +905 -905
  52. package/src/iconfont/iconfont.json +1563 -1563
  53. package/src/iconfont/iconfont.svg +692 -692
  54. package/src/icons/index.js +9 -9
  55. package/src/lang/e.js +48 -48
  56. package/src/lang/en.js +48 -48
  57. package/src/lang/zh.js +48 -48
  58. package/src/main.js +62 -62
  59. package/src/permission.js +283 -283
  60. package/src/permissionForMall.backup.js +375 -375
  61. package/src/permissionForMall.js +375 -375
  62. package/src/preset.js +67 -67
  63. package/src/router/_import_common.js +1 -1
  64. package/src/router/_import_development.js +1 -1
  65. package/src/router/_import_production.js +1 -1
  66. package/src/store/getters.js +39 -39
  67. package/src/store/index.js +18 -18
  68. package/src/store/modules/app.js +34 -30
  69. package/src/store/modules/menu.js +82 -82
  70. package/src/store/modules/user.js +227 -227
  71. package/src/styles/element-ui.scss +1368 -1368
  72. package/src/styles/index.scss +166 -166
  73. package/src/styles/mixin.scss +27 -27
  74. package/src/styles/pc-ui.scss +1031 -1031
  75. package/src/styles/scrollBar.scss +21 -21
  76. package/src/styles/sidebar.scss +123 -123
  77. package/src/styles/transition.scss +32 -32
  78. package/src/styles/variables.scss +44 -44
  79. package/src/styles/wf-ui.scss +86 -86
  80. package/src/utils/auth.js +57 -57
  81. package/src/utils/dom.js +12 -12
  82. package/src/utils/getQueryString.js +5 -5
  83. package/src/utils/import.js +5 -5
  84. package/src/utils/index.js +355 -355
  85. package/src/utils/interceptor.js +34 -34
  86. package/src/utils/menu.js +116 -116
  87. package/src/utils/proapp.js +35 -35
  88. package/src/utils/query.js +26 -26
  89. package/src/utils/request.js +366 -366
  90. package/src/utils/routeMapping.js +39 -39
  91. package/src/utils/routeMapping.json +310 -310
  92. package/src/utils/utils.js +84 -84
  93. package/src/utils/validate.js +102 -102
  94. package/src/views/404.vue +72 -72
  95. package/src/views/Layout.vue +106 -106
  96. package/src/views/imgSwiper/index.vue +34 -34
  97. package/src/views/layout/Layout.vue +181 -170
  98. package/src/views/layout/components/AppMain.vue +20 -20
  99. package/src/views/layout/components/Footer.vue +22 -22
  100. package/src/views/layout/components/LeftNavbar.vue +318 -310
  101. package/src/views/layout/components/NavMenu.vue +15 -15
  102. package/src/views/layout/components/Navbar.vue +664 -661
  103. package/src/views/layout/components/Sidebar/SidebarItem.vue +116 -113
  104. package/src/views/layout/components/Sidebar/index.vue +203 -193
  105. package/src/views/layout/components/index.js +19 -19
  106. package/src/views/layout/theme/darkBlue/Layout.vue +140 -140
  107. package/src/views/layout/theme/darkBlue/components/AppMain.vue +38 -38
  108. package/src/views/layout/theme/darkBlue/components/Footer.vue +147 -147
  109. package/src/views/layout/theme/darkBlue/components/LeftNavbar(/345/261/225/347/244/272/345/205/250/351/203/250/350/217/234/345/215/225).vue +448 -448
  110. package/src/views/layout/theme/darkBlue/components/LeftNavbar.3.vue +191 -191
  111. package/src/views/layout/theme/darkBlue/components/LeftNavbar.vue +466 -466
  112. package/src/views/layout/theme/darkBlue/components/Navbar.vue +200 -200
  113. package/src/views/layout/theme/darkBlue/components/Sidebar/SidebarItem.vue +71 -71
  114. package/src/views/layout/theme/darkBlue/components/Sidebar/index.vue +49 -49
  115. package/src/views/layout/theme/darkBlue/components/index.js +15 -15
  116. package/src/views/layout-default/Layout.vue +134 -134
  117. package/src/views/layout-default/components/AppMain.vue +19 -19
  118. package/src/views/layout-default/components/Footer.vue +22 -22
  119. package/src/views/layout-default/components/LeftNavbar.vue +164 -164
  120. package/src/views/layout-default/components/Navbar.vue +295 -295
  121. package/src/views/layout-default/components/Sidebar/SidebarItem.vue +67 -67
  122. package/src/views/layout-default/components/Sidebar/index.vue +59 -59
  123. package/src/views/layout-default/components/index.js +4 -4
  124. package/src/views/layout-default/theme/darkBlue/Layout.vue +140 -140
  125. package/src/views/layout-default/theme/darkBlue/components/AppMain.vue +38 -38
  126. package/src/views/layout-default/theme/darkBlue/components/Footer.vue +147 -147
  127. package/src/views/layout-default/theme/darkBlue/components/LeftNavbar.vue +465 -465
  128. package/src/views/layout-default/theme/darkBlue/components/Navbar.vue +200 -200
  129. package/src/views/layout-default/theme/darkBlue/components/Sidebar/SidebarItem.vue +69 -69
  130. package/src/views/layout-default/theme/darkBlue/components/Sidebar/index.vue +49 -49
  131. package/src/views/layout-default/theme/darkBlue/components/index.js +15 -15
  132. package/src/views/pc/Internationalization.vue +80 -80
  133. package/src/views/pc/default/Layout.vue +442 -442
  134. package/src/views/pc/default/LayoutCard.vue +424 -424
  135. package/src/views/pc/default/assets/flex.scss +99 -99
  136. package/src/views/pc/default/footer-modules/DgFooter/index.vue +179 -179
  137. package/src/views/pc/default/footer-modules/DgFooter/indexSDX.vue +187 -187
  138. package/src/views/pc/default/footer-modules/footer.vue +171 -171
  139. package/src/views/pc/default/footer-modules/footerAns.vue +167 -167
  140. package/src/views/pc/default/footer-modules/footerBulk.vue +169 -169
  141. package/src/views/pc/default/footer-modules/footerDM.vue +254 -254
  142. package/src/views/pc/default/footer-modules/footerDefault.vue +267 -267
  143. package/src/views/pc/default/footer-modules/footerDefaultA.vue +270 -270
  144. package/src/views/pc/default/footer-modules/footerDefaultNew.vue +201 -201
  145. package/src/views/pc/default/footer-modules/footerHDB.vue +153 -153
  146. package/src/views/pc/default/footer-modules/footerHy.vue +63 -63
  147. package/src/views/pc/default/footer-modules/footerKYW.vue +163 -163
  148. package/src/views/pc/default/footer-modules/footerMh.vue +30 -30
  149. package/src/views/pc/default/footer-modules/footerNew.vue +116 -116
  150. package/src/views/pc/default/footer-modules/footer_yzj.vue +169 -169
  151. package/src/views/pc/default/footer-modules/footerayd.vue +85 -85
  152. package/src/views/pc/default/footer-modules/ymFooter.vue +154 -154
  153. package/src/views/pc/default/footer-modules/zgl.vue +250 -250
  154. package/src/views/pc/default/header-modules/DgHeader/Logo.vue +57 -57
  155. package/src/views/pc/default/header-modules/DgHeader/Search.vue +135 -135
  156. package/src/views/pc/default/header-modules/DgHeader/Settleup.vue +46 -46
  157. package/src/views/pc/default/header-modules/DgHeader/index.vue +38 -38
  158. package/src/views/pc/default/header-modules/active.vue +177 -177
  159. package/src/views/pc/default/header-modules/header.vue +97 -97
  160. package/src/views/pc/default/header-modules/headerA.vue +142 -142
  161. package/src/views/pc/default/header-modules/headerFLPT.vue +157 -157
  162. package/src/views/pc/default/header-modules/headerMh.vue +187 -187
  163. package/src/views/pc/default/header-modules/headerNew.vue +121 -121
  164. package/src/views/pc/default/header-modules/headerSDX.vue +304 -304
  165. package/src/views/pc/default/header-modules/headerStyle2.vue +173 -173
  166. package/src/views/pc/default/header-modules/headerStyle3.vue +190 -190
  167. package/src/views/pc/default/header-modules/headerStyle4.vue +163 -163
  168. package/src/views/pc/default/header-modules/headerStyleAns.vue +400 -400
  169. package/src/views/pc/default/header-modules/headerStyleBulk.vue +427 -427
  170. package/src/views/pc/default/header-modules/headerStyleDefalut.vue +209 -209
  171. package/src/views/pc/default/header-modules/headerStyleKYW.vue +435 -435
  172. package/src/views/pc/default/header-modules/headerStyle_yzj.vue +427 -427
  173. package/src/views/pc/default/header-modules/headerayd.vue +187 -187
  174. package/src/views/pc/default/header-modules/index.vue +466 -466
  175. package/src/views/pc/default/header-modules/ymHeader.vue +292 -292
  176. package/src/views/pc/default/header-modules/ysHeader.vue +248 -248
  177. package/src/views/pc/default/header-modules/zgl.vue +855 -855
  178. package/src/views/pc/default/leftMenu-modules/leftMenu-logo.vue +194 -194
  179. package/src/views/pc/default/leftMenu-modules/leftMenu-style2.vue +206 -206
  180. package/src/views/pc/default/leftMenu-modules/leftMenu-style3.vue +207 -207
  181. package/src/views/pc/default/leftMenu-modules/leftMenu-style4.vue +192 -192
  182. package/src/views/pc/default/leftMenu-modules/leftMenu.vue +183 -183
  183. package/src/views/pc/default/leftMenu-modules/leftMenuDefault.vue +212 -212
  184. package/src/views/pc/default/leftMenu-modules/leftMenuDefaultEn.vue +214 -214
  185. package/src/views/pc/default/leftMenu-modules/leftMenuDefaultFLPT.vue +220 -220
  186. package/src/views/pc/default/leftMenu-modules/leftMenuDefaultayd.vue +220 -220
  187. package/src/views/pc/default/nav-modules/nav.vue +52 -52
  188. package/src/views/pc/default/nav-modules/navAns.vue +60 -60
  189. package/src/views/pc/default/nav-modules/navBulk.vue +60 -60
  190. package/src/views/pc/default/top-modules/DgTopShortcut/index.vue +177 -177
  191. package/src/views/pc/default/top-modules/Toplg.vue +280 -280
  192. package/src/views/pc/default/top-modules/topA.vue +136 -136
  193. package/src/views/pc/default/top-modules/topAns.vue +261 -261
  194. package/src/views/pc/default/top-modules/topAns_yzj.vue +282 -282
  195. package/src/views/pc/default/top-modules/topBar.vue +304 -304
  196. package/src/views/pc/default/top-modules/topBulk.vue +280 -280
  197. package/src/views/pc/default/top-modules/topDefault.vue +244 -244
  198. package/src/views/pc/default/top-modules/topDefaultDM.vue +197 -197
  199. package/src/views/pc/default/top-modules/topDefaultNew.vue +271 -271
  200. package/src/views/pc/default/top-modules/topFLPT.vue +197 -197
  201. package/src/views/pc/default/top-modules/topHDB.vue +479 -479
  202. package/src/views/pc/default/top-modules/topKYW.vue +258 -258
  203. package/src/views/pc/default/top-modules/topMh.vue +174 -174
  204. package/src/views/pc/default/top-modules/topNew.vue +97 -97
  205. package/src/views/pc/default/top-modules/topSDX.vue +298 -298
  206. package/src/views/pc/default/top-modules/topSimple.vue +247 -247
  207. package/src/views/pc/default/top-modules/topSimpleHy.vue +256 -256
  208. package/src/views/pc/default/top-modules/topUcc.vue +264 -264
  209. package/src/views/pc/default/top-modules/topayd.vue +170 -170
  210. package/src/views/pc/default/top-modules/ymTop.vue +299 -299
  211. package/src/views/pc/default/top-modules/zgltop.vue +499 -499
  212. package/src/views/routerView.vue +9 -9
  213. package/src/views/templates/components/temp-select.vue +80 -80
  214. package/src/views/templates/components/temp-upload.vue +233 -233
  215. package/src/views/templates/readme.md +2 -2
  216. package/src/views/templates/templateInput.vue +421 -421
  217. package/src/views/templates/templateReadme.html +588 -588
  218. package/src/views/templates/templateReadme.md +619 -619
  219. package/src/views/templates/templateTable.vue +2243 -2243
  220. package/src/views/templates/templateTableData.vue +1883 -1883
  221. package/src/views/templates/templateUi/templateTableContent.vue +187 -187
  222. package/src/views/treeTemplate/index.vue +559 -559
  223. package/src/views/treeTemplate/treeTemplate.md +274 -274
  224. package/src/views/uploadDialog/index copy.vue +352 -352
  225. package/src/views/uploadDialog/index.vue +558 -558
  226. package/src/views/uploadDialog/indexOlay.vue +582 -582
  227. package/src/views/uploadDialog/indexPM.vue +578 -578
  228. package/src/views/uploadDialog/indexUpload.vue +543 -543
  229. package/src/views/uploadDialog/readme.md +45 -45
@@ -1,352 +1,352 @@
1
- <template>
2
- <el-dialog
3
- :title="title"
4
- width="55%"
5
- :append-to-body="true"
6
- :visible.sync="diaVisible"
7
- @close="handelClose"
8
- >
9
- <!-- 点击上传弹出的第一个框 -->
10
- <el-form class="dialog-form" v-if="!type || type=='0'">
11
- <el-form-item label="上传本地图片" class="dialog-form-item">
12
- <el-button type="primary" class="file-btn" @click="changeFile">添加图片</el-button>
13
- <span class="el-upload__tip cor-red">只能上传{{imgType}}文件,且不超过{{num || 5}}M,最多上传{{picLimit}}张</span>
14
- </el-form-item>
15
- <el-form-item label="添加网络图片" class="dialog-form-item">
16
- <el-col :span="14">
17
- <el-input v-model="fileUrl"></el-input>
18
- </el-col>
19
- <el-col :span="5" :offset="1">
20
- <el-button type="primary" @click="getNetFile">提取</el-button>
21
- </el-col>
22
- </el-form-item>
23
- </el-form>
24
- <el-form class="dialog-form" v-else>
25
- <el-form-item label="上传本地文件" class="dialog-form-item">
26
- <el-button type="primary" class="file-btn" @click="changeFile">添加文件</el-button>
27
- <span class="el-upload__tip cor-red">只能上传常见的mp4,ogg,flv,mkv格式文件,且不超过5M,最多上传{{picLimit}}个</span>
28
- </el-form-item>
29
- <el-form-item label="添加网络文件" class="dialog-form-item">
30
- <el-col :span="14">
31
- <el-input v-model="fileUrl"></el-input>
32
- </el-col>
33
- <el-col :span="5" :offset="1">
34
- <el-button type="primary" @click="getNetFile">提取</el-button>
35
- </el-col>
36
- </el-form-item>
37
- </el-form>
38
- <div class="file-list">
39
- <el-upload
40
- v-if="!type || type=='0'"
41
- ref="picUpload"
42
- class="pic-div"
43
- :action="fileUploadUrl"
44
- :data="otherData"
45
- :before-upload="beforeAvatarUpload"
46
- :on-success="handelSuccess"
47
- :with-credentials="true"
48
- :on-remove="handleRemove"
49
- list-type="picture-card"
50
- :file-list="nFileList"
51
- :multiple="multiple"
52
- ></el-upload>
53
- <el-upload
54
- v-else
55
- ref="picUpload"
56
- :action="fileUploadUrl"
57
- :data="otherData"
58
- :with-credentials="true"
59
- :on-success="handelSuccess"
60
- :on-error="handelError"
61
- :on-remove="handleRemove"
62
- :before-upload="beforeUpload"
63
- :file-list="nFileList"
64
- :multiple="multiple"
65
- ></el-upload>
66
- </div>
67
- <div slot="footer" class="dialog-footer">
68
- <el-button @click="diaVisible = false">取消</el-button>
69
- <el-button type="primary" @click="setFileList">确定</el-button>
70
- </div>
71
- </el-dialog>
72
- </template>
73
- <script>
74
- import API from "#/api/common";
75
- import { Loading } from "element-ui";
76
- import { validateURL } from "#/utils/validate";
77
- export default {
78
- // props: ["fileList", "type", "limit", "visible", fileUploadUrl:{}],
79
- props: {
80
- fileList: Array,
81
- type: String,
82
- limit: Number,
83
- visible: Boolean,
84
- imgType: String,
85
- num: Number,
86
- multiple: {
87
- type: Boolean,
88
- default: false
89
- },
90
- fileUploadUrl: {
91
- type: String,
92
- default: process.env.API_ROOT + "/web/rs/goodsFile/uploadGoodsFile.json"
93
- }
94
- },
95
- data() {
96
- return {
97
- title: "选择图片",
98
- diaVisible: false,
99
- fileUrl: "",
100
- imgType: "jpg/png/gif",
101
- num: 5,
102
- picLimit: this.limit || 1,
103
- nFileList: this.fileList || [],
104
- otherData: {
105
- tenantCode: "00000001"
106
- },
107
- uploading: [] //正在上传的文件集合
108
- };
109
- },
110
-
111
- // mounted() {
112
- // console.log(this.fileUploadUrl, "111111111111111111111111111111111111111.");
113
- // if (!this.fileUploadUrl) {
114
- // this.fileUploadUrl =
115
- // process.env.API_ROOT + "/web/rs/goodsFile/uploadGoodsFile.json";
116
- // }
117
- // },
118
- activated() {
119
- console.log("组件被激活了");
120
- },
121
- methods: {
122
- uploadPic(index, rows) {
123
- //规格上传图片
124
- this.rowSer = rows;
125
- this.defaultPicList = rows.rsGoodsFileDomainList;
126
- this.diaVisible = true;
127
- },
128
- handelClose() {
129
- this.nFileList = [];
130
- this.fileUrl = "";
131
- this.$refs.picUpload.abort();
132
- this.uploading = [];
133
- this.$emit("toggle", false);
134
- },
135
- handleRemove(file, fileList) {
136
- //移除正在上传的文件 需要从this.uploading中移除
137
- let index = this.uploading.indexOf(file.uid);
138
- if (index > -1) {
139
- this.uploading.splice(index, 1);
140
- }
141
- this.nFileList = fileList;
142
- },
143
- beforeAvatarUpload(file) {
144
- console.log(file, "file", this.beforeAvatarUpload);
145
- //上传之前的回调
146
- const fileType = /\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(
147
- file.name.toLowerCase()
148
- );
149
- if (!fileType) {
150
- this.$message.error("图片格式为常见的jpg、png、gif格式!");
151
- }
152
- const isLt2M = file.size / 1024 / 1024 < 5;
153
- if (!isLt2M) {
154
- this.$message.error("上传的图片大小不能超过 5MB!");
155
- }
156
- if (isLt2M && fileType) {
157
- this.uploading.push(file.uid);
158
- }
159
- return isLt2M && fileType;
160
- },
161
- beforeUpload(file) {
162
- //上传之前的回调
163
- const fileType = /\.(mp4|ogg|flv|mkv|MP4|FLV|MKV|OGG)$/.test(
164
- file.name.toLowerCase()
165
- );
166
- if (!fileType) {
167
- this.$message.error("文件格式为常见的mp4,ogg,flv,mkv格式!");
168
- }
169
- const isLt2M = file.size / 1024 / 1024 < 5;
170
- if (!isLt2M) {
171
- this.$message.error("上传的文件大小不能超过5MB!");
172
- }
173
- if (isLt2M && fileType) {
174
- this.uploading.push(file.uid);
175
- }
176
- return isLt2M && fileType;
177
- },
178
- handelSuccess(response, file, fileList) {
179
- console.log(response);
180
- console.log(file);
181
- console.log(fileList);
182
- if (
183
- response &&
184
- typeof response == "object" &&
185
- "success" in response &&
186
- !response.success
187
- ) {
188
- let nJson = JSON.parse(response.data.dataObj);
189
- let nUrl = window.location.href;
190
- if (process.env.NODE_ENV === "development") {
191
- window.location.href =
192
- process.env.API_ROOT + nJson.loginurl + "?url=" + nUrl;
193
- } else {
194
- window.location.href = nJson.loginurl + "?url=" + nUrl;
195
- }
196
- return;
197
- }
198
- let njson = {
199
- name: file.name,
200
- url: response.fileUrl,
201
- goodsFileUrl: response.fileUrl,
202
- uid: file.uid,
203
- goodsFileType: this.type,
204
- goodsFileName: response.fileCode,
205
- status: "success"
206
- };
207
- //文件上传 需要从this.uploading中移除
208
- let index = this.uploading.indexOf(file.uid);
209
- this.uploading.splice(index, 1);
210
-
211
- fileList.splice(fileList.indexOf(file), 1, njson);
212
- console.log(fileList);
213
- this.nFileList = fileList;
214
- },
215
- handelError(error, file, fileList) {
216
- console.log(
217
- response,
218
- this.fileUploadUrl,
219
- "handelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelError"
220
- );
221
- console.log(file);
222
- console.log(fileList);
223
- },
224
- changeFile() {
225
- if (this.nFileList.length >= this.picLimit) {
226
- this.$message.error(
227
- `最多上传${this.picLimit}${this.type == "0" ? "张图片" : "个文件"}`
228
- );
229
- return;
230
- }
231
- this.$refs.picUpload.$refs["upload-inner"].$el.dispatchEvent(
232
- new MouseEvent("click")
233
- );
234
- },
235
- getNetFile() {
236
- if (this.nFileList.length >= this.picLimit) {
237
- this.$message.error(
238
- `最多上传${this.picLimit}${this.type == "0" ? "张图片" : "个文件"}`
239
- );
240
- this.fileUrl = "";
241
- return;
242
- }
243
- if (validateURL(this.fileUrl)) {
244
- let fileInfo = {
245
- url: this.fileUrl,
246
- goodsFileUrl: this.fileUrl,
247
- name: this.fileUrl,
248
- goodsFileType: this.type
249
- };
250
- this.nFileList.push(fileInfo);
251
- this.fileUrl = "";
252
- } else {
253
- this.$message.error("请输入正确的图片地址");
254
- }
255
- },
256
- setPicList(response, file, fileList) {},
257
- beyond() {
258
- //图片个数超出的验证
259
- this.$message.error("最多5张!");
260
- },
261
- setFileList() {
262
- let nList = [];
263
- if (this.nFileList.length > 0) {
264
- nList = JSON.parse(JSON.stringify(this.nFileList));
265
- }
266
- console.log(this.$refs.picUpload);
267
- if (this.uploading.length > 0) {
268
- this.$confirm(
269
- "请确认所有文件都上传完成,继续操作会移除正在上传的文件!",
270
- "提示",
271
- {
272
- confirmButtonText: "确定",
273
- cancelButtonText: "取消",
274
- type: "warning"
275
- }
276
- )
277
- .then(() => {
278
- this.$refs.picUpload.abort();
279
- this.$emit("setFileList", nList);
280
- this.diaVisible = false;
281
- })
282
- .catch(() => {});
283
- } else {
284
- this.$emit("setFileList", nList);
285
- this.diaVisible = false;
286
- }
287
- }
288
- },
289
- mounted() {
290
- console.log(this.multiple, "multiple");
291
- },
292
- watch: {
293
- visible() {
294
- this.diaVisible = this.visible;
295
- if (this.visible) {
296
- let nList = [];
297
- if (this.fileList.length > 0) {
298
- nList = JSON.parse(JSON.stringify(this.fileList));
299
- nList.forEach(item => {
300
- item.url = item.goodsFileUrl || item.url;
301
- });
302
- }
303
- this.$nextTick(() => {
304
- this.$refs.picUpload.$refs["upload-inner"].$el.style.display = "none";
305
- });
306
- this.nFileList = nList;
307
- }
308
- if (this.type && this.type == "1") {
309
- this.title = "选择文件";
310
- } else {
311
- this.title = "选择图片";
312
- }
313
- },
314
- limit() {
315
- this.picLimit = this.limit || 1;
316
- },
317
- fileList() {
318
- let nList = [];
319
- if (this.fileList.length > 0) {
320
- nList = JSON.parse(JSON.stringify(this.fileList));
321
- }
322
- this.nFileList = nList;
323
- console.log(this.nFileList);
324
- }
325
- }
326
- };
327
- </script>
328
-
329
- <style rel="stylesheet/scss" lang="scss" scoped>
330
- .dialog-form {
331
- width: 100%;
332
- box-sizing: border-box;
333
- padding-left: 20px;
334
- .dialog-form-item {
335
- width: 100% !important;
336
- margin-left: 0 !important;
337
- }
338
- }
339
- .el-dialog {
340
- border-radius: 6px;
341
- }
342
- .file-btn {
343
- position: relative;
344
- overflow: hidden;
345
- }
346
- .file-input {
347
- display: none;
348
- }
349
- .cor-red {
350
- color: #ff0000;
351
- }
352
- </style>
1
+ <template>
2
+ <el-dialog
3
+ :title="title"
4
+ width="55%"
5
+ :append-to-body="true"
6
+ :visible.sync="diaVisible"
7
+ @close="handelClose"
8
+ >
9
+ <!-- 点击上传弹出的第一个框 -->
10
+ <el-form class="dialog-form" v-if="!type || type=='0'">
11
+ <el-form-item label="上传本地图片" class="dialog-form-item">
12
+ <el-button type="primary" class="file-btn" @click="changeFile">添加图片</el-button>
13
+ <span class="el-upload__tip cor-red">只能上传{{imgType}}文件,且不超过{{num || 5}}M,最多上传{{picLimit}}张</span>
14
+ </el-form-item>
15
+ <el-form-item label="添加网络图片" class="dialog-form-item">
16
+ <el-col :span="14">
17
+ <el-input v-model="fileUrl"></el-input>
18
+ </el-col>
19
+ <el-col :span="5" :offset="1">
20
+ <el-button type="primary" @click="getNetFile">提取</el-button>
21
+ </el-col>
22
+ </el-form-item>
23
+ </el-form>
24
+ <el-form class="dialog-form" v-else>
25
+ <el-form-item label="上传本地文件" class="dialog-form-item">
26
+ <el-button type="primary" class="file-btn" @click="changeFile">添加文件</el-button>
27
+ <span class="el-upload__tip cor-red">只能上传常见的mp4,ogg,flv,mkv格式文件,且不超过5M,最多上传{{picLimit}}个</span>
28
+ </el-form-item>
29
+ <el-form-item label="添加网络文件" class="dialog-form-item">
30
+ <el-col :span="14">
31
+ <el-input v-model="fileUrl"></el-input>
32
+ </el-col>
33
+ <el-col :span="5" :offset="1">
34
+ <el-button type="primary" @click="getNetFile">提取</el-button>
35
+ </el-col>
36
+ </el-form-item>
37
+ </el-form>
38
+ <div class="file-list">
39
+ <el-upload
40
+ v-if="!type || type=='0'"
41
+ ref="picUpload"
42
+ class="pic-div"
43
+ :action="fileUploadUrl"
44
+ :data="otherData"
45
+ :before-upload="beforeAvatarUpload"
46
+ :on-success="handelSuccess"
47
+ :with-credentials="true"
48
+ :on-remove="handleRemove"
49
+ list-type="picture-card"
50
+ :file-list="nFileList"
51
+ :multiple="multiple"
52
+ ></el-upload>
53
+ <el-upload
54
+ v-else
55
+ ref="picUpload"
56
+ :action="fileUploadUrl"
57
+ :data="otherData"
58
+ :with-credentials="true"
59
+ :on-success="handelSuccess"
60
+ :on-error="handelError"
61
+ :on-remove="handleRemove"
62
+ :before-upload="beforeUpload"
63
+ :file-list="nFileList"
64
+ :multiple="multiple"
65
+ ></el-upload>
66
+ </div>
67
+ <div slot="footer" class="dialog-footer">
68
+ <el-button @click="diaVisible = false">取消</el-button>
69
+ <el-button type="primary" @click="setFileList">确定</el-button>
70
+ </div>
71
+ </el-dialog>
72
+ </template>
73
+ <script>
74
+ import API from "#/api/common";
75
+ import { Loading } from "element-ui";
76
+ import { validateURL } from "#/utils/validate";
77
+ export default {
78
+ // props: ["fileList", "type", "limit", "visible", fileUploadUrl:{}],
79
+ props: {
80
+ fileList: Array,
81
+ type: String,
82
+ limit: Number,
83
+ visible: Boolean,
84
+ imgType: String,
85
+ num: Number,
86
+ multiple: {
87
+ type: Boolean,
88
+ default: false
89
+ },
90
+ fileUploadUrl: {
91
+ type: String,
92
+ default: process.env.API_ROOT + "/web/rs/goodsFile/uploadGoodsFile.json"
93
+ }
94
+ },
95
+ data() {
96
+ return {
97
+ title: "选择图片",
98
+ diaVisible: false,
99
+ fileUrl: "",
100
+ imgType: "jpg/png/gif",
101
+ num: 5,
102
+ picLimit: this.limit || 1,
103
+ nFileList: this.fileList || [],
104
+ otherData: {
105
+ tenantCode: "00000001"
106
+ },
107
+ uploading: [] //正在上传的文件集合
108
+ };
109
+ },
110
+
111
+ // mounted() {
112
+ // console.log(this.fileUploadUrl, "111111111111111111111111111111111111111.");
113
+ // if (!this.fileUploadUrl) {
114
+ // this.fileUploadUrl =
115
+ // process.env.API_ROOT + "/web/rs/goodsFile/uploadGoodsFile.json";
116
+ // }
117
+ // },
118
+ activated() {
119
+ console.log("组件被激活了");
120
+ },
121
+ methods: {
122
+ uploadPic(index, rows) {
123
+ //规格上传图片
124
+ this.rowSer = rows;
125
+ this.defaultPicList = rows.rsGoodsFileDomainList;
126
+ this.diaVisible = true;
127
+ },
128
+ handelClose() {
129
+ this.nFileList = [];
130
+ this.fileUrl = "";
131
+ this.$refs.picUpload.abort();
132
+ this.uploading = [];
133
+ this.$emit("toggle", false);
134
+ },
135
+ handleRemove(file, fileList) {
136
+ //移除正在上传的文件 需要从this.uploading中移除
137
+ let index = this.uploading.indexOf(file.uid);
138
+ if (index > -1) {
139
+ this.uploading.splice(index, 1);
140
+ }
141
+ this.nFileList = fileList;
142
+ },
143
+ beforeAvatarUpload(file) {
144
+ console.log(file, "file", this.beforeAvatarUpload);
145
+ //上传之前的回调
146
+ const fileType = /\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(
147
+ file.name.toLowerCase()
148
+ );
149
+ if (!fileType) {
150
+ this.$message.error("图片格式为常见的jpg、png、gif格式!");
151
+ }
152
+ const isLt2M = file.size / 1024 / 1024 < 5;
153
+ if (!isLt2M) {
154
+ this.$message.error("上传的图片大小不能超过 5MB!");
155
+ }
156
+ if (isLt2M && fileType) {
157
+ this.uploading.push(file.uid);
158
+ }
159
+ return isLt2M && fileType;
160
+ },
161
+ beforeUpload(file) {
162
+ //上传之前的回调
163
+ const fileType = /\.(mp4|ogg|flv|mkv|MP4|FLV|MKV|OGG)$/.test(
164
+ file.name.toLowerCase()
165
+ );
166
+ if (!fileType) {
167
+ this.$message.error("文件格式为常见的mp4,ogg,flv,mkv格式!");
168
+ }
169
+ const isLt2M = file.size / 1024 / 1024 < 5;
170
+ if (!isLt2M) {
171
+ this.$message.error("上传的文件大小不能超过5MB!");
172
+ }
173
+ if (isLt2M && fileType) {
174
+ this.uploading.push(file.uid);
175
+ }
176
+ return isLt2M && fileType;
177
+ },
178
+ handelSuccess(response, file, fileList) {
179
+ console.log(response);
180
+ console.log(file);
181
+ console.log(fileList);
182
+ if (
183
+ response &&
184
+ typeof response == "object" &&
185
+ "success" in response &&
186
+ !response.success
187
+ ) {
188
+ let nJson = JSON.parse(response.data.dataObj);
189
+ let nUrl = window.location.href;
190
+ if (process.env.NODE_ENV === "development") {
191
+ window.location.href =
192
+ process.env.API_ROOT + nJson.loginurl + "?url=" + nUrl;
193
+ } else {
194
+ window.location.href = nJson.loginurl + "?url=" + nUrl;
195
+ }
196
+ return;
197
+ }
198
+ let njson = {
199
+ name: file.name,
200
+ url: response.fileUrl,
201
+ goodsFileUrl: response.fileUrl,
202
+ uid: file.uid,
203
+ goodsFileType: this.type,
204
+ goodsFileName: response.fileCode,
205
+ status: "success"
206
+ };
207
+ //文件上传 需要从this.uploading中移除
208
+ let index = this.uploading.indexOf(file.uid);
209
+ this.uploading.splice(index, 1);
210
+
211
+ fileList.splice(fileList.indexOf(file), 1, njson);
212
+ console.log(fileList);
213
+ this.nFileList = fileList;
214
+ },
215
+ handelError(error, file, fileList) {
216
+ console.log(
217
+ response,
218
+ this.fileUploadUrl,
219
+ "handelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelError"
220
+ );
221
+ console.log(file);
222
+ console.log(fileList);
223
+ },
224
+ changeFile() {
225
+ if (this.nFileList.length >= this.picLimit) {
226
+ this.$message.error(
227
+ `最多上传${this.picLimit}${this.type == "0" ? "张图片" : "个文件"}`
228
+ );
229
+ return;
230
+ }
231
+ this.$refs.picUpload.$refs["upload-inner"].$el.dispatchEvent(
232
+ new MouseEvent("click")
233
+ );
234
+ },
235
+ getNetFile() {
236
+ if (this.nFileList.length >= this.picLimit) {
237
+ this.$message.error(
238
+ `最多上传${this.picLimit}${this.type == "0" ? "张图片" : "个文件"}`
239
+ );
240
+ this.fileUrl = "";
241
+ return;
242
+ }
243
+ if (validateURL(this.fileUrl)) {
244
+ let fileInfo = {
245
+ url: this.fileUrl,
246
+ goodsFileUrl: this.fileUrl,
247
+ name: this.fileUrl,
248
+ goodsFileType: this.type
249
+ };
250
+ this.nFileList.push(fileInfo);
251
+ this.fileUrl = "";
252
+ } else {
253
+ this.$message.error("请输入正确的图片地址");
254
+ }
255
+ },
256
+ setPicList(response, file, fileList) {},
257
+ beyond() {
258
+ //图片个数超出的验证
259
+ this.$message.error("最多5张!");
260
+ },
261
+ setFileList() {
262
+ let nList = [];
263
+ if (this.nFileList.length > 0) {
264
+ nList = JSON.parse(JSON.stringify(this.nFileList));
265
+ }
266
+ console.log(this.$refs.picUpload);
267
+ if (this.uploading.length > 0) {
268
+ this.$confirm(
269
+ "请确认所有文件都上传完成,继续操作会移除正在上传的文件!",
270
+ "提示",
271
+ {
272
+ confirmButtonText: "确定",
273
+ cancelButtonText: "取消",
274
+ type: "warning"
275
+ }
276
+ )
277
+ .then(() => {
278
+ this.$refs.picUpload.abort();
279
+ this.$emit("setFileList", nList);
280
+ this.diaVisible = false;
281
+ })
282
+ .catch(() => {});
283
+ } else {
284
+ this.$emit("setFileList", nList);
285
+ this.diaVisible = false;
286
+ }
287
+ }
288
+ },
289
+ mounted() {
290
+ console.log(this.multiple, "multiple");
291
+ },
292
+ watch: {
293
+ visible() {
294
+ this.diaVisible = this.visible;
295
+ if (this.visible) {
296
+ let nList = [];
297
+ if (this.fileList.length > 0) {
298
+ nList = JSON.parse(JSON.stringify(this.fileList));
299
+ nList.forEach(item => {
300
+ item.url = item.goodsFileUrl || item.url;
301
+ });
302
+ }
303
+ this.$nextTick(() => {
304
+ this.$refs.picUpload.$refs["upload-inner"].$el.style.display = "none";
305
+ });
306
+ this.nFileList = nList;
307
+ }
308
+ if (this.type && this.type == "1") {
309
+ this.title = "选择文件";
310
+ } else {
311
+ this.title = "选择图片";
312
+ }
313
+ },
314
+ limit() {
315
+ this.picLimit = this.limit || 1;
316
+ },
317
+ fileList() {
318
+ let nList = [];
319
+ if (this.fileList.length > 0) {
320
+ nList = JSON.parse(JSON.stringify(this.fileList));
321
+ }
322
+ this.nFileList = nList;
323
+ console.log(this.nFileList);
324
+ }
325
+ }
326
+ };
327
+ </script>
328
+
329
+ <style rel="stylesheet/scss" lang="scss" scoped>
330
+ .dialog-form {
331
+ width: 100%;
332
+ box-sizing: border-box;
333
+ padding-left: 20px;
334
+ .dialog-form-item {
335
+ width: 100% !important;
336
+ margin-left: 0 !important;
337
+ }
338
+ }
339
+ .el-dialog {
340
+ border-radius: 6px;
341
+ }
342
+ .file-btn {
343
+ position: relative;
344
+ overflow: hidden;
345
+ }
346
+ .file-input {
347
+ display: none;
348
+ }
349
+ .cor-red {
350
+ color: #ff0000;
351
+ }
352
+ </style>