<?xml version='1.0' encoding='utf-8'?>
-<widget id="com.dalipolice.app" version="1.0.7" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+<widget id="com.dalipolice.app" version="1.0.6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name short="大理智警">dlapp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
//you're running Android 4.3 and below in 2017
@SuppressLint("TrulyRandom")
int generateBridgeSecret() {
+ //新增
+ //-----------start-----------
+ // if (expectedBridgeSecret >= 0)
+ // return expectedBridgeSecret;
+ //----------end-----------
SecureRandom randGen = new SecureRandom();
expectedBridgeSecret = randGen.nextInt(Integer.MAX_VALUE);
return expectedBridgeSecret;
import android.view.View;
import android.webkit.ValueCallback;
+
+
/**
* Interface for all Cordova engines.
* No methods will be added to this class (in order to be compatible with existing engines).
CordovaWebView getCordovaWebView();
ICordovaCookieManager getCookieManager();
+ //CordovaBridge getCordovaBridge(); //新增
View getView();
void loadUrl(String url, boolean clearNavigationStack);
bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue);
exposeJsInterface(webView, bridge);
}
+ // 新增
+ //@Override
+ //public CordovaBridge getCordovaBridge(){
+ // return bridge;
+ //}
@Override
public CordovaWebView getCordovaWebView() {
abiFilters "armeabi"
}
versionCode 15
- versionName '1.4.2'
+ versionName '1.4.3'
targetSdkVersion 28
}
lintOptions {
delete cordova.callbacks[callbackId];
}
}
+ //新增
+ //-------------------start------------------
+ else {
+ // __globalBrowser为表示当前界面开启了InAppBrowser
+ if(window.__globalBrowser) {
+ var message = 'cordova.callbackFromNative("'+callbackId+'",'+isSuccess+',' + status +',' +JSON.stringify(args) + ',' + keepCallback + ')';
+ // 调用InAppBrowser插件里的js回传方法
+ window.__globalBrowser.executeScript({code: message});
+ }
+ }
+ //-------------------end------------------
} catch (err) {
var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
console && console.log && console.log(msg);
var app = {
+ // Application Constructor
+ initialize: function() {
+ this.initTab();
+ document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
+ document.addEventListener('jpush.receiveRegistrationId', function(event) {
+ console.log(event.registrationId)
+ }, false)
+ document.addEventListener("jpush.openNotification", function(event) {
+ var refno
+ console.log("openNotify:" + event);
+ if (device.platform == "Android") {
+ refno = event.extras.refno
+ } else {
+ refno = event.refno
+ window.JPush.setApplicationIconBadgeNumber(0);
+ }
+ app.openBill(refno);
+ console.log("openNotify:" + refno);
+ }, false)
+ },
+ openBill: function(billno) {
+ window.localStorage.setItem("currentrefno", billno);
+ window.location = 'billdetail.html';
+ },
+ initJpush: function() {
+ if (device.platform == "Android") {} else {
+ window.JPush.setApplicationIconBadgeNumber(0);
+ }
+ window.JPush.init();
+ window.JPush.setDebugMode(true);
+ window.JPush.isPushStopped(function(result) {
+ if (result == 0) {
+ //window.JPush.resumePush();
+ } else {
+ window.JPush.resumePush();
+ }
+ });
+ window.JPush.getUserNotificationSettings(function(result) {
+ if (result == 0) {} else if (result > 0) {}
+ });
+ var uid = window.localStorage.getItem("uid");
- // Application Constructor
- initialize: function() {
- this.initTab();
- document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
- document.addEventListener('jpush.receiveRegistrationId', function(event) {
- console.log(event.registrationId)
- }, false)
- document.addEventListener("jpush.openNotification", function (event) {
- var refno
- console.log("openNotify:"+event);
- if(device.platform == "Android") {
- refno = event.extras.refno
- } else {
- refno = event.refno
- window.JPush.setApplicationIconBadgeNumber(0);
- }
- app.openBill(refno);
- console.log("openNotify:"+refno);
- }, false)
- },
- openBill:function(billno){
- window.localStorage.setItem("currentrefno",billno);
- window.location='billdetail.html';
- },
- initJpush: function() {
- if(device.platform == "Android") {
- } else {
- window.JPush.setApplicationIconBadgeNumber(0);
- }
- window.JPush.init();
- window.JPush.setDebugMode(true);
- window.JPush.isPushStopped(function(result) {
- if (result == 0) {
- //window.JPush.resumePush();
- } else {
- window.JPush.resumePush();
- }
- });
- window.JPush.getUserNotificationSettings(function(result) {
- if(result == 0) {
- } else if(result > 0) {
- }
- });
- var uid = window.localStorage.getItem("uid");
+ window.JPush.setAlias({
+ sequence: 1,
+ alias: uid
+ },
+ (result) => {
+ var sequence = result.sequence
+ var alias = result.alias
+ //alert(JSON.stringify(result))
+ }, (error) => {
+ var sequence = error.sequence
+ var errorCode = error.code
+ //alert(JSON.stringify(error))
+ })
+ },
- window.JPush.setAlias({ sequence: 1, alias: uid },
- (result) => {
- var sequence = result.sequence
- var alias = result.alias
- //alert(JSON.stringify(result))
- }, (error) => {
- var sequence = error.sequence
- var errorCode = error.code
- //alert(JSON.stringify(error))
- })
- },
+ onDeviceReady: function() {
+ var uid = window.localStorage.getItem("token");
+ this.initJpush();
+ $('#scanBtn').click(function() {
+ //window.location = "scan.html";
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "scan.html";
+ })
+ })
+ });
+ $('#qrcodeBtn').click(function() {
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "qrcode.html";
+ })
+ })
+ });
+ $('#cardBtn').click(function() {
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "card.html";
+ })
+ })
+ });
+ $('#billBtn').click(function() {
+ app.checkBefore(function() {
+ window.location = "bill.html";
+ })
+ });
+ $('#moreBtn').click(function() {
+ app.checkBefore(function() {
+ window.location = "bill.html";
+ })
+ });
+ $('#secBtn').click(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() {
+ window.location = "security.html";
+ })
+ })
+ });
+ $('#accsignbtn').click(function() {
+ app.checkBefore(function() {
+ var signed = window.localStorage.getItem("signed");
+ var cum = new auiDialog({});
+ if (isEmpty(signed) || signed != 'yes') {
+ var confirm = cum.alert({
+ title: "提示",
+ msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
+ buttons: ['取消', '去签约']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ app.toSignCode();
+ }
+ })
+ } else {
+ window.location = 'signxycheck.html'
+ }
+ })
+ });
+ this.initData();
+ this.backBtn();
+ },
+ backBtn: function() {
+ document.addEventListener("backbutton", function(e) {
+ e.preventDefault();
+ navigator.app.exitApp();
+ }, false);
+ },
+ initTab: function() {
+ $("#maincontent").css("top", $("#maintop").height())
+ var tab = new auiTab({
+ element: document.getElementById("footer"),
+ }, function(ret) {
+ window.localStorage.setItem("tabindex", ret.index);
- onDeviceReady: function() {
- var uid = window.localStorage.getItem("token");
- this.initJpush();
- $('#scanBtn').click(function() {
- //window.location = "scan.html";
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "scan.html";
- })
- })
- });
- $('#qrcodeBtn').click(function() {
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "qrcode.html";
- })
- })
- });
- $('#cardBtn').click(function() {
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "card.html";
- })
- })
- });
- $('#billBtn').click(function() {
- app.checkBefore(function() {
- window.location = "bill.html";
- })
- });
- $('#moreBtn').click(function() {
- app.checkBefore(function() {
- window.location = "bill.html";
- })
- });
- $('#secBtn').click(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() {
- window.location = "security.html";
- })
- })
- });
- $('#accsignbtn').click(function() {
- app.checkBefore(function() {
- var signed = window.localStorage.getItem("signed");
- var cum = new auiDialog({});
- if (isEmpty(signed) || signed != 'yes') {
- var confirm = cum.alert({
- title: "提示",
- msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
- buttons: ['取消', '去签约']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- app.toSignCode();
- }
- })
- }else{
- window.location = 'signxycheck.html'
- }
- })
- });
- this.initData();
- this.backBtn();
- },
- backBtn: function(){
- document.addEventListener("backbutton", function(e){
- e.preventDefault();
- navigator.app.exitApp();
- }, false);
- },
- initTab: function() {
- $("#maincontent").css("top", $("#maintop").height())
- var tab = new auiTab({
- element: document.getElementById("footer"),
- }, function(ret) {
- window.localStorage.setItem("tabindex", ret.index);
+ changeTab(ret.index);
+ });
+ var tabindex = window.localStorage.getItem("tabindex");
+ if (!tabindex || tabindex == 0) {
+ tabindex = 1
+ }
+ changeTab(tabindex);
+ tab.setActive(tabindex)
- changeTab(ret.index);
- });
- var tabindex = window.localStorage.getItem("tabindex");
- if (!tabindex || tabindex == 0) {
- tabindex = 1
- }
- changeTab(tabindex);
- tab.setActive(tabindex)
+ function changeTab(index) {
+ if (index == 1) {
+ $("#main1").show();
+ $("#main2").hide();
+ } else if (index == 2) {
+ $("#main1").hide();
+ $("#main2").show();
+ }
+ }
+ },
+ initData: function() {
+ this.loadBill()
+ },
+ loadBill: function() {
+ $("#loaddata").show()
+ $("#nodata").hide();
+ var param = {
+ "pageno": 1,
+ "platform": device.platform
+ }
+ V1Bills(param, function(ok, ret) {
+ if (ok) {
+ console.log(ret)
+ if (ret.code == 200) {
+ app.checkVersion(ret.version, ret.minversion, ret.versionmsg, ret.versionurl);
+ //app.checkVersion("1.3.9","1","new func","https://shouji.baidu.com/software/26706357.html");
+ $("#maingt").text(ret.t + "!")
+ $("#user-amount").text(ret.amount)
+ $("#user-point").text(ret.point)
+ if (ret.needrebind) {
+ window.localStorage.removeItem("userid");
+ } else {
+ window.localStorage.setItem("userid", ret.userid);
+ }
+ window.localStorage.setItem("signed", ret.signed);
+ window.localStorage.setItem("paypwdset", ret.paypwdset);
+ window.localStorage.setItem("name", ret.name);
+ if (ret.page && ret.page.count > 0) {
+ GLOBAL_TODAY = ret.today;
+ GLOBAL_YESTERDAY = ret.yesterday;
+ app.initBillView(ret.page)
+ app.initView();
+ } else {
+ $("#loaddata").hide()
+ $("#nodatahint").text("暂无数据")
+ $("#nodata").show();
+ app.initView();
+ }
+ } else {
+ $("#loaddata").hide()
+ $("#nodatahint").text("数据加载异常")
+ $("#nodata").show();
+ app.initView();
+ }
+ } else {
+ $("#loaddata").hide()
+ $("#nodatahint").text("请求数据失败")
+ $("#nodata").show();
+ app.initView();
+ }
+ })
+ },
+ checkVersion: function(ver, minver, m, url) {
+ cordova.getAppVersion.getVersionNumber(function(version) {
+ //alert(version);
+ //alert(version);
+ if (ver > version) {
+ var cum = new auiDialog({});
+ var confirm = cum.alert({
+ title: "有新的版本",
+ msg: m,
+ buttons: ['取消', '去更新']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ cordova.InAppBrowser.open(url, '_system',
+ 'location=no,toolbar=yes,toolbarposition=top,closebuttoncaption=关闭');
+ }
+ })
+ }
+ });
+ },
+ initBillView: function(page) {
+ var html = '';
+ for (var i = 0; i < page.data.length; i++) {
+ var bean = page.data[i]
+ html += '<div class="aui-card-list-header aui-card-list-user" onclick="app.toBillDetail(\'' + bean.refno + '\')">';
+ html +=
+ '<div class="aui-card-list-user-avatar"><img src="img/icon_meal.png" class="aui-margin-r-10 aui-img-round" />';
+ html += '</div><div class="aui-card-list-user-name">';
+ html += '<div>' + bean.transdesc + '</div>';
+ if (bean.tradeflag == 'in') {
+ html += '<div class="aui-list-item-right">+' + bean.amount + '</div>';
+ } else {
+ html += '<div class="aui-list-item-right">' + bean.amount + '</div>';
+ }
+ html += '</div><div class="aui-card-list-user-info">' + formatDateNoYear(bean.transdate, bean.transtime) +
+ '</div></div>';
+ }
+ $("#billcontent").html(html);
+ $("#loaddata").hide()
+ $("#nodata").hide();
+ $("#billcontent").show();
- function changeTab(index) {
- if (index == 1) {
- $("#main1").show();
- $("#main2").hide();
- } else if (index == 2) {
- $("#main1").hide();
- $("#main2").show();
- }
- }
- },
- initData: function() {
- this.loadBill()
- },
- loadBill: function() {
- $("#loaddata").show()
- $("#nodata").hide();
- var param = {
- "pageno": 1,
- "platform":device.platform
- }
- V1Bills(param, function(ok, ret) {
- if (ok) {
- console.log(ret)
- if (ret.code == 200) {
- app.checkVersion(ret.version,ret.minversion,ret.versionmsg,ret.versionurl);
- //app.checkVersion("1.3.9","1","new func","https://shouji.baidu.com/software/26706357.html");
- $("#maingt").text(ret.t + "!")
- $("#user-amount").text(ret.amount)
- $("#user-point").text(ret.point)
- if (ret.needrebind) {
- window.localStorage.removeItem("userid");
- } else {
- window.localStorage.setItem("userid", ret.userid);
- }
- window.localStorage.setItem("signed", ret.signed);
- window.localStorage.setItem("paypwdset", ret.paypwdset);
- window.localStorage.setItem("name", ret.name);
- if (ret.page && ret.page.count > 0) {
- GLOBAL_TODAY = ret.today;
- GLOBAL_YESTERDAY = ret.yesterday;
- app.initBillView(ret.page)
- app.initView();
- } else {
- $("#loaddata").hide()
- $("#nodatahint").text("暂无数据")
- $("#nodata").show();
- app.initView();
- }
- } else {
- $("#loaddata").hide()
- $("#nodatahint").text("数据加载异常")
- $("#nodata").show();
- app.initView();
- }
- } else {
- $("#loaddata").hide()
- $("#nodatahint").text("请求数据失败")
- $("#nodata").show();
- app.initView();
- }
- })
- },
- checkVersion:function(ver,minver,m,url){
- cordova.getAppVersion.getVersionNumber(function (version) {
- //alert(version);
- //alert(version);
- if(ver>version){
- var cum = new auiDialog({});
- var confirm = cum.alert({
- title: "有新的版本",
- msg: m,
- buttons: ['取消', '去更新']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- cordova.InAppBrowser.open(url, '_system', 'location=no,toolbar=yes,toolbarposition=top,closebuttoncaption=关闭');
- }
- })
- }
- });
- },
- initBillView: function(page) {
- var html = '';
- for (var i = 0; i < page.data.length; i++) {
- var bean = page.data[i]
- html += '<div class="aui-card-list-header aui-card-list-user" onclick="app.toBillDetail(\'' + bean.refno + '\')">';
- html += '<div class="aui-card-list-user-avatar"><img src="img/icon_meal.png" class="aui-margin-r-10 aui-img-round" />';
- html += '</div><div class="aui-card-list-user-name">';
- html += '<div>' + bean.transdesc + '</div>';
- if (bean.tradeflag == 'in') {
- html += '<div class="aui-list-item-right">+' + bean.amount + '</div>';
- } else {
- html += '<div class="aui-list-item-right">' + bean.amount + '</div>';
- }
- html += '</div><div class="aui-card-list-user-info">' + formatDateNoYear(bean.transdate, bean.transtime) + '</div></div>';
- }
- $("#billcontent").html(html);
- $("#loaddata").hide()
- $("#nodata").hide();
- $("#billcontent").show();
+ },
+ initView: function() {
+ var userid = window.localStorage.getItem("userid");
+ var signed = window.localStorage.getItem("signed");
+ if (isEmpty(userid)) {
+ $("#userbank").text("未绑定");
+ $("#userbank").css("color", "red")
+ } else {
+ $("#userbank").text("已绑定");
+ $("userbank").css("color", "#757575");
+ }
+ if (isEmpty(signed) || signed != 'yes') {
+ $("#usersign").text("未签约");
+ $("#usersign").css("color", "red")
+ } else {
+ $("#usersign").text("已签约");
+ $("usersign").css("color", "#757575");
+ }
+ var phone = window.localStorage.getItem("phoneX");
+ if (!isEmpty(phone)) {
+ $("#userphone").text(phone)
+ }
+ var name = window.localStorage.getItem("name");
+ if (isEmpty(name)) {
+ $("#username").text("匿名")
+ } else {
+ $("#username").text(name)
+ $("#homename").text(name)
+ }
+ },
+ checkBefore: function(callback) {
+ var uid = window.localStorage.getItem("token");
+ if (isEmpty(uid)) {
+ window.location = "login.html";
+ } else {
+ var userid = window.localStorage.getItem("userid");
+ if (isEmpty(userid)) {
+ var cum = new auiDialog({});
+ var confirm = cum.alert({
+ title: "提示",
+ msg: '为了不影响您正常使用相关功能,请先绑定银行卡',
+ buttons: ['取消', '去绑卡']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ window.location = 'bindcard.html'
+ }
+ })
+ } else {
+ if (callback) {
+ callback()
+ }
+ }
+ }
+ },
+ checkOther: function(callback) {
+ var signed = window.localStorage.getItem("signed");
+ var cum = new auiDialog({});
- },
- initView: function() {
- var userid = window.localStorage.getItem("userid");
- var signed = window.localStorage.getItem("signed");
- if (isEmpty(userid)) {
- $("#userbank").text("未绑定");
- $("#userbank").css("color", "red")
- } else {
- $("#userbank").text("已绑定");
- $("userbank").css("color", "#757575");
- }
- if (isEmpty(signed) || signed != 'yes') {
- $("#usersign").text("未签约");
- $("#usersign").css("color", "red")
- } else {
- $("#usersign").text("已签约");
- $("usersign").css("color", "#757575");
- }
- var phone = window.localStorage.getItem("phoneX");
- if (!isEmpty(phone)) {
- $("#userphone").text(phone)
- }
- var name = window.localStorage.getItem("name");
- if (isEmpty(name)) {
- $("#username").text("匿名")
- } else {
- $("#username").text(name)
- $("#homename").text(name)
- }
- },
- checkBefore: function(callback) {
- var uid = window.localStorage.getItem("token");
- if (isEmpty(uid)) {
- window.location = "login.html";
- } else {
- var userid = window.localStorage.getItem("userid");
- if (isEmpty(userid)) {
- var cum = new auiDialog({});
- var confirm = cum.alert({
- title: "提示",
- msg: '为了不影响您正常使用相关功能,请先绑定银行卡',
- buttons: ['取消', '去绑卡']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- window.location = 'bindcard.html'
- }
- })
- } else {
- if (callback) {
- callback()
- }
- }
- }
- },
- checkOther: function(callback) {
- var signed = window.localStorage.getItem("signed");
- var cum = new auiDialog({});
-
- if (isEmpty(signed) || signed != 'yes') {
- var confirm = cum.alert({
- title: "提示",
- msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
- buttons: ['取消', '去签约']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- app.toSignCode();
- }
- })
- } else {
- if (callback) {
- callback()
- }
- }
- },
- toSignCode: function(){
- var param = {
- }
- V1Bindcardcode(param, function(ok, ret) {
- if (ok) {
- if (ret.code == 200) {
- window.location = 'bindcheck.html'
- } else {
- $.alert(ret.msg, "错误");
- }
- } else {
- $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
- }
- })
- },
- toSign: function() {
- window.location = 'signxycheck.html'
- },
- toBillDetail: function(refno) {
- window.localStorage.setItem("currentrefno", refno);
- window.location = 'billdetail.html';
- },
- toCard: function() {
- var userid = window.localStorage.getItem("userid");
- if (isEmpty(userid)) {
- window.location = 'bindcard.html'
- } else {
- window.location = 'cardinfor.html'
- }
- },
- logout:function(){
- window.localStorage.removeItem("token");
- window.location = "login.html";
- }
+ if (isEmpty(signed) || signed != 'yes') {
+ var confirm = cum.alert({
+ title: "提示",
+ msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
+ buttons: ['取消', '去签约']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ app.toSignCode();
+ }
+ })
+ } else {
+ if (callback) {
+ callback()
+ }
+ }
+ },
+ toSignCode: function() {
+ var param = {}
+ V1Bindcardcode(param, function(ok, ret) {
+ if (ok) {
+ if (ret.code == 200) {
+ window.location = 'bindcheck.html'
+ } else {
+ $.alert(ret.msg, "错误");
+ }
+ } else {
+ $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
+ }
+ })
+ },
+ toSign: function() {
+ window.location = 'signxycheck.html'
+ },
+ toBillDetail: function(refno) {
+ window.localStorage.setItem("currentrefno", refno);
+ window.location = 'billdetail.html';
+ },
+ toCard: function() {
+ var userid = window.localStorage.getItem("userid");
+ if (isEmpty(userid)) {
+ window.location = 'bindcard.html'
+ } 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"
- });
- }
+ 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'
+ },
+ // menu: {
+ // image: 'share.png',
+ // imagePressed: 'share.png',
+ // align: 'right',
+ // items: [{
+ // event: 'shareQQ',
+ // label: '分享至QQ好友'
+ // },
+ // {
+ // event: 'shareWX',
+ // label: '分享至微信好友'
+ // }
+ // ]
+ // },
+ backButtonCanClose: true
+ }).addEventListener('closePressed', function(params) {
+ inAppBrowserRef.close();
+ //window.location = "main.html"
+ })
+ // .addEventListener('shareQQ', function(e) {
+ // // alert(1)
+ // var args = {};
+ // args.client = QQSDK.ClientType.QQ; //QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;
+ // args.scene = QQSDK.Scene.QQ; //QQSDK.Scene.QQZone,QQSDK.Scene.Favorite
+ // args.url = 'https://yy.dlsmk.cn/wisdompolice/app/getapplyqrcode?visitorid=' + vistorId;
+ // args.title = '大理APP';
+ // args.description = '访客二维码';
+ // // args.image = 'https://cordova.apache.org/static/img/cordova_bot.png';
+ // QQSDK.shareNews(function() {
+ // alert('分享成功');
+ // }, function(failReason) {
+ // alert(failReason);
+ // }, args);
+ // }).addEventListener('shareWX', function(e) {
+ // // alert(2)
+ // Wechat.share({
+ // message: {
+ // title: "大理App分享",
+ // description: "访客二维码",
+ // thumb: "www/img/thumbnail.png",
+ // media: {
+ // type: Wechat.Type.WEBPAGE,
+ // webpageUrl: 'https://yy.dlsmk.cn/wisdompolice/app/getapplyqrcode?visitorid=' + vistorId
+ // }
+ // },
+ // scene: Wechat.Scene.SESSION // share to Timeline
+ // }, function() {
+ // alert("分享成功");
+ // }, function(reason) {
+ // alert("Failed: " + reason);
+ // });
+ // });
+}
</div>
</li>
</ul>
- <ul class="aui-list aui-list-in">
+ <!-- <ul class="aui-list aui-list-in">
<li class="aui-list-item" id="shareqq">
<div class="aui-list-item-label-icon">
<i class="aui-iconfont aui-icon-info aui-text-info"></i>
</div>
</div>
</li>
- </ul>
+ </ul> -->
<div style="padding: 20px;margin-top: 40px;">
<a href="javascript:app.logout();" class="weui-btn weui-btn_warn">退出登录</a>
</div>
<script type="text/javascript" src="js/lib/aui-slide.js"></script>
<script type="text/javascript" src="js/server.js"></script>
<script type="text/javascript" src="js/mainmenu.js"></script>
- <script type="text/javascript">
+ <!-- <script type="text/javascript">
var shareqq = document.getElementById("shareqq");
var sharewx = document.getElementById("sharewx");
shareqq.onclick = function() {
alert("Failed: " + reason);
});
}
- </script>
+ </script> -->
</html>
strWindowFeatures = strWindowFeatures || '';
exec(cb, cb, 'InAppBrowser', 'open', [strUrl, strWindowName, strWindowFeatures]);
- return iab;
+ //新增
+ // 声明全局变量__globalBrowser,表示当前界面开启了InAppBrowser
+ //-----------------start--------------
+ // window.__globalBrowser = iab;
+ //-----------------end--------------
+ return iab;
};
})();
@SuppressLint("SetJavaScriptEnabled")
public class InAppBrowser extends CordovaPlugin {
+ //改造
+ private static final String NATIVE_JS_PREFIX = "https://native-js/";
private static final String NULL = "null";
protected static final String LOG_TAG = "InAppBrowser";
} catch (JSONException ex) {
LOG.d(LOG_TAG, "Should never happen");
}
+ //新增
+ //-------------------------satrt------------------------------------
+ // String jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)";
+ //在InAppBrowser WebView中注入一个对象(脚本或样式)。
+ // injectDeferredObject(NATIVE_JS_PREFIX + "cordova.js", jsWrapper);
+ //---------------------------end---------------------------------
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
delete cordova.callbacks[callbackId];
}
}
+ //新增
+ //-------------------start------------------
+ else {
+ // __globalBrowser为表示当前界面开启了InAppBrowser
+ if(window.__globalBrowser) {
+ var message = 'cordova.callbackFromNative("'+callbackId+'",'+isSuccess+',' + status +',' +JSON.stringify(args) + ',' + keepCallback + ')';
+ // 调用InAppBrowser插件里的js回传方法
+ window.__globalBrowser.executeScript({code: message});
+ }
+ }
+ //-------------------end------------------
} catch (err) {
var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
console && console.log && console.log(msg);
strWindowFeatures = strWindowFeatures || '';
exec(cb, cb, 'InAppBrowser', 'open', [strUrl, strWindowName, strWindowFeatures]);
- return iab;
+ //新增
+ // 声明全局变量__globalBrowser,表示当前界面开启了InAppBrowser
+ //-----------------start--------------
+ // window.__globalBrowser = iab;
+ //-----------------end--------------
+ return iab;
};
})();
var app = {
+ // Application Constructor
+ initialize: function() {
+ this.initTab();
+ document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
+ document.addEventListener('jpush.receiveRegistrationId', function(event) {
+ console.log(event.registrationId)
+ }, false)
+ document.addEventListener("jpush.openNotification", function(event) {
+ var refno
+ console.log("openNotify:" + event);
+ if (device.platform == "Android") {
+ refno = event.extras.refno
+ } else {
+ refno = event.refno
+ window.JPush.setApplicationIconBadgeNumber(0);
+ }
+ app.openBill(refno);
+ console.log("openNotify:" + refno);
+ }, false)
+ },
+ openBill: function(billno) {
+ window.localStorage.setItem("currentrefno", billno);
+ window.location = 'billdetail.html';
+ },
+ initJpush: function() {
+ if (device.platform == "Android") {} else {
+ window.JPush.setApplicationIconBadgeNumber(0);
+ }
+ window.JPush.init();
+ window.JPush.setDebugMode(true);
+ window.JPush.isPushStopped(function(result) {
+ if (result == 0) {
+ //window.JPush.resumePush();
+ } else {
+ window.JPush.resumePush();
+ }
+ });
+ window.JPush.getUserNotificationSettings(function(result) {
+ if (result == 0) {} else if (result > 0) {}
+ });
+ var uid = window.localStorage.getItem("uid");
- // Application Constructor
- initialize: function() {
- this.initTab();
- document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
- document.addEventListener('jpush.receiveRegistrationId', function(event) {
- console.log(event.registrationId)
- }, false)
- document.addEventListener("jpush.openNotification", function (event) {
- var refno
- console.log("openNotify:"+event);
- if(device.platform == "Android") {
- refno = event.extras.refno
- } else {
- refno = event.refno
- window.JPush.setApplicationIconBadgeNumber(0);
- }
- app.openBill(refno);
- console.log("openNotify:"+refno);
- }, false)
- },
- openBill:function(billno){
- window.localStorage.setItem("currentrefno",billno);
- window.location='billdetail.html';
- },
- initJpush: function() {
- if(device.platform == "Android") {
- } else {
- window.JPush.setApplicationIconBadgeNumber(0);
- }
- window.JPush.init();
- window.JPush.setDebugMode(true);
- window.JPush.isPushStopped(function(result) {
- if (result == 0) {
- //window.JPush.resumePush();
- } else {
- window.JPush.resumePush();
- }
- });
- window.JPush.getUserNotificationSettings(function(result) {
- if(result == 0) {
- } else if(result > 0) {
- }
- });
- var uid = window.localStorage.getItem("uid");
+ window.JPush.setAlias({
+ sequence: 1,
+ alias: uid
+ },
+ (result) => {
+ var sequence = result.sequence
+ var alias = result.alias
+ //alert(JSON.stringify(result))
+ }, (error) => {
+ var sequence = error.sequence
+ var errorCode = error.code
+ //alert(JSON.stringify(error))
+ })
+ },
- window.JPush.setAlias({ sequence: 1, alias: uid },
- (result) => {
- var sequence = result.sequence
- var alias = result.alias
- //alert(JSON.stringify(result))
- }, (error) => {
- var sequence = error.sequence
- var errorCode = error.code
- //alert(JSON.stringify(error))
- })
- },
+ onDeviceReady: function() {
+ var uid = window.localStorage.getItem("token");
+ this.initJpush();
+ $('#scanBtn').click(function() {
+ //window.location = "scan.html";
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "scan.html";
+ })
+ })
+ });
+ $('#qrcodeBtn').click(function() {
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "qrcode.html";
+ })
+ })
+ });
+ $('#cardBtn').click(function() {
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "card.html";
+ })
+ })
+ });
+ $('#billBtn').click(function() {
+ app.checkBefore(function() {
+ window.location = "bill.html";
+ })
+ });
+ $('#moreBtn').click(function() {
+ app.checkBefore(function() {
+ window.location = "bill.html";
+ })
+ });
+ $('#secBtn').click(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() {
+ window.location = "security.html";
+ })
+ })
+ });
+ $('#accsignbtn').click(function() {
+ app.checkBefore(function() {
+ var signed = window.localStorage.getItem("signed");
+ var cum = new auiDialog({});
+ if (isEmpty(signed) || signed != 'yes') {
+ var confirm = cum.alert({
+ title: "提示",
+ msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
+ buttons: ['取消', '去签约']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ app.toSignCode();
+ }
+ })
+ } else {
+ window.location = 'signxycheck.html'
+ }
+ })
+ });
+ this.initData();
+ this.backBtn();
+ },
+ backBtn: function() {
+ document.addEventListener("backbutton", function(e) {
+ e.preventDefault();
+ navigator.app.exitApp();
+ }, false);
+ },
+ initTab: function() {
+ $("#maincontent").css("top", $("#maintop").height())
+ var tab = new auiTab({
+ element: document.getElementById("footer"),
+ }, function(ret) {
+ window.localStorage.setItem("tabindex", ret.index);
- onDeviceReady: function() {
- var uid = window.localStorage.getItem("token");
- this.initJpush();
- $('#scanBtn').click(function() {
- //window.location = "scan.html";
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "scan.html";
- })
- })
- });
- $('#qrcodeBtn').click(function() {
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "qrcode.html";
- })
- })
- });
- $('#cardBtn').click(function() {
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "card.html";
- })
- })
- });
- $('#billBtn').click(function() {
- app.checkBefore(function() {
- window.location = "bill.html";
- })
- });
- $('#moreBtn').click(function() {
- app.checkBefore(function() {
- window.location = "bill.html";
- })
- });
- $('#secBtn').click(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() {
- window.location = "security.html";
- })
- })
- });
- $('#accsignbtn').click(function() {
- app.checkBefore(function() {
- var signed = window.localStorage.getItem("signed");
- var cum = new auiDialog({});
- if (isEmpty(signed) || signed != 'yes') {
- var confirm = cum.alert({
- title: "提示",
- msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
- buttons: ['取消', '去签约']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- app.toSignCode();
- }
- })
- }else{
- window.location = 'signxycheck.html'
- }
- })
- });
- this.initData();
- this.backBtn();
- },
- backBtn: function(){
- document.addEventListener("backbutton", function(e){
- e.preventDefault();
- navigator.app.exitApp();
- }, false);
- },
- initTab: function() {
- $("#maincontent").css("top", $("#maintop").height())
- var tab = new auiTab({
- element: document.getElementById("footer"),
- }, function(ret) {
- window.localStorage.setItem("tabindex", ret.index);
+ changeTab(ret.index);
+ });
+ var tabindex = window.localStorage.getItem("tabindex");
+ if (!tabindex || tabindex == 0) {
+ tabindex = 1
+ }
+ changeTab(tabindex);
+ tab.setActive(tabindex)
- changeTab(ret.index);
- });
- var tabindex = window.localStorage.getItem("tabindex");
- if (!tabindex || tabindex == 0) {
- tabindex = 1
- }
- changeTab(tabindex);
- tab.setActive(tabindex)
+ function changeTab(index) {
+ if (index == 1) {
+ $("#main1").show();
+ $("#main2").hide();
+ } else if (index == 2) {
+ $("#main1").hide();
+ $("#main2").show();
+ }
+ }
+ },
+ initData: function() {
+ this.loadBill()
+ },
+ loadBill: function() {
+ $("#loaddata").show()
+ $("#nodata").hide();
+ var param = {
+ "pageno": 1,
+ "platform": device.platform
+ }
+ V1Bills(param, function(ok, ret) {
+ if (ok) {
+ console.log(ret)
+ if (ret.code == 200) {
+ app.checkVersion(ret.version, ret.minversion, ret.versionmsg, ret.versionurl);
+ //app.checkVersion("1.3.9","1","new func","https://shouji.baidu.com/software/26706357.html");
+ $("#maingt").text(ret.t + "!")
+ $("#user-amount").text(ret.amount)
+ $("#user-point").text(ret.point)
+ if (ret.needrebind) {
+ window.localStorage.removeItem("userid");
+ } else {
+ window.localStorage.setItem("userid", ret.userid);
+ }
+ window.localStorage.setItem("signed", ret.signed);
+ window.localStorage.setItem("paypwdset", ret.paypwdset);
+ window.localStorage.setItem("name", ret.name);
+ if (ret.page && ret.page.count > 0) {
+ GLOBAL_TODAY = ret.today;
+ GLOBAL_YESTERDAY = ret.yesterday;
+ app.initBillView(ret.page)
+ app.initView();
+ } else {
+ $("#loaddata").hide()
+ $("#nodatahint").text("暂无数据")
+ $("#nodata").show();
+ app.initView();
+ }
+ } else {
+ $("#loaddata").hide()
+ $("#nodatahint").text("数据加载异常")
+ $("#nodata").show();
+ app.initView();
+ }
+ } else {
+ $("#loaddata").hide()
+ $("#nodatahint").text("请求数据失败")
+ $("#nodata").show();
+ app.initView();
+ }
+ })
+ },
+ checkVersion: function(ver, minver, m, url) {
+ cordova.getAppVersion.getVersionNumber(function(version) {
+ //alert(version);
+ //alert(version);
+ if (ver > version) {
+ var cum = new auiDialog({});
+ var confirm = cum.alert({
+ title: "有新的版本",
+ msg: m,
+ buttons: ['取消', '去更新']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ cordova.InAppBrowser.open(url, '_system',
+ 'location=no,toolbar=yes,toolbarposition=top,closebuttoncaption=关闭');
+ }
+ })
+ }
+ });
+ },
+ initBillView: function(page) {
+ var html = '';
+ for (var i = 0; i < page.data.length; i++) {
+ var bean = page.data[i]
+ html += '<div class="aui-card-list-header aui-card-list-user" onclick="app.toBillDetail(\'' + bean.refno + '\')">';
+ html +=
+ '<div class="aui-card-list-user-avatar"><img src="img/icon_meal.png" class="aui-margin-r-10 aui-img-round" />';
+ html += '</div><div class="aui-card-list-user-name">';
+ html += '<div>' + bean.transdesc + '</div>';
+ if (bean.tradeflag == 'in') {
+ html += '<div class="aui-list-item-right">+' + bean.amount + '</div>';
+ } else {
+ html += '<div class="aui-list-item-right">' + bean.amount + '</div>';
+ }
+ html += '</div><div class="aui-card-list-user-info">' + formatDateNoYear(bean.transdate, bean.transtime) +
+ '</div></div>';
+ }
+ $("#billcontent").html(html);
+ $("#loaddata").hide()
+ $("#nodata").hide();
+ $("#billcontent").show();
- function changeTab(index) {
- if (index == 1) {
- $("#main1").show();
- $("#main2").hide();
- } else if (index == 2) {
- $("#main1").hide();
- $("#main2").show();
- }
- }
- },
- initData: function() {
- this.loadBill()
- },
- loadBill: function() {
- $("#loaddata").show()
- $("#nodata").hide();
- var param = {
- "pageno": 1,
- "platform":device.platform
- }
- V1Bills(param, function(ok, ret) {
- if (ok) {
- console.log(ret)
- if (ret.code == 200) {
- app.checkVersion(ret.version,ret.minversion,ret.versionmsg,ret.versionurl);
- //app.checkVersion("1.3.9","1","new func","https://shouji.baidu.com/software/26706357.html");
- $("#maingt").text(ret.t + "!")
- $("#user-amount").text(ret.amount)
- $("#user-point").text(ret.point)
- if (ret.needrebind) {
- window.localStorage.removeItem("userid");
- } else {
- window.localStorage.setItem("userid", ret.userid);
- }
- window.localStorage.setItem("signed", ret.signed);
- window.localStorage.setItem("paypwdset", ret.paypwdset);
- window.localStorage.setItem("name", ret.name);
- if (ret.page && ret.page.count > 0) {
- GLOBAL_TODAY = ret.today;
- GLOBAL_YESTERDAY = ret.yesterday;
- app.initBillView(ret.page)
- app.initView();
- } else {
- $("#loaddata").hide()
- $("#nodatahint").text("暂无数据")
- $("#nodata").show();
- app.initView();
- }
- } else {
- $("#loaddata").hide()
- $("#nodatahint").text("数据加载异常")
- $("#nodata").show();
- app.initView();
- }
- } else {
- $("#loaddata").hide()
- $("#nodatahint").text("请求数据失败")
- $("#nodata").show();
- app.initView();
- }
- })
- },
- checkVersion:function(ver,minver,m,url){
- cordova.getAppVersion.getVersionNumber(function (version) {
- //alert(version);
- //alert(version);
- if(ver>version){
- var cum = new auiDialog({});
- var confirm = cum.alert({
- title: "有新的版本",
- msg: m,
- buttons: ['取消', '去更新']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- cordova.InAppBrowser.open(url, '_system', 'location=no,toolbar=yes,toolbarposition=top,closebuttoncaption=关闭');
- }
- })
- }
- });
- },
- initBillView: function(page) {
- var html = '';
- for (var i = 0; i < page.data.length; i++) {
- var bean = page.data[i]
- html += '<div class="aui-card-list-header aui-card-list-user" onclick="app.toBillDetail(\'' + bean.refno + '\')">';
- html += '<div class="aui-card-list-user-avatar"><img src="img/icon_meal.png" class="aui-margin-r-10 aui-img-round" />';
- html += '</div><div class="aui-card-list-user-name">';
- html += '<div>' + bean.transdesc + '</div>';
- if (bean.tradeflag == 'in') {
- html += '<div class="aui-list-item-right">+' + bean.amount + '</div>';
- } else {
- html += '<div class="aui-list-item-right">' + bean.amount + '</div>';
- }
- html += '</div><div class="aui-card-list-user-info">' + formatDateNoYear(bean.transdate, bean.transtime) + '</div></div>';
- }
- $("#billcontent").html(html);
- $("#loaddata").hide()
- $("#nodata").hide();
- $("#billcontent").show();
+ },
+ initView: function() {
+ var userid = window.localStorage.getItem("userid");
+ var signed = window.localStorage.getItem("signed");
+ if (isEmpty(userid)) {
+ $("#userbank").text("未绑定");
+ $("#userbank").css("color", "red")
+ } else {
+ $("#userbank").text("已绑定");
+ $("userbank").css("color", "#757575");
+ }
+ if (isEmpty(signed) || signed != 'yes') {
+ $("#usersign").text("未签约");
+ $("#usersign").css("color", "red")
+ } else {
+ $("#usersign").text("已签约");
+ $("usersign").css("color", "#757575");
+ }
+ var phone = window.localStorage.getItem("phoneX");
+ if (!isEmpty(phone)) {
+ $("#userphone").text(phone)
+ }
+ var name = window.localStorage.getItem("name");
+ if (isEmpty(name)) {
+ $("#username").text("匿名")
+ } else {
+ $("#username").text(name)
+ $("#homename").text(name)
+ }
+ },
+ checkBefore: function(callback) {
+ var uid = window.localStorage.getItem("token");
+ if (isEmpty(uid)) {
+ window.location = "login.html";
+ } else {
+ var userid = window.localStorage.getItem("userid");
+ if (isEmpty(userid)) {
+ var cum = new auiDialog({});
+ var confirm = cum.alert({
+ title: "提示",
+ msg: '为了不影响您正常使用相关功能,请先绑定银行卡',
+ buttons: ['取消', '去绑卡']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ window.location = 'bindcard.html'
+ }
+ })
+ } else {
+ if (callback) {
+ callback()
+ }
+ }
+ }
+ },
+ checkOther: function(callback) {
+ var signed = window.localStorage.getItem("signed");
+ var cum = new auiDialog({});
- },
- initView: function() {
- var userid = window.localStorage.getItem("userid");
- var signed = window.localStorage.getItem("signed");
- if (isEmpty(userid)) {
- $("#userbank").text("未绑定");
- $("#userbank").css("color", "red")
- } else {
- $("#userbank").text("已绑定");
- $("userbank").css("color", "#757575");
- }
- if (isEmpty(signed) || signed != 'yes') {
- $("#usersign").text("未签约");
- $("#usersign").css("color", "red")
- } else {
- $("#usersign").text("已签约");
- $("usersign").css("color", "#757575");
- }
- var phone = window.localStorage.getItem("phoneX");
- if (!isEmpty(phone)) {
- $("#userphone").text(phone)
- }
- var name = window.localStorage.getItem("name");
- if (isEmpty(name)) {
- $("#username").text("匿名")
- } else {
- $("#username").text(name)
- $("#homename").text(name)
- }
- },
- checkBefore: function(callback) {
- var uid = window.localStorage.getItem("token");
- if (isEmpty(uid)) {
- window.location = "login.html";
- } else {
- var userid = window.localStorage.getItem("userid");
- if (isEmpty(userid)) {
- var cum = new auiDialog({});
- var confirm = cum.alert({
- title: "提示",
- msg: '为了不影响您正常使用相关功能,请先绑定银行卡',
- buttons: ['取消', '去绑卡']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- window.location = 'bindcard.html'
- }
- })
- } else {
- if (callback) {
- callback()
- }
- }
- }
- },
- checkOther: function(callback) {
- var signed = window.localStorage.getItem("signed");
- var cum = new auiDialog({});
-
- if (isEmpty(signed) || signed != 'yes') {
- var confirm = cum.alert({
- title: "提示",
- msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
- buttons: ['取消', '去签约']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- app.toSignCode();
- }
- })
- } else {
- if (callback) {
- callback()
- }
- }
- },
- toSignCode: function(){
- var param = {
- }
- V1Bindcardcode(param, function(ok, ret) {
- if (ok) {
- if (ret.code == 200) {
- window.location = 'bindcheck.html'
- } else {
- $.alert(ret.msg, "错误");
- }
- } else {
- $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
- }
- })
- },
- toSign: function() {
- window.location = 'signxycheck.html'
- },
- toBillDetail: function(refno) {
- window.localStorage.setItem("currentrefno", refno);
- window.location = 'billdetail.html';
- },
- toCard: function() {
- var userid = window.localStorage.getItem("userid");
- if (isEmpty(userid)) {
- window.location = 'bindcard.html'
- } else {
- window.location = 'cardinfor.html'
- }
- },
- logout:function(){
- window.localStorage.removeItem("token");
- window.location = "login.html";
- }
+ if (isEmpty(signed) || signed != 'yes') {
+ var confirm = cum.alert({
+ title: "提示",
+ msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
+ buttons: ['取消', '去签约']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ app.toSignCode();
+ }
+ })
+ } else {
+ if (callback) {
+ callback()
+ }
+ }
+ },
+ toSignCode: function() {
+ var param = {}
+ V1Bindcardcode(param, function(ok, ret) {
+ if (ok) {
+ if (ret.code == 200) {
+ window.location = 'bindcheck.html'
+ } else {
+ $.alert(ret.msg, "错误");
+ }
+ } else {
+ $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
+ }
+ })
+ },
+ toSign: function() {
+ window.location = 'signxycheck.html'
+ },
+ toBillDetail: function(refno) {
+ window.localStorage.setItem("currentrefno", refno);
+ window.location = 'billdetail.html';
+ },
+ toCard: function() {
+ var userid = window.localStorage.getItem("userid");
+ if (isEmpty(userid)) {
+ window.location = 'bindcard.html'
+ } 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"
- });
- }
+ 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'
+ },
+ // menu: {
+ // image: 'share.png',
+ // imagePressed: 'share.png',
+ // align: 'right',
+ // items: [{
+ // event: 'shareQQ',
+ // label: '分享至QQ好友'
+ // },
+ // {
+ // event: 'shareWX',
+ // label: '分享至微信好友'
+ // }
+ // ]
+ // },
+ backButtonCanClose: true
+ }).addEventListener('closePressed', function(params) {
+ inAppBrowserRef.close();
+ //window.location = "main.html"
+ })
+ // .addEventListener('shareQQ', function(e) {
+ // // alert(1)
+ // var args = {};
+ // args.client = QQSDK.ClientType.QQ; //QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;
+ // args.scene = QQSDK.Scene.QQ; //QQSDK.Scene.QQZone,QQSDK.Scene.Favorite
+ // args.url = 'https://yy.dlsmk.cn/wisdompolice/app/getapplyqrcode?visitorid=' + vistorId;
+ // args.title = '大理APP';
+ // args.description = '访客二维码';
+ // // args.image = 'https://cordova.apache.org/static/img/cordova_bot.png';
+ // QQSDK.shareNews(function() {
+ // alert('分享成功');
+ // }, function(failReason) {
+ // alert(failReason);
+ // }, args);
+ // }).addEventListener('shareWX', function(e) {
+ // // alert(2)
+ // Wechat.share({
+ // message: {
+ // title: "大理App分享",
+ // description: "访客二维码",
+ // thumb: "www/img/thumbnail.png",
+ // media: {
+ // type: Wechat.Type.WEBPAGE,
+ // webpageUrl: 'https://yy.dlsmk.cn/wisdompolice/app/getapplyqrcode?visitorid=' + vistorId
+ // }
+ // },
+ // scene: Wechat.Scene.SESSION // share to Timeline
+ // }, function() {
+ // alert("分享成功");
+ // }, function(reason) {
+ // alert("Failed: " + reason);
+ // });
+ // });
+}
var app = {
- // Application Constructor
- initialize: function() {
- this.initTab();
- document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
- document.addEventListener('jpush.receiveRegistrationId', function(event) {
- console.log(event.registrationId)
- }, false)
- document.addEventListener("jpush.openNotification", function (event) {
- var refno,msgtype
- var userid = window.localStorage.getItem("userid");
- var baseUrl = "https://yy.dlsmk.cn/wisdompolice/app"
- console.log("openNotify:"+event);
- if(device.platform == "Android") {
- msgtype = event.extras.msgtype
- if (msgtype ==="conference"){
- window.location= baseUrl + "/conference/signupconference?userId="+userid;
- }else if(msgtype ==="atte1"){
- window.location= baseUrl + "/atte/reviewindex?custid="+userid;
- }else if(msgtype ==="atte2"){
- window.location= baseUrl + "/atte/searchindex?custid="+userid;
- }else if(msgtype ==="atte3"){
- window.location= baseUrl + "/atte/reviewClock?custid="+userid;
- }else if(msgtype ==="atte4"){
- window.location= baseUrl + "/atte/clockhisindex?custid="+userid;
- }else{
- refno = event.extras.refno
+ // Application Constructor
+ initialize: function() {
+ this.initTab();
+ document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
+ document.addEventListener('jpush.receiveRegistrationId', function(event) {
+ console.log(event.registrationId)
+ }, false)
+ document.addEventListener("jpush.openNotification", function(event) {
+ var refno, msgtype
+ var userid = window.localStorage.getItem("userid");
+ var baseUrl = "https://yy.dlsmk.cn/wisdompolice/app"
+ console.log("openNotify:" + event);
+ if (device.platform == "Android") {
+ msgtype = event.extras.msgtype
+ // window.location = 'more.html'
+ if (msgtype === "conference") {
+ showRet(baseUrl + "/conference/signupconference?userId=" + userid);
+ } else if (msgtype === "atte1") {
+ showRet(baseUrl + "/atte/reviewindex?custid=" + userid);
+ } else if (msgtype === "atte2") {
+ showRet(baseUrl + "/atte/searchindex?custid=" + userid);
+ } else if (msgtype === "atte3") {
+ showRet(baseUrl + "/atte/reviewClock?custid=" + userid);
+ } else if (msgtype === "atte4") {
+ showRet(baseUrl + "/atte/clockhisindex?custid=" + userid);
+ } else {
+ refno = event.extras.refno
+ app.openBill(refno);
+ }
+ } else {
+ refno = event.refno
+ window.JPush.setApplicationIconBadgeNumber(0);
app.openBill(refno);
}
- } else {
- refno = event.refno
- window.JPush.setApplicationIconBadgeNumber(0);
- app.openBill(refno);
- }
- //console.log("openNotify:"+refno);
- }, false)
- },
- openBill:function(billno){
- window.localStorage.setItem("currentrefno",billno);
- window.location='billdetail.html';
- },
- initJpush: function() {
- if(device.platform == "Android") {
- } else {
- window.JPush.setApplicationIconBadgeNumber(0);
- }
- window.JPush.init();
- window.JPush.setDebugMode(true);
- window.JPush.isPushStopped(function(result) {
- if (result == 0) {
- //window.JPush.resumePush();
- } else {
- window.JPush.resumePush();
- }
- });
- window.JPush.getUserNotificationSettings(function(result) {
- if(result == 0) {
- } else if(result > 0) {
- }
- });
- var uid = window.localStorage.getItem("uid");
- window.JPush.setAlias({ sequence: 1, alias: uid },
- (result) => {
- var sequence = result.sequence
- var alias = result.alias
- //alert(JSON.stringify(result))
- }, (error) => {
- var sequence = error.sequence
- var errorCode = error.code
- //alert(JSON.stringify(error))
- })
- },
+ //console.log("openNotify:"+refno);
+ }, false)
+ },
+ openBill: function(billno) {
+ window.localStorage.setItem("currentrefno", billno);
+ window.location = 'billdetail.html';
+ },
+ initJpush: function() {
+ if (device.platform == "Android") {} else {
+ window.JPush.setApplicationIconBadgeNumber(0);
+ }
+ window.JPush.init();
+ window.JPush.setDebugMode(true);
+ window.JPush.isPushStopped(function(result) {
+ if (result == 0) {
+ //window.JPush.resumePush();
+ } else {
+ window.JPush.resumePush();
+ }
+ });
+ window.JPush.getUserNotificationSettings(function(result) {
+ if (result == 0) {} else if (result > 0) {}
+ });
+ var uid = window.localStorage.getItem("uid");
+ window.JPush.setAlias({
+ sequence: 1,
+ alias: uid
+ },
+ (result) => {
+ var sequence = result.sequence
+ var alias = result.alias
+ //alert(JSON.stringify(result))
+ }, (error) => {
+ var sequence = error.sequence
+ var errorCode = error.code
+ //alert(JSON.stringify(error))
+ })
+ },
- onDeviceReady: function() {
- var uid = window.localStorage.getItem("token");
- this.initJpush();
- $('#scanBtn').click(function() {
- //window.location = "scan.html";
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "scan.html";
- })
- })
- });
- $('#qrcodeBtn').click(function() {
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "qrcode.html";
- })
- })
- });
- var userid = window.localStorage.getItem("userid");
- $('#qrcodeBtn1').click(function() {
- showRet("https://yy.dlsmk.cn/wisdompolice/app/doorappvisitor?custid="+userid);
- });
-
- $('#qingjiaBtn').click(function() {
-
- //window.location = "https://yy.dlsmk.cn/wisdompolice/app/doorappindex?custid="+userid;
- });
- $('#accessBtn').click(function() {
- //window.location = "https://yy.dlsmk.cn/wisdompolice/app/doorappvisitor?custid="+userid;
- });
- /*$('#cardBtn').click(function() {
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "card.html";
- })
- })
- });
- $('#billBtn').click(function() {
- app.checkBefore(function() {
- window.location = "bill.html";
- })
- });
- $('#moreBtn').click(function() {
- app.checkBefore(function() {
- window.location = "bill.html";
- })
- });
- $('#secBtn').click(function() {
- //window.location = "security.html";
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "security.html";
- })
- })
- });
+ onDeviceReady: function() {
+ var uid = window.localStorage.getItem("token");
+ this.initJpush();
+ $('#scanBtn').click(function() {
+ //window.location = "scan.html";
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "scan.html";
+ })
+ })
+ });
+ $('#qrcodeBtn').click(function() {
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "qrcode.html";
+ })
+ })
+ });
+ var userid = window.localStorage.getItem("userid");
+ $('#qrcodeBtn1').click(function() {
+ showRet("https://yy.dlsmk.cn/wisdompolice/app/doorappvisitor?custid=" + userid);
+ });
+
+ $('#qingjiaBtn').click(function() {
+
+ //window.location = "https://yy.dlsmk.cn/wisdompolice/app/doorappindex?custid="+userid;
+ });
+ $('#accessBtn').click(function() {
+ //window.location = "https://yy.dlsmk.cn/wisdompolice/app/doorappvisitor?custid="+userid;
+ });
+ /*$('#cardBtn').click(function() {
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "card.html";
+ })
+ })
+ });
+ $('#billBtn').click(function() {
+ app.checkBefore(function() {
+ window.location = "bill.html";
+ })
+ });
+ $('#moreBtn').click(function() {
+ app.checkBefore(function() {
+ window.location = "bill.html";
+ })
+ });
+ $('#secBtn').click(function() {
+ //window.location = "security.html";
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "security.html";
+ })
+ })
+ });
- $("#doorBtn").click(function(){
- app.checkBefore(function() {
- showRet(DOOR_URl);
- })
- })*/
- $("#moreFuncBtn").click(function(){
- window.location = "more.html";
- //showRet("https://yy.dlsmk.cn/wisdompolice/app/doorappindex?custid="+userid);
- })
- $('#usersec').click(function() {
- app.checkBefore(function() {
- app.checkOther(function() {
- window.location = "security.html";
- })
- })
- });
- $('#accsignbtn').click(function() {
- app.checkBefore(function() {
- var signed = window.localStorage.getItem("signed");
- var cum = new auiDialog({});
- if (isEmpty(signed) || signed != 'yes') {
- var confirm = cum.alert({
- title: "提示",
- msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
- buttons: ['取消', '去签约']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- app.toSignCode();
- }
- })
- }else{
- window.location = 'signxycheck.html'
- }
- })
- });
- this.initSlider();
- this.initData();
- this.backBtn();
- },
- backBtn: function(){
- document.addEventListener("backbutton", function(e){
- e.preventDefault();
- navigator.app.exitApp();
- }, false);
- },
- initTab: function() {
- //$("#maincontent").css("top", $("#maintop").height())
- var tab = new auiTab({
- element: document.getElementById("footer"),
- }, function(ret) {
- window.localStorage.setItem("tabindex", ret.index);
+ $("#doorBtn").click(function(){
+ app.checkBefore(function() {
+ showRet(DOOR_URl);
+ })
+ })*/
+ $("#moreFuncBtn").click(function() {
+ window.location = "more.html";
+ //showRet("https://yy.dlsmk.cn/wisdompolice/app/doorappindex?custid="+userid);
+ })
+ $('#usersec').click(function() {
+ app.checkBefore(function() {
+ app.checkOther(function() {
+ window.location = "security.html";
+ })
+ })
+ });
+ $('#accsignbtn').click(function() {
+ app.checkBefore(function() {
+ var signed = window.localStorage.getItem("signed");
+ var cum = new auiDialog({});
+ if (isEmpty(signed) || signed != 'yes') {
+ var confirm = cum.alert({
+ title: "提示",
+ msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
+ buttons: ['取消', '去签约']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ app.toSignCode();
+ }
+ })
+ } else {
+ window.location = 'signxycheck.html'
+ }
+ })
+ });
+ this.initSlider();
+ this.initData();
+ this.backBtn();
+ },
+ backBtn: function() {
+ document.addEventListener("backbutton", function(e) {
+ e.preventDefault();
+ navigator.app.exitApp();
+ }, false);
+ },
+ initTab: function() {
+ //$("#maincontent").css("top", $("#maintop").height())
+ var tab = new auiTab({
+ element: document.getElementById("footer"),
+ }, function(ret) {
+ window.localStorage.setItem("tabindex", ret.index);
+
+ changeTab(ret.index);
+ });
+ var tabindex = window.localStorage.getItem("tabindex");
+ if (!tabindex || tabindex == 0) {
+ tabindex = 1
+ }
+ changeTab(tabindex);
+ tab.setActive(tabindex)
- changeTab(ret.index);
- });
- var tabindex = window.localStorage.getItem("tabindex");
- if (!tabindex || tabindex == 0) {
- tabindex = 1
- }
- changeTab(tabindex);
- tab.setActive(tabindex)
+ function changeTab(index) {
+ if (index == 1) {
+ $("#main1").show();
+ $("#main2").hide();
+ $("#main3").hide();
+ } else if (index == 2) {
+ $("#main1").hide();
+ $("#main2").show();
+ $("#main3").hide();
+ } else if (index == 3) {
+ $("#main1").hide();
+ $("#main2").hide();
+ $("#main3").show();
+ }
+ }
+ },
+ initSlider: function() {
+ var slide = new auiSlide({
+ container: document.getElementById("startslider"),
+ "height": 240,
+ "speed": 500,
+ "pageShow": true,
+ "autoPlay": 3000,
+ "pageStyle": 'dot',
+ "loop": true,
+ 'dotPosition': 'center',
+ currentPage: currentFun
+ });
- function changeTab(index) {
- if (index == 1) {
- $("#main1").show();
- $("#main2").hide();
- $("#main3").hide();
- } else if (index == 2) {
- $("#main1").hide();
- $("#main2").show();
- $("#main3").hide();
- } else if (index == 3) {
- $("#main1").hide();
- $("#main2").hide();
- $("#main3").show();
- }
- }
- },
- initSlider:function(){
- var slide = new auiSlide({
- container:document.getElementById("startslider"),
- "height":240,
- "speed":500,
- "pageShow":true,
- "autoPlay":3000,
- "pageStyle":'dot',
- "loop":true,
- 'dotPosition':'center',
- currentPage:currentFun
- });
- function currentFun(index){
- //console.log(index)
- }
- },
- initData: function() {
- this.loadBill()
- },
- loadBill: function() {
- //$("#loaddata").show()
- //$("#nodata").hide();
- var param = {
- "pageno": 1,
- "type":"police",
- "platform":device.platform
- }
- V1Bills(param, function(ok, ret) {
- if (ok) {
- if (ret.code == 200) {
- console.log(ret)
- //ret.version='1.3.9';
- //ret.versionmsg='新版本';
- //ret.versionurl='https://yy.dlsmk.cn/app/download/wisdompolice.apk';
- app.checkVersion(ret.version,ret.minversion,ret.versionmsg,ret.versionurl);
- //app.checkVersion("1.3.9","1","new func","https://shouji.baidu.com/software/26706357.html");
- //$("#maingt").text(ret.t + "!")
- $("#user-amount").text(ret.amount)
- $("#user-point").text(ret.point)
- if (ret.needrebind) {
- window.localStorage.removeItem("userid");
- } else {
- window.localStorage.setItem("userid", ret.userid);
- }
- window.localStorage.setItem("signed", ret.signed);
- window.localStorage.setItem("paypwdset", ret.paypwdset);
- window.localStorage.setItem("name", ret.name);
- if (ret.page && ret.page.count > 0) {
- GLOBAL_TODAY = ret.today;
- GLOBAL_YESTERDAY = ret.yesterday;
- //app.initBillView(ret.page)
- app.initView();
- } else {
- //$("#loaddata").hide()
- //$("#nodatahint").text("暂无数据")
- //$("#nodata").show();
- app.initView();
- }
- } else {
- //$("#loaddata").hide()
- //$("#nodatahint").text("数据加载异常")
- //$("#nodata").show();
- app.initView();
- }
- } else {
- //$("#loaddata").hide()
- //$("#nodatahint").text("请求数据失败")
- //$("#nodata").show();
- app.initView();
- }
- })
- },
- checkVersion:function(ver,minver,m,url){
- cordova.getAppVersion.getVersionNumber(function (version) {
- //alert(version);
- //alert(version);
- if(ver>version){
- $("#versioncheck").html('<div class="aui-dot" style="position:relative;top:0; right:0;display:inline-block;"></div>新版本'+ver);
- var cum = new auiDialog({});
- var confirm = cum.alert({
- title: "有新的版本",
- msg: m,
- buttons: ['取消', '去更新']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- //cordova.InAppBrowser.open(url, '_system', 'location=no,toolbar=yes,toolbarposition=top,closebuttoncaption=关闭');
- window.open(url,"_system",'');
- }
- })
- }else{
- $("#versioncheck").html('已是最新版'+version);
- }
- });
- },
- initBillView: function(page) {
- var html = '';
- for (var i = 0; i < page.data.length; i++) {
- var bean = page.data[i]
- html += '<div class="aui-card-list-header aui-card-list-user" onclick="app.toBillDetail(\'' + bean.refno + '\')">';
- html += '<div class="aui-card-list-user-avatar"><img src="img/icon_meal.png" class="aui-margin-r-10 aui-img-round" />';
- html += '</div><div class="aui-card-list-user-name">';
- html += '<div>' + bean.transdesc + '</div>';
- if (bean.tradeflag == 'in') {
- html += '<div class="aui-list-item-right">+' + bean.amount + '</div>';
- } else {
- html += '<div class="aui-list-item-right">' + bean.amount + '</div>';
- }
- html += '</div><div class="aui-card-list-user-info">' + formatDateNoYear(bean.transdate, bean.transtime) + '</div></div>';
- }
- $("#billcontent").html(html);
- $("#loaddata").hide()
- $("#nodata").hide();
- $("#billcontent").show();
+ function currentFun(index) {
+ //console.log(index)
+ }
+ },
+ initData: function() {
+ this.loadBill()
+ },
+ loadBill: function() {
+ //$("#loaddata").show()
+ //$("#nodata").hide();
+ var param = {
+ "pageno": 1,
+ "type": "police",
+ "platform": device.platform
+ }
+ V1Bills(param, function(ok, ret) {
+ if (ok) {
+ if (ret.code == 200) {
+ console.log(ret)
+ //ret.version='1.3.9';
+ //ret.versionmsg='新版本';
+ //ret.versionurl='https://yy.dlsmk.cn/app/download/wisdompolice.apk';
+ app.checkVersion(ret.version, ret.minversion, ret.versionmsg, ret.versionurl);
+ //app.checkVersion("1.3.9","1","new func","https://shouji.baidu.com/software/26706357.html");
+ //$("#maingt").text(ret.t + "!")
+ $("#user-amount").text(ret.amount)
+ $("#user-point").text(ret.point)
+ if (ret.needrebind) {
+ window.localStorage.removeItem("userid");
+ } else {
+ window.localStorage.setItem("userid", ret.userid);
+ }
+ window.localStorage.setItem("signed", ret.signed);
+ window.localStorage.setItem("paypwdset", ret.paypwdset);
+ window.localStorage.setItem("name", ret.name);
+ if (ret.page && ret.page.count > 0) {
+ GLOBAL_TODAY = ret.today;
+ GLOBAL_YESTERDAY = ret.yesterday;
+ //app.initBillView(ret.page)
+ app.initView();
+ } else {
+ //$("#loaddata").hide()
+ //$("#nodatahint").text("暂无数据")
+ //$("#nodata").show();
+ app.initView();
+ }
+ } else {
+ //$("#loaddata").hide()
+ //$("#nodatahint").text("数据加载异常")
+ //$("#nodata").show();
+ app.initView();
+ }
+ } else {
+ //$("#loaddata").hide()
+ //$("#nodatahint").text("请求数据失败")
+ //$("#nodata").show();
+ app.initView();
+ }
+ })
+ },
+ checkVersion: function(ver, minver, m, url) {
+ cordova.getAppVersion.getVersionNumber(function(version) {
+ //alert(version);
+ //alert(version);
+ if (ver > version) {
+ $("#versioncheck").html(
+ '<div class="aui-dot" style="position:relative;top:0; right:0;display:inline-block;"></div>新版本' + ver);
+ var cum = new auiDialog({});
+ var confirm = cum.alert({
+ title: "有新的版本",
+ msg: m,
+ buttons: ['取消', '去更新']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ //cordova.InAppBrowser.open(url, '_system', 'location=no,toolbar=yes,toolbarposition=top,closebuttoncaption=关闭');
+ window.open(url, "_system", '');
+ }
+ })
+ } else {
+ $("#versioncheck").html('已是最新版' + version);
+ }
+ });
+ },
+ initBillView: function(page) {
+ var html = '';
+ for (var i = 0; i < page.data.length; i++) {
+ var bean = page.data[i]
+ html += '<div class="aui-card-list-header aui-card-list-user" onclick="app.toBillDetail(\'' + bean.refno + '\')">';
+ html +=
+ '<div class="aui-card-list-user-avatar"><img src="img/icon_meal.png" class="aui-margin-r-10 aui-img-round" />';
+ html += '</div><div class="aui-card-list-user-name">';
+ html += '<div>' + bean.transdesc + '</div>';
+ if (bean.tradeflag == 'in') {
+ html += '<div class="aui-list-item-right">+' + bean.amount + '</div>';
+ } else {
+ html += '<div class="aui-list-item-right">' + bean.amount + '</div>';
+ }
+ html += '</div><div class="aui-card-list-user-info">' + formatDateNoYear(bean.transdate, bean.transtime) +
+ '</div></div>';
+ }
+ $("#billcontent").html(html);
+ $("#loaddata").hide()
+ $("#nodata").hide();
+ $("#billcontent").show();
- },
- initView: function() {
- var userid = window.localStorage.getItem("userid");
- var signed = window.localStorage.getItem("signed");
- if (isEmpty(userid)) {
- $("#userbank").text("未绑定");
- $("#userbank").css("color", "red")
- } else {
- $("#userbank").text("已绑定");
- $("userbank").css("color", "#757575");
- }
- if (isEmpty(signed) || signed != 'yes') {
- $("#usersign").text("未签约");
- $("#usersign").css("color", "red")
- } else {
- $("#usersign").text("已签约");
- $("usersign").css("color", "#757575");
- }
- var phone = window.localStorage.getItem("phoneX");
- if (!isEmpty(phone)) {
- $("#userphone").text(phone)
- }
- var name = window.localStorage.getItem("name");
- if (isEmpty(name)) {
- $("#username").text("匿名")
- } else {
- $("#username").text(name)
- $("#homename").text(name)
- }
- },
- checkBefore: function(callback) {
- var uid = window.localStorage.getItem("token");
- if (isEmpty(uid)) {
- window.location = "login.html";
- } else {
- var userid = window.localStorage.getItem("userid");
- if (isEmpty(userid)) {
- var cum = new auiDialog({});
- var confirm = cum.alert({
- title: "提示",
- msg: '为了不影响您正常使用相关功能,请先进行市民卡签约',
- buttons: ['取消', '去签约']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- window.location = 'bindcard.html'
- }
- })
- } else {
- if (callback) {
- callback()
- }
- }
- }
- },
- checkOther: function(callback) {
- var signed = window.localStorage.getItem("signed");
- var cum = new auiDialog({});
+ },
+ initView: function() {
+ var userid = window.localStorage.getItem("userid");
+ var signed = window.localStorage.getItem("signed");
+ if (isEmpty(userid)) {
+ $("#userbank").text("未绑定");
+ $("#userbank").css("color", "red")
+ } else {
+ $("#userbank").text("已绑定");
+ $("userbank").css("color", "#757575");
+ }
+ if (isEmpty(signed) || signed != 'yes') {
+ $("#usersign").text("未签约");
+ $("#usersign").css("color", "red")
+ } else {
+ $("#usersign").text("已签约");
+ $("usersign").css("color", "#757575");
+ }
+ var phone = window.localStorage.getItem("phoneX");
+ if (!isEmpty(phone)) {
+ $("#userphone").text(phone)
+ }
+ var name = window.localStorage.getItem("name");
+ if (isEmpty(name)) {
+ $("#username").text("匿名")
+ } else {
+ $("#username").text(name)
+ $("#homename").text(name)
+ }
+ },
+ checkBefore: function(callback) {
+ var uid = window.localStorage.getItem("token");
+ if (isEmpty(uid)) {
+ window.location = "login.html";
+ } else {
+ var userid = window.localStorage.getItem("userid");
+ if (isEmpty(userid)) {
+ var cum = new auiDialog({});
+ var confirm = cum.alert({
+ title: "提示",
+ msg: '为了不影响您正常使用相关功能,请先进行市民卡签约',
+ buttons: ['取消', '去签约']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ window.location = 'bindcard.html'
+ }
+ })
+ } else {
+ if (callback) {
+ callback()
+ }
+ }
+ }
+ },
+ checkOther: function(callback) {
+ var signed = window.localStorage.getItem("signed");
+ var cum = new auiDialog({});
- if (isEmpty(signed) || signed != 'yes') {
- var confirm = cum.alert({
- title: "提示",
- msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
- buttons: ['取消', '去签约']
- }, function(ret) {
- if (ret.buttonIndex == 2) {
- app.toSignCode();
- }
- })
- } else {
- if (callback) {
- callback()
- }
- }
- },
- toSignCode: function(){
- var param = {
- }
- V1Bindcardcode(param, function(ok, ret) {
- if (ok) {
- if (ret.code == 200) {
- window.location = 'bindcheck.html'
- } else {
- $.alert(ret.msg, "错误");
- }
- } else {
- $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
- }
- })
- },
- toSign: function() {
- window.location = 'signxycheck.html'
- },
- toBillDetail: function(refno) {
- window.localStorage.setItem("currentrefno", refno);
- window.location = 'billdetail.html';
- },
- toCard: function() {
- var signed = window.localStorage.getItem("signed");
- if (isEmpty(signed) || signed != 'yes') {
- window.location = 'bindcard.html'
- }else{
- window.location = 'cardinfor.html'
- }
- },
- logout:function(){
- window.localStorage.removeItem("token");
- window.location = "login.html";
- },
- verisonCheck:function(){
- var param = {
- "pageno": 1,
- "type":"police",
- "platform":device.platform
- }
- V1Bills(param, function(ok, ret) {
- if (ok) {
- if (ret.code == 200) {
- console.log(ret)
- //ret.version='1.3.9';
- //ret.versionmsg='新版本';
- //ret.versionurl='https://yy.dlsmk.cn/app/download/wisdompolice.apk';
- app.checkVersion(ret.version,ret.minversion,ret.versionmsg,ret.versionurl);
- } else {
- }
- } else {
- }
- })
- }
+ if (isEmpty(signed) || signed != 'yes') {
+ var confirm = cum.alert({
+ title: "提示",
+ msg: '您尚未签约市民卡免密代扣签约协议,无法使用该功能',
+ buttons: ['取消', '去签约']
+ }, function(ret) {
+ if (ret.buttonIndex == 2) {
+ app.toSignCode();
+ }
+ })
+ } else {
+ if (callback) {
+ callback()
+ }
+ }
+ },
+ toSignCode: function() {
+ var param = {}
+ V1Bindcardcode(param, function(ok, ret) {
+ if (ok) {
+ if (ret.code == 200) {
+ window.location = 'bindcheck.html'
+ } else {
+ $.alert(ret.msg, "错误");
+ }
+ } else {
+ $.alert("请求失败了 " + ret.status + ",请稍后再试", "错误");
+ }
+ })
+ },
+ toSign: function() {
+ window.location = 'signxycheck.html'
+ },
+ toBillDetail: function(refno) {
+ window.localStorage.setItem("currentrefno", refno);
+ window.location = 'billdetail.html';
+ },
+ toCard: function() {
+ var signed = window.localStorage.getItem("signed");
+ if (isEmpty(signed) || signed != 'yes') {
+ window.location = 'bindcard.html'
+ } else {
+ window.location = 'cardinfor.html'
+ }
+ },
+ logout: function() {
+ window.localStorage.removeItem("token");
+ window.location = "login.html";
+ },
+ verisonCheck: function() {
+ var param = {
+ "pageno": 1,
+ "type": "police",
+ "platform": device.platform
+ }
+ V1Bills(param, function(ok, ret) {
+ if (ok) {
+ if (ret.code == 200) {
+ console.log(ret)
+ //ret.version='1.3.9';
+ //ret.versionmsg='新版本';
+ //ret.versionurl='https://yy.dlsmk.cn/app/download/wisdompolice.apk';
+ app.checkVersion(ret.version, ret.minversion, ret.versionmsg, ret.versionurl);
+ } else {}
+ } else {}
+ })
+ }
};
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: {
- wwwImage: 'img/back.png',
- wwwImagePressed: 'img/back.png',
- align: 'left',
- event: 'backPressed'
- },
- backButtonCanClose: true
- }).addEventListener('backPressed', function(e) {
- //alert('back pressed');
- }).addEventListener('closePressed', function(e) {
- //alert('closePressed pressed');
- inAppBrowserRef.close();
- window.location = "main.html"
- });
- }
+ 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: {
+ wwwImage: 'img/back.png',
+ wwwImagePressed: 'img/back.png',
+ align: 'left',
+ event: 'backPressed'
+ },
+ menu: {
+ wwwImage: 'img/share.png',
+ wwwImagePressed: 'img/share.png',
+ align: 'right',
+ items: [{
+ event: 'shareQQ',
+ label: '分享至QQ好友'
+ },
+ {
+ event: 'shareWX',
+ label: '分享至微信好友'
+ }
+ ]
+ },
+ backButtonCanClose: true
+ }).addEventListener('backPressed', function(e) {
+ // if (window.localStorage.getItem("share") === 1) {
+ // alert("share")
+ // inAppBrowserRef.close();
+ // window.location = "share.html"
+ // }
+ }).addEventListener('closePressed', function(e) {
+ //alert('closePressed pressed');
+ inAppBrowserRef.close();
+ window.location = "main.html"
+ })
+ .addEventListener('shareQQ', function(e) {
+ var visitorid = e.url.split("=")[1]
+ var path = 'https://yy.dlsmk.cn/wisdompolice/app/getapplyqrcode?visitorid=' + visitorid
+ var args = {};
+ args.client = QQSDK.ClientType.QQ; //QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;
+ args.scene = QQSDK.Scene.QQ; //QQSDK.Scene.QQZone,QQSDK.Scene.Favorite
+ args.title = '大理APP';
+ args.description = '访客二维码';
+ args.url = path;
+ // args.image = 'https://cordova.apache.org/static/img/cordova_bot.png';
+ QQSDK.shareNews(function() {
+ alert('分享成功');
+ }, function(failReason) {
+ alert(failReason);
+ }, args);
+ })
+ .addEventListener('shareWX', function(e) {
+ var visitorid = e.url.split("=")[1]
+ var path = 'https://yy.dlsmk.cn/wisdompolice/app/getapplyqrcode?visitorid=' + visitorid
+ Wechat.share({
+ message: {
+ title: "大理App分享",
+ description: "访客二维码",
+ thumb: "www/img/thumbnail.png",
+ media: {
+ type: Wechat.Type.WEBPAGE,
+ webpageUrl: path
+ }
+ },
+ scene: Wechat.Scene.SESSION, // share to Timeline
+ }, function() {
+ alert("分享成功");
+ }, function(reason) {
+ alert("Failed: " + reason);
+ })
+ });
+}
--- /dev/null
+<!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">
+ <link rel="stylesheet" type="text/css" href="css/aui.css" />
+ <link rel="stylesheet" type="text/css" href="css/weui.min.css">
+ <link rel="stylesheet" type="text/css" href="css/jquery-weui.min.css">
+ <link rel="stylesheet" type="text/css" href="css/index.css" />
+ <link rel="stylesheet" type="text/css" href="css/aui-slide.css">
+ <style type="text/css">
+ .aui-slide-node {
+ /*background: transparent!important;*/
+ }
+ body{
+ background-color: #FFFFFF;
+ }
+ .ul{
+ list-style: none;
+ display: flex;
+ /* flex-direction: column; */
+ justify-content: space-between;
+ text-align: center;
+ margin-top: 50%;
+ }
+ .li{
+ width: 45%;
+ line-height: 50px;
+ background-color: #3599FB;
+ color: #FFFFFF;
+ }
+ .header{
+ display: felx;
+ justify-content: center;
+ padding: 15px;
+ background-color:#3599FB ;
+ color: white;
+ text-align: center;
+ position: relative;
+ }
+ img{
+ position: absolute;
+ left: 10px;
+ top: 50%;
+ width: 20px;
+ transform: translateY(-50%);
+ }
+ </style>
+ </head>
+ <body>
+ <div id="" class="header">
+ <img src="img/back.png" id="img">
+ <span>二维码分享</span>
+ </div>
+ <ul class="ul">
+ <li class="li" id="shareqq">qq分享</li>
+ <li class="li" id="sharewx">微信分享</li>
+ </ul>
+ </body>
+ <script type="text/javascript" src="cordova.js"></script>
+ <script type="text/javascript" src="js/lib/jquery-2.1.4.js"></script>
+ <script type="text/javascript" src="js/lib/aui-tab.js"></script>
+ <script type="text/javascript" src="js/lib/aui-dialog.js"></script>
+ <script type="text/javascript" src="js/lib/aui-slide.js"></script>
+ <script type="text/javascript" src="js/server.js"></script>
+ <script type="text/javascript" src="js/mainmenu.js"></script>
+ <script type="text/javascript">
+ var img = document.getElementById("img");
+ var shareqq = document.getElementById("shareqq");
+ var sharewx = document.getElementById("sharewx");
+ img.onclick = function(){
+ window.location = "main.html"
+ }
+ shareqq.onclick = function() {
+ var args = {};
+ args.client = QQSDK.ClientType.QQ; //QQSDK.ClientType.QQ,QQSDK.ClientType.TIM;
+ args.scene = QQSDK.Scene.QQ; //QQSDK.Scene.QQZone,QQSDK.Scene.Favorite
+ args.url = 'https://cordova.apache.org/';
+ args.title = '大理App分享';
+ args.description = '访客二维码';
+ args.image = 'https://cordova.apache.org/static/img/cordova_bot.png';
+ QQSDK.shareNews(function() {
+ alert('分享成功');
+ }, function(failReason) {
+ alert(failReason);
+ }, args);
+ }
+ sharewx.onclick = function() {
+ Wechat.share({
+ message: {
+ title: "大理App分享",
+ description: "访客二维码",
+ thumb: "www/img/thumbnail.png",
+ media: {
+ type: Wechat.Type.LINK,
+ webpageUrl: "http://www.jason-z.com"
+ }
+ },
+ scene: Wechat.Scene.SESSION // share to Timeline
+ }, function () {
+ alert("分享成功");
+ }, function (reason) {
+ alert("Failed: " + reason);
+ });
+ }
+ </script>
+</html>