Bladeren bron

优化地图组件事件处理,更新API接口,调整志愿者招募页面样式,增加服务区域选择功能

lzj 1 dag geleden
bovenliggende
commit
2b8715cf7c

+ 3 - 3
components/mapComponent/mapComponent.vue

@@ -3,7 +3,7 @@
 		<map
 			id="map"
 			@markertap="markertap"
-			@callouttap="callouttap"
+			@labeltap="callouttap"
 			:enable-overlooking="true"
 			enable-3D="true"
 			:scale="scale"
@@ -13,7 +13,7 @@
 			:longitude="latitudeAndLongitude.longitude"
 			:show-location="latitudeAndLongitude.anchorPoint"
 		>
-			<cover-view slot="callout">
+			<!-- <cover-view slot="callout">
 				<cover-view
 					v-for="item in markers"
 					:key="item.id"
@@ -22,7 +22,7 @@
 				>
 					<cover-view class="custom_callout_text">{{ item.title }}</cover-view>
 				</cover-view>
-			</cover-view>
+			</cover-view> -->
 		</map>
 	</view>
 	<!-- :show-location="true"定位点 -->

+ 4 - 1
config/api.js

@@ -428,7 +428,10 @@ export const getScanContentList = (data, callback) => post('getScanContentList',
 	'content/content');
 // 需求岗位统计
 export const getVolunteerNumber = (data, callback) => post('getVolunteerNumber', data, callback,
-	'content/content/');
+	'content/content');
+// 区域岗位信息
+export const getVolunteerCrInfo = (data, callback) => post('getvolunteercrinfo', data, callback,
+	'content/content');
 // 模型主体栏目的内容列表
 export const getMainBodyColumnContentList = (data, callback) => post('getMainBodyColumnContentList', data, callback,
 	'content/content');

+ 1 - 1
index_fenbao/SaoMaBaoMing/district.vue

@@ -17,7 +17,7 @@
 					<view class="district-button" @click="selectDistrict(item)">
 						<text class="district-button-text">{{ item.name }}</text>
 					</view>
-					<text class="district-button-subtext">需招募岗位数:{{ item.recruitCount }}</text>
+					<text class="district-button-subtext">拟招募志愿者:{{ item.recruitCount }}</text>
 				</view>
 			</view>
 		</view>

+ 53 - 25
index_fenbao/SaoMaBaoMing/job.vue

@@ -1,31 +1,43 @@
 <template>
 	<view class="job-page">
-		<image
-			class="job-header-image"
-			src="https://wwgj.wenlvti.net/uploads/20260318/e94fb36598d415e39e7cd3d4bd6f915a.png"
-			mode="widthFix"
-		/>
+		<u-navbar
+			@leftClick="goHome"
+			leftText="首页"
+			title="志愿者招募"
+			bgColor="rgba(255,255,255,0)"
+			:placeholder="true"
+			titleStyle="font-weight:bold;color:#000000"
+		></u-navbar>
 
-		<view class="job-buttons">
-			<view class="job-button" @click="goToPage('volunteer')">
-			<view class="job-button-content">
-				<text class="job-button-text">巡查志愿者</text>
-				<text class="job-button-subtext">需招募岗位数:{{ summary.volunteer || 0 }}</text>
-			</view>
-			</view>
+		<view class="job-content">
+			<image
+				class="job-header-image"
+				src="https://wwgj.wenlvti.net/uploads/20260318/e94fb36598d415e39e7cd3d4bd6f915a.png"
+				mode="widthFix"
+			/>
 
-			<view class="job-button" @click="goToPage('xuanjiang')">
-			<view class="job-button-content">
-				<text class="job-button-text">宣讲志愿者</text>
-				<text class="job-button-subtext">需招募岗位数:{{ summary.xuanjiang || 0 }}</text>
-			</view>
-			</view>
+			<view class="job-buttons">
+				<view class="job-button" @click="goToPage('volunteer')">
+					<view class="job-button-content">
+						<text class="job-button-text">巡查志愿者</text>
+						<text class="job-button-subtext">需招募岗位数:{{ summary.volunteer || 0 }}</text>
+					</view>
+				</view>
 
-			<view class="job-button" @click="goToPage('publicize')">
-			<view class="job-button-content">
-				<text class="job-button-text">传播志愿者</text>
-				<text class="job-button-subtext">需招募岗位数:{{ summary.publicize || 0 }}</text>
-			</view>
+				<view class="job-button" @click="goToPage('xuanjiang')">
+					<view class="job-button-content">
+						<text class="job-button-text">宣讲志愿者</text>
+						<text class="job-button-subtext">需招募岗位数:{{ summary.xuanjiang || 0 }}</text>
+					</view>
+				</view>
+
+				<view class="job-button" @click="goToPage('publicize')">
+					<view class="job-button-content">
+						<text class="job-button-text">传播志愿者</text>
+						<text class="job-button-subtext">新媒体拍摄、制作及摄影</text>
+						<text class="job-button-subtext">需招募岗位数:{{ summary.publicize || 0 }}</text>
+					</view>
+				</view>
 			</view>
 		</view>
 	</view>
@@ -59,6 +71,11 @@ export default {
 				};
 			});
 		},
+		goHome() {
+			uni.switchTab({
+				url: '/pages/index/index'
+			});
+		},
 		goToPage(type) {
 			const urlMap = {
 				volunteer: '/index_fenbao/SaoMaBaoMing/saoMaBaoMing',
@@ -77,14 +94,24 @@ export default {
 <style scoped>
 .job-page {
 	min-height: 100vh;
+	display: flex;
+	flex-direction: column;
 	box-sizing: border-box;
-	padding: 25% 0 0 0;
 	background-image: url('https://wwgj.wenlvti.net/uploads/20260318/2663cbc99de9048f820be7badf3fb1e6.png');
 	background-repeat: no-repeat;
 	background-position: center top;
 	background-size: 100% 100%;
 }
 
+.job-content {
+	flex: 1;
+	display: flex;
+	flex-direction: column;
+	align-items: center;
+	box-sizing: border-box;
+	padding: 8vh 0 60rpx;
+}
+
 .job-header-image {
 	display: block;
 	width: 80%;
@@ -92,10 +119,11 @@ export default {
 }
 
 .job-buttons {
+	width: 100%;
 	display: flex;
 	flex-direction: column;
 	align-items: center;
-	padding-top: 130rpx;
+	padding-top: 100rpx;
 }
 
 .job-button {

+ 13 - 5
index_fenbao/SaoMaBaoMing/saoMaBaoMing.vue

@@ -38,8 +38,8 @@
 		<u-popup :show="introduceShow" @close="close" mode="center" :closeable="true" bgColor="#f9dbbf" round="5">
 			<view class="xx_box">
 				<view style="font-size: 40rpx; font-weight: bold; text-align: center;">{{ claimDetails.title }}</view>
-				<view class="xx_tit" v-if="claimDetails.intro">
-					<u-parse :content="claimDetails.intro"></u-parse>
+				<view class="xx_tit" v-if="claimDetails.volunteer_text">
+					<u-parse :content="claimDetails.volunteer_text"></u-parse>
 				</view>
 				<view v-else>
 					<u-empty text="该文物暂无介绍" iconColor="#4a433d" textColor="#4a433d" mode="data"></u-empty>
@@ -247,8 +247,17 @@ export default {
 				height: 1,
 				alpha: 0,
 				title: item.title,
-				customCallout: {
-					display: 'ALWAYS'
+				// customCallout: {
+				// 	display: 'ALWAYS'
+				// },
+				label: {
+					content: item.title,
+					color: '#ffffff',
+					fontSize: 12,
+					bgColor: '#e2a0a4',
+					borderRadius: 20,
+					padding: 6,
+					textAlign: 'center',
 				},
 				joinCluster: true,
 			};
@@ -401,7 +410,6 @@ export default {
 .claim_tit {
 	/* width: 190rpx; */
 	padding: 8rpx 20rpx;
-	height: 70rpx;
 	margin: 30rpx auto 0;
 	font-weight: 600;
 	text-align: center;

+ 172 - 1
index_fenbao/fuWu/baoMing/baoMing2.vue

@@ -16,6 +16,17 @@
 		<!-- 表单 -->
 		<view class="example">
 			<uni-forms style="padding: 0 20rpx 0 20rpx" label-position="top" ref="valiForm" :rules="rules" :modelValue="valiFormData">
+				<uni-forms-item v-if="shouldShowCrSelector" label="服务区域" label-width="100px" required>
+					<view v-if="isDistrictEntry" class="service-area-trigger" @click="openServiceAreaPicker">
+						<text :class="selectedServiceAreaTitle ? 'service-area-value' : 'service-area-placeholder'">
+							{{ selectedServiceAreaTitle || `请选择服务区域` }}
+						</text>
+						<uni-icons type="bottom" size="16" color="#6a412c"></uni-icons>
+					</view>
+					<view v-else class="service-area-readonly">
+						{{ selectedServiceAreaTitle || '暂无文物信息' }}
+					</view>
+				</uni-forms-item>
 				<uni-forms-item label="您的姓名" label-width="80px" required name="name">
 					<uni-easyinput v-model="valiFormData.name" placeholder="请输入姓名" />
 				</uni-forms-item>
@@ -78,6 +89,17 @@
       <view class="bm_tit">报名</view>
     </view>
 
+		<u-picker
+			keyName="title"
+			:show="showServiceAreaPicker"
+			:columns="serviceAreaColumns"
+			:defaultIndex="serviceAreaDefaultIndex"
+			@cancel="showServiceAreaPicker = false"
+			@close="closeServiceAreaPicker"
+			:closeOnClickOverlay="true"
+			@confirm="confirmServiceArea"
+		></u-picker>
+
     
     <!-- 对话框 -->
     <uni-popup ref="popup" type="center">
@@ -103,8 +125,12 @@ export default {
 			return {
 				regionList: [],
 				region_id: null,
+				entryRegionId: '',
 				pendingRegionId: '',
 				pendingRegionName: '',
+				volunteerCrInfo: {},
+				showServiceAreaPicker: false,
+				selectedServiceAreaTitle: '',
 				cr_id: '' /* 文物id */,
 				modifyId: '' /* 修改资料的文物id */,
 				volunteer_id: '' /* 志愿者id */,
@@ -305,10 +331,13 @@ export default {
 			this.volunteer_id = o.volunteer_id;
 			this.modifyId = o.modifyId;
 			this.pendingRegionId = o.region_id ? decodeURIComponent(o.region_id) : '';
+			this.entryRegionId = this.pendingRegionId;
 			this.pendingRegionName = o.regionName ? decodeURIComponent(o.regionName) : '';
 			if (o.type && this.typeOptions.some((item) => item.value === o.type)) {
 				this.valiFormData.type = o.type;
 			}
+			this.initSelectedCrInfo();
+			this.fetchVolunteerCrInfo();
 			this.getCategoryCascadeList();
 
 			if (this.isLogin) {
@@ -325,7 +354,44 @@ export default {
 			}
 		},
   computed: {
-    ...mapGetters(['isLogin'])
+    ...mapGetters(['isLogin']),
+		isDistrictEntry() {
+			return !!this.entryRegionId;
+		},
+		isVolunteerType() {
+			return this.valiFormData.type === 'volunteer';
+		},
+		serviceAreaOptions() {
+			const serviceAreas = this.volunteerCrInfo && Array.isArray(this.volunteerCrInfo.service_areas)
+				? this.volunteerCrInfo.service_areas
+				: [];
+			const optionMap = {};
+			const optionList = [];
+			serviceAreas.forEach((item, index) => {
+				const optionId = item && item.id !== undefined && item.id !== null ? item.id : '';
+				const optionTitle = item && item.title ? item.title : '';
+				const optionKey = `${optionId}_${optionTitle}`;
+				if (!optionMap[optionKey]) {
+					const optionItem = {
+						...item,
+						optionKey: `service_area_${index}`
+					};
+					optionMap[optionKey] = optionItem;
+					optionList.push(optionItem);
+				}
+			});
+			return optionList;
+		},
+		serviceAreaColumns() {
+			return [this.serviceAreaOptions];
+		},
+		serviceAreaDefaultIndex() {
+			const matchedIndex = this.serviceAreaOptions.findIndex((item) => String(item.id) === String(this.cr_id));
+			return [matchedIndex >= 0 ? matchedIndex : 0];
+		},
+		shouldShowCrSelector() {
+			return this.isDistrictEntry || (!this.isDistrictEntry && !!this.cr_id);
+		}
   },
 	methods: {
 		onchange(e) {
@@ -335,6 +401,40 @@ export default {
 			this.region_id = node.value;
 			console.log(node);
 		},
+		openServiceAreaPicker() {
+			if (!this.serviceAreaOptions.length) {
+				this.$common.errorToShow('暂无可选文物');
+				return;
+			}
+			this.showServiceAreaPicker = true;
+		},
+		closeServiceAreaPicker() {
+			this.showServiceAreaPicker = false;
+		},
+		confirmServiceArea(e) {
+			const selectedItem = e && Array.isArray(e.value) ? e.value[0] : null;
+			this.showServiceAreaPicker = false;
+			if (!selectedItem) {
+				return;
+			}
+			this.cr_id = selectedItem.id !== undefined && selectedItem.id !== null ? selectedItem.id : '';
+			this.selectedServiceAreaTitle = selectedItem.title || '';
+		},
+		initSelectedCrInfo() {
+			if (this.isDistrictEntry || !this.cr_id) {
+				return;
+			}
+			this.$api.getContentDetail(
+				{
+					main_body_id: 1,
+					id: this.cr_id
+				},
+				(res) => {
+					const detail = res && res.data ? res.data : {};
+					this.selectedServiceAreaTitle = detail.title || detail.name || '';
+				}
+			);
+		},
 		getRegionValue(item = {}) {
 			if (item.value !== undefined && item.value !== null && item.value !== '') {
 				return item.value;
@@ -392,6 +492,36 @@ export default {
 				this.region_id = this.getRegionValue(matchedRegion);
 			}
 		},
+		getVolunteerCrInfoParams() {
+			if (!this.entryRegionId || !this.valiFormData.type) {
+				return null;
+			}
+			return {
+				main_body_id: 1,
+				id: this.entryRegionId,
+				type: this.valiFormData.type
+			};
+		},
+		fetchVolunteerCrInfo() {
+			const params = this.getVolunteerCrInfoParams();
+			if (!params) {
+				return;
+			}
+			this.$api.getVolunteerCrInfo(params, (res) => {
+				this.volunteerCrInfo = res && res.data ? res.data : {};
+				const matchedItem = this.serviceAreaOptions.find((item) => String(item.id) === String(this.cr_id));
+				if (matchedItem) {
+					this.selectedServiceAreaTitle = matchedItem.title || '';
+				}
+			});
+		},
+		validateSelectedCr() {
+			if (!this.cr_id) {
+				this.$common.errorToShow(`请选择${this.volunteerCrLabel}`);
+				return false;
+			}
+			return true;
+		},
 		// 区域
 		getCategoryCascadeList() {
 			this.$api.getCategoryCascadeList({ main_body_id: 1, pid: 5, level: 2 }, function (res) {
@@ -448,6 +578,9 @@ export default {
 					that.$common.errorToShow('缺少报名类型,请从对应入口重新进入');
 					return;
 				}
+				if (!this.validateSelectedCr()) {
+					return;
+				}
         if (!err) {
 					console.log('校验成功');
 					/* 检验成功 */
@@ -474,6 +607,9 @@ export default {
 					if (this.cr_id) {
 						params.cr_id = this.cr_id;
 					}
+					if (this.isDistrictEntry && this.selectedServiceAreaTitle) {
+						params.service_area = this.selectedServiceAreaTitle;
+					}
 					this.$api.scanApplyVolunteer(
 						params,
 						function (res) {
@@ -706,6 +842,41 @@ export default {
 	color: #333;
 }
 
+.service-area-readonly {
+	display: flex;
+	align-items: center;
+	box-sizing: border-box;
+	height: 70rpx;
+	padding: 0 20rpx;
+	background-color: #f7dfc0;
+	border-radius: 8rpx;
+	color: #6a412c;
+	font-size: 28rpx;
+	line-height: 1;
+}
+
+.service-area-trigger {
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+	box-sizing: border-box;
+	height: 70rpx;
+	padding: 0 20rpx;
+	background-color: #f7dfc0;
+	border-radius: 8rpx;
+}
+
+.service-area-placeholder {
+	font-size: 24rpx;
+	color: #999999;
+	line-height: 1;
+}
+
+.service-area-value {
+	font-size: 24rpx;
+	line-height: 1;
+}
+
 /* 本人承诺样式 */
 .commitment-text {
 	font-size: 28rpx;