Przeglądaj źródła

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

tanxue 2 miesięcy temu
rodzic
commit
7bbfd7a269

+ 3 - 2
components/customMap/customMap.vue

@@ -55,7 +55,7 @@
 		useCustomMap
 	} from "@/components/customMap/useMap.js"
 
-	const emits = defineEmits(['close', 'xuanzeAdress'])
+	const emits = defineEmits(['close', 'xuanzeAdress','currentWeizhi'])
 	const {
 		getPositionSearchByKeyword
 	} = useCustomMap();
@@ -130,8 +130,9 @@
 	}
 
 	function xuanzeAdress(item) {
-		console.log('item');
+		console.log('item',item);
 		emits('xuanzeAdress', item.address);
+		emits('currentWeizhi', item.location);
 
 	}
 

+ 140 - 0
pages/admin/Jiazheng/common/share.vue

@@ -0,0 +1,140 @@
+<template>
+ <button @click="showShareMenu">分享</button>
+ 
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      imageUrl: '' 
+    };
+  },
+  methods: {
+
+    showShareMenu() {
+      uni.showActionSheet({
+        itemList: ['下载图片'],
+        success: (res) => {
+          if (res.tapIndex === 0) {
+            this.downloadImage();
+          }
+        }
+      });
+    },
+
+
+    downloadImage() {
+      // #ifdef H5
+      this.downloadImageForH5();
+      // #endif
+
+      // #ifdef APP-PLUS
+      this.downloadImageForApp();
+      // #endif
+    },
+
+
+    downloadImageForH5() {
+
+      const link = document.createElement('a');
+      link.href = this.imageUrl;
+      link.download = 'image.jpg'; 
+      document.body.appendChild(link);
+      link.click(); 
+      document.body.removeChild(link);
+      uni.showToast({
+        title: '图片已下载,请手动保存到相册。',
+        icon: 'none'
+      });
+    },
+
+    downloadImageForApp() {
+      uni.showLoading({
+        title: '下载中...',
+        mask: true
+      });
+
+      uni.downloadFile({
+        url: this.imageUrl, 
+        success: (res) => {
+          if (res.statusCode === 200) {
+            const tempFilePath = res.tempFilePath; // 下载后的临时文件路径
+            this.saveImageToAlbum(tempFilePath); // 保存到相册
+          } else {
+            uni.showToast({
+              title: '下载失败',
+              icon: 'none'
+            });
+          }
+        },
+        fail: (err) => {
+          console.error('下载失败:', err);
+          uni.showToast({
+            title: '下载失败',
+            icon: 'none'
+          });
+        },
+        complete: () => {
+          uni.hideLoading();
+        }
+      });
+    },
+
+
+    saveImageToAlbum(tempFilePath) {
+      // #ifdef APP-PLUS
+      if (uni.getSystemInfoSync().platform === 'android') {
+        uni.authorize({
+          scope: 'scope.writePhotosAlbum',
+          success: () => {
+            this.saveImage(tempFilePath);
+          },
+          fail: () => {
+            uni.showModal({
+              title: '提示',
+              content: '需要相册权限才能保存图片,是否去设置?',
+              success: (res) => {
+                if (res.confirm) {
+                  uni.openSetting(); // 打开设置页面
+                }
+              }
+            });
+          }
+        });
+      } else {
+        this.saveImage(tempFilePath);
+      }
+      // #endif
+    },
+    saveImage(tempFilePath) {
+      uni.saveImageToPhotosAlbum({
+        filePath: tempFilePath,
+        success: () => {
+          uni.showToast({
+            title: '保存成功',
+            icon: 'success'
+          });
+        },
+        fail: (err) => {
+          console.error('保存失败:', err);
+          uni.showToast({
+            title: '保存失败',
+            icon: 'none'
+          });
+        }
+      });
+    }
+  }
+};
+</script>
+
+<style>
+button {
+  margin-top: 20px;
+  padding: 10px 20px;
+  background-color: #007AFF;
+  color: white;
+  border-radius: 5px;
+}
+</style>

+ 9 - 1
pages/admin/Jiazheng/gerenZiliao.vue

@@ -126,7 +126,7 @@
 			<button type="default" v-if="status =='edit'" @click="editSave" class="phone-green-btn">保存</button>
 		</view>
 		<uni-popup ref="popupMap" background-color="#fff" :is-mask-click="false" :mask-click="false">
-			<customMap style="100vh" @xuanzeAdress="xuanzeAdress" @close="mapClose"></customMap>
+			<customMap style="100vh" @xuanzeAdress="xuanzeAdress" @currentWeizhi="currentWeizhi" @close="mapClose"></customMap>
 		</uni-popup>
 	</view>
 </template>
@@ -168,6 +168,8 @@
 					idtype: '1',
 					gender: '',
 					juzhuDizhi: '',
+					jingdu: '',
+					weidu: '',
 					shenfenzhengUrl: '',
 					minzu: {},
 					shuxiang: {
@@ -224,6 +226,12 @@
 				this.formData.juzhuDizhi = data
 				this.mapClose()
 			},
+			currentWeizhi(data) {
+				console.log('data', data);
+				this.formData.jingdu = data.lng
+				this.formData.weidu = data.lat
+				this.mapClose()
+			},
 			openMap() {
 				this.$refs.popupMap.open('bottom')
 			},

+ 26 - 2
pages/admin/Jiazheng/index.vue

@@ -49,6 +49,7 @@
 								<view class="head-name">{{item.realName}}</view>
 								<button type="default" class="phone-green-btn bz-tel-btn"
 									@click.stop="telephone(item)">打电话</button>
+									<share ref="shareRef">分享</share>
 							</view>
 							<view @click="lookUserInfo(item)" class="card-body-row">
 								<view class="card-img-box">
@@ -94,8 +95,10 @@
 	} from "@/api/jiazheng.js"
 	import dataChecked from './common/dataChecked.vue';
 	import searchDialog from "./common/search.vue";
+	import share from "./common/share.vue";
 	import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
 	const searchDialogRef = ref(null);
+	const shareRef = ref(null);
 	let allType = ref([])
 	let data = reactive({
 		leixing: '全部类型',
@@ -105,6 +108,8 @@
 		sortRule: '', //排序规则(1降序,2升序
 		sortRule: '', //排序类型(1更新时间,2录入时间)
 		userName: '',
+		weidu: '',
+		jingdu: '',
 		list: [], // 考试列表
 		loading: false,
 		state: 'more',
@@ -292,7 +297,9 @@
 			"size": 10,
 			"sortRule": data.sortRule,
 			"sortType": data.sortType,
-			"userName": data.userName
+			"userName": data.userName,
+			"jingdu": data.jingdu,
+			"weidu": data.weidu
 		}
 		data.list = [];
 		// 数学
@@ -325,7 +332,9 @@
 			"size": 10,
 			"sortRule": data.sortRule,
 			"sortType": data.sortType,
-			"userName": data.userName
+			"userName": data.userName,
+			"jingdu": data.jingdu,
+			"weidu": data.weidu
 		}
 		if (data.state == 'no-more') return;
 		data.state = 'loading';
@@ -365,8 +374,23 @@
 		}));
 		return newList
 	}
+	
+	function getCurrentWeizhi(){
+		console.log('1231231');
+		uni.getLocation({
+			type: 'gcj02',
+			success: function(res) {
+				console.log('res', res)
+				data.jingdu = res.longitude
+				data.weidu = res.latitude
+				console.log('当前位置的经度:' + res.longitude);
+				console.log('当前位置的纬度:' + res.latitude);
+			}
+		});
+	}
 	onLoad(() => {
 		getMore()
 		getLeixing()
+		getCurrentWeizhi()
 	})
 </script>

+ 6 - 1
pages/admin/Jiazheng/jiazhengUserManager.vue

@@ -80,7 +80,10 @@
 					"xingzuoFlag": false,
 					"xueli": '',
 					"zhengshuUrls": "",
-					"zhuangtai": ''
+					"zhuangtai": '',
+					"jingdu": '',
+					"weidu": ''
+					
 				},
 				status: '',
 				id: '',
@@ -287,6 +290,8 @@
 				this.allData.xingzuo = data.xingzuo.id
 				this.allData.shuxiang = data.shuxiang.id
 				this.allData.xingzuoFlag = data.xingzuoFlag
+				this.allData.jingdu = data.jingdu
+				this.allData.weidu = data.weidu
 				if (flag == 'edit') {
 					jiazhengUpdate(this.allData).then(res => {
 						uni.showToast({