日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)百度小程序教程:page-query-form查詢類服務(wù)模板
  • page-query-form 查詢類服務(wù)模板
    • 示例
    • 頁面內(nèi)容
      • 查詢參數(shù)填寫頁
      • 查詢結(jié)果頁
    • npm 依賴
    • Bug & Tip

    page-query-form 查詢類服務(wù)模板

    從開發(fā)者工具 v2.25.1-rc 版本開始支持。

    解釋:本模板適用于成績查詢、證書查詢等查詢類服務(wù)項開發(fā)工作,模板內(nèi)包含的組件豐富,覆蓋大多數(shù)查詢類服務(wù)項場景,開發(fā)者僅需通過調(diào)整組件屬性以及排序即可快速完成前端開發(fā)工作。

    示例

    掃碼體驗

    代碼示例

    請使用百度APP掃碼

    頁面內(nèi)容

    模板包含兩個頁面:查詢參數(shù)填寫頁、查詢結(jié)果頁。

    查詢參數(shù)填寫頁

    包括信息輸入操作常用組件,例如輸入框、日期選擇器、位置選擇器等,同時結(jié)合政務(wù)查詢類服務(wù)特性,模板內(nèi)包含了彈窗組件,當(dāng)用戶進(jìn)入服務(wù)頁面時,可通過彈窗對用戶進(jìn)行強提醒,加強信息的觸達(dá)效果,保障用戶辦理查詢類服務(wù)時的使用體驗。

    頁面路徑:pages/index/index

    代碼示例

    • SWAN
    • JSON
     
     
     
    1. s-if="{{showNoticeBar}}"
    2. text="{{noticeContent}}">
    3. data-id="iptOne"
    4. ipt-item-type="short"
    5. type="text"
    6. ipt-title="輸入框"
    7. placeholder-content="請輸入內(nèi)容"
    8. ipt-value="{{model.iptOne.iptValue}}"
    9. bindkeyinput="bindInput"
    10. bindiptblur="bindBlur"
    11. bindiptclean="cleanRoad"
    12. ipt-error-info="{{model.iptOne.iptErrorInfo}}">
    13. placeholder="請選擇選項"
    14. label-width="4em"
    15. range-key="type"
    16. errColor="#C40311"
    17. value="{{model.pickerOne.iptValue}}"
    18. bindchange="pickerOne"
    19. label="選擇框"
    20. range="{{optionsOne}}">
    21. data-id="password"
    22. ipt-item-type="short"
    23. type="text"
    24. ipt-title="密碼框"
    25. placeholder-content="請輸入密碼"
    26. ipt-value="{{model.password.iptValue}}"
    27. password="true"
    28. bindkeyinput="bindInput"
    29. bindiptblur="bindBlur"
    30. bindiptclean="cleanRoad"
    31. ipt-error-info="{{model.password.iptErrorInfo}}">
    32. data-id="idCard"
    33. ipt-item-type="short"
    34. type="idcard"
    35. ipt-title="身份證號"
    36. placeholder-content="請輸入身份證號"
    37. ipt-value="{{model.idCard.iptValue}}"
    38. maxlength="18"
    39. bindkeyinput="bindInput"
    40. bindiptblur="bindBlur"
    41. bindiptclean="cleanRoad"
    42. ipt-error-info="{{model.idCard.iptErrorInfo}}">
    43. data-id="phone"
    44. ipt-item-type="short"
    45. type="number"
    46. maxlength="11"
    47. ipt-title="手機(jī)號"
    48. placeholder-content="請輸入手機(jī)號"
    49. ipt-value="{{model.phone.iptValue}}"
    50. bindkeyinput="bindInput"
    51. bindiptblur="bindBlur"
    52. bindiptclean="cleanRoad"
    53. ipt-error-info="{{model.phone.iptErrorInfo}}">
    54. data-id="smsInput"
    55. type="number"
    56. label-width="4em"
    57. max-length="{{6}}"
    58. bindkeyinput="bindInput"
    59. bindiptblur="bindBlur"
    60. bindsmssend="smssend"
    61. placeholder-content="請輸入短信驗證碼"
    62. ipt-value="{{model.smsInput.iptValue}}"
    63. ipt-error-color="#C40311"
    64. ipt-error-flag="{{model.smsInput.iptErrorInfo.errFlag}}">
    65. data-id="govCaptcha"
    66. type="number"
    67. ipt-area-width="4em"
    68. max-length="{{4}}"
    69. verify-img-url="{{model.govCaptcha.codeImg}}"
    70. bindkeyinput="bindInput"
    71. bindiptblur="bindBlur"
    72. bindrefreshimg="reloadImg"
    73. ipt-value="{{model.govCaptcha.iptValue}}"
    74. ipt-error-info="{{model.govCaptcha.iptErrorInfo.errFlag}}">
    75. data-id="pickerDate"
    76. placeholder="請選擇日期"
    77. label-width="4em"
    78. mode="date"
    79. start="2020-01-01"
    80. end="2025-12-31"
    81. value="{{model.pickerDate.iptValue}}"
    82. bindchange="pickerDate"
    83. label="日期">
    84. placeholder="請選擇所在地區(qū)"
    85. mode="region"
    86. label-width="4em"
    87. value="{{model.pickerRegion.iptValue}}"
    88. bindchange="pickerRegion"
    89. label="所在地區(qū)">
    90. button-size="large"
    91. button-text="查詢"
    92. button-disabled="{{buttonDisabled}}"
    93. data-isValidata="true"
    94. button-color="#2772FB"
    95. bindtap="buttonImportant">
    96. button-size="large"
    97. button-text="輔助按鈕"
    98. button-color="plain"
    99. bindtap="buttonTap">
    100. 溫馨提示:
    101. 此板塊為提示區(qū),可用于提醒用戶業(yè)務(wù)填寫中的注意事項及要求
    102. 點擊查看
     
     
     
    1. {
    2. "navigationBarTitleText": "標(biāo)題文字",
    3. "navigationBarBackgroundColor": "#ffffff",
    4. "navigationBarTextStyle": "dark",
    5. "usingComponents": {
    6. "gov-picker": "@smt-ui/component-gov/src/picker",
    7. "gov-notice-bar": "@smt-ui/component-gov/src/notice-bar",
    8. "gov-sms-input": "@smt-ui/component-gov/src/sms-input",
    9. "gov-prompt": "@smt-ui/component-gov/src/prompt",
    10. "gov-captcha": "@smt-ui/component-gov/src/captcha",
    11. "gov-button": "@smt-ui/component-gov/src/button",
    12. "gov-input": "@smt-ui/component-gov/src/input"
    13. }
    14. }
    • 頁面初始化??蛇M(jìn)行辦理前提示和初始化數(shù)據(jù)等操作

    • JS

     
     
     
    1. onLoad() {
    2. // 初始化圖形驗證碼
    3. this.reloadImg();
    4. // 辦理前提示
    5. swan.showModal({
    6. title: '提示',
    7. content: '此彈窗可在業(yè)務(wù)辦理前對用戶進(jìn)行預(yù)先提醒',
    8. showCancel: false,
    9. confirmText: '我知道了'
    10. });
    11. }
    • 輸入框事件。包含普通輸入框、密碼輸入框、身份證輸入框、手機(jī)號輸入框、短信驗證碼輸入框、圖形驗證碼輸入框。

    • JS

     
     
     
    1. /**
    2. * 輸入框的 input 事件
    3. *
    4. * @param {Event} e 事件對象
    5. */
    6. bindInput(e) {
    7. // 將 input 輸入的值賦給 model 中對應(yīng)屬性的 iptValue 字段, 用于后續(xù)校驗和提交表單使用
    8. this.setData({
    9. ['model.' + e.currentTarget.dataset.id + '.iptValue']: e.detail.iptvalue
    10. });
    11. // 每次輸入完成時判斷查詢按鈕是否高亮顯示
    12. this.buttonImportant({});
    13. }
    14. /**
    15. * 輸入框的 blur 事件,失焦時通過 validata 方法對當(dāng)前輸入框的值進(jìn)行校驗
    16. *
    17. * @param {Event} e 事件對象
    18. */
    19. bindBlur(e) {
    20. let iptvalue = e.detail.iptvalue;
    21. let iptid = e.currentTarget.dataset.id;
    22. let rulse = this.data.model[iptid].rulse;
    23. this.validata(rulse, iptvalue, iptid);
    24. }
    25. /**
    26. * 點擊輸入框右側(cè)清除按鈕事件,短信驗證碼輸入框、圖形驗證碼輸入框沒有該事件
    27. *
    28. * @param {Event} e 事件對象
    29. */
    30. cleanRoad(e) {
    31. // 清空當(dāng)前表單內(nèi)數(shù)據(jù)
    32. this.setData({['model.' + e.currentTarget.dataset.id + '.iptValue']: ''});
    33. }
    • 選擇器的 change 事件處理。包含普通選擇器、日期選擇器、地區(qū)選擇器

    • JS

     
     
     
    1. /**
    2. * 普通選擇器的 change 事件
    3. *
    4. * @param {Object} detail 事件對象信息
    5. */
    6. pickerOne({detail}) {
    7. // 將 picker 選中值賦給 model 中對應(yīng)的屬性
    8. this.setData('model.pickerOne.iptValue', detail.detail.value);
    9. // 選擇完成時判斷查詢按鈕是否高亮顯示
    10. this.buttonImportant({});
    11. }
    12. /**
    13. * 時間選擇器的 change 事件
    14. *
    15. * @param {Object} detail 事件對象信息
    16. */
    17. pickerDate({detail}) {
    18. // 將 picker 選中值賦給 model 中對應(yīng)的屬性
    19. this.setData('model.pickerDate.iptValue', detail.detail.value);
    20. // 選擇完成時判斷查詢按鈕是否高亮顯示
    21. this.buttonImportant({});
    22. }
    23. /**
    24. * 地區(qū)選擇器的 change 事件
    25. *
    26. * @param {Object} detail 事件對象信息
    27. */
    28. pickerRegion({detail}) {
    29. // 將 picker 選中值賦給 model 中對應(yīng)的屬性
    30. this.setData('model.pickerRegion.iptValue', detail.detail.value);
    31. // 選擇完成時判斷查詢按鈕是否高亮顯示
    32. this.buttonImportant({});
    33. }
    • 點擊圖形驗證碼事件

    • JS

     
     
     
    1. /**
    2. * 圖形驗證碼的點擊事件,可以增加刷新圖片驗證碼或者其他需要的操作
    3. */
    4. reloadImg() {
    5. swan.request({
    6. // 僅為示例,并非真實的接口地址
    7. url: 'http://www.baidu.com',
    8. success: res => {
    9. this.setData({
    10. // codeImg 字段根據(jù)業(yè)務(wù)自行調(diào)整
    11. 'model.govCaptcha.codeImg': res.data.codeImg
    12. })
    13. },
    14. fail: err => {
    15. // 接口異常的處理代碼
    16. }
    17. })
    18. }
    • 獲取手機(jī)驗證碼事件

    • JS

     
     
     
    1. /**
    2. * 手機(jī)號驗證碼組件點擊獲取驗證碼的事件
    3. */
    4. smssend() {
    5. // 該方法模擬收到短信驗證碼的toast效果,實際場景請使用開發(fā)者自己的短信驗證碼服務(wù)
    6. swan.showToast({
    7. title: '驗證碼:123456',
    8. icon: 'none'
    9. });
    10. }
    • 頁面下方“溫馨提示”的“點擊查看”的事件

    • JS

     
     
     
    1. /**
    2. * 頁面下方“溫馨提示”的 “點擊查看” 事件處理
    3. */
    4. toView() {
    5. // 此處僅為示例,您可以自定義該事件的邏輯,比如跳轉(zhuǎn)到某個頁面等
    6. swan.navigateTo({url: '/pages/index/index'});
    7. }
    • 查詢按鈕點擊事件

    • JS

     
     
     
    1. /**
    2. * 查詢按鈕點擊事件
    3. *
    4. * @param {Event} e 事件對象
    5. */
    6. buttonImportant(e) {
    7. // 判斷表單是否全部填寫了
    8. for (let i in this.data.model) {
    9. if (!String(this.data.model[i].iptValue).trim()) {
    10. return;
    11. }
    12. }
    13. // 如果表單的必填項都已填寫則查詢按鈕高亮
    14. this.setData({buttonDisabled: false});
    15. // 只有手動點擊查詢按鈕的時候才會執(zhí)行校驗,通過按鈕組件的 data-isValidata 屬性控制是否需要走校驗邏輯
    16. if (e.currentTarget && e.currentTarget.dataset.isValidata) {
    17. for (let i in this.data.model) {
    18. let itemData = this.data.model[i];
    19. if (itemData.iptErrorInfo) {
    20. if (this.validata(itemData.rulse, itemData.iptValue, i, true)) {
    21. return;
    22. }
    23. }
    24. }
    25. // 此處表單已校驗通過,您可以自定義一些自己的邏輯,比如跳轉(zhuǎn)到查詢結(jié)果頁模板
    26. swan.navigateTo({
    27. url: '/@smt-ui-template-gov-query-form/pages/result/result'
    28. });
    29. }
    30. }

    查詢結(jié)果頁

    頁面用于承載查詢結(jié)果,將查詢結(jié)果信息結(jié)構(gòu)化呈現(xiàn),便于用戶閱讀理解。
    頁面路徑:pages/result/result

    代碼示例

    • SWAN
    • JSON
    • JS
     
     
     
    1. s-if="{{statePageType}}"
    2. class="page-status"
    3. icon="{{statePageConfig[statePageType].icon}}"
    4. title="{{statePageConfig[statePageType].title}}"
    5. desc="{{statePageConfig[statePageType].desc}}"
    6. showBtn="{{statePageConfig[statePageType].showBtn}}"
    7. smtreloading="{{reLoad}}"
    8. loading="{{statePageType === 'loading'}}"
    9. >
    10. label-width="6em"
    11. label="{{item.name}}"
    12. gov-label="list-label"
    13. border
    14. >
    15. s-for="ele in item.value"
    16. bindtap="callPhone"
    17. data-phoneNum="{{ele}}"
    18. >{{ele}}
    19. s-else
    20. text="{{item.value}}"
    21. line="{{item.line}}"
    22. gov-text-collapse-content="list-text"
    23. >
    24. 溫馨提示:
    25. 這里是溫馨提示這里是溫馨提示這里是溫馨提示這里是溫馨提示這里是溫馨提示這里是溫馨提示
    26. 點擊查看
     
     
     
    1. {
    2. "navigationBarTitleText": "查詢結(jié)果",
    3. "navigationBarBackgroundColor": "#ffffff",
    4. "navigationBarTextStyle": "dark",
    5. "usingComponents": {
    6. "gov-page-title":"@smt-ui/component-gov/src/page-title",
    7. "gov-list-item": "@smt-ui/component-gov/src/list-item",
    8. "gov-text-collapse": "@smt-ui/component-gov/src/text-collapse",
    9. "smt-page-status": "@smt-ui/component/src/page-status",
    10. "gov-prompt": "@smt-ui/component-gov/src/prompt"
    11. }
    12. }
     
     
     
    1. Page({
    2. data: {
    3. // warning 服務(wù)開小差、noContent 未查詢到信息、noNetwork 無網(wǎng)絡(luò)、不顯示錯誤頁則為空字符串
    4. statePageType: 'loading'
    5. },
    6. onLoad() {
    7. // 使用定時器模擬請求,模擬 loading 顯示兩秒鐘
    8. setTimeout(() => {
    9. this.data.statePageType = '';
    10. }, 2000)
    11. },
    12. /**
    13. * 點擊電話調(diào)起撥號
    14. *
    15. * @param {Event} e 事件對象
    16. */
    17. callPhone(e) {
    18. swan.makePhoneCall({
    19. phoneNumber: e.currentTarget.dataset.phoneNum
    20. });
    21. },
    22. /**
    23. * 頁面下方“溫馨提示”的 “點擊查看” 事件處理
    24. */
    25. toView() {
    26. swan.showToast({
    27. title: '點擊查看',
    28. icon: 'none'
    29. });
    30. }
    31. });

    npm 依賴

    名稱 版本號
    @smt-ui/component-govlatest
    @smt-ui/componentlatest

    Bug & Tip

    • Tip:該模板使用了 ES6 語法,需要開啟開發(fā)者工具的增強編譯,操作步驟參看開啟說明;同時也需開啟上傳代碼時樣式自動補全。
    • Tip:以上代碼示例為純客戶端代碼,可直接在模擬器和真機(jī)預(yù)覽。
    • Tip:模板中使用的是測試數(shù)據(jù),你需要從接口中獲取真實的數(shù)據(jù)。

    當(dāng)前題目:創(chuàng)新互聯(lián)百度小程序教程:page-query-form查詢類服務(wù)模板
    文章鏈接:http://www.5511xx.com/article/dhoddsc.html