国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
apicloud常用方法總結(jié)

獲取設(shè)備編號(hào)、打開/關(guān)閉新頁面、設(shè)置狀態(tài)欄樣式、ajax封裝、獲取上一頁參數(shù)、退出APP......

/* =============================== * apicloud應(yīng)用公共js * versions 1.0.0 * cl15095344637@163.com * @example:     * =============================== */var $app = {data: {appID: '', //應(yīng)用idappName: '', //應(yīng)用名稱appVersion: '1.0.0', //應(yīng)用版本號(hào)server: {url: '', //正式域名csurl: '', //測(cè)試域名},apicloud: true, //是否為apicloud環(huán)境},opts: function(opt){return $.extend(this.data, opt, true);},init: function(opt){var _this = this;_this.data = _this.opts(opt);},//獲得設(shè)備編號(hào)getDeviceId: function() {    var deviceId = api.deviceId;    deviceId = deviceId.replace(/\-/g, "");    return deviceId;},/***設(shè)置狀態(tài)欄樣式    @param {string} color APP狀態(tài)欄背景顏色    @param {string} style APP狀態(tài)欄文字顏色    @param {bool} contentTop 是否設(shè)置content頂部?jī)?nèi)邊距*/setStatusBar: function(color, style, contentTop) {    api.setStatusBarStyle({ color: color, style: style });    $api.fixStatusBar($api.dom('header'));    $api.fixIos7Bar($api.dom('header'));    $api.fixTabBar($api.dom('footer'));    $('header').height(44);    contentTop == false ? contentTop = contentTop : contentTop = true;    if(document.querySelector("header") && contentTop == true)    {        $(".content, .mui-content, aui-content").css({'padding-top': document.querySelector("header").offsetHeight});    }},/***ajax封裝    @param {string} opts.url 接口地址    @param {string} opts.type 請(qǐng)求類型, 默認(rèn)“post”(get, post)    @param {Object} opts.data 請(qǐng)求參數(shù) (若上傳文件則data: {path: "", ...})    @example:  aui.apicloud.ajax({ url: 'index/goods', tyle: 'post', data: {} }).then(function(ret){},function(err){})*/ajax: function(opts){var _this = this;if (_this.isDefine(opts.data.path)){ //上傳文件var data = { values: opts.data, files: { file: opts.data.path } }}else{ //普通數(shù)據(jù)請(qǐng)求var data = { values: opts.data }}return new Promise(function(resolve, reject){api.ajax({url: _this.data.server.url + opts.url || '',headers: {// 'Content-Type':'application/x-www-form-urlencoded' },method: opts.type || 'get',cache: opts.cache || 'false',timeout:  opts.timeout || 30,dataTpye: opts.dataTpye || 'json',data: data || {},},function(ret, err) {if(ret){resolve(ret)}else{ //請(qǐng)求失敗reject(err)}});});},/***獲取上一頁參數(shù)*/getPageparam: function() {    if (this.data.apicloud) {        return api.pageParam;    } else {        var res = getUrlParam('param');        if (res == 'undefined') { return {}; }        return _parse(res);    }},/***判斷是否為空    @param {string} value 需要判斷的變量字符串*/isDefine: function(value) {    if (value == null || value == "" || value == "undefined" || value == undefined || value == "null" || value == "(null)" || value == 'NULL' || typeof(value) == 'undefined') {        return false;    } else {        value = value + "";        value = value.replace(/\s/g, "");        if (value == "") {            return false;        }        return true;    }},/***打開新窗口    @param {string} name window窗口名稱    @param {string} url window窗口路徑    @param {Object} pageParam 打開新窗口傳入的參數(shù)    @param {string} type 動(dòng)畫類型    @param {string} subType 動(dòng)畫子類型    @param {string} duration 動(dòng)畫過渡時(shí)間,默認(rèn)300毫秒*/openWin: function(name, url, pageParam, type, subType, duration, isCheckLogin) {var _this = this;    if (_this.data.apicloud) {        _this.isDefine(pageParam) ? pageParam = pageParam : pageParam = new Object();        _this.isDefine(type) ? type = type : type = 'push';        _this.isDefine(subType) ? subType = subType : subType = 'from_right';        _this.isDefine(duration) ? duration = duration : duration = 300;        api.openWin({            name: name,            url: url,            pageParam: pageParam,            animation: {                type: type, 新視圖將舊視圖推開                subType: subType, //從右邊開始動(dòng)畫            }        });    }},/***關(guān)閉當(dāng)前頁面 */closeWin: function() {var _this = this;    if (_this.data.apicloud) {        api.closeWin();    }},/***關(guān)閉指定頁面    @param {string} name 指定頁面名稱*/winCloseName: function(name){if (api.systemType == 'ios'){var _timer = setTimeout(function(){clearTimeout(_timer);api.execScript({name: "root",script: "api.closeWin({name:'"+name+"'});"});},500)}else{api.closeWin({name:name});}},/***打開新頁面并在頁面消失時(shí)關(guān)閉當(dāng)前頁*/closeCurrentWin: function(){var _this = this;    // 監(jiān)聽頁面消失的時(shí)候,關(guān)閉當(dāng)前頁    api.addEventListener({        name:'viewdisappear'    },function(){        _this.closeWin();    });},/***退出APP    @param {string} appID 當(dāng)前app對(duì)應(yīng)的ID(已全局設(shè)置)    @param {bool} flag true:進(jìn)入后臺(tái)運(yùn)行; false:直接退出(可選)*/exitApp: function(flag){    if (api.systemType == 'ios')    { //IOS退出        api.setWinAttr({ slidBackEnabled: false });    }    else    { //安卓雙擊退出        api.addEventListener({            name: 'keyback'        }, function(ret, err) {            if (window.__start == 'undefined' || !window.__start) {                window.__start = new Date().getTime();                api.toast({ msg: '再按一次返回鍵退出', duration: 1500, location: 'bottom' });            } else {                if (new Date().getTime() - window.__start < 1500) {                    flag ? flag = flag : flag = true;                    switch (flag) {                        case true:                            //APP進(jìn)入后臺(tái)運(yùn)行                            api.toLauncher();                            break;                        case false:                            //直接退出APP(會(huì)殺死進(jìn)程)                            api.closeWidget({                                id: _this.appID, //應(yīng)用id                                retData: {  name: 'closeWidget' },                                animation: { type: 'flip', subType: 'from_bottom',  duration: 500},                                silent: true                            });                            break;                        default:                    }                } else {                    window.__start = new Date().getTime();                    api.toast({ msg: '再按一次返回鍵退出', duration: 1500, location: 'bottom' });                }            }        });    }},}
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
數(shù)據(jù)云API
APICloud 重新定義移動(dòng)應(yīng)用開發(fā)
打造云端一體化的全新開發(fā)和數(shù)據(jù)運(yùn)營模式
如何用APICloud開發(fā)一款手機(jī)直播APP?
新手入門教程,從0開始入手APIcloud(一)
慶科物聯(lián)網(wǎng)平臺(tái)架構(gòu)分析
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服