123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502 |
- <!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"/>
- <style>
- header ul li { height: 50px; line-height: 50px; text-align: center; display: none; color: #fff; position: relative;font-size: 18px; position: relative;}
- header ul li.active{ display: block; }
- .flex-con{
- overflow: auto
- }
- #main{
- -webkit-overflow-scrolling:touch;
- }
- .search_warp{
- padding: 0 60px 0 13px;
- box-sizing: border-box;
- -webkit-box-sizing: border-box;
- position: relative;
- }
- .search_warp .search_input{
- box-sizing: border-box;
- -webkit-box-sizing: border-box;
- height: 29px;
- line-height: 29px;
- background-color: rgba(255,255,255,.3);
- -webkit-border-radius: 50px;
- -moz-border-radius: 50px;
- border-radius: 50px;
- padding-left: 43px;
- font-size: 13px;
- color: #fff;
- width: 100%;
- }
- .search_warp .search_input::placeholder{
- color: #fff;
- }
- .search_icon{
- width: 19px;
- height: 19px;
- display: block;
- position: absolute;
- top: 18px;
- left: 28px;
- background: url("image/seacrh001.png") no-repeat;
- background-size: cover;
- }
- .topheader_img{
- background: url("image/topheader.png") no-repeat;
- background-size: contain;
- }
- .qrcode_{
- width: 29px;
- height:37px;
- display: block;
- position: absolute;
- top: 9px;
- right: 13px;
- background: url("image/qrcode.png") no-repeat;
- background-size: contain;
- }
- </style>
- </head>
- <body class="topheader_img">
- <div id="wrap" class="flex-wrap flex-vertical">
- <header id="headers">
- <ul>
- <li class="border-b active">
- <div class="search_warp">
- <input type="text" class="search_input" placeholder="搜索" onclick="searchInfo()" readonly>
- <i class="search_icon"></i>
- <i class="qrcode_" onclick="scanFun()"></i>
- </div>
- </li>
- <li class="border-b "></li>
- <li class="border-b">
- <!-- <div class="search_warp">
- <input type="text" class="search_input" placeholder="搜索" onclick="searchInfo()" readonly>
- <i class="search_icon"></i>
- <i class="qrcode_" onclick="scanFun()"></i>
- </div> -->
- </li>
- <li class="border-b "></li>
- <li class="border-b "></li>
- </ul>
- </header>
- <div id="main" class="flex-con">
- </div>
- </div>
- </body>
- </html>
- <script type="text/javascript" src="script/api.js"></script>
- <!-- <script src="script/aui-toast.js" charset="utf-8"></script> -->
- <!-- <script src="script/fastclick.min.js" charset="utf-8"></script> -->
- <script src="script/config.js" charset="utf-8"></script>
- <script type="text/javascript">
- var uuid = ''
- apiready = function () {
- $api.fixStatusBar( $api.dom('header'));
- // 从sesstion获取工号var info = $api.getStorage('data'),
- var info = $api.getStorage('data'),
- user = JSON.parse(info).data.user;
- uuid = JSON.parse(info).data.user.staff_num;
- // 极光推送
- initPush(uuid);
- // 手机类别
- var systemType = api.systemType;
- api.setStatusBarStyle({
- style:'light',
- color:'transparent'
- });
- api.addEventListener({
- name: 'keyback'
- }, function(ret, err) {
- api.confirm({
- title: '提示',
- msg: '是否退出应用',
- buttons: ['确定', '取消']
- }, function(ret, err) {
- if (ret.buttonIndex == 1) {
- // 关闭当前的主Widget,就可以实现推出APP的效果
- api.closeWidget({
- silent: true //直接退出,无需提示
- });
- }
- });
- })
- frameFun()//第一次进入首页
- sendEventFun()//广播,消息页面监听刷新
- // 关闭tabnar
- var NVTabBar = api.require('NVTabBar');
- NVTabBar.close();
- if (systemType == 'ios') {
- NVTabBarFun(33,26,2);
- } else if (systemType == 'android') {
- NVTabBarFun(14,45,1);
- }
- // 消息徽章
- newsBadge(uuid);
- api.addEventListener({
- name: 'newsBroadcast'
- }, function(ret, err) {
- newsBadge(uuid)
- });
- // 让NVTabBar在所有页面的上面
- var NVTabBar = api.require('NVTabBar');
- NVTabBar.bringToFront();
- }
- // 二维码
- function scanFun(){
- var FNScanner = api.require('FNScanner');
- FNScanner.open({
- autorotation: true
- }, function(ret, err) {
- if(ret.eventType == "success" && ret.content.length>0){
- QRcodeDetaile(ret.content)
- };
- });
- }
- // 详情
- function QRcodeDetaile(urls) {
- var name,value,info =[],Qrurl= urls;
- var str = Qrurl;
- var num=str.indexOf("?");
- str=str.substr(num+1);
- var arr=str.split("&");
- for(var i=0;i < arr.length;i++){
- num=arr[i].indexOf("=");
- if(num>0){
- name=arr[i].substring(0,num);
- value=arr[i].substr(num+1);
- this[name]=value;
- info.push(value)
- }
- }
- if (info[2] != "" && info[2]) {
- $event.openWin('browseQrcode_win','./html/browseQrcode/browseQrcode_win',{pageId:info[2],title:'二维码详情'},'');
- }else {
- $event.openWin('SweepcodeDetaile','./html/Qrcode/Sweepcode',{pageUrl:urls},'');
- }
- }
- // 极光推送
- function initPush(ids) {
- var ajpush = api.require('ajpush');
- ajpush.init(function(ret) {
- if (ret && ret.status) {
- bindId(ids);
- // 监听状态栏消息,获取数据
- appintent();
- }
- });
- }
- // 绑定工号
- function bindId (ids){
- var ajpush = api.require('ajpush');
- var param = {alias:ids};
- ajpush.bindAliasAndTags(param,function(ret) {
- var statusCode = ret.statusCode;
- });
- }
- // 点击状态栏 消息推送的回调
- function appintent() {
- api.addEventListener({
- name: 'appintent'
- }, function(ret, err) {
- if (ret && ret.appParam.ajpush) {
- $event.openWin('newsList','./html/news/news_win','','');
- var ajpush = ret.appParam.ajpush;
- var id = ajpush.id;
- var title = ajpush.title;
- var content = ajpush.content;
- var extra = ajpush.extra;
- }
- })
- }
- // 发送广播消息 监听消息提醒
- function sendEventFun() {
- api.sendEvent({
- name: 'myEvent'
- });
- api.sendEvent({
- name: 'myNews',
- });
- }
- // tabnar
- function NVTabBarFun(marginB,centerX,centerY) {
- var NVTabBar = api.require('NVTabBar');
- NVTabBar.open({
- styles: {
- bg: '#fff',
- h: 60,
- dividingLine: {
- width:0.5,
- color: '#ecf0f1'
- },
- badge: {
- bgColor: '#ff0000',
- numColor: '#fff',
- size: 7.0,
- centerX: centerX,
- centerY: centerY
- }
- },
- items: [{
- w: api.winWidth / 5.0,
- bg: {
- marginB: -1,
- },
- iconRect: {
- w: 25.0,
- h: 25.0,
- },
- icon: {
- normal: 'widget://image/NVTabBar/s01.png',
- highlight: 'widget://image/NVTabBar/s011.png',
- selected: 'widget://image/NVTabBar/s011.png'
- },
- title: {
- text : '首页',
- size: 13.0,
- normal: '#929292',
- selected: '#3498db',
- marginB: 6.0
- }
- },{
- w: api.winWidth / 5.0,
- bg: {
- marginB: -1
- },
- iconRect: {
- w: 25.0,
- h: 25.0,
- },
- icon: {
- normal: 'widget://image/NVTabBar/x02.png',
- highlight: 'widget://image/NVTabBar/x021.png',
- selected: 'widget://image/NVTabBar/x021.png'
- },
- title: {
- text: '消息',
- size: 13.0,
- normal: '#929292',
- selected: '#3498db',
- marginB: 6.0
- }
- }, {
- w: api.winWidth / 5.0,
- bg: {
- marginB: -1
- },
- iconRect: {
- w: 25.0,
- h: 25.0,
- },
- icon: {
- normal: 'widget://image/NVTabBar/k1.png',
- highlight: 'widget://image/NVTabBar/k1.png',
- selected: 'widget://image/NVTabBar/k2.png'
- },
- title: {
- text: '工作台',
- size: 13.0,
- normal: '#929292',
- selected: '#3498db',
- marginB: 6.0
- }
- },{
- w: api.winWidth / 5.0,
- bg: {
- marginB: -1
- },
- iconRect: {
- w: 25.0,
- h: 25.0,
- },
- icon: {
- normal: 'widget://image/NVTabBar/s03.png',
- highlight: 'widget://image/NVTabBar/s031.png',
- selected: 'widget://image/NVTabBar/s031.png'
- },
- title: {
- text: '生产数据',
- size: 13.0,
- normal: '#929292',
- selected: '#3498db',
- marginB: 6.0
- }
- }, {
- w: api.winWidth / 5.0,
- bg: {
- marginB: -1
- },
- iconRect: {
- w: 25.0,
- h: 25.0,
- },
- icon: {
- normal: 'widget://image/NVTabBar/g04.png',
- highlight: 'widget://image/NVTabBar/g041.png',
- selected: 'widget://image/NVTabBar/g041.png'
- },
- title: {
- text: '我的',
- size: 13.0,
- normal: '#929292',
- selected: '#3498db',
- marginB: 6.0
- }
- }],
- selectedIndex: 0
- }, function(ret, err) {
- if (ret.eventType == "click" && ret.index == 0) {
- api.setFrameGroupIndex({
- name: 'group',
- index: 0
- });
- $api.html($api.dom('.border-b'), `<div class="search_warp">
- <input type="text" class="search_input" placeholder="搜索" onclick="searchInfo()" readonly>
- <i class="search_icon"></i>
- <i class="qrcode_" onclick="scanFun()"></i>
- </div>`);
- $api.css($api.byId('headers'), 'background-color: transparent');
- api.sendEvent({
- name: 'newsBroadcast'
- });
- }
- if (ret.eventType == "click" && ret.index == 1) {
- api.setFrameGroupIndex({
- name: 'group',
- index: 1
- });
- $api.css($api.byId('headers'), 'background-color: transparent');
- $api.css($api.byId('headers'), 'background-color: #009fe8');
- $api.html($api.dom('.border-b'), '消息');
- api.sendEvent({
- name: 'myEvent'
- });
- api.sendEvent({
- name: 'newsBroadcast'
- });
- }
- if (ret.eventType == "click" && ret.index == 2) {
- api.setFrameGroupIndex({
- name: 'group',
- index: 2
- });
- $api.css($api.byId('headers'), 'background-color: #009fe8');
- $api.html($api.dom('.border-b'), '工作台');
- api.sendEvent({
- name: 'newsBroadcast'
- });
- }
- if (ret.eventType == "click" && ret.index == 3) {
- api.setFrameGroupIndex({
- name: 'group',
- index: 3
- });
- // api.sendEvent({
- // name: 'eventCanvas'
- // });
- api.sendEvent({
- name: 'refreshProduction'
- });
- $api.css($api.byId('headers'), 'background-color: #009fe8');
- $api.html($api.dom('.border-b'), '生产数据');
- api.sendEvent({
- name: 'newsBroadcast'
- });
- } else {
- api.sendEvent({
- name: 'clearCanvas'
- });
- }
- if (ret.eventType == "click" && ret.index == 4) {
- api.setFrameGroupIndex({
- name: 'group',
- index: 4
- });
- $api.css($api.byId('headers'), 'background-color: #009fe8');
- $api.html($api.dom('.border-b'), '个人中心');
- api.sendEvent({
- name: 'myNews'
- });
- api.sendEvent({
- name: 'newsBroadcast'
- });
- }
- });
- }
- function frameFun() {
- var eHeaderLis = $api.domAll('header li'),
- frames = [];
- for (var i = 0,len = eHeaderLis.length; i < len; i++) {
- frames.push( {
- name: 'frame'+i,
- url: './html/page/frame'+i+'.html',
- bgColor : '#f2f2f2',
- bounces:true,
- overScrollMode:'always'
- } )
- }
- api.openFrameGroup({
- name: 'group',
- scrollEnabled: false,
- rect: {
- x: 0,
- y: $api.dom('header').offsetHeight,
- w: api.winWidth,
- h: $api.dom('#main').offsetHeight - 60
- },
- preload:0,
- index: 0,
- frames: frames
- }, function (ret, err) {
- if (ret.index == 3) {
- api.sendEvent({
- name: 'eventCanvas'
- });
- }else {
- api.sendEvent({
- name: 'clearCanvas'
- });
- }
- });
- var NVTabBar = api.require('NVTabBar');
- NVTabBar.bringToFront();
- }
- // 消息徽章
- function newsBadge(id) {
- var NVTabBar = api.require('NVTabBar');
- $http.fnReuestDataNologing(UrlRouter.findMessageCount+id,'','get','',function (ret,err) {
- if (ret.data && ret.data>99) {
- NVTabBar.setBadge({
- index: 1,
- badge: ret.data > 99?'99':ret.data
- });
- }
- if (ret.data && ret.data<99 && ret.data != 0) {
- NVTabBar.setBadge({
- index: 1,
- badge: ' '+ret.data+' '
- });
- }
- if (ret.data === 0) {
- NVTabBar.setBadge({
- index: 1
- });
- }
- })
- }
- // 搜索
- function searchInfo() {
- $event.openWin('search_win','./html/page/search_win','','')
- }
- </script>
|