Skip to content

Commit

Permalink
Add update code add other ingress.
Browse files Browse the repository at this point in the history
  • Loading branch information
bestony committed Mar 12, 2017
1 parent 2e90dfb commit f948ffe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions pages/info/info.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const totp = require('../../utils/totp.js');
var update = require("../../utils/update");
Page({
data: {
timer: 0
},
onLoad: function (options) {
var that = this;
update.checkUpdate();
/**
* 获取数据
*/
Expand Down
15 changes: 8 additions & 7 deletions pages/servers/servers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const totp = require('../../utils/totp.js');
var update = require("../../utils/update");
Page({
data: {
servers: [],
Expand All @@ -8,7 +9,7 @@ Page({
* 页面进入时,首先加载一次数据
*/
onLoad: function (options) {

update.checkUpdate();
var ingress = wx.getStorageSync('ingress');
/**
* 如果Ingress 为空,则跳转到引导页
Expand All @@ -22,18 +23,18 @@ Page({
},
onReady: function () {
var that = this;

/**
* 每秒执行一次
*/
setInterval(function () {
/**
* 如果当前数据的长度和本地存储中数据长度不同。强制刷新一次数据
*/

var mem_server = wx.getStorageSync('servers');
if(mem_server != ''){
if(JSON.parse(mem_server).length != that.data.servers.length){
if (mem_server != '') {
if (JSON.parse(mem_server).length != that.data.servers.length) {
that.refreshData();
}
}
Expand All @@ -60,8 +61,8 @@ Page({
refreshData: function () {
var that = this;
var raw_server = wx.getStorageSync('servers');
if(raw_server == ''){
return ;
if (raw_server == '') {
return;
}
var servers = JSON.parse(raw_server);
/**
Expand Down

0 comments on commit f948ffe

Please sign in to comment.