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,558 +1,558 @@
1
- <template>
2
- <el-dialog :title="title" width="766px" :append-to-body="true" :visible.sync="diaVisible" @close="handelClose"
3
- class="file-box">
4
- <!-- 点击上传弹出的第一个框 -->
5
-
6
- <el-form class="dialog-form" v-if="!type || type == '0'">
7
- <span class="el-upload__tip cor-red">最多上传{{ picLimit }}张</span>
8
- <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
9
- <el-tab-pane label="上传本地图片" name="first"></el-tab-pane>
10
- <el-tab-pane label="添加网络图片" name="second"></el-tab-pane>
11
- <el-tab-pane label="图片库" name="third"></el-tab-pane>
12
- </el-tabs>
13
- <el-form-item label="上传本地图片" class="dialog-form-item" v-if="activeName == 'first'">
14
- <el-button type="primary" class="file-btn" @click="changeFile">添加图片</el-button>
15
- <span class="el-upload__tip cor-red">只能上传{{ imgType }}文件,且不超过{{ num || 5 }}M</span>
16
- </el-form-item>
17
- <el-form-item label="添加网络图片" class="dialog-form-item" v-if="activeName == 'second'">
18
- <el-col :span="14">
19
- <el-input v-model="fileUrl"></el-input>
20
- </el-col>
21
- <el-col :span="5" :offset="1">
22
- <el-button type="primary" @click="getNetFile">提取</el-button>
23
- </el-col>
24
- </el-form-item>
25
- <el-form-item class="dialog-form-item" v-if="activeName == 'third'">
26
- <el-row>
27
- <el-col :span="2">货号:</el-col>
28
- <el-col :span="14">
29
- <el-input v-model="skuNo"></el-input>
30
- </el-col>
31
- <el-col :span="5" :offset="1">
32
- <el-button type="primary" @click="getSkuImg">查询</el-button>
33
- </el-col>
34
- </el-row>
35
- <el-row style="margin-top: 20px">
36
- <el-checkbox-group :max="picLimit || 5" v-model="checkList" @change="hanlderFileImg">
37
- <el-checkbox v-for="(item, index) in arrList" :label="item" :key="index">
38
- <img v-lazy="item.fileUrl" class="image"
39
- v-if="item.fileUrl.indexOf('http') > -1 || item.fileUrl.indexOf('https')>-1 || item.fileUrl.indexOf('paas/shop') > -1" />
40
- <img v-lazy="imgUrl + item.fileUrl" class="image" v-else />
41
- </el-checkbox>
42
- </el-checkbox-group>
43
- <div v-if="btnShow" style="text-align: center">
44
- <el-button type="text" @click="morePage">更多</el-button>
45
- </div>
46
- </el-row>
47
- </el-form-item>
48
- </el-form>
49
- <el-form class="dialog-form" v-else>
50
- <el-form-item label="上传本地文件" class="dialog-form-item">
51
- <el-button type="primary" class="file-btn" @click="changeFile">添加文件</el-button>
52
- <span class="el-upload__tip cor-red" v-if="noLimit">只能上传常见的mp4,ogg,flv,mkv格式文件</span>
53
- <span class="el-upload__tip cor-red"
54
- v-else>只能上传常见的mp4,ogg,flv,mkv格式文件,且不超过{{ nums || 5 }}M,最多上传{{ picLimit }}个</span>
55
- </el-form-item>
56
- <el-form-item label="添加网络文件" class="dialog-form-item">
57
- <el-col :span="14">
58
- <el-input v-model="fileUrl"></el-input>
59
- </el-col>
60
- <el-col :span="5" :offset="1">
61
- <el-button type="primary" @click="getNetFile">提取</el-button>
62
- </el-col>
63
- </el-form-item>
64
- </el-form>
65
- <div class="file-list">
66
- <el-upload v-if="!type || type == '0'" ref="picUpload" class="pic-div" :action="fileUploadUrl" :data="otherData"
67
- :before-upload="beforeAvatarUpload" :on-success="handelSuccess" :with-credentials="true"
68
- :on-remove="handleRemove" list-type="picture-card" :file-list="nFileList" :multiple="multiple"></el-upload>
69
- <el-upload v-else ref="picUpload" :action="fileUploadUrl" :data="otherData" :with-credentials="true"
70
- :on-success="handelSuccess" :on-error="handelError" :on-remove="handleRemove" :before-upload="beforeUpload"
71
- :file-list="nFileList" :multiple="multiple"></el-upload>
72
- </div>
73
- <div slot="footer" class="dialog-footer">
74
- <el-button @click="diaVisible = false">取消</el-button>
75
- <el-button type="primary"
76
- v-show="(uploading.length == 0 && activeName == 'first') || activeName == 'second' || activeName == 'third'"
77
- @click="setFileList">确定</el-button>
78
- </div>
79
- </el-dialog>
80
- </template>
81
- <script>
82
- import API from '#/api/common';
83
- import request from '#/utils/request';
84
- const querystring = require('querystring');
85
- import {
86
- Loading
87
- } from 'element-ui';
88
- import {
89
- validateURL
90
- } from '#/utils/validate';
91
- export default {
92
- // props: ["fileList", "type", "limit", "visible", fileUploadUrl:{}],
93
- props: {
94
- fileList: Array,
95
- type: String,
96
- limit: Number,
97
- visible: Boolean,
98
- imgType: String,
99
- num: {
100
- type: Number,
101
- default: 5,
102
- },
103
- nums: {
104
- type: Number,
105
- default: 5,
106
- },
107
- noLimit: {
108
- type: Boolean,
109
- default: false,
110
- },
111
- multiple: {
112
- type: Boolean,
113
- default: false,
114
- },
115
- fileUploadUrl: {
116
- type: String,
117
- default: '/web/rs/goodsFile/uploadGoodsFile.json',
118
- },
119
- fileImgUrl: {
120
- type: String,
121
- default: '/web/fm/file/queryFilelistView.json?fileSort=FILE_GD',
122
- },
123
- },
124
- data() {
125
- return {
126
- imgUrl: process.env.API_ROOT + '/paas/shop/',
127
- checked: true,
128
- activeName: 'first',
129
- title: '选择图片',
130
- diaVisible: false,
131
- fileUrl: '',
132
- imgType: 'jpg/png/gif',
133
- noLimit: false,
134
- total: '',
135
- pageNo: 1,
136
- pageSize: 10,
137
- picLimit: this.limit || 1,
138
- nFileList: this.fileList || [],
139
- otherData: {
140
- tenantCode: '00000001',
141
- },
142
- checkList: [],
143
- tabName: '',
144
- imgList: [],
145
- arrList: [],
146
- skuNo: '',
147
- btnShow: true,
148
- imgState: true,
149
- fileListArray: [], //初始化组件时候
150
- imgUrlArrayList: [], //判断哪些添加了
151
- uploading: [], //正在上传的文件集合
152
- secDomainName: null,
153
- fileUploadUrls: null,
154
- fileImgUrls: null
155
- };
156
- },
157
-
158
- mounted() {
159
- let hrefs = window.location.href,
160
- hosts = window.location.host;
161
- if (hrefs && hosts) {
162
- let name = hrefs.split(hosts)[1] ? hrefs.split(hosts)[1].split('/')[1] : null;
163
- this.secDomainName = name && name !== 'paas' && process.env.NODE_ENV != 'development' ? process.env.API_ROOT +
164
- '/' + name : process.env.API_ROOT
165
- } else {
166
- this.secDomainName = process.env.API_ROOT
167
- }
168
- this.imgUrl = this.secDomainName + '/paas/shop/';
169
- this.fileUploadUrls = this.secDomainName + this.fileUploadUrl;
170
- this.fileImgUrls = this.secDomainName + this.fileImgUrls;
171
- },
172
- methods: {
173
- handleClick(tab, event) {
174
- this.tabName = tab.name;
175
- if (tab.name == 'third') {
176
- if (this.imgState) {
177
- this.getImgData();
178
- this.checkList = [];
179
- }
180
- }
181
- },
182
- hanlderFileImg(data) {
183
- console.log(data, this.nFileList);
184
- },
185
- getImgData() {
186
- console.log(this.fileImgUrl);
187
-
188
- request({
189
- url: this.fileImgUrl,
190
- method: 'post',
191
- data: querystring.stringify({
192
- rows: this.pageSize,
193
- page: this.pageNo
194
- }),
195
- }).then((res) => {
196
- console.log(res.rows);
197
-
198
- this.imgList = res.rows;
199
- this.arrList = this.arrList.concat(this.imgList);
200
- this.total = res.total;
201
- this.imgState = false;
202
- if (res && res.total > this.pageSize) {
203
- this.btnShow = true;
204
- } else {
205
- this.btnShow = false;
206
- }
207
- });
208
- },
209
- getSkuImg() {
210
- this.fileImgUrl = this.secDomainName + '/web/fm/file/queryFilelistView.json?fileSort=FILE_GD&fileRemark=' + this
211
- .skuNo;
212
- this.arrList = [];
213
- this.pageNo = 1;
214
- this.getImgData();
215
- },
216
- morePage() {
217
- this.pageNo++;
218
- var pagelist = Math.ceil(this.total / this.pageSize);
219
- // console.log(this.pageNo, pagelist);
220
- if (this.pageNo <= pagelist) {
221
- this.getImgData();
222
- // this.arrList.concat(this.imgList)
223
- } else {
224
- this.btnShow = false;
225
- }
226
- },
227
- handleSizeChange(val) {
228
- //分页
229
- this.pageSize = val;
230
- this.getImgData();
231
- },
232
- handleCurrentChange(val) {
233
- this.pageNo = val;
234
- this.getImgData();
235
- },
236
-
237
- uploadPic(index, rows) {
238
- //规格上传图片
239
- this.rowSer = rows;
240
- this.defaultPicList = rows.rsGoodsFileDomainList;
241
- this.diaVisible = true;
242
- },
243
- handelClose() {
244
- this.nFileList = [];
245
- this.fileUrl = '';
246
- if (this.$refs.picUpload) {
247
- this.$refs.picUpload.abort();
248
- }
249
- this.uploading = [];
250
- this.$emit('toggle', false);
251
- },
252
- handleRemove(file, fileList) {
253
- console.log(file, '0000');
254
- this.checkList.forEach((el, index) => {
255
- if (`/paas/shop/${el.fileUrl}` == file.url) {
256
- this.checkList.splice(index, 1);
257
- }
258
- });
259
- //移除正在上传的文件 需要从this.uploading中移除
260
- let index = this.uploading.indexOf(file.uid);
261
- if (index > -1) {
262
- this.uploading.splice(index, 1);
263
- }
264
- this.nFileList = fileList;
265
- this.fileListArray = [];
266
- this.nFileList.forEach((el) => {
267
- this.fileListArray.push(el.url);
268
- });
269
- },
270
- beforeAvatarUpload(file) {
271
- console.log(file, 'file', this.beforeAvatarUpload);
272
- //上传之前的回调
273
- const fileType = /\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(file.name.toLowerCase());
274
- if (!fileType) {
275
- this.$message.error('图片格式为常见的jpg、png、gif格式!');
276
- }
277
- const isLt2M = file.size / 1024 / 1024 < (this.num ? this.num : this.nums);
278
- if (!isLt2M) {
279
- this.$message.error('上传的图片大小不能超过 ' + (this.num ? this.num : this.nums) + 'MB!');
280
- }
281
- if (isLt2M && fileType) {
282
- this.uploading.push(file.uid);
283
- }
284
- return isLt2M && fileType;
285
- },
286
- beforeUpload(file) {
287
- //上传之前的回调
288
- const fileType = /\.(mp4|ogg|flv|mkv|MP4|FLV|MKV|OGG)$/.test(file.name.toLowerCase());
289
- if (!fileType) {
290
- this.$message.error('文件格式为常见的mp4,ogg,flv,mkv格式!');
291
- }
292
- if (this.noLimit) {
293
- return fileType;
294
- } else {
295
- const isLt2M = file.size / 1024 / 1024 < (this.num ? this.num : this.nums);
296
- if (!isLt2M) {
297
- this.$message.error('上传的文件大小不能超过 ' + (this.num ? this.num : this.nums) + 'MB!');
298
- }
299
- if (isLt2M && fileType) {
300
- this.uploading.push(file.uid);
301
- }
302
- return isLt2M && fileType;
303
- }
304
- },
305
- handelSuccess(response, file, fileList) {
306
- console.log(response);
307
- console.log(file);
308
- console.log(fileList, '999');
309
- if (response && typeof response == 'object' && 'success' in response && !response.success) {
310
- let nJson = JSON.parse(response.data.dataObj);
311
- let nUrl = window.location.href;
312
- if (process.env.NODE_ENV === 'development') {
313
- window.location.href = this.secDomainName + nJson.loginurl + '?url=' + nUrl;
314
- } else {
315
- window.location.href = this.secDomainName + nJson.loginurl + '?url=' + nUrl;
316
- }
317
- return;
318
- }
319
- let njson = {
320
- name: file.name,
321
- url: response.fileUrl,
322
- goodsFileUrl: response.fileUrl,
323
- uid: file.uid,
324
- goodsFileType: this.type,
325
- goodsFileName: response.fileCode,
326
- status: 'success',
327
- };
328
- //文件上传 需要从this.uploading中移除
329
- let index = this.uploading.indexOf(file.uid);
330
- this.uploading.splice(index, 1);
331
-
332
- fileList.splice(fileList.indexOf(file), 1, njson);
333
- console.log(fileList);
334
- this.nFileList = fileList;
335
- },
336
- handelError(error, file, fileList) {
337
- console.log(response, this.fileUploadUrl,
338
- 'handelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelError');
339
- console.log(file);
340
- console.log(fileList);
341
- },
342
- changeFile() {
343
- if (this.nFileList.length >= this.picLimit) {
344
- this.$message.error(`最多上传${this.picLimit}${this.type == '0' ? '张图片' : '个文件'}`);
345
- return;
346
- }
347
- this.$refs.picUpload.$refs['upload-inner'].$el.dispatchEvent(new MouseEvent('click'));
348
- },
349
- getNetFile() {
350
- if (this.nFileList.length >= this.picLimit) {
351
- this.$message.error(`最多上传${this.picLimit}${this.type == '0' ? '张图片' : '个文件'}`);
352
- this.fileUrl = '';
353
- return;
354
- }
355
- if (validateURL(this.fileUrl)) {
356
- let fileInfo = {
357
- url: this.fileUrl,
358
- goodsFileUrl: this.fileUrl,
359
- name: this.fileUrl,
360
- goodsFileType: this.type,
361
- };
362
- this.nFileList.push(fileInfo);
363
- this.fileUrl = '';
364
- } else {
365
- this.$message.error('请输入正确的图片地址');
366
- }
367
- },
368
- setPicList(response, file, fileList) {},
369
- beyond() {
370
- //图片个数超出的验证
371
- this.$message.error('最多5张!');
372
- },
373
- setFileList() {
374
- let nList = [];
375
- console.log(this.imgUrlArrayList, 'xx imgUrlArrayList');
376
- if (this.nFileList.length > 0) {
377
- nList = JSON.parse(JSON.stringify(this.nFileList));
378
- }
379
- this.checkList.forEach((res) => {
380
- if (this.imgUrlArrayList.indexOf(`/paas/shop/${res.fileUrl}`) < 0) {
381
- // if (res.fileUrl.indexOf('http') > -1) {
382
- nList.push({
383
- url: `${res.fileUrl}`,
384
- goodsFileUrl: `${res.fileUrl}`,
385
- name: res.fileName,
386
- });
387
- // } else {
388
- // nList.push({
389
- // url: `/paas/shop/${res.fileUrl}`,
390
- // goodsFileUrl: `/paas/shop/${res.fileUrl}`,
391
- // name: res.fileName,
392
- // });
393
- // }
394
- }
395
- });
396
- this.imgUrlArrayList = this.fileListArray;
397
- if (this.uploading.length > 0) {
398
- this.$confirm('请确认所有文件都上传完成,继续操作会移除正在上传的文件!', '提示', {
399
- confirmButtonText: '确定',
400
- cancelButtonText: '取消',
401
- type: 'warning',
402
- }).then(() => {
403
- this.$refs.picUpload.abort();
404
- this.$emit('setFileList', nList);
405
- this.diaVisible = false;
406
- });
407
- } else {
408
- this.$emit('setFileList', nList);
409
- this.diaVisible = false;
410
- }
411
- },
412
- },
413
- watch: {
414
- visible() {
415
- this.diaVisible = this.visible;
416
- if (this.visible) {
417
- if (this.fileImgUrl && this.fileImgUrl.lastIndexOf('&fileRemark') > -1) {
418
- let index = this.fileImgUrl.lastIndexOf('=');
419
- console.log(index, index, '0000');
420
- if (index > -1) {
421
- console.log(index);
422
- this.skuNo = this.fileImgUrl.slice(index + 1);
423
- }
424
- } else {
425
- this.skuNo = '';
426
- }
427
- console.log(this.skuNo, '00000');
428
- let nList = [],
429
- delList = [];
430
- if (this.fileList.length > 0) {
431
- nList = JSON.parse(JSON.stringify(this.fileList));
432
- //查找删除后的存在的对象
433
- nList.forEach((el, index) => {
434
- if (this.fileListArray.indexOf(el.goodsFileUrl || el.url) >= 0) {
435
- delList.push(el.goodsFileUrl || el.url);
436
- }
437
- });
438
- // console.log(delList, this.checkList, "this.checkList");
439
- this.checkList.forEach((el, index) => {
440
- if (delList.indexOf(`/paas/shop/${el.fileUrl}`) < 0) {
441
- this.checkList.splice(index, 1);
442
- }
443
- });
444
- this.fileListArray = [];
445
- nList.forEach((item) => {
446
- item.url = item.goodsFileUrl || item.url;
447
- this.fileListArray.push(item.url);
448
- });
449
- } else {
450
- this.checkList = [];
451
- this.fileListArray = [];
452
- }
453
- this.$nextTick(() => {
454
- console.log(this.$refs);
455
- if (this.$refs) {
456
- this.$refs.picUpload.$refs['upload-inner'].$el.style.display = 'none';
457
- }
458
- });
459
- this.nFileList = nList;
460
- }
461
- if (this.type && this.type == '1') {
462
- this.title = '选择文件';
463
- } else {
464
- this.title = '选择图片';
465
- }
466
- },
467
- limit() {
468
- this.picLimit = this.limit || 1;
469
- },
470
- fileList() {
471
- let nList = [];
472
- if (this.fileList.length > 0) {
473
- nList = JSON.parse(JSON.stringify(this.fileList));
474
- }
475
- this.nFileList = nList;
476
- console.log(this.nFileList);
477
- },
478
- },
479
- };
480
- </script>
481
-
482
- <style rel="stylesheet/scss" lang="scss" scoped>
483
- .dialog-form {
484
- width: 100%;
485
- box-sizing: border-box;
486
- padding-left: 20px;
487
-
488
- .dialog-form-item {
489
- width: 100% !important;
490
- margin-left: 0 !important;
491
- }
492
- }
493
-
494
- .el-dialog {
495
- border-radius: 6px;
496
- }
497
-
498
- .file-btn {
499
- position: relative;
500
- overflow: hidden;
501
- }
502
-
503
- .file-input {
504
- display: none;
505
- }
506
-
507
- .cor-red {
508
- color: #ff0000;
509
- }
510
-
511
- .image {
512
- width: 100px;
513
- height: 100px;
514
- display: block;
515
- }
516
-
517
- .clearfix:before,
518
- .clearfix:after {
519
- display: table;
520
- content: '';
521
- }
522
-
523
- .clearfix:after {
524
- clear: both;
525
- }
526
-
527
- .elcard {
528
- margin-top: 20px;
529
- }
530
- </style>
531
- <style lang="scss">
532
- .file-box {
533
- .el-checkbox {
534
- margin-left: 30px;
535
- position: relative;
536
-
537
- .el-checkbox__input {
538
- position: absolute;
539
- top: 0;
540
- left: 0;
541
- }
542
-
543
- .el-checkbox__label {
544
- padding: 0;
545
- }
546
- }
547
-
548
- .el-checkbox-group {
549
- height: 230px;
550
- overflow-y: scroll;
551
- }
552
-
553
- .el-upload-list--picture-card .el-upload-list__item {
554
- width: 100px;
555
- height: 100px;
556
- }
557
- }
558
- </style>
1
+ <template>
2
+ <el-dialog :title="title" width="766px" :append-to-body="true" :visible.sync="diaVisible" @close="handelClose"
3
+ class="file-box">
4
+ <!-- 点击上传弹出的第一个框 -->
5
+
6
+ <el-form class="dialog-form" v-if="!type || type == '0'">
7
+ <span class="el-upload__tip cor-red">最多上传{{ picLimit }}张</span>
8
+ <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
9
+ <el-tab-pane label="上传本地图片" name="first"></el-tab-pane>
10
+ <el-tab-pane label="添加网络图片" name="second"></el-tab-pane>
11
+ <el-tab-pane label="图片库" name="third"></el-tab-pane>
12
+ </el-tabs>
13
+ <el-form-item label="上传本地图片" class="dialog-form-item" v-if="activeName == 'first'">
14
+ <el-button type="primary" class="file-btn" @click="changeFile">添加图片</el-button>
15
+ <span class="el-upload__tip cor-red">只能上传{{ imgType }}文件,且不超过{{ num || 5 }}M</span>
16
+ </el-form-item>
17
+ <el-form-item label="添加网络图片" class="dialog-form-item" v-if="activeName == 'second'">
18
+ <el-col :span="14">
19
+ <el-input v-model="fileUrl"></el-input>
20
+ </el-col>
21
+ <el-col :span="5" :offset="1">
22
+ <el-button type="primary" @click="getNetFile">提取</el-button>
23
+ </el-col>
24
+ </el-form-item>
25
+ <el-form-item class="dialog-form-item" v-if="activeName == 'third'">
26
+ <el-row>
27
+ <el-col :span="2">货号:</el-col>
28
+ <el-col :span="14">
29
+ <el-input v-model="skuNo"></el-input>
30
+ </el-col>
31
+ <el-col :span="5" :offset="1">
32
+ <el-button type="primary" @click="getSkuImg">查询</el-button>
33
+ </el-col>
34
+ </el-row>
35
+ <el-row style="margin-top: 20px">
36
+ <el-checkbox-group :max="picLimit || 5" v-model="checkList" @change="hanlderFileImg">
37
+ <el-checkbox v-for="(item, index) in arrList" :label="item" :key="index">
38
+ <img v-lazy="item.fileUrl" class="image"
39
+ v-if="item.fileUrl.indexOf('http') > -1 || item.fileUrl.indexOf('https')>-1 || item.fileUrl.indexOf('paas/shop') > -1" />
40
+ <img v-lazy="imgUrl + item.fileUrl" class="image" v-else />
41
+ </el-checkbox>
42
+ </el-checkbox-group>
43
+ <div v-if="btnShow" style="text-align: center">
44
+ <el-button type="text" @click="morePage">更多</el-button>
45
+ </div>
46
+ </el-row>
47
+ </el-form-item>
48
+ </el-form>
49
+ <el-form class="dialog-form" v-else>
50
+ <el-form-item label="上传本地文件" class="dialog-form-item">
51
+ <el-button type="primary" class="file-btn" @click="changeFile">添加文件</el-button>
52
+ <span class="el-upload__tip cor-red" v-if="noLimit">只能上传常见的mp4,ogg,flv,mkv格式文件</span>
53
+ <span class="el-upload__tip cor-red"
54
+ v-else>只能上传常见的mp4,ogg,flv,mkv格式文件,且不超过{{ nums || 5 }}M,最多上传{{ picLimit }}个</span>
55
+ </el-form-item>
56
+ <el-form-item label="添加网络文件" class="dialog-form-item">
57
+ <el-col :span="14">
58
+ <el-input v-model="fileUrl"></el-input>
59
+ </el-col>
60
+ <el-col :span="5" :offset="1">
61
+ <el-button type="primary" @click="getNetFile">提取</el-button>
62
+ </el-col>
63
+ </el-form-item>
64
+ </el-form>
65
+ <div class="file-list">
66
+ <el-upload v-if="!type || type == '0'" ref="picUpload" class="pic-div" :action="fileUploadUrl" :data="otherData"
67
+ :before-upload="beforeAvatarUpload" :on-success="handelSuccess" :with-credentials="true"
68
+ :on-remove="handleRemove" list-type="picture-card" :file-list="nFileList" :multiple="multiple"></el-upload>
69
+ <el-upload v-else ref="picUpload" :action="fileUploadUrl" :data="otherData" :with-credentials="true"
70
+ :on-success="handelSuccess" :on-error="handelError" :on-remove="handleRemove" :before-upload="beforeUpload"
71
+ :file-list="nFileList" :multiple="multiple"></el-upload>
72
+ </div>
73
+ <div slot="footer" class="dialog-footer">
74
+ <el-button @click="diaVisible = false">取消</el-button>
75
+ <el-button type="primary"
76
+ v-show="(uploading.length == 0 && activeName == 'first') || activeName == 'second' || activeName == 'third'"
77
+ @click="setFileList">确定</el-button>
78
+ </div>
79
+ </el-dialog>
80
+ </template>
81
+ <script>
82
+ import API from '#/api/common';
83
+ import request from '#/utils/request';
84
+ const querystring = require('querystring');
85
+ import {
86
+ Loading
87
+ } from 'element-ui';
88
+ import {
89
+ validateURL
90
+ } from '#/utils/validate';
91
+ export default {
92
+ // props: ["fileList", "type", "limit", "visible", fileUploadUrl:{}],
93
+ props: {
94
+ fileList: Array,
95
+ type: String,
96
+ limit: Number,
97
+ visible: Boolean,
98
+ imgType: String,
99
+ num: {
100
+ type: Number,
101
+ default: 5,
102
+ },
103
+ nums: {
104
+ type: Number,
105
+ default: 5,
106
+ },
107
+ noLimit: {
108
+ type: Boolean,
109
+ default: false,
110
+ },
111
+ multiple: {
112
+ type: Boolean,
113
+ default: false,
114
+ },
115
+ fileUploadUrl: {
116
+ type: String,
117
+ default: '/web/rs/goodsFile/uploadGoodsFile.json',
118
+ },
119
+ fileImgUrl: {
120
+ type: String,
121
+ default: '/web/fm/file/queryFilelistView.json?fileSort=FILE_GD',
122
+ },
123
+ },
124
+ data() {
125
+ return {
126
+ imgUrl: process.env.API_ROOT + '/paas/shop/',
127
+ checked: true,
128
+ activeName: 'first',
129
+ title: '选择图片',
130
+ diaVisible: false,
131
+ fileUrl: '',
132
+ imgType: 'jpg/png/gif',
133
+ noLimit: false,
134
+ total: '',
135
+ pageNo: 1,
136
+ pageSize: 10,
137
+ picLimit: this.limit || 1,
138
+ nFileList: this.fileList || [],
139
+ otherData: {
140
+ tenantCode: '00000001',
141
+ },
142
+ checkList: [],
143
+ tabName: '',
144
+ imgList: [],
145
+ arrList: [],
146
+ skuNo: '',
147
+ btnShow: true,
148
+ imgState: true,
149
+ fileListArray: [], //初始化组件时候
150
+ imgUrlArrayList: [], //判断哪些添加了
151
+ uploading: [], //正在上传的文件集合
152
+ secDomainName: null,
153
+ fileUploadUrls: null,
154
+ fileImgUrls: null
155
+ };
156
+ },
157
+
158
+ mounted() {
159
+ let hrefs = window.location.href,
160
+ hosts = window.location.host;
161
+ if (hrefs && hosts) {
162
+ let name = hrefs.split(hosts)[1] ? hrefs.split(hosts)[1].split('/')[1] : null;
163
+ this.secDomainName = name && name !== 'paas' && process.env.NODE_ENV != 'development' ? process.env.API_ROOT +
164
+ '/' + name : process.env.API_ROOT
165
+ } else {
166
+ this.secDomainName = process.env.API_ROOT
167
+ }
168
+ this.imgUrl = this.secDomainName + '/paas/shop/';
169
+ this.fileUploadUrls = this.secDomainName + this.fileUploadUrl;
170
+ this.fileImgUrls = this.secDomainName + this.fileImgUrls;
171
+ },
172
+ methods: {
173
+ handleClick(tab, event) {
174
+ this.tabName = tab.name;
175
+ if (tab.name == 'third') {
176
+ if (this.imgState) {
177
+ this.getImgData();
178
+ this.checkList = [];
179
+ }
180
+ }
181
+ },
182
+ hanlderFileImg(data) {
183
+ console.log(data, this.nFileList);
184
+ },
185
+ getImgData() {
186
+ console.log(this.fileImgUrl);
187
+
188
+ request({
189
+ url: this.fileImgUrl,
190
+ method: 'post',
191
+ data: querystring.stringify({
192
+ rows: this.pageSize,
193
+ page: this.pageNo
194
+ }),
195
+ }).then((res) => {
196
+ console.log(res.rows);
197
+
198
+ this.imgList = res.rows;
199
+ this.arrList = this.arrList.concat(this.imgList);
200
+ this.total = res.total;
201
+ this.imgState = false;
202
+ if (res && res.total > this.pageSize) {
203
+ this.btnShow = true;
204
+ } else {
205
+ this.btnShow = false;
206
+ }
207
+ });
208
+ },
209
+ getSkuImg() {
210
+ this.fileImgUrl = this.secDomainName + '/web/fm/file/queryFilelistView.json?fileSort=FILE_GD&fileRemark=' + this
211
+ .skuNo;
212
+ this.arrList = [];
213
+ this.pageNo = 1;
214
+ this.getImgData();
215
+ },
216
+ morePage() {
217
+ this.pageNo++;
218
+ var pagelist = Math.ceil(this.total / this.pageSize);
219
+ // console.log(this.pageNo, pagelist);
220
+ if (this.pageNo <= pagelist) {
221
+ this.getImgData();
222
+ // this.arrList.concat(this.imgList)
223
+ } else {
224
+ this.btnShow = false;
225
+ }
226
+ },
227
+ handleSizeChange(val) {
228
+ //分页
229
+ this.pageSize = val;
230
+ this.getImgData();
231
+ },
232
+ handleCurrentChange(val) {
233
+ this.pageNo = val;
234
+ this.getImgData();
235
+ },
236
+
237
+ uploadPic(index, rows) {
238
+ //规格上传图片
239
+ this.rowSer = rows;
240
+ this.defaultPicList = rows.rsGoodsFileDomainList;
241
+ this.diaVisible = true;
242
+ },
243
+ handelClose() {
244
+ this.nFileList = [];
245
+ this.fileUrl = '';
246
+ if (this.$refs.picUpload) {
247
+ this.$refs.picUpload.abort();
248
+ }
249
+ this.uploading = [];
250
+ this.$emit('toggle', false);
251
+ },
252
+ handleRemove(file, fileList) {
253
+ console.log(file, '0000');
254
+ this.checkList.forEach((el, index) => {
255
+ if (`/paas/shop/${el.fileUrl}` == file.url) {
256
+ this.checkList.splice(index, 1);
257
+ }
258
+ });
259
+ //移除正在上传的文件 需要从this.uploading中移除
260
+ let index = this.uploading.indexOf(file.uid);
261
+ if (index > -1) {
262
+ this.uploading.splice(index, 1);
263
+ }
264
+ this.nFileList = fileList;
265
+ this.fileListArray = [];
266
+ this.nFileList.forEach((el) => {
267
+ this.fileListArray.push(el.url);
268
+ });
269
+ },
270
+ beforeAvatarUpload(file) {
271
+ console.log(file, 'file', this.beforeAvatarUpload);
272
+ //上传之前的回调
273
+ const fileType = /\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(file.name.toLowerCase());
274
+ if (!fileType) {
275
+ this.$message.error('图片格式为常见的jpg、png、gif格式!');
276
+ }
277
+ const isLt2M = file.size / 1024 / 1024 < (this.num ? this.num : this.nums);
278
+ if (!isLt2M) {
279
+ this.$message.error('上传的图片大小不能超过 ' + (this.num ? this.num : this.nums) + 'MB!');
280
+ }
281
+ if (isLt2M && fileType) {
282
+ this.uploading.push(file.uid);
283
+ }
284
+ return isLt2M && fileType;
285
+ },
286
+ beforeUpload(file) {
287
+ //上传之前的回调
288
+ const fileType = /\.(mp4|ogg|flv|mkv|MP4|FLV|MKV|OGG)$/.test(file.name.toLowerCase());
289
+ if (!fileType) {
290
+ this.$message.error('文件格式为常见的mp4,ogg,flv,mkv格式!');
291
+ }
292
+ if (this.noLimit) {
293
+ return fileType;
294
+ } else {
295
+ const isLt2M = file.size / 1024 / 1024 < (this.num ? this.num : this.nums);
296
+ if (!isLt2M) {
297
+ this.$message.error('上传的文件大小不能超过 ' + (this.num ? this.num : this.nums) + 'MB!');
298
+ }
299
+ if (isLt2M && fileType) {
300
+ this.uploading.push(file.uid);
301
+ }
302
+ return isLt2M && fileType;
303
+ }
304
+ },
305
+ handelSuccess(response, file, fileList) {
306
+ console.log(response);
307
+ console.log(file);
308
+ console.log(fileList, '999');
309
+ if (response && typeof response == 'object' && 'success' in response && !response.success) {
310
+ let nJson = JSON.parse(response.data.dataObj);
311
+ let nUrl = window.location.href;
312
+ if (process.env.NODE_ENV === 'development') {
313
+ window.location.href = this.secDomainName + nJson.loginurl + '?url=' + nUrl;
314
+ } else {
315
+ window.location.href = this.secDomainName + nJson.loginurl + '?url=' + nUrl;
316
+ }
317
+ return;
318
+ }
319
+ let njson = {
320
+ name: file.name,
321
+ url: response.fileUrl,
322
+ goodsFileUrl: response.fileUrl,
323
+ uid: file.uid,
324
+ goodsFileType: this.type,
325
+ goodsFileName: response.fileCode,
326
+ status: 'success',
327
+ };
328
+ //文件上传 需要从this.uploading中移除
329
+ let index = this.uploading.indexOf(file.uid);
330
+ this.uploading.splice(index, 1);
331
+
332
+ fileList.splice(fileList.indexOf(file), 1, njson);
333
+ console.log(fileList);
334
+ this.nFileList = fileList;
335
+ },
336
+ handelError(error, file, fileList) {
337
+ console.log(response, this.fileUploadUrl,
338
+ 'handelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelErrorhandelError');
339
+ console.log(file);
340
+ console.log(fileList);
341
+ },
342
+ changeFile() {
343
+ if (this.nFileList.length >= this.picLimit) {
344
+ this.$message.error(`最多上传${this.picLimit}${this.type == '0' ? '张图片' : '个文件'}`);
345
+ return;
346
+ }
347
+ this.$refs.picUpload.$refs['upload-inner'].$el.dispatchEvent(new MouseEvent('click'));
348
+ },
349
+ getNetFile() {
350
+ if (this.nFileList.length >= this.picLimit) {
351
+ this.$message.error(`最多上传${this.picLimit}${this.type == '0' ? '张图片' : '个文件'}`);
352
+ this.fileUrl = '';
353
+ return;
354
+ }
355
+ if (validateURL(this.fileUrl)) {
356
+ let fileInfo = {
357
+ url: this.fileUrl,
358
+ goodsFileUrl: this.fileUrl,
359
+ name: this.fileUrl,
360
+ goodsFileType: this.type,
361
+ };
362
+ this.nFileList.push(fileInfo);
363
+ this.fileUrl = '';
364
+ } else {
365
+ this.$message.error('请输入正确的图片地址');
366
+ }
367
+ },
368
+ setPicList(response, file, fileList) {},
369
+ beyond() {
370
+ //图片个数超出的验证
371
+ this.$message.error('最多5张!');
372
+ },
373
+ setFileList() {
374
+ let nList = [];
375
+ console.log(this.imgUrlArrayList, 'xx imgUrlArrayList');
376
+ if (this.nFileList.length > 0) {
377
+ nList = JSON.parse(JSON.stringify(this.nFileList));
378
+ }
379
+ this.checkList.forEach((res) => {
380
+ if (this.imgUrlArrayList.indexOf(`/paas/shop/${res.fileUrl}`) < 0) {
381
+ // if (res.fileUrl.indexOf('http') > -1) {
382
+ nList.push({
383
+ url: `${res.fileUrl}`,
384
+ goodsFileUrl: `${res.fileUrl}`,
385
+ name: res.fileName,
386
+ });
387
+ // } else {
388
+ // nList.push({
389
+ // url: `/paas/shop/${res.fileUrl}`,
390
+ // goodsFileUrl: `/paas/shop/${res.fileUrl}`,
391
+ // name: res.fileName,
392
+ // });
393
+ // }
394
+ }
395
+ });
396
+ this.imgUrlArrayList = this.fileListArray;
397
+ if (this.uploading.length > 0) {
398
+ this.$confirm('请确认所有文件都上传完成,继续操作会移除正在上传的文件!', '提示', {
399
+ confirmButtonText: '确定',
400
+ cancelButtonText: '取消',
401
+ type: 'warning',
402
+ }).then(() => {
403
+ this.$refs.picUpload.abort();
404
+ this.$emit('setFileList', nList);
405
+ this.diaVisible = false;
406
+ });
407
+ } else {
408
+ this.$emit('setFileList', nList);
409
+ this.diaVisible = false;
410
+ }
411
+ },
412
+ },
413
+ watch: {
414
+ visible() {
415
+ this.diaVisible = this.visible;
416
+ if (this.visible) {
417
+ if (this.fileImgUrl && this.fileImgUrl.lastIndexOf('&fileRemark') > -1) {
418
+ let index = this.fileImgUrl.lastIndexOf('=');
419
+ console.log(index, index, '0000');
420
+ if (index > -1) {
421
+ console.log(index);
422
+ this.skuNo = this.fileImgUrl.slice(index + 1);
423
+ }
424
+ } else {
425
+ this.skuNo = '';
426
+ }
427
+ console.log(this.skuNo, '00000');
428
+ let nList = [],
429
+ delList = [];
430
+ if (this.fileList.length > 0) {
431
+ nList = JSON.parse(JSON.stringify(this.fileList));
432
+ //查找删除后的存在的对象
433
+ nList.forEach((el, index) => {
434
+ if (this.fileListArray.indexOf(el.goodsFileUrl || el.url) >= 0) {
435
+ delList.push(el.goodsFileUrl || el.url);
436
+ }
437
+ });
438
+ // console.log(delList, this.checkList, "this.checkList");
439
+ this.checkList.forEach((el, index) => {
440
+ if (delList.indexOf(`/paas/shop/${el.fileUrl}`) < 0) {
441
+ this.checkList.splice(index, 1);
442
+ }
443
+ });
444
+ this.fileListArray = [];
445
+ nList.forEach((item) => {
446
+ item.url = item.goodsFileUrl || item.url;
447
+ this.fileListArray.push(item.url);
448
+ });
449
+ } else {
450
+ this.checkList = [];
451
+ this.fileListArray = [];
452
+ }
453
+ this.$nextTick(() => {
454
+ console.log(this.$refs);
455
+ if (this.$refs) {
456
+ this.$refs.picUpload.$refs['upload-inner'].$el.style.display = 'none';
457
+ }
458
+ });
459
+ this.nFileList = nList;
460
+ }
461
+ if (this.type && this.type == '1') {
462
+ this.title = '选择文件';
463
+ } else {
464
+ this.title = '选择图片';
465
+ }
466
+ },
467
+ limit() {
468
+ this.picLimit = this.limit || 1;
469
+ },
470
+ fileList() {
471
+ let nList = [];
472
+ if (this.fileList.length > 0) {
473
+ nList = JSON.parse(JSON.stringify(this.fileList));
474
+ }
475
+ this.nFileList = nList;
476
+ console.log(this.nFileList);
477
+ },
478
+ },
479
+ };
480
+ </script>
481
+
482
+ <style rel="stylesheet/scss" lang="scss" scoped>
483
+ .dialog-form {
484
+ width: 100%;
485
+ box-sizing: border-box;
486
+ padding-left: 20px;
487
+
488
+ .dialog-form-item {
489
+ width: 100% !important;
490
+ margin-left: 0 !important;
491
+ }
492
+ }
493
+
494
+ .el-dialog {
495
+ border-radius: 6px;
496
+ }
497
+
498
+ .file-btn {
499
+ position: relative;
500
+ overflow: hidden;
501
+ }
502
+
503
+ .file-input {
504
+ display: none;
505
+ }
506
+
507
+ .cor-red {
508
+ color: #ff0000;
509
+ }
510
+
511
+ .image {
512
+ width: 100px;
513
+ height: 100px;
514
+ display: block;
515
+ }
516
+
517
+ .clearfix:before,
518
+ .clearfix:after {
519
+ display: table;
520
+ content: '';
521
+ }
522
+
523
+ .clearfix:after {
524
+ clear: both;
525
+ }
526
+
527
+ .elcard {
528
+ margin-top: 20px;
529
+ }
530
+ </style>
531
+ <style lang="scss">
532
+ .file-box {
533
+ .el-checkbox {
534
+ margin-left: 30px;
535
+ position: relative;
536
+
537
+ .el-checkbox__input {
538
+ position: absolute;
539
+ top: 0;
540
+ left: 0;
541
+ }
542
+
543
+ .el-checkbox__label {
544
+ padding: 0;
545
+ }
546
+ }
547
+
548
+ .el-checkbox-group {
549
+ height: 230px;
550
+ overflow-y: scroll;
551
+ }
552
+
553
+ .el-upload-list--picture-card .el-upload-list__item {
554
+ width: 100px;
555
+ height: 100px;
556
+ }
557
+ }
558
+ </style>