【App开发笔记】2.8 编写添加好友页面

源码地址

2.8.1 修改之前password_body.html页面的代码

html/user/password_body.html

<button tapmode="" onclick="OpenWin('add_friends_head','./add_friends_head.html')" class="H-button H-margin-vertical-top-20 H-width-100-percent H-font-size-15 H-outline-none H-padding-vertical-both-8 H-padding-horizontal-both-20 H-theme-font-color-white">
        完成
    </button>

2.8.2 添加好友的win页面

html/user/add_friends_head.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>app开发笔记</title>
    <link rel="stylesheet" type="text/css" href="../../css/Hui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/iconfont/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <style type="text/css">
        #search_box {
            background: #fafafa;padding:6px
        }

        #search_input {
            height: 30px;
            background: #ffffff;
            border: 1px solid #f4f4f4;
            border-radius: 5px
        }
        #search_input:active{
            background: #fdfdfd;
        }
        #search_input span{
            color: #d8d8d8
        }
        #search_input span:active{
            color: #e6e6e6;
        }
        button {
            background: #d8d8d8;
            border: 1px solid #d8d8d8;
            -webkit-transition: all 0.8s;
            -moz-transition: all 0.8s;
            -o-transition: all 0.8s;
            transition: all 0.8s;
        }

        .btn-after {
            background: #4a90e2;
            border-color: #4a90e2;
        }

        .btn-after:active {
            background: #dbe9f9;
            border-color: #dbe9f9;
        }

        .tab-active {
            position: relative;
            overflow: hidden;
        }

        .tab-active:after {
            content: '';
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            transform-origin: 0 0;
            transform: scale(1);
            -webkit-transform-origin: 0 0;
            -webkit-transform: scale(1);
            pointer-events: none;
            margin: 24px 14px;
            border-bottom: 2px solid #e7511a;
        }
    </style>
</head>
<body class="H-flexbox-vertical">
<header class="H-header H-padding-vertical-top-25" id="header" style="background-color: #fafafa">
     <span onclick="CloseToWin('root')" tapmode=""
           class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-padding-horizontal-left-5 H-z-index-100">
        <i class="iconfont icon-arrow-left H-font-size-20 H-vertical-middle"></i>
    </span>
    <div class="H-header-title H-center-all H-font-size-14 H-text-show-row-1 H-position-absolute H-width-100-percent"
         style="color: #4a4a4a">添加好友
    </div>
</header>
<div class="H-flex-item">
    <div tapmode="" onclick="OpenWin('search_friends_head','./search_friends_head.html')" id="search_box">
        <div id="search_input" class="H-vertical-middle">
            <span class="H-width-100-percent H-text-align-center H-display-block H-font-size-14">
                <i class="iconfont icon-search"></i>
                搜索昵称/手机号
            </span>
        </div>
    </div>
    <div id="tab" class="H-flexbox-horizontal H-theme-background-color-white">
        <div class="H-flex-item H-center-all H-padding-vertical-both-10 H-theme-border-color-white H-font-size-14 H-theme-font-color-black"
             style="">
            <span class="tab-active">推荐好友</span>
        </div>
        <div class="H-flex-item H-center-all H-padding-vertical-both-10 H-theme-border-color-white H-font-size-14">
            <span>微信好友</span>
        </div>
    </div>
</div>
<footer id="footer" class="H-padding-horizontal-both-25 H-padding-vertical-both-15">
    <div class="H-font-size-14 H-text-align-center H-padding-vertical-bottom-10" style="color:#4a90e2;">换一批看看</div>
    <button class="H-button H-width-100-percent H-font-size-15 H-outline-none H-padding-vertical-both-8 H-padding-horizontal-both-20 H-theme-font-color-white H-border-radius-5">
        一键关注
    </button>
</footer>
<script src="../../script/api.js" type="text/javascript"></script>
<script src="../../script/common.js" type="text/javascript"></script>
<script type="text/javascript">
    apiready = function () {
        api.openFrame({
            name: 'add_friends_body',
            url: './add_friends_body.html',
            rect: {
                x: 0,
                y: $api.byId('header').offsetHeight + $api.byId('search_box').offsetHeight + $api.byId('tab').offsetHeight,
                w: api.winWidth,
                h: api.frameHeight - $api.byId('header').offsetHeight - $api.byId('search_box').offsetHeight - $api.byId('tab').offsetHeight - $api.byId('footer').offsetHeight
            }
        });
    };
</script>
</body>
</html>

2.8.3 添加好友的frame页面

html/user/add_friends_body.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>app开发笔记</title>
    <link rel="stylesheet" type="text/css" href="../../css/Hui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/iconfont/iconfont.css"/>
    <style type="text/css">
        .friend_list{
            padding: 0 30px;height: 100%
        }
        .friend_box {
            height: 33.33%;
            width: 33.33%;
            text-align: center;
            float: left
        }

        .friend_select {
            height: 20px;
            width: 20px;
            bottom: 2px;
            right: 2px;
        }

        .friend_select_bg {
            background: #e7511a;
        }

        .friend_select_bg:active {
            background: rgba(0, 0, 0, 0);
        }
        .friend_select_bg .icon-select{
            color: #ffffff;
        }
        .friend_select_bg .icon-select:active {
            color: rgba(0, 0, 0, 0);
        }
        .friend_noselect_bg {
            background: #cccccc;
        }
        .friend_noselect_bg:active{
            background: rgba(0, 0, 0, 0);
        }
        .friend_noselect_bg .icon-select{
            color: #ffffff;
        }
        .friend_noselect_bg .icon-select:active {
            color: rgba(0, 0, 0, 0);
        }
    </style>
</head>
<body class="H-width-100-percent H-height-100-percent">
<div  class="friend_list">
    <div class="H-flex-item H-vertical-middle friend_box">
        <div class="H-line-height-0" style="min-width: 100%">
            <div class="picture H-position-relative  H-margin-horizontal-auto" style="width: 64px; height: 64px;">
                <span tapmode="" onclick="SelectFriend(this)" selected="1"
                      class="friend_select friend_select_bg H-icon H-display-block H-position-absolute H-center-all H-border-radius-circle H-z-index-1000 H-line-height-0"
                      style="">
                    <i class="iconfont icon-select H-font-size-12 H-vertical-align-middle"></i>
                </span>
                <img src="../../image/defult/head-img.png" class="H-display-block H-border-radius-circle" alt=""
                     title="" style="width: 64px; height: 64px;">
            </div>
            <div class="H-font-size-14 H-padding-vertical-both-2" style="line-height: 1.4rem">名字名字</div>
            <div class="H-font-size-10 H-theme-font-color-ccc H-padding-vertical-both-2" style="line-height: 1rem">粉丝&nbsp;&nbsp;654</div>
        </div>
    </div>
    <div class="H-flex-item H-vertical-middle friend_box">
        <div class="H-line-height-0" style="min-width: 100%">
            <div class="picture H-position-relative  H-margin-horizontal-auto" style="width: 64px; height: 64px;">
                <span tapmode="" onclick="SelectFriend(this)" selected="1"
                      class="friend_select friend_select_bg H-icon H-display-block H-position-absolute H-center-all H-border-radius-circle H-z-index-1000 H-line-height-0"
                      style="">
                    <i class="iconfont icon-select H-font-size-12 H-vertical-align-middle"></i>
                </span>
                <img src="../../image/defult/head-img.png" class="H-display-block H-border-radius-circle" alt=""
                     title="" style="width: 64px; height: 64px;">
            </div>
            <div class="H-font-size-14 H-padding-vertical-both-2" style="line-height: 1.4rem">名字名字</div>
            <div class="H-font-size-10 H-theme-font-color-ccc H-padding-vertical-both-2" style="line-height: 1rem">粉丝&nbsp;&nbsp;654</div>
        </div>
    </div>
    <div class="H-flex-item H-vertical-middle friend_box">
        <div class="H-line-height-0" style="min-width: 100%">
            <div class="picture H-position-relative  H-margin-horizontal-auto" style="width: 64px; height: 64px;">
                <span tapmode="" onclick="SelectFriend(this)" selected="1"
                      class="friend_select friend_select_bg H-icon H-display-block H-position-absolute H-center-all H-border-radius-circle H-z-index-1000 H-line-height-0"
                      style="">
                    <i class="iconfont icon-select H-font-size-12 H-vertical-align-middle"></i>
                </span>
                <img src="../../image/defult/head-img.png" class="H-display-block H-border-radius-circle" alt=""
                     title="" style="width: 64px; height: 64px;">
            </div>
            <div class="H-font-size-14 H-padding-vertical-both-2" style="line-height: 1.4rem">名字名字</div>
            <div class="H-font-size-10 H-theme-font-color-ccc H-padding-vertical-both-2" style="line-height: 1rem">粉丝&nbsp;&nbsp;654</div>
        </div>
    </div>
    <div class="H-flex-item H-vertical-middle friend_box">
        <div class="H-line-height-0" style="min-width: 100%">
            <div class="picture H-position-relative  H-margin-horizontal-auto" style="width: 64px; height: 64px;">
                <span tapmode="" onclick="SelectFriend(this)" selected="1"
                      class="friend_select friend_select_bg H-icon H-display-block H-position-absolute H-center-all H-border-radius-circle H-z-index-1000 H-line-height-0"
                      style="">
                    <i class="iconfont icon-select H-font-size-12 H-vertical-align-middle"></i>
                </span>
                <img src="../../image/defult/head-img.png" class="H-display-block H-border-radius-circle" alt=""
                     title="" style="width: 64px; height: 64px;">
            </div>
            <div class="H-font-size-14 H-padding-vertical-both-2" style="line-height: 1.4rem">名字名字</div>
            <div class="H-font-size-10 H-theme-font-color-ccc H-padding-vertical-both-2" style="line-height: 1rem">粉丝&nbsp;&nbsp;654</div>
        </div>
    </div>
    <div class="H-flex-item H-vertical-middle friend_box">
        <div class="H-line-height-0" style="min-width: 100%">
            <div class="picture H-position-relative  H-margin-horizontal-auto" style="width: 64px; height: 64px;">
                <span tapmode="" onclick="SelectFriend(this)" selected="1"
                      class="friend_select friend_select_bg H-icon H-display-block H-position-absolute H-center-all H-border-radius-circle H-z-index-1000 H-line-height-0"
                      style="">
                    <i class="iconfont icon-select H-font-size-12 H-vertical-align-middle"></i>
                </span>
                <img src="../../image/defult/head-img.png" class="H-display-block H-border-radius-circle" alt=""
                     title="" style="width: 64px; height: 64px;">
            </div>
            <div class="H-font-size-14 H-padding-vertical-both-2" style="line-height: 1.4rem">名字名字</div>
            <div class="H-font-size-10 H-theme-font-color-ccc H-padding-vertical-both-2" style="line-height: 1rem">粉丝&nbsp;&nbsp;654</div>
        </div>
    </div><div class="H-flex-item H-vertical-middle friend_box">
    <div class="H-line-height-0" style="min-width: 100%">
        <div class="picture H-position-relative  H-margin-horizontal-auto" style="width: 64px; height: 64px;">
                <span tapmode="" onclick="SelectFriend(this)" selected="1"
                      class="friend_select friend_select_bg H-icon H-display-block H-position-absolute H-center-all H-border-radius-circle H-z-index-1000 H-line-height-0"
                      style="">
                    <i class="iconfont icon-select H-font-size-12 H-vertical-align-middle"></i>
                </span>
            <img src="../../image/defult/head-img.png" class="H-display-block H-border-radius-circle" alt=""
                 title="" style="width: 64px; height: 64px;">
        </div>
        <div class="H-font-size-14 H-padding-vertical-both-2" style="line-height: 1.4rem">名字名字</div>
        <div class="H-font-size-10 H-theme-font-color-ccc H-padding-vertical-both-2" style="line-height: 1rem">粉丝&nbsp;&nbsp;654</div>
    </div>
</div><div class="H-flex-item H-vertical-middle friend_box">
    <div class="H-line-height-0" style="min-width: 100%">
        <div class="picture H-position-relative  H-margin-horizontal-auto" style="width: 64px; height: 64px;">
                <span tapmode="" onclick="SelectFriend(this)" selected="1"
                      class="friend_select friend_select_bg H-icon H-display-block H-position-absolute H-center-all H-border-radius-circle H-z-index-1000 H-line-height-0"
                      style="">
                    <i class="iconfont icon-select H-font-size-12 H-vertical-align-middle"></i>
                </span>
            <img src="../../image/defult/head-img.png" class="H-display-block H-border-radius-circle" alt=""
                 title="" style="width: 64px; height: 64px;">
        </div>
        <div class="H-font-size-14 H-padding-vertical-both-2" style="line-height: 1.4rem">名字名字</div>
        <div class="H-font-size-10 H-theme-font-color-ccc H-padding-vertical-both-2" style="line-height: 1rem">粉丝&nbsp;&nbsp;654</div>
    </div>
</div>
    <div class="H-flex-item H-vertical-middle friend_box">
        <div class="H-line-height-0" style="min-width: 100%">
            <div class="picture H-position-relative  H-margin-horizontal-auto" style="width: 64px; height: 64px;">
                <span tapmode="" onclick="SelectFriend(this)" selected="1"
                      class="friend_select friend_select_bg H-icon H-display-block H-position-absolute H-center-all H-border-radius-circle H-z-index-1000 H-line-height-0"
                      style="">
                    <i class="iconfont icon-select H-font-size-12 H-vertical-align-middle"></i>
                </span>
                <img src="../../image/defult/head-img.png" class="H-display-block H-border-radius-circle" alt=""
                     title="" style="width: 64px; height: 64px;">
            </div>
            <div class="H-font-size-14 H-padding-vertical-both-2" style="line-height: 1.4rem">名字名字</div>
            <div class="H-font-size-10 H-theme-font-color-ccc H-padding-vertical-both-2" style="line-height: 1rem">粉丝&nbsp;&nbsp;654</div>
        </div>
    </div>
    <div class="H-flex-item H-vertical-middle friend_box">
        <div class="H-line-height-0" style="min-width: 100%">
            <div class="picture H-position-relative  H-margin-horizontal-auto" style="width: 64px; height: 64px;">
                <span tapmode="" onclick="SelectFriend(this)" selected="1"
                      class="friend_select friend_select_bg H-icon H-display-block H-position-absolute H-center-all H-border-radius-circle H-z-index-1000 H-line-height-0"
                      style="">
                    <i class="iconfont icon-select H-font-size-12 H-vertical-align-middle"></i>
                </span>
                <img src="../../image/defult/head-img.png" class="H-display-block H-border-radius-circle" alt=""
                     title="" style="width: 64px; height: 64px;">
            </div>
            <div class="H-font-size-14 H-padding-vertical-both-2" style="line-height: 1.4rem">名字名字</div>
            <div class="H-font-size-10 H-theme-font-color-ccc H-padding-vertical-both-2" style="line-height: 1rem">粉丝&nbsp;&nbsp;654</div>
        </div>
    </div>
</div>
<script src="../../script/api.js" type="text/javascript"></script>
<script src="../../script/common.js" type="text/javascript"></script>
<script type="text/javascript">
    function SelectFriend(obj) {
        if($api.attr(obj,'selected')=="1"){
            $api.removeCls(obj,'friend_select_bg')
            $api.addCls(obj,'friend_noselect_bg')
            $api.attr(obj,'selected','0')
        }else{
            $api.addCls(obj,'friend_select_bg')
            $api.removeCls(obj,'friend_noselect_bg')
            $api.attr(obj,'selected','1')
        }

    }
</script>
</body>
</html>

效果图
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,378评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,356评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,702评论 0 342
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,259评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,263评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,036评论 1 285
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,349评论 3 400
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,979评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,469评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,938评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,059评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,703评论 4 323
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,257评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,262评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,485评论 1 262
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,501评论 2 354
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,792评论 2 345

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,599评论 18 139
  • 工厂模式类似于现实生活中的工厂可以产生大量相似的商品,去做同样的事情,实现同样的效果;这时候需要使用工厂模式。简单...
    舟渔行舟阅读 7,718评论 2 17
  • 经过对django的初步学习,我们已经对后台的基本流程以及django的运作有了一定的了解,但是这还不足够,dja...
    coder_ben阅读 3,823评论 8 34
  • 22年12月更新:个人网站关停,如果仍旧对旧教程有兴趣参考 Github 的markdown内容[https://...
    tangyefei阅读 35,160评论 22 257
  • 悦悦,你是个好女孩,是个迷人的女孩,起码迷住了我,你知不知道你很讨人喜欢啊?说到这你是不是在偷着笑啊?别臭美了!这...
    云若言阅读 263评论 0 0