123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <!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">
- <meta name="format-detection"content="telephone=no">
- <title>index</title>
- <link rel="stylesheet" type="text/css" href="./../css/api.css"/>
- <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
- <link rel="stylesheet" type="text/css" href="../../css/toast.css"/>
- <link rel="stylesheet" href="../../css/projeck.css">
- <style media="screen">
- body,html{
- margin: 0;
- background: #fff;
- }
- .api_seach_personal{
- padding: 0 15px;
- box-sizing: border-box;
- position: relative;
- background: #f1f5f7;
- width: 90%;
- margin: auto;
- margin-top: 10px;
- /*border-bottom: 1px solid #ebebeb;*/
- }
- .api_seach_personal_box{
- height: 45px;
- }
- .api_seach_personal input{
- box-sizing: border-box;
- height: 44px;
- width: 100%;
- padding-left: 15px;
- border: none;
- outline: none;
- padding-right: 40px;
- -webkit-tap-highlight-color:rgba(0,0,0,0);
- -webkit-tap-highlight-color: transparent;
- }
- /*.seach_api{*/
- /*width: 44px;*/
- /*height: 44px;*/
- /*background: url("../../image/seach_api.png") no-repeat;*/
- /*background-size: cover;*/
- /*position: absolute;*/
- /*top: 20px;*/
- /*right: 20px;*/
- /*}*/
- </style>
- </head>
- <body>
- <header class="header-login">
- <img class="backBtn" src="../../image/btn_back.png" alt="" onclick="backIndex()">
- <p class="api_text">通讯录</p>
- </header>
- <div style="padding-bottom:10px;"class="api_seach_personal_box relative after-border">
- <div class="api_seach_personal" id="api_seach_personal">
- <input type="text" name="" value="" placeholder="" class="info" id="info_input">
- </div>
- </div>
- </body>
- </html>
- <script type="text/javascript" src="../../script/api.js"></script>
- <!-- <script src="../../script/fastclick.min.js" charset="utf-8"></script> -->
- <script type="text/javascript" src="../../script/config.js"></script>
- <script type="text/javascript">
- var UIInputId;
- apiready = function () {
- $api.fixStatusBar($api.dom('header') );
- var info = $api.getStorage('data'),
- user = JSON.parse(info).data.user;
- token = JSON.parse(info).data.access_token;
- // api.parseTapmode();
- fnInitUIInput(token);
- openFram();
- openSeachList();
- }
- function openSeachList(){
- var info = $api.dom('.info').value;;
- var UIListSearch = api.require('UIListSearch');
- UIListSearch.open({
- rect: {
- x: 0,
- y: $api.dom('header').offsetHeight + $api.dom('.api_seach_personal').offsetHeight+30,
- w: api.winWidth,
- h: api.winHeigh
- },
- contacts:[],
- fixedOn: api.organization_frame
- }, function(ret, err) {
- if (ret) {
- UIListSearch.hide();
- var UIInput = api.require('UIInput');
- UIInput.closeKeyboard({
- id:UIInputId
- });
- openDetails(ret.contact.name,ret.contact.mobile,ret.contact.avatar,ret.contact.position);
- }
- });
- UIListSearch.hide();
- };
- // 数据更新
- function functionName(arr) {
- var UIListSearch = api.require('UIListSearch');
- UIListSearch.show();
- UIListSearch.reloadData({
- contacts:JSON.parse(arr)
- });
- }
- function openFram() {
- api.openFrame({
- name: 'organization_frame',
- bounces: true,
- url: 'organization_frame.html',
- rect: {
- x: 0,
- y: $api.dom('header').offsetHeight + $api.dom('.api_seach_personal_box').offsetHeight+10,
- w: api.winWidth,
- h: 'auto',
- },
- pageParam: {
- // name: 'test'
- }
- });
- }
- function backIndex() {
- api.closeWin();
- var UIListSearch = api.require('UIListSearch');
- UIListSearch.close();
- }
- // input
- function fnInitUIInput(tokens) {
- var searchText = $api.byId('info_input');
- var rect = $api.offset(searchText);
- var UIInput = api.require('UIInput');
- UIInput.open({
- rect: {
- x: rect.l,
- y: rect.t,
- w: rect.w,
- h: rect.h
- },
- styles: {
- bgColor: '#f1f5f7',
- size: 14,
- color: '#000',
- placeholder: {
- color: '#ccc'
- }
- },
- autoFocus: false,
- maxRows: 1,
- placeholder: '使用姓名,工号查找',
- keyboardType: 'default',
- fixedOn: api.frameName
- }, function(ret, err) {
- // console.log(JSON.stringify(ret));
- UIInputId = ret.id;
- if (ret.eventType == "change") {
- UIInput.value({
- id: ret.id
- }, function(ret, err) {
- if (ret) {
- if (ret.status) {
- if (ret.msg == "") {
- var UIListSearch = api.require('UIListSearch');
- UIListSearch.hide();
- }else {
- selectPersonal(tokens,ret.msg);
- // functionName()
- }
- }
- }
- });
- // functionName();
- }
- });
- }
- // 查询
- function selectPersonal(token,name) {
- var headers = {
- "Authorization": "Bearer " + token
- };
- $http.fnReuestDataNologing(UrlRouter.searchPersonal,headers,'post',{content:name},function (ret,err) {
- if (ret.code === 0) {
- functionName(JSON.stringify(ret.data))
- }
- // console.log(JSON.stringify(ret));
- })
- }
- // 点击人员列表看详情
- function openDetails(name,phone,img,del) {
- var param = {
- username: name,
- mobile:phone,
- avatar:img,
- delp:del
- };
- $event.openPopup(api.winWidth,'auto','modul',param);
- }
- </script>
|