Jelajahi Sumber

创建名片调整

xhj 2 tahun lalu
induk
melakukan
0a0146b805
1 mengubah file dengan 29 tambahan dan 18 penghapusan
  1. 29 18
      card/create/create.vue

+ 29 - 18
card/create/create.vue

@@ -129,10 +129,10 @@
 			</view> -->
 			<view class="li ddflex">
 				<view class="label">所在地区</view>
-				<view :class="['item flex', city ? 'active' : '']" @click="chooseLocation()">
-					<!-- <pickerAddress class="picker flex" @change="bindAddressChange" :disabled="true" @click="chooseLocation()"> -->
+				<view :class="['item flex', city ? 'active' : '']">
+					<pickerAddress class="picker flex" @change="bindAddressChange">
 						<view :class="city?'':'placeholder'">{{ city ? city : '请选择地区' }}</view>
-					<!-- </pickerAddress> -->
+					</pickerAddress>
 				</view>
 				<image src="../../static/images/rico.png" class="rico"></image>
 				<!-- <picker class="picker flex">
@@ -140,9 +140,9 @@
 					<image src="../../static/images/rico.png" class="rico"></image>
 				</picker> -->
 			</view>
-			<view class="li ddflex">
+			<view class="li ddflex" @click="chooseLocation()">
 				<view class="label">地址</view>
-				<input v-model="address" placeholder="填写街道地址" placeholder-class="placeholder" class="ipt flex" />
+				<input :disabled="true" v-model="address" placeholder="填写街道地址" placeholder-class="placeholder" class="ipt flex" />
 			</view>
 		</view>
 		<view class="bot">
@@ -321,11 +321,14 @@ export default {
 		// 裁剪完成时,返回截取图片的临时路径
         copperSuccess(tempFilePathObj) {
 			let that = this
-			let tempFilePath = tempFilePathObj.path
+			let tempFilePath = tempFilePathObj.base64
+			tempFilePath = tempFilePath.replace('data:image/png;base64,','')
+			tempFilePath = tempFilePath.replace('data:image/jpeg;base64,','')
+			console.log(tempFilePath)
             uni.showLoading({
             	title:'上传中'
             })
-            req.uploadFile('/api/nocheck/upload', tempFilePath, res => {
+            req.postRequest('/api/nocheck/uploadBase64', {fileString:tempFilePath}, res => {
             	that.avatar = res.src;
             	uni.hideLoading()
 				this.copperShow = false
@@ -376,6 +379,7 @@ export default {
 					var promise = Promise.all(
 						tempFilePaths.map(tempFilePath => {
 							return new Promise(function(resolve, reject) {
+								console.log(tempFilePath)
 								req.uploadFile('/api/nocheck/upload', tempFilePath, res => {
 									that.wechatCode = res.src;
 									resolve()
@@ -527,6 +531,7 @@ export default {
 		bindAddressChange(data) {
 			this.morCity = data.ids;
 			this.city = data.data[0] + data.data[1] + data.data[2];
+			this.city = this.city.replace(/\s/g,'')
 			this.areaCode = data.ids[2];
 		},
 		chooseLocation() {
@@ -535,6 +540,8 @@ export default {
 				success: function(res) {
 					if (res.name) {
 						tha.address = res.name;
+						this.longitude = res.longitude
+						this.latitude = res.latitude
 						tha.reverseGeocoder(res);
 						console.log('地址数据》》》:', res);
 					}
@@ -551,12 +558,14 @@ export default {
 					output: 'jsonp'
 				}).then(data => {
 					console.log('解析后的地址地址数据:', data);
-					data = data.result
-					this.city = data.ad_info.province+data.ad_info.city+data.ad_info.district
-					this.areaCode = data.ad_info.adcode;
-					this.morCity = [this.areaCode.substring(0,2)+'0000',this.areaCode.substring(0,4)+'00',this.areaCode]
-					this.longitude = data.location.lng
-					this.latitude = data.location.lat
+					if(data){
+						data = data.result
+						this.city = data.ad_info.province+data.ad_info.city+data.ad_info.district
+						this.areaCode = data.ad_info.adcode;
+						this.morCity = [this.areaCode.substring(0,2)+'0000',this.areaCode.substring(0,4)+'00',this.areaCode]
+						this.longitude = data.location.lng
+						this.latitude = data.location.lat
+					}
 				}).catch(err => {
 					console.log(err);
 				});
@@ -566,11 +575,13 @@ export default {
 				QQMapWX.reverseGeocoder(location, data => {
 					console.log('解析后的地址地址数据:', data);
 					
-					this.city = data.ad_info.province+data.ad_info.city+data.ad_info.district
-					this.areaCode = data.ad_info.adcode;
-					this.morCity = [this.areaCode.substring(0,2)+'0000',this.areaCode.substring(0,4)+'00',this.areaCode]
-					this.longitude = data.location.lng
-					this.latitude = data.location.lat
+					if(data){
+						this.city = data.ad_info.province+data.ad_info.city+data.ad_info.district
+						this.areaCode = data.ad_info.adcode;
+						this.morCity = [this.areaCode.substring(0,2)+'0000',this.areaCode.substring(0,4)+'00',this.areaCode]
+						this.longitude = data.location.lng
+						this.latitude = data.location.lat
+					}
 				});
 			//#endif
 		},