创新互联百度小程序教程:page-policy政策文件库模板
大悟县网站建设
  • 首页
  • 关于我们
  • 服务项目
    高端网站定制
    微信定制
    APP开发服务
    网络营销服务
    电商网站建设
    生物医药网站建设
    外贸网站建设
    教育培训网站建设
  • 小程序开发
  • 案例展示
    网站建设
    小程序
    电商平台
    APP
    系统平台
  • 建站知识
  • 联系我们
咨询热线 :
028-86922220
×
01
关于我们

公司简介

发展历程

02
服务项目

高端网站建设

微信开发

APP开发

网络营销服务

电商网站定制

生物医药网站建设

外贸网站建设

教育培训网站建设

03
小程序开发

小程序开发

功能应用

客户案例

04
案例展示

网站建设案例

小程序案例

电商平台案例

APP案例

系统平台案例

05
建站动态

网站建设

网站设计

网站营销

小程序

06
联系我们

公司地址

人才招聘

地址:成都市太升南路288号锦天国际A幢1002号

电话:028-86922220

028-86922220

疆括仕网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

创新互联百度小程序教程:page-policy政策文件库模板

  • page-policy 政策文件库模板
    • 示例
    • 页面内容
      • 政策文件列表页
      • 政策文件详情页
      • 我的收藏页面
      • 我的订阅页面
      • 搜索页
    • 自定义 UI 组件
    • npm 依赖
    • Bug & Tip

    page-policy 政策文件库模板

    从开发者工具 v2.25.1-rc 版本开始支持。

    解释:本模板适用于信息公开类小程序的快速搭建,可应用于办税指南、法律宝典、街道信息公告通知等场景,可将信息结构化的呈现给用户,方便用户快速阅读获取有效的信息。

    示例

    扫码体验

    代码示例

    请使用百度APP扫码

    页面内容

    模板包含政策文件列表页、政策文件详情页、收藏列表页以及订阅列表页、搜索结果页。

    政策文件列表页

    政策文件列表页包含搜索以及筛选组件,用户可以快速获取所需要的信息,同时页面包含跑马灯组件、tab 切换组件可实现信息轮播提示、板块切换等交互效果,丰富页面功能,提升使用体验。

    页面路径:pages/indexFilter/index、pages/indexTab/index

    列表页提供了筛选器和 tab 两种效果样式。其中,pages/indexFilter/index 是带筛选器的模板页,pages/indexTab/index 是带 tab 切换的模板页。如果想查看不同的模板类型,可以修改小程序根目录下的 app.json 文件,将对应类型的模板页面路径放到第一个。

    代码示例

    • 以下是使用筛选器的首页模板代码:

    • SWAN

    • JSON
    • JS
     
     
     
    1. class='policy-home-filter'
    2. common-bg-opacity="{{true}}"
    3. common-front-color="#ffffff"
    4. fixed-title="政策文件库"
    5. need-to-return="{{false}}"
    6. fixed-text-align="center"
    7. common-text-align="left"
    8. fixed-bg-color="#ffffff"
    9. common-bg-color="#2772fb"
    10. fixed-front-color="#000000"
    11. fixed-has-border="{{true}}"
    12. common-has-border="{{false}}"
    13. show-fixed-bar="{{true}}"
    14. namespace="policy-home-filter"
    15. >
    16. 政策文件库
    17. 文件全文 权威解读
    18. 我的订阅
    19. 我的收藏
    20. s-for="item, findex in filter"
    21. title="{{item.title}}"
    22. class="filter"
    23. mask-with-animation="{{false}}"
    24. bind:openFilter="openFilter"
    25. max-title-width="123.79"
    26. is-immersive
    27. >
    28. s-for="sub,index in item.children"
    29. bind:change="changeFilter"
    30. value="{{findex + ':' + sub.id}}"
    31. text="{{sub.name}}" />
    32. 正在加载...
    33. s-for="item, index in page"
    34. title="{{item.title}}"
    35. desc="{{'发文机关:' + item.office}}"
    36. clickable="{{true}}"
    37. data-aid="item.id"
    38. bind:tap="gotoArticle"
    39. />
    40. 单行footer
     
     
     
    1. {
    2. "navigationBarTitleText": "政策文件库",
    3. "navigationStyle": "custom",
    4. "backgroundColor": "#ffffff",
    5. "backgroundColorTop": "#2772fb",
    6. "navigationBarBackgroundColor": "#ffffff",
    7. "navigationBarTextStyle": "white",
    8. "onReachBottomDistance": 34,
    9. "usingComponents": {
    10. "zw-custom-title-bar": "../../components/CustomTitleBar/src/index",
    11. "zw-notice-bar": "../../components/NoticeBar/src/index",
    12. "zw-footer": "../../components/Footer/src/index",
    13. "zw-icon": "../../components/Icon/src/index",
    14. "zw-loading": "../../components/LoadingStatus/src/index",
    15. "zw-state-page": "../../components/StatePage/src/index",
    16. "zw-list-item": "../../components/ListItem/src/index",
    17. "zw-spin": "../../components/Spin/src/index",
    18. "zw-filter": "../../components/Filter/src/index",
    19. "zw-filter-item": "../../components/FilterItem/src/index"
    20. }
    21. }
     
     
     
    1. // 获取列表数据,以下为使用 mock 数据的请求示例
    2. getHomeList(query, ({code, msg, data}) => {
    3. if (code === 0) {
    4. // 设置筛选器数据
    5. !filter.length && (res.filter = data.filter);
    6. // 更新通知栏内容
    7. !notice && !this.data.hideNotice && data.notice && (res.notice = data.notice);
    8. // ...
    9. }
    10. else {
    11. // 请求异常处理
    12. }
    13. }),
    14. // 跳转到文章详情页。跳转携带的 id 参数只是 mock 数据举例,是否需要带参数跳转以及参数名称、参数值均可自定义
    15. gotoArticle(e) {
    16. const index = e.currentTarget.dataset.aid;
    17. navigateTo({
    18. url: `../article/article?id=${index}`
    19. });
    20. }

    政策文件详情页

    分为标题以及文字信息区域,可将图文等内容结构化呈现,方便用户阅读。

    页面路径:pages/article/article

    代码示例

    • SWAN
    • JSON
    • JS
     
     
     
    1. 正在加载...
    2. {{detail.title}}
    3. {{detail.info[0].name}}
    4. {{detail.info[0].value}}
    5. s-if="{{expand.length > 0}}"
    6. name="arrow-{{!expandStatus ? 'down' : 'up'}}"
    7. color="#ccc"
    8. size="{{actionFontSize}}">
    9. class="expand-area" s-if="{{expand.length > 0}}"
    10. style="height: {{expandStatus ? expandHeight : 0}}px;"
    11. >
    12. {{item.name}}
    13. {{item.value}}
    14. title="{{detail.hoster}}"
    15. desc="{{detail.desc}}"
    16. clickable="{{false}}"
    17. zw-list-item-wrap-class="custom-list"
    18. no-border
    19. >
    20. button-size="xs-small"
    21. button-color="{{detail.status ? 'secondly' : 'thirdly'}}"
    22. button-text="{{detail.status ? '已订阅' : '订阅'}}"
    23. bindtap="changeSub"
    24. />
    25. {{detail.collected ? '已收藏' : '收藏'}}
    26. 分享
     
     
     
    1. {
    2. "navigationBarBackgroundColor": "#ffffff",
    3. "navigationBarTextStyle": "black",
    4. "navigationBarTitleText": "政策文件库",
    5. "backgroundColor": "#ffffff",
    6. "backgroundTextStyle": "light",
    7. "usingComponents": {
    8. "zw-loading": "../../components/LoadingStatus/src/index",
    9. "zw-state-page": "../../components/StatePage/src/index",
    10. "zw-button": "../../components/Button/src/index",
    11. "zw-icon": "../../components/Icon/src/index",
    12. "zw-list-item": "../../components/ListItem/src/index"
    13. }
    14. }
     
     
     
    1. // 请求接口,获取文件详情
    2. getArticle(({code, msg, data}) => {
    3. // 请求正常响应
    4. if (code === 0) {
    5. // ...
    6. }
    7. // 请求异常
    8. else {
    9. // ...
    10. }
    11. }),
    12. // 切换订阅状态
    13. changeSub(e) {
    14. // 获取当前订阅状态
    15. const status = this.data.detail.status;
    16. // 请求接口,切换订阅状态
    17. changeStatus(status, ({code, data}) => {
    18. // 请求正常响应
    19. if (code === 0) {
    20. // 更新订阅状态
    21. }
    22. });
    23. },
    24. // 切换收藏状态
    25. addCollection(e) {
    26. // 获取当前收藏状态
    27. const status = this.data.detail.collected;
    28. // 请求接口,切换收藏状态
    29. changeStatus(status, ({code, data}) => {
    30. // 请求正常响应
    31. if (code === 0) {
    32. // 更新收藏状态
    33. }
    34. });
    35. },
    36. // 分享的标题、内容、路径、图片地址,分享成功、分享失败的回调都可以根据实际业务场景和需求自定义。
    37. toShare() {
    38. swan.openShare({
    39. title: '政策文件库分享示例',
    40. content: '中共中央办公厅印发《2019-2023年全国党员教育培训工作规划》',
    41. path: '/templates/gov/policy/pages/article/article?key=' + this.data.articleId,
    42. imageUrl: 'https://ms-static.cdn.bcebos.com/miniappdocs/img/logo_new.png',
    43. success: res => {
    44. swan.showToast({
    45. title: '分享成功'
    46. });
    47. console.log('openShare success', res);
    48. },
    49. fail: err => {
    50. console.log('openShare fail', err);
    51. }
    52. });
    53. }

    我的收藏页面

    用户收藏过的内容将通过一定的顺序呈现在收藏列表页,对于重点关注的内容,用户无需反复检索,在收藏列表页可直接阅读。

    页面路径:pages/collect/collect

    代码示例

    • SWAN
    • JSON
    • JS
     
     
     
    1. tabs="{{tabs}}"
    2. type="flex"
    3. mode="auto"
    4. active-tab="{{0}}"
    5. nav-bar-width="100%"
    6. show-with-animation="{{false}}"
    7. bindonChange="onCustomTabChange"
    8. />
    9. 正在加载...
    10. class="smt-feed click-zc-refresh"
    11. data-type="zc"
    12. bind:scrolltolower="autoScrollToLower"
    13. >
    14. s-for="item, index in page"
    15. title="{{item.title}}"
    16. desc="{{'发文机关:' + item.office}}"
    17. clickable="{{true}}"
    18. data-aid="item.id"
    19. bind:tap="gotoArticle"
    20. />
    21. 正在加载...
    22. class="smt-feed click-jd-refresh"
    23. data-type="jd"
    24. bind:scrolltolower="autoScrollToLower"
    25. >
    26. s-for="item, index in page"
    27. title="{{item.title}}"
    28. desc="{{'发文机关:' + item.office}}"
    29. clickable="{{true}}"
    30. data-aid="{{item.id}}"
    31. bind:tap="gotoArticle"
    32. />
     
     
     
    1. {
    2. "navigationBarBackgroundColor": "#fffffe",
    3. "navigationBarTextStyle": "black",
    4. "navigationBarTitleText": "我的收藏",
    5. "backgroundColor": "#ffffff",
    6. "backgroundTextStyle": "light",
    7. "usingComponents": {
    8. "zw-loading": "../../components/LoadingStatus/src/index",
    9. "zw-state-page": "../../components/StatePage/src/index",
    10. "zw-list-item": "../../components/ListItem/src/index",
    11. "smt-feed": "@smt-ui/component/src/feed",
    12. "zw-spin": "../../components/Spin/src/index",
    13. "zw-tabs": "../../components/Tabs/src/index"
    14. }
    15. }
     
     
     
    1. // 请求接口,获取收藏数据
    2. getCollectList(name, ({code, msg, data}) => {
    3. if (code === 0) {
    4. // 请求正常响应处理
    5. }
    6. else {
    7. // 请求异常处理
    8. }
    9. }),
    10. // 跳转到文章详情页。跳转携带的 id 参数只是 mock 数据举例,是否需要带参数跳转以及参数名称、参数值均可自定义
    11. gotoArticle(e) {
    12. const index = e.currentTarget.dataset.aid;
    13. navigateTo({
    14. url: `../article/article?id=${index}`
    15. });
    16. }

    我的订阅页面

    开发者可结合自身业务,向用户提供订阅功能。对于订阅后的内容或板块,用户无需反复检索,在订阅列表页可直接获取最新资讯。

    页面路径:pages/subscribe/subscribe

    代码示例

    • SWAN
    • JSON
    • JS
     
     
     
    1. 正在加载...
    2. s-if="errStatus !== ''"
    3. show-reload="{{stateBtn}}"
    4. type="{{errStatus}}"
    5. bind:reload="reload"
    6. />
    7. s-for="item, index in subList"
    8. title="{{item.title}}"
    9. desc="{{item.desc}}"
    10. clickable="{{false}}"
    11. data-index={{index}}
    12. bind:tap="gotoArticle"
    13. >
    14. button-size="xs-small"
    15. button-color="{{item.status ? 'secondly' : 'thirdly'}}"
    16. button-text="{{item.status ? '已订阅' : '订阅'}}"
    17. data-index="{{index}}"
    18. catchtap="changeSub"
    19. />
     
     
     
    1. {
    2. "navigationBarBackgroundColor": "#ffffff",
    3. "navigationBarTextStyle": "black",
    4. "navigationBarTitleText": "我的订阅",
    5. "backgroundColor": "#ffffff",
    6. "backgroundTextStyle": "light",
    7. "usingComponents": {
    8. "zw-list-item": "../../components/ListItem/src/index",
    9. "zw-loading": "../../components/LoadingStatus/src/index",
    10. "zw-state-page": "../../components/StatePage/src/index",
    11. "zw-button": "../../components/Button/src/index"
    12. }
    13. }
     
     
     
    1. // 请求接口,获取关注列表数据
    2. getList(({code, msg, data}) => {
    3. if (code === 0) {
    4. // 请求正常响应处理
    5. }
    6. else {
    7. // 请求异常处理
    8. }
    9. }),
    10. // 切换订阅状态
    11. changeSub(e) {
    12. // 获取当前订阅状态
    13. const status = this.data.subList[index].status;
    14. changeStatus(status, ({code, data}) => {
    15. // 请求正常响应
    16. if (code === 0) {
    17. // 更新订阅状态
    18. }
    19. });
    20. },
    21. // 跳转到文章详情页。跳转携带的 id 参数只是 mock 数据举例,是否需要带参数跳转以及参数名称、参数值均可自定义
    22. gotoArticle(e) {
    23. const index = e.currentTarget.dataset.aid;
    24. navigateTo({
    25. url: `../articleList/articleList?id=${index}`
    26. });
    27. }

    搜索页

    用户触发搜索功能后将跳转至搜索页,页面包含搜索历史以及搜索结果两部分。搜索结果高亮显示,方便用户辩识获取有效信息;搜索历史结构化呈现,方便用户再次进行检索。对于搜索历史,也可使用“清空”进行删除。

    页面路径:pages/search/search

    代码示例

    • SWAN
    • JSON
    • JS
     
     
     
    1. show-fixed-bar='{{false}}'
    2. fixed-title="搜索"
    3. fixed-front-color="#000000"
    4. common-front-color="#000000"
    5. common-bg-color='#ffffff'
    6. fixed-bg-color='#ffffff'
    7. common-bg-opacity="{{false}}"
    8. need-to-return="{{true}}"
    9. common-title="搜索"
    10. bind:navhome="navhome"
    11. />
    12. class='search-bar-component'
    13. value="{{value}}"
    14. focus="{{focusing}}"
    15. placeholder="{{placeholder}}"
    16. confirm-type="{{confirmType}}"
    17. sear
      标题名称:创新互联百度小程序教程:page-policy政策文件库模板
      分享路径:https://tyhkzb.com/article/dhhiocp.html

    其他资讯

    • ABAP的权限检查跟踪工具怎么使用
    • Golang中的结构体标签StructTag详解
    • vnc登录服务器输入指令没反应
    • 云服务器如何修改root密码
    • 大连空间域名:互联网品牌新选择
    分享至:
       
    关于我们
    公司简介 发展历程
    服务项目
    高端网站建设 小程序开发 APP开发 网络营销
    建站知识
    行业新闻 建站学堂 常见问题
    联系我们
    公司地址 人才招聘
    成都 大悟县
    
    电话:028-86922220
    
    地址:成都市太升南路288号锦天国际A幢1002号
    
    电话:028-86922220
    
    地址:湖省孝感市大悟县城关镇鄂北物流城13栋125号
    版权所有:大悟县疆括仕商贸有限公司 鄂ICP备2025139637号-7
    
    在线咨询
    
    服务热线
    服务热线:028-86922220
    
    TOP