{
- "name": "com.supwisdom.dlapp",
+ "name": "com.dalicitycard.app",
"version": "1.0.3",
"lockfileVersion": 1,
"requires": true,
"resolved": "https://registry.npmjs.org/cordova-plugin-app-version/-/cordova-plugin-app-version-0.1.9.tgz",
"integrity": "sha1-nbBgeGMzenEEiTAuX1CpBPFEm9s="
},
+ "cordova-plugin-brightness": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/cordova-plugin-brightness/-/cordova-plugin-brightness-0.2.0.tgz",
+ "integrity": "sha512-ujW4v58jArPxPf8CjEppl9hM2/9jep1+nflzAOGoT4yc5UIuLja6j6+wxK2fv6+UWqVEWEKB3JkfnijVUl6HjQ=="
+ },
"cordova-plugin-camera": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/cordova-plugin-camera/-/cordova-plugin-camera-4.0.3.tgz",
"cordova-ios": "^5.0.1",
"cordova-plugin-advanced-http": "^2.1.1",
"cordova-plugin-app-version": "^0.1.9",
+ "cordova-plugin-brightness": "^0.2.0",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-disable-ios11-statusbar": "^1.0.0",
"CHANNEL": "developer-default"
},
"cordova-plugin-app-version": {},
- "cordova-plugin-wkwebview-engine": {}
+ "cordova-plugin-wkwebview-engine": {},
+ "cordova-plugin-brightness": {}
},
"platforms": [
"android",
{
"xml": "<feature name=\"AppVersion\"><param name=\"android-package\" value=\"uk.co.whiteoctober.cordova.AppVersion\" /></feature>",
"count": 1
+ },
+ {
+ "xml": "<feature name=\"Brightness\"><param name=\"android-package\" value=\"org.apache.cordova.plugin.Brightness.BrightnessPlugin\" /></feature>",
+ "count": 1
}
]
}
},
"cordova-plugin-wkwebview-engine": {
"PACKAGE_NAME": "com.dalicitycard.app"
+ },
+ "cordova-plugin-brightness": {
+ "PACKAGE_NAME": "com.dalicitycard.app"
}
},
"dependent_plugins": {},
"clobbers": [
"cordova.getAppVersion"
]
+ },
+ {
+ "id": "cordova-plugin-brightness.Brightness",
+ "file": "plugins/cordova-plugin-brightness/www/brightness.js",
+ "pluginId": "cordova-plugin-brightness",
+ "clobbers": [
+ "cordova.plugins.brightness"
+ ]
}
],
"plugin_metadata": {
"cordova-plugin-jcore": "1.3.0",
"jpush-phonegap-plugin": "3.7.2",
"cordova-plugin-app-version": "0.1.9",
- "cordova-plugin-wkwebview-engine": "1.2.1"
+ "cordova-plugin-wkwebview-engine": "1.2.1",
+ "cordova-plugin-brightness": "0.1.5"
}
}
dependencies {
implementation fileTree(include: '*.jar', dir: 'libs')
// SUB-PROJECT DEPENDENCIES START
- implementation project(path: ':CordovaLib')
- implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
- implementation 'com.android.support:support-v4:24.1.1+'
+ implementation(project(path: ":CordovaLib"))
+ implementation "com.squareup.okhttp3:okhttp-urlconnection:3.10.0"
+ implementation "com.android.support:support-v4:24.1.1+"
// SUB-PROJECT DEPENDENCIES END
}
<?xml version='1.0' encoding='utf-8'?>
-<manifest android:hardwareAccelerated="true" android:versionCode="10004" android:versionName="1.0.4" package="com.dalicitycard.app"
- xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest android:hardwareAccelerated="true" android:versionCode="10005" android:versionName="1.0.5" package="com.dalicitycard.app" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/launcher_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<category android:name="com.dalicitycard.app" />
</intent-filter>
</receiver>
- <activity android:exported="true" android:name="cn.jpush.android.service.JNotifyActivity"
- android:taskAffinity="jpush.custom" android:theme="@android:style/Theme.Translucent.NoTitleBar">
+ <activity android:exported="true" android:name="cn.jpush.android.service.JNotifyActivity" android:taskAffinity="jpush.custom" android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="cn.jpush.android.intent.JNotifyActivity" />
<category android:name="com.dalicitycard.app" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
+ <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
</manifest>
"clobbers": [
"cordova.getAppVersion"
]
+ },
+ {
+ "id": "cordova-plugin-brightness.Brightness",
+ "file": "plugins/cordova-plugin-brightness/www/brightness.js",
+ "pluginId": "cordova-plugin-brightness",
+ "clobbers": [
+ "cordova.plugins.brightness"
+ ]
}
];
module.exports.metadata = {
"cordova-plugin-jcore": "1.3.0",
"jpush-phonegap-plugin": "3.7.2",
"cordova-plugin-app-version": "0.1.9",
- "cordova-plugin-wkwebview-engine": "1.2.1"
+ "cordova-plugin-wkwebview-engine": "1.2.1",
+ "cordova-plugin-brightness": "0.1.5"
};
});
\ No newline at end of file
dict = ret.idtypes;
let keys = Object.keys(dict);
let vals = Object.values(dict);
+ console.log(keys, vals)
var items=[];
var selectItem=items[0];
for(var key of keys){
}
if(key == 'idcard'){
selectItem=bean;
- }
+ }
items.push(bean)
}
$("#idtype").val(selectItem.title)
cardnum = cardnum.trim();
name = name.trim();
idno = idno.trim();
+
$.showLoading("正在处理");
var param = {
"cardno": cardnum,
window.localStorage.setItem("cardno", cardnum);
window.localStorage.setItem("idtype", idtype);
window.localStorage.setItem("idno", idno);
-
window.localStorage.setItem("phoneX",ret.phonex);
window.localStorage.setItem("personid", ret.personid);
window.localStorage.setItem("signed", ret.signed);
}
});
var uid = window.localStorage.getItem("uid");
- console.log(uid);
window.JPush.setAlias({ sequence: 1, alias: uid },
(result) => {
var sequence = result.sequence
var alias = result.alias
- console.log(alias)
+ //alert(JSON.stringify(result))
}, (error) => {
- console.log(JSON.stringify(error))
var sequence = error.sequence
var errorCode = error.code
+ //alert(JSON.stringify(error))
})
},
})
});
$('#secBtn').click(function() {
- window.location = "security.html";
- /*app.checkBefore(function() {
+ //window.location = "security.html";
+ app.checkBefore(function() {
app.checkOther(function() {
window.location = "security.html";
})
- })*/
+ })
});
+ /*$("#doorBtn").click(function(){
+ app.checkBefore(function() {
+ showRet(DOOR_URl);
+ })
+ })*/
$('#usersec').click(function() {
app.checkBefore(function() {
app.checkOther(function() {
this.backBtn();
},
backBtn: function(){
- document.addEventListener("backbutton", function(e){
- e.preventDefault();
- navigator.app.exitApp();
- }, false);
- },
+ document.addEventListener("backbutton", function(e){
+ e.preventDefault();
+ navigator.app.exitApp();
+ }, false);
+ },
initTab: function() {
$("#maincontent").css("top", $("#maintop").height())
var tab = new auiTab({
} else {
window.location = 'cardinfor.html'
}
- },
- logout:function(){
- window.localStorage.removeItem("token");
- window.location = "login.html";
}
-
};
app.initialize();
+
+function showRet(url) {
+ if(isEmpty(url)){
+ return;
+ }
+ var userid = window.localStorage.getItem("userid");
+ //if (url.indexOf("yy.dlsmk.cn")>=0) {
+ if(url.indexOf("?")>0){
+ url=url+'&userid='+userid;
+ }else{
+ url=url+'?userid='+userid;
+ }
+ //}
+ console.log(url)
+ var inAppBrowserRef = cordova.ThemeableBrowser.open(url, '_blank', {
+ statusbar: {
+ color: '#03a9f4ff'
+ },
+ toolbar: {
+ height: 44,
+ color: '#03a9f4ff'
+ },
+ title: {
+ color: '#ffffffff',
+ showPageTitle: true
+ },
+ backButton: {
+ image: 'back.png',
+ imagePressed: 'back.png',
+ align: 'left',
+ event: 'backPressed'
+ },
+ closeButton: {
+ image: 'close.png',
+ imagePressed: 'close.png',
+ align: 'left',
+ event: 'closePressed'
+ },
+ backButtonCanClose: true
+ }).addEventListener('closePressed', function(params){
+ inAppBrowserRef.close();
+ //window.location = "main.html"
+ });
+ }
+var brightness;
+var bvalue;
+var setted= false;
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
-
onDeviceReady: function() {
var uid = window.localStorage.getItem("token");
- this.loadQrcode();
+ app.loadQrcode();
setInterval(function () {
window.location.reload();
},100000);
+
+ brightness = cordova.plugins.brightness;
+ if(brightness){
+ brightness.getBrightness(function(val){
+ bvalue = val;
+ }, function(err){
+ console.log(err);
+ });
+ }
},
loadQrcode: function() {
$.showLoading("加载中");
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.L
});
+ if(!setted&&brightness){
+ brightness.setBrightness(1, function(ret){
+ console.log(ret);
+ setted = true;
+ brightness.setKeepScreenOn(true);
+ }, function(e){
+ console.log(e)
+ });
+ }
} else {
$.hideLoading();
$.alert("请求失败,请稍后再试", "错误");
$.hideLoading();
var qrcode = new QRCode(document.getElementById("qrcode"), {
text: ret.qrcode,
- width: 150,
- height: 150,
+ width: 200,
+ height: 200,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.L
$.alert("请求失败了:" + ret.status + "请稍后再试", "错误");
}
})
+ },
+ backTo:function(){
+ if(brightness&&bvalue){
+ brightness.setBrightness(bvalue, function(ret){
+ brightness.setKeepScreenOn(false);
+ }, function(e){
+ console.log(e)
+ });
+ }
+ window,location.href='main.html';
}
};
app.initialize();
\ No newline at end of file
"platform":device.name+","+device.platform+","+device.version,
"uuid":device.uuid
}
- console.log(param)
ICheckCode(param,function(ok,ret){
if(ok){
$.hideLoading();
var dev = false;
var SERVER = "https://yy.dlsmk.cn/payapi/mobileapi";
+var DOOR_URl = "http://172.28.43.8:8099/door/app/appMintUIindex";//门禁服务地址
var GLOBAL_TODAY="";
var GLOBAL_YESTERDAY="";
var CURRENT_INDEX=1;
if (dev) {
- SERVER = "http://172.28.201.70:10010/payapi/mobileapi";
+ SERVER = "http://172.28.43.7:8099/payapi/mobileapi";
}
function V1Qrcode(callback) {
<div class="center-in"><img src="img/icon_securty.png" style="width:28px;height: 28px"></div>
<div class="aui-grid-label" style="margin-top:10px;">账户安全</div>
</div>
+ <!--<div class="aui-col-xs-4" id="doorBtn">
+ <div class="center-in"><img src="img/icon_door.png" style="width:28px;height: 28px"></div>
+ <div class="aui-grid-label" style="margin-top:10px;">远程开门</div>
+ </div>-->
</div>
</div>
</section>
</div>
</div>
</div>
- <section class="aui-content aui-grid " style="display:none;">
+ <section class="aui-content aui-grid ">
<div class="aui-row aui-margin-t-10">
<div class="aui-col-xs-4 aui-border-r">
<big class="aui-text-warning" id="user-amount">0.00</big>
</div>
</li>
</ul>
- <div style="padding: 20px;margin-top: 40px;">
- <a href="javascript:app.logout();" class="weui-btn weui-btn_warn">退出登录</a>
- </div>
</section>
</div>
<footer class="aui-bar aui-bar-tab aui-border-t" id="footer">
</head>
<body style="background: #fff" >
<header class="aui-bar aui-bar-nav" style="padding-top:25px;">
- <a class="aui-pull-left" href="main.html">
+ <a class="aui-pull-left" href="app.backTo()">
<span class="aui-iconfont aui-icon-left"></span>
</a>
<div class="aui-title">付款码</div>
</div>
</li>
</ul>
-
+ <div style="padding: 20px;margin-top: 40px;">
+ <a href="javascript:app.logout();" class="weui-btn weui-btn_warn">退出登录</a>
+ </div>
</section>
</body>
--- /dev/null
+package org.apache.cordova.plugin.Brightness;
+
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.CordovaPlugin;
+import org.json.JSONArray;
+import org.json.JSONException;
+
+import android.app.Activity;
+import android.view.WindowManager.LayoutParams;
+import android.view.WindowManager;
+import android.view.Window;
+
+/**
+ * @author Evgeniy Lukovsky
+ *
+ */
+public class BrightnessPlugin extends CordovaPlugin {
+ public enum Action{
+ setBrightness,
+ getBrightness,
+ setKeepScreenOn
+ }
+
+ private class SetTask implements Runnable{
+ private Activity target = null;
+ private LayoutParams lp = null;
+ @Override
+ public void run() {
+ target.getWindow().setAttributes(lp);
+ }
+ public void setParams(Activity act, LayoutParams params){
+ this.target = act;
+ this.lp = params;
+ }
+ }
+
+ private class KeepOnTask implements Runnable{
+ private Window win = null;
+ private boolean state = false;
+ @Override
+ public void run() {
+ if(state){
+ win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ } else {
+ win.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ }
+ }
+ public void setParams(Window win, boolean state){
+ this.win = win;
+ this.state = state;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.cordova.CordovaPlugin#execute(java.lang.String, org.json.JSONArray, org.apache.cordova.CallbackContext)
+ */
+ @Override
+ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
+ System.out.println("plugin has been started");
+ boolean result = false;
+
+ switch(Action.valueOf(action)){
+ case setBrightness: result = true;
+ setBrightness(args, callbackContext);
+ break;
+ case getBrightness: result = true;
+ getBrightness(args, callbackContext);
+ break;
+ case setKeepScreenOn: result = true;
+ setKeepScreenOn(args, callbackContext);
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * @param args
+ * @param callbackContext
+ * @return
+ */
+ private boolean setBrightness(JSONArray args, CallbackContext callbackContext) {
+ try {
+ Activity activity = cordova.getActivity();
+ WindowManager.LayoutParams layoutParams = activity.getWindow().getAttributes();
+ String value = args.getString(0);
+ double brightness = Double.parseDouble(value);
+ layoutParams.screenBrightness = (float) brightness;
+ SetTask task = new SetTask();
+ task.setParams(activity, layoutParams);
+ activity.runOnUiThread(task);
+ callbackContext.success("OK");
+
+ } catch (NullPointerException e) {
+ System.out.println("Null pointer exception");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ } catch (JSONException e) {
+ System.out.println("JSONException exception");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ }
+ System.out.println("All went fine.");
+ return true;
+ }
+
+ /**
+ * @param args
+ * @param callbackContext
+ * @return
+ */
+ private boolean getBrightness(JSONArray args, CallbackContext callbackContext) {
+ try {
+ Activity activity = cordova.getActivity();
+ WindowManager.LayoutParams layoutParams = activity.getWindow().getAttributes();
+ Double brightness = (double) layoutParams.screenBrightness;
+ callbackContext.success(brightness.toString());
+
+ } catch (NullPointerException e) {
+ System.out.println("Null pointer exception");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ }
+ System.out.println("All went fine.");
+ return true;
+ }
+ /**
+ * @param args
+ * @param callbackContext
+ * @return
+ */
+ private boolean setKeepScreenOn(JSONArray args, CallbackContext callbackContext){
+ try {
+ boolean value = args.getBoolean(0);
+ Activity activity = cordova.getActivity();
+ KeepOnTask task = new KeepOnTask();
+ task.setParams(activity.getWindow(), value);
+ activity.runOnUiThread(task);
+ callbackContext.success("OK");
+
+ } catch (NullPointerException e) {
+ System.out.println("Null pointer exception");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ } catch (JSONException e) {
+ System.out.println("JSONException");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ }
+ System.out.println("All went fine.");
+ return true;
+ }
+}
<?xml version='1.0' encoding='utf-8'?>
-<widget id="com.dalicitycard.app" version="1.0.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+<widget id="com.dalicitycard.app" version="1.0.5" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<feature name="Fingerprint">
<param name="android-package" value="de.niklasmerz.cordova.fingerprint.Fingerprint" />
</feature>
<feature name="AppVersion">
<param name="android-package" value="uk.co.whiteoctober.cordova.AppVersion" />
</feature>
+ <feature name="Brightness">
+ <param name="android-package" value="org.apache.cordova.plugin.Brightness.BrightnessPlugin" />
+ </feature>
<name short="大理市民卡">dlapp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
"clobbers": [
"cordova.getAppVersion"
]
+ },
+ {
+ "id": "cordova-plugin-brightness.Brightness",
+ "file": "plugins/cordova-plugin-brightness/www/brightness.js",
+ "pluginId": "cordova-plugin-brightness",
+ "clobbers": [
+ "cordova.plugins.brightness"
+ ]
}
];
module.exports.metadata = {
"cordova-plugin-jcore": "1.3.0",
"jpush-phonegap-plugin": "3.7.2",
"cordova-plugin-app-version": "0.1.9",
- "cordova-plugin-wkwebview-engine": "1.2.1"
+ "cordova-plugin-wkwebview-engine": "1.2.1",
+ "cordova-plugin-brightness": "0.1.5"
};
});
\ No newline at end of file
--- /dev/null
+cordova.define("cordova-plugin-brightness.Brightness", function(require, exports, module) {
+'use strict';
+
+var exec = require('cordova/exec');
+
+exports.getBrightness = function( success, error) {
+ exec(success, error, 'Brightness', 'getBrightness', []);
+};
+
+exports.setBrightness = function(value, success, error) {
+ exec(success, error, 'Brightness', 'setBrightness', [value]);
+};
+
+exports.setKeepScreenOn = function(value, success, error) {
+ exec(success, error, 'Brightness', 'setKeepScreenOn', [value]);
+};
+
+});
},
"cordova-plugin-wkwebview-engine": {
"PACKAGE_NAME": "com.supwisdom.dlapp"
+ },
+ "cordova-plugin-brightness": {
+ "PACKAGE_NAME": "com.dalicitycard.app"
}
},
"dependent_plugins": {},
"clobbers": [
"cordova.getAppVersion"
]
+ },
+ {
+ "file": "plugins/cordova-plugin-brightness/www/brightness.js",
+ "id": "cordova-plugin-brightness.Brightness",
+ "pluginId": "cordova-plugin-brightness",
+ "clobbers": [
+ "cordova.plugins.brightness"
+ ]
}
],
"plugin_metadata": {
"cordova-plugin-jcore": "1.3.0",
"jpush-phonegap-plugin": "3.7.2",
"cordova-plugin-app-version": "0.1.9",
- "cordova-plugin-wkwebview-engine": "1.2.1"
+ "cordova-plugin-wkwebview-engine": "1.2.1",
+ "cordova-plugin-brightness": "0.1.5"
}
}
"clobbers": [
"cordova.getAppVersion"
]
+ },
+ {
+ "file": "plugins/cordova-plugin-brightness/www/brightness.js",
+ "id": "cordova-plugin-brightness.Brightness",
+ "pluginId": "cordova-plugin-brightness",
+ "clobbers": [
+ "cordova.plugins.brightness"
+ ]
}
];
module.exports.metadata =
"cordova-plugin-jcore": "1.3.0",
"jpush-phonegap-plugin": "3.7.2",
"cordova-plugin-app-version": "0.1.9",
- "cordova-plugin-wkwebview-engine": "1.2.1"
+ "cordova-plugin-wkwebview-engine": "1.2.1",
+ "cordova-plugin-brightness": "0.1.5"
}
// BOTTOM OF METADATA
});
\ No newline at end of file
--- /dev/null
+cordova.define("cordova-plugin-brightness.Brightness", function(require, exports, module) { 'use strict';
+
+var exec = require('cordova/exec');
+
+exports.getBrightness = function( success, error) {
+ exec(success, error, 'Brightness', 'getBrightness', []);
+};
+
+exports.setBrightness = function(value, success, error) {
+ exec(success, error, 'Brightness', 'setBrightness', [value]);
+};
+
+exports.setKeepScreenOn = function(value, success, error) {
+ exec(success, error, 'Brightness', 'setKeepScreenOn', [value]);
+};
+
+});
};
objectVersion = 46;
objects = {
-
/* Begin PBXBuildFile section */
0207DA581B56EA530066E2B4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0207DA571B56EA530066E2B4 /* Images.xcassets */; };
04347BD0ABAC4EE0B4CDDDB6 /* jcore-ios-2.1.1.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 444DBF371D8346D7BC7EE35D /* jcore-ios-2.1.1.a */; };
F68EA21E51A3463A8FE2EE92 /* CDVWKWebViewUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B73EA28E46846FF84E6AF02 /* CDVWKWebViewUIDelegate.m */; };
F939AD8D22BB769B006B371B /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F939AD8C22BB769B006B371B /* libsqlite3.0.tbd */; };
FDE92C386167415E8040F8AB /* AFURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = FDEE8379D7A34C55A616F700 /* AFURLResponseSerialization.m */; };
+ C0A6FD40F47B434496535606 /* Brightness.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E4D2B8A1F474D9883C50B86 /* Brightness.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
FCC7E279D80D4FB9BCF2530A /* Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "Bridging-Header.h"; path = "cordova-plugin-fingerprint-aio/Bridging-Header.h"; sourceTree = "<group>"; };
FDEE8379D7A34C55A616F700 /* AFURLResponseSerialization.m */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.objc; name = AFURLResponseSerialization.m; path = "cordova-plugin-advanced-http/AFURLResponseSerialization.m"; sourceTree = "<group>"; };
FE0B455916A4481681D59FE0 /* WebKit.framework */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
+ 1E4D2B8A1F474D9883C50B86 /* Brightness.m */ = {isa = PBXFileReference; name = "Brightness.m"; path = "cordova-plugin-brightness/Brightness.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; };
+ 817A61F7D48245FA9567B115 /* Brightness.h */ = {isa = PBXFileReference; name = "Brightness.h"; path = "cordova-plugin-brightness/Brightness.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
648BD3182CD64A77AD2D447B /* CDVWKWebViewEngine.h */,
1E5CB6025B2E4D14ABFDB037 /* CDVWKWebViewUIDelegate.h */,
7DC7711D3C76485B9E422E3A /* CDVWKProcessPoolFactory.h */,
+ 1E4D2B8A1F474D9883C50B86 /* Brightness.m */,
+ 817A61F7D48245FA9567B115 /* Brightness.h */,
);
name = Plugins;
path = dlapp/Plugins;
562D29FCB1FB4F86B95BB2BC /* CDVWKWebViewEngine.m in Sources */,
F68EA21E51A3463A8FE2EE92 /* CDVWKWebViewUIDelegate.m in Sources */,
1F969D21D7EF4CF1A547A1DF /* CDVWKProcessPoolFactory.m in Sources */,
+ C0A6FD40F47B434496535606 /* Brightness.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
--- /dev/null
+/**
+ * @author Evgeniy Lukovsky
+ *
+ */
+
+
+#import <Cordova/CDV.h>
+
+@interface Brightness : CDVPlugin
+
+- (void)getBrightness:(CDVInvokedUrlCommand*)command;
+- (void)setBrightness:(CDVInvokedUrlCommand*)command;
+- (void)setKeepScreenOn:(CDVInvokedUrlCommand*)command;
+
+@end
--- /dev/null
+/**
+ * @author Evgeniy Lukovsky
+ *
+ */
+
+#import <UIKit/UIScreen.h>
+#import "Brightness.h"
+
+@implementation Brightness : CDVPlugin
+
+- (void)getBrightness:(CDVInvokedUrlCommand *)command
+{
+ CDVPluginResult * pluginResult = nil;
+ float brightness = [UIScreen mainScreen].brightness;
+ NSString *result = [NSString stringWithFormat:@"%f", brightness];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:result];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+- (void)setBrightness:(CDVInvokedUrlCommand *)command
+{
+ CDVPluginResult * pluginResult = nil;
+ NSString *value = [command.arguments objectAtIndex:0];
+ float brightness = [value floatValue];
+ [UIScreen mainScreen].brightness = brightness;
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+-(void)setKeepScreenOn:(CDVInvokedUrlCommand *)command
+{
+ CDVPluginResult* pluginResult = nil;
+ BOOL value = [[command.arguments objectAtIndex:0] boolValue];
+ [UIApplication sharedApplication].idleTimerDisabled = value;
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+@end
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
+ <feature name="Brightness">
+ <param name="ios-package" value="Brightness" />
+ </feature>
<name short="大理市民卡">dlapp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
"CoreFoundation.framework": 1,
"CoreTelephony.framework": 1,
"Foundation.framework": 1,
- "UIKit.framework": 1,
+ "UIKit.framework": 2,
"libz.tbd": 1,
"AdSupport.framework": 1,
"UserNotifications.framework": 1,
{
"xml": "<preference name=\"CordovaWebViewEngine\" value=\"CDVWKWebViewEngine\" />",
"count": 1
+ },
+ {
+ "xml": "<feature name=\"Brightness\"><param name=\"ios-package\" value=\"Brightness\" /></feature>",
+ "count": 1
}
]
}
},
"cordova-plugin-wkwebview-engine": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
+ },
+ "cordova-plugin-brightness": {
+ "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}
},
"dependent_plugins": {},
"clobbers": [
"window.WkWebView"
]
+ },
+ {
+ "id": "cordova-plugin-brightness.Brightness",
+ "file": "plugins/cordova-plugin-brightness/www/brightness.js",
+ "pluginId": "cordova-plugin-brightness",
+ "clobbers": [
+ "cordova.plugins.brightness"
+ ]
}
],
"plugin_metadata": {
"cordova-plugin-jcore": "1.3.0",
"jpush-phonegap-plugin": "3.7.2",
"cordova-plugin-app-version": "0.1.9",
- "cordova-plugin-wkwebview-engine": "1.2.1"
+ "cordova-plugin-wkwebview-engine": "1.2.1",
+ "cordova-plugin-brightness": "0.1.5"
}
}
"clobbers": [
"window.WkWebView"
]
+ },
+ {
+ "id": "cordova-plugin-brightness.Brightness",
+ "file": "plugins/cordova-plugin-brightness/www/brightness.js",
+ "pluginId": "cordova-plugin-brightness",
+ "clobbers": [
+ "cordova.plugins.brightness"
+ ]
}
];
module.exports.metadata = {
"cordova-plugin-jcore": "1.3.0",
"jpush-phonegap-plugin": "3.7.2",
"cordova-plugin-app-version": "0.1.9",
- "cordova-plugin-wkwebview-engine": "1.2.1"
+ "cordova-plugin-wkwebview-engine": "1.2.1",
+ "cordova-plugin-brightness": "0.1.5"
};
});
\ No newline at end of file
--- /dev/null
+cordova.define("cordova-plugin-brightness.Brightness", function(require, exports, module) {
+'use strict';
+
+var exec = require('cordova/exec');
+
+exports.getBrightness = function( success, error) {
+ exec(success, error, 'Brightness', 'getBrightness', []);
+};
+
+exports.setBrightness = function(value, success, error) {
+ exec(success, error, 'Brightness', 'setBrightness', [value]);
+};
+
+exports.setKeepScreenOn = function(value, success, error) {
+ exec(success, error, 'Brightness', 'setKeepScreenOn', [value]);
+};
+
+});
},
"cordova-plugin-wkwebview-engine": {
"PACKAGE_NAME": "com.dalicitycard.app"
+ },
+ "cordova-plugin-brightness": {
+ "PACKAGE_NAME": "com.dalicitycard.app"
}
},
"dependent_plugins": {
},
"cordova-plugin-wkwebview-engine": {
"PACKAGE_NAME": "com.supwisdom.dlapp"
+ },
+ "cordova-plugin-brightness": {
+ "PACKAGE_NAME": "com.dalicitycard.app"
}
},
"dependent_plugins": {
--- /dev/null
+{
+ "_from": "cordova-plugin-brightness",
+ "_id": "cordova-plugin-brightness@0.2.0",
+ "_inBundle": false,
+ "_integrity": "sha512-ujW4v58jArPxPf8CjEppl9hM2/9jep1+nflzAOGoT4yc5UIuLja6j6+wxK2fv6+UWqVEWEKB3JkfnijVUl6HjQ==",
+ "_location": "/cordova-plugin-brightness",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "tag",
+ "registry": true,
+ "raw": "cordova-plugin-brightness",
+ "name": "cordova-plugin-brightness",
+ "escapedName": "cordova-plugin-brightness",
+ "rawSpec": "",
+ "saveSpec": null,
+ "fetchSpec": "latest"
+ },
+ "_requiredBy": [
+ "#USER",
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/cordova-plugin-brightness/-/cordova-plugin-brightness-0.2.0.tgz",
+ "_shasum": "af2b57d5f8054828a54f86bd6886d015d00293bc",
+ "_spec": "cordova-plugin-brightness",
+ "_where": "/Users/shuwei/works2/cordova/dlapp",
+ "author": {
+ "name": "Evgeniy Lukovsky"
+ },
+ "bugs": {
+ "url": "https://github.com/mgcrea/cordova-plugin-brightness/issues"
+ },
+ "bundleDependencies": false,
+ "cordova": {
+ "id": "cordova-plugin-brightness",
+ "platforms": [
+ "ios"
+ ]
+ },
+ "deprecated": false,
+ "description": "Cordova Brightness Control Plugin",
+ "engines": [
+ {
+ "name": "cordova-ios",
+ "version": ">=3.6.0"
+ }
+ ],
+ "homepage": "https://github.com/mgcrea/cordova-plugin-brightness#readme",
+ "keywords": [
+ "cordova",
+ "unity",
+ "ecosystem:cordova",
+ "cordova-ios"
+ ],
+ "license": "MIT",
+ "name": "cordova-plugin-brightness",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/mgcrea/cordova-plugin-brightness.git"
+ },
+ "version": "0.2.0"
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+
+<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ id="cordova-plugin-brightness"
+ version="0.1.5">
+ <name>Brightness</name>
+
+ <author>Evgeniy Lukovsky</author>
+
+ <license>MIT</license>
+
+ <description>
+ This plugin gives you the ability to get and set the screen brightness
+ </description>
+
+ <js-module src="www/brightness.js" name="Brightness">
+ <clobbers target="cordova.plugins.brightness" />
+ </js-module>
+
+ <info>
+ This plugin gives you the ability to get and set the screen brightness. Also recently I have added the function for keep screen on.
+ </info>
+
+ <!-- android -->
+ <platform name="android">
+ <config-file target="res/xml/config.xml" parent="/*">
+ <feature name="Brightness">
+ <param name="android-package" value="org.apache.cordova.plugin.Brightness.BrightnessPlugin"/>
+ </feature>
+ </config-file>
+
+ <source-file src="src/android/BrightnessPlugin.java" target-dir="src/org/apache/cordova/plugin/Brightness" />
+
+ </platform>
+
+ <!-- ios -->
+ <platform name="ios">
+ <config-file target="config.xml" parent="/*">
+ <feature name="Brightness">
+ <param name="ios-package" value="Brightness" />
+ </feature>
+ </config-file>
+
+ <header-file src="src/ios/Brightness.h" />
+ <source-file src="src/ios/Brightness.m" />
+
+ <framework src="UIKit.framework" weak="true" />
+
+ </platform>
+
+</plugin>
--- /dev/null
+package org.apache.cordova.plugin.Brightness;
+
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.CordovaPlugin;
+import org.json.JSONArray;
+import org.json.JSONException;
+
+import android.app.Activity;
+import android.view.WindowManager.LayoutParams;
+import android.view.WindowManager;
+import android.view.Window;
+
+/**
+ * @author Evgeniy Lukovsky
+ *
+ */
+public class BrightnessPlugin extends CordovaPlugin {
+ public enum Action{
+ setBrightness,
+ getBrightness,
+ setKeepScreenOn
+ }
+
+ private class SetTask implements Runnable{
+ private Activity target = null;
+ private LayoutParams lp = null;
+ @Override
+ public void run() {
+ target.getWindow().setAttributes(lp);
+ }
+ public void setParams(Activity act, LayoutParams params){
+ this.target = act;
+ this.lp = params;
+ }
+ }
+
+ private class KeepOnTask implements Runnable{
+ private Window win = null;
+ private boolean state = false;
+ @Override
+ public void run() {
+ if(state){
+ win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ } else {
+ win.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ }
+ }
+ public void setParams(Window win, boolean state){
+ this.win = win;
+ this.state = state;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.cordova.CordovaPlugin#execute(java.lang.String, org.json.JSONArray, org.apache.cordova.CallbackContext)
+ */
+ @Override
+ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
+ System.out.println("plugin has been started");
+ boolean result = false;
+
+ switch(Action.valueOf(action)){
+ case setBrightness: result = true;
+ setBrightness(args, callbackContext);
+ break;
+ case getBrightness: result = true;
+ getBrightness(args, callbackContext);
+ break;
+ case setKeepScreenOn: result = true;
+ setKeepScreenOn(args, callbackContext);
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * @param args
+ * @param callbackContext
+ * @return
+ */
+ private boolean setBrightness(JSONArray args, CallbackContext callbackContext) {
+ try {
+ Activity activity = cordova.getActivity();
+ WindowManager.LayoutParams layoutParams = activity.getWindow().getAttributes();
+ String value = args.getString(0);
+ double brightness = Double.parseDouble(value);
+ layoutParams.screenBrightness = (float) brightness;
+ SetTask task = new SetTask();
+ task.setParams(activity, layoutParams);
+ activity.runOnUiThread(task);
+ callbackContext.success("OK");
+
+ } catch (NullPointerException e) {
+ System.out.println("Null pointer exception");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ } catch (JSONException e) {
+ System.out.println("JSONException exception");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ }
+ System.out.println("All went fine.");
+ return true;
+ }
+
+ /**
+ * @param args
+ * @param callbackContext
+ * @return
+ */
+ private boolean getBrightness(JSONArray args, CallbackContext callbackContext) {
+ try {
+ Activity activity = cordova.getActivity();
+ WindowManager.LayoutParams layoutParams = activity.getWindow().getAttributes();
+ Double brightness = (double) layoutParams.screenBrightness;
+ callbackContext.success(brightness.toString());
+
+ } catch (NullPointerException e) {
+ System.out.println("Null pointer exception");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ }
+ System.out.println("All went fine.");
+ return true;
+ }
+ /**
+ * @param args
+ * @param callbackContext
+ * @return
+ */
+ private boolean setKeepScreenOn(JSONArray args, CallbackContext callbackContext){
+ try {
+ boolean value = args.getBoolean(0);
+ Activity activity = cordova.getActivity();
+ KeepOnTask task = new KeepOnTask();
+ task.setParams(activity.getWindow(), value);
+ activity.runOnUiThread(task);
+ callbackContext.success("OK");
+
+ } catch (NullPointerException e) {
+ System.out.println("Null pointer exception");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ } catch (JSONException e) {
+ System.out.println("JSONException");
+ System.out.println(e.getMessage());
+ callbackContext.error(e.getMessage());
+ return false;
+ }
+ System.out.println("All went fine.");
+ return true;
+ }
+}
--- /dev/null
+/**
+ * @author Evgeniy Lukovsky
+ *
+ */
+
+
+#import <Cordova/CDV.h>
+
+@interface Brightness : CDVPlugin
+
+- (void)getBrightness:(CDVInvokedUrlCommand*)command;
+- (void)setBrightness:(CDVInvokedUrlCommand*)command;
+- (void)setKeepScreenOn:(CDVInvokedUrlCommand*)command;
+
+@end
--- /dev/null
+/**
+ * @author Evgeniy Lukovsky
+ *
+ */
+
+#import <UIKit/UIScreen.h>
+#import "Brightness.h"
+
+@implementation Brightness : CDVPlugin
+
+- (void)getBrightness:(CDVInvokedUrlCommand *)command
+{
+ CDVPluginResult * pluginResult = nil;
+ float brightness = [UIScreen mainScreen].brightness;
+ NSString *result = [NSString stringWithFormat:@"%f", brightness];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:result];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+- (void)setBrightness:(CDVInvokedUrlCommand *)command
+{
+ CDVPluginResult * pluginResult = nil;
+ NSString *value = [command.arguments objectAtIndex:0];
+ float brightness = [value floatValue];
+ [UIScreen mainScreen].brightness = brightness;
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+-(void)setKeepScreenOn:(CDVInvokedUrlCommand *)command
+{
+ CDVPluginResult* pluginResult = nil;
+ BOOL value = [[command.arguments objectAtIndex:0] boolValue];
+ [UIApplication sharedApplication].idleTimerDisabled = value;
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+@end
--- /dev/null
+'use strict';
+
+var exec = require('cordova/exec');
+
+exports.getBrightness = function( success, error) {
+ exec(success, error, 'Brightness', 'getBrightness', []);
+};
+
+exports.setBrightness = function(value, success, error) {
+ exec(success, error, 'Brightness', 'setBrightness', [value]);
+};
+
+exports.setKeepScreenOn = function(value, success, error) {
+ exec(success, error, 'Brightness', 'setKeepScreenOn', [value]);
+};
},
"is_top_level": true,
"variables": {}
+ },
+ "cordova-plugin-brightness": {
+ "source": {
+ "type": "registry",
+ "id": "cordova-plugin-brightness"
+ },
+ "is_top_level": true,
+ "variables": {}
}
}
\ No newline at end of file
},
"cordova-plugin-wkwebview-engine": {
"PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
+ },
+ "cordova-plugin-brightness": {
+ "PACKAGE_NAME": "$(PRODUCT_BUNDLE_IDENTIFIER)"
}
},
"dependent_plugins": {
+var brightness;
+var bvalue;
+var setted= false;
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},
-
onDeviceReady: function() {
var uid = window.localStorage.getItem("token");
- this.loadQrcode();
+ app.loadQrcode();
setInterval(function () {
window.location.reload();
},100000);
+
+ brightness = cordova.plugins.brightness;
+ if(brightness){
+ brightness.getBrightness(function(val){
+ bvalue = val;
+ }, function(err){
+ console.log(err);
+ });
+ }
},
loadQrcode: function() {
$.showLoading("加载中");
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.L
});
+ if(!setted&&brightness){
+ brightness.setBrightness(1, function(ret){
+ console.log(ret);
+ setted = true;
+ brightness.setKeepScreenOn(true);
+ }, function(e){
+ console.log(e)
+ });
+ }
} else {
$.hideLoading();
$.alert("请求失败,请稍后再试", "错误");
$.hideLoading();
var qrcode = new QRCode(document.getElementById("qrcode"), {
text: ret.qrcode,
- width: 150,
- height: 150,
+ width: 200,
+ height: 200,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.L
$.alert("请求失败了:" + ret.status + "请稍后再试", "错误");
}
})
+ },
+ backTo:function(){
+ if(brightness&&bvalue){
+ brightness.setBrightness(bvalue, function(ret){
+ brightness.setKeepScreenOn(false);
+ }, function(e){
+ console.log(e)
+ });
+ }
+ window,location.href='main.html';
}
};
app.initialize();
\ No newline at end of file
</head>
<body style="background: #fff" >
<header class="aui-bar aui-bar-nav" style="padding-top:25px;">
- <a class="aui-pull-left" href="main.html">
+ <a class="aui-pull-left" href="app.backTo()">
<span class="aui-iconfont aui-icon-left"></span>
</a>
<div class="aui-title">付款码</div>