1. 1 不可撤销
  2. 2 小年兽 程嘉敏
  3. 3 手放开 李圣杰
  4. 4 迷人的危险3(翻自 dance flow) FAFA
  5. 5 山楂树之恋 程佳佳
  6. 6 summertime cinnamons / evening cinema
  7. 7 不谓侠(Cover 萧忆情Alex) CRITTY
  8. 8 神武醉相思(翻自 优我女团) 双笙
  9. 9 空山新雨后 音阙诗听 / 锦零
  10. 10 Wonderful U (Demo Version) AGA
  11. 11 广寒宫 丸子呦
  12. 12 陪我看日出 回音哥
  13. 13 春夏秋冬的你 王宇良
  14. 14 世界が终わるまでは… WANDS
  15. 15 多想在平庸的生活拥抱你 隔壁老樊
  16. 16 千禧 徐秉龙
  17. 17 我的一个道姑朋友 双笙
  18. 18 大鱼  (Cover 周深) 双笙
  19. 19 霜雪千年(Cover 洛天依 / 乐正绫) 双笙 / 封茗囧菌
  20. 20 云烟成雨(翻自 房东的猫) 周玥
  21. 21 情深深雨濛濛 杨胖雨
  22. 22 Five Hundred Miles Justin Timberlake / Carey Mulligan / Stark Sands
  23. 23 斑马斑马 房东的猫
  24. 24 See You Again Wiz Khalifa / Charlie Puth
  25. 25 Faded Alan Walker / Iselin Solheim
  26. 26 Natural J.Fla
  27. 27 New Soul Vox Angeli
  28. 28 ハレハレヤ(朗朗晴天)(翻自 v flower) 猫瑾
  29. 29 像鱼 王贰浪
  30. 30 Bye Bye Bye Lovestoned
  31. 31 Blame You 眠 / Lopu$
  32. 32 Believer J.Fla
  33. 33 书信 戴羽彤
  34. 34 柴 鱼 の c a l l i n g【已售】 幸子小姐拜托了
  35. 35 夜空中最亮的星(翻自 逃跑计划) 戴羽彤
  36. 36 慢慢喜欢你 LIve版(翻自 莫文蔚) 戴羽彤
  37. 37 病变(翻自 cubi) 戴羽彤
  38. 38 那女孩对我说 (完整版) Uu
  39. 39 绿色 陈雪凝
  40. 40 月牙湾 LIve版(翻自 F.I.R.) 戴羽彤
夜空中最亮的星(翻自 逃跑计划) - 戴羽彤
00:00 / 04:10

夜空中最亮的星 能否听清

那仰望的人 心底的孤独和叹息

夜空中最亮的星 能否记起

那曾与我同行 消失在风里的身影

我祈祷拥有一颗透明的心灵

和会流泪的眼睛

给我再去相信的勇气

越过谎言去拥抱你

每当我找不到存在的意义

每当我迷失在黑夜里

噢喔喔 夜空中最亮的星

请指引我靠近你

夜空中最亮的星 是否知道

那曾与我同行的身影 如今在哪里

夜空中最亮的星 是否在意

是等太阳先升起 还是意外先来临

我宁愿所有痛苦都留在心底

也不愿忘记你的眼睛

哦 给我再去相信的勇气

哦 越过谎言去拥抱你

每当我找不到存在的意义

每当我迷失在黑夜里

噢喔喔 夜空中最亮的星

请照亮我向前行 哒~

我祈祷拥有一颗透明的心灵

和会流泪的眼睛 哦

给我再去相信的勇气

哦 越过谎言去拥抱你

每当我找不到存在的意义

每当我迷失在黑夜里

噢喔喔 夜空中最亮的星

请照亮我向前行

基于weui的城市选择器(city-picker)

基于weui的城市选择器(city-picker)

前言

最近在用weui做一个移动端的项目,有个城市选择器的需求,但是weui原生并不支持,需要自定义实现,查了一些资料,需求完美实现,下面分享下实现过程。

效果

先看下最终的效果:

代码

html

话不多说,先放html页面:

    <div class="weui-form">
            <div class="weui-form__text-area">
                <h2 class="weui-form__title">城市选择器示例</h2>
            </div>
         
            <div id="apply-form" class="weui-form__control-area" style="margin: 20px 0;">
                <div style="margin-left: 15px; margin-bottom: 10px; overflow: hidden;">
                    <span style="display: block; width: 5px; height: 25px; background: #10aeff; float: left; margin-right: 10px; border-radius: 2px;"></span>
                    <span style="float: left;">城市信息</span>
                </div>
                <div class="weui-cells__title">请认真填写以下信息</div>
                <div class="weui-cells weui-cells_form"> 
                    <div class="weui-cell weui-cell_active weui-cell_access" id="showCityPicker1">
                        <div class="weui-cell__hd"><label class="weui-label">省份1级<spsn style="color: red; float: left; margin-right: 5px;">*</spsn></label></div>
                        <div class="weui-cell__bd weui-flex"><label id="city1-label"
                                                                    style="color: #ccc;">请选择省份</label>
                            <input id="city1" type="hidden" tips="请选择省份">
                        </div>
                        <div class="weui-cell__ft"></div>
                    </div>
                </div>

                <div class="weui-cells weui-cells_form"> 
                    <div class="weui-cell weui-cell_active weui-cell_access" id="showCityPicker2">
                        <div class="weui-cell__hd"><label class="weui-label">城市2级<spsn style="color: red; float: left; margin-right: 5px;">*</spsn></label></div>
                        <div class="weui-cell__bd weui-flex"><label id="city2-label"
                                                                    style="color: #ccc;">请选择城市</label>
                            <input id="city2" type="hidden" tips="请选择城市">
                        </div>
                        <div class="weui-cell__ft"></div>
                    </div>
                </div>

                <div class="weui-cells weui-cells_form"> 
                    <div class="weui-cell weui-cell_active weui-cell_access" id="showCityPicker3">
                        <div class="weui-cell__hd"><label class="weui-label">城市区县3级<spsn style="color: red; float: left; margin-right: 5px;">*</spsn></label></div>
                        <div class="weui-cell__bd weui-flex"><label id="city3-label"
                                                                    style="color: #ccc;">请选择城市区县</label>
                            <input id="city3" type="hidden" tips="请选择城市">
                        </div>
                        <div class="weui-cell__ft"></div>
                    </div>
                </div>
            </div>
            <div class="weui-form__opr-area">
                <a class="weui-btn weui-btn_primary" href="javascript:" id="make-sure">确定</a>
            </div>
        </div>

js

js代码:

$(function () {
            $('#make-sure').on('click', function () {
                var msg = "你选择的省份编码是:" + $('#showCityPicker1  #city1').val() +
                "\n你选择的城市编码是:" + $('#showCityPicker2  #city2').val() +
                "\n你选择的城市区县编码是:" + $('#showCityPicker3  #city3').val()
                alert();
            });

            $('#showCityPicker1').on('click', function () {
                weui.picker(cityData, {
                    defaultValue: [110000],
                    depth: 1,
                    onChange: function (result) {
                        console.log(result);
                    },
                    onConfirm: function (result) {
                        console.log(result);
                        $('#showCityPicker1  #city1-label').html(result[0].label);
                        $('#showCityPicker1  #city1-label').css("color", "#000");
                        $('#showCityPicker1  #city1').val(result[0].value);
                    },
                    title: '省份'
                });
            }); 
           
            $('#showCityPicker2').on('click', function () {
                weui.picker(cityData, {
                    defaultValue: [110000, 110000],
                    depth: 2,
                    onChange: function (result) {
                        console.log(result);
                    },
                    onConfirm: function (result) {
                        console.log(result);
                        $('#showCityPicker2  #city2-label').html(result[0].label + " - " + result[1].label);
                        $('#showCityPicker2  #city2-label').css("color", "#000");
                        $('#showCityPicker2  #city2').val(result[1].value);
                    },
                    title: '城市'
                });
            });  

            $('#showCityPicker3').on('click', function () {
                weui.picker(cityData, {
                    defaultValue: [110000, 110000, 110101],
                    depth: 3,
                    onChange: function (result) {
                        console.log(result);
                    },
                    onConfirm: function (result) {
                        console.log(result);
                        $('#showCityPicker3  #city3-label').html(result[0].label + " - " + result[1].label + " - " + result[2].label);
                        $('#showCityPicker3  #city3-label').css("color", "#000");
                        $('#showCityPicker3  #city3').val(result[2].value);
                    },
                    title: '城市区县'
                });
            });  
        });    

其中cityData是我修改的城市信息,大致结构如下:

ar cityData = [{
    value: 110000,
    label: '北京市',
    children: [{
        value: 110000,
        label: '北京市',
        children: [{value: 110101, label: '东城区'}, {value: 110102, label: '西城区'}, {
            value: 110105,
            label: '朝阳区'
        }, {value: 110106, label: '丰台区'}, {value: 110107, label: '石景山区'}, {
            value: 110108,
            label: '海淀区'
        }, {value: 110109, label: '门头沟区'}, {value: 110111, label: '房山区'}, {
            value: 110112,
            label: '通州区'
        }, {value: 110113, label: '顺义区'}, {value: 110114, label: '昌平区'}, {
            value: 110115,
            label: '大兴区'
        }, {value: 110116, label: '怀柔区'}, {value: 110117, label: '平谷区'}, {
            value: 110118,
            label: '密云区'
        }, {value: 110119, label: '延庆区'}]
    }]
},{...}

完整代码请移步github,文末有地址。

结语

这就是个简单的示例,有需求的小伙伴自取,githuhub路径:weui-demo-city-picker

因为这次的项目也实现了在线签名的需求,所以后面也会发布在线签名的相关实现

posted @ 2021-01-09 12:53  云中志  阅读(1868)  评论(0编辑  收藏  举报