创新互联
  • 成都网站推广
  • 搜索引擎优化
  • 搜索引擎推广
  • 网络营销推广
  • 珉田数据中心
  • 高端网站设计
  • 成都企业变更注销

创新互联百度小程序教程: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政策文件库模板
      文章链接:http://www.kswsj.com/qtweb/news25/327925.html

      网站建设、网络推广公司-成都快上网,一家网站设计、网站制作公司;服务项目有等

      广告

      声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 成都快上网

    成都快上网科技猜您喜欢

    • phpcms无法载入样式表的解决办法
    • 专家推荐 TortoiseSVN中文使用手册新手必备
    • 做IPTV的公司是哪家?(桂哥网络香港大带宽服务器)
    • 共轭梯度法求解线性方程组,量化共轭梯度法(利用共轭梯度法求解线性方程组)
    • 主机屋免费空间是什么,主机屋免费空间的好处是什么?
    • 双线主机购买流程是什么
    • windows7禁止u盘运行?(windows7禁用u盘)
    • 日志利用Redis优化AOF日志记录技术(redis设置aof)
    • 下载Linux系统:wget命令的使用(wgetlinux)

    做网站知识

    • 创新互联Python教程:Python的基本数据类型有哪些
    • VMware推出首款开放PaaS平台CloudFoundry
    • 改善系统性能取消Redis开机自启动(取消开机启动redis)
    • 解决Linux线程栈溢出问题(linux线程栈溢出)
    • 幼儿园健康日志怎么填?(用户登陆日志,网站登录日志2022年更新(用户登陆日志,网站登录日志2022年更新))
    • 管理Linux分支管理:掌握自由式开发流程(linux的分支)
    • 移动云服务器?(移动云服务器价格)
    • 小红伞的用处有多少?小红伞windows2008
    • Linux进程管道通信:高效实现进程间数据交换(linux进程管道通信)
    • 服务器配置参数怎么看?(服务器如何选看哪些参数配置)
    • 香港好的服务器出租
    • 万网属于什么资源?(万网虚拟云服务器)
    • word怎么缩小?(word怎么缩小行间距)
    • 扫脸付、VR付实现了,“KongFu”空付还远吗?
    • 五里店机房服务器运行状况分析与优化方案

    分类信息网站

    • 酒店设计
    • 被动防护网
    • 阳光房
    • 搅拌罐车
    • 围栏护栏
    • 火锅店设计
    • 水处理设备
    • 集装箱
    • 混凝土搅拌机
    • 石笼网
    • 玻璃钢雕塑
    • 边坡防护网
    • 小搅拌车
    • 木托盘
    • 广告制作
    • 玻璃隔断
    成都小程序    广汉做网站    门户网站建设方案    成都网站建设    广安网站建设    成都LED照明    乐山装修公司    成都网站设计    微信公众号开发    H5建站    电商网站建设方案    新津网站运维    自贡主机托管    成都网站建设    企业网站建设    绵阳服务器托管    网页设计制作    买链接    乐山服务器托管    公路钻孔机    
     品质网站建设  多平台展现  600元建站  高效快速  专业用心服务

    028-86922220 13518219792

    028-86922220 13518219792

    网站建设QQ:532337155 营销推广QQ:631063699 网站制作QQ:532337155 营销推广QQ:631063699 售后QQ:1683211881
    成都快上网专注: 成都网站制作 网站设计 成都网站建设
    地址:成都太升南路288号锦天国际A幢10楼
    创新互联

    成都创新互联科技有限公司
    Tel:028-86922220(7x24h)