feat: 为政策详情、政策列表和首页页面增加H5/PC适配样式、隐藏滚动条,并为政策详情和列表接口失败时添加H5/APP-PLUS测试数据。

This commit is contained in:
2026-03-10 17:49:02 +08:00
parent acfee86a50
commit a676deedc1
3 changed files with 190 additions and 7 deletions

View File

@@ -5,7 +5,7 @@
--> -->
<template> <template>
<!-- @scroll="handleScroll" @scrolltolower="scrollBottom" --> <!-- @scroll="handleScroll" @scrolltolower="scrollBottom" -->
<scroll-view :scroll-y="true" class="container" style="background-image: url(../../../packageRc/static/pageBgIndex.png);"> <scroll-view :scroll-y="true" class="container h5-pc-container" :show-scrollbar="false" style="background-image: url(../../../packageRc/static/pageBgIndex.png);">
<view style="padding: 40rpx 28rpx;"> <view style="padding: 40rpx 28rpx;">
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<view class="kinggang"> <view class="kinggang">
@@ -133,6 +133,8 @@ onMounted(()=>{
getPolicy(); getPolicy();
}) })
function goCa(){ function goCa(){
if (checkLogin()) { if (checkLogin()) {
const userInfo = uni.getStorageSync('userInfo') const userInfo = uni.getStorageSync('userInfo')
@@ -240,6 +242,14 @@ function nextDetail(job) {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
/* 隐藏滚动条 */
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
}
view{box-sizing: border-box;display: block;} view{box-sizing: border-box;display: block;}
.container{ .container{
background-color: #F4F4F4;background-position: top center;background-size: 100% auto; background-color: #F4F4F4;background-position: top center;background-size: 100% auto;
@@ -414,4 +424,70 @@ view{box-sizing: border-box;display: block;}
transform: translateX(50%); transform: translateX(50%);
} }
} }
/* #ifdef H5 */
.h5-pc-container {
& > view {
width: 80% !important;
margin: 0 auto !important;
padding-left: 0 !important;
padding-right: 0 !important;
}
.showtab {
margin-bottom: 80rpx;
height: 300rpx;
.tabItem {
height: 300rpx !important;
image:first-child {
width: 100%;
height: 100%;
object-fit: contain;
}
}
}
.tabs {
margin-bottom: 80rpx;
height: 120rpx;
.tab {
line-height: 112rpx !important;
font-size: 38rpx !important;
font-weight: bold;
}
}
.titles {
margin-bottom: 80rpx;
.title-item {
font-size: 42rpx !important;
margin-right: 80rpx !important;
>view {
padding: 0 24rpx !important;
}
}
}
.job-list {
padding: 48rpx !important;
margin-bottom: 40rpx !important;
}
.title {
font-size: 42rpx !important;
}
.infos view {
font-size: 34rpx !important;
line-height: 56rpx !important;
padding: 8rpx 24rpx !important;
}
.salary {
font-size: 40rpx !important;
}
.bottom-line {
font-size: 32rpx !important;
margin-top: 24rpx !important;
}
}
/* #endif */
</style> </style>

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="page" style="background-image: url(../../../packageRc/static/pageBg.png);"> <view class="page h5-pc-page" style="background-image: url(../../../packageRc/static/pageBg.png);">
<scroll-view :scroll-y="true" style="height: 100vh;position: relative;z-index: 1;"> <scroll-view :scroll-y="true" style="height: 100vh;position: relative;z-index: 1;" :show-scrollbar="false">
<view class="input-outer-part" <view class="input-outer-part"
style="padding: 24rpx 32rpx 0;max-height: unset;"> style="padding: 24rpx 32rpx 0;max-height: unset;">
<view class="basic-info-content-main" v-if="!loading"> <view class="basic-info-content-main" v-if="!loading">
@@ -31,8 +31,8 @@
class="main-ceontent-list-item" class="main-ceontent-list-item"
v-if="policyDetail.applicableObjects" v-if="policyDetail.applicableObjects"
> >
<view class="main-ceontent-list-item-title">政策对象</view> <view :class="['main-ceontent-list-item-title', isPc ? 'pc-main-ceontent-list-item-title' : '']">政策对象</view>
<view class="main-ceontent-list-item-content"> <view :class="['main-ceontent-list-item-content', isPc ? 'pc-main-ceontent-list-item-content' : '']">
<span <span
v-if="policyDetail.applicableObjects" v-if="policyDetail.applicableObjects"
v-html="policyDetail.applicableObjects" v-html="policyDetail.applicableObjects"
@@ -113,6 +113,23 @@ import { getPolicyDetail } from "@/packageRc/apiRc/policy";
getPolicy(id) { getPolicy(id) {
getPolicyDetail({id}).then(res => { getPolicyDetail({id}).then(res => {
this.policyDetail = res.data this.policyDetail = res.data
}).catch(err => {
// #ifdef H5 || APP-PLUS
// 仅在测试环境下,注入大段文本验证排版
this.policyDetail = {
zcmc: '【条件编译测试】支持高校毕业生在本地创业就业的若干激励措施(接口失败模拟)',
zcLevel: '省级重点',
sourceUnit: '人社测试局',
publishTime: '2026-03-10',
viewNum: 9999,
applicableObjects: '1. 本市户籍的高校毕业生;<br/>2. 创业青年群体。',
policyExplanation: '本政策旨在吸引更多高素质人才留在本市发展。',
applyCondition: '具有全日制本科及以上学历且毕业在5年内。',
zczc: '最高50万元奖励办公场地免租3年。',
btbz: '本科5000元/月硕士10000元/月连续发放3年。',
jbqd: '政务中心2楼窗口、线上小程序入口。'
}
// #endif
}) })
}, },
getDictLabel(value, list) { getDictLabel(value, list) {
@@ -130,6 +147,14 @@ import { getPolicyDetail } from "@/packageRc/apiRc/policy";
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 隐藏滚动条 */
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
}
.page { .page {
background-color: #f4f4f4 !important; background-color: #f4f4f4 !important;
height: 100vh; height: 100vh;
@@ -323,4 +348,41 @@ import { getPolicyDetail } from "@/packageRc/apiRc/policy";
); );
} }
} }
/* #ifdef H5 */
.h5-pc-page {
width: 100% !important;
.input-outer-part {
width: 80% !important;
margin: 0 auto !important;
padding-left: 0 !important;
padding-right: 0 !important;
}
.title-line {
font-size: 52rpx !important;
line-height: 1.4 !important;
}
.infos {
font-size: 38rpx !important;
line-height: 1.8 !important;
.info {
margin-top: 10rpx !important;
}
}
.main-ceontent-list-item-title {
font-size: 42rpx !important;
line-height: 60rpx !important;
margin-bottom: 24rpx !important;
}
.main-ceontent-list-item-content {
font-size: 38rpx !important;
line-height: 56rpx !important;
padding: 24rpx !important;
}
.tag {
font-size: 34rpx !important;
}
}
/* #endif */
</style> </style>

View File

@@ -1,6 +1,6 @@
<template> <template>
<view <view
class="page" class="page h5-pc-page"
style=" style="
background-image: url(../../../packageRc/static/pageBg.png); background-image: url(../../../packageRc/static/pageBg.png);
" "
@@ -34,6 +34,7 @@
:scroll-y="true" :scroll-y="true"
style="height: calc(100vh - 232rpx); position: relative; z-index: 1" style="height: calc(100vh - 232rpx); position: relative; z-index: 1"
@scrolltolower="getBottomList" @scrolltolower="getBottomList"
:show-scrollbar="false"
> >
<view <view
style="margin-bottom: 24rpx; border-radius: 16rpx" style="margin-bottom: 24rpx; border-radius: 16rpx"
@@ -162,8 +163,16 @@ export default {
this.total = res.total; this.total = res.total;
} else { } else {
this.loading = false; this.loading = false;
// #ifdef H5 || APP-PLUS
// 接口返回非 200 或失败时展示测试数据 (条件编译)
this.tableData = [
{ id: '1', zcmc: '测试政策001关于进一步支持人才发展的若干措施条件编译测试数据', publishTime: '2026-03-10', viewNum: 888, zcLevel: '省级', sourceUnit: '模拟测试部' },
{ id: '2', zcmc: '测试政策002高校毕业生创业补贴申请指南条件编译测试数据', publishTime: '2026-03-10', viewNum: 666, zcLevel: '市级', sourceUnit: '人力资源局' }
];
this.total = 2;
// #endif
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg || '获取列表失败',
icon: "none", icon: "none",
}); });
} }
@@ -173,6 +182,14 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 隐藏滚动条 */
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
}
.page { .page {
background-color: #f4f4f4 !important; background-color: #f4f4f4 !important;
height: 100vh; height: 100vh;
@@ -520,4 +537,32 @@ export default {
margin-top: 12rpx; margin-top: 12rpx;
} }
} }
/* #ifdef H5 */
.h5-pc-page {
width: 100% !important;
.input-outer-part {
width: 80% !important;
margin: 0 auto !important;
padding-left: 0 !important;
padding-right: 0 !important;
}
.title {
font-size: 48rpx !important;
margin-bottom: 24rpx !important;
}
.infos view {
font-size: 36rpx !important;
line-height: 56rpx !important;
}
.bottom-line {
font-size: 34rpx !important;
margin-top: 24rpx !important;
}
input {
font-size: 36rpx !important;
}
}
/* #endif */
</style> </style>