Blame view

lvdao-miniapp/pagesA/application/application.vue 8.85 KB
3f535f30   杨鑫   '初始'
1
2
3
  <template>
  	<view class="page">
  		<view class="add-list">
40a0b33d   杨鑫   '最新'
4
5
6
7
8
9
10
11
12
13
14
  			<view class="item">
  				<view class="contents" style="background-color:#fff;">
  					<view class="feedback-data">
  						<view>
  							<view class="title">
  								<text style="font-weight: bold;">*宣传标题</text>
  							</view>
  						</view>
  						<view class="voucher-img">
  							<view class="voucher-list" style="width: 100%;">
  								<view class="" style="background-color: #F0F0F0;border-radius: 20rpx;">
97dd7eda   wesley88   1
15
16
  									<textarea :auto-height="true" placeholder="请输入"
  										style="font-size: 24rpx;background-color: #F0F0F0;border-radius: 20rpx;width: 96%;margin: 0 auto;padding:10px;min-height: 100px;"
40a0b33d   杨鑫   '最新'
17
18
19
20
21
  										v-model="rulform.schemeTitle"></textarea>
  								</view>
  							</view>
  						</view>
  					</view>
3f535f30   杨鑫   '初始'
22
23
  				</view>
  			</view>
40a0b33d   杨鑫   '最新'
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  			<view class="item">
  				<view class="contents" style="background-color:#fff;">
  					<view class="feedback-data">
  						<view>
  							<view class="title">
  								<text style="font-weight: bold;">*宣传海报</text>
  							</view>
  						</view>
  						<view class="voucher-img">
  							<view class="voucher-list" style="width: 100%;">
  								<u-upload :action="$upload" :auto-upload="false" ref="coverImage" :max-count="1" :file-list="fist"
  									@on-choose-complete="(response, file, fileList) => onsuccess1(response, file, fileList, 'coverImage')"></u-upload>
  							</view>
  						</view>
  					</view>
3f535f30   杨鑫   '初始'
39
40
  				</view>
  			</view>
40a0b33d   杨鑫   '最新'
41
42
43
44
45
46
47
48
49
50
  			<view class="item">
  				<view class="contents" style="background-color:#fff;">
  					<view class="feedback-data">
  						<view>
  							<view class="title">
  								<text style="font-weight: bold;">*宣传内容</text>
  							</view>
  						</view>
  						<view>
  							 <spEditor
6c268f28   杨鑫   最新1
51
52
  							:toolbar-config="{
  						excludeKeys: ['direction', 'date', 'export','link', 'letterSpacing','video','undo','redo'],
40a0b33d   杨鑫   '最新'
53
54
55
56
57
58
59
  							          iconSize: '18px'
  							        }"
  							        @input="inputOver"
  							        @upinImage="upinImage"
  									:placeholde="'请输入内容'"
  							      ></spEditor>
  						</view>
3f535f30   杨鑫   '初始'
60
61
  					</view>
  				</view>
3f535f30   杨鑫   '初始'
62
  			</view>
40a0b33d   杨鑫   '最新'
63
  			
3f535f30   杨鑫   '初始'
64
65
  		</view>
  		<!-- <u-select v-model="popup1" :list="list" @confirm="pops"></u-select> -->
40a0b33d   杨鑫   '最新'
66
  
3f535f30   杨鑫   '初始'
67
68
69
70
71
72
73
74
75
76
77
78
79
  
  		<!-- 保存按钮 -->
  		<view class="page-footer" @click="go">
  			<view class="footer-buy">
  				<view class="cart-add">
  					<text>提交</text>
  				</view>
  			</view>
  		</view>
  	</view>
  </template>
  
  <script>
40a0b33d   杨鑫   '最新'
80
  	import spEditor from '@/pagesA/sp-editor/components/sp-editor/sp-editor.vue'
3f535f30   杨鑫   '初始'
81
  	export default {
40a0b33d   杨鑫   '最新'
82
83
84
  		components:{
  		spEditor	
  		},
3f535f30   杨鑫   '初始'
85
86
  		data() {
  			return {
40a0b33d   杨鑫   '最新'
87
  				fist: [],
3f535f30   杨鑫   '初始'
88
89
  				rulform: {
  					schemeTitle: '',
3f535f30   杨鑫   '初始'
90
91
92
  					createDate: '',
  					createUser: '',
  					promotionContent: '',
40a0b33d   杨鑫   '最新'
93
  					coverImage: '',
d5f60c72   杨鑫   '最新'
94
  					state:'2'
3f535f30   杨鑫   '初始'
95
96
  				},
  				Fenshow:true,
40a0b33d   杨鑫   '最新'
97
98
  				editorIns: null
  			}
3f535f30   杨鑫   '初始'
99
100
  		},
  		mounted() {
40a0b33d   杨鑫   '最新'
101
  			
3f535f30   杨鑫   '初始'
102
103
104
  		},
  		onLoad(optiong) {
  			console.log(optiong.item)
40a0b33d   杨鑫   '最新'
105
106
107
108
  			// if(optiong.item){
  			// 	this.rulform = JSON.parse(optiong.item)
  			// 	this.Fenshow = false
  			// }
3f535f30   杨鑫   '初始'
109
110
  		},
  		methods: {
40a0b33d   杨鑫   '最新'
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
  			 inputOver(e) {
  			      // 可以在此处获取到编辑器已编辑的内容
  			      console.log('==== inputOver :', e)
  				  this.rulform.promotionContent = e.html
  			    },
  				   upinImage(tempFiles, editorCtx) {
  					   console.log(tempFiles)
  				     tempFiles.forEach(async (item) => {
  				         uni.uploadFile({
  				         	url: this.$upload, // 仅为示例,请替换为您的服务器上传接口
  				         	filePath: tempFiles[0].path,
  				         	name: 'file', // 后端接收的文件参数名
  				         	formData: {
  				         		filePath: 'xcx', // 其他表单数据
  				         	},
  							
  				         	success: (uploadFileRes) => {
  				         		uni.showToast({
  				         			title: '上传成功',
  				         			icon: 'success',
  				         		})
  								editorCtx.insertImage({
  								  src: this.$img + JSON.parse(uploadFileRes.data).data,
  								  width: '80%', // 默认不建议铺满宽度100%,预留一点空隙以便用户编辑
  								  success: function () {
  								    uni.hideLoading()
  								  }
  								})
  				         	},
  				         	fail: (err) => {
  				         		console.error('上传失败', err);
  				         		uni.showToast({
  				         			title: '上传失败',
  				         			icon: 'none',
  				         		});
  				         	},
  				         })
  				           
  				           })
  					  },
3f535f30   杨鑫   '初始'
151
152
153
154
155
156
157
  			 padZero(num) {
  			  return num < 10 ? '0' + num : num;
  			},
  		getCurrentTimeFormatted() {
  			  const now = new Date();
  			  return `${now.getFullYear()}-${this.padZero(now.getMonth() + 1)}-${this.padZero(now.getDate())} ${this.padZero(now.getHours())}:${this.padZero(now.getMinutes())}:${this.padZero(now.getSeconds())}`;
  			},
40a0b33d   杨鑫   '最新'
158
  
3f535f30   杨鑫   '初始'
159
  			go() {
40a0b33d   杨鑫   '最新'
160
161
162
163
164
  				console.log(this.rulform,uni.getStorageSync('user').phone)
  				if(!this.rulform.schemeTitle){
  					uni.showToast({
  						icon: 'none',
  						title: '请输入宣传标题'
3f535f30   杨鑫   '初始'
165
  					})
40a0b33d   杨鑫   '最新'
166
167
168
169
170
171
172
173
174
175
176
177
178
  					return
  				}
  				if(!this.rulform.coverImage){
  					uni.showToast({
  						icon: 'none',
  						title: '请上传宣传封面'
  					})
  					return
  				}
  				if(!this.rulform.promotionContent){
  					uni.showToast({
  						icon: 'none',
  						title: '请输入宣传内容'
3f535f30   杨鑫   '初始'
179
  					})
40a0b33d   杨鑫   '最新'
180
  					return
3f535f30   杨鑫   '初始'
181
  				}
40a0b33d   杨鑫   '最新'
182
183
184
185
186
187
188
189
190
191
192
193
  				this.rulform.createDate = this.getCurrentTimeFormatted()
  				  this.rulform.createUser = uni.getStorageSync('user').phone
  				  let info = {
  				  	...this.rulform,
  				  	coverImage:this.rulform.coverImage.replace(this.$img,''),
  				  }
  				this.$http.sendRequest('/cerePromotion/addPromotionPlanning', 'POST', info,1).then(res => {
  					//成功回调
  					uni.redirectTo({
  						url: '/pagesA/projectManagement/projectManagement'
  					})
  				})
3f535f30   杨鑫   '初始'
194
195
  			
  			},
40a0b33d   杨鑫   '最新'
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
  			onsuccess1(e, file, fileList, ziduan) {
  				uni.uploadFile({
  					url: this.$upload, // 仅为示例,请替换为您的服务器上传接口
  					filePath: e[0].url,
  					name: 'file', // 后端接收的文件参数名
  					formData: {
  						filePath: 'xcx', // 其他表单数据
  					},
  					success: (uploadFileRes) => {
  						
  							this.rulform.coverImage = this.$img + JSON.parse(uploadFileRes.data).data
  							// let obj ={
  							// 	url:this.$img + JSON.parse(uploadFileRes.data).data
  							// }
  							// this.fist.push(obj)
  						uni.showToast({
  							title: '上传成功',
  							icon: 'success',
  						});
  					},
  					fail: (err) => {
  						console.error('上传失败', err);
  						uni.showToast({
  							title: '上传失败',
  							icon: 'none',
  						});
  					},
  				});
3f535f30   杨鑫   '初始'
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
  			},
  		}
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'application.scss';
  
  	.juli {
  		padding: 10rpx;
  		display: flex;
  		flex-wrap: wrap;
  
  		.u-transition {
  			// width: 31%;
  			margin: 1%;
  			// width: 212rpx;
  			// height: 80rpx;
  			border-radius: 16rpx 16rpx 16rpx 16rpx;
  			background-color: rgba(21, 98, 214, 0.1);
  			// line-height: 80rpx;
  			text-align: center;
  			font-style: normal;
  			color: #1562D6;
  			font-size: 28rpx;
  			border-radius: 2px;
  
  		}
  
  		::v-deep .u-tag--primary--plain {
  			border: 0px;
  			border-radius: 2px;
  			background-color: #ebebeb;
  
  			.u-tag__text--primary--plain {
  				color: #000;
  
  			}
  		}
  
  		::v-deep .u-tag--primary {
  			background-color: rgba(245, 178, 160, 0.3);
  			border: 0px;
  			border-radius: 2px;
  
  			.u-tag__text--primary {
  				color: #ff3442;
  			}
  		}
  
  		.jinbutiao {
  			display: flex;
  			width: 100%;
  			align-items: center;
  
  			.u-slider {
  				width: 80%;
  				margin-right: 20rpx;
  			}
  		}
  	}
  
  	.choose1 {
  		width: 100%;
  		display: flex;
  
  		.choose1left {
  			width: 26%;
  			border-right: 2rpx solid #f6f6f6;
  
  			.leftItem1 {
  				width: 100%;
  				display: flex;
  				justify-content: center;
  				align-items: center;
  				padding: 20rpx 0;
  			}
  		}
  
  		.choose1right {
  			flex: 1;
  
  			// width: 70%;
  			.rightBox {
  				width: 90%;
  				margin: 0 auto;
  
  				.weizhiName {
  					display: flex;
  					justify-content: space-between;
  					align-items: center;
  
  					// height: 80rpx;
  					.weizhiLeft {
  						display: flex;
  						align-items: center;
  
  						.weizhiInput {
  							color: #959595;
  						}
  					}
  
  					.weizhiSpan {
  						color: #D32D25;
  					}
  				}
  
  				.juli {
  					display: flex;
  					justify-content: space-between;
  					align-items: center;
  					flex-wrap: wrap;
  
  					.u-transition {
  						// width: 31%;
  						margin: 1%;
  						// width: 212rpx;
  						// height: 80rpx;
  						border-radius: 16rpx 16rpx 16rpx 16rpx;
  						background-color: rgba(21, 98, 214, 0.1);
  						// line-height: 80rpx;
  						text-align: center;
  						font-style: normal;
  						color: #1562D6;
  						font-size: 28rpx;
  
  					}
  
  					.u-tag-wrapper {
  						width: 100%;
  						height: 100%;
  						border: none !important;
  					}
  
  					.u-tag {
  						padding: 0;
  						width: 212rpx !important;
  						height: 60rpx !important;
  					}
  
  					.u-tag__text {
  						width: 100%;
  						font-size: 25rpx;
  						text-align: center;
  						margin: 0 auto;
  					}
  
  				}
  			}
  
  			.quyu {
  				display: flex;
  				padding-left: 20rpx;
  				height: 300px;
  				width: 100%;
  
  				.sl_city {
  					width: 48%;
  					margin-right: 0px;
  					overflow: auto;
  
  				}
  			}
  		}
  	}
  
  	::v-deep .u-input__input {
  		text-align: right;
  	}
  </style>