yuantianjiao 6 years ago
parent
commit
5fc2ca4620

+ 1
- 1
config/index.js View File

15
         // target: 'http://192.168.0.62:8080', //wf
15
         // target: 'http://192.168.0.62:8080', //wf
16
         // target: 'http://127.0.0.1:8080', 
16
         // target: 'http://127.0.0.1:8080', 
17
         // target: 'http://192.168.0.11:8080', //ys
17
         // target: 'http://192.168.0.11:8080', //ys
18
-        // target: 'http://192.168.0.125:8080', //hyq
18
+        // target: 'http://192.168.0.102:8080', //hyq
19
         target: 'http://dev.ycjcjy.com', //frp
19
         target: 'http://dev.ycjcjy.com', //frp
20
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
20
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
21
         // pathRewrite: {
21
         // pathRewrite: {

+ 11
- 3
src/pages/system/caseManager/caseAreaManager/add.vue View File

38
               <el-upload
38
               <el-upload
39
                 class="avatar-uploader"
39
                 class="avatar-uploader"
40
                 action='string'
40
                 action='string'
41
+                :before-upload="toolClass.beforeUpload"
41
                 :http-request="toolClass.upload"
42
                 :http-request="toolClass.upload"
42
                 :show-file-list="false"
43
                 :show-file-list="false"
43
                 :on-success="handleAvatarSuccess">
44
                 :on-success="handleAvatarSuccess">
54
               <el-upload
55
               <el-upload
55
                 class="avatar-uploader"
56
                 class="avatar-uploader"
56
                 action='string'
57
                 action='string'
58
+                :before-upload="toolClass.beforeUpload"
57
                 :http-request="toolClass.upload"
59
                 :http-request="toolClass.upload"
58
                 :show-file-list="false"
60
                 :show-file-list="false"
59
                 :on-success="handleAvatarSuccesser">
61
                 :on-success="handleAvatarSuccesser">
73
 </template>
75
 </template>
74
 
76
 
75
 <script>
77
 <script>
76
-import { mapState } from 'vuex'
78
+import { mapState, mapActions } from 'vuex'
77
 
79
 
78
 export default {
80
 export default {
79
   name: '',
81
   name: '',
105
     }
107
     }
106
   },
108
   },
107
   components: {},
109
   components: {},
110
+  created () {
111
+    this.picSize({ w: 30, h: 30 })
112
+  },
108
   methods: {
113
   methods: {
114
+    ...mapActions([
115
+      'picSize'
116
+    ]),
109
     handleAvatarSuccesser (res, file) {
117
     handleAvatarSuccesser (res, file) {
110
       this.postData.AreaIconWhite = res.result.url
118
       this.postData.AreaIconWhite = res.result.url
111
     },
119
     },
150
           type: 'success',
158
           type: 'success',
151
           message: '操作成功!'
159
           message: '操作成功!'
152
         })
160
         })
153
-        this.$router.push({name: 'caseAreaManager'})
161
+        this.$router.push({ name: 'caseAreaManager' })
154
       })
162
       })
155
     },
163
     },
156
     cancel () {
164
     cancel () {
157
-      this.$router.push({name: 'caseAreaManager'})
165
+      this.$router.push({ name: 'caseAreaManager' })
158
     }
166
     }
159
   },
167
   },
160
   mounted () { }
168
   mounted () { }

+ 7
- 1
src/pages/system/caseManager/caseAreaManager/edit.vue View File

38
               <el-upload
38
               <el-upload
39
                 class="avatar-uploader"
39
                 class="avatar-uploader"
40
                 action='string'
40
                 action='string'
41
+                :before-upload="toolClass.beforeUpload"
41
                 :http-request="toolClass.upload"
42
                 :http-request="toolClass.upload"
42
                 :show-file-list="false"
43
                 :show-file-list="false"
43
                 :on-success="handleAvatarSuccess">
44
                 :on-success="handleAvatarSuccess">
54
               <el-upload
55
               <el-upload
55
                 class="avatar-uploader"
56
                 class="avatar-uploader"
56
                 action='string'
57
                 action='string'
58
+                :before-upload="toolClass.beforeUpload"
57
                 :http-request="toolClass.upload"
59
                 :http-request="toolClass.upload"
58
                 :show-file-list="false"
60
                 :show-file-list="false"
59
                 :on-success="handleAvatarSuccesser">
61
                 :on-success="handleAvatarSuccesser">
73
 </template>
75
 </template>
74
 
76
 
75
 <script>
77
 <script>
76
-import { mapState } from 'vuex'
78
+import { mapState, mapActions } from 'vuex'
77
 
79
 
78
 export default {
80
 export default {
79
   name: '',
81
   name: '',
106
   },
108
   },
107
   created () {
109
   created () {
108
     this.getCaseAreaInfo()
110
     this.getCaseAreaInfo()
111
+    this.picSize({ w: 30, h: 30 })
109
   },
112
   },
110
   components: {},
113
   components: {},
111
   methods: {
114
   methods: {
115
+    ...mapActions([
116
+      'picSize'
117
+    ]),
112
     getCaseAreaInfo () { // 获取区域信息
118
     getCaseAreaInfo () { // 获取区域信息
113
       this.$ajax(this.$api.caseManager.getCaseAreaInfo.url, {
119
       this.$ajax(this.$api.caseManager.getCaseAreaInfo.url, {
114
         method: this.$api.caseManager.getCaseAreaInfo.method,
120
         method: this.$api.caseManager.getCaseAreaInfo.method,

+ 5
- 1
src/pages/system/caseManager/caseInfo/addCase/index.vue View File

67
               <el-upload
67
               <el-upload
68
                 class="avatar-uploader"
68
                 class="avatar-uploader"
69
                 action='string'
69
                 action='string'
70
+                :before-upload="toolClass.beforeUpload"
70
                 :http-request="toolClass.upload"
71
                 :http-request="toolClass.upload"
71
                 :show-file-list="false"
72
                 :show-file-list="false"
72
                 :on-success="handleAvatarSuccess">
73
                 :on-success="handleAvatarSuccess">
158
       OrgId: x => x.app.user.OrgId,
159
       OrgId: x => x.app.user.OrgId,
159
     }),
160
     }),
160
   },
161
   },
162
+  created () {
163
+    this.picSize({ w: 480, h: 300 })
164
+  },
161
   components: {},
165
   components: {},
162
   methods: {
166
   methods: {
163
     ...mapActions([
167
     ...mapActions([
164
-      'updateSystemInfo'
168
+      'updateSystemInfo', 'picSize'
165
     ]),
169
     ]),
166
     handleAvatarSuccess (res, file) {
170
     handleAvatarSuccess (res, file) {
167
       this.postData.CaseIcon = res.result.url
171
       this.postData.CaseIcon = res.result.url

+ 3
- 1
src/pages/system/caseManager/caseInfo/editCase/index.vue View File

63
               <el-upload
63
               <el-upload
64
                 class="avatar-uploader"
64
                 class="avatar-uploader"
65
                 action='string'
65
                 action='string'
66
+                :before-upload="toolClass.beforeUpload"
66
                 :http-request="toolClass.upload"
67
                 :http-request="toolClass.upload"
67
                 :show-file-list="false"
68
                 :show-file-list="false"
68
                 :on-success="handleAvatarSuccess">
69
                 :on-success="handleAvatarSuccess">
156
   },
157
   },
157
   created () {
158
   created () {
158
     this.getCaseInfoById()
159
     this.getCaseInfoById()
160
+    this.picSize({ w: 480, h: 300 })
159
   },
161
   },
160
   components: {},
162
   components: {},
161
   methods: {
163
   methods: {
162
     ...mapActions([
164
     ...mapActions([
163
-      'updateSystemInfo'
165
+      'updateSystemInfo', 'picSize'
164
     ]),
166
     ]),
165
     getCaseInfoById () { // 获取案场信息
167
     getCaseInfoById () { // 获取案场信息
166
       this.$ajax(this.$api.caseManager.getCaseInfo.url, {
168
       this.$ajax(this.$api.caseManager.getCaseInfo.url, {

+ 3
- 1
src/pages/system/cmsManager/bannerManager/add.vue View File

80
             <el-upload
80
             <el-upload
81
               class="avatar-uploader"
81
               class="avatar-uploader"
82
               action='string'
82
               action='string'
83
+              :before-upload="toolClass.beforeUpload"
83
               :http-request="toolClass.upload"
84
               :http-request="toolClass.upload"
84
               :show-file-list="false"
85
               :show-file-list="false"
85
               :on-success="handleAvatarSuccess">
86
               :on-success="handleAvatarSuccess">
131
     // imageUploader: () => import('@/components/upload')
132
     // imageUploader: () => import('@/components/upload')
132
   },
133
   },
133
   created () {
134
   created () {
135
+    this.picSize({ w: 650, h: 300 })
134
     this.GetCourseList({ page: 1, pagesize: 100 })
136
     this.GetCourseList({ page: 1, pagesize: 100 })
135
     this.updateLocationAllInfo()
137
     this.updateLocationAllInfo()
136
     this.updateSystemInfo().then(() => {
138
     this.updateSystemInfo().then(() => {
153
       'GetCourseList',
155
       'GetCourseList',
154
     ]),
156
     ]),
155
     ...mapCmsActions(['updateLocationAllInfo']),
157
     ...mapCmsActions(['updateLocationAllInfo']),
156
-    ...mapActions(['updateSystemInfo']),
158
+    ...mapActions(['updateSystemInfo', 'picSize']),
157
     submit () {
159
     submit () {
158
       if (this.postData.ForwardType === 'url') {
160
       if (this.postData.ForwardType === 'url') {
159
         this.postData.ForwardResourceId = ''
161
         this.postData.ForwardResourceId = ''

+ 4
- 1
src/pages/system/cmsManager/bannerManager/edit.vue View File

80
             <el-upload
80
             <el-upload
81
               class="avatar-uploader"
81
               class="avatar-uploader"
82
               action='string'
82
               action='string'
83
+              :before-upload="toolClass.beforeUpload"
83
               :http-request="toolClass.upload"
84
               :http-request="toolClass.upload"
84
               :show-file-list="false"
85
               :show-file-list="false"
85
               :on-success="handleAvatarSuccess">
86
               :on-success="handleAvatarSuccess">
98
 </template>
99
 </template>
99
 
100
 
100
 <script>
101
 <script>
101
-import { mapState, createNamespacedHelpers } from 'vuex'
102
+import { mapState, createNamespacedHelpers, mapActions } from 'vuex'
102
 const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
103
 const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
103
 const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
104
 const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
104
 
105
 
125
   },
126
   },
126
   components: {},
127
   components: {},
127
   created () {
128
   created () {
129
+    this.picSize({ w: 650, h: 300 })
128
     this.GetCourseList({page: 1, pagesize: 100, callback: this.getDetail})
130
     this.GetCourseList({page: 1, pagesize: 100, callback: this.getDetail})
129
     this.updateLocationAllInfo()
131
     this.updateLocationAllInfo()
130
   },
132
   },
143
       'GetCourseList',
145
       'GetCourseList',
144
     ]),
146
     ]),
145
     ...mapCmsActions(['updateLocationAllInfo']),
147
     ...mapCmsActions(['updateLocationAllInfo']),
148
+    ...mapActions(['picSize']),
146
     submit () {
149
     submit () {
147
       if (this.postData.ForwardType === 'url') {
150
       if (this.postData.ForwardType === 'url') {
148
         this.postData.ForwardResourceId = ''
151
         this.postData.ForwardResourceId = ''

+ 12
- 3
src/pages/system/cmsManager/majorProjects/edit.vue View File

48
         </li>
48
         </li>
49
         <li class="flex-h">
49
         <li class="flex-h">
50
           <span>图片:<em>*</em></span>
50
           <span>图片:<em>*</em></span>
51
-          <div class="flex-item">
51
+          <div class="flex-item" @click="pictSize()">
52
             <el-upload
52
             <el-upload
53
               class="avatar-uploader"
53
               class="avatar-uploader"
54
               action='string'
54
               action='string'
55
+              :before-upload="toolClass.beforeUpload"
55
               :http-request="toolClass.upload"
56
               :http-request="toolClass.upload"
56
               :show-file-list="false"
57
               :show-file-list="false"
57
               :on-success="handleImgSuccess">
58
               :on-success="handleImgSuccess">
62
         </li>
63
         </li>
63
         <li class="flex-h">
64
         <li class="flex-h">
64
           <span>详细图片:<em>*</em></span>
65
           <span>详细图片:<em>*</em></span>
65
-          <div class="flex-item">
66
+          <div class="flex-item" @click="descSize()">
66
             <el-upload
67
             <el-upload
67
               class="avatar-uploader"
68
               class="avatar-uploader"
68
               action='string'
69
               action='string'
70
+              :before-upload="toolClass.beforeUpload"
69
               :http-request="toolClass.upload"
71
               :http-request="toolClass.upload"
70
               :show-file-list="false"
72
               :show-file-list="false"
71
               :on-success="handleDetailImgSuccess">
73
               :on-success="handleDetailImgSuccess">
203
 </template>
205
 </template>
204
 
206
 
205
 <script>
207
 <script>
206
-import { createNamespacedHelpers, mapState } from 'vuex'
208
+import { createNamespacedHelpers, mapState, mapActions } from 'vuex'
207
 
209
 
208
 const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('cmscase')
210
 const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('cmscase')
209
 const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
211
 const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
276
     ...mapCourseActions([
278
     ...mapCourseActions([
277
       'GetCourseList',
279
       'GetCourseList',
278
     ]),
280
     ]),
281
+    ...mapActions(['picSize']),
279
     caseChange () {
282
     caseChange () {
280
       this.selCourseList = []
283
       this.selCourseList = []
281
       this.detail.Courses = []
284
       this.detail.Courses = []
282
     },
285
     },
286
+    pictSize () {
287
+      this.picSize({ w: 704, h: 208 })
288
+    },
289
+    descSize () {
290
+      this.picSize({ w: 105, h: 64 })
291
+    },
283
     checkFn (arr) {
292
     checkFn (arr) {
284
       for (var n = 0; n < arr.length; n++) {
293
       for (var n = 0; n < arr.length; n++) {
285
         if (arr[n].type === 'isNull' && !arr[n].target) {
294
         if (arr[n].type === 'isNull' && !arr[n].target) {

+ 3
- 1
src/pages/system/cmsManager/newsManager/add.vue View File

80
             <el-upload
80
             <el-upload
81
               class="avatar-uploader"
81
               class="avatar-uploader"
82
               action='string'
82
               action='string'
83
+              :before-upload="toolClass.beforeUpload"
83
               :http-request="toolClass.upload"
84
               :http-request="toolClass.upload"
84
               :show-file-list="false"
85
               :show-file-list="false"
85
               :on-success="handleAvatarSuccess">
86
               :on-success="handleAvatarSuccess">
125
   },
126
   },
126
   components: {},
127
   components: {},
127
   created () {
128
   created () {
129
+    this.picSize({ w: 172, h: 106 })
128
     this.updateSystemInfo().then(() => {
130
     this.updateSystemInfo().then(() => {
129
       this.postData.OrgId = this.OrgId
131
       this.postData.OrgId = this.OrgId
130
       this.postData.CaseId = this.CaseId
132
       this.postData.CaseId = this.CaseId
147
     ...mapCourseActions([
149
     ...mapCourseActions([
148
       'GetCourseList',
150
       'GetCourseList',
149
     ]),
151
     ]),
150
-    ...mapActions(['updateSystemInfo']),
152
+    ...mapActions(['updateSystemInfo', 'picSize']),
151
     ...mapCmsActions([
153
     ...mapCmsActions([
152
       'updateLocationAllInfo',
154
       'updateLocationAllInfo',
153
     ]),
155
     ]),

+ 4
- 1
src/pages/system/cmsManager/newsManager/edit.vue View File

80
             <el-upload
80
             <el-upload
81
               class="avatar-uploader"
81
               class="avatar-uploader"
82
               action='string'
82
               action='string'
83
+              :before-upload="toolClass.beforeUpload"
83
               :http-request="toolClass.upload"
84
               :http-request="toolClass.upload"
84
               :show-file-list="false"
85
               :show-file-list="false"
85
               :on-success="handleAvatarSuccess">
86
               :on-success="handleAvatarSuccess">
98
 </template>
99
 </template>
99
 
100
 
100
 <script>
101
 <script>
101
-import { mapState, createNamespacedHelpers } from 'vuex'
102
+import { mapState, mapActions, createNamespacedHelpers } from 'vuex'
102
 const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
103
 const { mapActions: mapCmsActions } = createNamespacedHelpers('cms')
103
 const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
104
 const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
104
 export default {
105
 export default {
124
   },
125
   },
125
   components: {},
126
   components: {},
126
   created () {
127
   created () {
128
+    this.picSize({ w: 172, h: 106 })
127
     this.updateLocationAllInfo().then(() => {
129
     this.updateLocationAllInfo().then(() => {
128
       this.getDetail()
130
       this.getDetail()
129
       this.GetCourseList({ page: 1, pagesize: 10000 })
131
       this.GetCourseList({ page: 1, pagesize: 10000 })
141
     ...mapCourseActions([
143
     ...mapCourseActions([
142
       'GetCourseList',
144
       'GetCourseList',
143
     ]),
145
     ]),
146
+    ...mapActions(['picSize']),
144
     ...mapCmsActions(['updateLocationAllInfo']),
147
     ...mapCmsActions(['updateLocationAllInfo']),
145
     submit () {
148
     submit () {
146
       if (this.postData.ForwardType === 'url') {
149
       if (this.postData.ForwardType === 'url') {

+ 4
- 1
src/pages/system/courseManager/courseList/add.vue View File

9
               <el-upload
9
               <el-upload
10
                 class="avatar-uploader"
10
                 class="avatar-uploader"
11
                 action='string'
11
                 action='string'
12
+                :before-upload="toolClass.beforeUpload"
12
                 :http-request="toolClass.upload"
13
                 :http-request="toolClass.upload"
13
                 :show-file-list="false"
14
                 :show-file-list="false"
14
                 :on-success="handleAvatarSuccess">
15
                 :on-success="handleAvatarSuccess">
209
 </template>
210
 </template>
210
 
211
 
211
 <script>
212
 <script>
212
-import { createNamespacedHelpers, mapState } from 'vuex'
213
+import { createNamespacedHelpers, mapState, mapActions } from 'vuex'
213
 
214
 
214
 const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
215
 const { mapState: mapCourseState, mapActions: mapCourseActions } = createNamespacedHelpers('course')
215
 const { mapState: mapLocationState, mapActions: mapLocationActions } = createNamespacedHelpers('cms')
216
 const { mapState: mapLocationState, mapActions: mapLocationActions } = createNamespacedHelpers('cms')
288
     ...mapTagActions([
289
     ...mapTagActions([
289
       'GetCourseTagList',
290
       'GetCourseTagList',
290
     ]),
291
     ]),
292
+    ...mapActions(['picSize']),
291
     handleAvatarSuccess (res, file) {
293
     handleAvatarSuccess (res, file) {
292
       this.UpdateInfo({ ...this.detail, CourseImg: res.result.url })
294
       this.UpdateInfo({ ...this.detail, CourseImg: res.result.url })
293
     },
295
     },
386
     }
388
     }
387
   },
389
   },
388
   mounted () {
390
   mounted () {
391
+    this.picSize({ w: 750, h: 960 })
389
     this.updateLocationInfo({issys: 0})
392
     this.updateLocationInfo({issys: 0})
390
     this.GetCourseTagList({ pagesize: 100 })
393
     this.GetCourseTagList({ pagesize: 100 })
391
     const { id } = this.$route.query
394
     const { id } = this.$route.query

+ 28
- 0
src/pages/system/dataStatistics/goodsOrderList/index.vue View File

23
               </el-option>
23
               </el-option>
24
             </el-select>
24
             </el-select>
25
           </li>
25
           </li>
26
+          <li>
27
+            <el-select v-model="postData.paytype" placeholder="请选择下单支付方式">
28
+              <el-option
29
+                v-for="item in paytype"
30
+                :key="item.id"
31
+                :label="item.value"
32
+                :value="item.id">
33
+              </el-option>
34
+            </el-select>
35
+          </li>
26
           <li>
36
           <li>
27
             <el-select v-model="postData.status" placeholder="请选择订单状态">
37
             <el-select v-model="postData.status" placeholder="请选择订单状态">
28
               <el-option
38
               <el-option
71
               <span>案场:{{returnListItem(goodsOrderList, index).CaseName}}</span>
81
               <span>案场:{{returnListItem(goodsOrderList, index).CaseName}}</span>
72
               <span>用户类型:{{returnListItem(goodsOrderList, index).UserType === 'sales' ? '销售' : returnListItem(goodsOrderList, index).UserType === 'manager' ? '主管' : '用户'}}</span>
82
               <span>用户类型:{{returnListItem(goodsOrderList, index).UserType === 'sales' ? '销售' : returnListItem(goodsOrderList, index).UserType === 'manager' ? '主管' : '用户'}}</span>
73
               <span>下单时间:{{toolClass.dateFormat(returnListItem(goodsOrderList, index).CreateDate)}}</span>
83
               <span>下单时间:{{toolClass.dateFormat(returnListItem(goodsOrderList, index).CreateDate)}}</span>
84
+              <span>支付方式:{{returnListItem(goodsOrderList, index).PayTypeStr}}</span>
74
             </div>
85
             </div>
75
             <span>{{returnStatus(returnListItem(goodsOrderList, index).MakeStatus)}}</span>
86
             <span>{{returnStatus(returnListItem(goodsOrderList, index).MakeStatus)}}</span>
76
           </div>
87
           </div>
146
         usertype: '', // 用户类型
157
         usertype: '', // 用户类型
147
         begindate: '', // 起始日期
158
         begindate: '', // 起始日期
148
         enddate: '', // 截止日期
159
         enddate: '', // 截止日期
160
+        paytype: '', // 支付方式
149
         page: 1, // 当前页码
161
         page: 1, // 当前页码
150
         pagesize: 10, // 请求数据量
162
         pagesize: 10, // 请求数据量
151
       },
163
       },
162
         value: '用户',
174
         value: '用户',
163
         id: 'customer'
175
         id: 'customer'
164
       }],
176
       }],
177
+      paytype: [{
178
+        value: '',
179
+        id: ''
180
+      }, {
181
+        value: '城币',
182
+        id: 'cheng-coin'
183
+      }, {
184
+        value: '优惠券',
185
+        id: 'coupon'
186
+      }, {
187
+        value: '案场',
188
+        id: 'sys user'
189
+      }, {
190
+        value: '积分',
191
+        id: 'points'
192
+      }],
165
       statusList: [{
193
       statusList: [{
166
         value: '',
194
         value: '',
167
         id: ''
195
         id: ''

+ 6
- 1
src/pages/system/goodsManager/goodManager/edit.vue View File

36
               <el-upload
36
               <el-upload
37
                 class="avatar-uploader"
37
                 class="avatar-uploader"
38
                 action='string'
38
                 action='string'
39
+                :before-upload="toolClass.beforeUpload"
39
                 :http-request="toolClass.upload"
40
                 :http-request="toolClass.upload"
40
                 :show-file-list="false"
41
                 :show-file-list="false"
41
                 :on-success="handleAvatarSuccess">
42
                 :on-success="handleAvatarSuccess">
97
 </template>
98
 </template>
98
 
99
 
99
 <script>
100
 <script>
100
-import { createNamespacedHelpers, mapState } from 'vuex'
101
+import { createNamespacedHelpers, mapState, mapActions } from 'vuex'
101
 
102
 
102
 const { mapState: mapGoodsState, mapActions: mapGoodsActions } = createNamespacedHelpers('goods')
103
 const { mapState: mapGoodsState, mapActions: mapGoodsActions } = createNamespacedHelpers('goods')
103
 export default {
104
 export default {
163
       'UpdateInfo',
164
       'UpdateInfo',
164
       'GetGoodSpecs',
165
       'GetGoodSpecs',
165
     ]),
166
     ]),
167
+    ...mapActions([
168
+      'picSize'
169
+    ]),
166
     submit () {
170
     submit () {
167
       this.detail.specs = JSON.stringify(this.detailSpecs.map(x => ({ SpecId: x, GoodsPrice: this.detail.Price })))
171
       this.detail.specs = JSON.stringify(this.detailSpecs.map(x => ({ SpecId: x, GoodsPrice: this.detail.Price })))
168
       this.detail.images = (this.detail.Images || []).map(x => {
172
       this.detail.images = (this.detail.Images || []).map(x => {
234
     },
238
     },
235
   },
239
   },
236
   created () {
240
   created () {
241
+    this.picSize({ w: 150, h: 150 })
237
     const { id } = this.$route.query
242
     const { id } = this.$route.query
238
     if (id && id !== '') {
243
     if (id && id !== '') {
239
       this.GetGoodTypes({ pagesize: 1000, caseid: this.Case })
244
       this.GetGoodTypes({ pagesize: 1000, caseid: this.Case })

+ 11
- 1
src/store/app.js View File

59
     roles: [],
59
     roles: [],
60
     user: {},
60
     user: {},
61
     clientUrl: '',
61
     clientUrl: '',
62
+    picSize: {
63
+      w: 0,
64
+      height: 0
65
+    }
62
   },
66
   },
63
   mutations: {
67
   mutations: {
64
     init (state, data) { // 这里的state对应着上面这个state
68
     init (state, data) { // 这里的state对应着上面这个state
94
       // 获取 面包屑
98
       // 获取 面包屑
95
       if (currentRoute) state.breadcrumb = currentRoute.parent.slice(1).concat(currentRoute)
99
       if (currentRoute) state.breadcrumb = currentRoute.parent.slice(1).concat(currentRoute)
96
       // console.log(state.breadcrumb)
100
       // console.log(state.breadcrumb)
97
-    }
101
+    },
102
+    setPicSize (state, data) { // 设置图片尺寸限制
103
+      state.picSize = data
104
+    },
98
   },
105
   },
99
   actions: {
106
   actions: {
100
     updateSystemInfo (context) { // 这里的context和我们使用的$store拥有相同的对象和方法
107
     updateSystemInfo (context) { // 这里的context和我们使用的$store拥有相同的对象和方法
106
           resolve()
113
           resolve()
107
         })
114
         })
108
       })
115
       })
116
+    },
117
+    picSize (context, data) {
118
+      context.commit('setPicSize', data)
109
     }
119
     }
110
   }
120
   }
111
 }
121
 }

+ 38
- 0
src/util/util.js View File

1
 import Ajax from './ajax'
1
 import Ajax from './ajax'
2
 import api from './api'
2
 import api from './api'
3
+import { Message } from 'element-ui'
4
+import store from '../store'
3
 const toolClass = {
5
 const toolClass = {
4
   dateFormat: (timestamp, fmt) => {
6
   dateFormat: (timestamp, fmt) => {
5
     if (!fmt) {
7
     if (!fmt) {
43
         resolve(result)
45
         resolve(result)
44
       }).catch(reject)
46
       }).catch(reject)
45
     })
47
     })
48
+  },
49
+  beforeUpload (file) {
50
+    return new Promise((resolve, reject) => {
51
+      let w = store.state.app.picSize.w
52
+      let h = store.state.app.picSize.h
53
+      if ('image'.indexOf(file.type) > -1) {
54
+        Message({
55
+          type: 'error',
56
+          message: `请上传${w}像素*${h}像素尺寸的图片`
57
+        })
58
+        reject(new Error('error'))
59
+      }
60
+      var reader = new FileReader()
61
+      reader.onload = function (e) {
62
+        var data = e.target.result
63
+        // 加载图片获取图片真实宽度和高度
64
+        var image = new Image()
65
+        image.onload = function () {
66
+          var width = image.width
67
+          var height = image.height
68
+          console.log(width)
69
+          console.log(height)
70
+          if (width === w && height === h) {
71
+            resolve()
72
+          } else {
73
+            Message({
74
+              type: 'error',
75
+              message: `请上传${w}像素*${h}像素尺寸的图片`
76
+            })
77
+            reject(new Error('error'))
78
+          }
79
+        }
80
+        image.src = data
81
+      }
82
+      reader.readAsDataURL(file)
83
+    })
46
   }
84
   }
47
 }
85
 }
48
 
86