wkw 7 месяцев назад
Родитель
Сommit
60f4efbd15
2 измененных файлов с 79 добавлено и 157 удалено
  1. 65 67
      common/queue.js
  2. 14 90
      pages/index/index.vue

+ 65 - 67
common/queue.js

@@ -466,73 +466,71 @@ module.exports = {
 	},
 	},
 	//APP获取手机权限鉴权
 	//APP获取手机权限鉴权
 	// APP获取手机权限鉴权(优化版,兼容全权限+多系统)
 	// APP获取手机权限鉴权(优化版,兼容全权限+多系统)
-	checkPermission: function(permission, tip) {
-		return new Promise((resolve) => {
-			const permisionObj = uni.getAppAuthorizeSetting();
-			const system = uni.getSystemInfoSync().platform; // 获取系统类型(ios/android)
+	checkPermission(permission, tip) {
+	  return new Promise((resolve) => {
+	    const permisionObj = uni.getAppAuthorizeSetting && uni.getAppAuthorizeSetting();
+	    if (!permisionObj || !permisionObj.getSetting) {
+	      console.log('当前环境不支持 getAppAuthorizeSetting');
+	      resolve(true); // 默认放行
+	      return;
+	    }
+	
+	    const system = uni.getSystemInfoSync().platform;
+	    let realScope = permission;
+	    const scopeMap = {
+	      'microphone': 'microphone',
+	      'camera': 'camera',
+	      'location': 'scope.userLocation',
+	      'albumRead': system === 'ios' ? 'photos' : 'storage',
+	      'albumWrite': system === 'ios' ? 'writePhotosAlbum' : 'storage',
+	    };
+	    if (permission === 'album') realScope = scopeMap.albumRead;
+	    else if (permission === 'albumWrite') realScope = scopeMap.albumWrite;
+	    else if (scopeMap[permission]) realScope = scopeMap[permission];
+	
+	    console.log('准备检测权限:', realScope);
+	
+	    permisionObj.getSetting({
+	      success: (res) => {
+	        console.log('权限状态', res.authSetting);
+	        const authStatus = res.authSetting[realScope];
+	        if (authStatus === true) {
+	          resolve(true);
+	        } else if (authStatus === false) {
+	          uni.showModal({
+	            title: '权限不足',
+	            content: `${tip},请前往设置开启权限`,
+	            confirmText: '去设置',
+	            cancelText: '取消',
+	            success: (modalRes) => {
+	              if (modalRes.confirm) {
+	                permisionObj.openAppAuthorizeSetting({
+	                  success: () => resolve(false),
+	                  fail: () => resolve(false)
+	                });
+	              } else {
+	                resolve(false);
+	              }
+	            }
+	          });
+	        } else {
+	          permisionObj.authorize({
+	            scope: realScope,
+	            success: () => resolve(true),
+	            fail: (err) => {
+	              console.log('权限授权失败', err);
+	              resolve(false);
+	            }
+	          });
+	        }
+	      },
+	      fail: (err) => {
+	        console.log('getSetting失败', err);
+	        resolve(false);
+	      }
+	    });
+	  });
+	}
 
 
-			// 步骤1:统一权限scope映射(解决不同系统/权限的scope差异)
-			let realScope = permission;
-			const scopeMap = {
-				// 基础权限(双端通用)
-				'microphone': 'microphone', // 麦克风
-				'camera': 'camera', // 相机
-				'location': 'scope.userLocation', // 定位(小程序/APP通用)
-				// 相册权限(系统差异化处理)
-				'albumRead': system === 'ios' ? 'photos' : 'storage', // 读取相册
-				'albumWrite': system === 'ios' ? 'writePhotosAlbum' : 'storage', // 写入相册
-			};
-			// 兼容传入的permission别名(如传入'album'自动映射为对应系统的读取权限)
-			if (permission === 'album') realScope = scopeMap.albumRead;
-			else if (permission === 'albumWrite') realScope = scopeMap.albumWrite;
-			else if (scopeMap[permission]) realScope = scopeMap[permission];
-
-			// 步骤2:获取权限状态并校验
-			permisionObj.getSetting({
-				success: (res) => {
-					const authStatus = res.authSetting[realScope];
-					// 已授权
-					if (authStatus === true) {
-						resolve(true);
-					}
-					// 已拒绝(引导到设置页)
-					else if (authStatus === false) {
-						uni.showModal({
-							title: '权限不足',
-							content: `${tip},请前往设置开启权限`,
-							confirmText: '去设置',
-							cancelText: '取消',
-							success: (modalRes) => {
-								if (modalRes.confirm) {
-									permisionObj.openAppAuthorizeSetting({
-										success: () => resolve(
-										false), // 跳转设置页后不自动重试,需用户手动开启后返回
-										fail: () => resolve(false)
-									});
-								} else {
-									resolve(false);
-								}
-							}
-						});
-					}
-					// 未授权过(发起系统授权请求)
-					else {
-						permisionObj.authorize({
-							scope: realScope,
-							success: () => resolve(true),
-							fail: (err) => {
-								console.log(`权限授权失败:${permission}`, err);
-								resolve(false);
-							}
-						});
-					}
-				},
-				fail: (err) => {
-					console.log(`获取权限设置失败:${permission}`, err);
-					resolve(false);
-				}
-			});
-		});
-	},
 
 
 };
 };

+ 14 - 90
pages/index/index.vue

@@ -34,69 +34,13 @@
 		</block>
 		</block>
 		<block v-else>
 		<block v-else>
 			<!-- 用户端 -->
 			<!-- 用户端 -->
-			<block v-if="userType==1">
-				<!-- <view class="topbg"> -->
-				<!-- 顶部图片区 -->
-				<!-- #ifdef H5 -->
-				<!-- <view class="banner flex justify-center" style="padding-top: 20rpx;"
-						v-if="bannerListuser.length!=0"> -->
-				<!-- #endif -->
-				<!-- #ifndef H5 -->
-				<!-- <view class="banner flex justify-center" v-if="bannerListuser.length!=0"> -->
-				<!-- #endif -->
-				<!-- <view class="banner-box">
-								<swiper :indicator-dots="false" style="width: 100%;height: 100%;" :autoplay="true"
-									:interval="5000" :duration="300">
-									<swiper-item v-for="(item,index) in bannerListuser" :key="index"
-										@click="goNave(item.url)">
-										<view class="swiper-item" style="width: 100%;height: 100%;">
-											<image :src="item.imageUrl"
-												style="width: 100%;height: 100%;border-radius: 24rpx;"
-												mode="scaleToFill">
-											</image>
-										</view>
-									</swiper-item>
-								</swiper>
-							</view>
-						</view> -->
-				<!-- 公告区 -->
-				<!-- <view class="announcement" v-if="gongao.length!=0">
-							<view class="announcementbox">
-								<view class="anount">最新公告</view>
-								<view class="anounts flex align-center" v-if="gongao.length>0">
-									<view class="" style="width: 100%;">
-										<u-notice-bar color="#333" bg-color="#e5fff2" padding="0rpx 24rpx 4rpx 24rpx"
-											:volume-icon="false" style="height: 100%;" mode="vertical"
-											:list="gongao"></u-notice-bar>
-									</view>
-								</view>
-								<view class="anounts flex align-center" style="padding-left: 30rpx;" v-else>
-									暂无公告
-								</view>
-							</view>
-						</view> -->
-
-				<!-- 企业端 -->
-				<!-- <view v-if="gridlist.length!=0">
-							<u-grid :col="4" :border="false">
-								<u-grid-item bg-color="#00DD9A">
-									<view v-for="(item,index) in gridlist" :key="index" style="text-align: center;"
-										@click="goNave(item.url)">
-										<image :src="item.imageUrl"
-											style="width:80rpx;height: 80rpx;border-radius: 50%;">
-										</image>
-										<view style="color: #FFFFFF;">{{item.name}}</view>
-									</view>
-								</u-grid-item>
-
-							</u-grid>
-						</view> -->
-				<!-- </view> -->
+			<view v-if="userType==1" class="page-container" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
+				
 				<view class="topbg-sticky">
 				<view class="topbg-sticky">
 					<image class="top-bg" src="/static/images/index/index-bg.png" mode="widthFix" />
 					<image class="top-bg" src="/static/images/index/index-bg.png" mode="widthFix" />
 					<!-- <view class="top-bg"></view> -->
 					<!-- <view class="top-bg"></view> -->
 					<!-- 标题-搜索 -->
 					<!-- 标题-搜索 -->
-					<view class="topbg-sticky-box" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
+					<view class="topbg-sticky-box" >
 						<view class="topbg-sticky-title flex justify-between align-center">
 						<view class="topbg-sticky-title flex justify-between align-center">
 							<view class="topbg-sticky-title-left flex align-center">
 							<view class="topbg-sticky-title-left flex align-center">
 								<image src="../../static/images/index/xingIcon.svg" class="xing-icon" />
 								<image src="../../static/images/index/xingIcon.svg" class="xing-icon" />
@@ -221,7 +165,7 @@
 				<block v-if="current != typeList.length - 1">
 				<block v-if="current != typeList.length - 1">
 					<view class="gwList flex justify-center" v-if="dataList.length>0">
 					<view class="gwList flex justify-center" v-if="dataList.length>0">
 						<view class="gwList-box">
 						<view class="gwList-box">
-							<scroll-view scroll-y="true" style="width: 100%;height: 60vh;">
+							<scroll-view scroll-y="true" style="width: 100%;height: 100%;">
 								<view class="gwList-box-item flex justify-center" @click="gotoInfo(item.postPushId)"
 								<view class="gwList-box-item flex justify-center" @click="gotoInfo(item.postPushId)"
 									v-for="(item,index) in dataList" :key="index">
 									v-for="(item,index) in dataList" :key="index">
 									<view class="gwList-box-item-box">
 									<view class="gwList-box-item-box">
@@ -295,31 +239,12 @@
 				<view class="gwList" v-if="current == typeList.length - 1 && companList.length==0">
 				<view class="gwList" v-if="current == typeList.length - 1 && companList.length==0">
 					<empty />
 					<empty />
 				</view>
 				</view>
-			</block>
+			</view>
 			<!-- 企业版 -->
 			<!-- 企业版 -->
-			<block v-else>
-				<!-- 顶部banner图片 -->
-				<!-- 
-					<view class="banner flex justify-center">
-						<view class="banner-box">
-							<swiper :indicator-dots="false" style="width: 100%;height: 100%;" :autoplay="true"
-								:interval="5000" :duration="300">
-								<swiper-item v-for="(item,index) in bannerList" :key="index">
-									<view class="swiper-item" style="width: 100%;height: 100%;">
-										<image :src="item.imageUrl" style="width: 100%;height: 100%;border-radius: 24rpx;"
-											mode="scaleToFill"></image>
-									</view>
-								</swiper-item>
-							</swiper>
-						</view>
-					</view>
-				-->
-
+			<view v-else class="page-container" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
 				<view class="topbg-sticky">
 				<view class="topbg-sticky">
-					<!-- 			<image class="top-bg" src="/static/images/index/index-bg1.png" mode="widthFix" /> -->
-					<!-- <view class="top-bg"></view> -->
 					<!-- 标题-搜索 -->
 					<!-- 标题-搜索 -->
-					<view class="topbg-sticky-box" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
+					<view class="topbg-sticky-box">
 						<view class="topbg-sticky-title flex justify-between align-center">
 						<view class="topbg-sticky-title flex justify-between align-center">
 							<view class="topbg-sticky-title-left flex align-center">
 							<view class="topbg-sticky-title-left flex align-center">
 								<image src="../../static/images/index/xingIcon.svg" class="xing-icon" />
 								<image src="../../static/images/index/xingIcon.svg" class="xing-icon" />
@@ -329,12 +254,7 @@
 						</view>
 						</view>
 						<view class="topbg-sticky-subtitle">亿职赞,愿你在逐梦路上找到心仪伙伴</view>
 						<view class="topbg-sticky-subtitle">亿职赞,愿你在逐梦路上找到心仪伙伴</view>
 					</view>
 					</view>
-
-					<!-- tabs和筛选 -->
 				</view>
 				</view>
-
-
-
 				<!-- 最新公告 -->
 				<!-- 最新公告 -->
 				<view class="announcement" v-if="gongao.length!=0">
 				<view class="announcement" v-if="gongao.length!=0">
 					<view class="announcementbox">
 					<view class="announcementbox">
@@ -508,8 +428,7 @@
 						<empty :isShow="false" v-if="datasList.length==0" />
 						<empty :isShow="false" v-if="datasList.length==0" />
 					</view>
 					</view>
 				</view>
 				</view>
-
-			</block>
+			</view>
 		</block>
 		</block>
 
 
 		<view v-if="goback==true" class="goback" @click="gotoBack">
 		<view v-if="goback==true" class="goback" @click="gotoBack">
@@ -1817,6 +1736,11 @@
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
+	.page-container{
+		display: flex;
+		flex-direction: column;
+		height: calc(100vh - 50px);
+	}
 	page {
 	page {
 		background: #F2F2F7;
 		background: #F2F2F7;
 	}
 	}
@@ -2361,7 +2285,7 @@
 
 
 	.gwList {
 	.gwList {
 		width: 100%;
 		width: 100%;
-		// margin-top: 220rpx;
+		flex: 1;
 
 
 		.gwList-box {
 		.gwList-box {
 			width: 710rpx;
 			width: 710rpx;