From f3ce372afc816f947ae64ef2935b282087384b0d Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 01 三月 2024 15:30:32 +0800
Subject: [PATCH] mrshi

---
 h5/pages/userinfo/userinfo.vue |   51 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/h5/pages/userinfo/userinfo.vue b/h5/pages/userinfo/userinfo.vue
index ae9cb78..cc59728 100644
--- a/h5/pages/userinfo/userinfo.vue
+++ b/h5/pages/userinfo/userinfo.vue
@@ -27,14 +27,14 @@
 				</view>
 			</view>
 			<view class="cell">
-				<view class="title">鍏徃</view>
+				<view class="title">鍏徃<b>*</b></view>
 				<view class="content">
 					<input class="input" maxlength="50" placeholder-style="color: #999999;" v-model="visitorData.companyName" placeholder="璇疯緭鍏ユ偍鐨勫叕鍙稿悕绉�" />
 				</view>
 			</view>
 			<view class="cell">
 				<view class="title1">
-					<text class="title1_a">浜鸿劯鐓х墖<b>*</b></text>
+					<text class="title1_a">浜鸿劯鐓х墖<b style="color: red;">*</b></text>
 					<text class="title1_b">1銆佽鎻愪緵浜斿畼娓呮櫚锛屼汉鑴稿眳涓殑姝i潰浜鸿劯鍏嶅啝鐓х墖锛�</text>
 					<text class="title1_b">2銆佺収鐗囨棤閫嗗厜銆佹棤PS銆佹棤杩囧害缇庨澶勭悊</text>
 				</view>
@@ -73,6 +73,7 @@
 			return {
 				show: false,
 				visit: '',
+				type: '',
 				columns: [[{name: '韬唤璇�', id: 0}, {name: '娓境璇佷欢', id: 1},{name: '鎶ょ収', id: 2}]],
 				fileList: [],
 				visitorData: {
@@ -93,6 +94,9 @@
 		onLoad(option) {
 			this.visitorData.userAnswerId = option.userAnswerId
 			this.getVisit()
+			uni.$on('update', (data) => {
+				this.uploadImg(data.tempFilePath)
+			})
 		},
 
 		methods: {
@@ -125,6 +129,10 @@
 						icon: 'none'
 					})
 				}
+				if (!this.visitorData.companyName) return uni.showToast({
+					title: '鍏徃涓嶈兘涓虹┖',
+					icon: 'none'
+				})
 				if (!this.visitorData.faceImg) return uni.showToast({
 					title: '浜鸿劯鐓х墖涓嶈兘涓虹┖',
 					icon: 'none'
@@ -150,14 +158,41 @@
 					}
 				})
 			},
+			uploadImg(file) {
+				uni.showLoading({ title: '涓婁紶涓�', mask: true });
+				uni.uploadFile({
+					url: `${this.$baseUrl}public/api/uploadFtp.do`,
+					filePath: file,
+					name: 'file',
+					formData: {
+						folderCode: 'MEMBER_IMG'
+					},
+					success: (uploadFileRes) => {
+						let res = JSON.parse(uploadFileRes.data)
+						if (this.type === 'faceImg') {
+							this.visitorData.faceImg = res.data.halfPath
+							this.visitorData.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
+						} else {
+							this.visitorData.imgurl = res.data.halfPath
+							this.visitorData.imgurlUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
+						}
+					},
+					complete() {
+						uni.hideLoading();
+					}
+				});
+			},
 			upload(type) {
+				this.type = type
 				uni.chooseImage({
+					count: 1,
 					success: (chooseImageRes) => {
-						// console.log(chooseImageRes.tempFilePaths[0])
-						uni.navigateTo({
-							url: `/pages/cropping/cropping?item=${JSON.stringify({ tempFilePath: chooseImageRes.tempFilePaths[0] })}`
-						})
-						return
+						if (type === 'faceImg') {
+							uni.navigateTo({
+								url: `/pages/cropping/cropping?item=${JSON.stringify({ tempFilePath: chooseImageRes.tempFilePaths[0] })}`
+							})
+							return
+						}
 						uni.showLoading({ title: '涓婁紶涓�', mask: true });
 						for (let i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
 							uni.uploadFile({
@@ -167,7 +202,7 @@
 								formData: {
 									folderCode: 'MEMBER_IMG'
 								},
-								success: (uploadFileRes) => {
+								success: (uploadFileRes) => {	
 									let res = JSON.parse(uploadFileRes.data)
 									if (type === 'faceImg') {
 										this.visitorData.faceImg = res.data.halfPath

--
Gitblit v1.9.3