mobileoa-common-modules
Version:
移动办公平台前端公共功能模块
61 lines (51 loc) • 1.23 kB
JavaScript
;
var angular = require('angular');
require('../modules');
angular
.module('setting')
.controller('FileCacheCtrl', FileCacheCtrl);
/**
* @ngInject
*/
function FileCacheCtrl($scope, fileCacheService, $toast) {
init();
function init() {
$scope.osType = ionic.Platform.platform();
$scope.items = getItems();
$scope.saveExpire = fileCacheService.saveExpire;
$scope.clearFile = function () {
fileCacheService.clearFile().then(function() {
$toast.showShortCenter('清空缓存成功!');
});
};
$scope.saveExpire = function() {
fileCacheService.saveExpire($scope.expire.value);
}
$scope.expire = {};
fileCacheService.getExpire().then(function(expire) {
$scope.items.forEach(function(item) {
if (item.value === expire) {
$scope.expire = {
value: item.value
};
}
});
});
}
function getItems() {
var millien = 1000 * 60;
return [{
value: millien * 10,
text: '10分钟'
}, {
value: millien * 30,
text: '30分钟'
}, {
value: millien * 60 ,
text: '1小时'
}, {
value: millien * 60 * 24,
text: '1天'
}]
}
}