|
现在需要登录页面A时,获取设备ID号之后将设备ID号与SQLite中的数据进行对比,该ID已经在数据库中存在则直接进入页面B,如果在数据库中没有这个ID则跳转到页面C。请问如何实现这个功能?下面是我写的代码- Model.prototype.modelLoad = function(event){
- var me = this;
- var uuid = "123456";
- document.addEventListener("deviceready", onDeviceReady, false);
- function onDeviceReady() {
- me.db = window.sqlitePlugin.openDatabase({
- name : "my.db"
- });
- me.db.transaction(function(tx) {
- tx.executeSql('CREATE TABLE IF NOT EXISTS equipment (id integer primary key, server text, equipmentId Long ,className text)');
- tx.executeSql("select id,data,data_num from test_table where equipmentId=?;", [uuid], function(tx, res) {
- if(res.rows.length != 0){
- var url = require.toUrl('./first.w');
- this.comp('windowDialog1').open({src:url});
- }else{
- var url = require.toUrl('./mainActivity.w');
- this.comp('windowDialog1').open({src:url});
- }
- });
复制代码 |
|