gjy 3 vuotta sitten
vanhempi
commit
e7492cf073

+ 3 - 5
manifest.json

@@ -98,10 +98,10 @@
                     "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
                     "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
                     "<uses-permission android:name=\"android.permission.CAMERA\"/>",
+                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
                     "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
                     "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
-                    "<uses-permission android:name=\"android.permission.USE_FINGERPRINT\"/>"
+                    "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>"
                 ]
             },
             "icons" : {
@@ -166,9 +166,7 @@
         "modules" : {
             "SQLite" : {},
             "Push" : {},
-            "Maps" : {},
-            "Geolocation" : {},
-            "Fingerprint" : {}
+            "Maps" : {}
         },
         "splashscreen" : {
             "waiting" : false

+ 63 - 18
pages/grain_pulse/enter.vue

@@ -46,12 +46,23 @@
 			<view class="modular">
 				<u-form-item label="上传坐标" label-width="30%" class="title Regular">
 					<text @click='naviageToPage("/pages/grain_pulse/localtion/coordinate")'
-						class="con-list Regular">{{deptList.buyer == null ? "未上传":deptList.buyer}}<text
+						class="con-list Regular">{{position.longitude == undefined ? "未上传":'已上传'}}<text
 							class='tip_text cuIcon-right'></text></text>
 				</u-form-item>
 				<u-form-item label="所在区域" label-width="30%" class="title Regular">
-					<u-input v-model="deptList.name" input-align="right" class="write Regular" disabled
-						placeholder="自动获取" />
+					<view style='text-align:right;width:100%;padding-right:10px;' v-if='position.province!=undefined'>
+						{{position.province}}
+					{{position.city}}
+					{{position.district}}
+					</view>
+					<view style='text-align:right;width:100%;padding-right:10px;' v-if='position.pname!=undefined'>
+						{{position.pname}}
+					{{position.cityname}}
+					{{position.adname}}
+					</view>
+					<view style='text-align:right;width:100%;padding-right:10px;' v-if='position.pname==undefined&&position.province==undefined'>
+						未上传坐标
+					</view>
 				</u-form-item>
 				<u-form-item label="详细地址" label-width="30%" class="title Regular">
 					<u-input v-model="deptList.detailedAddress" input-align="right" class="write Regular"
@@ -61,19 +72,19 @@
 					<view class="title Regular" style="margin-top: 15rpx;">上传图片</view>
 					<view v-if="license1 != ''">
 						<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
-							:size-type="['compressed']" @on-success="getImgUrl" @on-error="onError"
-							@on-remove="onRemove" @on-uploaded="isAdd = true" :before-upload="filterFileType"
+							:size-type="['compressed']" @on-success="getImgUrl" 
+							 @on-uploaded="isAdd = true" :before-upload="filterFileType"
 							:options="uploadOptions" customBorder='2px dashed #D8DEF7' customBtnFontSize="14" customBtnColor="#6A7282" :customBtnHeight='custombtnheight'
 							 :customBtnWidth='custombtnwidth' customBack='#F9FAFE' :customBtnImage="custombtnimage" :customBtn='custombtn'
-							  :custom="uploadCustom" @on-progress="onProgress"></upload>
+							  :custom="uploadCustom" ></upload>
 					</view>
 					<view v-if="license2 != ''">
 						<upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
-							:size-type="['compressed']" @on-success="getImgUrl1" @on-error="onError"
-							@on-remove="onRemove" @on-uploaded="isAdd = true" :before-upload="filterFileType"
+							:size-type="['compressed']" @on-success="getImgUrl1"
+							 @on-uploaded="isAdd = true" :before-upload="filterFileType"
 							:options="uploadOptions1"  customBack='#FEF9FA' customBorder='2px dashed #F9D5DC' customBtnFontSize="14" customBtnColor="#6A7282" :customBtnHeight='custombtnheight'
 							 :customBtnWidth='custombtnwidth' :customBtnImage="custombtnimage" :customBtn='custombtn'
-							  :custom="uploadCustom" @on-progress="onProgress"></upload>
+							  :custom="uploadCustom" ></upload>
 					</view>
 				</view>
 			</view>
@@ -97,7 +108,8 @@
 
 <script>
 	import {
-		mapState
+		mapState,
+		mapMutations
 	} from 'vuex';
 	import upload from '@/components/upload.vue';
 	export default {
@@ -123,7 +135,12 @@
 				mainBusinessType: [],
 				uploadCustom: true,
 				deptList: {
-					companyProfile:''
+					compName:'',
+					title:'',
+					companyProfile:'',
+					province:'',
+					city:'',
+					area:''
 				},
 				management: [{
 						name: "粮库",
@@ -158,7 +175,9 @@
 				show: false,
 				// anNiuCss:"types",
 				anNiuCss: [],
-				position:{},
+				position:{
+					province:''
+				},
 				custombtn:true,
 				custombtnimage:'../../static/img/liangmai/ic_shanchuan@3x.png',
 				custombtnwidth:50,
@@ -169,9 +188,13 @@
 			}
 		},
 		onLoad(options) {
-			console.log(options)
-			this.position=JSON.parse(options.position)
-			console.log(this.position)
+			
+			if(options.position){
+				this.position=JSON.parse(options.position)
+			}
+		},
+		onShow() {
+			console.log(this.$store.state.enter)
 		},
 		computed: {
 			...mapState(['hasLogin', 'userInfo'])
@@ -182,9 +205,21 @@
 				this.deptList.attachmentAddress = res
 			},
 			naviageToPage(item) {
+				// console.log(this.enter)
+				var data={
+					compName:this.deptList.compName,
+					title:this.deptList.title,
+					mainBusinessType:this.mainBusinessType.toString(),
+					companyProfile:this.deptList.companyProfile,
+				}
+				this.$store.dispatch('enterchange',data)
+				console.log(this.$store.state.enter)
+				// this.enterchange()
+				var mainBusinessType=this.mainBusinessType.toString()
 				uni.navigateTo({
 					url: item
 				})
+				
 			},
 			getImgUrl1(res) {
 				console.log(res)
@@ -247,7 +282,7 @@
 					this.$api.msg('企业简介不能为空')
 					return
 				}
-				if (!this.deptList.longitude&&!this.deptList.longitude) {
+				if (!this.position.longitude&&!this.position.latitude) {
 					this.$api.msg('上传坐标不能为空')
 					return
 				}
@@ -282,8 +317,18 @@
 				// this.show = true
 				// return
 				this.deptList.mainBusinessType=this.mainBusinessType.toString()
-				this.deptList.longitude='40.22077'
-				this.deptList.latitude='116.23128'
+				this.deptList.longitude=this.position.longitude
+				this.deptList.latitude=this.position.latitude
+				if(this.position.province!=undefined){
+					this.deptList.province=this.position.province
+					this.deptList.city=this.position.city
+					this.deptList.area=this.position.district
+				}else if(this.position.pname!=undefined){
+					this.deptList.province=this.position.pname
+					this.deptList.city=this.position.cityname
+					this.deptList.area=this.position.adname
+				}
+				
 				this.deptList.createPhone=this.userInfo.phone
 				uni.showModal({
 					content: "确定提交企业信息??",

+ 10 - 1
pages/grain_pulse/home.vue

@@ -63,7 +63,7 @@
 						<image class='location' src="../../static/img/liangmai/icon_ditu.png" mode=""></image>
 						{{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}
 					</view>
-					<view v-if='position.name!="未设置"' class='distance Regular'>50m</view>
+					<view v-if='position.name!="未设置"' class='distance Regular'>{{item._metre}}</view>
 				</view>
 			</view>
 		</view>
@@ -131,6 +131,14 @@
 			}).then(res => {
 				if (res.data.code == 200) {
 					this.datalist = res.data.data.records
+					console.log(this.position)
+					let lat2 =this.position.location.split(',')[1];
+					let lng2 = this.position.location.split(',')[0];
+					for(var i=0;i<this.datalist.length;i++){
+						this.datalist[i]._metre=this.utils.getDistance(this.datalist[i].latitude,this.datalist[i].longitude,lat2,lng2)
+					}
+					console.log(this.datalist)
+					// let _metre = this.utils.getDistance(lat1,lng1,lat2,lng2) +"千米"
 				}
 			})
 			uni.getStorage({
@@ -148,6 +156,7 @@
 		onLoad(option) {
 			if (option.position){
 				this.position = option.position
+				
 			}
 		},
 		methods: {

+ 46 - 13
pages/grain_pulse/localtion/coordinate.nvue

@@ -41,7 +41,9 @@
 				// 	longitude: 116.39747,
 				// 	iconPath: '../../../static/img/location.png',
 				// }],
-				covers: []
+				covers: [],
+				amapPlugin:null,
+				mapKey:''
 			}
 		},
 		onReady() {
@@ -72,6 +74,12 @@
 
 			},
 		},
+		onLoad(options) {
+			console.log(11111)
+			// if(options){
+				console.log(options)
+			// }
+		},
 		onShow() {
 			let that = this
 			uni.getStorage({
@@ -109,21 +117,46 @@
 			
 			},
 			tap(e) {
+				var that = this
 					let newmarker =[];
 							var id=1;
-				this.position.longitude = e.detail.longitude;
-				this.position.latitude = e.detail.latitude;
-				console.log(this.longitude)
-				console.log(this.latitude)
-				let maker= {
-					id: id++,
-					latitude: this.position.latitude,
-					longitude:this.position.longitude,
-					iconPath: '../../../static/img/location.png',
+						
+				// this.position.longitude = e.detail.longitude;
+				// this.position.latitude = e.detail.latitude;
+				// console.log(this.longitude)
+				// console.log(this.latitude)
+				// let maker= {
+				// 	id: id++,
+				// 	latitude: this.position.latitude,
+				// 	longitude:e.detail.longitude,
+				// 	iconPath: '../../../static/img/location.png',
+				// }
+				// newmarker.push(maker)
+				// this.covers = newmarker
+				var lnglat = e.detail.longitude+','+e.detail.latitude
+				console.log("lnglat",lnglat)
+				let parameters = {
+					key: 'dd701d394d116b50268dc16470ddd615',
+					location: lnglat
 				}
-				newmarker.push(maker)
-				this.covers = newmarker
-
+				uni.request({
+					url: 'https://restapi.amap.com/v3/geocode/regeo?parameters',
+					data: parameters,
+					success: (res) => {
+						that.position=res.data.regeocode.addressComponent
+						console.log(res.data.regeocode.addressComponent)
+						that.position.longitude = res.data.regeocode.addressComponent.streetNumber.location.split(',')[0];
+						that.position.latitude = res.data.regeocode.addressComponent.streetNumber.location.split(',')[1];
+						let maker= {
+							id: id++,
+							latitude: that.position.latitude,
+							longitude:that.position.longitude,
+							iconPath: '../../../static/img/location.png',
+						}
+						newmarker.push(maker)
+						that.covers = newmarker
+					}
+				});
 			},
 			config() {
 				// console.log("this.position",this.position)

+ 37 - 11
pages/grain_pulse/localtion/coordinate.vue

@@ -109,20 +109,46 @@
 			
 			},
 			tap(e) {
+				var that = this
 					let newmarker =[];
 							var id=1;
-				this.position.longitude = e.detail.longitude;
-				this.position.latitude = e.detail.latitude;
-				console.log(this.longitude)
-				console.log(this.latitude)
-				let maker= {
-					id: id++,
-					latitude: this.position.latitude,
-					longitude:this.position.longitude,
-					iconPath: '../../../static/img/location.png',
+						
+				// this.position.longitude = e.detail.longitude;
+				// this.position.latitude = e.detail.latitude;
+				// console.log(this.longitude)
+				// console.log(this.latitude)
+				// let maker= {
+				// 	id: id++,
+				// 	latitude: this.position.latitude,
+				// 	longitude:e.detail.longitude,
+				// 	iconPath: '../../../static/img/location.png',
+				// }
+				// newmarker.push(maker)
+				// this.covers = newmarker
+				var lnglat = e.detail.longitude+','+e.detail.latitude
+				console.log("lnglat",lnglat)
+				let parameters = {
+					key: 'dd701d394d116b50268dc16470ddd615',
+					location: lnglat
 				}
-				newmarker.push(maker)
-				this.covers = newmarker
+				uni.request({
+					url: 'https://restapi.amap.com/v3/geocode/regeo?parameters',
+					data: parameters,
+					success: (res) => {
+						that.position=res.data.regeocode.addressComponent
+						console.log(res.data.regeocode.addressComponent)
+						that.position.longitude = res.data.regeocode.addressComponent.streetNumber.location.split(',')[0];
+						that.position.latitude = res.data.regeocode.addressComponent.streetNumber.location.split(',')[1];
+						let maker= {
+							id: id++,
+							latitude: that.position.latitude,
+							longitude:that.position.longitude,
+							iconPath: '../../../static/img/location.png',
+						}
+						newmarker.push(maker)
+						that.covers = newmarker
+					}
+				});
 
 			},
 			config() {

+ 2 - 2
pages/grain_pulse/my_grain_pulse.vue

@@ -44,7 +44,7 @@
 				</view>
 			</view>
 			<view v-if='mainBusinessType=="我的企业"' class='exitloginwrap'>
-				<button @click='enter()' class='exitlogin'>新增</button>
+				<button @click.stop='enterclick()' class='exitlogin'>新增</button>
 			</view>
 		</view>
 	</view>
@@ -123,7 +123,7 @@
 					url:item
 				})
 			},
-			enter(){
+			enterclick(){
 				//入驻
 				uni.navigateTo({
 					url:'/pages/grain_pulse/enter'

+ 8 - 1
pages/grain_pulse/perfect.vue

@@ -81,7 +81,7 @@
 		data() {
 			return {
 				deptList: {},
-				label: ["世界一流", "世界500强"],
+				label: [],
 				closeable: true,
 				show: true,
 				show1: true,
@@ -99,6 +99,13 @@
 			this.deptList=JSON.parse(options.deptList)
 			console.log(this.deptList)
 		},
+		computed: {
+			show(){
+				if(!this.deptList.companyContant&&!this.deptList){
+					
+				}
+			}
+		},
 		methods: {
 			add() {
 				if (this.label.length >= 6) {

+ 7 - 4
pages/grain_pulse/position/position.vue

@@ -182,13 +182,14 @@
 			},
 			getLocation() {
 				let that = this;
+				console.log(11111)
 				uni.getLocation({
 					type: 'gcj02',
 					geocode: true,
 					success: function(res) {
-						// console.log('获取位置数据:', res);
-						// console.log('当前位置的经度:' + res.longitude);
-						// console.log('当前位置的纬度:' + res.latitude);
+						console.log('获取位置数据:', res);
+						console.log('当前位置的经度:' + res.longitude);
+						console.log('当前位置的纬度:' + res.latitude);
 						//拼接当前定位回显地址
 						// #ifdef APP-PLUS
 						let _address = res.address
@@ -199,6 +200,9 @@
 							.poiName
 						console.log(that.address)
 						// #endif
+					},
+					fail:function(req){
+						console.log(req)
 					}
 				});
 			},
@@ -208,7 +212,6 @@
 				var that = this
 				that.po_tips = '定位中...'
 				let countdown = setInterval(() => {
-					console.log(2222)
 					that.seconds--;
 					uni.getLocation({
 						type: 'gcj02',

+ 15 - 1
store/index.js

@@ -44,6 +44,12 @@ const saveLifeData = function(key, value) {
 
 const store = new Vuex.Store({
 	state: {
+		enter:{
+			compName:'',
+			title:'',
+			mainBusinessType:'',
+			companyProfile:'',
+		},
 		hasLogin: false,
 		// 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量
 		pushRes:lifeData.pushRes?lifeData.pushRes: {},
@@ -115,6 +121,7 @@ const store = new Vuex.Store({
 			state.userInfo = provider;
 			uni.setStorageSync('userInfo', provider)
 		},
+		
 		logout(state) {
 			state.hasLogin = false;
 			state.userInfo = {};
@@ -130,7 +137,14 @@ const store = new Vuex.Store({
 		
 	},
 	actions: {
-	
+		enterchange(state, provider) {
+	    console.log(state)  
+		console.log(provider)  
+		state.compName = provider.compName;  
+		state.title = provider.title;  
+		state.mainBusinessType = provider.mainBusinessType;  
+		state.companyProfile = provider.companyProfile;  
+		},  
 	},
 	getters: {
 		getUserInfo(state) {