创新互联百度小程序教程:page-frame 基础政务服务大厅模板

  • page-frame 基础政务服务大厅模板
    • 示例
    • 页面内容
      • 服务大厅首页
      • 服务列表页
    • npm 依赖
    • Bug & Tip

    page-frame 基础政务服务大厅模板

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

    成都创新互联公司为客户提供专业的成都网站建设、网站制作、程序、域名、空间一条龙服务,提供基于WEB的系统开发. 服务项目涵盖了网页设计、网站程序开发、WEB系统开发、微信二次开发、手机网站制作设计等网站方面业务。

    解释:本模板适用于各政府部门或区县政务服务线上办事大厅快速搭建工作,如社保、公安、税务、教育等部门,模板包含服务类目列表页、二级服务列表页,开发者可根据实际业务分类方式进行二次开发,以实现服务列表清晰、直观、结构化的展现形式。

    示例

    扫码体验

    代码示例

    请使用百度APP扫码

    页面内容

    模板包含两个页面:服务大厅首页、服务列表页。

    服务大厅首页

    页面包含首页头部板块、小程序名称及描述区域、服务提供方描述区域可对开发者主体进行介绍。模板提供红、蓝两种配色供选择。

    页面路径:pages/index

    代码示例

    • SWAN
    • JSON
     
     
     
    1. s-if="{{!loading && !statusType && showBar}}"
    2. animation
    3. show-fixed-bar
    4. fixed-title="{{frameList.name}}"
    5. fixed-front-color="#000000"
    6. common-front-color="#ffffff"
    7. common-bg-color="{{theme}}"
    8. common-bg-opacity="{{true}}"
    9. switch-start-position="10"
    10. switch-end-position="60"
    11. >
    12. s-if="{{!loading && statusType}}"
    13. class="frame-status"
    14. icon="{{statusConfig[statusType].icon}}"
    15. title="{{statusConfig[statusType].title}}"
    16. desc="{{statusConfig[statusType].desc}}"
    17. showBtn="{{statusConfig[statusType].showBtn}}"
    18. bindsmtreloading="requestList"
    19. >
    20. s-else
    21. text="{{frameList.hoster}}"
    22. gov-layout-container="frame-content"
    23. >
    24. {{frameList.name}}
    25. {{frameList.slogan}}
    26. label="{{val.category}}"
    27. gov-label="gov-label"
    28. label-width="6em"
    29. border
    30. >
    31. s-for="item, s in val.subCategory"
    32. content="{{item.name}}"
    33. border="{{s !== val.subCategory.length - 1}}"
    34. contentDesc="{{item.desc}}"
    35. gov-content="gov-content"
    36. label-width="0"
    37. data-service="{{i}}"
    38. data-list="{{s}}"
    39. bindtap="goService"
    40. arrow
    41. clickable
    42. >
    43. slot="left"
    44. >
     
     
     
    1. {
    2. "navigationStyle": "custom",
    3. "navigationBarTextStyle": "white",
    4. "usingComponents": {
    5. "gov-custom-title-bar": "@smt-ui/component-gov/src/custom-title-bar",
    6. "gov-list-item": "@smt-ui/component-gov/src/list-item",
    7. "gov-layout": "@smt-ui/component-gov/src/layout",
    8. "smt-page-status": "@smt-ui/component/src/page-status"
    9. }
    10. }
    • 页面初始化,可设置服务项、主题色,页面状态

    • JS

     
     
     
    1. onLoad(options) {
    2. // frameList为mock的数据
    3. const {code, theme} = frameList;
    4. this.setData({
    5. // 服务项
    6. frameList: frameList,
    7. // 根据主题修改配色
    8. theme: theme === 'blue' ? COLOR_BLUE : COLOR_RED,
    9. // code 0: 正常获取数据 99999: 无网络 其他: 服务异常
    10. statusType: code === 99999 ? 'noNetwork' : code !== 0 ? 'warning' : ''
    11. });
    12. }
    • 跳转服务列表页,开发者可以按需传递参数到列表页

    • JS

     
     
     
    1. goService({currentTarget}) {
    2. const {service, list} = currentTarget.dataset;
    3. // 跳转服务列表页,跳转的list和theme参数只是mock数据举例,具体是否需要带参数跳转、参数名称、参数值可自定义。
    4. swan.navigateTo({
    5. url: 'pages/@smt-ui-template-page-frame/pages/services/index?list=${JSON.stringify(this.data.frameList.service[service].subCategory[list])}&theme=${this.data.frameList.theme}'
    6. });
    7. }
    • 根据主题修改配色

    • JS

     
     
     
    1. import {COLOR_BLUE, COLOR_RED} from '../../common/style/color.js';
    2. ...
    3. this.setData({
    4. // 根据主题修改配色
    5. theme: theme === 'blue' ? COLOR_BLUE : COLOR_RED,
    6. });

    服务列表页

    页面包含服务类目列表,可以将服务项进行清晰直观的分类展示。

    页面路径:pages/services

    代码示例

    • SWAN
    • JSON
     
     
     
    1. animation
    2. show-fixed-bar
    3. fixed-title="{{services.name}}"
    4. common-front-color="#000000"
    5. fixed-bg-color='#ffffff'
    6. common-bg-opacity="{{true}}"
    7. need-to-return="{{true}}"
    8. gov-fixed-nav-bar="{{isOpacity || statusType ? 'gov-fixed' : ''}}"
    9. switch-start-position="10"
    10. switch-end-position="60"
    11. >
    12. s-if="{{!loading && statusType}}"
    13. class="frame-status"
    14. icon="{{statusConfig[statusType].icon}}"
    15. title="{{statusConfig[statusType].title}}"
    16. desc="{{statusConfig[statusType].desc}}"
    17. showBtn="{{statusConfig[statusType].showBtn}}"
    18. bindsmtreloading="requestList"
    19. >
    20. s-else
    21. text="{{services.hoster}}"
    22. gov-layout-container="frame-content"
    23. gov-layout-text="frame-footer"
    24. >
    25. class="service-bg-img"
    26. src="{{headBg}}"
    27. >
    28. {{services.name}}
    29. {{desc}}
    30. {{val.name}}
    31. s-for="v in val.list"
    32. label="{{v.name}}"
    33. bindtap="clickService"
    34. gov-label="label-text"
    35. label-width="6em"
    36. arrow
    37. border
    38. clickable
    39. />
     
     
     
    1. {
    2. "navigationBarTextStyle": "black",
    3. "navigationStyle": "custom",
    4. "usingComponents": {
    5. "gov-custom-title-bar": "@smt-ui/component-gov/src/custom-title-bar",
    6. "gov-list-item": "@smt-ui/component-gov/src/list-item",
    7. "gov-layout": "@smt-ui/component-gov/src/layout",
    8. "smt-page-status": "@smt-ui/component/src/page-status"
    9. }
    10. }
    • 页面初始化,可设置服务列表项、主题色、欢迎语

    • JS

     
     
     
    1. onLoad({list, theme, type}) {
    2. this.setData({
    3. // 设置服务列表项
    4. services: JSON.parse(list),
    5. // 根据当前主题切换头部背景
    6. headBg: '../../images/bg${theme}.png',
    7. desc: this.getGreet() + ',欢迎使用该服务!',
    8. theme: {
    9. // 根据当前主题切换配色
    10. color: theme === 'blue' ? COLOR_BLUE_1 : COLOR_RED_1
    11. },
    12. statusType: type
    13. });
    14. }
    • 点击服务项事件,可自定义落地页

    • JS

     
     
     
    1. clickService() {
    2. // url路径可根据实际落地页路径替换
    3. swan.navigateTo({
    4. url: './nextPage'
    5. });
    6. }

    npm 依赖

    名称版本号
    @smt-ui/component-gov1.1.19-alpha.0
    @smt-ui/componentlatest

    Bug & Tip

    • Tip:该模板使用了 ES6 语法,需要开启开发者工具的增强编译,操作步骤参看开启说明;同时也需开启上传代码时样式自动补全。
    • Tip:以上代码示例为纯客户端代码,可直接在模拟器和真机预览。
    • Tip:模板中使用的是测试数据,你需要从接口中获取真实的数据。

    网站名称:创新互联百度小程序教程:page-frame 基础政务服务大厅模板
    本文网址:http://www.hantingmc.com/qtweb/news37/13737.html

    网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

    广告

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