easeChat模块demo退出登录功能源码案例

代码片段:

<div class="flex-vertical" id="rootWarp" v-cloak>

<!--  头部 -->

<header id="header">

<div class="header" :class="{on:headers.num==0}" v-for="(headers,index) in header">

<div class="title">{{headers.name}}</div>

<div class="right" @click="fnAddFriends();" v-if="headers.name==‘通讯录‘"></div>

</div>

</header>

<!--  sectionflex-con -->

<section class="flex-con"></section>

<!--  底部 -->

<footer id="footer" class="flex-wrap">

<div class="bar-tab-item flex-con" :class="{active:footers.num==0}" v-for="(footers,index) in footer" @click="fnChange(index);">

<!-- 聊天列表消息数 -->

<div class="badge" v-show="footers.name==‘消息‘ && footers.number>0">{{footers.number}}</div>

<!-- 通讯录加好友的新消息提示 -->

<div class="dot" v-if="footers.id==1 && footers.newNews==true"></div>

<i class="icon" :class="fnAddcs(footers.id)"></i>

<div class="bar-tab-label">{{footers.name}}</div>

</div>

</footer>

</div>

复制代码

首先api使用需要在vue渲染之后生效,所以初始化一下vue

apiready = function() {

//初始化vue

fnInitVue();

};

复制代码

//  设置底部点击初始化0防止多次重复点击

var eliminate = 0;

function fnInitVue() {

window.rootVue = new Vue({

el: ‘#rootWarp‘,

data: {

header: [],

footer: []

},

mounted: function() {

this.$nextTick(function() {

fnRequest();

fnInit();

});

},

methods: {

//打开添加好友页面

fnAddFriends: function() {

},

// 底部图标状态

fnAddcs: function(id) {

if (id == 0) {

return "message"; //消息图标

}

if (id == 1) {

return "directories"; //通讯录图标

}

if (id == 2) {

return "setup"; //设置图标

}

},

//底部tab

fnChange: function(index) {

// 防止重复点击

if (index == eliminate) {

return;

}

eliminate = index;

// 改变头部显示

this.header[index].num = 0;

// 改变底部显示

this.footer[index].num = 0;

//改变页面

api.setFrameGroupIndex({

name: ‘main_group‘,

index: index

});

}

}

})

}

复制代码

设置页面代码片段:

模拟ios滑动开关css:

.list-item .right {

position: relative;

z-index: 33;

}

.list-item .right .state {

display: inline-block;

vertical-align: middle;

border-radius: 20px;

width: 38px;

height: 21px;

text-align: center;

line-height: 20px;

font-size: 12px;

color: #fff;

}

.list-item .right .open {

}

.list-item .right .open::after {

content: " ";

float: right;

margin-top: 1px;

margin-right: 1px;

width: 19px;

height: 19px;

border-radius: 50%;

box-shadow: 0px 0px 1px 1px #d4d4d4;

-webkit-transition: all 0.2s linear;

transition: all 0.2s linear;

}

.list-item .right .close {

}

.list-item .right .close::after {

content: " ";

float: left;

margin-top: 1px;

margin-left: 1px;

width: 19px;

height: 19px;

border-radius: 50%;

box-shadow: 0px 0px 1px 1px #d4d4d4;

-webkit-transition: all 0.2s linear;

transition: all 0.2s linear;

}

复制代码

div:

<div id="rootlist" class="list" v-cloak>

<transition v-for="(lists,index) in list">

<div class="list-item flex-wrap" @click="fnOpenWin(list.id,list.name);" v-if="list.id==0||list.id==1">

<div class="left">{{lists.name}}</div>

<div class="title flex-con"></div>

<div class="right" v-if="lists.displays==1" @click="fnSwitch(index);">

<div class="state" :class="fnBarType(lists.state)"></div>

</div>

</div>

<div class="list-item flex-wrap" v-else>

<div class="left">{{lists.name}}</div>

<div class="title flex-con"></div>

<div class="right" v-if="lists.displays==1" @click="fnSwitch(index);">

<div class="state" :class="fnBarType(lists.state)"></div>

</div>

</div>

</transition>

<div class="list-footer" v-if="list.length>0">

<div class="btn" @click="fnSignOut();">退出登录(<span>{{user}}</span>)</div>

</div>

</div>

复制代码

js:

apiready = function() {

fnInitVue();

};

function fnInitVue() {

window.rootVue = new Vue({

el: ‘#rootlist‘,

data: {

list: [],

user: ‘‘,

},

mounted: function() {

this.$nextTick(function() {

fnInit();

fnRequest();

});

},

methods: {

// 开关状态

fnSwitch: function(index) {

if (this.list[index].state) {

this.list[index].state = false;

} else {

this.list[index].state = true;

}

},

// 根据true false显示不同按钮状态

fnBarType: function(type) {

if (type == true) return ‘open‘;

if (type == false) return ‘close‘;

},

// 退出登录

fnSignOut: function() {

}

}

})

}

复制代码

原文地址:https://www.cnblogs.com/tuituile/p/11757580.html

时间: 2024-08-13 15:49:02

easeChat模块demo退出登录功能源码案例的相关文章

easeChat模块demo实现静态聊天窗口测试源码分享

easeChat模块demo(vue+api实现会话列表滑动删除静态,我曾用于手机推币城APP中的房间用户聊天功能)聊天窗口界面静态页面,发送文本消息/消除最新消息/监听消息等环信的接口数据交互功能 *****使我代码的时候,一定记住config.xml里面,关于环信的value,环信开发控制台官网申请key,vuale修改完之后,上传到云端编译才会有效******* message_frm.html代码片段 置顶删除暂时没有做动态数据交换,只是实现了静态功能,留下的点击删除置顶事件,数据交互功

功能源码

两行代码实现当tableview无内容时自动显示提示语,一键设... TableView的嵌套使用 悬停 高仿喵播,视频直播 视频推流 2.0版 AFN与MBProgressHUD的组合封装 iOS手势解锁 高仿'微博'&&'微信'图片浏览器 App组件化之控制器之间的跳转 仿钉钉报销+cell+textview+自适应 自定义cell多个滑动编辑按钮 shoppingCart swift的购物车demo UITabView的折叠 8种删除UICollectionViewCell动画 Fl

ios自动滚动图片功能源码

源码AdScrollerView,一个已经封装好的UIScrollView的子类,可以自动滚动图片以及对应的描述语,类似淘宝app首页的广告滚动效果.滚动图片数量不限,并且显示pageControl. 效果图: <ignore_js_op> 源码下载: http://code.662p.com/view/9763.html 使用方法: 导入demo中的AdScrollerView文件夹,并导入头文件: #import "AdScrollView.h" #import &qu

elasticsearch index 功能源码概述

从本篇开始,对elasticsearch的介绍将进入数据功能部分(index),这一部分包括索引的创建,管理,数据索引及搜索等相关功能.对于这一部分的介绍,首先对各个功能模块的分析,然后详细分析数据索引和搜索的整个流程. 这一部分从代码包结构上可以分为:index, indices及lucene(common)几个部分.index包中的代码主要是各个功能对应于lucene的底层操作,它们的操作对象是index的shard,是elasticsearch对lucene各个功能的扩展和封装.indic

10.用户模块:退出登录

点击退出,销毁session,返回到首页. 1.在menu.jsp中加入退出的链接 <li id="headerRegister" class="headerRegister" style="display: list-item;"> <a href="${pageContext.request.contextPath }/user_quit">退出</a>| </li> 2.在

Mindjump-微信跳转浏览器功能源码,实现微信内自动跳转手机浏览器访问网页url

源码使用场景:1.用来实现微信自动跳转外部浏览器下载app2.用来实现微信内打开网页链接自动跳转浏览器访问指定页面3.防止网页链接由于被微信拦截,导致用户无法正常在微信内打开 源码说明: 适用安卓和苹果系统,支持任何网页链接.并且无论链接是否已经被微信拦截,均可实现微信内自动跳转浏览器打开. 生成的跳转链接具有极佳的防拦截效果. 源码体验: 1.复制分享链接(app下载页链接或网页链接),然后在浏览器(电脑和手机上都可以)中打开我们需要用到的 Mindjump 平台:http://www.min

PHP发表心情-投票功能源码

当浏览新闻页面或者其它页面的时候会有阅读后的感受,比如给力.淡定.打酱油.加油.坑爹等等的表情.让读者打分,看看自己的感受是否与其他读者一样.很不错的交互! 查看演示:http://www.weibut.com/demo/20...立即下载:http://www.weibut.com/downloa... 本文需要熟悉jquery,mysql,ajax相关的知识,不过用的不多.本文有三个文件:index.html,mood.php,sql.php index.html,页面展示和请求ajax数据

python实现最简单的计算器功能源码

1 import re 2 3 4 def calc(formula): 5 formula = re.sub(' ', '', formula) 6 formula_ret = 0 7 match_brackets = re.search(r'\([^()]+\)', formula) 8 if match_brackets: 9 calc_result = calc(match_brackets.group().strip("(,)")) 10 formula = formula.

.net 邮件批量发送功能源码

#define debug using System; using System.Text; using System.Linq; using System.IO; using System.Net; using System.Net.Mail; using System.Net.Mime; using System.Threading; using System.ComponentModel; using System.Diagnostics; using System.Collections