Blame view

uniapp_jiju/pages/contactUs/contactUs.vue 4.57 KB
d56bd957   “wangming”   修复问题,组建AI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
  <template>
  	<view class="page">
  		<view class="head">
  			<view class="logo-title">
  				<image @click="goBack" src="../../static/left.png"></image>
  				联系我们
  			</view>
  			<view class="title">
  			</view>
  			<view class="setting-mess"></view>
  		</view>
  		
  		<view class="main">
  			<view class="top-box" @click="fklxshow = true">
  				<view><text class="red">*</text>反馈类型</view>
  				<view class="top-box-img">
  					<input  v-model="form.type" type="text" placeholder="请选择" placeholder-class="placeholder" />
  					<image class="top-box-image" src="../../static/down3.png"></image>
  				</view>
  			</view>
  			<u-picker :show="fklxshow" :columns="columns" @confirm="fklxconfirm" @cancel="fklxshow = false"></u-picker>
  			<view class="message-list">
  			<view class="info-box">
  				<view class="info-box-list">
  					<view class="info-box-width width100">
  						<view><text class="red">*</text>问题和意见</view>
  						<view>
  							<textarea maxlength="10000" v-model="form.problem" auto-height placeholder="请输入" class="textarea"></textarea>
  						</view>
  					</view>
  				</view>
  			</view>
  			</view>
  			
  			<view class="message-list">
  			<view class="info-box">
  				<view class="info-box-list">
  					<view class="info-box-width">
  						<view style="margin-bottom: 20rpx;">图片</view>
  						<view class="" style="width: 70vw;">
  							<u-upload :fileList="fileList1" @afterRead="afterRead1" @delete="deletePic1" name="1" multiple
  								:maxCount="9">
  							</u-upload>
  						</view>
  						
  					</view>
  				</view>
  			</view>
  			</view>
  			
  			<view class="top-box">
  				<view class="top-box-heng">联系电话:{{info.telephone}}<view class="top-box-heng-right">联系人:{{info.person}}</view></view>
  			</view>
  		</view>
  		
  		<view class="page-footer">
  		  <view class="footer-buy">
  		    <view class="cart-add" @click="submit">
  		      <text>提交</text>
  		    </view>
  		  </view>
  		</view>
  		
  	</view>
  </template>
  
  <script>
  	export default {
  		data() {
  			return {
  				fileList1:[],
  				form:{
  					type:"",
  					problem:"",
  					images:"",
  				},
  				fklxshow:false,
  				columns:[
  					['优化建议','其他']
  				],
  				info:{}
  			};
  		},
  		onLoad() {
  			this.lxrxx();
  		},
  		methods:{
  			lxrxx(){
  				this.API.lxrxx().then(res=>{
  					this.info = res.data
  				})
  			},
  			fklxconfirm(e){
  				console.log(e);
  				this.form.type = e.value[0]
  				this.fklxshow = false
  			},
  			goBack() {
  				uni.navigateBack({
  					delta: 1
  				});
  			},
  			submit(){
  				console.log(this.fileList1);
  				if(this.fileList1.length > 0){
  					var arr = []
  					for(let i = 0;i < this.fileList1.length;i++){
  						arr.push(this.fileList1[i].url)
  					}
  					this.form.images = arr.join(',')
  				}
  				this.API.lxwm(this.form).then(res=>{
  					console.log(1,res);
  					if(res.code == 1){
  						uni.showToast({
  							icon:"success",
  							title:"提交成功"
  						})
  						setTimeout(()=>{
  							uni.navigateBack({
  								delta: 1
  							});
  						},500)
  					}else{
  						uni.showToast({
  							icon:"error",
  							title:"提交失败"
  						})
  					}
  				})
  				// 
  			},
  			async afterRead1(event) {
  				// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  				let lists = [].concat(event.file)
  				let fileListLen = this.fileList1.length
  				lists.map((item) => {
  					this.fileList1.push({
  						...item,
  						status: 'uploading',
  						message: '上传中'
  					})
  				})
  				for (let i = 0; i < lists.length; i++) {
  					const result = await this.uploadFilePromise(lists[i].url)
  					let item = this.fileList1[fileListLen]
  					console.log("result", result);
  					this.fileList1.splice(fileListLen, 1, Object.assign(item, {
  						status: 'success',
  						message: '',
  						url: result
  					}))
  					fileListLen++
  				}
  			},
  			deletePic1(event) {
  				console.log(event);
  				this.fileList1.splice(event.index,1)
  				console.log(this.fileList1);
  			},
  			uploadFilePromise(url) {
  				return new Promise((resolve, reject) => {
  					let a = uni.uploadFile({
  						url: 'http://antis103.sherkxuan.cn/api/common/upload', // 仅为示例,非真实的接口地址
  						filePath: url,
  						name: 'file',
  						formData: {
  							user: 'test',
  							token: uni.getStorageSync("token"),
  						},
  						success: (res) => {
  							console.log("111", JSON.parse(res.data));
  							// var info = {
  							// 	url:'https://yipinzhisheng.com' + JSON.parse(res.data).data.url
  							// }
  							// this.form.avatar.push(info)
  							setTimeout(() => {
  								resolve(JSON.parse(res.data).data.fullurl)
  							}, 1000)
  						}
  					});
  				})
  			},
  		}
  	}
  </script>
  
  <style scoped lang="scss">
  	@import 'contactUs.scss';
  </style>