浏览代码

Merge branch '2025北京诚祥' of https://gogs.mtavip.com/wangguoyu/uniProject into 2025北京诚祥

tanxue 2 月之前
父节点
当前提交
926301bbb0
共有 4 个文件被更改,包括 152 次插入41 次删除
  1. 43 11
      components/customMap/customMap.vue
  2. 48 0
      components/customMap/useMap.js
  3. 7 1
      manifest.json
  4. 54 29
      pages/admin/Jiazheng/gerenZiliao.vue

+ 43 - 11
components/customMap/customMap.vue

@@ -1,32 +1,64 @@
 <template>
 	<view>
-		<map style="width: 100%; height: 300px;" :latitude="data.latitude" :longitude="data.longitude" :markers="data.covers"> </map>
+		<map style="width: 100%; height: 300px;" :latitude="data.latitude" :longitude="data.longitude"
+			:markers="data.covers" :show-location="true"> </map>
+			<input type="text" v-model="data.keyword" placeholder="请输入地址" style="padding: 10px 0">
+			
+			<view>{{result && result.data.data}}</view>
+			
+			<button @click="handleClick">查询</button>
 	</view>
 </template>
 
 <script setup>
 	import {
-		reactive,
+		reactive,ref
 	} from "vue"
 	import myIcon from "@/static/images/common/markIcon.png"
-	import {onLoad} from "@dcloudio/uni-app"
+	import {
+		onLoad, onHide, onShow
+	} from "@dcloudio/uni-app"
+	import {useCustomMap} from "@/components/customMap/useMap.js"
+	const { getPositionSearchByKeyword } = useCustomMap();
+	
+	const result = ref(null);
+	
+	function handleClick() {
+		if (data.keyword) {
+			getPositionSearchByKeyword(data.keyword, `nearby(${data.latitude},${data.longitude},1000)`,  onSuccess, onError, {page:1, size:3,})
+		}
+	}
+
+	function onSuccess(data) {
+		console.log('数据', data);
+		result.value = data
+	}
+	function onError(err) {
+		console.log('错误', err)
+	}
 
 	const data = reactive({
+		keyword: '', // 关键字
 		id: 0, // 使用 marker点击事件 需要填写id
 		title: 'map',
-		latitude: 39.909,
-		longitude: 116.39742,
+		latitude: 0,
+		longitude: 0,
 		covers: [{
-			latitude: 39.909,
-			longitude: 116.39742,
+			latitude: 0,
+			longitude: 0,
 			iconPath: myIcon,
+			width: 30,
+			height: 30
 		}]
 	})
-	
+
+	// 初始化
 	function initLocation() {
+		console.log('init')
 		uni.getLocation({
 			type: 'gcj02',
-			success: function (res) {
+			success: function(res) {
+				console.log('res', res)
 				data.longitude = res.longitude;
 				data.latitude = res.latitude;
 				data.covers[0].longitude = res.longitude;
@@ -36,11 +68,11 @@
 			}
 		});
 	}
-	
+
 	onLoad(() => {
+		console.log('初始化')
 		initLocation();
 	})
-	
 </script>
 
 <style>

+ 48 - 0
components/customMap/useMap.js

@@ -0,0 +1,48 @@
+// 文档地址 https://lbs.qq.com/service/webService/webServiceGuide/search/webServiceSearch
+// 注意当前请求仅打包后有效
+import request from '@/utils/request'
+import {
+	ref
+} from "vue"
+
+// 关键词不全
+const httpUrl = "https://apis.map.qq.com/ws/place/v1/search"
+const Key = `KBYBZ-FS3KZ-U2FXR-7VPDX-L7J46-23F55`
+
+export function useCustomMap() {
+	// 关键字 范围 页码 数量 成功回调 失败回调
+	function getPositionSearchByKeyword(keyword, boundary, successFun, errorFun, options) {
+		let cpage = options.page || 1;
+		let csize = options.size || 20;
+		let cboundary = boundary; //'nearby(39.992870,116.310250,1000)'
+
+		uni.showLoading({
+			title: '加载中'
+		})
+		uni.request({
+			url: httpUrl,
+			method: 'get',
+			data: {
+				key: Key,
+				output: "json",
+				keyword: keyword,
+				boundary: cboundary,
+				page_size: csize,
+				page_index: cpage,
+			},
+			timeout: 20000,
+		}).then(res => {
+			successFun && successFun(res)
+		}).catch(err => {
+			console.log('err')
+			errorFun && errorFun(err);
+		}).finally(() => {
+			uni.hideLoading();
+		})
+	}
+
+	return {
+		getPositionSearchByKeyword
+	}
+
+}

+ 7 - 1
manifest.json

@@ -32,7 +32,8 @@
         },
         /* 模块配置 */
         "modules" : {
-            "Camera" : {}
+            "Camera" : {},
+            "Maps" : {}
         },
         /* 应用发布信息 */
         "distribute" : {
@@ -75,6 +76,11 @@
                     "alipay" : {
                         "__platform__" : [ "ios", "android" ]
                     }
+                },
+                "maps" : {
+                    "tencent" : {
+                        "key" : "KBYBZ-FS3KZ-U2FXR-7VPDX-L7J46-23F55"
+                    }
                 }
             },
             "splashscreen" : {

+ 54 - 29
pages/admin/Jiazheng/gerenZiliao.vue

@@ -157,7 +157,7 @@
 					idtype: '1',
 					gender: '',
 					juzhuDizhi: '',
-					shenfenzhengUrl:'',
+					shenfenzhengUrl: '',
 					minzu: {},
 					shuxiang: {
 
@@ -202,27 +202,35 @@
 			}
 		},
 		created() {
-
+			uni.showLoading({
+				title: '加载中'
+			});
 			this.initRequests()
-
-
-
 		},
 		methods: {
 
 			async initRequests() {
-				await Promise.all([
-					this.getXueli(),
-					this.getHunyin(),
-					this.getMinzu(),
-					this.getXingzuo(),
-					this.getShuxiang(),
-					this.getJiguan(),
-				]);
-				if (this.status == 'edit') {
-					this.$emit('finishDom','gerenZiliao');
+				try {
+					await Promise.all([
+						this.getXueli(),
+						this.getHunyin(),
+						this.getMinzu(),
+						this.getXingzuo(),
+						this.getShuxiang(),
+						this.getJiguan(),
+					]);
+					uni.hideLoading();
+					if (this.status == 'edit') {
+						this.$emit('finishDom', 'gerenZiliao');
+					}
+				} catch (e) {
+					uni.hideLoading();
+					uni.showToast({
+						title: `请求失败!`,
+						icon: 'none',
+						duration: 2000
+					})
 				}
-
 			},
 			editinfo(data) {
 				this.$nextTick(() => {
@@ -236,10 +244,10 @@
 					this.formData.jiguanShiName = data.jiguanShiName
 					this.formData.juzhuDizhi = data.juzhuDizhi
 					this.formData.birthday = data.birthday
-					this.formData.minzu = this.dataForId(this.minzuList, data.minzu)||''
+					this.formData.minzu = this.dataForId(this.minzuList, data.minzu) || ''
 					this.formData.gender = data.gender
-					this.formData.xueli = this.dataForId(this.xueliList, data.xueli)||''
-					this.formData.hunyin = this.dataForId(this.hunyinList, data.hunyin)||''
+					this.formData.xueli = this.dataForId(this.xueliList, data.xueli) || ''
+					this.formData.hunyin = this.dataForId(this.hunyinList, data.hunyin) || ''
 					this.formData.hujiDizhi = data.hujiDizhi
 					this.formData.juzhuDizhi = data.juzhuDizhi
 					this.formData.xingzuo = this.dataForId(this.xingzuoList, data.xingzuo) || ''
@@ -481,16 +489,33 @@
 			getFileUrl(data) {
 				this.formData.shenfenzhengUrl = data
 				console.log('data', data);
-				jiazhengIdcard({url:this.formData.shenfenzhengUrl}).then(res=>{
-					console.log('res',res);
-					if(res.code ==0){
-						this.formData.realName = res.data.name
-						this.formData.gender = res.data.sex
-						this.formData.minzu = res.data.ethnicity
-						this.formData.realName = res.data.name
-						this.formData.realName = res.data.name
-						this.formData.realName = res.data.name
+				jiazhengIdcard({
+					url: this.formData.shenfenzhengUrl
+				}).then(res => {
+					console.log('res', res);
+					if (res.code == 0) {
+
+
+
+
+
 						this.formData.realName = res.data.name
+						this.formData.gender = res.data.genderId
+						this.formData.minzu.name = res.data.ethnicity
+						this.formData.minzu.id = res.data.minzuId
+						this.formData.birthday = res.data.birthDate
+						this.formData.hujiDizhi = res.data.address
+						this.formData.idcard = res.data.idNumber
+						this.formData.shuxiang.id = res.data.shuxiangId
+						this.formData.shuxiang.name = res.data.shuxiangName
+						this.formData.xingzuo.id = res.data.xingzuoId
+						this.formData.xingzuo.name = res.data.xingzuoName
+						this.formData.jiguanShengId = res.data.jiguanShengId
+						this.formData.jiguanShiId = res.data.jiguanShiId
+						this.formData.jiguanShengName = res.data.jiguanShengName
+						this.formData.jiguanShiName = res.data.jiguanShiName
+						this.formData.jiguanObj.jiguanShengId = res.data.jiguanShengId
+						this.formData.jiguanObj.jiguanShiId = res.data.jiguanShiId
 					}
 				})
 			},
@@ -528,7 +553,7 @@
 				this.formData.gender = data
 			},
 			selectChangeHunyinList(data) {
-					console.log('data',data[0]);
+				console.log('data', data[0]);
 				this.formData.hunyin = data[0]
 			},
 			switchXingzuoChange(e) {