text
stringlengths 7
3.69M
|
|---|
// Define the `phonecatApp` module
var inobitecApp = angular.module('inobitecApp', ['ngSanitize','ui.mask']);
inobitecApp.directive('onFinishRender', function ($timeout) {
return {
restrict: 'A',
link: function (scope, element, attr) {
if (scope.$last === true) {
$timeout(function () {
scope.$emit(attr.onFinishRender);
});
}
}
}
});
// Define the `PhoneListController` controller on the `phonecatApp` module
inobitecApp.controller('buyPageController', ['$window', '$scope', '$http', '$rootScope', function buyPageController($window, $scope, $http, $rootScope) {
$scope.usdCurr = false;
$scope.showBuyBlock = true;
$scope.sectionID = false;
$scope.site = "s1";
$scope.extRedactions = [];
$scope.liteRedactions = [];
$scope.proRedactions = [];
$scope.$on('reInitDataMain', function(event, data) {
$scope.initDicomviewerPage();
});
$scope.redirect = redirect;
$scope.initDicomviewerPage = initDicomviewerPage;
$scope.addToBasket = addToBasket;
$scope.addModuleToBasket = addModuleToBasket;
$scope.deleteFromBasket = deleteFromBasket;
$scope.addRedactionlite = addRedactionlite;
$scope.addRedactionpro = addRedactionpro;
$scope.needCheckEndProRender = false;
$scope.license = {
"viewerLic": false,
"serverLic": false,
};
$scope.checkIfLiteRedactionsFull = checkIfLiteRedactionsFull;
$scope.checkIfProRedactionsFull = checkIfProRedactionsFull;
$scope.changeViewBlock = changeViewBlock;
$scope.calculateDicomViewerPrice = calculateDicomViewerPrice;
$scope.parsePrice = parsePrice;
$scope.countModulesPrice = countModulesPrice;
$scope.calculateLicProPrice_renew = calculateLicProPrice_renew;
$scope.calculateLicLitePrice = calculateLicLitePrice;
$scope.calculateLicLitePrice_renew = calculateLicLitePrice_renew;
$scope.calculateLicProPrice = calculateLicProPrice;
$scope.yearLicPrice = {};
$scope.yearLicPrice['1'] = false;
$scope.yearLicPrice['2'] = false;
$scope.yearLicPrice['3'] = false;
$scope.fullViewerPrice = false;
$scope.fullPrice = false;
$scope.increaseGoodAmount = increaseGoodAmount;
$scope.reduceGoodAmount = reduceGoodAmount;
$scope.timerId
$scope.itemAddupdateFilter = function (item){
return item.canUpdateLic;
};
$scope.setGoodAmount = function(good){
if(!Number.isInteger(good.quantity))
good.quantity = 0;
if(good.quantity < 1){
good.quantity = 1;
}
if(good.quantity > 99){
good.quantity = 99;
}
//return false;
clearTimeout($scope.timerId);
$scope.timerId = setTimeout(function () {
if(good.quantityold && good.quantityold == good.quantity)
return false;
$('.preloader').show();
$http.get('/include/basket/changeGoodsCount.php?itemBasketId='+good.cartitemId+'&count='+good.quantity).then(function (response) {
good.quantityold = good.quantity;
$rootScope.$broadcast('reInitData');
$('.preloader').hide();
});
}, 1500);
}
function increaseGoodAmount(good){
if(!good.inbasket)
return false;
good.quantity++;
if(good.modules){
for(keyModule in good.modules){
if(good.modules[keyModule].inbasket){
good.modules[keyModule].quantity++;
}
}
}
$scope.setGoodAmount(good);
}
$scope.checkIfLicenseForUpdate = function(){
$flag = false;
if($scope.extRedactions){
if($scope.extRedactions.lite){
for(keyExtLite in $scope.extRedactions.lite){
$flag = $scope.extRedactions.lite[keyExtLite].canUpdateLic;
if($flag)
return $flag;
}
}
if($scope.extRedactions.pro){
for(keyExtPro in $scope.extRedactions.pro){
$flag = $scope.extRedactions.pro[keyExtPro].canUpdateLic;
if($flag)
return $flag;
}
}
}
return $flag;
}
$scope.changeModuleStatus = function($event, module, proItem){
if(module.inbasket){
deleteFromBasket($event, module);
}else{
addModuleToBasket($event, module, proItem);
}
}
$scope.changeViewerLic = function(year, proItem){
$('.preloader').show();
if($scope.ifViewerLicSolid(year, proItem)){
$scope.delViewerLic(proItem);
}else{
if(proItem.license.inbasket && proItem.license.cartitemId > 0){
$http.get('/include/basket/deleteGood.php?itemBasketId='+proItem.license.cartitemId).then(function successCallback(response) {
if(response.data.success == proItem.license.cartitemId){
proItem.license.inbasket = false;
proItem.license.years = false;
proItem.license.cartitemId = false;
$rootScope.$broadcast('reInitData');
$scope.addViewerLic(year,proItem);
}
}, function errorCallback(response) {
});
}else{
$scope.addViewerLic(year,proItem);
}
}
}
function reduceGoodAmount(good){
if(!good.inbasket)
return false;
if(good.quantity == 1)
return false;
good.quantity--;
if(good.modules){
for(keyModule in good.modules){
if(good.modules[keyModule].inbasket){
good.modules[keyModule].quantity--;
}
}
}
$scope.setGoodAmount(good);
}
$scope.checkIfInBaketLicenseUpdate = function(years, extItem){
if(!extItem.updateLic)
return false;
if(extItem.updateLic.years == years)
return true;
return false;
}
$scope.changeLicenseUpdate = function(years, extItem){
$('.preloader').show();
if(extItem.updateLic && extItem.updateLic.years == years){
$scope.delViewerLicUpdate(extItem.updateLic);
}else if(extItem.updateLic){
if(extItem.updateLic.cartitemId > 0){
$http.get('/include/basket/deleteGood.php?itemBasketId='+extItem.updateLic.cartitemId).then(function successCallback(response) {
if(response.data.success == extItem.updateLic.cartitemId){
extItem.updateLic.inbasket = false;
extItem.updateLic.years = false;
extItem.updateLic.cartitemId = false;
$rootScope.$broadcast('reInitData');
$scope.addViewerLicUpdateViewer(years,extItem);
}
}, function errorCallback(response) {
});
}else{
$scope.addViewerLicUpdateViewer(years,extItem);
}
}else{
$scope.addViewerLicUpdateViewer(years,extItem);
}
}
$scope.addViewerLicUpdateViewer = function(years, extItem){
$http.get('/include/basket/addLicenseUpdate.php?productId='+$scope.license.viewerLic.productID+"&years="+years + "&licenseId="+extItem.oldLicID).then(function successCallback(response) {
if(response.data.itemBasketId){
if(!extItem.updateLic)
extItem.updateLic = [];
extItem.updateLic.inbasket = true;
extItem.updateLic.years = years;
extItem.updateLic.price = response.data.price;
extItem.updateLic.cartitemId = response.data.itemBasketId;
$rootScope.$broadcast('reInitData');
$('.preloader').hide();
}else{
}
}, function errorCallback(response) {
$('.preloader').hide();
});
}
$scope.countBoughtModules = function(proItem){
var $n = 0;
for(keyModule in proItem.modules){
if(proItem.modules[keyModule].inbasket){
$n++;
}
}
return $n;
}
function changeViewBlock(blockType){
if(blockType == 'buy' && $scope.showBuyBlock){
return false;
}
else if(blockType == 'lic' && !$scope.showBuyBlock){
return false;
}
$scope.showBuyBlock = !$scope.showBuyBlock;
}
function redirect(url){
$window.location.href = url;
}
function calculateLicLitePrice(price, years){
var processedPrice = price.replace(/ /g, '');
if(years == 1)
return processedPrice * 0.3;
if(years == 2)
return processedPrice * 0.25;
if(years == 3)
return processedPrice * 0.2;
return false;
}
function calculateLicLitePrice_renew(good, years){
$price = false;
if($scope.site == "s1")
$price = good.price;
else
$price = good.price_en;
var processedPrice = $price.replace(/ /g, '');
if(years == 1)
return processedPrice * 0.3;
if(years == 2)
return processedPrice * 0.25;
if(years == 3)
return processedPrice * 0.2;
return false;
}
function calculateLicProPrice(good, years){
$price = good.price;
if(good.currency == 'USD')
$price = good.price_en;
var processedPrice = parseInt($price.replace(/ /g, ''));
processedPrice += parseInt(countModulesPrice(good));
if(years == 0)
return processedPrice;
if(years == 1)
return processedPrice * 0.3;
if(years == 2)
return processedPrice * 0.25;
if(years == 3)
return processedPrice * 0.2;
return false;
}
function calculateLicProPrice_renew(good, years){
$price = false;
if($scope.site == "s1")
$price = good.price;
else
$price = good.price_en;
var processedPrice = parseInt($price.replace(/ /g, ''));
processedPrice += parseInt(countModulesPrice_renew(good));
if(years == 0)
return processedPrice;
if(years == 1)
return processedPrice * 0.3;
if(years == 2)
return processedPrice * 0.25;
if(years == 3)
return processedPrice * 0.2;
return false;
}
function checkIfLiteRedactionsFull(){
for(keyLite in $scope.liteRedactions){
if(!$scope.liteRedactions[keyLite].inbasket){
return false;
}
}
return true;
}
function checkIfProRedactionsFull(){
for(keyPro in $scope.proRedactions){
if(!$scope.proRedactions[keyPro].inbasket){
return false;
}
}
return true;
}
function addRedactionlite(){
if(!$scope.checkIfLiteRedactionsFull())
return false;
$http.get('/include/basket/addRedaction.php?sectionID='+$scope.sectionID+"&siteID="+$scope.site).then(function successCallback(response) {
if(response.data.lite){
$scope.liteRedactions.push(response.data.lite[0]);
}
}, function errorCallback(response) {
});
}
function addRedactionpro(){
if(!$scope.checkIfProRedactionsFull())
return false;
$http.get('/include/basket/addRedaction.php?sectionID='+$scope.sectionID+"&siteID="+$scope.site).then(function successCallback(response) {
if(response.data.pro){
$scope.proRedactions.push(response.data.pro[0]);
}
}, function errorCallback(response) {
});
}
function initDicomviewerPage(){
if($scope.sectionID)
$http.get('/include/basket/getBasketInfo.php?sectionID='+$scope.sectionID+"&siteID="+$scope.site).then(buyPageInfo);
}
function countModulesPrice(good){
//if(!good.inbasket)
// return 0;
$total = 0;
if(good.modules){
for(keyModule in good.modules){
if(good.modules[keyModule].inbasket){
$price = good.modules[keyModule].price;
if(good.currency == 'USD')
$price = good.modules[keyModule].price_en;
var processedModule = $price.replace(/ /g, '');
$total += parseInt(processedModule);
}
}
}
return $total;
}
function countModulesPrice_renew(good){
//if(!good.inbasket)
// return 0;
$total = 0;
if(good.modules){
for(keyModule in good.modules){
if(good.modules[keyModule].inbasket){
$price = false;
if($scope.site == "s1")
$price = good.modules[keyModule].price;
else
$price = good.modules[keyModule].price_en;
var processedModule = $price.replace(/ /g, '');
$total += parseInt(processedModule);
}
}
}
return $total;
}
$scope.getNumber = function(num) {
return new Array(num);
}
function buyPageInfo(response) {
console.log(response)
if(response.data.USD_CUR)
$scope.usdCurr = response.data.USD_CUR;
if(response.data.viewerLic)
$scope.license.viewerLic = response.data.viewerLic;
else
$scope.license.viewerLic = false;
if(response.data.serverLic)
$scope.license.serverLic = response.data.serverLic;
else
$scope.license.serverLic = false
if(response.data.listOfExtLic)
$scope.extRedactions = response.data.listOfExtLic;
if(!$scope.extRedactions.lite )
$scope.extRedactions.lite = [];
if(!$scope.extRedactions.pro)
$scope.extRedactions.pro = [];
$scope.liteRedactions = response.data.lite;
$scope.needCheckEndProRender = true;
$scope.proRedactions = response.data.pro;
$('.preloader').hide();
}
$scope.$on('proRedactionsRenderEnd', function(proRedactionsRenderEndEvent) {
if(!$scope.needCheckEndProRender)
return false;
for(keyPro in $scope.proRedactions){
if($scope.proRedactions[keyPro].inbasket){
//openCase(keyPro);
}
}
$scope.needCheckEndProRender = false;
});
function addToBasket($event, good){
if(good.inbasket)
return false;
$http.get('/include/basket/addGood.php?productID='+good.productID+'&uniqueCode='+good.basketId).then(function successCallback(response) {
if(response.data.itemBasketId){
//gtag_report_addToBasket();
good.inbasket = true;
good.cartitemId = response.data.itemBasketId;
$rootScope.$broadcast('reInitData');
}
}, function errorCallback(response) {
});
}
function addModuleToBasket($event, module, lic){
if(module.inbasket || !lic.inbasket || !lic.basketId)
return false;
$http.get('/include/basket/addGood.php?productID='+module.productID+'&parenId='+lic.basketId).then(function successCallback(response) {
if(response.data.itemBasketId){
module.inbasket = true;
module.cartitemId = response.data.itemBasketId;
module.quantity = lic.quantity;
$rootScope.$broadcast('reInitData');
}
}, function errorCallback(response) {
});
}
function deleteFromBasket($event, good){
if(!good.inbasket)
return false;
$http.get('/include/basket/deleteGood.php?itemBasketId='+good.cartitemId).then(function successCallback(response) {
if(response.data.success == good.cartitemId){
good.inbasket = false;
good.quantity = 1;
if(good.modules){
for(keyModule in good.modules){
good.modules[keyModule].inbasket = false;
good.modules[keyModule].quantity = 1;
}
}
if(good.license && good.license.inbasket){
good.license.inbasket = false;
good.license.years = false;
good.license.cartitemId = false;
}
$rootScope.$broadcast('reInitData');
}
}, function errorCallback(response) {
});
}
function calculateDicomViewerPrice(){
var price = 0;
for(keyLite in $scope.liteRedactions){
if($scope.liteRedactions[keyLite].inbasket){
var processed = $scope.liteRedactions[keyLite].price.replace(/ /g, '');
price += (parseInt(processed) * parseInt($scope.liteRedactions[keyLite].quantity));
if($scope.liteRedactions[keyLite].license.inbasket){
price += parseInt( parseInt(parseInt(processed) * (0.3-(($scope.liteRedactions[keyLite].license.years-1)*0.05))* $scope.liteRedactions[keyLite].license.years) * parseInt($scope.liteRedactions[keyLite].quantity));
}
}
}
for(keyPro in $scope.proRedactions){
if($scope.proRedactions[keyPro].inbasket){
var processed = $scope.proRedactions[keyPro].price.replace(/ /g, '');
var modulesProcc = 0;
price += (parseInt(processed) * parseInt($scope.proRedactions[keyPro].quantity));
for(keyModule in $scope.proRedactions[keyPro].modules){
if($scope.proRedactions[keyPro].modules[keyModule].inbasket){
var processedModule = $scope.proRedactions[keyPro].modules[keyModule].price.replace(/ /g, '');
modulesProcc += parseInt(processedModule);
price += parseInt(parseInt(processedModule) * parseInt($scope.proRedactions[keyPro].modules[keyModule].quantity));
}
}
if($scope.proRedactions[keyPro].license.inbasket){
price += parseInt(parseInt( parseInt(modulesProcc) + parseInt(processed)) * (0.3-(($scope.proRedactions[keyPro].license.years-1)*0.05))* $scope.proRedactions[keyPro].license.years) * parseInt($scope.proRedactions[keyPro].quantity);
}
}
}
$scope.fullViewerPrice = price;
$scope.fullPrice = price;
return price;
}
function parsePrice($price, currency = false, state = false){
siteId = false;
if(!currency)
siteId = $scope.site;
else if(currency == "RUB")
siteId = 's1';
else if(currency == "USD")
siteId = 's2';
if(siteId == 's1')
return $price.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1 ');
else
if(!state)
return parseInt($price);
else
return $price.toFixed(1);
}
$scope.parsePriceCustom = function(item, currency = false, state = false){
siteId = false;
if(!currency)
siteId = $scope.site;
else if(currency == "RUB")
siteId = 's1';
else if(currency == "USD")
siteId = 's2';
$price = item.price;
if(siteId == 's2')
$price = item.price_en;
if(siteId == 's1')
return $price.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1 ');
else
if(!state)
return parseInt($price);
else
return $price.toFixed(1);
}
$scope.ifViewerLicSolid = function(years, good){
if(!good.license)
return false;
if(!good.license.inbasket)
return false;
if(good.license.years != years)
return false;
return true;
}
$scope.ifViewerLicActive = function(years){
if(calculateDicomViewerPrice() == 0)
return false;
if($scope.license.viewerLic.inbasket && $scope.license.viewerLic.years != years)
return false;
return true;
}
$scope.addViewerLic = function(years, good){
if(!$scope.ifViewerLicActive(years)){
return;
}
$http.get('/include/basket/addLicense.php?productId='+$scope.license.viewerLic.productID+"&years="+years + "&basketItemId="+good.cartitemId).then(function successCallback(response) {
if(response.data.itemBasketId){
good.license.inbasket = true;
good.license.years = years;
good.license.cartitemId = response.data.itemBasketId;
$rootScope.$broadcast('reInitData');
$('.preloader').hide();
}
}, function errorCallback(response) {
$('.preloader').hide();
});
}
$scope.delViewerLicUpdate = function(good){
$http.get('/include/basket/deleteGood.php?itemBasketId='+good.cartitemId).then(function successCallback(response) {
if(response.data.success == good.cartitemId){
good.inbasket = false;
good.years = false;
good.cartitemId = false;
$rootScope.$broadcast('reInitData');
$('.preloader').hide();
}
}, function errorCallback(response) {
$('.preloader').hide();
});
}
$scope.delViewerLic = function(good){
if(!good.license.inbasket || good.license.cartitemId < 0)
return;
$http.get('/include/basket/deleteGood.php?itemBasketId='+good.license.cartitemId).then(function successCallback(response) {
if(response.data.success == good.license.cartitemId){
good.license.inbasket = false;
good.license.years = false;
good.license.cartitemId = false;
$rootScope.$broadcast('reInitData');
$('.preloader').hide();
}
}, function errorCallback(response) {
$('.preloader').hide();
});
}
$scope.calculateFullDicomViewerPrice = function(){
var price = $scope.calculateDicomViewerPrice();
if($scope.license.viewerLic.inbasket)
price += parseInt($scope.license.viewerLic.price.replace(/ /g, ''));
return price;
}
}]);
inobitecApp.controller('buyServerController', ['$window', '$scope', '$http', '$rootScope', function buyServerController($window, $scope, $http, $rootScope) {
$scope.usdCurr = false;
$scope.showBuyBlock = true;
$scope.sectionID = false;
$scope.site = "s1";
$scope.serverRedaction = [];
$scope.initDicomserverPage = initDicomserverPage;
$scope.addServerToBasket = addServerToBasket;
$scope.delServerFromBasket = delServerFromBasket;
$scope.extRedactions = [];
$scope.license = {
"viewerLic": false,
"serverLic": false,
};
$scope.serverProductKey = false;
$scope.yearLicPrice = {};
$scope.yearLicPrice['1'] = false;
$scope.yearLicPrice['2'] = false;
$scope.yearLicPrice['3'] = false;
$scope.fullViewerPrice = false;
$scope.fullPrice = false;
$scope.beforeLodaing = true;
$scope.changeViewBlock = changeViewBlock;
$scope.redirect = redirect;
$scope.calculateLicServerPrice = calculateLicServerPrice;
$scope.calculateLicServerPrice_renew = calculateLicServerPrice_renew;
$scope.existCompCodeArr = false;
$scope.redactionForNewConnections = false;
$scope.ignoreSetConnections = false;
$scope.itemAddupdateFilter = function (item){
return item.canUpdateLic;
};
$scope.$on('reInitDataMain', function(event, data) {
$scope.serverProductKey = "";
console.log("REINITDATAMAIN");
$scope.initDicomserverPage();
});
$scope.checkIfLicenseForUpdate = function(){
$flag = false;
if($scope.extRedactions){
if($scope.extRedactions.server){
for(keyExtServ in $scope.extRedactions.server){
console.log($scope.extRedactions.server[keyExtServ]);
$flag = $scope.extRedactions.server[keyExtServ].canUpdateLic;
if($flag)
return $flag;
}
}
}
return $flag;
}
$scope.changeServerLic = function(years, good){
$('.preloader').show();
if($scope.ifServerLicSolid(years, good)){
$scope.delServerLic(good);
}else{
if(good.license.inbasket && good.license.cartitemId > 0){
$http.get('/include/basket/deleteGood.php?itemBasketId='+good.license.cartitemId).then(function successCallback(response) {
if(response.data.success == good.license.cartitemId){
good.license.inbasket = false;
good.license.years = false;
good.license.cartitemId = false;
$rootScope.$broadcast('reInitData');
$scope.addServerLic(years,good);
}
}, function errorCallback(response) {
//console.log(response);
});
}else{
$scope.addServerLic(years,good);
}
}
}
$scope.getNumber = function(num) {
return new Array(num);
}
function calculateLicServerPrice(price, years){
if(!price)
return false;
if(Number.isInteger(price))
var processedPrice = price;
else
var processedPrice = price.replace(/ /g, '');
if(years == 1)
return processedPrice * 0.3;
if(years == 2)
return processedPrice * 0.25;
if(years == 3)
return processedPrice * 0.2;
return false;
}
function calculateLicServerPrice_renew(extItem, years, currency = false){
if($scope.site == "s1" || ($scope.site == "s2" && currency == 'RUB') )
price = extItem.price;
else
price = extItem.price_en;
price = parseInt(extItem.price) * parseInt(extItem.numConnection);
if(!price)
return false;
if(Number.isInteger(price))
var processedPrice = price;
else
var processedPrice = price.replace(/ /g, '');
if(years == 1){
if($scope.site == "s1" || ($scope.site == "s2" && currency == 'RUB') )
return processedPrice * 0.3;
return processedPrice/$scope.usdCurr * 0.3;
}
if(years == 2){
if($scope.site == "s1" || ($scope.site == "s2" && currency == 'RUB') )
return processedPrice * 0.25;
return processedPrice/$scope.usdCurr * 0.25;
}
if(years == 3){
if($scope.site == "s1" || ($scope.site == "s2" && currency == 'RUB') )
return processedPrice * 0.2;
return processedPrice/$scope.usdCurr * 0.2;
}
return false;
}
function changeViewBlock(blockType){
if(blockType == 'buy' && $scope.showBuyBlock){
return false;
}
else if(blockType == 'lic' && !$scope.showBuyBlock){
return false;
}
$scope.showBuyBlock = !$scope.showBuyBlock;
}
function initDicomserverPage(){
console.log('/include/basket/getBasketInfo.php?sectionID='+$scope.sectionID+"&siteID="+$scope.site);
if($scope.sectionID)
$http.get('/include/basket/getBasketInfo.php?sectionID='+$scope.sectionID+"&siteID="+$scope.site).then(buyServerPageInfo);
};
function redirect(url){
$window.location.href = url;
}
$scope.$watch('serverConnections',function(newValue,oldValue)
{
if($scope.serverRedaction.inbasket){
if(newValue != $scope.serverRedaction.serverConnections)
$scope.serverConnections = parseInt($scope.serverRedaction.serverConnections);
}
});
$scope.$watch('serverProductKey',function(newValue,oldValue)
{
if(newValue && newValue != oldValue){
$scope.checkIfExistCompCode(newValue);
}
});
$scope.checkIfExistCompCode = function(compCode){
if($scope.serverRedaction.inbasket || ($scope.redactionForNewConnections && $scope.redactionForNewConnections.inbasket ))
return false;
$http.get('/include/basket/checkIfCompCodeExist.php?compCode='+compCode).then(function successCallback(response){
$scope.existCompCodeArr = response.data;
if($scope.existCompCodeArr.existCode){ //если код повторяется
if(!$scope.existCompCodeArr.currentUser){ //если код для другого пользователя
Popup('another_user_compcode');
$scope.redactionForNewConnections = false;
}else{ //если код текущегоп ользователя
var maxNum = 1;
if($scope.extRedactions)
if($scope.extRedactions.server){
var $tempRedaction = false;
for(keyExtServ in $scope.extRedactions.server){
if($scope.extRedactions.server[keyExtServ].compCode == compCode){
$tempRedaction = $scope.extRedactions.server[keyExtServ]
}
}
if($tempRedaction){
$scope.redactionForNewConnections = [];
$scope.redactionForNewConnections.shortName = $tempRedaction.shortName;
$scope.redactionForNewConnections.detailText = $tempRedaction.detailText;
$scope.redactionForNewConnections.price = $tempRedaction.price;
$scope.redactionForNewConnections.productID = $tempRedaction.productID;
$scope.redactionForNewConnections.inbasket = false;
$scope.redactionForNewConnections.basketId = $tempRedaction.basketId;
$scope.redactionForNewConnections.lic = $tempRedaction.lic;
$scope.redactionForNewConnections.numConnection = $tempRedaction.numConnection;
$scope.redactionForNewConnections.oldLicID = $tempRedaction.oldLicID;
$scope.redactionForNewConnections.compCode = $tempRedaction.compCode;
$scope.redactionForNewConnections.maxYears = $tempRedaction.maxYears;
$scope.redactionForNewConnections.licKey = $tempRedaction.licKey;
$scope.redactionForNewConnections.actualLic = $tempRedaction.actualLic;
$scope.redactionForNewConnections.endData = $tempRedaction.endData;
$scope.redactionForNewConnections.haveUpdates = $tempRedaction.haveUpdates;
$scope.redactionForNewConnections.updateLic = [];
if($scope.redactionForNewConnections.haveUpdates){
Popup('already_have_updates');
return false;
}
}else{
$scope.redactionForNewConnections = [];
$scope.redactionForNewConnections.haveUpdates = true;
Popup('already_have_updates');
return false;
}
//maxNum = 50 - $scope.redactionForNewConnections.numConnection;
maxNum = 50;
}
if($scope.serverConnections > maxNum){
$scope.serverConnections = maxNum;
$( ".slider" ).slider( "value", maxNum );
}
$( ".slider" )
.slider( "option", "max", maxNum )
.slider("pips", "refresh")
.draggable({disabled: true});
}
}else{
$scope.redactionForNewConnections = false;
$( ".slider" )
.slider( "option", "max", 50 )
.slider("pips", "refresh")
.draggable({disabled: true});
}
console.log(response);
});
}
$scope.parseInt = function(num){
return parseInt(num);
}
function buyServerPageInfo(response){
console.log(response);
if(response.data.USD_CUR)
$scope.usdCurr = response.data.USD_CUR;
if(response.data.viewerLic)
$scope.license.viewerLic = response.data.viewerLic;
else
$scope.license.viewerLic = false;
if(response.data.serverLic)
$scope.license.serverLic = response.data.serverLic;
else
$scope.license.serverLic = false;
if(response.data.listOfExtLic)
$scope.extRedactions = response.data.listOfExtLic;
if(!$scope.extRedactions.server )
$scope.extRedactions.server = [];
if(response.data.newServConn){
$scope.redactionForNewConnections = response.data.newServConn;
}else
$scope.redactionForNewConnections = false;
if(response.data.server.serverConnections)
$scope.serverConnections = parseInt(response.data.server.serverConnections);
else
$scope.serverConnections = 1;
if(response.data.server.productCode)
$scope.serverProductKey = response.data.server.productCode;
$scope.serverRedaction = response.data.server;
$scope.beforeLodaing = false;
if($scope.redactionForNewConnections && $scope.redactionForNewConnections.inbasket){
$scope.serverProductKey = $scope.redactionForNewConnections.compCode;
//maxNum = 50 - $scope.redactionForNewConnections.numConnection;
maxNum = 50;
$scope.serverConnections = $scope.redactionForNewConnections.updateLic.connectionsNum;
$( ".slider" )
.slider( "option", "max", maxNum )
.slider("pips", "refresh")
.draggable({disabled: true});
//$scope.serverConnections =
}
$('.preloader').hide();
$scope.ignoreSetConnections = true;
$( ".slider" ).slider( "value", $scope.serverConnections );
$scope.ignoreSetConnections = false;
if($scope.serverRedaction.inbasket || ($scope.redactionForNewConnections && $scope.redactionForNewConnections.inbasket)){
increaseLicConn($scope.redactionForNewConnections.oldLicID, $scope.serverConnections);
$( ".slider" ).slider( "disable" );
$('.slider').draggable({
disabled: true
});
} else {
$( ".slider" ).slider( "enable" );
$('.slider').draggable({
disabled: false
});
}
}
$scope.tryAddServer = false;
$scope.checkIfInBaketLicenseUpdate = function(years, extItem){
if(!extItem.updateLic)
return false;
if(extItem.updateLic.years == years)
return true;
return false;
}
$scope.changeLicenseUpdate = function(years, extItem){
$('.preloader').show();
if(extItem.updateLic && extItem.updateLic.years == years){
$scope.delViewerLicUpdate(extItem.updateLic);
}else if(extItem.updateLic){
if(extItem.updateLic.cartitemId > 0){
$http.get('/include/basket/deleteGood.php?itemBasketId='+extItem.updateLic.cartitemId).then(function successCallback(response) {
if(response.data.success == extItem.updateLic.cartitemId){
extItem.updateLic.inbasket = false;
extItem.updateLic.years = false;
extItem.updateLic.cartitemId = false;
$rootScope.$broadcast('reInitData');
$scope.addViewerLicUpdateServer(years,extItem);
}
}, function errorCallback(response) {
//console.log(response);
});
}else{
$scope.addViewerLicUpdateServer(years,extItem);
}
}else{
$scope.addViewerLicUpdateServer(years,extItem);
}
}
$scope.delViewerLicUpdate = function(good){
$http.get('/include/basket/deleteGood.php?itemBasketId='+good.cartitemId).then(function successCallback(response) {
if(response.data.success == good.cartitemId){
good.inbasket = false;
good.years = false;
good.cartitemId = false;
$rootScope.$broadcast('reInitData');
$('.preloader').hide();
}
}, function errorCallback(response) {
$('.preloader').hide();
//console.log(response);
}
);
}
$scope.addViewerLicUpdateServer = function(years, extItem){
$http.get('/include/basket/addLicenseUpdate.php?productId='+$scope.license.serverLic.productID+"&years="+years + "&licenseId="+extItem.oldLicID).then(function successCallback(response) {
if(response.data.itemBasketId){
if(!extItem.updateLic)
extItem.updateLic = [];
extItem.updateLic.inbasket = true;
extItem.updateLic.years = years;
extItem.updateLic.price = response.data.price;
extItem.updateLic.cartitemId = response.data.itemBasketId;
$rootScope.$broadcast('reInitData');
$('.preloader').hide();
}else{
console.log(response.data);
}
}, function errorCallback(response) {
$('.preloader').hide();
//console.log(response);
});
}
function increaseLicConn(LicId, Conn){
for(keyExtServ in $scope.extRedactions.server){
if($scope.extRedactions.server[keyExtServ].oldLicID == LicId){
$scope.extRedactions.server[keyExtServ].numConnection = parseInt($scope.extRedactions.server[keyExtServ].numConnection) + parseInt(Conn);
}
}
}
function deacreaseConn(LicId, Conn){
for(keyExtServ in $scope.extRedactions.server){
if($scope.extRedactions.server[keyExtServ].oldLicID == LicId){
$scope.extRedactions.server[keyExtServ].numConnection = parseInt($scope.extRedactions.server[keyExtServ].numConnection) - parseInt(Conn);
}
}
}
function addServerToBasket(){
$scope.tryAddServer = true;
if(!$scope.serverProductKey){
return false;
}
if($scope.existCompCodeArr){
if($scope.existCompCodeArr.existCode){
if(!$scope.existCompCodeArr.currentUser){
Popup('another_user_compcode');
}else{
if($scope.redactionForNewConnections.haveUpdates){
Popup('already_have_updates');
return false;
}
if($scope.redactionForNewConnections && $scope.redactionForNewConnections.inbasket){
return false;
}else{
$http.get('/include/basket/addConnectionsToServer.php?productId='+$scope.license.serverLic.productID+'&licenseId='+$scope.redactionForNewConnections.oldLicID+'&conn='+$scope.serverConnections+'&siteID='+$scope.site).then(function successCallback(response) {
if(response.data.itemBasketId){
$scope.redactionForNewConnections.inbasket = true;
if(!$scope.redactionForNewConnections.updateLic)
$scope.redactionForNewConnections.updateLic = [];
$scope.redactionForNewConnections.updateLic.cartitemId = response.data.itemBasketId;
$scope.redactionForNewConnections.updateLic.inbasket = true;
$scope.redactionForNewConnections.updateLic.price = $scope.parsePrice(response.data.price);
$scope.redactionForNewConnections.updateLic.priceEN = $scope.parsePrice(response.data.price_en);
increaseLicConn($scope.redactionForNewConnections.oldLicID,$scope.serverConnections);
$rootScope.$broadcast('reInitData');
$( ".slider" ).slider( "disable" );
$('.slider').draggable({
disabled: true
});
}
});
}
}
return false;
}
}
if(!$scope.serverRedaction.inbasket && $scope.serverRedaction.offers[$scope.serverConnections]){
$http.get('/include/basket/addGood.php?productID='+$scope.serverRedaction.offers[$scope.serverConnections].productID+'&uniqueCode='+$scope.serverRedaction.basketId+'&productKey='+$scope.serverProductKey).then(function successCallback(response) {
console.log(response);
if(response.data.itemBasketId){
$scope.serverRedaction.inbasket = true;
$scope.serverRedaction.cartitemId = response.data.itemBasketId;
$scope.serverRedaction.serverConnections = $scope.serverConnections;
$rootScope.$broadcast('reInitData');
$( ".slider" ).slider( "disable" );
$('.slider').draggable({
disabled: true
});
}
}, function errorCallback(response) {
//console.log(response);
});
}
}
function delServerFromBasket(good){
if($scope.serverRedaction.inbasket){
$http.get('/include/basket/deleteGood.php?itemBasketId='+good.cartitemId).then(function successCallback(response) {
if(response.data.success == $scope.serverRedaction.cartitemId){
good.inbasket = false;
good.cartitemId = false;
$scope.serverRedaction.license.inbasket = false;
$scope.serverRedaction.license.years = false;
$scope.serverRedaction.license.cartitemId = false;
$rootScope.$broadcast('reInitData');
$( ".slider" ).slider( "enable" );
/*$('.slider').draggable({
disabled: false
});*/
$scope.delServerLic(good);
}
});
}
if($scope.redactionForNewConnections && $scope.redactionForNewConnections.inbasket){
$http.get('/include/basket/deleteGood.php?itemBasketId='+$scope.redactionForNewConnections.updateLic.cartitemId).then(function successCallback(response) {
if(response.data.success == $scope.redactionForNewConnections.updateLic.cartitemId){
$scope.redactionForNewConnections.inbasket = false;
$scope.redactionForNewConnections.updateLic.cartitemId = false;
$scope.redactionForNewConnections.updateLic.inbasket = false;
console.log($scope.existCompCodeArr);
$scope.checkIfExistCompCode($scope.serverProductKey);
deacreaseConn($scope.redactionForNewConnections.oldLicID, $scope.serverConnections);
$rootScope.$broadcast('reInitData');
$( ".slider" ).slider( "enable" );
/*$('.slider').draggable({
disabled: false
});*/
console.log("TO DO - продление что делать?");
}
});
}
}
$scope.ifServerLicSolid = function(years, good){
if(!good.inbasket)
return false;
if(good.license.inbasket && good.license.years == years)
return true;
return false;
}
$scope.ifServerLicActive = function(years, good){
if(!good.inbasket)
return false;
if(good.license.years && good.license.years != years)
return false;
return true;
}
$scope.addServerLic = function(years, good){
if(!$scope.ifServerLicActive(years, good)){
return;
}
$http.get('/include/basket/addLicense.php?productId='+$scope.license.serverLic.productID+"&years="+years+"&basketItemId="+good.cartitemId).then(function successCallback(response) {
if(response.data.itemBasketId){
good.license.inbasket = true;
good.license.years = years;
good.license.cartitemId = response.data.itemBasketId;
$rootScope.$broadcast('reInitData');
$('.preloader').hide();
}
}, function errorCallback(response) {
$('.preloader').hide();
//console.log(response);
});
}
$scope.delServerLic = function(good){
if($scope.license.serverLic.cartitemId < 0)
return;
$http.get('/include/basket/deleteGood.php?itemBasketId='+good.license.cartitemId).then(function successCallback(response) {
if(response.data.success == good.license.cartitemId){
good.license.inbasket = false;
good.license.years = false;
good.license.cartitemId = false;
$rootScope.$broadcast('reInitData');
$('.preloader').hide();
}
}, function errorCallback(response) {
$('.preloader').hide();
//console.log(response);
});
}
$scope.calcServerFullPrices = function(){
siteId = $scope.site;
if($scope.beforeLodaing)
return 0;
$scope.fullPrice = 0;
$scope.yearLicPrice["1"] = parseInt($scope.serverRedaction.offers[$scope.serverConnections].price.replace(/ /g, ''))*0.3;
$scope.yearLicPrice["2"] = parseInt($scope.serverRedaction.offers[$scope.serverConnections].price.replace(/ /g, ''))*0.25;
$scope.yearLicPrice["3"] = parseInt($scope.serverRedaction.offers[$scope.serverConnections].price.replace(/ /g, ''))*0.2;
if($scope.serverRedaction.inbasket)
$scope.fullPrice += parseInt($scope.serverRedaction.offers[$scope.serverConnections].price.replace(/ /g, ''));
if($scope.serverRedaction.license.inbasket){
$scope.fullPrice += parseInt($scope.yearLicPrice[$scope.serverRedaction.license.years])*parseInt($scope.serverRedaction.license.years);
}
if($scope.redactionForNewConnections && $scope.redactionForNewConnections.inbasket){
if($scope.redactionForNewConnections.updateLic.cartitemId && $scope.redactionForNewConnections.updateLic.inbasket){
console.log($scope.redactionForNewConnections);
console.log(siteId);
if(siteId == 's2')
$scope.fullPrice += parseInt($scope.redactionForNewConnections.updateLic.price);
else
$scope.fullPrice += parseInt($scope.redactionForNewConnections.updateLic.price.replace(/ /g, ''));
}
}
return $scope.fullPrice;
}
$scope.parsePrice = function($price, currency = false, state = false){
siteId = false;
if(!currency)
siteId = $scope.site;
else if(currency == "RUB")
siteId = 's1';
else if(currency == "USD")
siteId = 's2';
if(siteId == 's1')
return $price.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1 ');
else
if(!state)
return parseInt($price);
else
return $price.toFixed(1);
}
$scope.calcBuyServerPrice = function($servobj){
if($servobj.currency == "RUB")
$priceOneConn = $servobj.price;
else
$priceOneConn = $servobj.price_en;
return parseInt($priceOneConn)*parseInt($servobj.numConnection)
}
/*$scope.parsePrice = function($price){
if($scope.site == 's1')
return $price.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1 ');
else
return parseInt($price);
}*/
$scope.setServerConnections = function(serverConnections){
if($scope.ignoreSetConnections)
return false;
if($scope.serverRedaction.inbasket){
$( ".slider" ).slider( "value", $scope.serverRedaction.serverConnections );
}else{
$scope.serverConnections = serverConnections;
}
return true;
}
//console.log("Test controller");
}]);
inobitecApp.controller('cartController', ['$window','$scope', '$http', '$rootScope', '$window', function cartController($window, $scope, $http, $rootScope, $window) {
$scope.liteRedactions = [];
$scope.proRedactions = [];
$scope.serverRedaction = false;
$scope.extRedactions = [];
$scope.newServConn = [];
$scope.site = "s1";
$scope.license = {
"viewerLic": false,
"serverLic": false,
};
$scope.beforeFirstLoading = true;
$scope.calculateDicomViewerPrice = calculateDicomViewerPrice;
$scope.calculateFullPrice = calculateFullPrice;
$scope.parsePrice = parsePrice;
$scope.redirect = redirect;
$scope.initCart = initCart;
$scope.clearBasket = clearBasket;
$scope.$on('reInitDataMain', function(event, data) {
console.log("REINITDATAMAIN");
$scope.initCart();
});
function redirect(url){
$window.location.href = url;
}
function clearBasket(){
Popup('basketAlert');
return false;
$http.get('/include/basket/clearBasket.php').then(function successCallback(response) {
if(response.data.success == 1){
$rootScope.$broadcast('reInitData');
$scope.initCart();
}
}, function errorCallback(response) {
//console.log(response);
});
}
$scope.countBoughtModules = function(proItem){
var $n = 0;
for(keyModule in proItem.modules){
if(proItem.modules[keyModule].inbasket){
$n++;
}
}
return $n;
}
$scope.defaultDelGood = function(good){
if(!good.inbasket)
return false;
$rootScope.$broadcast('sendItemID', good.cartitemId);
Popup('basketAlertTwo');
return false;
$http.get('/include/basket/deleteGood.php?itemBasketId='+good.cartitemId).then(function successCallback(response) {
if(response.data.success == good.cartitemId){
good.inbasket = false;
if(good.modules){
for(keyModule in good.modules){
good.modules[keyModule].inbasket = false;
}
}
$rootScope.$broadcast('reInitData');
$scope.initCart();
}
}, function errorCallback(response) {
//console.log(response);
});
}
$scope.checkIfLiteRedactionInBAsket = function(){
for(keyLite in $scope.liteRedactions){
if($scope.liteRedactions[keyLite].inbasket){
return true;
}
}
return false;
}
$scope.checkIfViewerInBasket = function(){
for(keyLite in $scope.liteRedactions){
//console.log($scope.liteRedactions[keyLite].inbasket);
if($scope.liteRedactions[keyLite].inbasket){
return true;
}
}
for(keyPro in $scope.proRedactions){
//console.log($scope.proRedactions[keyPro].inbasket);
if($scope.proRedactions[keyPro].inbasket){
return true;
}
}
return false;
}
$scope.licenseUpdateFilter = function(item){
if(item.updateLic && item.updateLic.inbasket)
return true;
return false
}
$scope.licenseUpdateViewerCount = function(){
var $count = 0;
if($scope.extRedactions){
for(keyLiteUpdate in $scope.extRedactions.lite){
if($scope.extRedactions.lite[keyLiteUpdate].updateLic && $scope.extRedactions.lite[keyLiteUpdate].updateLic.inbasket && $scope.extRedactions.lite[keyLiteUpdate].updateLic.cartitemId > 0)
$count++;
}
for(keyProUpdate in $scope.extRedactions.pro){
if($scope.extRedactions.pro[keyProUpdate].updateLic && $scope.extRedactions.pro[keyProUpdate].updateLic.inbasket && $scope.extRedactions.pro[keyProUpdate].updateLic.cartitemId > 0)
$count++;
}
for(keyProUpdate in $scope.extRedactions.server){
if($scope.extRedactions.server[keyProUpdate].updateLic && $scope.extRedactions.server[keyProUpdate].updateLic.inbasket && $scope.extRedactions.server[keyProUpdate].updateLic.cartitemId > 0)
$count++;
}
}
return $count;
}
$scope.itemFilter = function (item){
return item.inbasket;
};
$scope.delLiteFromBasket = function($event, good){
$scope.defaultDelGood(good);
};
$scope.delProFromBasket = function($event, good){
//if($scope.canDeletePro(good)){
$scope.defaultDelGood(good);
//}else
//return false;
};
$scope.canDeletePro = function(pro){
for(keyModule in pro.modules){
if(pro.modules[keyModule].inbasket)
return false;
}
return true;
}
$scope.delModuleFromBasket = function($event, good){
$scope.defaultDelGood(good);
};
$scope.delServerFromBasket = function($event){
$scope.defaultDelGood($scope.serverRedaction);
return false;
/*if($scope.serverRedaction.inbasket){
$http.get('/include/basket/deleteGood.php?itemBasketId='+$scope.serverRedaction.cartitemId).then(function successCallback(response) {
if(response.data.success == $scope.serverRedaction.cartitemId){
$scope.serverRedaction = false;
$rootScope.$broadcast('reInitData');
if($scope.license.serverLic.inbasket){
$scope.defaultDelGood($scope.license.serverLic);
}
}
});
}*/
};
$scope.strPriceToNumber = function(strPrice){
if(strPrice)
return strPrice.replace(/ /g, '');
return false;
}
function calculateDicomViewerPrice(){
var price = 0;
for(keyLite in $scope.liteRedactions){
if($scope.liteRedactions[keyLite].inbasket){
var processed = $scope.liteRedactions[keyLite].price.replace(/ /g, '');
price += parseInt(processed) * $scope.liteRedactions[keyLite].quantity;
if($scope.liteRedactions[keyLite].license && $scope.liteRedactions[keyLite].license.inbasket){
var processed = $scope.liteRedactions[keyLite].license.price.replace(/ /g, '');
price += parseInt(processed) * $scope.liteRedactions[keyLite].quantity;
}
}
}
for(keyPro in $scope.proRedactions){
if($scope.proRedactions[keyPro].inbasket){
var processed = $scope.proRedactions[keyPro].price.replace(/ /g, '');
price += parseInt(processed) * $scope.proRedactions[keyPro].quantity;
for(keyModule in $scope.proRedactions[keyPro].modules){
if($scope.proRedactions[keyPro].modules[keyModule].inbasket){
var processedModule = $scope.proRedactions[keyPro].modules[keyModule].price.replace(/ /g, '');
price += parseInt(processedModule) * $scope.proRedactions[keyPro].modules[keyModule].quantity ;
}
}
if($scope.proRedactions[keyPro].license.inbasket){
var processed = $scope.proRedactions[keyPro].license.price.replace(/ /g, '');
price += parseInt(processed) * $scope.proRedactions[keyPro].quantity;
}
}
}
if($scope.extRedactions && $scope.extRedactions.lite){
for(keyUpdateLite in $scope.extRedactions.lite){
if($scope.extRedactions.lite[keyUpdateLite].updateLic && $scope.extRedactions.lite[keyUpdateLite].updateLic.inbasket){
var processed = $scope.extRedactions.lite[keyUpdateLite].updateLic.price.replace(/ /g, '');
price += parseInt(processed);
}
}
}
if($scope.extRedactions && $scope.extRedactions.pro){
for(keyUpdatePro in $scope.extRedactions.pro){
if($scope.extRedactions.pro[keyUpdatePro].updateLic && $scope.extRedactions.pro[keyUpdatePro].updateLic.inbasket){
var processed = $scope.extRedactions.pro[keyUpdatePro].updateLic.price.replace(/ /g, '');
price += parseInt(processed);
}
}
}
return price;
}
function calculateFullPrice(){
var fullPrice = $scope.calculateDicomViewerPrice();
if($scope.serverRedaction){
fullPrice += parseInt($scope.serverRedaction.offers[$scope.serverRedaction.serverConnections].price.replace(/ /g, ''));
if($scope.serverRedaction.license.inbasket){
fullPrice += parseInt($scope.serverRedaction.license.price.replace(/ /g, ''));
}
}
if($scope.extRedactions.server){
for(keyUpdateServer in $scope.extRedactions.server){
if($scope.extRedactions.server[keyUpdateServer].updateLic && $scope.extRedactions.server[keyUpdateServer].updateLic.inbasket){
var processed = $scope.extRedactions.server[keyUpdateServer].updateLic.price.replace(/ /g, '');
fullPrice += parseInt(processed);
}
}
}
if($scope.newServConn && $scope.newServConn.inbasket){
if(Number.isInteger($scope.newServConn.updateLic.price))
fullPrice += parseInt($scope.newServConn.updateLic.price);
else
fullPrice += parseInt($scope.newServConn.updateLic.price.replace(/ /g, ''));
}
return parsePrice(fullPrice);
}
function parsePrice($price){
if($scope.site == 's1')
return $price.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1 ');
else
return parseInt($price);
}
function initCart(){
//console.log('/include/basket/getBasketInfo.php?siteID='+$scope.site);
$http.get('/include/basket/getBasketInfo.php?siteID='+$scope.site).then(cartInfo);
}
function cartInfo(response){
if(response.data.viewerLic)
$scope.license.viewerLic = response.data.viewerLic;
else
$scope.license.viewerLic = false;
if(response.data.serverLic)
$scope.license.serverLic = response.data.serverLic;
else
$scope.license.serverLic = false;
if(response.data.listOfExtLic)
$scope.extRedactions = response.data.listOfExtLic;
else
$scope.extRedactions = [];
if(response.data.newServConn)
$scope.newServConn = response.data.newServConn;
else
$scope.newServConn = [];
$scope.liteRedactions = response.data.lite;
$scope.proRedactions = response.data.pro;
$scope.serverRedaction = response.data.server;
$scope.beforeFirstLoading = false;
$('.preloader').hide();
}
$scope.goToPage = function(href){
$window.location.href = href;
}
$scope.declOfNum = function(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
}]);
inobitecApp.controller('basketHeaderController', ['$window','$scope', '$http', '$rootScope', function basketHeaderController($window, $scope, $http, $rootScope){
$scope.liteRedactions = [];
$scope.proRedactions = [];
$scope.extRedactions = [];
$scope.newServConn = [];
$scope.serverRedaction = false;
$scope.site = "s1";
$scope.license = {
"viewerLic": false,
"serverLic": false,
};
$scope.initCart = function(){
$http.get('/include/basket/getBasketInfo.php?siteID='+$scope.site).then(cartInfo);
}
$scope.redirect = function(url){
$window.location.href = url;
}
function cartInfo(response){
if(response.data.viewerLic)
$scope.license.viewerLic = response.data.viewerLic;
else
$scope.license.viewerLic = false;
if(response.data.serverLic)
$scope.license.serverLic = response.data.serverLic;
else
$scope.license.serverLic = false
if(response.data.listOfExtLic)
$scope.extRedactions = response.data.listOfExtLic;
else
$scope.extRedactions = [];
if(response.data.newServConn)
$scope.newServConn = response.data.newServConn;
else
$scope.newServConn = [];
$scope.liteRedactions = response.data.lite;
$scope.proRedactions = response.data.pro;
$scope.serverRedaction = response.data.server;
}
$scope.licenseUpdateFilter = function(item){
if(item.updateLic && item.updateLic.inbasket)
return true;
return false
}
$scope.licenseUpdateViewerCount = function(){
var $count = 0;
if($scope.extRedactions && $scope.extRedactions.lite){
for(keyLiteUpdate in $scope.extRedactions.lite){
if($scope.extRedactions.lite[keyLiteUpdate].updateLic && $scope.extRedactions.lite[keyLiteUpdate].updateLic.inbasket && $scope.extRedactions.lite[keyLiteUpdate].updateLic.cartitemId > 0)
$count++;
}
}
if($scope.extRedactions && $scope.extRedactions.pro){
for(keyProUpdate in $scope.extRedactions.pro){
if($scope.extRedactions.pro[keyProUpdate].updateLic && $scope.extRedactions.pro[keyProUpdate].updateLic.inbasket && $scope.extRedactions.pro[keyProUpdate].updateLic.cartitemId > 0)
$count++;
}
}
if($scope.extRedactions && $scope.extRedactions.server){
for(keySeverUpdate in $scope.extRedactions.server){
if($scope.extRedactions.server[keySeverUpdate].updateLic && $scope.extRedactions.server[keySeverUpdate].updateLic.inbasket && $scope.extRedactions.server[keySeverUpdate].updateLic.cartitemId > 0)
$count++;
}
}
return $count;
}
$scope.itemFilter = function (item){
return item.inbasket;
};
$scope.$on('reInitData', function(event, data) {
$scope.initCart();
});
$scope.checkIfViewerInBasket = function(){
for(keyLite in $scope.liteRedactions){
if($scope.liteRedactions[keyLite].inbasket){
return true;
}
}
for(keyPro in $scope.proRedactions){
if($scope.proRedactions[keyPro].inbasket){
return true;
}
}
return false;
}
$scope.calculateProductsNum = function(){
var $numViewer = 0;
for(keyLite in $scope.liteRedactions){
if($scope.liteRedactions[keyLite].inbasket){
$numViewer+= $scope.liteRedactions[keyLite].quantity;
}
}
for(keyPro in $scope.proRedactions){
if($scope.proRedactions[keyPro].inbasket){
$numViewer += $scope.proRedactions[keyPro].quantity;
/*for(keyModule in $scope.proRedactions[keyPro].modules){
if($scope.proRedactions[keyPro].modules[keyModule].inbasket){
$numViewer++;
}
}*/
}
}
var $num = $numViewer;
if($scope.serverRedaction)
$num++;
/*if($scope.license.viewerLic.inbasket && $numViewer > 0)
$num++;
if($scope.license.serverLic.inbasket && $scope.serverRedaction)
$num++;*/
$num += $scope.licenseUpdateViewerCount();
if($scope.newServConn && $scope.newServConn.inbasket){
$num++;
}
$('.new-mobile-menu_icons-counter').html($num);
return $num;
}
$scope.calculateDicomViewerPrice = function(){
var price = 0;
for(keyLite in $scope.liteRedactions){
if($scope.liteRedactions[keyLite].inbasket){
var processed = $scope.liteRedactions[keyLite].price.replace(/ /g, '');
price += parseInt(processed) * $scope.liteRedactions[keyLite].quantity;
if($scope.liteRedactions[keyLite].license && $scope.liteRedactions[keyLite].license.inbasket){
var processed = $scope.liteRedactions[keyLite].license.price.replace(/ /g, '');
price += parseInt(processed) * $scope.liteRedactions[keyLite].quantity;
}
}
}
for(keyPro in $scope.proRedactions){
if($scope.proRedactions[keyPro].inbasket){
var processed = $scope.proRedactions[keyPro].price.replace(/ /g, '');
price += parseInt(processed) * $scope.proRedactions[keyPro].quantity;
for(keyModule in $scope.proRedactions[keyPro].modules){
if($scope.proRedactions[keyPro].modules[keyModule].inbasket){
var processedModule = $scope.proRedactions[keyPro].modules[keyModule].price.replace(/ /g, '');
price += parseInt(processedModule) * $scope.proRedactions[keyPro].modules[keyModule].quantity ;
}
}
if($scope.proRedactions[keyPro].license.inbasket){
var processed = $scope.proRedactions[keyPro].license.price.replace(/ /g, '');
price += parseInt(processed) * $scope.proRedactions[keyPro].quantity;
}
}
}
if($scope.extRedactions && $scope.extRedactions.lite){
for(keyUpdateLite in $scope.extRedactions.lite){
if($scope.extRedactions.lite[keyUpdateLite].updateLic && $scope.extRedactions.lite[keyUpdateLite].updateLic.inbasket){
var processed = $scope.extRedactions.lite[keyUpdateLite].updateLic.price.replace(/ /g, '');
price += parseInt(processed);
}
}
}
if($scope.extRedactions && $scope.extRedactions.pro){
for(keyUpdatePro in $scope.extRedactions.pro){
if($scope.extRedactions.pro[keyUpdatePro].updateLic && $scope.extRedactions.pro[keyUpdatePro].updateLic.inbasket){
var processed = $scope.extRedactions.pro[keyUpdatePro].updateLic.price.replace(/ /g, '');
price += parseInt(processed);
}
}
}
if($scope.extRedactions && $scope.extRedactions.server){
for(keyUpdateServer in $scope.extRedactions.server){
if($scope.extRedactions.server[keyUpdateServer].updateLic && $scope.extRedactions.server[keyUpdateServer].updateLic.inbasket){
var processed = $scope.extRedactions.server[keyUpdateServer].updateLic.price.replace(/ /g, '');
price += parseInt(processed);
}
}
}
return price;
}
$scope.calculateFullPrice = function(){
var fullPrice = $scope.calculateDicomViewerPrice();
if($scope.serverRedaction){
fullPrice += parseInt($scope.serverRedaction.offers[$scope.serverRedaction.serverConnections].price.replace(/ /g, ''));
if($scope.serverRedaction.license.inbasket){
fullPrice += parseInt($scope.serverRedaction.license.price.replace(/ /g, ''));
}
}
if($scope.newServConn && $scope.newServConn.inbasket){
if(Number.isInteger($scope.newServConn.updateLic.price))
fullPrice += parseInt($scope.newServConn.updateLic.price);
else
fullPrice += parseInt($scope.newServConn.updateLic.price.replace(/ /g, ''));
}
return $scope.parsePrice(fullPrice);
}
$scope.parsePrice = function($price){
if($scope.site == 's1')
return $price.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1 ');
else
return parseInt($price);
}
$scope.defaultDelGood = function(good){
if(!good.inbasket)
return false;
$rootScope.$broadcast('sendItemID', good.cartitemId);
Popup('basketAlertTwo');
return false;
$http.get('/include/basket/deleteGood.php?itemBasketId='+good.cartitemId).then(function successCallback(response) {
if(response.data.success == good.cartitemId){
console.log("reinitData");
$rootScope.$broadcast('reInitData');
$rootScope.$broadcast('reInitDataMain');
}
}, function errorCallback(response) {
//console.log(response);
});
}
$scope.delLiteFromBasket = function($event, good){
$scope.defaultDelGood(good);
};
$scope.delProFromBasket = function($event, good){
//if($scope.canDeletePro(good)){
$scope.defaultDelGood(good);
//}else
//return false;
};
$scope.canDeletePro = function(pro){
for(keyModule in pro.modules){
if(pro.modules[keyModule].inbasket)
return false;
}
return true;
}
$scope.delModuleFromBasket = function($event, good){
$scope.defaultDelGood(good);
};
$scope.delServerFromBasket = function($event){
$scope.defaultDelGood($scope.serverRedaction);
return false;
/*if($scope.serverRedaction.inbasket){
$http.get('/include/basket/deleteGood.php?itemBasketId='+$scope.serverRedaction.cartitemId).then(function successCallback(response) {
if(response.data.success == $scope.serverRedaction.cartitemId){
console.log("REINITDATA");
//$scope.serverRedaction = false;
$rootScope.$broadcast('reInitData');
//$scope.initCart();
$rootScope.$broadcast('reInitDataMain');
}
});
}*/
};
}]);
inobitecApp.directive('myPhonestopinput', function() {
function link(scope, elem, attrs, ngModel) {
ngModel.$parsers.push(function(viewValue) {
var element = $('[ng-model="userPhone"]');
var regex = RegExp(element.attr('pattern'));
// if view values matches regexp, update model value
if (regex.test(viewValue)) {
return viewValue;
}
if(ngModel.$modelValue)
var transformedValue = ngModel.$modelValue;
else
var transformedValue = viewValue.substring(0, viewValue.length - 1);
if(!regex.test(transformedValue))
transformedValue = "+";
ngModel.$setViewValue(transformedValue);
ngModel.$render();
return transformedValue;
// keep the model value as it is
});
}
return {
restrict: 'A',
require: 'ngModel',
link: link
};
});
inobitecApp.directive('myValidatorpass', function () {
function link(scope, elem, attrs, ngModel) {
var regex = RegExp('^\[a-zA-Z0-9]*$');
/** var $mobileFlag = true;
elem.on('keypress', function(e){
$mobileFlag = false;
var char = String.fromCharCode(e.which||e.charCode||e.keyCode), matches = [];
if(!regex.test(char))
return false;
});*/
ngModel.$parsers.push(function(viewValue) {
// if view values matches regexp, update model value
if (regex.test(viewValue)) {
return viewValue;
}
if(ngModel.$modelValue)
var transformedValue = ngModel.$modelValue;
else
var transformedValue = viewValue.substring(0, viewValue.length - 1);
if(regex.test(transformedValue)){
ngModel.$setViewValue(transformedValue);
ngModel.$render();
return transformedValue;
}
return viewValue;
});
}
return {
restrict: 'A',
require: 'ngModel',
link: link
};
});
inobitecApp.controller('orderController', ['$scope', '$http', '$rootScope','$compile', function orderController($scope, $http, $rootScope, $compile){
//console.log("orderController");
$scope.showValid = false;
$scope.site = "s1";
$scope.EMAILERROR = true;
$scope.EMAILERRORCODE = false;
$scope.needPhoneExp = false;
$scope.refresh = function(res){
$("#order_form_content").html($compile(res)($scope));
}
$scope.$watch('EMAIL',function(newValue,oldValue)
{
if(!$scope.EMAILERROR){
if(newValue != oldValue){
$scope.EMAILERROR = true;
$scope.EMAILERRORCODE = false;
}
}
});
$scope.checkFormValidate = function(){
//console.log("---------------");
//console.log($scope.ORDER_FORM);
var $validLength = true;
var anotherForm = false;
angular.forEach($scope.ORDER_FORM, function (element, name) {
if (!name.startsWith('$')) {
//console.log(element.$$element.context.name);
if($("[name='"+element.$$element.context.name+"']").length < 1){
anotherForm = true;
}
if($("[name='"+element.$$element.context.name+"']").attr("data-call") == "POWER_OF_ATTORNEY")
if($("[data-call='EVIDENCE']:checked").val() != "powerOfAttorney"){
$("[name='"+element.$$element.context.name+"']").val("");
$("[name='"+element.$$element.context.name+"']").trigger('input');
$("[name='"+element.$$element.context.name+"']").trigger('change');
return;
}else if($("[data-call='EVIDENCE']:checked").val() == "powerOfAttorney"){
if(typeof element.$viewValue === "undefined" || element.$viewValue.length < 1){
console.log('test11');
$validLength = false;
}
return;
}
if($("[name='"+element.$$element.context.name+"']").attr("data-req") == "Y"){
if($("[name='"+element.$$element.context.name+"']").attr("data-call") == "OFERTA_AGREE"){
if(!$("[name='"+element.$$element.context.name+"']").is(':checked')){
//console.log('test12');
$validLength = false;
}
}else{
if(typeof element.$viewValue === "undefined" || element.$viewValue.length < 1){
//console.log('test13');
$validLength = false;
}
}
}
}
});
if(anotherForm)
return;
if( (!$validLength || !$scope.ORDER_FORM.$valid) ){
$scope.showValid = false;
$("#ORDER_CONFIRM_BUTTON").addClass('btn-blue-disable');
return false;
}
if($scope.PASS){
if($scope.PASS != $scope.PASS_CONF){
$scope.showValid = false;
$("#ORDER_CONFIRM_BUTTON").addClass('btn-blue-disable');
return false;
}
}
$("#ORDER_CONFIRM_BUTTON").removeClass('btn-blue-disable');
$scope.showValid = true;
return true;
}
$scope.sumbitOrder = function(){
var $validLength = true;
angular.forEach($scope.ORDER_FORM, function (element, name) {
if (!name.startsWith('$')) {
element.$dirty = true;
if($("[name='"+element.$$element.context.name+"']").attr("data-call") == "POWER_OF_ATTORNEY")
if($("[data-call='EVIDENCE']:checked").val() != "powerOfAttorney"){
$("[name='"+element.$$element.context.name+"']").val("");
$("[name='"+element.$$element.context.name+"']").trigger('input');
$("[name='"+element.$$element.context.name+"']").trigger('change');
return;
}else if($("[data-call='EVIDENCE']:checked").val() == "powerOfAttorney"){
if(typeof element.$viewValue === "undefined" || element.$viewValue.length < 1){
$validLength = false;
}
return;
}
if($("[name='"+element.$$element.context.name+"']").attr("data-req") == "Y"){
if($("[name='"+element.$$element.context.name+"']").attr("data-call") == "OFERTA_AGREE"){
if(!$("[name='"+element.$$element.context.name+"']").is(':checked')){
$validLength = false;
}
}else{
if(typeof element.$viewValue === "undefined" || element.$viewValue.length < 1){
$validLength = false;
}
}
}
}
});
$scope.ORDER_FORM.$dirty = true;
$scope.ValidateAttorney();
if(!$validLength || !$scope.ORDER_FORM.$valid){
return false;
}
if($scope.PASS){
if($scope.PASS != $scope.PASS_CONF){
return false;
}
}
$url = '/include/checkEmail.php?mail='+encodeURIComponent($("[data-call='EMAIL']").val());
$http.get($url).then(function successCallback(response) {
if(response.data.rez == "YES"){
submitForm('Y');
}else{
$scope.EMAILERROR = false;
$scope.EMAILERRORCODE = response.data.rez;
}
});
}
$scope.ValidateAttorneyFlag = false;
$scope.showAttorney = function(){
var evidenceVal = $("[data-call='EVIDENCE']:checked").val();
if(evidenceVal == "powerOfAttorney")
return true;
return false;
}
$scope.ValidateAttorney = function(){
//console.log("checkValidaty");
var evidenceVal = $("[data-call='EVIDENCE']:checked").val();
var attorneyVal = $("[data-call='POWER_OF_ATTORNEY']").val();
if(!evidenceVal){
$scope.ValidateAttorneyFlag = false;
return;
}
if(attorneyVal.length < 1 && evidenceVal == "powerOfAttorney"){
$scope.ValidateAttorneyFlag = false;
}else{
$scope.ValidateAttorneyFlag = true;
}
}
$scope.ValidateAttorney();
}]);
inobitecApp.controller('popupController', ['$scope', '$http', '$rootScope','$compile', function popupController($scope, $http, $rootScope, $compile){
$scope.CurrenItemId = false;
$scope.$on('sendItemID', function(event, data) {
$scope.CurrenItemId = data;
});
$scope.defaultDelGoodPopup = function(){
if(!$scope.CurrenItemId)
return false;
$http.get('/include/basket/deleteGood.php?itemBasketId='+$scope.CurrenItemId).then(function successCallback(response) {
if(response.data.success == $scope.CurrenItemId){
$scope.CurrenItemId = false;
$rootScope.$broadcast('reInitData');
$rootScope.$broadcast('reInitDataMain');
$scope.closePopup('basketAlertTwo');
}
}, function errorCallback(response) {
//console.log(response);
});
}
$scope.clearBasketPopup = function clearBasketPopup(){
console.log('clearBasketPopup');
$http.get('/include/basket/clearBasket.php').then(function successCallback(response) {
if(response.data.success == 1){
$rootScope.$broadcast('reInitData');
$rootScope.$broadcast('reInitDataMain');
$scope.closePopup('basketAlert');
}
}, function errorCallback(response) {
//console.log(response);
});
}
$scope.closePopup = function(blockID){
var currentPopup = document.querySelector('#'+blockID);
closePopup(currentPopup);
}
}])
inobitecApp.controller('redirectController', ['$window', '$scope', '$http', '$rootScope','$compile', function popupController($window, $scope, $http, $rootScope, $compile){
$scope.redirect = function(url){
$window.location.href = url;
}
}])
|
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';
import { Logins, Records } from '../../collections/collections.js';
if (Meteor.isServer) {
Meteor.publish('logins', function loginsPublication(user,pw) { // logins collection which is connected to external db
return Logins.find({ username: user, password: pw});
});
Meteor.publish('register', function registerPublication(user,em) { // logins collection which is connected to external db
return Logins.find( { $or: [ { username:user }, { email: em } ] } );
});
Meteor.publish('records', function recordsPublication(user) {
return Records.find({ username: user });
});
}
|
import React from 'react'
import Image from './Image'
const Result = (props) =>{
return(
<div className='image-container'>
{
props.images.map((image) =>(
<Image
key={image.recipe.label}
image={image.recipe.image}
name ={image.recipe.label}
ingredients ={image.recipe.ingredients.length}
allRecipe = {image.recipe}
/>
))
}
</div>
)
}
export default Result
|
import React from "react";
import Lottie from "react-lottie";
import animation_data from "../lotties/loading_spinner.json";
const LoadingAnimation = () => {
const defaultOptions = {
loop: true,
autoplay: true,
animationData: animation_data,
};
return (
<div>
<Lottie options={defaultOptions} height={200} />
</div>
);
};
export default LoadingAnimation;
|
'use strict';
import React, { Component,PropTypes } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image,
Platform,
Animated,
Easing,
Switch,
} from 'react-native';
import { WinStyle } from '../styles/BaseStyle';
import { IconData } from '../styles/IconBase';
//开关控件
export default class SwitchComp1 extends Component {
constructor(props) {
super(props);
let leftNumVal;
if(props.widthStyle) {
leftNumVal = -(props.widthStyle - 24);
} else {
leftNumVal = -(50 - 24);
}
this.state = {
isOpen: props.isOpen || false,
leftNum:new Animated.Value(props.isOpen ? 0 : leftNumVal),
openTxtW:0,
closeTxtW:0,
widthStyle:props.widthStyle || 50,
value:false,
switchBgColor: props.isOpen ? '#338ee2' : '#666',
onTxt: props.onTxt || '确定',
offTxt: props.offTxt || '取消',
}
}
// onLayout 当挂载或者布局变化以后调用
openLoad(e){
this.setState({
openTxtW : e.nativeEvent.layout.width
})
}
closeLoad(e){
this.setState({
closeTxtW : e.nativeEvent.layout.width
})
}
trigger(){
this.setState({
isOpen: !this.state.isOpen
},()=>{
if(this.state.isOpen) {
this.setState({
switchBgColor: '#338ee2'
})
} else {
this.setState({
switchBgColor: '#666'
})
}
Animated.timing(
this.state.leftNum,
{
toValue: this.state.isOpen ? 0 : -(this.state.widthStyle - 24) || -this.state.openTxtW,
Easing:Easing.poly(2),
duration:200,
}
).start(()=>{
this.props.changeSwitchState && this.props.changeSwitchState(this.state.isOpen);
});
})
}
render(){
let { onTxt,offTxt } = this.state;
return(
<View style={{ marginVertical:20 }}>
<TouchableOpacity style={[styles.switchStyle,{width:this.state.widthStyle,backgroundColor:this.state.switchBgColor}]} onPress={this.trigger.bind(this)} activeOpacity={1}>
<Animated.View style={[styles.viewStyle,{left:this.state.leftNum}]}>
<Text style={{fontSize:10,color:'#fff'}} onLayout={this.openLoad.bind(this)}>{onTxt}</Text>
<View style={styles.circle}></View>
<Text style={{fontSize:10,color:'#fff'}} onLayout={this.closeLoad.bind(this)}>{offTxt}</Text>
</Animated.View>
</TouchableOpacity>
{ // <Switch
// style={{marginTop: 20}}
// value={this.state.value}
// onValueChange={(value)=>{console.log(value);this.setState({value: value})}} />
}
</View>
)
}
}
const styles = StyleSheet.create({
switchStyle: {
height:24,
borderRadius:13,
paddingVertical:2,
flexDirection:'row',
justifyContent:'center',
alignItems:'center',
position:'relative',
},
viewStyle: {
height:24,
flexDirection:'row',
alignItems:'center',
position:'absolute',
top:0,
paddingHorizontal:5,
// borderWidth:1,
// borderColor:'#f00',
},
circle: {
width:20,
height:20,
borderRadius:11,
backgroundColor:'#fff',
marginHorizontal:2
}
})
|
import PropTypes from 'prop-types';
import React from 'react';
import injectStyles from '@/utils/injectStyles';
import { TYPE } from './constants';
import Arcs from './elements/ArcsBackground';
import styles from './styles';
const SpeedometerChart = ({
className,
minValue,
minValueLabel,
maxValue,
maxValueLabel,
value,
valueLabel,
type,
markers
}) => (
<div className={className}>
<svg
width="180"
height="100"
viewBox="0 0 180 100"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<Arcs minValue={minValue} maxValue={maxValue} value={value} type={type} markers={markers} />
</svg>
<span>{valueLabel || value}</span>
<div>
<p>{minValueLabel || minValue.toFixed(1)}</p>
<p>{maxValueLabel || maxValue.toFixed(1)}</p>
</div>
</div>
);
SpeedometerChart.propTypes = {
className: PropTypes.string.isRequired,
minValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
minValueLabel: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
maxValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
maxValueLabel: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
valueLabel: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
type: PropTypes.string,
markers: PropTypes.array
};
// структура markers
// [number_1, number_2] или
// [
// { value: number_1, label: 'number or string' },
// { value: number_2, label: 'number or string' }
// ]
SpeedometerChart.defaultProps = {
type: TYPE.NORMAL,
markers: []
};
SpeedometerChart.displayName = 'SpeedopmeterChartComponent';
export default injectStyles(SpeedometerChart, styles);
|
import express from 'express'
import authDtrl from '../controllers/auth.controller'
const router = express.Router()
router.route('auth/signin')
.post(authCtrl.signin)
router.route('/auth/signout')
.get(authCtrl.signout)
export default router
|
var mergesort = require("../mergesort");
var chai = require("chai");
var expect = chai.expect;
describe ("merge", function(){
it("empty array", function(){
expect(mergesort([])).to.equal("Empty Array");
});
it("simple array", function(){
expect(mergesort([3,2,1],0,2)).to.eql([1,2,3]);
expect(mergesort([3,2,1,8,7,0,5,4,6],0,8)).to.eql([0,1,2,3,4,5,6,7,8]);
});
});
|
var Util = require('./util');
function Node(logicOp, condition) {
this.logicOp = logicOp;
this.condition = condition || null;
this.children = [];
}
function generateTree(arr) {
var node = null;
if(!arr && arr.length === 0) {
return node;
}
if(arr[0].toLowerCase() === 'and' || arr[0].toLowerCase() === 'or') {
node = new Node(arr[0].toLowerCase(), null);
for(var i=1; i<arr.length; i++) {
node.children[i-1] = generateTree(arr[i]);
}
} else {
node = new Node(null, arr);
}
return node;
}
var conditionParser = function(baseTable, resultSet) {
var getResults = function(conditionalArr) {
var parseTree = generateTree(conditionalArr[0]);
// Recursively apply conditional to get final results
return applyConditionals(parseTree, resultSet.result);
}
var applyConditionals = function(tree, results) {
var r = [];
if(!tree || Util.isEmpty(tree)) {
return r;
}
if(tree.logicOp !== null) {
if(tree.logicOp === 'or') {
for(var i = 0; i < tree.children.length; i++) {
r = Util.unionArray(r, applyConditionals(tree.children[i], results));
}
} else {
for(var i = 0; i < tree.children.length; i++) {
if(!r.length) {
r = applyConditionals(tree.children[i], results);
} else {
r = Util.intersectArray(r, applyConditionals(tree.children[i], results));
}
}
}
} else {
var idx = baseTable.tblAttributes.indexOf(tree.condition[0]);
r = results.filter(function(row) {
return Util.evalExpression(row[idx], tree.condition[1], tree.condition[2]);
});
}
return r;
};
return {
getResults : getResults
};
};
module.exports = conditionParser;
|
import React, { Component } from 'react';
import myData from '../data/stock-data.json'
class Home extends Component {
constructor(props){
super(props)
}
render() {
return(
<div className="stocks">
<h2>{this.props.name}</h2>
<ul className="stocks-list">
<li>{this.props.symbol}</li>
<li>{this.props.lastPrice}</li>
<li>{this.props.change}</li>
<li>{this.props.high}</li>
<li>{this.props.low}</li>
<li>{this.props.open}</li>
</ul>
</div>
)
}
}
export default Home
|
import {
querySummaryPageConfig,
queryPagelist,
queryDetailPageConfig,
queryDetailPage,
queryRemoveBusiness,
queryTableDelete,
queryDetailSave,
queryDetailEdit,
queryDetailChildSave,
queryTransactionProcess,
queryPagination,
queryAutocomplate,
queryDetailChildPage,
updateFields,
childUpdateFields,
queryDetailListConfig,
queryDetailList,
fileUpdate,
queryOpenAccount,
queryLargeChilddata,
} from '@/services/api';
import _ from 'lodash';
import { notification } from 'antd';
import moment from 'moment';
import { onGetImageUrl } from '@/utils/FunctionSet';
export default {
namespace: 'tableTemplate',
state: {
pageId: null, // 当前页面的pageID
tableColumns: [], // 列表页表头
tableColumnsData: {}, // 列表页表头数据
tableData: [], // 列表页数据
detailColumns: [], // 详情页表头
detailData: [], // 详情页数据
MainTableData: [], //主表最新的数据(用于子表的rtlink联动)
DetailChildData: {}, // 子表数据
initDetailChildData: {}, // 刚进入详情页面时的子表数据
initPolicyFormFields: [], // 刚进入详情页时的主表数据
ChildData: [], // 子表展示数据
childMaxCount: null, //子表的所有数据
selectDate: {}, // 跳转时选择的数据
selectDataDelete: [], // 选择要删除的数据
selectOption: [], // 下拉框显示的数据
selectChildOption: [], // 子表下拉显示的数据
pagination: {}, // 请求的分页数据,列表页数据以此为准
framePagination: {}, // 弹框显示的数据,子表新增弹框以此为准
ID: null, // 新增数据的id
objectType: null, // 新增数据的objectType
child: [], // 子表修改的数据
Data: [], // 子表的数据
currentKey: '', // 搜索栏下拉框查询需要的key
childChanged: [], // 子表修改的数据,待发送到后台
frameColumns: [], // 子表弹框的表格表头
frameData: [], // 子表弹框的表格数据
reportFormURL: null, // 报表的url地址
reportFormURLPage: null, //page页里面的报表地址
defaultActiveKey: '0', // 子表tab选择的key
fileList: [], // 主表图片组件显示的数据
fileKey: '', // 对应主表的图片的detailpage里面的元素的FIELD_NAME值
isChildAdd: false, // 是否有子表新增
MasterTable: {}, //主表的数据,用于新增时的rtlink联动
// ------------------------------------------------
isEdit: false, // 判断是不是详情页,默认不是详情页false
buttonType: false, // 详情页的按钮格式,false表示只有保存,取消按钮
isNewSave: false, // 判断是不是列表页的新增,默认为false 不是
disEditStyle: true, // 默认都不可编辑
searchParams: {}, // 列表页的查询参数
selectedRowKeys: [], // 选择的那个表格行数据
pageSize: 10,
isEditSave: false, //判断是不是详情页的新增,默认是false 不是
isOperate: false, //用于记录取消时,用户有没有进行过操作,默认没有操作(fasle)
sorterData: {}, //用于记录列表排序
summarySort: null,
// ------------------------------------------------
},
subscriptions: {
setup({ history, dispatch }) {
return history.listen(({ pathname }) => {});
},
},
effects: {
// 改变状态
*changeState({ payload }, { put, call, select }) {
yield put({
type: 'save',
payload,
});
},
*getReportForm({ payload, callback }, { put, call, select }) {
const { pageId } = payload;
const params = { pageId };
const result = yield call(querySummaryPageConfig, params);
if (callback) callback(result);
if (result.status == 'success') {
yield put({
type: 'save',
payload: {
tableColumns: result.data.columns,
currentKey: result.data.key,
tableColumnsData: result.data,
},
});
}
},
// 获取列表页表头数据
*getSummaryPageConfig({ payload, callback }, { put, call, select }) {
const pageId = yield select(({ tableTemplate }) => tableTemplate.pageId);
const params = { pageId };
const result = yield call(querySummaryPageConfig, params);
if (callback) callback(result);
if (result.status == 'success') {
yield put({
type: 'save',
payload: {
tableColumns: result.data.columns,
currentKey: result.data.key,
tableColumnsData: result.data,
},
});
} else {
notification.error({ message: result.message, duration: 3 });
}
},
// 获取列表页数据
*getPagelist({ payload, callback }, { put, call, select }) {
const pageId = yield select(({ tableTemplate }) => tableTemplate.pageId);
const pagination = yield select(({ tableTemplate }) => tableTemplate.pagination);
const { pageSize = 10 } = yield select(({ tableTemplate }) => tableTemplate.pagination);
const { searchParams } = yield select(({ tableTemplate }) => tableTemplate);
const params = { pageId, pageSize, pageNum: pagination.currentPage, ...searchParams };
const result = yield call(queryPagelist, params);
if (result.status == 'success') {
yield put({ type: 'save', payload: { pagination: result.data } });
} else {
notification.error({ message: result.message, duration: 3 });
}
if (callback) callback(result);
},
// 获取详情页表头
*getDetailPageConfig({ payload, callback }, { call, select, put }) {
const pageId = yield select(({ tableTemplate }) => tableTemplate.pageId);
const params = { pageId };
const result = yield call(queryDetailPageConfig, params);
if (callback) callback(result);
if (result.status == 'success') {
yield put({
type: 'save',
payload: { detailColumns: result.data, objectType: result.data.objectType },
});
} else {
notification.error({ message: result.message, duration: 3 });
}
},
// 获取详情页数据
*getDetailPage({ payload, callback }, { call, put, select }) {
const { type } = payload; // 判断是不是点击子表删除进来的刷新页面
const deleteParams = payload.params; // 子表删除时指定删除的数据参数
// ------判断子表删除的参数 ⬆️------
let params;
if (payload.ID) {
params = {
ID: payload.ID,
ObjectType: payload.ObjectType
? payload.ObjectType
: yield select(({ tableTemplate }) => tableTemplate.objectType),
pageId: payload.pageId,
};
} else {
params = {
ObjectType: payload.ObjectType
? payload.ObjectType
: yield select(({ tableTemplate }) => tableTemplate.objectType),
pageId: payload.pageId,
};
}
const result = yield call(queryDetailPage, params);
if (callback) callback(result);
yield put({
type: 'save',
payload: {
detailData: result.data,
childMaxCount: result.data.childMaxCount,
initPolicyFormFields: result.data.policyFormFields,
},
});
// 区分是否是新增的情况
if (result.status == 'success' && !payload.ProhibitChildRefresh) {
// 如果正确返回,则获取子表数据
const childParams = {
pageId: payload.pageId,
thisComponentUid: result.data.thisComponentUid,
};
let childResult;
if (result.data.childMaxCount >= 50 && payload.pageId !== 135) {
childResult = yield call(queryLargeChilddata, childParams);
} else {
childResult = yield call(queryDetailChildPage, childParams);
}
const initDetailChildData = yield select(
({ tableTemplate }) => tableTemplate.initDetailChildData
);
if (_.isEmpty(initDetailChildData)) {
yield put({
type: 'save',
payload: { DetailChildData: childResult.data, initDetailChildData: childResult.data },
});
} else {
yield put({
type: 'save',
payload: { DetailChildData: childResult.data, initDetailChildData: childResult.data },
});
}
if (type == 'deleteChild') {
// 获取子表数据,通过type判断是不是删除调用的刷新数据方法
const ChildData = yield select(({ tableTemplate }) => tableTemplate.ChildData);
ChildData.map(value => {
if (value.Data.objectType == deleteParams.param.objectType) {
const deleteChildId = deleteParams.param.businessId[0]; // 要删除的子对象
let deleteChildIndex;
value.Data.records.map((i, index) => {
if (i[0].id == deleteChildId) {
deleteChildIndex = index;
}
});
value.Data.records.splice(deleteChildIndex, 1);
}
});
} else {
yield put({ type: 'getChildTable' });
}
if (callback) callback(childResult);
} else if (!payload.ProhibitChildRefresh) {
// yield put({ type: 'save', payload: { detailData: [], initPolicyFormFields: [] } });
notification.error({ message: result.message, duration: 3 });
}
},
// 获取子表数据
*getChildTable({ payload }, { select, put, call }) {
const detailColumns = yield select(({ tableTemplate }) => tableTemplate.detailColumns);
const DetailChildData = yield select(({ tableTemplate }) => tableTemplate.DetailChildData);
const childAllData = [];
detailColumns.child.map((value, index) => {
// 循环表头,value某个子表的表头
DetailChildData.child.map((i, j) => {
// 循环数据,i某个子表的数据
const childData = {};
if (value.fieldGroupName == i.fieldGroupName) {
childData.Columns = value;
childData.Data = i;
childAllData.push(childData);
}
});
});
yield put({ type: 'save', payload: { ChildData: childAllData } });
},
// 获取子表数据
*handleRefreshChildTable({ payload, callback }, { call, put, select }) {
console.log('ssssssss1', payload);
const id = yield select(({ tableTemplate }) => tableTemplate.pageId);
const { uid } = payload;
const childParams = {
pageId: id,
thisComponentUid: uid,
};
const childResult = yield call(queryDetailChildPage, childParams);
const initDetailChildData = yield select(
({ tableTemplate }) => tableTemplate.initDetailChildData
);
if (_.isEmpty(initDetailChildData)) {
yield put({
type: 'save',
payload: { DetailChildData: childResult.data, initDetailChildData: childResult.data },
});
} else {
yield put({
type: 'save',
payload: { DetailChildData: childResult.data, initDetailChildData: childResult.data },
});
}
yield put({ type: 'getChildTable' });
},
// 清空子表数据
*cleanClildData({ payload, callback }, { call, put, select }) {
yield put({ type: 'save', payload: { ChildData: [], reportFormURL: null } });
},
// 详情页数据保存
*getDetailSave({ payload, callback }, { call, put, select }) {
const detailColumns = yield select(({ tableTemplate }) => tableTemplate.detailColumns);
const detailData = yield select(({ tableTemplate }) => tableTemplate.detailData);
const pageId = yield select(({ tableTemplate }) => tableTemplate.pageId);
const DetailChildData = yield select(({ tableTemplate }) => tableTemplate.DetailChildData);
const ChildData = yield select(({ tableTemplate }) => tableTemplate.ChildData);
const pagination = yield select(({ tableTemplate }) => tableTemplate.pagination);
const editValue = payload.value; // 编辑传过来的值
if (payload.type == 'edit') {
let params;
// console.log(detailData.policyFormFields, editValue)
const child = []; // 存放新版的子表修改数据
ChildData.map(value => {
value.Data.records.map(i => {
child.push(i);
});
});
detailData.policyFormFields.map((value, index) => {
// if(editValue){
// 判断是否修改和用户是否选择清空选项,如果修改了,就赋值,没有修改不变,注:null == undefined,区分他们要用 ===
if (editValue[value.FIELD_NAME] !== undefined) {
value.FIELD_VALUE = editValue[value.FIELD_NAME];
} else if (
editValue[value.FIELD_NAME] === null ||
editValue[value.FIELD_NAME] === undefined
) {
value.FIELD_VALUE = null;
}
// detailData.child = payload.child; //旧版的
});
detailData.child = child;
params = detailData;
params.policyFormFields.map(item => {
if (item.WIDGET_TYPE == 'Image' || item.WIDGET_TYPE == 'Attachment') {
if (item.FIELD_VALUE) {
item.FIELD_VALUE.map(ii => {
if (ii.url) {
if (ii.url.includes('http:')) {
let str = ii.url.match(/:(\S*)/)[1];
let lastStr = str.match(/:(\S*)/)[1];
ii.url = `:${lastStr}`;
}
}
});
}
}
});
const result = yield call(queryDetailEdit, params);
if (callback) callback(result);
if (result.status == 'success') {
// 用最新的值替换selectDate,确保数据永远是最新的,不会出错
// if (result.message) {
// notification.success({ message: result.message, duration: 3 });
// }
let selectDate;
let objectType = pagination.objectType;
pagination.list.map((value, index) => {
if (value.ID == result.data.thisComponentUid) {
selectDate = value;
}
});
yield put({
type: 'save',
payload: { selectDate, objectType, isNewSave: false, isEditSave: false },
});
yield put({
type: 'getDetailPage',
payload: { ID: selectDate.ID, pageId, ObjectType: objectType },
});
yield put({
type: 'getPagelist',
payload: { pageId },
callback: res => {
if (res.status == 'success' && result.message) {
notification.success({ message: result.message, duration: 3 });
}
},
});
} else {
notification.error({ message: result.message, duration: 3 });
}
} else if (payload.type == 'save') {
let params;
const child = []; // 存放新版的子表修改数据
ChildData.map(value => {
value.Data.records.map(i => {
child.push(i);
});
});
detailData.policyFormFields.map((value, index) => {
// if(editValue){
// 判断是否修改和用户是否选择清空选项,如果修改了,就赋值,没有修改不变,注:null == undefined,区分他们要用 ===
if (editValue[value.FIELD_NAME] !== undefined) {
value.FIELD_VALUE = editValue[value.FIELD_NAME];
} else if (
editValue[value.FIELD_NAME] === null ||
editValue[value.FIELD_NAME] === undefined
) {
value.FIELD_VALUE = null;
}
// detailData.child = payload.child; //旧版的
detailData.child = child;
params = detailData;
});
// detailData.child = payload.child;
detailData.child = child;
params = detailData;
const result = yield call(queryDetailSave, params);
if (callback) callback(result);
if (result.status == 'success') {
yield put({ type: 'save', payload: { saveData: result } });
yield put({ type: 'getPagelist', payload: { pageId } });
yield put({
type: 'getDetailPage',
payload: { ID: result.data.ID, pageId, ObjectType: result.data.ObjectType },
});
yield put({
type: 'save',
payload: {
selectDate: result.data,
objectType: result.data.ObjectType,
isEditSave: false,
isEdit: true,
buttonType: true,
isNewSave: false,
disEditStyle: true,
ID: result.data.ID,
},
});
if (result.message) {
notification.success({ message: result.message, duration: 3 });
}
} else {
notification.error({ message: result.message, duration: 3 });
}
}
// yield put({type:'save'})
},
// 删除数据方法
*getRemoveBusiness({ payload, callback }, { call, select, put }) {
const pageId = yield select(({ tableTemplate }) => tableTemplate.pageId);
const selectedRowKeys = yield select(({ tableTemplate }) => tableTemplate.selectedRowKeys);
const selectDate = yield select(({ tableTemplate }) => tableTemplate.selectDate);
const pagination = yield select(({ tableTemplate }) => tableTemplate.pagination);
const businessId = [];
let params;
if (payload) {
businessId.push(payload.businessId);
params = {
param: {
pageId,
businessId,
objectType: pagination.objectType,
// selectDataDelete.length == 0 ? selectDate.ObjectType : selectDataDelete[0].ObjectType,
},
};
} else {
// 列表页删除
selectedRowKeys.map((value, index) => {
businessId.push(value);
});
if (businessId.length == 0) {
notification.warning({ message: '未选择要删除的数据,请重试!', duration: 3 });
return false;
}
params = {
param: {
pageId,
businessId,
objectType: pagination.objectType,
},
};
}
const result = yield call(queryRemoveBusiness, params);
if (callback) callback(result);
if (result.status == 'success') {
if (result.message) {
notification.success({ message: result.message, duration: 3 });
}
yield put({ type: 'getPagelist', payload: { pageId } });
} else {
notification.error({ message: result.message, duration: 3 });
}
},
// 删除子表数据
*getRemoveChildData({ payload, callback }, { select, call, put }) {
const selectDate = yield select(({ tableTemplate }) => tableTemplate.selectDate);
const pageId = yield select(({ tableTemplate }) => tableTemplate.pageId);
const params = {
param: { businessId: [payload.id], objectType: payload.objectType, pageId },
};
const result = yield call(queryRemoveBusiness, params);
if (result.status == 'success') {
if (result.message) {
notification.success({ message: result.message, duration: 3 });
}
yield put({ type: 'getPagelist', payload: { pageId } });
if (payload.id) {
// 用于区分是否是保存的数据删除还是新增的缓存数据删除
yield put({
type: 'getDetailPage',
payload: {
ID: selectDate.ID,
pageId,
ObjectType: selectDate.ObjectType,
type: 'deleteChild',
params,
},
});
}
} else {
notification.error({ message: result.message, duration: 3 });
}
},
// 子表数据保存
*getDetailChildSave({ payload }, { select, call, put }) {
const params = payload.data;
const ObjectType = yield select(
({ tableTemplate }) => tableTemplate.Detail.data.child[0].objectType
);
params.objectType = ObjectType;
params.PARENT_ID = yield select(
({ tableTemplate }) => tableTemplate.DetailPage.data.thisComponentUid
);
const result = yield call(queryDetailChildSave, params);
},
// 按钮的执行方法
*getTransactionProcess({ payload }, { select, call, put }) {
const selectDate = yield select(({ tableTemplate }) => tableTemplate.selectDate);
const objectType = yield select(
({ tableTemplate }) => tableTemplate.detailColumns.objectType
);
const pageId = yield select(({ tableTemplate }) => tableTemplate.pageId);
// const DetailChildData = yield select(({ tableTemplate }) => tableTemplate.DetailChildData);
const { isEdit, idList } = payload;
const ButtonName = payload.Buttons.FIELD_NAME;
let params;
if (isEdit) {
params = {
selectDate,
ButtonName,
objectType,
selectDataId: selectDate.ID,
// ChildTableData: DetailChildData,
};
} else {
if (idList) {
params = {
selectDate,
selectDate1: idList,
ButtonName,
objectType,
selectDataId: selectDate.ID,
};
} else {
params = { selectDate, ButtonName, objectType, selectDataId: selectDate.ID };
}
}
const result = yield call(queryTransactionProcess, params);
if (result.status == 'success') {
if (result.executeScript) {
yield put({
type: 'save',
payload: {
reportFormURL: result.executeScript + `&userid=${localStorage.getItem('loginData')}`,
},
});
} else {
yield put({ type: 'save', payload: { reportFormURL: result.executeScript } });
}
if (result.message) {
notification.success({ message: result.message, duration: 3 });
}
if(!result.executeScript){
const pagination = yield select(({ tableTemplate }) => tableTemplate.pagination);
let newSelectDate;
let newObjectType;
pagination.list.map((value, index) => {
if (value.ID == selectDate.ID) {
newSelectDate = value;
newObjectType = value.ObjectType;
}
});
yield put({ type: 'getPagelist', payload: { pageId } });
yield put({
type: 'getDetailPage',
payload: {
pageId,
ObjectType: newObjectType,
ID: selectDate.ID,
ProhibitChildRefresh: true,
},
});
yield put({
type: 'save',
payload: { selectDate: newSelectDate, objectType: newObjectType, pagination: tableData },
});
}
} else {
notification.error({ message: result.message, duration: 3 });
}
},
// 分页 (列表页获取数据)
*getPagination({ payload, callback }, { select, call, put }) {
const { pageId, searchParams = {}, pageSize, summarySort, sorterData } = payload;
const pageNum = payload.current;
const params = {
pageId,
summarySort,
pageSize,
pageNum,
sorterData,
...searchParams,
};
const result = yield call(queryPagination, params);
if (callback) callback(result);
if (result.status == 'success') {
yield put({ type: 'save', payload: { pagination: result.data } });
} else {
yield put({ type: 'save', payload: { pagination: {} } });
notification.error({ message: result.message, duration: 3 });
}
},
// 下拉框事件
*getAutocomplate({ payload, callback }, { select, call, put }) {
const detailColumns = yield select(({ tableTemplate }) => tableTemplate.detailColumns);
const selectDate = yield select(({ tableTemplate }) => tableTemplate.selectDate);
const detailData = yield select(({ tableTemplate }) => tableTemplate.detailData);
const { key } = payload.value.key ? payload.value : detailColumns;
const { text } = payload.value;
const { searchData, selectKey, ColumnsData } = payload;
let params;
if (payload.value) {
params = {
key: key || payload.value.key,
text: payload.value.FIELD_NAME || payload.value.text,
value: searchData !== undefined ? searchData : payload.value.FIELD_VALUE,
objId: selectDate.ID,
selectKey,
};
} else {
params = {
key,
text,
value: searchData != undefined ? searchData : null,
objId: selectDate.ID,
selectKey,
};
}
const result = yield call(queryAutocomplate, params);
const selectChildOption = yield select(
({ tableTemplate }) => tableTemplate.selectChildOption
);
const isExist = _.findIndex(selectChildOption, function(o) {
return o.selectKey == result.data.selectKey && o.field == result.data.field;
});
if (isExist == -1) {
selectChildOption.push(result.data);
} else {
selectChildOption[isExist].options = result.options;
}
_.map(detailData.policyFormFields, data => {
if (data.FIELD_NAME === result.data.field) {
data.options = result.data.options;
return data;
}
});
yield put({
type: 'save',
payload: {
selectOption: result.data
? result.data.options
? result.data.options
: result.data
: [],
detailData,
selectChildOption,
},
});
callback && callback(result);
},
// 子表搜索下拉框事件
*getChildSearchAutocomplate({ payload, callback }, { select, call, put }) {
const detailColumns = yield select(({ tableTemplate }) => tableTemplate.detailColumns);
const selectDate = yield select(({ tableTemplate }) => tableTemplate.selectDate);
const detailData = yield select(({ tableTemplate }) => tableTemplate.detailData);
const { value } = payload;
const { searchData, selectKey, ColumnsData } = payload;
let params = {
...value,
objId: selectDate.ID,
selectKey,
};
const result = yield call(queryAutocomplate, params);
const selectChildOption = yield select(
({ tableTemplate }) => tableTemplate.selectChildOption
);
const isExist = _.findIndex(selectChildOption, function(o) {
return o.selectKey == result.data.selectKey && o.field == result.data.field;
});
if (isExist == -1) {
selectChildOption.push(result.data);
} else {
selectChildOption[isExist].options = result.options;
}
_.map(detailData.policyFormFields, data => {
if (data.FIELD_NAME === result.data.field) {
data.options = result.data.options;
return data;
}
});
yield put({
type: 'save',
payload: {
selectOption: result.data
? result.data.options
? result.data.options
: result.data
: [],
detailData,
selectChildOption,
},
});
callback && callback(result);
},
// 子表下拉框事件
*getChildAutocomplate({ payload, callback }, { select, call, put }) {
const selectDate = yield select(({ tableTemplate }) => tableTemplate.selectDate);
const { searchData, selectKey, ColumnsData } = payload;
const { text } = payload.value;
const params = {
key: ColumnsData.key,
text: payload.value.FIELD_NAME || payload.value.text,
value: searchData !== undefined ? searchData : payload.value.FIELD_VALUE,
objId: selectDate.ID,
selectKey,
};
const result = yield call(queryAutocomplate, params);
const selectChildOption = yield select(
({ tableTemplate }) => tableTemplate.selectChildOption
);
// console.log('子表的下拉数据',selectChildOption)
const isExist = _.findIndex(selectChildOption, function(o) {
return o.selectKey == result.data.selectKey && o.field == result.data.field;
});
// console.log('是否存在',isExist)
if (isExist == -1) {
selectChildOption.push(result.data);
} else {
selectChildOption[isExist].options = result.data.options;
}
// console.log(selectChildOption,'后台返回的数据',result.data.options)
yield put({
type: 'save',
payload: {
selectChildOption,
},
});
},
// 主表的rtlink功能
*updateFields({ payload, callback }, { call, put, select }) {
const { updatedField, objectType, params, value } = payload;
// _.mapKeys(params, (value, key) => {
// if (typeof value === 'string') {
// const arr = value.split('--');
// const newValue = arr[arr.length - 1];
// if (arr.length > 0) {
// params[key] = parseInt(newValue) ? parseInt(newValue) : newValue;
// }
// }
// });
// const params = _.assign(value, selectValue);
const detailData = yield select(({ tableTemplate }) => tableTemplate.detailData);
detailData.policyFormFields.map((val, index) => {
// if(editValue){
// 判断是否修改和用户是否选择清空选项,如果修改了,就赋值,没有修改不变,注:null == undefined,区分他们要用 ===
if (params[val.FIELD_NAME]) {
val.FIELD_VALUE = params[val.FIELD_NAME];
if (val.WIDGET_TYPE == 'Date' || val.WIDGET_TYPE == 'DateTime') {
val.FIELD_VALUE = moment(params[val.FIELD_NAME]).valueOf();
} else {
val.FIELD_VALUE = params[val.FIELD_NAME];
}
} else if (params[val.FIELD_NAME] === null && params[val.FIELD_NAME] !== undefined) {
val.FIELD_VALUE = null;
}
});
const postData = {
list: [
{
updatedField,
objectType,
policyFormFields: detailData.policyFormFields,
fieldGroupName: detailData.fieldGroupName,
},
],
};
const result = yield call(updateFields, postData);
if (result.data[0].fieldChanges.length) {
_.map(result.data[0].fieldChanges, item => {
const index = _.findIndex(
detailData.policyFormFields,
data => item.field === data.FIELD_NAME
);
if (index > -1) {
_.map(item.changes, c => {
detailData.policyFormFields[index][c.field] = c.value;
});
}
});
}
yield put({ type: 'save', payload: { detailData } });
if (result.status === 'success' && result.data[0].fieldChanges.length && callback) {
callback(result.data[0].fieldChanges);
}
},
//用于获取主表最新的值
*getMainTableData({ payload, callback }, { select, put, call }) {
yield put({
type: 'save',
payload: {
MainTableData: payload,
},
});
},
// 子表的rtlink功能
*childUpdateFields({ payload, callback }, { select, put, call }) {
const ChildData = yield select(({ tableTemplate }) => tableTemplate.ChildData);
const { params } = payload;
const { list = [] } = params;
if (list.length > 0) {
yield put({ type: 'save', payload: { isChildAdd: true } });
}
// const parentPolicyFormFields = yield select(({ tableTemplate }) => tableTemplate.detailData)
// params.parentPolicyFormFields = parentPolicyFormFields.policyFormFields
let MasterTables = payload.params.MasterTable;
for (let i in MasterTables) {
if (typeof MasterTables[i] == 'object' && MasterTables[i] != null) {
MasterTables[i] = moment(MasterTables[i]).valueOf();
}
}
params.parentPolicyFormFields = MasterTables;
const result = yield call(childUpdateFields, params);
// console.log(ChildData,'后端返回的数据',result.data)
// rtlink 添加警告
result.data.map((item, index) => {
item.fieldChanges.map((j, k) => {
if (j.warningMessage) {
notification.warning({ message: j.warningMessage, duration: 3 });
}
});
});
if (result.status == 'success') {
ChildData.map(i => {
// 子表数据循环 i-子表数据
const { objectType } = i.Data;
result.data.map(n => {
// 子表联动字段循环数据 n-子表新增的一行数据数据
if (n.objectType == objectType) {
i.Data.records.map(j => {
if (j[0].key == n.identifierKey || j[0].identifier == n.identifier) {
n.fieldChanges.map(z => {
j.map(y => {
if (z.field == y.FIELD_NAME) {
z.changes.map(a => {
y[a.field] = a.value;
});
}
});
});
}
});
}
});
});
} else {
notification.error({ message: result.message, duration: 3 });
}
yield put({ type: 'save', payload: { ChildData } });
if (callback) callback(result);
},
// 子表新增弹框表格表头
*getDetailListConfig({ payload }, { select, put, call }) {
const { multiGroupName, multiObjectType } = payload;
const params = {
summaryFieldGroupName: multiGroupName,
objectType: multiObjectType,
};
const result = yield call(queryDetailListConfig, params);
yield put({ type: 'save', payload: { frameColumns: result.data } });
},
// 子表新增弹框表格数据
*getDetailList({ payload }, { select, put, call }) {
const {
multiGroupName,
multiObjectType,
pageSize,
pageNum,
current,
searchParams,
MasterTableID,
ChildTableData,
ChildObject,
} = payload;
for (let gg in searchParams) {
//去除前后的空格
if (searchParams[gg] && typeof searchParams[gg] == 'string') {
searchParams[gg] = searchParams[gg].replace(/(^\s*)|(\s*$)/g, '');
}
}
const params = {
summaryFieldGroupName: multiGroupName,
objectType: multiObjectType,
pageSize,
pageNum: pageNum || current,
MasterTableID,
ChildTableData,
ChildObject,
...searchParams,
};
const result = yield call(queryDetailList, params);
yield put({ type: 'save', payload: { framePagination: result.data } });
},
// 文件上传的接口
*FileUpdate({ payload }, { select, put, call }) {
console.log('文件上传的接口');
},
},
reducers: {
save(state, action) {
return {
...state,
...action.payload,
};
},
},
};
|
import { niceFlash, goodFlash, greatFlash } from '../../anim/animSpeedWordUI';
import GameObject from '../../core/gameObject';
import Script from '../../core/script';
import Render from '../../render';
import speedWordUIScript from './speedWordUIScript';
class SpeedProfilerScript extends Script {
constructor() {
super();
this.old = Date.now();
this.addListener('deleteLetter', (e) => {
let pos = {
'x': e.detail.x,
'y': e.detail.y
};
if (e.detail.active) {
this.createUI(pos, Date.now() - this.old);
this.old = Date.now();
}
});
}
createUI(pos, rank) {
let obj = this.newObject(new GameObject('speedUI'));
obj.render = new Render('./speedUI.png');
obj.addScript(new speedWordUIScript());
obj.setPosition(pos.x, pos.y + 100);
if (rank < 150)
obj.render.addAnim(greatFlash);
else if (rank < 300)
obj.render.addAnim(goodFlash);
else
obj.render.addAnim(niceFlash);
setTimeout(() => {
GameObject.delete(obj);
}, 300);
}
}
export default SpeedProfilerScript;
|
$('#ver_detalle').on('show.bs.modal', function(event) {
let button = $(event.relatedTarget);
$("#procesoventa_id").val(button.data('proceso_venta_id'));
$("#producto_descripcion").val(button.data('producto'));
$("#producto_kilogramos").val(button.data('kilogramos'));
$("#fechasolicitud").val(button.data('fechacreacion'));
$.ajax({
url : "/transportista/subastas/detalle",
data : {
proceso_venta_id : button.data('proceso_venta_id')
},
dataType : "json",
success : function(data) {
$('#tabla_dinamica_ver_detalle').empty();
var trHTML = '';
$.each(data, function(i, item) {
trHTML += '<tr><td>'
+ item.productor.razonsocial
+ '</td><td>'
+ item.kilogramosocupados
+ '</td><td>'
+ item.productor.direccion
+ '</td><td>'
+ item.productor.comuna
+ '</td></tr>';
});
$('#tabla_dinamica_ver_detalle').append(trHTML);
}
});
});
$(".btn_informar").click(function (e){
e.preventDefault();
$('.btn_informar').prop('disable', true);
Swal.fire({
title: '',
text: "¿Desea informar que el pedido a sido entregado en bodega central?",
type: 'warning',
showCancelButton: true,
confirmButtonText: "Confirmar entrega",
confirmButtonColor: '#28a745',
cancelButtonText: 'Cerrar',
cancelButtonColor: '#6c757d'
}).then((result) => {
if (result.value) {
respuestaInforme();
}else{
$('.btn_ofertar').prop('disable', false);
}
})
const respuestaInforme = function(){
$.ajax({
url : "/transportista/subasta/informar-entrega",
data : {
proceso_venta_id : $('#procesoventa_id').val()
},
dataType : "json",
success : function(data) {
if (data === -1) {
MENSAJE_ERROR('','No se ha podido informar la entrega, favor contacta al administrador.');
}else if(data === 1){
MENSAJE_SUCCESS('',
'Se ha informado al administrador la entrega de los productos satisfactoriamente.',
'Cerrar',
'transportista/informar');
}else {
MENSAJE_ERROR('','Hubo un problema en el sistema, favor contacta con el administrador si ves este mensaje (COD: 10501).');
}
$('.btn_informar').prop('disable', false);
}
});
}
});
|
import React from 'react';
import styled from 'styled-components';
const Line = styled.hr`
width : 15%;
border-top: 2px solid rgba(0,0,0,.4);
`
const Header = (props) => {
return (
<div className="mt-5 text-center">
<h2>Our {props.category} Collection</h2>
<Line />
</div>
);
};
export default Header;
|
$(document).ready(function(){
player=$('#music-player')[0]
$(document).on('click','#play-btn.fa.fa-play',function(){
$('#play-btn.fa.fa-play').removeClass('fa-play').addClass('fa-pause').css('color','#fff')
player.play();
totalTime =player.duration
PlayingTime=setInterval(function(){
var playedtime=(Math.round((player.currentTime/player.duration)*100))
if(playedtime>=100)
{
$('#play-btn.fa.fa-pause').removeClass('fa-pause').addClass('fa-play').css('color','#aaa')
player.pause();
clearInterval(PlayingTime)
player.currentTime=0;
$('#podcast-id-value').animate({width:'0%'})
}
else
{
$('#podcast-id-value').animate({width:playedtime+'%'})
}
},1000)
})
$(document).on('click','#play-btn.fa.fa-pause',function(){
$('#play-btn.fa.fa-pause').removeClass('fa-pause').addClass('fa-play').css('color','#aaa')
player.pause();
clearInterval(PlayingTime)
})
$(document).on('click','#podcast-progress',function(event){
if($('#play-btn.fa').hasClass('fa-pause'))
{
var clickpos=event.pageX
var divpos=$('#podcast-progress').offset().left
var divwid=$('#podcast-progress').width()
var songpos= ((clickpos-divpos)/divwid)*100
$('#podcast-id-value').animate({width:songpos+'%'})
totalTime =player.duration
player.currentTime=(songpos*totalTime)/100;
player.play();
}
})
$(document).on('click','#volume-progress',function(event){
var clickpos=event.pageX
var divpos=$('#volume-progress').offset().left
var divwid=$('#volume-progress').width()
var volpos= Math.round(((clickpos-divpos)/divwid)*10)/10;
$('#volume-id-value').animate({width:(volpos*100)+'%'})
player.volume=volpos
})
$(document).on('click','#volume-container .fa.fa-volume-up',function(){
$('#volume-container .fa.fa-volume-up').removeClass('fa-volume-up').addClass('fa-volume-off').css('color','#fff')
currentVol=player.volume
player.volume=0
$('#volume-id-value').animate({width:'0%'})
})
$(document).on('click','#volume-container .fa.fa-volume-off',function(){
$('#volume-container .fa.fa-volume-off').removeClass('fa-volume-off').addClass('fa-volume-up').css('color','#aaa')
player.volume=currentVol
$('#volume-id-value').animate({width:(currentVol*100)+'%'})
})
})
|
import Database from '../../../server'
class Notes extends Database.Model
{
get tableName ()
{
return 'admin_notes'
}
}
module.exports = Notes
|
import React from 'react';
import BG from '../../assets/images/bg.png';
const ProfileHeader = ({ username }) => (
<header
style={{
backgroundImage: `url(${BG})`,
height: 222,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
}}
>
<div
style={{
background: 'linear-gradient(to top, #2b3237 10px, transparent)',
width: '100%',
height: '100%',
position: 'absolute',
left: 0,
bottom: 0,
zIndex: 1,
}}
/>
<img
src={`http://i.pravatar.cc/150?u=${username}`}
alt="profile_picture"
style={{
zIndex: 5,
maxWidth: 80,
maxHeight: 80,
borderRadius: '50%',
}}
/>
<h2 style={{ color: '#fff', zIndex: 5 }}> {username} </h2>
</header>
);
export { ProfileHeader };
|
'use strict';
var edge = require('edge-js');
var express = require('express');
var bodyParser = require('body-parser')
const util = require('util');
var fs = require('fs');
var https = require('https');
var PrintData = require('./src/print_data.js')
var pd = new PrintData()
var app = express();
var cors = require('cors');
var about;
var openport;
var sendcommand;
var clearbuffer;
var printerfont;
var barcode;
var printlabel;
var closeport;
var printer_status;
app.use(express.static('./'));
//var app = express();
app.use(express.json());
app.use(cors({origin:'*'}))
app.listen(8888, function () {
console.log("Server Start!!");
})
app.get('/online_check', function (req, res){
res.send({status:"200"})
});
app.post('/test', function(request, response){
pd._looper(request.body);
response.send({
message: 'telah dicetak pada pencetak barcode!!!'
})
});
app.post('/',function (req, res) {
//printfile();
res.redirect(req.get('referer'));
console.log(req);
});
https.createServer({
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.cert')
}, app).listen(3000,()=>{
console.log('https is listening...')
})
|
const n = 5;
arr1 = [9, 20, 28, 18, 11];
arr2 = [30, 1, 21, 17, 28];
function solution(n, arr1, arr2) {
let answer = [];
for (let i = 0; i < n; i++) {
let temp1 = arr1[i].toString(2);
let temp2 = arr2[i].toString(2);
if (temp1.length < n) {
temp1 = "0".repeat(n - temp1.length) + temp1;
}
if (temp2.length < n) {
temp2 = "0".repeat(n - temp2.length) + temp2;
}
let value = "";
for (let i = 0; i < n; i++) {
if (parseInt(temp1[i]) || parseInt(temp2[i])) {
value += "#";
} else {
value += " ";
}
}
answer.push(value);
}
return answer;
}
console.log(solution(n, arr1, arr2));
|
objdataAjax = getAjaxObj();
updateAjax = getAjaxObj();
function noBack()
{
window.history.forward();
}
String.prototype.trim = function()
{
var x = this;
x = x.replace(/^\s*(.*)/, "$1");
x = x.replace(/(.*?)\s*$/, "$1");
return x;
}
//Email Validation
function isEmailAddr(email, errMsg)
{
var result = false;
email = get_id(email);
var theStr = new String(email.value);
var index = theStr.indexOf("@");
if (index > 0)
{
var pindex = theStr.indexOf(".",index);
if ((pindex > index+1) && (theStr.length > pindex+1))
{
result = true;
}
}
if(result == false)
{
alert(errMsg);
email.focus();
}
return result;
}
//Validate checkbox
function validateCheckbox(chkvarnames,reqCount,optioncount,errMsg)
{
var temp = false;
varArray = chkvarnames.split(",");
checkedcount = 0;
for(i=0; i<optioncount;i++)
{
chkname = varArray[i];
chkVar1= get_id(chkname).checked;
if(chkVar1== true)
{
checkedcount++;
}
}
if(checkedcount < reqCount )
{
alert(errMsg);
get_id(varArray[0]).focus();
// tooltip(errMsg,get_id(varArray[0]),25);
//setTimeout("hidetooltip()",5000);
return false;
}
else
{
return true;
}
};
function checkSpace(id,msg)
{
var alpha;
var flag = true;
str = trim(get_id(id).value);
for (i = 0; i < str.length; i++)
{
alpha = str.charAt(i);
if(alpha==" " || alpha=="")
{
alert(msg);
get_id(id).focus();
flag = false;
break;
}
}
return flag;
}
//Validate Numeric Value
function isNumeric(st, errMsg)
{
var Char;
if(!(st))
{
st = get_id(st);
}
sText = st.value;
var IsNumeric = true;
var blnk = "0123456789.-";
var blnkcnt = 0;
for (i = 0; i < sText.length; i++)
{
Char = sText.charAt(i);
if (blnk.indexOf(Char) == -1)
{
IsNumeric = false;
}
}
if(IsNumeric == false)
{
if(errMsg != '')
{
alert(errMsg);
st.focus();
}
}
return IsNumeric;
}
//value is numeric
function isAnyNumeric(st, mode, errMsg)
{
// Function to check if user input has any Numeric value.
// For example, user enters 1232s324 OR sw23232 OR 2342343sdhs, it would return TRUE.
// But if user enters "asgshsgd", it would return FALSE
var Char;
var chkMode = mode;
st = get_id(st);
sText = st.value;
var IsNumeric = false;
var blnk = "0123456789.-";
var blnkcnt = 0;
for (i = 0; i < sText.length; i++)
{
Char = sText.charAt(i);
if (blnk.indexOf(Char) > -1)
{
IsNumeric = true;
}
}
if(IsNumeric == chkMode)
{
if(errMsg != '')
{
alert(errMsg);
st.focus();
}
return false;
}
else
{
return true;
}
}
//Remove all option from the drop down list
function removeAllOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
//selectbox.options.remove(i);
selectbox.remove(i);
}
}
function addOption(selectbox, value, text )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
sel = document.getElementById(selectbox);
sel.options.add(optn);
}
function removeOption(sel,value)
{
var i;
selectbox = document.getElementById(sel);
for(i=selectbox.options.length-1;i>=0;i--)
{
if(selectbox.options[i].value==value)
{
selectbox.remove(i);
}
}
}
//validate text box is filled or not
function isFilledText(textbox, spStr, errMsg)
{
var strVal;
textbox = get_id(textbox);
strVal = textbox.value;
strVal = trim(strVal);
if((strVal=='') || (strVal==spStr))
{
if(errMsg != '')
{
alert(errMsg);
textbox.focus();
//tooltip(errMsg, textbox, 225);
//setTimeout("hidetooltip()",5000);
}
return false;
}
else
{
return true;
}
}
function hidetooltip()
{
hidetip();
}
//is filled email
function isFilledEmail(textbox, spStr, errMsg)
{
var strVal;
textbox = get_id(textbox);
strVal = textbox.value;
strVal = trim(strVal);
if((strVal=='') || (strVal==spStr))
{
if(errMsg != '')
{
alert(errMsg);
textbox.focus();
}
return false;
}
else
{
v=isEmailAddr(textbox, errMsg);
return v;
}
}
//is filled numeric
function isFilledNumeric(textbox, spStr, errMsg)
{
var strVal;
textbox = get_id(textbox);
strVal = textbox.value;
strVal = trim(strVal);
if((strVal=='') || (strVal==spStr))
{
if(errMsg != '')
{
alert(errMsg);
textbox.focus();
}
return false;
}
else
{
v=isNumeric(textbox,errMsg);
return v;
}
}
//is drop down selected
function isFilledSelect(selectbox, spStr, errMsg, cmpOpt)
{
// Possible values for cmpOpt are
// 0 when values are supposed to be compared but in numbers, variable spStr is mentioned in number
// 1 when text needs to be compared, variable spStr is mentioned in text
// 2 when values are supposed to be compared but in text, variable spStr is mentioned in text
var strVal;
if(cmpOpt == 0)
{
selectbox = get_id(selectbox);
strVal = selectbox.selectedIndex;
if(strVal==spStr)
{
alert(errMsg);
selectbox.focus();
return false;
}
else
{
return true;
}
}
else if(cmpOpt == 1)
{
strVal = selectbox.options[selectbox.selectedIndex].text;
spStr = trim(spStr);
if(strVal==spStr)
{
alert(errMsg);
selectbox.focus();
return false;
}
else
{
return true;
}
}
else if(cmpOpt == 2)
{
strVal = selectbox.options[selectbox.selectedIndex].value;
spStr = trim(spStr);
if(strVal==spStr)
{
alert(errMsg);
selectbox.focus();
return false;
}
else
{
return true;
}
}
}
//if checkbox checked
function isCBoxChecked(checkBox, numChecked, errMsg, countCBox)
{
var numCBox, chkTemp, chkCount;
if(countCBox == 1)
{
if(checkBox.checked == false)
{
if(errMsg != "")
{
alert(errMsg);
checkBox.focus();
}
return false;
}
else
{
return true;
}
}
else
{
chkTemp = false;
chkCount = 0;
numCBox = checkBox.length;
for(i=0;i<numCBox;i++)
{
if(checkBox[i].checked == true)
{
chkCount++;
if(chkCount==numChecked)
{
chkTemp = true;
}
}
}
if(chkTemp==false)
{
if(errMsg != "")
{
alert(errMsg);
}
}
return chkTemp;
}
}
//compare two strings
function compareString(strObject1, strObject2, objType)
{
var str1, str2;
var isEqual = false;
if(objType == "Text")
{
str1 = strObject1.value;
str1 = trim(str1);
str2 = strObject2.value;
str2 = trim(str2);
if(str1 == str2)
{
isEqual = true;
}
}
else if(objType == "Select")
{
str1 = strObject1.options[strObject1.selectedIndex].text;
str1 = trim(str1);
str2 = strObject2.options[strObject2.selectedIndex].text;
str2 = trim(str2);
if(str1 == str2)
{
isEqual = true;
}
}
return isEqual;
}
//generate string for different form values
function createStrSubmit(frmName)
{
var strSubmit = "";
var currElement, lstElement;
lstElement = "";
for(i=0; i<frmName.elements.length; i++)
{
currElement = frmName.elements[i];
switch(currElement.type)
{
case 'text':
case 'select-one':
case 'hidden':
case 'password':
case 'textarea':
strSubmit += currElement.name + '=' + escape(currElement.value) + '&'
break;
case 'checkbox':
if(currElement.checked == true)
{
if(lstElement != currElement.name)
{
strSubmit += currElement.name + '=' + escape(trim(currElement.value)) + '&'
}
else
{
if(strSubmit.substring(strSubmit.length - 1, strSubmit.length) == '&')
strSubmit = strSubmit.substring(0, strSubmit.length - 1)
strSubmit += ',' + escape(currElement.value)
}
lstElement = currElement.name
}
break;
}
if(strSubmit.substring(strSubmit.length - 1, strSubmit.length) != '&')
{
strSubmit += '&';
}
}
if(strSubmit.substring(strSubmit.length - 1, strSubmit.length) == '&')
{
strSubmit = strSubmit.substring(0,strSubmit.length-1);
}
return strSubmit;
}
//check for all form fields
function checkFormAllFields(frmName)
{
var strSubmit = true;
var currElmVal;
var currI = -1;
for(i=0; i<frmName.elements.length; i++)
{
currElement = frmName.elements[i];
switch(currElement.type)
{
case 'text':
case 'select-one':
case 'password':
case 'textarea':
case 'checkbox':
currElmVal = currElement.value;
currElmVal = trim(currElmVal);
if(escape(currElmVal) == "")
{
if(strSubmit == true)
{
currI = i;
}
strSubmit = false;
}
break;
}
}
if(strSubmit == false)
{
alert('No field can be left blank.');
currElement = frmName.elements[currI];
currElement.focus();
}
return strSubmit;
}
//check for special characters
function chkspChar(str)
{
var alpha;
var flag= true;
for (i = 0; i < str.length; i++)
{
alpha = str.charAt(i);
if(!((alpha>="A" && alpha<="Z") || (alpha>="a" && alpha<="z") || (alpha>="0" && alpha<="9")))
{
flag=false;
break;
}
}
return flag;
}
function _allowNumeric(e)
{
var keyp;
keyp = getKeyCode(e);
if(keyp >= 48 && keyp <= 57)
{
return true;
}
else if(keyp == null)
{
return true;
}
else
{
if(keyp == 8 || keyp == 0)
{
return true;
}
else
{
return false;
}
}
};
//Only Alpha allowed
function isAlpha(st,errMsg)
{
str = st.value;
flag=true;
for (i = 0; i < str.length; i++)
{
alpha = str.charAt(i);
if(!((alpha>="A" && alpha<="Z") || (alpha>="a" && alpha<="z") || (alpha=='_')))
{
if(errMsg!='')
{
alert(errMsg);
st.focus();
}
flag=false;
break;
}
}
return flag;
};
//is filled and alpha
function isFilledAlpha(textbox, spStr, errMsg)
{
var strVal;
textbox = get_id(textbox);
strVal = textbox.value;
strVal = trim(strVal);
if((strVal=='') || (strVal==spStr))
{
if(errMsg != '')
{
alert(errMsg);
textbox.select();
}
return false;
}
else
{
v=isAlpha(textbox,errMsg);
return v;
}
};
//Only Alpha Numeric allowed
function isAlphaNumeric(st,errMsg)
{
str = st.value;
flag=true;
for (i = 0; i < str.length; i++)
{
alpha = str.charAt(i);
if(!((alpha>="A" && alpha<="Z") || (alpha>="a" && alpha<="z") || (alpha>="0" && alpha<="9")))
{
if(errMsg!='')
{
alert(errMsg);
st.select();
}
flag=false;
break;
}
}
return flag;
};
//is filled and alphanum
function isFilledAlphaNum(textbox, spStr, errMsg)
{
var strVal;
strVal = textbox.value;
strVal = trim(strVal);
if((strVal=='') || (strVal==spStr))
{
if(errMsg != '')
{
alert(errMsg);
textbox.select();
}
return false;
}
else
{
v=isAlphaNumeric(textbox,errMsg);
return v;
}
};
//is 1 option selected from option list
function isRadioSelected(radio,errMsg)
{
robj = document.forms[0].elements[radio];
if(robj.length > 0)
{
flag = false;
for(var i=0;i<robj.length;i++)
{
if(robj[i].checked == true)
{
flag = true;
break;
}
}
if(flag==false)
{
if(errMsg!='')
{
alert(errMsg);
}
robj[0].focus();
}
}
return flag;
};
function get_id(element)
{
if(document.getElementById(element))
{
return document.getElementById(element);
}
else
{
return false;
}
};
//return form elements value
function $F(element)
{
if(get_id(element).value)
{
return get_id(element).value;
}
else
{
return false;
}
};
function trim(s)
{
var l=0; var r=s.length -1;
while(l < s.length && s[l] == ' ')
{ l++; }
while(r > l && s[r] == ' ')
{ r-=1; }
return s.substring(l, r+1);
};
function _allowAlpha(e)
{
var keyp;
keyp = getKeyCode(e);
if((keyp>=65 && keyp<=90) || (keyp>=97 && keyp<=122) || keyp==32 || keyp==8 || keyp==0)
{
return true;
}
else if(keyp == null)
{
return true;
}
else
{
return false;
}
};
function getKeyCode(e)
{
if (window.event)
{
return window.event.keyCode;
}
else if (e)
{
return e.which;
}
else
{
return null;
}
};
// allow true alpha space backspace and del
function _allowAlpha(e)
{
var keyp;
keyp = getKeyCode(e);
if((keyp>=65 && keyp<=90) || (keyp>=97 && keyp<=122) || keyp==32 || keyp==8 || keyp==0)
{
return true;
}
else if(keyp == null)
{
return true;
}
else
{
return false;
}
};
//allow alpha and numeric
function _allowAlphaNumeric(e)
{
var keyp;
keyp = getKeyCode(e);
if((keyp>=65 && keyp<=90) || (keyp>=97 && keyp<=122) || keyp==8 || keyp==0 ||(keyp>=48 && keyp<=57) || (keyp==95))
{
return true;
}
else if(keyp == null)
{
return true;
}
else
{
return false;
}
};
function _allowAlphaNumericSpace(e)
{
var keyp;
keyp = getKeyCode(e);
if((keyp>=65 && keyp<=90) || (keyp>=97 && keyp<=122) || keyp==8 || keyp==0 ||(keyp>=48 && keyp<=57) || (keyp==95) || (keyp==32))
{
return true;
}
else if(keyp == null)
{
return true;
}
else
{
return false;
}
};
function returnAllChecked(chkname)
{
var countchk = chkname.length;
var check = true;
for(i=0;i<countchk;i++)
{
if(chkname[i].checked == false)
{
var check = false;
break;
}
}
return check;
};
function anyChecked(chkname,countchk)
{
var check = false;
for(i=1;i<=countchk;i++)
{
chk = chkname + "_" + i;
if(get_id(chk).checked == true)
{
check = true;
break;
}
}
return check;
};
function isAnyChecked(chktest)
{
var countchk = chktest.length;
var check = false;
for(i=0;i<countchk;i++)
{
if(chktest[i].checked == true)
{
check = true;
break;
}
}
if(check== false)
{
document.frmdeloption.sbutton.disabled = true;
}
else
{
document.frmdeloption.sbutton.disabled = false;
}
};
function _checkDuplicateAct(v1,v2,v3,dropcount)
{
//v1 = document.getElementById(d1);
//v2 = document.getElementById(d2);
if(dropcount==3)
{
//v3 = document.getElementById(d3);
}
if(!(v1.value==97 || v1.value==98 || v1.value==0))
{
if(dropcount==3 && (v1.value==v2.value || v1.value==v3.value))
{
alert("you have already selected this option");
v1.selectedIndex = 0;
}
else if(dropcount==2 && (v1.value==v2.value))
{
alert("you have already selected this option");
v1.selectedIndex = 0;
}
}
}
function _checkDuplicateDrop(d1,d2,d3,dropcount)
{
v1 = document.getElementById(d1);
v2 = document.getElementById(d2);
if(dropcount==3)
{
v3 = document.getElementById(d3);
}
if(!(v1.value==97 || v1.value==98 || v1.value==0))
{
if(dropcount==3 && (v1.value==v2.value || v1.value==v3.value))
{
alert("you have already selected this option");
v1.selectedIndex = 0;
}
else if(dropcount==2 && (v1.value==v2.value))
{
alert("you have already selected this option");
v1.selectedIndex = 0;
}
}
}
function uncheckAll(id,count)
{
for(i=1;i<=count;i++)
{
chkid = id+"_"+i;
get_id(chkid).checked = false;
}
}
function checkFilled(txt_id,msg)
{
if(get_id(txt_id).value=='' || get_id(txt_id).value==' ')
{
get_id(txt_id).style.color = '#a0a0a0';
get_id(txt_id).value = msg;
}
}
function removeDefault(txt_id,msg)
{
if(get_id(txt_id).value==msg)
{
get_id(txt_id).style.color = '#000000';
get_id(txt_id).value = '';
}
}
function checkFilled(txt_id,msg)
{
if(get_id(txt_id).value=='' || get_id(txt_id).value==' ')
{
get_id(txt_id).style.color = '#a0a0a0';
get_id(txt_id).value = msg;
}
}
function removeDefault(txt_id,msg)
{
txtstr = get_id(txt_id).value;
//if(get_id(txt_id).value==msg || get_id(txt_id).value=='')
if(txtstr.search(msg)!=-1 || get_id(txt_id).value=='')
{
get_id(txt_id).style.color = '#000000';
get_id(txt_id).value = '';
}
}
function countChecked(id,count)
{
chkcount = 0;
for(i=1;i<=count;i++)
{
chkid = id+"_"+i;
if(get_id(chkid).checked)
{
chkcount++;
}
}
return chkcount;
}
function getAjaxObj()
{
var AjaxObj = null;
try
{
// Firefox, Opera 8.0+, Safari
AjaxObj = new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
AjaxObj = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
AjaxObj = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return AjaxObj;
};
function showHideOther2(value,divid,txtoth)
{
if(value==97)
{
get_id(divid).style.display = "block";
get_id(txtoth).focus();
}
else
{
get_id(divid).style.display = "none";
get_id(txtoth).value = '';
}
};
function returnAnyChecked(chkname)
{
var countchk = chkname.length;
var check = false;
for(i=0;i<countchk;i++)
{
if(get_id(chkname[i]).checked == true)
{
check = true;
break;
}
}
return check;
};
function showHideOther(divid,chkoth)
{
chkbrand = document.getElementsByName("e9[]");
chkid = chkbrand[26];
if(chkid.checked)
{
get_id(divid).style.display = "block";
get_id(chkoth).focus();
}
else
{
get_id(divid).style.display = "none";
get_id(chkoth).value = '';
}
}
function upPriority(tab,id)
{
txtid = "txt"+id;
tvalue = get_id(txtid).value;
var myRandom = parseInt(Math.random()*99999999);
updateAjax.open("GET","updpriority.php?rand=" + myRandom + "&rowid=" + id + "&priority=" + tvalue + "&tab=" + tab,true);
updateAjax.onreadystatechange = function _httpUpdate()
{
if(updateAjax.readyState == 4)
{
//alert(updateAjax.responseText);
window.location.reload(true);
}
}
updateAjax.send(null);
}
function checknoneArr(chkidArr,value)
{
chkcollect = document.getElementsByName(chkidArr);
len =chkcollect.length;
noneid = chkcollect[chkcollect.length-1];
if(value!=98)
{
cid = chkcollect[value-1];
if(cid.checked)
{
if(noneid.checked)
{
alert("You can\'t select any other option dd with \'None\' option");
cid.checked = false;
}
}
}
else
{
for(i=0;i<(len-1);i++)
{
chkid = chkcollect[i];
if(chkid.checked)
{
alert("You can\'t select \'None\' option with any other option");
noneid.checked = false;
break;
}
}
}
}
//Restricts for checkbox selected with none option or vice versa
function checknone(id,value,countchk,qid)
{
prevar = id.substr(0,2);
noneid = prevar + qid + "_" + countchk;
if(value!=98 && value!=99)
{
if(get_id(id).checked)
{
if(get_id(noneid).checked)
{
alert("You can\'t select any other option with \'None\' option");
get_id(id).checked = false;
}
}
}
else
{
for(i=1;i<countchk;i++)
{
chkid = prevar + qid + "_" + i;
if(get_id(chkid).checked)
{
alert("You can\'t select \'None\' option with any other option");
get_id(noneid).checked = false;
break;
}
}
}
}
|
import Button from './Button'
import TextyInput from './TextyInput'
import TextArea from './TextArea'
import Repertoire from './Arrays/Repertoire'
import Performances from './Arrays/Performances'
export {
Button,
TextyInput,
TextArea,
Repertoire,
Performances
}
|
/* eslint-disable */
const commonConfig = require('@modules/eslint');
module.exports = {
...commonConfig,
}
|
import test from 'ava';
import { getRandomInt } from './jsUtils';
test('should respect lower bound', t => {
t.true(getRandomInt(0, 100) >= 0);
});
test('should respect upper bound', t => {
t.true(getRandomInt(0, 100) <= 100);
});
|
import {
ROLE_ADMINISTRATEUR,
ROLE_ASSISTANCE,
ROLE_GESTIONNAIRE,
} from "actions/constants/roles";
export default (state = {}, action) => {
const { type, payload: roles } = action;
switch (type) {
case ROLE_ADMINISTRATEUR:
return { ...state, roleAdministrateur: roles.split(",") };
case ROLE_ASSISTANCE:
return { ...state, roleAssistance: roles.split(",") };
case ROLE_GESTIONNAIRE:
return { ...state, roleGestionnaire: roles.split(",") };
default:
return state;
}
};
|
import React from 'react';
import "./style.css";
function Footer() {
return(
<div className="footerDiv">
<h6 className="footerText">follow</h6>
<h6 className="footerText">Created By: Mathew Bishop, Callie Hart, and Jordan Beaman</h6>
</div>
)
}
export default Footer;
|
import {createLocalVue, mount} from '@vue/test-utils'
import {
getQueriesForElement,
logDOM,
waitFor,
fireEvent as dtlFireEvent,
} from '@testing-library/dom'
const mountedWrappers = new Set()
function render(
TestComponent,
{
store = null,
routes = null,
container: customContainer,
baseElement: customBaseElement,
...mountOptions
} = {},
configurationCb,
) {
const div = document.createElement('div')
const baseElement = customBaseElement || customContainer || document.body
const container = customContainer || baseElement.appendChild(div)
const attachTo = document.createElement('div')
container.appendChild(attachTo)
const localVue = createLocalVue()
let vuexStore = null
let router = null
let additionalOptions = {}
if (store) {
const Vuex = require('vuex')
localVue.use(Vuex)
vuexStore = new Vuex.Store(store)
}
if (routes) {
const requiredRouter = require('vue-router')
const VueRouter = requiredRouter.default || requiredRouter
localVue.use(VueRouter)
router = new VueRouter({
routes,
})
}
if (configurationCb && typeof configurationCb === 'function') {
additionalOptions = configurationCb(localVue, vuexStore, router)
}
if (!mountOptions.propsData && !!mountOptions.props) {
mountOptions.propsData = mountOptions.props
delete mountOptions.props
}
const wrapper = mount(TestComponent, {
localVue,
router,
attachTo,
store: vuexStore,
...mountOptions,
...additionalOptions,
})
mountedWrappers.add(wrapper)
container.appendChild(wrapper.element)
return {
container,
baseElement,
debug: (el = baseElement) =>
Array.isArray(el) ? el.forEach(e => logDOM(e)) : logDOM(el),
unmount: () => wrapper.destroy(),
isUnmounted: () => wrapper.vm._isDestroyed,
html: () => wrapper.html(),
emitted: () => wrapper.emitted(),
updateProps: _ => {
wrapper.setProps(_)
return waitFor(() => {})
},
...getQueriesForElement(baseElement),
}
}
function cleanup() {
mountedWrappers.forEach(cleanupAtWrapper)
}
function cleanupAtWrapper(wrapper) {
if (
wrapper.element.parentNode &&
wrapper.element.parentNode.parentNode === document.body
) {
document.body.removeChild(wrapper.element.parentNode)
}
wrapper.destroy()
mountedWrappers.delete(wrapper)
}
// Vue Testing Library's version of fireEvent will call DOM Testing Library's
// version of fireEvent plus wait for one tick of the event loop to allow Vue
// to asynchronously handle the event.
// More info: https://vuejs.org/v2/guide/reactivity.html#Async-Update-Queue
async function fireEvent(...args) {
dtlFireEvent(...args)
await waitFor(() => {})
}
Object.keys(dtlFireEvent).forEach(key => {
fireEvent[key] = async (...args) => {
dtlFireEvent[key](...args)
await waitFor(() => {})
}
})
fireEvent.touch = async elem => {
await fireEvent.focus(elem)
await fireEvent.blur(elem)
}
// Small utility to provide a better experience when working with v-model.
// Related upstream issue: https://github.com/vuejs/vue-test-utils/issues/345#issuecomment-380588199
// Examples: https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/form.js
fireEvent.update = (elem, value) => {
const tagName = elem.tagName
const type = elem.type
switch (tagName) {
case 'OPTION': {
elem.selected = true
const parentSelectElement =
elem.parentElement.tagName === 'OPTGROUP'
? elem.parentElement.parentElement
: elem.parentElement
return fireEvent.change(parentSelectElement)
}
case 'INPUT': {
if (['checkbox', 'radio'].includes(type)) {
elem.checked = true
return fireEvent.change(elem)
} else {
elem.value = value
return fireEvent.input(elem)
}
}
case 'TEXTAREA': {
elem.value = value
return fireEvent.input(elem)
}
case 'SELECT': {
elem.value = value
return fireEvent.change(elem)
}
default:
// do nothing
}
return null
}
// If we're running in a test runner that supports afterEach then we'll
// automatically run cleanup after each test. This ensures that tests run in
// isolation from each other.
// If you don't like this, set the VTL_SKIP_AUTO_CLEANUP variable to 'true'.
if (typeof afterEach === 'function' && !process.env.VTL_SKIP_AUTO_CLEANUP) {
afterEach(() => {
cleanup()
})
}
export * from '@testing-library/dom'
export {cleanup, render, fireEvent}
|
'use strict'
const Hash = use('Hash')
const UserHook = module.exports = {}
UserHook.hashPassword = async (model) => {
const dirty = model.dirty
if (dirty.password) {
model.password = await Hash.make(model.password)
}
}
|
if(document.readyState == 'loading'){
document.addEventListener('DOMContentLoaded', start)
} else{
start()
}
function start(){
const quantityInput = document.getElementsByClassName('quantity-input')
for(let i = 0; i < quantityInput.length; i++){
let input = quantityInput[i]
input.addEventListener('change', quantityChanged)
}
const deleteButton = document.getElementsByClassName('btn-delete')
for(let i = 0; i < deleteButton.length; i++){
deleteButton[i].addEventListener('click', deleteCartItem)
}
const addToCartButton = document.getElementsByClassName('add-to-cart')
for(let i = 0; i < addToCartButton.length; i++){
addToCartButton[i].addEventListener('click', addtoCart)
}
const searchBar = document.querySelector('.item-input')
searchBar.addEventListener('keyup', searchBarActive)
const purchaseButtons = document.querySelectorAll('[data-modal-purchase]')
purchaseButtons.forEach(button => {
button.addEventListener('click', purchaseClicked)
})
}
function quantityChanged(event){
let input = event.target
if(isNaN(input.value) || input.value <= 0){
input.value = 1
}
updatePrice()
}
function deleteCartItem(event){
let button = event.target
button.parentElement.parentElement.remove()
updatePrice()
}
function purchaseClicked() {
alert('Thank you for your purchase!')
const items = document.getElementsByClassName('shopping-cart')[0]
while (items.hasChildNodes()) {
items.removeChild(items.firstChild)
}
updatePrice()
}
function updatePrice(){
const shoppingCart = document.getElementsByClassName('shopping-cart')[0]
const cartItems = shoppingCart.getElementsByClassName('cart-items')
let total = 0
for(let i = 0; i < cartItems.length; i++){
const cartItem = cartItems[i]
let quantity = cartItem.getElementsByClassName('quantity-input')[0].value
let unitprice = cartItem.getElementsByClassName('cart-price')[0].innerText.replace('$','')
total = total + (quantity * unitprice)
subtotal = quantity * unitprice
subtotal = Math.round(subtotal*100) / 100
let subtotalbox = cartItem.getElementsByClassName('cart-subtotal-price')[0]
subtotalbox.innerText = '$' + subtotal
}
total = Math.round(total*100) / 100
const totalPrice = document.getElementsByClassName('cart-total-price')[0]
totalPrice.innerText = '$' + total
}
function addtoCart(event){
let button = event.target
let item = button.parentElement.parentElement
let title = item.getElementsByClassName('item-title')[0].innerText
let image = item.getElementsByClassName('item-image')[0].src
let unitprice = item.getElementsByClassName('item-price')[0].innerText
addedItem(title, image, unitprice)
}
function addedItem(title, image, unitprice){
let itemRow = document.createElement('div')
itemRow.className = 'cart-items'
const shoppingCart = document.getElementsByClassName('shopping-cart')[0]
const itemRowContent =
`<div class="cart-item cart-style">
<img class="cart-item-image" src=${image}>
<span class="cart-item-title">${title}</span>
</div>
<span class="cart-price cart-style">${unitprice}</span>
<div class="cart-quantity cart-style">
<input class="quantity-input" type="number" value="1">
</div>
<div class="cart-subtotal cart-style">
<span class="cart-subtotal-price">$0</span>
<button class="btn btn-delete" type="button">Remove</button>
</div>`
itemRow.innerHTML = itemRowContent
// Avoid same item added to cart
const cartTitles = shoppingCart.getElementsByClassName('cart-item-title')
for(let i = 0; i< cartTitles.length; i++){
const cartTitle = cartTitles[i]
if(cartTitle.innerText == title){
alert('Already added to cart!')
return
}
}
shoppingCart.append(itemRow)
let input = itemRow.getElementsByClassName('quantity-input')[0]
input.addEventListener('change', quantityChanged)
let deleteItem = itemRow.getElementsByClassName('btn-delete')[0]
deleteItem.addEventListener('click', deleteCartItem)
updatePrice()
}
// Search bar function
function searchBarActive(event){
const inputContent = event.target.value.toLowerCase()
const titleNames = document.querySelectorAll('.item-title')
Array.from(titleNames).forEach(title => {
if(title.textContent.toLowerCase().indexOf(inputContent)!= -1){
title.parentElement.style.display = 'block'
} else{
title.parentElement.style.display = 'none'
}
})
}
// Cart modal
const openModalButtons = document.querySelectorAll('[data-modal-target]')
const closeModalButtons = document.querySelectorAll('[data-close-modal]')
const overlay = document.getElementById('overlay')
openModalButtons.forEach(openbutton => {
openbutton.addEventListener('click', () => {
const modal = document.querySelector(openbutton.dataset.modalTarget)
openCartModal(modal)
})
})
function openCartModal(modal){
if(modal == null) return
modal.classList.add('active')
overlay.classList.add('active')
}
closeModalButtons.forEach(closebutton => {
closebutton.addEventListener('click', () => {
const modal = closebutton.parentElement.parentElement
closeCartModal(modal)
})
})
function closeCartModal(modal){
if(modal == null) return
modal.classList.remove('active')
overlay.classList.remove('active')
}
overlay.addEventListener('click', () => {
const modals = document.querySelectorAll('.modal.active')
modals.forEach(modal => {
closeCartModal(modal)
})
})
|
import React from 'react';
import Header from './components/Header';
import Footer from './components/Footer';
import Body from './components/Body';
import {View} from 'react-native';
const Post = ({post}) => (
<>
<View>
<Header imageUri={post.user.image} name={post.user.name} />
<Body imageUri={post.image} />
<Footer likesCount={post.likes} caption={post.caption} postedAt={post.createdAt}/>
</View>
</>
);
export default Post;
|
// localStorage - keeps a user logged in between visits
// sessionStorage (not using) - only keeps token / them logged in during browser session
// creating a new service called authentication
(function() {
angular
.module('journalApp')
.service('authentication', authentication);
authentication.$inject = ['$http', '$window'];
function authentication ($http, $window) {
// creating and returning these methods:
// saveToken method
var saveToken = function(token) {
$window.localStorage['journal-token'] = token;
};
// getToken method
var getToken = function() {
return $window.localStorage['journal-token'];
};
// isLoggedIn method
var isLoggedIn = function() {
var token = getToken();
var payload;
// decode the payload (2nd part of token) & parse as JSON
if(token) {
payload = token.split('.')[1];
payload = $window.atob(payload);
payload = JSON.parse(payload);
//check if expiry date passed
return payload.exp > Date.now() / 1000;
} else {
return false;
}
};
// currentUser method
// get user data from JWT (check if they are logged in, then decode payload etc)
// gets the email and name from JWT and returns them in an object
var currentUser = function() {
if(isLoggedIn()){
var token = getToken();
var payload = token.split('.')[1];
payload = $window.atob(payload);
payload = JSON.parse(payload);
return {
email : payload.email,
name : payload.name
};
}
};
// register & login methods
// call login and register points and save the token
// (interface between angular app and api) uses $http service
register = function(user) {
return $http.post('/api/register', user).success(function(data){
saveToken(data.token);
});
};
login = function(user) {
return $http.post('/api/login', user).success(function(data) {
saveToken(data.token);
});
};
// logout method
logout = function() {
$window.localStorage.removeItem('journal-token');
};
return {
currentUser : currentUser,
saveToken : saveToken,
getToken : getToken,
isLoggedIn : isLoggedIn,
register : register,
login : login,
logout : logout
};
}
})();
|
$(document).ready(function(){
$('#third-question-container').jScrollPane();
});
function completed(goPre){
if(_previewFlag || goPre){
var isRadio = _type.startsWith("RADIO") ? true :false;
if(goPre){
if(confirm("입력한 사항을 취소하시겠습니까?")){
parent.complete3Depth(_itemId,_questionId,isRadio,true);
}
}else{
parent.complete3Depth(_itemId,_questionId,isRadio,goPre);
}
return;
}
var timer = null;
if(_processingFlag){
//진행중이면 1초후에 다시 이함수를 호출한다.
if(timer != null){
clearTimeout(timer);
}
timer = setTimeout(function(){
completed(goPre);
},1000);
return;
}
var canGoNext = true;
$("input:hidden").each(function(){
var id = $(this).attr("id");
if(id.startsWith("complete_flag_")){
var val = $(this).val();
if(val == "false"){
canGoNext = false;
var inputNeedId = $(this).attr("questionId");
$("#question-" + inputNeedId).addClass("required-question");
}
}
});
if(canGoNext){
var isRadio = _type.startsWith("RADIO") ? true :false;
parent.complete3Depth(_itemId,_questionId,isRadio);
}else{
alert("필수 질문에 답변이 필요합니다.\n붉은색으로 밑줄쳐진 질문에 답변을 하십시요.");
}
}
function showDepth(itemId){
}
function hideDepth(itemId){
}
function close3Depth(){
}
function _updateProgress(){
//dummy
}
|
// Pour obtenir le nombre de MILLISECONDES par une écriture : (2).minutes / (4).weeks
// -----------------------------------------------------------------------------
// Il faut obligatoirement entourer les chiffres par des parenthèses :
// 2.days => produit une erreur
// (2).days => OK
Object.defineProperties(Number.prototype,{
"minute" :{get:function(){return this.minutes}},
"minutes" :{get:function(){return this * 60 * 1000}},
"hour" :{get:function(){return this.hours}},
"hours" :{get:function(){return this.minutes * 60}},
"day" :{get:function(){return this.days}},
"days" :{get:function(){return this.hours * 24}},
"week" :{get:function(){return this.weeks}},
"weeks" :{get:function(){return this.days * 7}},
})
// // Pour utiliser jusqu'à vingt des tournures comme "one.day", "two.hours"
// window._NumberObject = {}
// Object.defineProperties(_NumberObject,{
// "minute":{get:function(){return this.minutes}},
// "minutes":{get:function(){return this.multi * 60}},
// "hour":{get:function(){return this.hours}},
// "hours":{get:function(){this.minutes * 69}},
// "day":{get:function(){return this.days}},
// "days":{get:function(){return this.hours * 24}}
// })
// L({one:1,two:2,tree:3,four:4,five:5,six:6,seven:7,height:8,nine:9,ten:10,
// eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,
// heighteen:18, nineteen:19,twenty:20}).
// each(function(k,v){window[k] = $.extend({multi:v, _NumberObject})})
//
Object.defineProperty(window, "NOW", {
get:function(){ return Time.now() }
})
/*
* Time Object
* -----------
* Utilitaire pour le temps
*
*/
const WITH_MILLIEME = 1;
const HOUR_TWO_DIGITS = 2;
window.Time = {
// Format de l'horloge
// @valeurs possibles :
// null => H:MM:SS
// 'with_milliemes' => H:MM:SS,MMM
FORMAT_HORLOGE_DEFAULT: WITH_MILLIEME,
// Retourne un objet Date défini avec un {Array} contenant :
// [annee, mois, jour, heure, minute, secondes]
dateFromArray:function(arr){
return new Date(Date.UTC.apply(null, arr))
},
// Retourne le temps courant
// Pour le moment, le nombre de microsecondes ou le format local
// si format est défini
now:function(format){
if(undefined == format) return (new Date()).valueOf();
else return new Date().toLocaleString();
},
// Retourne le nombre de secondes (float) en fonction de l'horloge
// fournie.
// @note: Si l'horloge contient un point, c'est un time code
horlogeToSeconds:function(val){
var hrl, frames = 0;
if(val.indexOf(',')>-1){
var p = val.split(',')
hrl = p[0];
frames = parseInt(p[1],10);
} else { hrl = val }
hrl = hrl.split(':').reverse();
var seconds = parseInt(hrl[0],10) + (hrl[1]||0)*60 + (hrl[2]||0)*3600;
return parseFloat(seconds) + frames/1000;
},
h2s:function(val){return this.horlogeToSeconds(val)},
/*
Reçoit un nombre de secondes et retourne une horloge
-------------------------------------------------------------------
@param val Nombre de secondes (float / integer)
@param options Liste optionnelle d'options :
hour_2_digits Si true, met l'heure en format de 2 chiffres
False par défaut.
*/
secondsToHorloge:function(val,options){
if('undefined'==typeof options)options = {}
var fms="000";
if(undefined == val || val === null) return "x:xx:xx";
if(val.toString().indexOf(".")>-1){
val = val.toString().split('.');
fms = parseInt(val[1],10).toString().substring(0,3);
while(fms.toString().length < 3) fms += "0";
val = parseInt(val[0],10);
}
var hrs = Math.floor(val / 3600);
if((options.hour_2_digits || (this.FORMAT_HORLOGE_DEFAULT & HOUR_TWO_DIGITS)) && hrs < 10) hrs = "0"+hrs;
var reste = val % 3600;
var mns = Math.floor(reste / 60);
if(mns < 10) mns = "0"+mns;
var scs = (reste % 60) * 1000;
scs = Math.floor(scs/1000);
if(scs<10) scs = "0"+scs;
var h = hrs+":"+mns+":"+scs;
if(this.FORMAT_HORLOGE_DEFAULT & WITH_MILLIEME) h += ","+fms;
return h;
},
s2h:function(val,options){return this.secondsToHorloge(val,options)}
}
Object.defineProperties(Time, {
"lag":{
get:function(){
if(undefined == this._lag)
{
var d = new Date()
var utc = Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds())
this._lag = utc - d.getTime()
}
return this._lag
}
}
})
|
const favicon = require('koa-favicon')
const path = require('path')
module.exports = function (app, options) {
// 中间件:用来注册在每个请求生命周期的路由之前 在日志、session中间件之后调用
app.middleware(favicon(path.resolve(__dirname, '../public/favicon.ico')))
}
|
import util from '@/libs/util';
import {computeColumnSpanParams, computeSpanMethod} from "./components/column-span-tool"
import dropdownNav from './components/dropdown-nav'
import {computeSumLime} from "./components/data-groupby-tool"
import {findComponentsDownward} from 'view-design/src/utils/assist';
import {deepCopy} from "@/libs/assist";
export default {
name: 'XtlElTable',
componentName: 'XtlElTable',
components: {
dropdownNav
},
props: {
tableName: {
type: String,
default: '表格数据'
},
//是否折叠查询条件
collapseSearch: {
type: Boolean,
default: false
},
dataUrl: {
type: String,
default: ''
},
columns: {
type: Array,
default: function () {
return []
}
},
data: {
type: Array,
default: () => {
return []
}
},
spanColumns: {
type: Array,
default: function () {
return []
}
},
groupSum: {
type: Object,
default: function () {
return {}
}
},
//查询条件
searchParams: {
type: Object
},
rowClassName: [String, Function],
border: {
type: Boolean,
default: true
},
//扩展方式 all loadmore paging
extendType: {
type: String,
default: ""
},
transformRequest: {
type: Function,
default: function (data) {
return data;
}
},
transformResponse: {
type: Function,
default: function (data) {
return data;
}
},
showTableOption: {
type: Boolean,
default: true
},
showSummary: {
type: Boolean,
default: false
},
summaryMethod: Function
},
data() {
return {
showAll: true,
colIcon: 'ios-arrow-up',
cloneTableTata: [],
sortParams: {},
tableColumns: [],
tableLoading: false,
totalNumber: 0,
pageSizeOpts: [10, 50, 100, 200],
limitNumber: 10,
currentPage: 1,
};
},
mounted() {
if (this.data.length > 0) {
this.cloneTableTata = deepCopy(this.data)
} else {
this.tableRefresh()
}
this.tableColumns = findComponentsDownward(this, 'ElTable')[0].store.states.columns;
},
watch: {
searchParams: {
handler: function (val, oldVal) {
//查询时重置页码
this.currentPage = 1
this.cloneTableTata = []
this.tableRefresh();
},
deep: true
},
dataUrl: {
handler: function (val, oldVal) {
//查询时重置页码
this.currentPage = 1
this.cloneTableTata = []
this.tableRefresh();
},
deep: true
},
data(val) {
this.cloneTableTata = deepCopy(val)
}
},
computed: {
spanParams() {
return computeColumnSpanParams(this.spanColumns, this.tableData);
},
tableData() {
let groupSum = this.groupSum;
return computeSumLime(this.cloneTableTata, groupSum.groupKeys, groupSum.labelColumns, groupSum.summaryMethod);
},
paginationParams() {
return {
offset: (this.currentPage - 1) * this.limitNumber,
limit: this.limitNumber
}
},
showAddMore() {
if (this.cloneTableTata.length > this.totalNumber)
return false
else
return true
},
elTablePlusButtonsStyle() {
let style = {}
if (this.showTableOption)
style.width = 'calc(100% - 90px)'
else
style.width = '100%'
return style
},
tableOptionDropdownStyle() {
let style = {}
if (this.showTableOption)
style.display = 'inline-block'
else
style.display = 'none'
return style
}
},
methods: {
toggle() {
this.showAll = !this.showAll
this.colIcon = this.showAll ? 'ios-arrow-up' : 'ios-arrow-down'
this.$nextTick(function () {
this.tableRefresh()
})
},
tableRefresh() {
let self = this;
if (self.dataUrl !== '') {
let requireTableTata = []
self.tableLoading = true;
util.ajax.get(self.dataUrl, {
params: Object.assign({}, self.paginationParams, self.sortParams, self.searchParams),
transformRequest: [self.transformRequest],
transformResponse: [self.transformResponse],
responseType: 'json'
}).then(function (resp) {
if (resp.data) {
//这里是为了做IE11兼容
if (!util.isJson(resp.data)) {
resp.data = JSON.parse(resp.data);
}
if (resp.data.code === 11000 || resp.data.code === "11000") {
requireTableTata = resp.data.data.rows;
self.totalNumber = resp.data.data.total;
self.$emit("on-data-load", resp.data);
} else if (resp.data.code === 0) {
alert("获取数据异常,请稍后重试");
} else {
requireTableTata = resp.data.rows;
self.totalNumber = resp.data.total;
}
if (self.extendType === 'loadmore') {
self.cloneTableTata = self.cloneTableTata.concat(requireTableTata)
} else {
self.cloneTableTata = requireTableTata
}
}
self.tableLoading = false;
});
}
this.optionDropdownVisible = false;
this.maxHeight = this.fixHead ? this.getMaxHeight() : this.height;
},
sortChange({column, prop, order}) {
if (this.data.length <= 0) {
this.sortParams = {
sort: prop,
order: order == null ? 'desc' : order === 'ascending' ? 'asc' : 'desc'
}
this.cloneTableTata = []
this.tableRefresh()
}
},
onPageChange(currentPageIndex) {
this.currentPage = currentPageIndex;
this.tableRefresh();
this.$emit("on-page-change", currentPageIndex)
},
onPageSizeChange(currentLimitNumber) {
this.currentPage = 1;
this.limitNumber = currentLimitNumber;
this.tableRefresh();
this.$emit("on-page-size-change", currentLimitNumber)
},
defaultComputeSpanMethod({row, column, rowIndex, columnIndex}) {
let params = this.spanParams;
return computeSpanMethod({row, column, rowIndex, columnIndex, params});
},
setSumLineClass({row, rowIndex}) {
if (this.rowClassName) {
return this.rowClassName;
} else {
if (row._sumLine) {
return 'sum-line-row'
}
}
},
changeColumns(data) {
this.$set(this.tableColumns, data)
this.cloneTableTata = []
this.tableRefresh()
// this.$set(this.tableColumns, this.tableColumns.splice(2,1))
},
addMore() {
this.tableRefresh()
}
},
render(h) {
const namespace = 'xtl-el-table';
const {caption, actionBar, search, searchBtn, buttons, ...otherSlots} = this.$slots;
return (
<div class={namespace}>
{
(caption || actionBar) &&
<div class={`${namespace}__header`}>
<h1 class={`${namespace}__header__caption`}>{caption}</h1>
<div class={`${namespace}__header__action-bar`}>{actionBar}</div>
</div>
}
<div class={`table-search`}>
{
this.collapseSearch ?
<div>
<div class={this.showAll ? '' : 'search-col'}>{search}</div>
<Form label-width={100}>
<FormItem>
<span onClick={this.toggle} slot={`label`} style={`cursor: pointer`}>
<Icon type={this.colIcon} size={16}/>
</span>
{searchBtn}
</FormItem>
</Form>
</div>
:
<div>{search}</div>
}
</div>
<div>
<div class={`${namespace}__buttons`} style={this.elTablePlusButtonsStyle}>{buttons}</div>
<div class={`table-option-dropdown`} style={this.tableOptionDropdownStyle}>
<dropdownNav data={this.tableData} columns={this.tableColumns} spanColumns={this.spanColumns}
tableName={this.tableName} dataUrl={this.dataUrl}
searchParams={Object.assign({}, this.sortParams, this.searchParams)}
on-change-columns={this.changeColumns}
show-summary={this.showSummary}
summary-method={this.summaryMethod}
></dropdownNav>
</div>
</div>
<el-table
data={this.tableData}
span-method={this.defaultComputeSpanMethod}
row-class-name={this.setSumLineClass}
border={this.border}
v-loading={this.tableLoading}
on-sort-change={this.sortChange}
useVirtual={this.extendType === 'all'}
show-summary={this.showSummary}
summary-method={this.summaryMethod}
{...{props: this.$attrs, on: this.$listeners}}
>
{
Object.entries(otherSlots).map(([key, val]) =>
<template slot={key}>{val}</template>
)
}
{
this.columns.map(column => {
const {formatter, renderBody} = column;
const data = {
props: {
...column,
formatter: formatter && (row => formatter(row[column.prop]))
}
};
if (renderBody) {
data.scopedSlots = {
default({row}) {
return renderBody(h, row);
}
};
}
return (
<el-table-column {...data}></el-table-column>
);
})
}
{
this.extendType === 'loadmore' ?
<div slot='append'>
<div v-show={this.data.length <= 0 && this.showAddMore}>
<div v-show={!this.tableLoading} class={`${namespace}__add__more`}
onClick={this.addMore}>
加载更多
</div>
</div>
</div> :
<div></div>
}
</el-table>
{
this.extendType === 'paging' ?
<Row style="margin-top:15px;">
<i-col span="24" style="text-align:right">
<Page
total={this.totalNumber}
current={this.currentPage}
page-size-opts={this.pageSizeOpts}
show-sizer
show-total
show-elevator
on-on-change={this.onPageChange}
on-on-page-size-change={this.onPageSizeChange}>
</Page>
</i-col>
</Row> :
<div></div>
}
</div>
);
}
};
|
import { Model, NeuralNetwork } from 'reimprovejs/dist/reimprove';
import { Random } from 'random-js';
import { AvailableAgentAction } from './AgentFactory';
const rng = new Random(Random.browserCrypto);
export const createNetwork = (maxAgents, maxFood) => {
const baseInputShape =
(2 * maxAgents) + // Inputs for each Agent's current postion (x,y)
(maxAgents) + // Inputs for each Agent's current action
(2 * maxAgents) + // Inputs for position (x,y) of each Agent's target
(maxAgents) + // Inputs for each Agent's speed
(2 * maxFood) + // Inputs for the position of each Food resource
6; // Inputs for the specific agent's self-identity (position/action/etc.)
const numActions = maxFood; // The network outputs a given food index the Agent to should go for
const finalInputShape = (2 * baseInputShape) + numActions;
const network = new NeuralNetwork();
network.InputShape = [ finalInputShape ];
network.addNeuralNetworkLayers([
{ type: 'dense', units: 32, activation: 'relu' },
{ type: 'dense', units: numActions, activation: 'softmax' }
]);
return network;
};
export const createModel = (network) => {
const modelFitConfig = {
epochs: 1,
stepsPerEpoch: 16
};
const model = Model.FromNetwork(network, modelFitConfig);
model.compile({ loss: 'meanSquaredError', optimizer: 'sgd' });
return model;
};
export const createTeacher = (academy) => {
const teacherConfig = {
lessonsQuantity: 10000,
lessonLength: 100,
lessonsWithRandom: 0,
epsilon: 1,
epsilonDecay: 0.995,
epsilonMin: 0.05,
gamma: 0.9,
};
const t = academy.addTeacher(teacherConfig);
//academy.OnLessonEnded(t, (tc, l) => {
//const tcObject = academy.teachers.get(tc);
//console.log(tc, 'state1', tcObject.State);
//console.log('OnLessonEnded', tc, l);
//});
//academy.OnLearningLessonEnded(t, (tc) => {
//const tcObject = academy.teachers.get(tc);
//console.log(tc, 'state2', tcObject.State);
//console.log('OnLearningLessonEnded', tc);
//});
//return academy.addTeacher(teacherConfig);
return t;
};
export const createNeuralAgent = (academy, network) => {
const agentConfig = {
model: createModel(network),
agentConfig: {
memorySize: 500,
batchSize: 32,
temporalWindow: 1
}
};
return academy.addAgent(agentConfig);
};
export const createNeuralAgentFromModel = (academy, model) => {
const modelFitConfig = {
epochs: 1,
stepsPerEpoch: 16
};
const newModel = new Model({
name: rng.uuid4(),
layers: [ ...model.layers ]
}, modelFitConfig);
newModel.compile({ loss: 'meanSquaredError', optimizer: 'sgd' });
newModel.model.setWeights(model.model.getWeights());
const agentConfig = {
model: newModel,
agentConfig: {
memorySize: 500,
batchSize: 128,
temporalWindow: 1
}
};
return academy.addAgent(agentConfig);
};
export const createNewAgentBrain = (academy, network) => {
const pTeacher = createTeacher(academy);
const agent = createNeuralAgent(academy, network);
academy.assignTeacherToAgent(agent, pTeacher);
return [ pTeacher, agent ];
};
export const createDerivedAgentBrain = (agentBrain, academy, network) => {
const [ , nAgent ] = agentBrain;
const oldAgent = academy.agents.get(nAgent);
const newAgent = createNeuralAgentFromModel(academy, oldAgent.model.model);
let pTeacher;
academy.teachers.forEach( (t, id) => {
if (pTeacher) return;
if (t.agents.size === 0) {
t.currentLessonLength = t.currentLessonLength < 25 ? 0 : t.currentLessonLength - 25;
pTeacher = id;
}
});
pTeacher = pTeacher || createTeacher(academy);
academy.assignTeacherToAgent(newAgent, pTeacher);
return [ pTeacher, newAgent ];
};
const mapAgentActionToInput = (action) => {
switch(action) {
case AvailableAgentAction.FIND_FOOD:
return 0;
case AvailableAgentAction.EAT_FOOD:
return 1;
case AvailableAgentAction.WAIT:
return 2;
case AvailableAgentAction.THINKING:
return 4;
case AvailableAgentAction.LAY_EGG:
return 5;
case AvailableAgentAction.FERTILIZE_EGG:
return 6;
default:
return -1;
}
};
export const worldStateToInputs = (world, config, agentId) => {
const MAX_AGENTS = config.world.maxAgents;
const MAX_FOOD = config.world.maxFood;
const agentPosList = [];
const agentActionList = [];
const agentActionTargetList = [];
const agentSpeedList = [];
const agentSelfIdentity = [];
for (let i = 0; i < MAX_AGENTS; i++) {
const foundAgent = world.agents[i];
if (foundAgent) {
agentPosList.push(foundAgent.position.x);
agentPosList.push(foundAgent.position.y);
agentActionList.push(mapAgentActionToInput(foundAgent.attemptedAction.type));
agentSpeedList.push(foundAgent.speed);
if (foundAgent.id === agentId) {
agentSelfIdentity.push(foundAgent.position.x);
agentSelfIdentity.push(foundAgent.position.y);
agentSelfIdentity.push(mapAgentActionToInput(foundAgent.attemptedAction.type));
agentSelfIdentity.push(foundAgent.speed);
}
if (foundAgent.attemptedAction.targetPosition) {
agentActionTargetList.push(foundAgent.attemptedAction.targetPosition.x);
agentActionTargetList.push(foundAgent.attemptedAction.targetPosition.y);
if (foundAgent.id === agentId) {
agentSelfIdentity.push(foundAgent.attemptedAction.targetPosition.x);
agentSelfIdentity.push(foundAgent.attemptedAction.targetPosition.y);
}
} else {
agentActionTargetList.push(null);
agentActionTargetList.push(null);
if (foundAgent.id === agentId) {
agentSelfIdentity.push(null);
agentSelfIdentity.push(null);
}
}
} else {
agentPosList.push(null);
agentPosList.push(null);
agentActionList.push(null);
agentActionTargetList.push(null);
agentActionTargetList.push(null);
agentSpeedList.push(null);
}
}
const foodPosList = [];
for (let i = 0; i < MAX_FOOD; i++) {
if (world.food[i]) {
foodPosList.push(world.food[i].position.x);
foodPosList.push(world.food[i].position.y);
} else {
foodPosList.push(null);
foodPosList.push(null);
}
}
return [
...agentSelfIdentity,
...agentPosList,
...agentActionList,
...agentActionTargetList,
...agentSpeedList,
...foodPosList,
];
};
|
import React from 'react';
import styled from 'styled-components';
import Card from '../Card';
const Section = styled.section`
display: flex;
flex-flow: row wrap;
`;
const CardContainer = styled.article`
flex: 1 1 30%;
padding: 1rem;
`;
const SearchResult = () => (
<Section>
<CardContainer><Card /></CardContainer>
<CardContainer><Card /></CardContainer>
<CardContainer><Card /></CardContainer>
<CardContainer><Card /></CardContainer>
<CardContainer><Card /></CardContainer>
<CardContainer><Card /></CardContainer>
<CardContainer><Card /></CardContainer>
</Section>
);
export default SearchResult;
|
const babelJest = require('babel-jest');
module.exports = babelJest.createTransformer({
presets: [
[
'@babel/preset-env',
{
targets: {
node: 6
}
}
],
[
'@babel/preset-react',
{
'pragma': 'xEngine.h'
}
]
]
});
|
import './Content.css';
import React, {Component} from "react";
import Wrapper from "../Wrapper";
import Aside from "../Aside";
import CommentContainer from "../CommentContainer";
import PostDetails from "../PostDetails";
import Post from "../Post";
export default class Content extends Component {
render() {
return (
<div className="content">
<Wrapper>
<div className="space-between">
<div className="col-lg-8">
<h1 className="my-4">
Page Heading
</h1>
<Post/>
<Post/>
<Post/>
<hr/>
<CommentContainer/>
</div>
<div className="col-md-4">
<Aside/>
</div>
</div>
</Wrapper>
</div>
)
}
}
|
import React from 'react';
import PropTypes from 'prop-types';
import { Col } from 'antd';
const Actions = ({ children, size }) => (
<Col span={size}>
{children}
</Col>
);
Actions.defaultProps = {
size: 24,
};
Actions.propTypes = {
children: PropTypes.node.isRequired,
size: PropTypes.number,
};
export default Actions;
|
let a = "alpha"
let b = "beta"
let c = "Gamma"
console.log(a,b,c)
let operacion = (1/2)*(4*5)-(2**3)
console.log(operacion)
let numero = 9
if (numero >10 ){
console.log(numero/2)
} else {
console.log(numero*2)
}
// console.log(num>10 ? num/2 : num *2) Esto es una ternaria.
let motor = 0
console.log(motor == 0 ? "El motor esta apagado" : motor == 100 ? "El motor está a máxima potencia" : "El motor está a potencia media " + motor)
// let motor = 100
// if (motor == 0 ){
// console.log("El motor esta apagado")
// } else if (motor == 100) {
// console.log("El motor está a máxima potencia")
// } else {
// console.log("El motor está a potencia media " + motor)
// }
let activo = false
let num = 2
if (activo ) {
if (num == 1) {
console.log("Hello world")
}else {
console.log("Hello world")
console.log("Hello world")
}
} else {
console.log("EL programa no esta activo")}
// Lo mismo de arriba, reducido un poco:
// if (activo) {
// if (num > 1) {
// console.log("Hello world")
// }console.log("Hello world")
// }
// } else {
// console.log("EL programa no esta activo")
// }
let activo2 = true
let num2 = 2
if (activo2 && num2 >= 1) {
console.log("Hello world")
if (activo2 == true && num2 == 2) {
console.log("Hello world")}
} else { console.log("EL programa no esta activo")}
// Bucles Recorre desde el uno hasta el 6
for(let i = 1; i<= 6; i = i + 1 ){
console.log(i)
}
// // Funcion. multiplicacion.
function multi (a, b, c){
return a*b*c
}
console.log(multi(897,3333,50))
// Funcion. cuenta atras.
function countdown (num){
for(let i = num; i >=0; i--) {
console.log(i)
}
}
countdown(5)
// 3
function comp (a, b){
return a > b ? a : b
}
comp (8, 10)
// Array 1. Funcion que recibe dos parámetros y define un array con ellos.
function parm (a,b) {
let parms = []
parms.push (a)
parms.push (b)
console.log(parms)
}
parm ("Hola",3)
// Array 2. Dar un número y crear un array que de desde el cero hasta ese numero.
function number(a) {
let numbers = []
for(let i = 0; i<= a; i = i + 1 ){
numbers.push (i)
}
console.log(numbers)
}
number (10)
// Array 3. Recice un array y debe devoler cada valor por separado.
let peliculas = ["El nombre de la rosa", "La vida es bella", "Volver"];
for (let i = 0; i < peliculas.length; i++) {
console.log(peliculas[i]);
}
function arr2(arr) {
for (let i = 0; i < arr.length; i++){
console.log(arr[i]);
}
}
arr2 (["hola", 2, 3, 4, "Adios"])
// reverse
// function reverse (str){
// let result = []
// for (i = str.length -1; i >=0; i--){
// result.push(str[i])
// }
// return result.join('')
// }
// console.log(reverse('abdc'))
// Otro modo
// function reverse(str){
// let result=''
// for(i = str.length -1: i >=0; i--){
// result += str[1]
// }
// return result
// }
// Array 4 Variable que recibe un array de numeros y devuelve la suma de los valores
function arrPrint(arr){
let resultado = 0
for(let i = 0; i<arr.length ; i++){
resultado = resultado + arr[i]
}
console.log(resultado)
}
arrPrint([5,2,3,189])
// Array 5. recibe un array de numeros y devuelve el valor mas pequeño.
function arrnumb(arr){
let menor = arr [0]
for(let i = 0; i <= arr.length ; i++){
if (arr [i] < menor){
menor = arr[i]
}
}
console.log(menor)
}
arrnumb([89,8,21,8923,341,41,7])
// Array 5*. recibe un array de numeros y devuelve el valor mas grande.
function arrnum(arr){
let mayor = arr[0]
for(i=0; i<arr.length; i++){
if (arr[i] > mayor){
mayor = arr[i]
}
}
console.log(mayor)
}
arrnum([89,8,21,893,341,41,7])
// Bucle for of. devuelve los elementos uno a uno
let letters = ["a", "b", "c", "d"]
for(let letter of letters){
console.log(letter)
}
//Ejemplo para ver como funciona. for of
function aaaa(buclenuevo){
for (let nuevo of buclenuevo){
console.log(nuevo)
}
}
aaaa(["aasd", "dab", "cdas", "dwd"])
//Ejemplo para ver como funciona. for of
function ttt(arguments) {
for (let argument of arguments) {
console.log(argument);
}
}
ttt([1, 2876, "adios"])
// Array 6. bucle for of recibir array de numeros y devolver el mas pequeño
function array6 (arr){
let minimo = Infinity;
for (let numero of arr){
if ( numero < minimo){
minimo = numero
}
}
console.log(minimo);
}
array6 ([29,131,52,634,23,8,832])
// * Ejercicio extra-Longest Word.
// * Función que devuelve la palabra mas larga. Si hay dos iguales, devuelve la primera
function getLongestWord (str){
let words = str.split('')
let longes = ""
for (let word of words){
if (word.length > getLongestWord.length) longest = word
}
return word
}
// Array sobre array. Nested array.
function sumaNested (arr){
let resultado = 0
for(let i = 0; i<arr.length ; i++){
let fila = arr [i]
for ( let i2=0; i2< fila.length; i2++){
resultado = resultado + fila[i2]
}
}
console.log(resultado)
}
sumaNested([[2, 2], [3, 4], [1, 1 ,1]])
// Array nested con for of
function sumaNestedForOf (arr){
let resultado = 0;
for (let numero of arr){
let fila = numero
for (let final of fila ){
resultado = resultado + final
}
}
console.log(resultado);
}
sumaNestedForOf([[2, 2], [3, 4], [1, 1 ,1], [8, 5]])
// Objetos
// Objetos I
// let obj1 = {
// "perro": {"nombre": "Ponchi", "raza":"A", "peso":20 },
// }
// console.log(obj1.perro.nombre)
// Objetos II
// let obj2 = {
// "perro": {"nombre": "Ponchi" , "raza": "A" },
// "peso": {"unidad": "kg" , "cantidad": "20" },
// }
// Objetos III
// let obj3 = {
// "objeto1": {"nombre": "A", "precio": ""},
// "objeto2": {"nombre": "B", "precio": ""},
// "objeto3": {"nombre": "C", "precio": ""},
// "objeto4": {"nombre": "D", "precio": ""},
// "objeto5": {"nombre": "E", "precio": ""},
// "objeto6": {"nombre": "F", "precio": ""},
// }
// Objetos IV. Recorre lista anterior y saca uno a uno.
// let obj4 = {
// "objeto1": {"nombre": "A", "precio": ""},
// "objeto2": {"nombre": "B", "precio": ""},
// "objeto3": {"nombre": "C", "precio": ""},
// "objeto4": {"nombre": "D", "precio": ""},
// "objeto5": {"nombre": "E", "precio": ""},
// "objeto6": {"nombre": "F", "precio": ""},
// }
// function compra (obj4){
// }
// console.log(datos.objetos)
// Objetos V
// let suma = 0
// for (let prod of lista){
// suma = suma + prod.precio
// }
// console.log(prod)
// Ejercicio extra-Piramide
// function pyramid(N){
// let len = N * 2 + 1
// let blocks = 1
// printLevel(blocks)
// for(let i = 1; i <= N; i = i + 2){
// blocks += 2
// printLevel(blocks)
// }
// function printLevel(blocks){
// let space = (len - blocks) /2
// let level = (' '.repeat(space)) + ('#'.repeat(blocks)) + (' '.repeat(space))
// console.log(level)
// }
// }
// Manipulacion String I
// function manip1 (str){
// let comprob = 0
// if(str.length > comprob)
// str.length = comprob
// console.log(comprob)
// }
// let prueba = "Hola"
// Teoria
// // O(1)
// function func(n){
// console.log('hola')
// }
// // O(n)
// function func(n){
// for(let el of n){
// console.log(el)
// }
// }
// // O(n2)
// function func(n){
// for(let el of n){
// console.log(el)
// }
// }
// // O(2n)
// fib(n);
// if n <= 1
// return 1
// function func(n){
// for(let el of n){
// }
// // }
// Fin teoria
// Performance
// Podemos URLSearchParams, console.time
// console.time('for')
// let sum = 0
// let store = 0
// for ( let i = 0; i < 10000; i++){
// if(i > 1){
// store++
// }else{
// console.log(i)
// }
// sum += i
// }
// console.timeEnd('for)
// Type coercion
console.log("Type:")
let StrCoercion = "3 20 6 1"
let arr = StrCoercion.split(" ")
console.log(arr)
let suma = 0
for (numCoercion of arr){
let x = parseInt(numCoercion)
suma = suma + arr
}
console.log(suma)
// Extra. Esta en slack
let str = 'abdsdadadadbasd'
let arr3 = str.split('')
let obj = {}
for (let char of arr3){
if (obj[char]){
obj[char] += 1
}else {
obj[char] = 1
}
}
let keys = Object.keys(obj)
let max = -Infinity
let letter = ''
for (let key of keys){
if(obj[key] > max){
max = obj[key]
letter = key
}
}
console.log(keys)
|
const SortedObjectCollection = require("./sorted_object_collection");
const equal = require("deep-equal");
class SortedStateSet extends SortedObjectCollection {
constructor() {
super();
}
add(obj) {
if (this.contains(obj)) {
return null;
}
super.add(obj);
return obj;
}
equals(obj1, obj2) {
const fieldNames = Object.keys(obj1);
for (let i = 0; i < fieldNames.length; i++) {
let value1 = obj1[fieldNames[i]];
let value2 = obj2[fieldNames[i]];
// Check deep-equal for value1 and value2
if (!equal(value1, value2)) {
// console.log(
// value1,
// "and",
// value2,
// "are not equal. fieldnames[" + i + "] = " + fieldNames[i]
// );
return false;
}
}
return true;
}
findPosIfExists(obj) {
if (this.elements.length === 0) {
return null;
}
const index = this.findPos(obj, 0, this.elements.length - 1);
if (index >= this.elements.length) {
return null;
}
if (this.equals(obj, this.elements[index])) {
return index;
}
return null;
}
delete(obj) {
const index = this.findPosIfExists(obj);
// console.log("Delete ", obj.uniqueState, ", index: ", index);
if (index != null) {
this.elements.splice(index, 1);
return true;
}
return false;
}
contains(obj) {
const pos = this.findPosIfExists(obj);
return pos != null;
}
}
module.exports = SortedStateSet;
|
import React, { useState, useEffect }from 'react';
import ReactDom from 'react-dom';
import styles from './index.scss';
const Counter = () => {
const [count, setCount] = useState(0);
useEffect(() => {
console.log('execute every state change.')
});
useEffect(() => {
console.log('execute after render.')
}, []);
useEffect(() => {
console.log(`count changed to ${count}.`)
return () => {
console.log(`count before change is ${count}.`)
}
}, [count]);
useEffect(() => {
return () => {
console.log('execute after removed.')
}
}, []);
return (
<>
<h1 className={styles.main}>{count}</h1>
<button type="button" onClick={() => {setCount(count + 1)}}>
add 1.
</button>
</>
);
}
const Main = () => {
const [hiddenCounter, setHiddenCounter] = useState(false);
return (
<>
<button type="button" onClick={() => setHiddenCounter(!hiddenCounter)}>
on/off counter
</button>
{
hiddenCounter ? null : <Counter />
}
</>
);
}
ReactDom.render(<Main />, document.getElementById('root'));
|
const createError = require('http-errors');
const { Superhero, Image, Superpower } = require('../models');
module.exports.createSuperhero = async (req, res, next) => {
try {
const { body } = req;
const heroPowers = findAll(body, ['superPower']);
const heroImages = findAll(body, ['imagePath']);
const heroPowersArray = heroPowers.map(stringSuperpowers => {
return { superPower: stringSuperpowers };
});
const heroImagesArray = heroImages.map(stringImg => {
return { imagePath: stringImg };
});
const createdSuperhero = await Superhero.create(body);
const superpowers = await Superpower.bulkCreate(heroPowersArray);
const images = await Image.bulkCreate(heroImagesArray);
await createdSuperhero.addSuperpower(superpowers);
await createdSuperhero.addImage(images);
if (!createdSuperhero) {
return next(createError(400));
}
res.status(201).send({ data: createdSuperhero });
} catch (err) {
next(err);
}
};
module.exports.getSuperHeroes = async (req, res, next) => {
try {
const { pagination } = req;
const heroes = await Superhero.findAll({
include: [
{ model: Superpower, attributes: { exclude: ['superheroId'] } },
{ model: Image, attributes: { exclude: ['superheroId'] } },
],
...pagination,
});
if (!heroes.length) {
return next(createError(404, 'Super Heroes not found'));
}
res.status(200).send({ data: heroes });
} catch (err) {
next(err);
}
};
module.exports.getSuperhero = async (req, res, next) => {
try {
const {
params: { id },
} = req;
const superHero = await Superhero.findAll({
where: { id },
include: [
{ model: Superpower, attributes: { exclude: ['superheroId'] } },
{ model: Image, attributes: { exclude: ['superheroId'] } },
],
});
if (!superHero) {
const err = createError(404, 'Super Hero not found');
return next(err);
}
res.send({ data: superHero });
} catch (err) {
next(err);
}
};
module.exports.updateSuperHero = async (req, res, next) => {
try {
const {
params: { id },
body,
} = req;
const [rowsCount, [updateSuperHero]] = await Superhero.update(body, {
where: { id },
include: [
{ model: Superpower, attributes: { exclude: ['superheroId'] } },
{ model: Image, attributes: { exclude: ['superheroId'] } },
],
returning: true,
});
if (rowsCount !== 1) {
return next(createError(400, 'Super Hero cant be updated'));
}
res.send({ data: updateSuperHero });
} catch (err) {
next(err);
}
};
module.exports.deleteSuperHero = async (req, res, next) => {
try {
const {
params: { id },
} = req;
const rowsCount = await Superhero.destroy({ where: { id } });
if (rowsCount !== 1) {
return next(createError(404, 'Super Hero not found'));
}
res.send({ data: rowsCount });
} catch (err) {
next(err);
}
};
|
import React, { useContext } from 'react';
import { StyleSheet, View, ScrollView } from 'react-native';
import { Button, Text, Avatar, ListItem, Icon } from 'react-native-elements';
import { LoginContext } from '../contexts/LoginContext';
import AsyncStorage from '@react-native-community/async-storage'
const storeData = async (key, value) => {
try {
await AsyncStorage.setItem(key,value);
} catch (err) {
console.log(err)
}
};
const clearAsyncStorage = async() => {
AsyncStorage.clear();
}
function ProfileScreen({ route, navigation }) {
const { data, resetData } = useContext(LoginContext)
return (
<ScrollView>
<View style={styles.mainContainer}>
<View style={styles.headerArea}>
<Avatar
rounded
source={{ uri: data.photoURL === '' ? "https://lh3.googleusercontent.com/TwHrwftk8BaWEV4swcWDtdcg1halIcT2U3EWkXYkDyYPXmufMLtn1DJG569HIIsd4ty4=s630-fcrop64=1,2202423de15ce329" : data.photoURL }}
size="large"
/>
<View>
<Text style={styles.usernameText}>{data.username}</Text>
<Text style={styles.subText}>Referral Code: {data.code}</Text>
</View>
</View>
<Text style={styles.menuHeader}>Profile Information</Text>
<ListItem bottomDivider>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>First Name</ListItem.Title>
</ListItem.Content>
<Text style={{ fontSize: 16, color: '#707070' }}>{data.firstName}</Text>
</ListItem>
<ListItem bottomDivider>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>Last Name</ListItem.Title>
</ListItem.Content>
<Text style={{ fontSize: 16, color: '#707070' }}>{data.lastName}</Text>
</ListItem>
<ListItem bottomDivider>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>Email Address</ListItem.Title>
</ListItem.Content>
<Text style={{ fontSize: 16, color: '#707070' }}>{data.email}</Text>
</ListItem>
<ListItem bottomDivider>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>Username</ListItem.Title>
</ListItem.Content>
<Text style={{ fontSize: 16, color: '#707070' }}>{data.username}</Text>
</ListItem>
<ListItem bottomDivider>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>Contact Number</ListItem.Title>
</ListItem.Content>
<Text style={{ fontSize: 16, color: '#707070' }}>{data.contact}</Text>
</ListItem>
<Text style={styles.menuHeader}>Account Management</Text>
<ListItem bottomDivider onPress={() => { navigation.navigate('RequestSupport', { id: data.id, token: data.token }) }}>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>Request Support</ListItem.Title>
</ListItem.Content>
<Icon
name="chevron-forward-outline"
type='ionicon'
color='#707070'
/>
</ListItem>
<ListItem bottomDivider onPress={() => { }}>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>Change Password</ListItem.Title>
</ListItem.Content>
<Icon
name="chevron-forward-outline"
type='ionicon'
color='#707070'
/>
</ListItem>
<ListItem bottomDivider onPress={() => { }}>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>Edit Personal Information</ListItem.Title>
</ListItem.Content>
<Icon
name="chevron-forward-outline"
type='ionicon'
color='#707070'
/>
</ListItem>
<ListItem bottomDivider onPress={() => {navigation.navigate('Scan') }}>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>Scan QR Code</ListItem.Title>
</ListItem.Content>
<Icon
name="chevron-forward-outline"
type='ionicon'
color='#707070'
/>
</ListItem>
{/* <ListItem bottomDivider onPress={() => { }}>
<ListItem.Content>
<ListItem.Title style={{ fontWeight: 'bold' }}>Payments</ListItem.Title>
</ListItem.Content>
<Icon
name="chevron-forward-outline"
type='ionicon'
color='#707070'
/>
</ListItem> */}
<Button
title='LOG OUT'
buttonStyle={styles.buttonStyle}
titleStyle={{ fontSize: 18 }}
onPress={() => {
resetData()
clearAsyncStorage()
storeData('loggedState', 'no')
navigation.navigate('Login')
}}
/>
</View>
</ScrollView>
);
}
const styles = StyleSheet.create({
image: {
flex: 1,
height: 200,
width: 200,
resizeMode: "cover",
justifyContent: "center",
marginLeft: 15
},
headerArea: {
height: 120,
alignItems: 'center',
// justifyContent: 'center',
flexDirection: 'row',
backgroundColor: '#2EC4B6',
color: '#fff',
paddingLeft: 25,
marginTop: 25
},
headerText: {
color: '#fff',
fontSize: 20,
fontWeight: 'bold',
marginTop: 30,
},
usernameText: {
color: 'white',
fontWeight: 'bold',
marginHorizontal: 15,
fontSize: 24
},
menuHeader: {
marginVertical: 20,
marginLeft: 15,
fontWeight: 'bold',
fontSize: 20
},
subText: {
color: 'white',
// fontWeight: 'bold',
fontSize: 16,
marginHorizontal: 15,
marginBottom: 5
},
buttonStyle: {
width: 330,
marginVertical: 20,
backgroundColor: '#DC143C',
marginLeft: 40
}
})
export default ProfileScreen
|
'use strict';
/**
* Module dependencies.
*/
const only = require('only');
const { wrap: async } = require('co');
const { respond, respondOrRedirect } = require('../utils');
const { getBranchConditions } = require('../utils/helper');
exports.configure = function (schema, controller) {
return {
findOne: async(function* (req, res, next, _id) {
const conditions = { _id };
try {
req.model = yield schema.load({ conditions });
if (!req.model) return next(new Error('Record not found'));
} catch (err) {
return next(err);
}
next();
}),
index: async(function* (req, res) {
var datatables = []
var datatable = schema.createDatatable();
datatables.push(datatable);
res.render(controller + '/index', {
datatables: datatables,
crud: {
create: "/" + controller + "/edit/",
update: "/" + controller + "/edit/",
delete: "/" + controller + "/delete/",
read: "/" + controller + "/edit/",
}
});
}),
datatable: async(function* (req, res, next) {
var options=yield getBranchConditions(req.user,req.currentRight);
schema.dataTable(req.query,options, function (err, data) { return res.send(data); });
}),
all: async(function* (req, res) {
var options=yield getBranchConditions(req.user,req.currentRight);
var all = yield schema.list(options);
res.send({ value: all });
}),
edit: async(function* (req, res) {
var model = schema.new();
if (req.params._id) {
model = req.model;
}
res.render(controller + '/edit', {
model: model,
controller: controller
});
}),
post: async(function* (req, res) {
const model = schema.new(req.body);
//model.user = req.user;
//console.log(model)
try {
yield model.saveChanges();
respondOrRedirect({ req, res }, `/${controller}/edit/${model._id}`, {
model: model,
controller: controller
}, {
type: 'success',
text: 'Successfully created model!'
});
} catch (err) {
respond(res, `${controller}/edit`, {
title: 'New ',
errors: [err.toString()],
model,
controller
}, 422);
}
}),
put: async(function* (req, res) {
const model = req.model;
//console.log(req.body)
Object.assign(model, only(req.body, model.assign()));
try {
yield model.saveChanges();
respondOrRedirect({ req, res }, `/${controller}/edit/${model._id}`, {
model: model,
controller: controller
}, {
type: 'success',
text: 'Successfully updated model!'
});
} catch (err) {
respond(res, `${controller}/edit`, {
title: 'Edit ',
errors: [err.toString()],
model,
controller
}, 422);
}
}),
delete: async(function* (req, res) {
yield req.model.remove();
res.send({
type: 'info',
text: 'Deleted successfully'
});
})
}
}
|
import React from 'react';
import {BrowserRouter as Router, Switch, Route} from 'react-router-dom';
import { createTheme, ThemeProvider } from '@material-ui/core/styles';
import Header from './components/Header';
// Main Page
import HomePage from './components/mainPage/HomePage';
// Theme
const theme = createTheme({
palette: {
primary: {
main: "#2c2c2c",
},
secondary: {
main: "#383838",
},
},
});
// Styles
const styles = {
site: {
display: "flex",
flexDirection: "column",
width: "100%",
height: "100vh"
},
page: {
display: "flex",
justifyContent: "center",
alignItems: "center",
flexDirection: "column",
backgroundColor: "#2c2c2c",
height: "100%",
//textAlign: "center"
}
}
class App extends React.Component {
render() {
return(
<Router>
<React.Fragment>
<ThemeProvider theme={theme}>
<div style={styles.site}>
<Header/>
<div style={styles.page}>
<HomePage/>
</div>
</div>
</ThemeProvider>
</React.Fragment>
</Router>
);
}
}
export default App;
|
import ViewerConfig from "@/helpers/ViewerConfig";
import ViewerServiceKerken from "./service/ViewerServiceKerken";
import ViewerServiceKerkenBAG from "./service/ViewerServiceKerkenBAG";
import ViewerWMS from "../service/ViewerWMS";
class KerkConfig extends ViewerConfig {
constructor() {
super();
this.kerk = {
filter: {},
filterchanged: true,
info_url: 'https://geoplaza.vu.nl/projects/kerken_vue/resources/getKerkInfo.php',
typeahead_url: 'https://geoplaza.vu.nl/projects/kerken_vue/resources/getTypeaheadData.php',
filterstate_url: 'https://geoplaza.vu.nl/projects/kerken_vue/resources/getFilterState.php',
selected_id: '',
legend_style: 'denominatie',
pand_id: [],
id: '',
data: {
year: 0,
geojson: {},
geojsoncluster: {}
}
}
}
getService(service_config) {
console.log(service_config);
super.getService(service_config);
if (service_config.type === 'wms') return new ViewerWMS(service_config);
if (service_config.type === 'kerken') return new ViewerServiceKerken(service_config);
if (service_config.type === 'kerken_bag') return new ViewerServiceKerkenBAG(service_config);
}
}
export default KerkConfig;
|
import axios from 'axios'
const api = axios.create({
baseURL: 'http://localhost:3000/api',
})
export const insertComment = payload => api.post(`/comment`, payload)
export const getAllComments = () => api.get(`/comments`)
const apis = {
insertComment,
getAllComments,
}
export default apis
|
/**
* @Summary: short description for the file
* @Date: 2020/6/18 1:33 PM
* @Author: Youth
*/
const area_pool = [
{
pool_channel: 'topn_taiwan_pool',
channel: '台湾地方站',
channel_name: 'news_news_antip',
topn: 'pneumonia_topn_taiwan_pool',
topn_name: '肺炎池_台湾地方站',
type: '地方站',
name: 'taiwan',
area: '台湾'
},
{
pool_channel: 'topn_macau_pool',
channel: '澳门地方站',
channel_name: 'news_news_antip',
topn: 'pneumonia_topn_macau_pool',
topn_name: '肺炎池_澳门地方站',
type: '地方站',
name: 'macau',
area: '澳门'
},
{
pool_channel: 'topn_hk_pool',
channel: '香港地方站',
channel_name: 'news_news_antip',
topn: 'pneumonia_topn_hk_pool',
topn_name: '肺炎池_香港地方站',
type: '地方站',
name: 'hk',
area: '香港'
},
{
pool_channel: 'cq_pool',
channel: '重庆地方站',
channel_name: 'news_news_cq',
topn: 'pneumonia_cq_pool',
topn_name: '肺炎池_重庆地方站',
type: '地方站',
name: 'cq',
area: '重庆'
},
{
pool_channel: 'zj_pool',
channel: '浙江地方站',
channel_name: 'news_news_zj',
topn: 'pneumonia_zj_pool',
topn_name: '肺炎池_浙江地方站',
type: '地方站',
name: 'zj',
area: '浙江'
},
{
pool_channel: 'yn_pool',
channel: '云南地方站',
channel_name: 'news_news_yn',
topn: 'pneumonia_yn_pool',
topn_name: '肺炎池_云南地方站',
type: '地方站',
name: 'yn',
area: '云南'
},
{
pool_channel: 'xinjiang_pool',
channel: '新疆地方站',
channel_name: 'news_news_xinjiang',
topn: 'pneumonia_xinjiang_pool',
topn_name: '肺炎池_新疆地方站',
type: '地方站',
name: 'xinjiang',
area: '新疆'
},
{
pool_channel: 'xizang_pool',
channel: '西藏地方站',
channel_name: 'news_news_xizang',
topn: 'pneumonia_xizang_pool',
topn_name: '肺炎池_西藏地方站',
type: '地方站',
name: 'xizang',
area: '西藏'
},
{
pool_channel: 'tj_pool',
channel: '天津分站',
channel_name: 'news_news_tj',
topn: 'pneumonia_tj_pool',
topn_name: '肺炎池_天津分站',
type: '地方站',
name: 'tj',
area: '天津'
},
{
pool_channel: 'cd_pool',
channel: '四川地方站',
channel_name: 'news_news_cd',
topn: 'pneumonia_cd_pool',
topn_name: '肺炎池_四川地方站',
type: '地方站',
name: 'cd',
area: '四川'
},
{
pool_channel: 'xian_pool',
channel: '陕西地方站',
channel_name: 'news_news_xian',
topn: 'pneumonia_xian_pool',
topn_name: '肺炎池_陕西地方站',
type: '地方站',
name: 'xian',
area: '陕西'
},
{
pool_channel: 'shanxi_pool',
channel: '山西地方站',
channel_name: 'news_news_shanxi',
topn: 'pneumonia_shanxi_pool',
topn_name: '肺炎池_山西地方站',
type: '地方站',
name: 'shanxi',
area: '山西'
},
{
pool_channel: 'qinghai_pool',
channel: '青海地方站',
channel_name: 'news_news_qinghai',
topn: 'pneumonia_qinghai_pool',
topn_name: '肺炎池_青海地方站',
type: '地方站',
name: 'qinghai',
area: '青海'
},
{
pool_channel: 'ningxia_pool',
channel: '宁夏地方站',
channel_name: 'news_news_ningxia',
topn: 'pneumonia_ningxia_pool',
topn_name: '肺炎池_宁夏地方站',
type: '地方站',
name: 'ningxia',
area: '宁夏'
},
{
pool_channel: 'neimenggu_pool',
channel: '内蒙古地方站',
channel_name: 'news_news_neimenggu',
topn: 'pneumonia_neimenggu_pool',
topn_name: '肺炎池_内蒙古地方站',
type: '地方站',
name: 'neimenggu',
area: '内蒙古'
},
{
pool_channel: 'ln_pool',
channel: '辽宁地方站',
channel_name: 'news_news_ln',
topn: 'pneumonia_ln_pool',
topn_name: '肺炎池_辽宁地方站',
type: '地方站',
name: 'ln',
area: '辽宁'
},
{
pool_channel: 'jiangxi_pool',
channel: '江西地方站',
channel_name: 'news_news_jiangxi',
topn: 'pneumonia_jiangxi_pool',
topn_name: '肺炎池_江西地方站',
type: '地方站',
name: 'jiangxi',
area: '江西'
},
{
pool_channel: 'jiangsu_pool',
channel: '江苏地方站',
channel_name: 'news_news_js',
topn: 'pneumonia_jiangsu_pool',
topn_name: '肺炎池_江苏地方站',
type: '地方站',
name: 'jiangsu',
area: '江苏'
},
{
pool_channel: 'jilin_pool',
channel: '吉林省地方站',
channel_name: 'news_news_jilin',
topn: 'pneumonia_jilin_pool',
topn_name: '肺炎池_吉林省地方站',
type: '地方站',
name: 'jilin',
area: '吉林'
},
{
pool_channel: 'hn_pool',
channel: '湖南地方站',
channel_name: 'news_news_hn',
topn: 'pneumonia_hn_pool',
topn_name: '肺炎池_湖南地方站',
type: '地方站',
name: 'hn',
area: '湖南'
},
{
pool_channel: 'heilongjiang_pool',
channel: '黑龙江地方站',
channel_name: 'news_news_heilongjiang',
topn: 'pneumonia_heilongjiang_pool',
topn_name: '肺炎池_黑龙江地方站',
type: '地方站',
name: 'heilongjiang',
area: '黑龙江'
},
{
pool_channel: 'henan_pool',
channel: '河南地方站',
channel_name: 'news_news_henan',
topn: 'pneumonia_henan_pool',
topn_name: '肺炎池_河南地方站',
type: '地方站',
name: 'henan',
area: '河南'
},
{
pool_channel: 'hebei_pool',
channel: '河北分站',
channel_name: 'news_news_heb',
topn: 'pneumonia_hebei_pool',
topn_name: '肺炎池_河北分站',
type: '地方站',
name: 'hebei',
area: '河北'
},
{
pool_channel: 'hainan_pool',
channel: '海南地方站',
channel_name: 'news_nwes_hainan',
topn: 'pneumonia_hainan_pool',
topn_name: '肺炎池_海南地方站',
type: '地方站',
name: 'hainan',
area: '海南'
},
{
pool_channel: 'guizhou_pool',
channel: '贵州地方站',
channel_name: 'news_news_guizhou',
topn: 'pneumonia_guizhou_pool',
topn_name: '肺炎池_贵州地方站',
type: '地方站',
name: 'guizhou',
area: '贵州'
},
{
pool_channel: 'guangxi_pool',
channel: '广西地方站',
channel_name: 'news_news_guangxi',
topn: 'pneumonia_guangxi_pool',
topn_name: '肺炎池_广西地方站',
type: '地方站',
name: 'guangxi',
area: '广西'
},
{
pool_channel: 'gd_pool',
channel: '广东地方站',
channel_name: 'news_news_gd',
topn: 'pneumonia_gd_pool',
topn_name: '肺炎池_广东地方站',
type: '地方站',
name: 'gd',
area: '广东'
},
{
pool_channel: 'gansu_pool',
channel: '甘肃地方站',
channel_name: 'news_news_gansu',
topn: 'pneumonia_gansu_pool',
topn_name: '肺炎池_甘肃地方站',
type: '地方站',
name: 'gansu',
area: '甘肃'
},
{
pool_channel: 'fj_pool',
channel: '福建地方站',
channel_name: 'news_news_fj',
topn: 'pneumonia_fj_pool',
topn_name: '肺炎池_福建地方站',
type: '地方站',
name: 'fj',
area: '福建'
},
{
pool_channel: 'ah_pool',
channel: '安徽地方站',
channel_name: 'news_news_anhui',
topn: 'pneumonia_ah_pool',
topn_name: '肺炎池_安徽地方站',
type: '地方站',
name: 'ah',
area: '安徽'
},
{
pool_channel: 'sh_pool',
channel: '上海地方站',
channel_name: 'news_news_sh',
topn: 'pneumonia_sh_pool',
topn_name: '肺炎池_上海地方站',
type: '地方站',
name: 'sh',
area: '上海'
},
{
pool_channel: 'bj_pool',
channel: '北京分站',
channel_name: 'news_news_bj',
topn: 'pneumonia_bj_pool',
topn_name: '肺炎池_北京分站',
type: '地方站',
name: 'bj',
area: '北京'
},
{
pool_channel: 'hb_pool',
channel: '湖北地方站',
channel_name: 'news_news_hb',
topn: 'pneumonia_hb_pool',
topn_name: '肺炎池_湖北地方站',
type: '地方站',
name: 'hb',
area: '湖北'
},
{
pool_channel: 'sd_pool',
channel: '山东地方站',
channel_name: 'news_news_sd',
topn: 'pneumonia_sd_pool',
topn_name: '肺炎池_山东地方站',
type: '地方站',
name: 'sd',
area: '山东'
}
];
const local_chllist = [
{
chlid: 'news_news_cq',
chlname: '重庆',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '重庆',
adcode: 500000,
channelType: 'local'
},
{
chlid: 'news_news_gd',
chlname: '广东',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '广东',
adcode: 440000,
channelType: 'local'
},
{
chlid: 'news_news_gz',
chlname: '广州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 440100,
channelType: 'local'
},
{
chlid: 'news_news_sz',
chlname: '深圳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 440300,
channelType: 'local'
},
{
chlid: 'news_news_shantou',
chlname: '汕头',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 440500,
channelType: 'local'
},
{
chlid: 'news_news_dg',
chlname: '东莞',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 441900,
channelType: 'local'
},
{
chlid: 'news_news_foshan',
chlname: '佛山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 440600,
channelType: 'local'
},
{
chlid: 'news_news_jm',
chlname: '江门',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 440700,
channelType: 'local'
},
{
chlid: 'news_news_zhanjiang',
chlname: '湛江',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 440800,
channelType: 'local'
},
{
chlid: 'news_news_huizhou',
chlname: '惠州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 441300,
channelType: 'local'
},
{
chlid: 'news_news_zhongshan',
chlname: '中山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 442000,
channelType: 'local'
},
{
chlid: 'news_news_jieyang',
chlname: '揭阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 445200,
channelType: 'local'
},
{
chlid: 'news_news_gdzh',
chlname: '珠海',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 440400,
channelType: 'local'
},
{
chlid: 'news_news_gdsg',
chlname: '韶关',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 440200,
channelType: 'local'
},
{
chlid: 'news_news_gdmm',
chlname: '茂名',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 440900,
channelType: 'local'
},
{
chlid: 'news_news_gdzq',
chlname: '肇庆',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 441200,
channelType: 'local'
},
{
chlid: 'news_news_gdmz',
chlname: '梅州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 441400,
channelType: 'local'
},
{
chlid: 'news_news_gdsw',
chlname: '汕尾',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 441500,
channelType: 'local'
},
{
chlid: 'news_news_gdhy',
chlname: '河源',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 441600,
channelType: 'local'
},
{
chlid: 'news_news_gdyj',
chlname: '阳江',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 441700,
channelType: 'local'
},
{
chlid: 'news_news_gdqy',
chlname: '清远',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 441800,
channelType: 'local'
},
{
chlid: 'news_news_gdcz',
chlname: '潮州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 445100,
channelType: 'local'
},
{
chlid: 'news_news_gdyf',
chlname: '云浮',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广东',
adcode: 445300,
channelType: 'local'
},
{
chlid: 'news_news_cd',
chlname: '四川',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '四川',
adcode: 510000,
channelType: 'local'
},
{
chlid: 'news_news_chengdu',
chlname: '成都',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 510100,
channelType: 'local'
},
{
chlid: 'news_news_mianyang',
chlname: '绵阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 510700,
channelType: 'local'
},
{
chlid: 'news_news_sczg',
chlname: '自贡',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 510300,
channelType: 'local'
},
{
chlid: 'news_news_scpzh',
chlname: '攀枝花',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 510400,
channelType: 'local'
},
{
chlid: 'news_news_sclz',
chlname: '泸州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 510500,
channelType: 'local'
},
{
chlid: 'news_news_scdy',
chlname: '德阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 510600,
channelType: 'local'
},
{
chlid: 'news_news_scgy',
chlname: '广元',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 510800,
channelType: 'local'
},
{
chlid: 'news_news_scsn',
chlname: '遂宁',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 510900,
channelType: 'local'
},
{
chlid: 'news_news_scnj',
chlname: '内江',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 511000,
channelType: 'local'
},
{
chlid: 'news_news_scls',
chlname: '乐山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 511100,
channelType: 'local'
},
{
chlid: 'news_news_scnc',
chlname: '南充',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 511300,
channelType: 'local'
},
{
chlid: 'news_news_scms',
chlname: '眉山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 511400,
channelType: 'local'
},
{
chlid: 'news_news_scyb',
chlname: '宜宾',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 511500,
channelType: 'local'
},
{
chlid: 'news_news_scga',
chlname: '广安',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 511600,
channelType: 'local'
},
{
chlid: 'news_news_scdz',
chlname: '达州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 511700,
channelType: 'local'
},
{
chlid: 'news_news_scya',
chlname: '雅安',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 511800,
channelType: 'local'
},
{
chlid: 'news_news_scbz',
chlname: '巴中',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 511900,
channelType: 'local'
},
{
chlid: 'news_news_sczy',
chlname: '资阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 512000,
channelType: 'local'
},
{
chlid: 'news_news_scab',
chlname: '阿坝州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 513200,
channelType: 'local'
},
{
chlid: 'news_news_scgz',
chlname: '甘孜州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 513300,
channelType: 'local'
},
{
chlid: 'news_news_sclsz',
chlname: '凉山州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '四川',
adcode: 513400,
channelType: 'local'
},
{
chlid: 'news_news_sh',
chlname: '上海',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '上海',
adcode: 310000,
channelType: 'local'
},
{
chlid: 'news_news_xian',
chlname: '陕西',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '陕西',
adcode: 610000,
channelType: 'local'
},
{
chlid: 'news_news_shan3xi',
chlname: '西安',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 610100,
channelType: 'local'
},
{
chlid: 'news_news_yulin',
chlname: '榆林',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 610800,
channelType: 'local'
},
{
chlid: 'news_news_xianyang',
chlname: '咸阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 610400,
channelType: 'local'
},
{
chlid: 'news_news_sxtc',
chlname: '铜川',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 610200,
channelType: 'local'
},
{
chlid: 'news_news_sxbj',
chlname: '宝鸡',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 610300,
channelType: 'local'
},
{
chlid: 'news_news_sxwn',
chlname: '渭南',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 610500,
channelType: 'local'
},
{
chlid: 'news_news_sxya',
chlname: '延安',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 610600,
channelType: 'local'
},
{
chlid: 'news_news_sxhz',
chlname: '汉中',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 610700,
channelType: 'local'
},
{
chlid: 'news_news_sxak',
chlname: '安康',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 610900,
channelType: 'local'
},
{
chlid: 'news_news_sxal',
chlname: '商洛',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '陕西',
adcode: 611000,
channelType: 'local'
},
{
chlid: 'news_news_zj',
chlname: '浙江',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '浙江',
adcode: 330000,
channelType: 'local'
},
{
chlid: 'news_news_hz',
chlname: '杭州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 330100,
channelType: 'local'
},
{
chlid: 'news_news_wz',
chlname: '温州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 330300,
channelType: 'local'
},
{
chlid: 'news_news_nb',
chlname: '宁波',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 330200,
channelType: 'local'
},
{
chlid: 'news_news_zjjh',
chlname: '金华',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 330700,
channelType: 'local'
},
{
chlid: 'news_news_zjhz',
chlname: '湖州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 330500,
channelType: 'local'
},
{
chlid: 'news_news_zjsx',
chlname: '绍兴',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 330600,
channelType: 'local'
},
{
chlid: 'news_news_zjjx',
chlname: '嘉兴',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 330400,
channelType: 'local'
},
{
chlid: 'news_news_zjzhs',
chlname: '舟山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 330900,
channelType: 'local'
},
{
chlid: 'news_news_zjqz',
chlname: '衢州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 330800,
channelType: 'local'
},
{
chlid: 'news_news_zjtz',
chlname: '台州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 331000,
channelType: 'local'
},
{
chlid: 'news_news_lishui',
chlname: '丽水',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '浙江',
adcode: 331100,
channelType: 'local'
},
{
chlid: 'news_news_hb',
chlname: '湖北',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '湖北',
adcode: 420000,
channelType: 'local'
},
{
chlid: 'news_news_wuhan',
chlname: '武汉',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 420100,
channelType: 'local'
},
{
chlid: 'news_news_hubes',
chlname: '恩施',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 422800,
channelType: 'local'
},
{
chlid: 'news_news_yichang',
chlname: '宜昌',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 420500,
channelType: 'local'
},
{
chlid: 'news_news_xiangyang',
chlname: '襄阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 420600,
channelType: 'local'
},
{
chlid: 'news_news_xiaogan',
chlname: '孝感',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 420900,
channelType: 'local'
},
{
chlid: 'news_news_jingzhou',
chlname: '荆州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 421000,
channelType: 'local'
},
{
chlid: 'news_news_xianning',
chlname: '咸宁',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 421200,
channelType: 'local'
},
{
chlid: 'news_news_hubhs',
chlname: '黄石',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 420200,
channelType: 'local'
},
{
chlid: 'news_news_hubsy',
chlname: '十堰',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 420300,
channelType: 'local'
},
{
chlid: 'news_news_hubez',
chlname: '鄂州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 420700,
channelType: 'local'
},
{
chlid: 'news_news_hubjm',
chlname: '荆门',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 420800,
channelType: 'local'
},
{
chlid: 'news_news_hubhg',
chlname: '黄冈',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 421100,
channelType: 'local'
},
{
chlid: 'news_news_hubsz',
chlname: '随州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 421300,
channelType: 'local'
},
{
chlid: 'news_news_hubxt',
chlname: '仙桃',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 429004,
channelType: 'local'
},
{
chlid: 'news_news_hubqj',
chlname: '潜江',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 429005,
channelType: 'local'
},
{
chlid: 'news_news_hubtm',
chlname: '天门',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 429006,
channelType: 'local'
},
{
chlid: 'news_news_hubsnj',
chlname: '神农架',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖北',
adcode: 429021,
channelType: 'local'
},
{
chlid: 'news_news_henan',
chlname: '河南',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '河南',
adcode: 410000,
channelType: 'local'
},
{
chlid: 'news_news_zhengzhou',
chlname: '郑州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 410100,
channelType: 'local'
},
{
chlid: 'news_news_luoyang',
chlname: '洛阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 410300,
channelType: 'local'
},
{
chlid: 'news_news_anyang',
chlname: '安阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 410500,
channelType: 'local'
},
{
chlid: 'news_news_nanyang',
chlname: '南阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 411300,
channelType: 'local'
},
{
chlid: 'news_news_shangqiu',
chlname: '商丘',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 411400,
channelType: 'local'
},
{
chlid: 'news_news_xinyang',
chlname: '信阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 411500,
channelType: 'local'
},
{
chlid: 'news_news_zhoukou',
chlname: '周口',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 411600,
channelType: 'local'
},
{
chlid: 'news_news_lochnkf',
chlname: '开封',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 410200,
channelType: 'local'
},
{
chlid: 'news_news_hnpds',
chlname: '平顶山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 410400,
channelType: 'local'
},
{
chlid: 'news_news_hnjz',
chlname: '焦作',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 410800,
channelType: 'local'
},
{
chlid: 'news_news_hnhb',
chlname: '鹤壁',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 410600,
channelType: 'local'
},
{
chlid: 'news_news_hnxx',
chlname: '新乡',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 410700,
channelType: 'local'
},
{
chlid: 'news_news_hnpy',
chlname: '濮阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 410900,
channelType: 'local'
},
{
chlid: 'news_news_hnxc',
chlname: '许昌',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 411000,
channelType: 'local'
},
{
chlid: 'news_news_hnlh',
chlname: '漯河',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 411100,
channelType: 'local'
},
{
chlid: 'news_news_hnsmx',
chlname: '三门峡',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 411200,
channelType: 'local'
},
{
chlid: 'news_news_hnzmd',
chlname: '驻马店',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 411700,
channelType: 'local'
},
{
chlid: 'news_news_hnjy',
chlname: '济源',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河南',
adcode: 419001,
channelType: 'local'
},
{
chlid: 'news_news_hn',
chlname: '湖南',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '湖南',
adcode: 430000,
channelType: 'local'
},
{
chlid: 'news_news_changsha',
chlname: '长沙',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 430100,
channelType: 'local'
},
{
chlid: 'news_news_xiangtan',
chlname: '湘潭',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 430300,
channelType: 'local'
},
{
chlid: 'news_news_hengyang',
chlname: '衡阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 430400,
channelType: 'local'
},
{
chlid: 'news_news_yueyang',
chlname: '岳阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 430600,
channelType: 'local'
},
{
chlid: 'news_news_changde',
chlname: '常德',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 430700,
channelType: 'local'
},
{
chlid: 'news_news_chenzhou',
chlname: '郴州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 431000,
channelType: 'local'
},
{
chlid: 'news_news_huaihua',
chlname: '怀化',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 431200,
channelType: 'local'
},
{
chlid: 'news_news_shaoyang',
chlname: '邵阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 430500,
channelType: 'local'
},
{
chlid: 'news_news_ld',
chlname: '娄底',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 431300,
channelType: 'local'
},
{
chlid: 'news_news_hunzz',
chlname: '株洲',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 430200,
channelType: 'local'
},
{
chlid: 'news_news_news_hunzjj',
chlname: '张家界',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 430800,
channelType: 'local'
},
{
chlid: 'news_news_hunyy',
chlname: '益阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 430900,
channelType: 'local'
},
{
chlid: 'news_news_hunyz',
chlname: '永州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 431100,
channelType: 'local'
},
{
chlid: 'news_news_hunxx',
chlname: '湘西',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '湖南',
adcode: 433100,
channelType: 'local'
},
{
chlid: 'news_news_fj',
chlname: '福建',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '福建',
adcode: 350000,
channelType: 'local'
},
{
chlid: 'news_news_fuzhou',
chlname: '福州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '福建',
adcode: 350100,
channelType: 'local'
},
{
chlid: 'news_news_quanzhou',
chlname: '泉州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '福建',
adcode: 350500,
channelType: 'local'
},
{
chlid: 'news_news_fjxm',
chlname: '厦门',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '福建',
adcode: 350200,
channelType: 'local'
},
{
chlid: 'news_news_fjpt',
chlname: '莆田',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '福建',
adcode: 350300,
channelType: 'local'
},
{
chlid: 'news_news_fjsm',
chlname: '三明',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '福建',
adcode: 350400,
channelType: 'local'
},
{
chlid: 'news_news_fjzz',
chlname: '漳州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '福建',
adcode: 350600,
channelType: 'local'
},
{
chlid: 'news_news_fjnp',
chlname: '南平',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '福建',
adcode: 350700,
channelType: 'local'
},
{
chlid: 'news_news_fhly',
chlname: '龙岩',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '福建',
adcode: 350800,
channelType: 'local'
},
{
chlid: 'news_news_fjnd',
chlname: '宁德',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '福建',
adcode: 350900,
channelType: 'local'
},
{
chlid: 'news_news_js',
chlname: '江苏',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '江苏',
adcode: 320000,
channelType: 'local'
},
{
chlid: 'news_news_nj',
chlname: '南京',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 320100,
channelType: 'local'
},
{
chlid: 'news_news_jswx',
chlname: '无锡',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 320200,
channelType: 'local'
},
{
chlid: 'news_news_xuzhou',
chlname: '徐州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 320300,
channelType: 'local'
},
{
chlid: 'news_news_changzhou',
chlname: '常州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 320400,
channelType: 'local'
},
{
chlid: 'news_news_suz',
chlname: '苏州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 320500,
channelType: 'local'
},
{
chlid: 'news_news_nantong',
chlname: '南通',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 320600,
channelType: 'local'
},
{
chlid: 'news_news_jslyg',
chlname: '连云港',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 320700,
channelType: 'local'
},
{
chlid: 'news_news_jsha',
chlname: '淮安',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 320800,
channelType: 'local'
},
{
chlid: 'news_news_jsyc',
chlname: '盐城',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 320900,
channelType: 'local'
},
{
chlid: 'news_news_jsyz',
chlname: '扬州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 321000,
channelType: 'local'
},
{
chlid: 'news_news_jszj',
chlname: '镇江',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 321100,
channelType: 'local'
},
{
chlid: 'news_news_jstz',
chlname: '泰州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 321200,
channelType: 'local'
},
{
chlid: 'news_news_jssq',
chlname: '宿迁',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江苏',
adcode: 321300,
channelType: 'local'
},
{
chlid: 'news_news_ln',
chlname: '辽宁',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '辽宁',
adcode: 210000,
channelType: 'local'
},
{
chlid: 'news_news_lndl',
chlname: '大连',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 210200,
channelType: 'local'
},
{
chlid: 'news_news_shenyang',
chlname: '沈阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 210100,
channelType: 'local'
},
{
chlid: 'news_news_anshan',
chlname: '鞍山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 210300,
channelType: 'local'
},
{
chlid: 'news_news_fushun',
chlname: '抚顺',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 210400,
channelType: 'local'
},
{
chlid: 'news_news_dandong',
chlname: '丹东',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 210600,
channelType: 'local'
},
{
chlid: 'news_news_jinzhou',
chlname: '锦州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 210700,
channelType: 'local'
},
{
chlid: 'news_news_yingkou',
chlname: '营口',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 210800,
channelType: 'local'
},
{
chlid: 'news_news_loclntl',
chlname: '铁岭',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 211200,
channelType: 'local'
},
{
chlid: 'news_news_lnbx',
chlname: '本溪',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 210500,
channelType: 'local'
},
{
chlid: 'news_news_lnfx',
chlname: '阜新',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 210900,
channelType: 'local'
},
{
chlid: 'news_news_lnly',
chlname: '辽阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 211000,
channelType: 'local'
},
{
chlid: 'news_news_lnpj',
chlname: '盘锦',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 211100,
channelType: 'local'
},
{
chlid: 'news_news_lncy',
chlname: '朝阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 211300,
channelType: 'local'
},
{
chlid: 'news_news_lnhld',
chlname: '葫芦岛',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '辽宁',
adcode: 211400,
channelType: 'local'
},
{
chlid: 'news_news_bj',
chlname: '北京',
recommend: 2,
order: 3,
isProvince: 1,
refresh: 1,
group: '北京',
adcode: 110000,
channelType: 'local'
},
{
chlid: 'news_news_tj',
chlname: '天津',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '天津',
adcode: 120000,
channelType: 'local'
},
{
chlid: 'news_news_heb',
chlname: '河北',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '河北',
adcode: 130000,
channelType: 'local'
},
{
chlid: 'news_news_shijiazhuang',
chlname: '石家庄',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130100,
channelType: 'local'
},
{
chlid: 'news_news_ts',
chlname: '唐山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130200,
channelType: 'local'
},
{
chlid: 'news_news_hd',
chlname: '邯郸',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130400,
channelType: 'local'
},
{
chlid: 'news_news_xingtai',
chlname: '邢台',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130500,
channelType: 'local'
},
{
chlid: 'news_news_bd',
chlname: '保定',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130600,
channelType: 'local'
},
{
chlid: 'news_news_zhangjiakou',
chlname: '张家口',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130700,
channelType: 'local'
},
{
chlid: 'news_news_cangzhou',
chlname: '沧州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130900,
channelType: 'local'
},
{
chlid: 'news_news_lf',
chlname: '廊坊',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 131000,
channelType: 'local'
},
{
chlid: 'news_news_hs',
chlname: '衡水',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 131100,
channelType: 'local'
},
{
chlid: 'news_news_chengde',
chlname: '承德',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130800,
channelType: 'local'
},
{
chlid: 'news_news_xiongan',
chlname: '雄安',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130638,
channelType: 'local'
},
{
chlid: 'news_news_hbqhd',
chlname: '秦皇岛',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '河北',
adcode: 130300,
channelType: 'local'
},
{
chlid: 'news_news_sd',
chlname: '山东',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '山东',
adcode: 370000,
channelType: 'local'
},
{
chlid: 'news_news_sdjinan',
chlname: '济南',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 370100,
channelType: 'local'
},
{
chlid: 'news_news_sdqd',
chlname: '青岛',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 370200,
channelType: 'local'
},
{
chlid: 'news_news_sdzb',
chlname: '淄博',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 370300,
channelType: 'local'
},
{
chlid: 'news_news_sdzz',
chlname: '枣庄',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 370400,
channelType: 'local'
},
{
chlid: 'news_news_sddy',
chlname: '东营',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 370500,
channelType: 'local'
},
{
chlid: 'news_news_sdyt',
chlname: '烟台',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 370600,
channelType: 'local'
},
{
chlid: 'news_news_sdwf',
chlname: '潍坊',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 370700,
channelType: 'local'
},
{
chlid: 'news_news_sdjining',
chlname: '济宁',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 370800,
channelType: 'local'
},
{
chlid: 'news_news_sdta',
chlname: '泰安',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 370900,
channelType: 'local'
},
{
chlid: 'news_news_sdwh',
chlname: '威海',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 371000,
channelType: 'local'
},
{
chlid: 'news_news_sdrz',
chlname: '日照',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 371100,
channelType: 'local'
},
{
chlid: 'news_news_sdlw',
chlname: '莱芜',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 371200,
channelType: 'local'
},
{
chlid: 'news_news_sdly',
chlname: '临沂',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 371300,
channelType: 'local'
},
{
chlid: 'news_news_sddz',
chlname: '德州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 371400,
channelType: 'local'
},
{
chlid: 'news_news_sdlc',
chlname: '聊城',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 371500,
channelType: 'local'
},
{
chlid: 'news_news_sdbz',
chlname: '滨州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 371600,
channelType: 'local'
},
{
chlid: 'news_news_sdhz',
chlname: '菏泽',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山东',
adcode: 371700,
channelType: 'local'
},
{
chlid: 'news_news_yn',
chlname: '云南',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '云南',
adcode: 530000,
channelType: 'local'
},
{
chlid: 'news_news_ynkm',
chlname: '昆明',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 530100,
channelType: 'local'
},
{
chlid: 'news_news_ynqj',
chlname: '曲靖',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 530300,
channelType: 'local'
},
{
chlid: 'news_news_ynyx',
chlname: '玉溪',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 530400,
channelType: 'local'
},
{
chlid: 'news_news_ynbs',
chlname: '保山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 530500,
channelType: 'local'
},
{
chlid: 'news_news_ynzt',
chlname: '昭通',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 530600,
channelType: 'local'
},
{
chlid: 'news_news_ynlj',
chlname: '丽江',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 530700,
channelType: 'local'
},
{
chlid: 'news_news_ynpe',
chlname: '普洱',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 530800,
channelType: 'local'
},
{
chlid: 'news_news_ynlc',
chlname: '临沧',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 530900,
channelType: 'local'
},
{
chlid: 'news_news_yncx',
chlname: '楚雄',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 532300,
channelType: 'local'
},
{
chlid: 'news_news_ynhh',
chlname: '红河',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 532500,
channelType: 'local'
},
{
chlid: 'news_news_ynws',
chlname: '文山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 532600,
channelType: 'local'
},
{
chlid: 'news_news_ynxsbn',
chlname: '西双版纳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 532800,
channelType: 'local'
},
{
chlid: 'news_news_yndl',
chlname: '大理',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 532900,
channelType: 'local'
},
{
chlid: 'news_news_yndh',
chlname: '德宏',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 533100,
channelType: 'local'
},
{
chlid: 'news_news_ynnj',
chlname: '怒江',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 533300,
channelType: 'local'
},
{
chlid: 'news_news_yndq',
chlname: '迪庆',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '云南',
adcode: 533400,
channelType: 'local'
},
{
chlid: 'news_news_shanxi',
chlname: '山西',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '山西',
adcode: 140000,
channelType: 'local'
},
{
chlid: 'news_news_sxty',
chlname: '太原',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 140100,
channelType: 'local'
},
{
chlid: 'news_news_shxdt',
chlname: '大同',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 140200,
channelType: 'local'
},
{
chlid: 'news_news_shxyq',
chlname: '阳泉',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 140300,
channelType: 'local'
},
{
chlid: 'news_news_shxcz',
chlname: '长治',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 140400,
channelType: 'local'
},
{
chlid: 'news_news_shxjc',
chlname: '晋城',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 140500,
channelType: 'local'
},
{
chlid: 'news_news_shxsz',
chlname: '朔州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 140600,
channelType: 'local'
},
{
chlid: 'news_news_shxjz',
chlname: '晋中',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 140700,
channelType: 'local'
},
{
chlid: 'news_news_shxyc',
chlname: '运城',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 140800,
channelType: 'local'
},
{
chlid: 'news_news_shxxz',
chlname: '忻州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 140900,
channelType: 'local'
},
{
chlid: 'news_news_shxlf',
chlname: '临汾',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 141000,
channelType: 'local'
},
{
chlid: 'news_news_shxll',
chlname: '吕梁',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '山西',
adcode: 141100,
channelType: 'local'
},
{
chlid: 'news_news_jilin',
chlname: '吉林',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '吉林',
adcode: 220000,
channelType: 'local'
},
{
chlid: 'news_news_jlcc',
chlname: '长春',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '吉林',
adcode: 220100,
channelType: 'local'
},
{
chlid: 'news_news_jljl',
chlname: '吉林市',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '吉林',
adcode: 220200,
channelType: 'local'
},
{
chlid: 'news_news_jlsp',
chlname: '四平',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '吉林',
adcode: 220300,
channelType: 'local'
},
{
chlid: 'news_news_jlly',
chlname: '辽源',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '吉林',
adcode: 220400,
channelType: 'local'
},
{
chlid: 'news_news_jlth',
chlname: '通化',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '吉林',
adcode: 220500,
channelType: 'local'
},
{
chlid: 'news_news_jlbs',
chlname: '白山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '吉林',
adcode: 220600,
channelType: 'local'
},
{
chlid: 'news_news_jlsy',
chlname: '松原',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '吉林',
adcode: 220700,
channelType: 'local'
},
{
chlid: 'news_news_jlbc',
chlname: '白城',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '吉林',
adcode: 220800,
channelType: 'local'
},
{
chlid: 'news_news_jlyb',
chlname: '延边',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '吉林',
adcode: 222400,
channelType: 'local'
},
{
chlid: 'news_news_guizhou',
chlname: '贵州',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '贵州',
adcode: 520000,
channelType: 'local'
},
{
chlid: 'news_news_gzgy',
chlname: '贵阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '贵州',
adcode: 520100,
channelType: 'local'
},
{
chlid: 'news_news_gzlps',
chlname: '六盘水',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '贵州',
adcode: 520200,
channelType: 'local'
},
{
chlid: 'news_news_gzzy',
chlname: '遵义',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '贵州',
adcode: 520300,
channelType: 'local'
},
{
chlid: 'news_news_gzas',
chlname: '安顺',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '贵州',
adcode: 520400,
channelType: 'local'
},
{
chlid: 'news_news_gzbj',
chlname: '毕节',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '贵州',
adcode: 520500,
channelType: 'local'
},
{
chlid: 'news_news_gztr',
chlname: '铜仁',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '贵州',
adcode: 520600,
channelType: 'local'
},
{
chlid: 'news_news_gzqxn',
chlname: '黔西南',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '贵州',
adcode: 522300,
channelType: 'local'
},
{
chlid: 'news_news_gzqdn',
chlname: '黔东南',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '贵州',
adcode: 522600,
channelType: 'local'
},
{
chlid: 'news_news_gzqn',
chlname: '黔南',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '贵州',
adcode: 522700,
channelType: 'local'
},
{
chlid: 'news_news_jiangxi',
chlname: '江西',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '江西',
adcode: 360000,
channelType: 'local'
},
{
chlid: 'news_news_jxnc',
chlname: '南昌',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 360100,
channelType: 'local'
},
{
chlid: 'news_news_jxjdz',
chlname: '景德镇',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 360200,
channelType: 'local'
},
{
chlid: 'news_news_jxpx',
chlname: '萍乡',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 360300,
channelType: 'local'
},
{
chlid: 'news_news_jxjj',
chlname: '九江',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 360400,
channelType: 'local'
},
{
chlid: 'news_news_jxxy',
chlname: '新余',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 360500,
channelType: 'local'
},
{
chlid: 'news_news_jxyt',
chlname: '鹰潭',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 360600,
channelType: 'local'
},
{
chlid: 'news_news_jxgz',
chlname: '赣州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 360700,
channelType: 'local'
},
{
chlid: 'news_news_jxja',
chlname: '吉安',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 360800,
channelType: 'local'
},
{
chlid: 'news_news_jxyc',
chlname: '宜春',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 360900,
channelType: 'local'
},
{
chlid: 'news_news_jxfz',
chlname: '抚州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 361000,
channelType: 'local'
},
{
chlid: 'news_news_jxsr',
chlname: '上饶',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '江西',
adcode: 361100,
channelType: 'local'
},
{
chlid: 'news_news_anhui',
chlname: '安徽',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '安徽',
adcode: 340000,
channelType: 'local'
},
{
chlid: 'news_news_ahhf',
chlname: '合肥',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 340100,
channelType: 'local'
},
{
chlid: 'news_news_ahwh',
chlname: '芜湖',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 340200,
channelType: 'local'
},
{
chlid: 'news_news_ahbb',
chlname: '蚌埠',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 340300,
channelType: 'local'
},
{
chlid: 'news_news_ahhn',
chlname: '淮南',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 340400,
channelType: 'local'
},
{
chlid: 'news_news_ahmas',
chlname: '马鞍山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 340500,
channelType: 'local'
},
{
chlid: 'news_news_ahhb',
chlname: '淮北',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 340600,
channelType: 'local'
},
{
chlid: 'news_news_ahtl',
chlname: '铜陵',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 340700,
channelType: 'local'
},
{
chlid: 'news_news_ahaq',
chlname: '安庆',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 340800,
channelType: 'local'
},
{
chlid: 'news_news_ahhs',
chlname: '黄山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 341000,
channelType: 'local'
},
{
chlid: 'news_news_ahczz',
chlname: '滁州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 341100,
channelType: 'local'
},
{
chlid: 'news_news_ahfy',
chlname: '阜阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 341200,
channelType: 'local'
},
{
chlid: 'news_news_ahsz',
chlname: '宿州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 341300,
channelType: 'local'
},
{
chlid: 'news_news_ahla',
chlname: '六安',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 341500,
channelType: 'local'
},
{
chlid: 'news_news_ahhz',
chlname: '亳州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 341600,
channelType: 'local'
},
{
chlid: 'news_news_ahcz',
chlname: '池州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 341700,
channelType: 'local'
},
{
chlid: 'news_news_ahxc',
chlname: '宣城',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '安徽',
adcode: 341800,
channelType: 'local'
},
{
chlid: 'news_news_guangxi',
chlname: '广西',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '广西',
adcode: 450000,
channelType: 'local'
},
{
chlid: 'news_news_gxnn',
chlname: '南宁',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 450100,
channelType: 'local'
},
{
chlid: 'news_news_gxlz',
chlname: '柳州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 450200,
channelType: 'local'
},
{
chlid: 'news_news_gxgl',
chlname: '桂林',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 450300,
channelType: 'local'
},
{
chlid: 'news_news_gxwz',
chlname: '梧州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 450400,
channelType: 'local'
},
{
chlid: 'news_news_gxbh',
chlname: '北海',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 450500,
channelType: 'local'
},
{
chlid: 'news_news_gxfcg',
chlname: '防城港',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 450600,
channelType: 'local'
},
{
chlid: 'news_news_gxqz',
chlname: '钦州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 450700,
channelType: 'local'
},
{
chlid: 'news_news_gxgg',
chlname: '贵港',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 450800,
channelType: 'local'
},
{
chlid: 'news_news_gxyl',
chlname: '玉林',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 450900,
channelType: 'local'
},
{
chlid: 'news_news_gxbs',
chlname: '百色',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 451000,
channelType: 'local'
},
{
chlid: 'news_news_gxhz',
chlname: '贺州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 451100,
channelType: 'local'
},
{
chlid: 'news_news_gxhc',
chlname: '河池',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 451200,
channelType: 'local'
},
{
chlid: 'news_news_gxlb',
chlname: '来宾',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 451300,
channelType: 'local'
},
{
chlid: 'news_news_gxcz',
chlname: '崇左',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '广西',
adcode: 451400,
channelType: 'local'
},
{
chlid: 'news_news_xizang',
chlname: '西藏',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '西藏',
adcode: 540000,
channelType: 'local'
},
{
chlid: 'news_news_xinjiang',
chlname: '新疆',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '新疆',
adcode: 650000,
channelType: 'local'
},
{
chlid: 'news_news_qinghai',
chlname: '青海',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '青海',
adcode: 630000,
channelType: 'local'
},
{
chlid: 'news_news_qhxn',
chlname: '西宁',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '青海',
adcode: 630100,
channelType: 'local'
},
{
chlid: 'news_news_qhhd',
chlname: '海东',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '青海',
adcode: 630200,
channelType: 'local'
},
{
chlid: 'news_news_qhhb',
chlname: '海北',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '青海',
adcode: 632200,
channelType: 'local'
},
{
chlid: 'news_news_qhhnn',
chlname: '黄南',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '青海',
adcode: 632300,
channelType: 'local'
},
{
chlid: 'news_news_qhhn',
chlname: '海南州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '青海',
adcode: 632500,
channelType: 'local'
},
{
chlid: 'news_news_qhgl',
chlname: '果洛',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '青海',
adcode: 632600,
channelType: 'local'
},
{
chlid: 'news_news_qhys',
chlname: '玉树',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '青海',
adcode: 632700,
channelType: 'local'
},
{
chlid: 'news_news_qhhx',
chlname: '海西',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '青海',
adcode: 632800,
channelType: 'local'
},
{
chlid: 'news_news_gansu',
chlname: '甘肃',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '甘肃',
adcode: 620000,
channelType: 'local'
},
{
chlid: 'news_news_gslz',
chlname: '兰州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 620100,
channelType: 'local'
},
{
chlid: 'news_news_gsjyg',
chlname: '嘉峪关',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 620200,
channelType: 'local'
},
{
chlid: 'news_news_gsjc',
chlname: '金昌',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 620300,
channelType: 'local'
},
{
chlid: 'news_news_gsby',
chlname: '白银',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 620400,
channelType: 'local'
},
{
chlid: 'news_news_gsts',
chlname: '天水',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 620500,
channelType: 'local'
},
{
chlid: 'news_news_gsww',
chlname: '武威',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 620600,
channelType: 'local'
},
{
chlid: 'news_news_gszy',
chlname: '张掖',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 620700,
channelType: 'local'
},
{
chlid: 'news_news_gspl',
chlname: '平凉',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 620800,
channelType: 'local'
},
{
chlid: 'news_news_gsjq',
chlname: '酒泉',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 620900,
channelType: 'local'
},
{
chlid: 'news_news_gsqy',
chlname: '庆阳',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 621000,
channelType: 'local'
},
{
chlid: 'news_news_gsdx',
chlname: '定西',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 621100,
channelType: 'local'
},
{
chlid: 'news_news_gsln',
chlname: '陇南',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 621200,
channelType: 'local'
},
{
chlid: 'news_news_gslx',
chlname: '临夏',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 622900,
channelType: 'local'
},
{
chlid: 'news_news_gsgn',
chlname: '甘南',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '甘肃',
adcode: 623000,
channelType: 'local'
},
{
chlid: 'news_news_neimenggu',
chlname: '内蒙古',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '内蒙古',
adcode: 150000,
channelType: 'local'
},
{
chlid: 'news_news_hhht',
chlname: '呼和浩特',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 150100,
channelType: 'local'
},
{
chlid: 'news_news_nmgbt',
chlname: '包头',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 150200,
channelType: 'local'
},
{
chlid: 'news_news_nmgwh',
chlname: '乌海',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 150300,
channelType: 'local'
},
{
chlid: 'news_news_nmgcf',
chlname: '赤峰',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 150400,
channelType: 'local'
},
{
chlid: 'news_news_nmgtl',
chlname: '通辽',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 150500,
channelType: 'local'
},
{
chlid: 'news_news_nmgeeds',
chlname: '鄂尔多斯',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 150600,
channelType: 'local'
},
{
chlid: 'news_news_nmghlbe',
chlname: '呼伦贝尔',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 150700,
channelType: 'local'
},
{
chlid: 'news_news_nmgbyze',
chlname: '巴彦淖尔',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 150800,
channelType: 'local'
},
{
chlid: 'news_news_nmgwlcb',
chlname: '乌兰察布',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 150900,
channelType: 'local'
},
{
chlid: 'news_news_nmgxam',
chlname: '兴安盟',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 152200,
channelType: 'local'
},
{
chlid: 'news_news_nmgxlglm',
chlname: '锡林郭勒',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 152500,
channelType: 'local'
},
{
chlid: 'news_news_nmgalsm',
chlname: '阿拉善盟',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '内蒙古',
adcode: 152900,
channelType: 'local'
},
{
chlid: 'news_news_heilongjiang',
chlname: '黑龙江',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '黑龙江',
adcode: 230000,
channelType: 'local'
},
{
chlid: 'news_news_hljheb',
chlname: '哈尔滨',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 230100,
channelType: 'local'
},
{
chlid: 'news_news_hljqqhe',
chlname: '齐齐哈尔',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 230200,
channelType: 'local'
},
{
chlid: 'news_news_hljjx',
chlname: '鸡西',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 230300,
channelType: 'local'
},
{
chlid: 'news_news_hljhg',
chlname: '鹤岗',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 230400,
channelType: 'local'
},
{
chlid: 'news_news_hljsys',
chlname: '双鸭山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 230500,
channelType: 'local'
},
{
chlid: 'news_news_hljdq',
chlname: '大庆',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 230600,
channelType: 'local'
},
{
chlid: 'news_news_hljyc',
chlname: '伊春',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 230700,
channelType: 'local'
},
{
chlid: 'news_news_hljjms',
chlname: '佳木斯',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 230800,
channelType: 'local'
},
{
chlid: 'news_news_hljqth',
chlname: '七台河',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 230900,
channelType: 'local'
},
{
chlid: 'news_news_hljmdj',
chlname: '牡丹江',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 231000,
channelType: 'local'
},
{
chlid: 'news_news_hljhh',
chlname: '黑河',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 231100,
channelType: 'local'
},
{
chlid: 'news_news_hljsh',
chlname: '绥化',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 231200,
channelType: 'local'
},
{
chlid: 'news_news_hljdxal',
chlname: '大兴安岭',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '黑龙江',
adcode: 232700,
channelType: 'local'
},
{
chlid: 'news_news_ningxia',
chlname: '宁夏',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '宁夏',
adcode: 640000,
channelType: 'local'
},
{
chlid: 'news_news_nxyc',
chlname: '银川',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '宁夏',
adcode: 640100,
channelType: 'local'
},
{
chlid: 'news_news_nxszs',
chlname: '石嘴山',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '宁夏',
adcode: 640200,
channelType: 'local'
},
{
chlid: 'news_news_nxwz',
chlname: '吴忠',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '宁夏',
adcode: 640300,
channelType: 'local'
},
{
chlid: 'news_news_nxgy',
chlname: '固原',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '宁夏',
adcode: 640400,
channelType: 'local'
},
{
chlid: 'news_news_nxzw',
chlname: '中卫',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '宁夏',
adcode: 640500,
channelType: 'local'
},
{
chlid: 'news_nwes_hainan',
chlname: '海南',
recommend: 0,
order: 0,
isProvince: 1,
refresh: 1,
group: '海南',
adcode: 460000,
channelType: 'local'
},
{
chlid: 'news_news_hnhk',
chlname: '海口',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '海南',
adcode: 460100,
channelType: 'local'
},
{
chlid: 'news_news_hansy',
chlname: '三亚',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '海南',
adcode: 460200,
channelType: 'local'
},
{
chlid: 'news_news_hanss',
chlname: '三沙',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '海南',
adcode: 460300,
channelType: 'local'
},
{
chlid: 'news_news_handz',
chlname: '儋州',
recommend: 0,
order: 0,
isProvince: 0,
refresh: 1,
group: '海南',
adcode: 460400,
channelType: 'local'
}
];
export default {
area_pool,
local_chllist
}
|
export default {
gap: 'medium',
columnMin: '280px',
breakpoints: {
mobile: 'small',
min: '320px',
small: '480px',
medium: '768px',
large: '992px',
max: '1200px',
},
}
|
/*
* Copyright 2014 Jive Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var chai = require('chai')
, expect = chai.expect
, should = chai.should();
var chaiAsPromised = require("chai-as-promised");
var q = require("q");
chai.use(chaiAsPromised);
var builder = require("./strategies/testStrategyBuilder");
describe("#StrategySetBuilderBase", function () {
describe("#build", function () {
it("should create an object with setup and teardown functions", function () {
var b = new builder();
var strats = b.test().build();
strats.should.have.property("setup");
strats.should.have.property("teardown");
});
it("should throw if no strategies have been added", function () {
var b = new builder();
expect(function () {
b.build();
}).to.throw(builder.EMPTY_SET);
});
it("calling setup should call all strategies setup functions in order", function () {
var b = new builder();
var strats = b.test().test2().build();
var options = {};
return strats.setup(options).then(function () {
options.setupRun.should.not.be.above(options.setup2Run);
});
});
it("calling teardown should call all strategies teardown functions in order", function () {
var b = new builder();
var strats = b.test().test2().build();
var options = {placeUrl: "Some_Linked_Place"};
return strats.setup(options).then(function () {
return strats.teardown(options).then(function () {
options.teardownRun.should.not.be.above(options.teardown2Run);
});
});
});
it("should continue setting up if a strategy fails", function () {
var b = new builder();
var strats = b.test().failSetup().test2().build();
var options = {placeUrl: "Some_Linked_Place"};
return strats.setup(options).then(function () {
options.should.have.property("setup2Run");
});
});
it("should continue setting up if a strategy fails", function () {
var b = new builder();
var strats = b.test().failTeardown().test2().build();
var options = {placeUrl: "Some_Linked_Place"};
return strats.setup(options).then(function () {
strats.teardown(options).then(function () {
options.should.have.property("teardown22Run");
})
});
});
});
});
|
window.onload = function(){
//动态加载商品
var title = decodeURI(location.search).split("?")[1];
$.ajax({
type:"post",
url:"../php/detail.php",
data:{
"name":title
},
success:function(res){
var arr = JSON.parse(res);
var html = "";
html+=`<!--详细信息开始-->
<div class="content container">
<div class="left">
<!--小图-->
<div class="cake_photo_s">
<img src="../images/${arr.magImg.split(",")[0]}.png"/>
<!--遮罩层-->
<div class="mask"></div>
</div>
<!--图片列表-->
<ul>
<li class="active"><img src="../images/${arr.magImg.split(",")[0]}.png"/></li>
<li><img src="../images/${arr.magImg.split(",")[1]}.png"/></li>
<li><img src="../images/${arr.magImg.split(",")[2]}.png"/></li>
<li><img src="../images/${arr.magImg.split(",")[3]}.png"/></li>
</ul>
<!--大图-->
<div class="cake_photo_b">
<img src="../images/${arr.magImg.split(",")[0]}.png"/>
</div>
</div>
<div class="right">
<h1>${arr.title}</h1>
<ul class="detail_distribution">
<li>
<i></i>
<span>保鲜条件:0-4℃保藏10小时,5℃食用为佳</span>
</li>
<li>
<i></i>
<span>参考甜度:</span>
<span>
<i></i>
<i></i>
<i class="active"></i>
<i class="active"></i>
<i class="active"></i>
</span>
</li>
</ul>
<div class="pro_detial">
${arr.des}
</div>
<div class="outer_box">
<div class="detail_img">
<img src="../images/detail_img.jpg"/>
<ul>
<li>
<i></i>
17*17cm
</li>
<li>
<i></i>
适合7-8人分享
</li>
<li>
<i></i>
含10套餐具
</li>
<li>
<i></i>
最早明天 09:30配送
</li>
</ul>
<p class="price">
¥
<span>${arr.price}</span>
/2.0磅
</p>
</div>
<div class="cake_size">
<span>商品规格</span>
<ul>
<li>
<a href="#" class="active">
1.0磅
<i></i>
</a>
</li>
<li>
<a href="#">
2.0磅
<i></i>
</a>
</li>
<li>
<a href="#">
3.0磅
<i></i>
</a>
</li>
<li>
<a href="#">
5.0磅
<i></i>
</a>
</li>
</ul>
</div>
<div class="buy_button">
<a href="javascript:;" class="buy_now">立即购买</a>
<a href="javascript:;" class="go_car">加入购物车</a>
</div>
</div>
</div>
</div>
<!--详细信息结束-->
<!--详情图开始-->
<div class="detail_photo container">
<img src="../images/${arr.desImg.split(",")[0]}.jpg"/>
<img src="../images/${arr.desImg.split(",")[1]}.jpg"/>
<img src="../images/${arr.desImg.split(",")[2]}.jpg"/>
<img src="../images/${arr.desImg.split(",")[3]}.jpg"/>
<img src="../images/${arr.desImg.split(",")[4]}.jpg"/>
</div>
<!--详情图结束-->`;
$(".mainly").html(html);
//点击立即购买跳转到购物车的页面
$(".buy_now").click(function(){
var uname = localStorage.getItem("uname");
if(uname){
//添加购物车信息
var name = decodeURI(location.search.split("?")[1]);
var goodsInfo = [{
"name":name,
"num":1
}];
var goodsInfoJson = JSON.stringify(goodsInfo);
//购物车信息存在就进行添加操作,不存在就进行创建
if(localStorage.getItem(uname+"goShopping")){
//存在,直接添加购物车信息
var goodsInfo = localStorage.getItem(uname+"goShopping");
var goodsInfoJson = JSON.parse(goodsInfo);
var flag = true;//该商品是否在goshopping中已存在,true代表存在
for(var i=0;i<goodsInfoJson.length;i++){
if(goodsInfoJson[i].name == name){
goodsInfoJson[i].num++;
flag = false;
}
}
if(flag){
var goodsObj = {
"name":name,
"num":1
};
goodsInfoJson.push(goodsObj);
}
var json = JSON.stringify(goodsInfoJson);
localStorage.setItem(uname+"goShopping",json);
}else{
//不存在,创建购物车信息
localStorage.setItem(uname+"goShopping",goodsInfoJson);
location.href = "car.html";
}
}else{
alert("您还没有登录,请登录!");
location.href = "login.html";
}
})
$(".go_car").click(function(){
var uname = localStorage.getItem("uname");
if(uname){
//添加购物车信息
var name = decodeURI(location.search.split("?")[1]);
var goodsInfo = [{
"name":name,
"num":1
}];
var goodsInfoJson = JSON.stringify(goodsInfo);
//购物车信息存在就进行添加操作,不存在就进行创建
if(localStorage.getItem(uname+"goShopping")){
//存在,直接添加购物车信息
var goodsInfo = localStorage.getItem(uname+"goShopping");
var goodsInfoJson = JSON.parse(goodsInfo);
var flag = true;//该商品是否在goshopping中已存在,true代表存在
for(var i=0;i<goodsInfoJson.length;i++){
if(goodsInfoJson[i].name == name){
goodsInfoJson[i].num++;
flag = false;
}
}
if(flag){
var goodsObj = {
"name":name,
"num":1
};
goodsInfoJson.push(goodsObj);
}
var json = JSON.stringify(goodsInfoJson);
localStorage.setItem(uname+"goShopping",json);
}else{
//不存在,创建购物车信息
localStorage.setItem(uname+"goShopping",goodsInfoJson);
}
}else{
alert("您还没有登录,请登录!");
location.href = "login.html";
}
//头部购物车显示的变化
var goodsinfo = localStorage.getItem(uname+"goShopping");
if(goodsinfo){
var count = 0;
var goodsArr = JSON.parse(goodsinfo);
if(goodsinfo == "[]"){
$(".cat span").css("display","none");
}else{
for(var i=0;i<goodsArr.length;i++){
count += parseInt(goodsArr[i].num);
}
$(".cat span").css("display","block");
$(".cat span").html(count);
}
}
})
//放大镜
$(".cake_photo_s").hover(function(){
$(".cake_photo_s .mask").css("display","block");
$(".cake_photo_b").css("display","block");
$(".cake_photo_s").mousemove(function(e){
var e = e || event;
var x = e.pageX;
var y = e.pageY;
var w = $(".cake_photo_s")[0].offsetLeft;
var h = $(".cake_photo_s")[0].offsetTop;
var l = x-w-parseInt($(".mask").css("width"))/2;
var t = y-h-parseInt($(".mask").css("height"))/2;
var left = parseInt($(".cake_photo_s").css("width"))-parseInt($(".mask").css("width"));
var top = parseInt($(".cake_photo_s").css("height"))-parseInt($(".mask").css("height"));
if(l<0){
l=0;
}else if(l>left){
l=left;
}
if(t<0){
t=0;
}else if(t>top){
t=top;
}
var le = l*(parseInt($(".cake_photo_b img").css("width"))-parseInt($(".cake_photo_b").css("width")))/left;
var to = t*(parseInt($(".cake_photo_b img").css("height"))-parseInt($(".cake_photo_b").css("height")))/top;
$(".mask").css("left",l);
$(".mask").css("top",t);
$(".cake_photo_b img").css("left",-le);
$(".cake_photo_b img").css("top",-to);
})
},function(){
$(".cake_photo_s .mask").css("display","none");
$(".cake_photo_b").css("display","none");
});
//点击切换图片
$(".left ul li").click(function(){
var index = $(this).index();
$(".left ul li").eq(index).addClass("active").siblings().prop("class","");
$(".cake_photo_s img").attr("src",`../images/${arr.magImg.split(",")[index]}.png`);
$(".cake_photo_b img").attr("src",`../images/${arr.magImg.split(",")[index]}.png`);
})
}
});
/*****************头部****************/
//头部二维码
$(".app_down").hover(function(){
$(".header_code").stop().slideDown();
},function(){
$(".header_code").stop().slideUp();
})
//头部城市选择列表
$(".city_select").hover(function(){
$(".select_city").stop().slideDown();
},function(){
$(".select_city").stop().slideUp();
})
$(".select_city li a").click(function(){
var str = $(".city_select span").html();
$(".city_select span").html($(this).html());
$(this).html(str);
});
//头部消息
$(".message").hover(function(){
$(".header_info").stop().slideDown();
},function(){
$(".header_info").stop().slideUp();
})
//判断用户是否登录
var uname = localStorage.getItem("uname");
if(uname){
$(".login_register .login").css("display","none");
$(".login_register .register").css("display","none");
$(".login_register .myname").html(uname);
//用户
$(".login_register").hover(function(){
$(".login_register ul").stop().slideDown();
},function(){
$(".login_register ul").stop().slideUp();
})
}
$(".login_register ul .exit").click(function(){
$(".login_register .myname").html("");
$(".login_register .login").css("display","inline-block");
$(".login_register .register").css("display","inline-block");
$(".login_register ul").css("display","none");
localStorage.setItem("uname","");
window.location.reload();
});
//购物车商品显示
var goodsinfo = localStorage.getItem(uname+"goShopping");
if(goodsinfo){
var count = 0;
var goodsArr = JSON.parse(goodsinfo);
if(goodsinfo == "[]"){
$(".cat span").css("display","none");
}else{
for(var i=0;i<goodsArr.length;i++){
count += parseInt(goodsArr[i].num);
}
$(".cat span").css("display","block");
$(".cat span").html(count);
}
}
}
|
import React from 'react';
import './leftBar.css';
import Grid from '@material-ui/core/Grid';
function LeftBar(props){
return <Grid item className="d-flex LeftBar" md={2}>
<span className="mb-auto mx-auto"> Navigation </span>
</Grid>;
}
export default LeftBar;
|
require('@babel/register')({
ignore: [/node_modules\//],
plugins: ['add-module-exports'],
});
const Router = require('koa-router');
const axios = require('../../utils/axios').default;
const router = new Router();
router.post('/login', async (ctx, next) => {
try {
const res = await axios.post('https://l94wc2001h.execute-api.ap-southeast-2.amazonaws.com/prod/fake-auth', ctx.request.body);
ctx.status = 200;
ctx.body = {
success: true,
value: res.data
};
} catch (error) {
if (error.response) {
ctx.status = error.response.status;
ctx.body = {
success: false,
errorMsg: error.response.data,
};
} else {
ctx.status = 500;
ctx.body = {
success: false,
errorMsg: 'system error',
};
}
}
return next();
});
module.exports = router;
|
import React, {Component} from 'react'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import SelectField from 'material-ui/SelectField'
import axios from 'axios'
import localStorage from 'localStorage'
import * as smtpActions from '../../Actions/SMTPActions'
import {AUTH_BASE_URL} from '../../Config/Constants'
import {underlineFocusStyle, floatingLabelFocusStyle, selectContainerStyle} from '../CSSModules'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
import {axiosInstance} from '../../Config/AxiosInstance'
import {toastr} from 'react-redux-toastr'
import {ButtonInput} from 'react-bootstrap'
import {ValidatorForm} from 'react-form-validator-core'
import {TextValidator} from 'react-material-ui-form-validator'
const requiredValidation = () => ['required'];
const errorMessage = () => ['this field is required'];
class Form extends Component {
constructor(props) {
super(props);
this.state = {
smtpDetailsPresent: false
};
this.handleApplicationUrlChange = this
.handleApplicationUrlChange
.bind(this);
this.handleSMTPHostChange = this
.handleSMTPHostChange
.bind(this);
this.handleSMTPUserNameChange = this
.handleSMTPUserNameChange
.bind(this);
this.handleSMTPPasswordChange = this
.handleSMTPPasswordChange
.bind(this);
this.handleSMTPPortChange = this
.handleSMTPPortChange
.bind(this);
this.handleSubmit = this
.handleSubmit
.bind(this);
}
handleApplicationUrlChange = (event, applicationUrl) => this.setState({applicationUrl});
handleSMTPHostChange = (event, smtpHost) => this.setState({smtpHost});
handleSMTPUserNameChange = (event, smtpUserName) => this.setState({smtpUserName});
handleSMTPPasswordChange = (event, smtpPassword) => this.setState({smtpPassword});
handleSMTPPortChange = (event, smtpPort) => this.setState({smtpPort});
componentDidMount() {
axios.get(AUTH_BASE_URL + "smtp/1", {
withCredentials: true,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': localStorage.getItem('token')
},
}).then((response) => {
var smtpDetails = response.data;
if (smtpDetails) {
this.setState({
applicationUrl: smtpDetails.applicationUrl,
smtpHost: smtpDetails.smtpHost,
smtpUserName: smtpDetails.smtpUserName,
smtpPassword: smtpDetails.smtpPassword,
smtpPort: smtpDetails.smtpPort,
smtpDetailsPresent: true,
})
}
}).catch((err) => {
toastr.error("Error while fetching smtp details");
})
}
handleSubmit(event) {
event.preventDefault();
var payload = {
applicationUrl: this.state.applicationUrl,
smtpHost: this.state.smtpHost,
smtpUserName: this.state.smtpUserName,
smtpPassword: this.state.smtpPassword,
smtpPort: this.state.smtpPort,
};
if (this.state.smtpDetailsPresent) {
this
.props
.actions
.update(1, payload);
} else {
this
.props
.actions
.create(payload);
}
}
componentWillReceiveProps(nextProps) {
if (nextProps.createResponse) {
toastr.info("SMTP details created successfully");
}
if (nextProps.updateResponse) {
toastr.info("SMTP details updated successfully");
}
if (nextProps.error) {
toastr.error(nextProps.error.data.message);
}
}
render() {
return (
<MuiThemeProvider>
<ValidatorForm onSubmit={this.handleSubmit}>
<TextValidator name="applicationUrl" validators={requiredValidation()} errorMessages={errorMessage()} floatingLabelText="Application URL" fullWidth={true} underlineFocusStyle={underlineFocusStyle} floatingLabelFocusStyle={floatingLabelFocusStyle} onChange={this.handleApplicationUrlChange} value={this.state.applicationUrl}/>
<TextValidator name="smtpHost" validators={requiredValidation()} errorMessages={errorMessage()} floatingLabelText="SMTP Host" fullWidth={true} underlineFocusStyle={underlineFocusStyle} floatingLabelFocusStyle={floatingLabelFocusStyle} onChange={this.handleSMTPHostChange} value={this.state.smtpHost}/>
<TextValidator name="smtpUserName" validators={requiredValidation()} errorMessages={errorMessage()} floatingLabelText="SMTP User Name" fullWidth={true} underlineFocusStyle={underlineFocusStyle} floatingLabelFocusStyle={floatingLabelFocusStyle} onChange={this.handleSMTPUserNameChange} value={this.state.smtpUserName}/>
<TextValidator name="smtpPassword" type="password" validators={requiredValidation()} errorMessages={errorMessage()} floatingLabelText="SMTP Password" fullWidth={true} underlineFocusStyle={underlineFocusStyle} floatingLabelFocusStyle={floatingLabelFocusStyle} onChange={this.handleSMTPPasswordChange} value={this.state.smtpPassword}/>
<TextValidator name="smtpPort" floatingLabelText="SMTP Port" fullWidth={true} underlineFocusStyle={underlineFocusStyle} floatingLabelFocusStyle={floatingLabelFocusStyle} onChange={this.handleSMTPPortChange} value={this.state.smtpPort}/>
<button class="btn btn-primary form-page-btn">
Save Details
</button>
</ValidatorForm>
</MuiThemeProvider>
)
}
}
const mapStateToProps = (state) => ({smtpDetails: state.smtp.smtpDetails, createResponse: state.smtp.createResponse, updateResponse: state.smtp.updateResponse, error: state.smtp.error});
const mapDispatchToProps = (dispatch) => ({
actions: bindActionCreators(smtpActions, dispatch)
});
export default connect(mapStateToProps, mapDispatchToProps)(Form);
|
// @flow
import { type Action } from "shared/types/ReducerAction";
import {
type AsyncStatusType,
type NotificationType,
} from "shared/types/General";
import { ASYNC_STATUS } from "constants/async";
import {
ASYNC_ORDERS_INIT,
HANDLE_NOTIFICATION,
GET_ORDERS_SUCCESS,
GET_ORDER_SUCCESS,
INIT_ORDERS,
} from "actionTypes/order";
export type OrdersStateType = {
status: AsyncStatusType,
notification: NotificationType,
orders: Array<any>,
order: Object | null,
};
const initialState: OrdersStateType = {
status: ASYNC_STATUS.INIT,
notification: null,
orders: [],
order: null,
};
function asyncOrdersInit(state: OrdersStateType) {
return {
...state,
status: ASYNC_STATUS.LOADING,
notification: null,
};
}
function getOrderSuccess(
state,
{
orderId,
supplierCode,
productCode,
productName,
size,
price,
color,
quantity,
}
) {
return {
...state,
status: ASYNC_STATUS.SUCCESS,
order: {
orderId,
supplierCode,
productCode,
productName,
size,
price,
color,
quantity,
},
};
}
function handleNotification(
state: OrdersStateType,
{ isSuccess, notification }
) {
return {
...state,
notification,
status: isSuccess ? ASYNC_STATUS.SUCCESS : ASYNC_STATUS.FAILURE,
};
}
export default (
state: OrdersStateType = initialState,
{ type, payload = {} }: Action
) => {
switch (type) {
case ASYNC_ORDERS_INIT:
return asyncOrdersInit(state);
case HANDLE_NOTIFICATION:
return handleNotification(state, payload);
case INIT_ORDERS:
return {
...state,
status: ASYNC_STATUS.INIT,
notification: null,
};
case GET_ORDERS_SUCCESS:
return {
...state,
status: ASYNC_STATUS.SUCCESS,
orders: payload,
};
case GET_ORDER_SUCCESS:
return getOrderSuccess(state, payload);
default:
return state;
}
};
|
#!/usr/bin/env node
var debug = false
var request = require('request')
var isRestarting = false
var now = Math.floor(new Date() / 1000)
var timeout = (1000 * 60) * 30
var updateCheckInterval = (1000 * 60) * 5
if (debug) {
updateCheckInterval = 5000 // Check every 5 seconds
timeout = 1000 * 60 // Timeout after a minute
}
// Timeout after 30 minutes and restart
setTimeout(function () {
console.log('RestartApp::Timeout exceeded, forcing a restart')
restart()
}, timeout)
// Start checking for client updates
checkForClientUpdate()
function checkForClientUpdate () {
if (isRestarting) {
if (debug) console.log("RestartApp::We're restarting, skipping client update check..")
return
}
console.log('RestartApp::Checking if a client update is available..')
request({ url: 'https://whenisupdate.com/api.json', headers: { Referer: 'rust-docker-server' }, timeout: 10000 }, function (error, response, body) {
if (!error && response.statusCode === 200) {
var info = JSON.parse(body)
var latest = info.latest
if (latest !== undefined && latest.length > 0) {
if (latest >= now) {
console.log('RestartApp::Client update is out, forcing a restart')
restart()
return
}
}
if (debug) console.log('RestartApp::Client update not out yet..')
} else if (debug) {
console.log('RestartApp::Error: ' + error)
}
// Keep checking for client updates every 5 minutes
setTimeout(function () {
checkForClientUpdate()
}, updateCheckInterval)
})
}
function restart () {
if (debug) console.log('RestartApp::Restarting..')
if (isRestarting) {
if (debug) console.log("RestartApp::We're already restarting..")
return
}
isRestarting = true
var serverHostname = 'localhost'
var serverPort = process.env.RUST_RCON_PORT
var serverPassword = process.env.RUST_RCON_PASSWORD
var WebSocket = require('ws')
var ws = new WebSocket('ws://' + serverHostname + ':' + serverPort + '/' + serverPassword)
ws.on('open', function open () {
setTimeout(function () {
ws.send(createPacket("say NOTICE: We're updating the server in <color=orange>5 minutes</color>, so get to a safe spot!"))
setTimeout(function () {
ws.send(createPacket("say NOTICE: We're updating the server in <color=orange>4 minutes</color>, so get to a safe spot!"))
setTimeout(function () {
ws.send(createPacket("say NOTICE: We're updating the server in <color=orange>3 minutes</color>, so get to a safe spot!"))
setTimeout(function () {
ws.send(createPacket("say NOTICE: We're updating the server in <color=orange>2 minutes</color>, so get to a safe spot!"))
setTimeout(function () {
ws.send(createPacket("say NOTICE: We're updating the server in <color=orange>1 minute</color>, so get to a safe spot!"))
setTimeout(function () {
ws.send(createPacket('global.kickall <color=orange>Updating/Restarting</color>'))
setTimeout(function () {
ws.send(createPacket('quit'))
// ws.send(createPacket("restart 60")); // NOTE: Don't use restart, because that doesn't actually restart the container!
setTimeout(function () {
ws.close(1000)
// After 2 minutes, if the server's still running, forcibly shut it down
setTimeout(function () {
var fs = require('fs')
fs.unlinkSync('/tmp/restart_app.lock')
var childProcess = require('child_process')
childProcess.execSync('kill -s 2 $(pidof bash)')
}, 1000 * 60 * 2)
}, 1000)
}, 1000)
}, 1000 * 60)
}, 1000 * 60)
}, 1000 * 60)
}, 1000 * 60)
}, 1000 * 60)
}, 1000)
})
}
function createPacket (command) {
var packet =
{
Identifier: -1,
Message: command,
Name: 'WebRcon'
}
return JSON.stringify(packet)
}
|
// Strict Mode On (엄격모드)
"use strict";
"use warning";
var SelectUnitPopup = new function() {
var INSTANCE = this;
var callbackfunc;
var focus = 0;
var frameCnt = 0;
var str;
var teamScore;
var isMenu;
var popX = 0, popY = 0;
var selectBox;
var myUnitIconImg;
var myUnitImg;
var focusImg;
var button_exit_off;
var button_exit_on;
var num;
var numberFont;
var star;
var starBack;
var typeImg;
var type_s_Img;
var iconImg;
var iconAtk;
var lvIconArr;
var popup_monster_select;
var unitTypeStr = ["근거리 공격", "원거리 공격"];
var unitAttrStr = ["무속성", "물리속성", "마법속성"];
var unitSkillStr = ["스킬 없음", "몬스터를 공격하여 다수의 적의|이동을 1초간 방해 한다.", "몬스터를 공격하여 단일 개체의 적에게|매초당 공격력의 20%의 피해를 입힌다.",
"몬스터를 공격하여 단일 개체의 적의|이동속도를 5초간 10% 감소 시킨다.", "몬스터를 공격하여 다수의 적에게|공격력의 50%의 피해를 입힌다.",
"몬스터를 공격하여 다수의 적의|이동을 1초간 방해 한다.", "몬스터를 공격하여 다수의 적에게|매 초당 공격력의 35%의 피해를 입힌다.", "몬스터를 공격하여 다수의 적의|이동속도를 5초간 20% 감소 시킨다."];
var setResource = function(onload) {
myUnitIconImg = [];
// myUnitImg = [];
button_exit_on = [];
// num = [];
// typeImg = [];
// type_s_Img = [];
// iconImg = [];
var imgParam = [
[popup_monster_select = new Image(), ROOT_IMG + "popup/popup_monster_select" + EXT_PNG],
// [button_exit_off = new Image(), ROOT_IMG + "popup/b_exit_off" + EXT_PNG],
[button_exit_on = [], HTool.getURLs(ROOT_IMG, "popup/p_b_exit_", EXT_PNG, 3)],
[focusImg = [], HTool.getURLs(ROOT_IMG, "game/skill/skill_select_", EXT_PNG, 2)],
// [num = [], HTool.getURLs(ROOT_IMG, "number/w_", EXT_PNG, 10)],
// [star = new Image(), ROOT_IMG + "etc/star_1" + EXT_PNG],
// [starBack = new Image(), ROOT_IMG + "etc/star_0" + EXT_PNG],
[selectBox = new Image(), ROOT_IMG + "waitroom/select_box" + EXT_PNG]
];
for (var i = 0; i < UnitManager.getUseHeroInfo().length; i++) {
imgParam.push([myUnitIconImg[i] = new Image(), ROOT_IMG + "game/myUnit/icon/s_hero_" + UnitManager.getUseHeroInfo()[i].getRes() + EXT_PNG]);
// imgParam.push([myUnitImg[i] = new Image(), ROOT_IMG + "game/myUnit/hero/hero_" + UnitManager.getUseHeroInfo()[i].getRes() + "_l_w_0" + EXT_PNG]);
}
ResourceMgr.makeImageList(imgParam, function() {
imgParam = null;
// numberFont = new NumberFontImage(num);
// typeImg[0] = PlayResManager.getIconMap().get("type_none");
// typeImg[1] = PlayResManager.getIconMap().get("type_physics");
// typeImg[2] = PlayResManager.getIconMap().get("type_magic");
// type_s_Img[0] = PlayResManager.getIconMap().get("type_s_none");
// type_s_Img[1] = PlayResManager.getIconMap().get("type_s_physics");
// type_s_Img[2] = PlayResManager.getIconMap().get("type_s_magic");
// iconImg[0] = PlayResManager.getIconMap().get("icon_melee");
// iconImg[1] = PlayResManager.getIconMap().get("icon_range");
//
// iconAtk = PlayResManager.getIconMap().get("icon_attack");
// lvIconArr = [];
// for (var i = 0; i < 4; i++) {
// lvIconArr[i] = PlayResManager.getIconMap().get("lv_icon_" + i);
// }
onload();
}, function(err) {
appMgr.openDisconnectPopup("SelectUnitPopup setResource Fail!!");
onload();
});
};
var heroRender = function(g) {
if (UnitManager.getUseHeroInfo()[focus] != null) {
// g.setFont(FONT_24);
// g.setColor(COLOR_YELLOW);
// HTextRender.oriRender(g, UnitManager.getUseHeroInfo()[focus].getName(), 455, 219, HTextRender.CENTER);
// g.drawImage(lvIconArr[UnitManager.getUseHeroInfo()[focus].getGrade()], 264, 239);
// g.drawImage(myUnitImg[focus], 367 - (myUnitImg[focus].width / 2), 407 - myUnitImg[focus].height);
// for (var j = 0; j < 6; j++) {
// g.drawImage(starBack, 335 + (j * 15), 252);
// }
// for (var j = 0; j < UnitManager.getUseHeroInfo()[focus].getExp(); j++) {
// g.drawImage(star, 335 + (j * 15), 252);
// }
// g.drawImage(typeImg[UnitManager.getUseHeroInfo()[focus].getAttr()], 447, 252);
// g.drawImage(iconImg[UnitManager.getUseHeroInfo()[focus].getType()], 447, 302);
// g.drawImage(iconAtk, 447, 352);
//
// g.setFont(FONT_19);
// g.setColor(COLOR_WHITE);
// HTextRender.oriRender(g, unitAttrStr[UnitManager.getUseHeroInfo()[focus].getAttr()], 546, 282, HTextRender.LEFT);
// HTextRender.oriRender(g, unitTypeStr[UnitManager.getUseHeroInfo()[focus].getType()], 546, 332, HTextRender.LEFT);
// HTextRender.oriRender(g, UnitManager.getUseHeroInfo()[focus].getAttack(), 546, 382, HTextRender.LEFT);
//
// str = UnitManager.getUseHeroInfo()[focus].getPresent();
// for (var i = 0; i < str.length; i++) {
// HTextRender.oriRender(g, str[i], 257, 455 + (i * 22), HTextRender.LEFT);
// }
} else {
// g.setFont(FONT_24);
// g.setColor(COLOR_YELLOW);
// HTextRender.oriRender(g, "EMPTY", 455, 219, HTextRender.CENTER);
// g.setFont(FONT_19);
// g.setColor(COLOR_WHITE);
// HTextRender.oriRender(g, "EMPTY", 546, 282, HTextRender.LEFT);
// HTextRender.oriRender(g, "EMPTY", 546, 332, HTextRender.LEFT);
// HTextRender.oriRender(g, "EMPTY", 546, 382, HTextRender.LEFT);
//
// HTextRender.oriRender(g, "EMPTY", 257, 455, HTextRender.LEFT);
}
for (var i = 0; i < 6; i++) {
if (i < UnitManager.getUseHeroInfo().length) {
if (UnitManager.getUseHeroInfo()[i].getUsed()) {
// g.drawImage(selectBox, 681 + ((i % 3) * 115), 249 + Math.floor(i / 3) * 116);
g.drawImage(selectBox, popX + 107 + (i * 70), popY - 24);
}
}
}
if (isMenu) {
g.drawImage(button_exit_on[Math.floor(frameCnt / 2 % 2) + 1], popX + 263, popY + 78);
} else {
g.drawImage(focusImg[frameCnt % 2], popX + 105 + (focus * 70), popY - 1);
}
for (var i = 0; i < 6; i++) {
if (i < UnitManager.getUseHeroInfo().length) {
// g.drawImage(myUnitIconImg[i], 686 + ((i % 3) * 115), 254 + Math.floor(i / 3) * 116);
g.drawImage(myUnitIconImg[i], popX + 111 + (i * 70), popY + 5);
// g.drawImage(type_s_Img[UnitManager.getUseHeroInfo()[i].getAttr()], 674 + ((i % 3) * 115), 246 + Math.floor(i / 3) * 116);
// for (var j = 0; j < 6; j++) {
// g.drawImage(starBack, 687 + ((i % 3) * 115) + (j * 15), 329 + Math.floor(i / 3) * 116);
// }
// for (var j = 0; j < UnitManager.getUseHeroInfo()[i].getExp(); j++) {
// g.drawImage(star, 687 + ((i % 3) * 115) + (j * 15), 329 + Math.floor(i / 3) * 116);
// }
}
}
};
this.setPosition = function(_x, _y) {
popX = _x;
popY = _y - 100;
};
var setFocus = function(_focus) {
focus = _focus;
};
return {
toString: function() {
return "SelectUnitPopup";
},
init: function(onload, callback) {
callbackfunc = callback;
focus = 0;
frameCnt = 0;
teamScore = 0;
isMenu = false;
for (var i = 0; i < UnitManager.getUseHeroInfo().length; i++) {
teamScore = teamScore + UnitManager.getUseHeroInfo()[i].getAttack();
}
setResource(onload);
},
start: function() {
},
run: function() {
frameCnt++;
UIMgr.repaint();
},
paint: function() {
// g.setColor(COLOR_POPUPBACK);
// g.fillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
g.drawImage(popup_monster_select, popX + 60, popY - 9);
g.drawImage(button_exit_on[0], popX + 263, popY + 78);
// numberFont.render(g, teamScore, 801, 198, 17, HTextRender.LEFT);
heroRender(g);
},
stop: function() {
selectBox = null;
myUnitIconImg = null;
myUnitImg = null;
focusImg = null;
popup_monster_select = null;
num = null;
numberFont = null;
button_exit_off = null;
button_exit_on = null;
star = null;
starBack = null;
typeImg = null;
type_s_Img = null;
iconImg = null;
iconAtk = null;
lvIconArr = null;
},
onKeyPressed: function(key) {
switch(key) {
case KEY_ENTER :
if (isMenu) {
PopupMgr.closeAllPopup();
} else {
if (UnitManager.getUseHeroInfo()[focus] != null) {
if (UnitManager.getUseHeroInfo()[focus].getUsed()) {
PopupMgr.openPopup(appMgr.getMessage0BtnPopup("이미 배치한 영웅입니다."), null, 1500);
return;
}
callbackfunc(INSTANCE, UnitManager.getUseHeroInfo()[focus]);
}
}
break;
case KEY_LEFT:
focus = HTool.getIndex(focus, -1, 6);
// if (focus % 3 <= 0) {
// setFocus(focus + 2);
// } else {
// setFocus(focus - 1);
// }
break;
case KEY_RIGHT:
focus = HTool.getIndex(focus, 1, 6);
// if (focus % 3 >= 2) {
// setFocus(focus - 2);
// } else {
// setFocus(focus + 1);
// }
break;
case KEY_UP:
isMenu = !isMenu;
// if (isMenu) {
// isMenu = false;
// if (Math.floor(focus / 3) <= 0) {
// setFocus(focus + 3);
// }
// } else {
// if (Math.floor(focus / 3) <= 0) {
// isMenu = true;
// } else {
// setFocus(focus - 3);
// }
// }
//
//// if (Math.floor(focus / 3) <= 0) {
//// setFocus(focus + 3);
//// } else {
//// setFocus(focus - 3);
//// }
break;
case KEY_DOWN:
isMenu = !isMenu
// if (isMenu) {
// isMenu = false;
//
// if (Math.floor(focus / 3) >= 1) {
// setFocus(focus - 3);
// }
// } else {
// if (Math.floor(focus / 3) >= 1) {
// isMenu = true;
// } else {
// setFocus(focus + 3);
// }
// }
//
//
//// if (Math.floor(focus / 3) >= 1) {
//// setFocus(focus - 3);
//// } else {
//// setFocus(focus + 3);
//// }
break;
}
},
onKeyReleased: function(key) {
switch(key) {
case KEY_ENTER :
break;
}
},
getInstance: function() {
return INSTANCE;
}
};
};
|
export default {
home: 'Home',
login: 'Login',
params: 'Params',
task_pool: 'Task Pool',
sys_monitor: 'System Monitor',
data_monitor: 'Data Monitor',
// cache_monitor: 'Cache Monitor',
// equip_monitor: 'Equip Monitor',
// thread_monitor: 'Thread Monitor',
repo:'Repo',
tree_repo:'Sitch Repo',
db_repo:'Db Repo',
file_repo:'File Repo',
db_edit_repo:'编辑数据库资源库',
file_edit_repo:'编辑文件库资源库',
business:'Business',
busi_db:'Busi DB',
busi_db_edit:'DB Edit',
busi_dict_edit:'Dict Edit',
busi_dict:'Busi Dict',
task:'Task',
task_job:'Job Task',
add_job:'Add Job',
edit_job:'Edit Job',
copy_job:'Copy Job',
create_job:'Create Job',
detail_job:'Detail Job',
add_trans:'Add Trans',
edit_trans:'Edit Trans',
copy_trans:'Copy Trans',
create_trans:'Create Trans',
detail_trans:'Detail Trans',
task_trans:'Trasn Task',
params_job:'Params Job',
params_trans:'Trans Job',
scheduler:'Scheduler',
job_run:'Job Run',
trans_run:'Trans Run',
scheduler_manager:'Scheduler Manager',
scheduler_trans:'Trans Scheduler',
log_etl:'Log Manage',
log_page:'Log Page',
log_login:'Login Page',
log_operate:'Operate Page',
// cluster_page:'CLUSTER',
// node_page:'Node Page',
// carte_page:'Carte Page',
system:'System',
// system_user_page:'User',
// system_role_page:'Role',
// system_permission_page:'Permission',
help:'Help',
warning:'Warning',
help_db_page:'Druid',
help_cron_page:'Cron',
help_json_page:'Json'
}
|
import dynamic from 'next/dynamic'
import styles from '../styles/Home.module.css'
import { Container, Row, Col, Navbar, Nav, NavDropdown, Form, FormControl, Button } from 'react-bootstrap'
const MenuBlog = dynamic(() =>
import('../components/MenuBlog').then((mod) => mod.MenuBlog)
)
const TituloBlog = dynamic(() =>
import('../components/TituloBlog').then((mod) => mod.TituloBlog)
)
export function BannerPrincipal() {
return (
<Row className={styles["banner-principal"]}>
<Col className="col-sm-4" >
<div className={styles['banner-principal__logo']}>
<img></img>
</div>
</Col>
<Col className={styles['banner-principal__titulo-blog']}>
<Row>
<Col className="col-sm-12">
<MenuBlog></MenuBlog>
</Col>
</Row>
<Row>
<Col className="col-sm-12">
<TituloBlog></TituloBlog>
</Col>
</Row>
</Col>
</Row>
)
}
|
import React from 'react';
import { Modal } from 'antd';
import { useSelector, useDispatch } from 'react-redux';
import { TOGGLE_REGISTER } from '../../actions/types';
import RegisterForm from './RegisterForm';
const index = () => {
const dispatch = useDispatch();
const isVisible = useSelector(state => state.overlays.isRegister);
return (
<Modal
title="Register"
visible={isVisible}
onOk={() => dispatch({ type: TOGGLE_REGISTER, payload: false })}
onCancel={() => dispatch({ type: TOGGLE_REGISTER, payload: false })}
footer={null}
zIndex={1100}
>
<RegisterForm />
</Modal>
);
};
export default index;
|
module.exports = {
mongoURI: process.env.MONGODB_URI,
cookieKey: process.env.COOKIE_KEY,
apiKey: process.env.MASHAPE_KEY,
apiHost: process.env.MASHAPE_HOST,
googleClientID: process.env.GOOGLE_CLIENT_ID,
googleClientSecret: process.env.GOOGLE_CLIENT_SECRET,
googleCallbackURL: process.env.GOOGLE_CALLBACK_URL,
JWT_Secret: 'qweasdhtedsfasd'
};
|
/**
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
goog.provide('audioCat.state.effect.field.GradientField');
goog.require('audioCat.state.effect.field.EventType');
goog.require('audioCat.state.effect.field.Field');
goog.require('audioCat.state.effect.field.FieldCategory');
/**
* A generic field for a value that is continuous and thus takes values along a
* gradient of values.
* @param {string} name The name of the field.
* @param {string} description The description of the field.
* @param {string} units The string for labelling units for this field, ie dB
* or s. Could be an empty string.
* @param {number} min The min value.
* @param {number} max The max value.
* @param {number} decimalPlaces How many decimal places to round values to for
* display.
* @param {number} defaultValue The default value.
* @param {number=} opt_initialValue The optional initial value if different
* from the default value.
* @constructor
* @extends {audioCat.state.effect.field.Field}
*/
audioCat.state.effect.field.GradientField = function(
name,
description,
units,
min,
max,
decimalPlaces,
defaultValue,
opt_initialValue) {
goog.base(this, name, description, units,
audioCat.state.effect.field.FieldCategory.GRADIENT);
/**
* The number of decimal places to round values to for display.
* @private {number}
*/
this.decimalPlaces_ = decimalPlaces;
/**
* The min value for the field. Not enforced by this class.
* @private {number}
*/
this.min_ = min;
/**
* The max value for the field. Not enforced by this class.
* @private {number}
*/
this.max_ = max;
/**
* The default value.
* @private {number}
*/
this.defaultValue_ = defaultValue;
/**
* The value for the field.
* @private {number}
*/
this.value_ = goog.isDef(opt_initialValue) ? opt_initialValue : defaultValue;
};
goog.inherits(audioCat.state.effect.field.GradientField,
audioCat.state.effect.field.Field);
/**
* @return {number} The number of decimal places to round values to for display.
*/
audioCat.state.effect.field.GradientField.prototype.getDecimalPlaces =
function() {
return this.decimalPlaces_;
};
/**
* @return {number} The minimum value allowed.
*/
audioCat.state.effect.field.GradientField.prototype.getMin = function() {
return this.min_;
};
/**
* @return {number} The maximum value allowed.
*/
audioCat.state.effect.field.GradientField.prototype.getMax = function() {
return this.max_;
};
/**
* @return {number} The default value of the field.
*/
audioCat.state.effect.field.GradientField.prototype.getDefaultValue =
function() {
return this.defaultValue_;
};
/**
* @return {number} The value of the field.
*/
audioCat.state.effect.field.GradientField.prototype.getValue = function() {
return this.value_;
};
/**
* Sets the value of the field.
* @param {number} value The new value of the field.
* @param {boolean=} opt_stableChange Whether this change is a change in the
* stable value of the field. Defaults to false.
*/
audioCat.state.effect.field.GradientField.prototype.setValue = function(
value, opt_stableChange) {
this.value_ = value;
this.dispatchEvent(audioCat.state.effect.field.EventType.FIELD_VALUE_CHANGED);
if (opt_stableChange) {
this.dispatchEvent(
audioCat.state.effect.field.EventType.FIELD_STABLE_VALUE_CHANGED);
}
};
|
/* jshint expr: true, quotmark: false */
/* globals it, describe, before, afterEach */
'use strict';
var expect = require('chai').expect;
var nock = require('nock');
var azureQueue = require('../index');
//nock.recorder.rec();
describe('default client', function() {
var client;
before(function(){
client = azureQueue.setDefaultClient({
retry: {
firstDelay: 100 // normal delay would be too long to wait
}
});
});
afterEach(function(){
nock.cleanAll();
});
it('should retry the create testqueue when receiving error', function(done) {
var azure = nock('http://127.0.0.1:10001')
.put('/devstoreaccount1/testqueue2')
.reply(500, '<?xml version="1.0" encoding="utf-8"?><Error><Code>OutOfRangeQueryParameterValue</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' })
.put('/devstoreaccount1/testqueue2')
.reply(412, '<?xml version="1.0" encoding="utf-8"?><Error><Code>ETIMEDOUT</Code><Message>SomeError2</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' })
.put('/devstoreaccount1/testqueue2')
.reply(201, "", { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' });
client.createQueue('testqueue2', function(err, data) {
expect(err).to.be.null;
expect(data).to.be.true;
expect(azure.isDone()).to.be.true;
done();
});
});
it('should return error when all retries are erroring', function(done) {
var azure = nock('http://127.0.0.1:10001')
.put('/devstoreaccount1/testqueue2')
.reply(501, '<?xml version="1.0" encoding="utf-8"?><Error><Code>Error</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' })
.put('/devstoreaccount1/testqueue2')
.reply(412, '<?xml version="1.0" encoding="utf-8"?><Error><Code>EADDRINUSE</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' })
.put('/devstoreaccount1/testqueue2')
.reply(503, '<?xml version="1.0" encoding="utf-8"?><Error><Code>OtherError</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' })
.put('/devstoreaccount1/testqueue2')
.reply(400, '<?xml version="1.0" encoding="utf-8"?><Error><Code>ECONNRESET</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' });
client.createQueue('testqueue2', function(err, data) {
expect(err).to.not.be.null;
expect(err.retriesMade).to.be.equal(3);
expect(data).to.be.undefined;
expect(azure.isDone()).to.be.true;
done();
});
});
});
describe('client with retry disabled', function() {
var client;
before(function(){
client = azureQueue.createClient({
retry: false
});
});
afterEach(function(){
nock.cleanAll();
});
it('should return error to requester after first error', function(done) {
var azure = nock('http://127.0.0.1:10001')
.put('/devstoreaccount1/testqueue2')
.reply(503, '<?xml version="1.0" encoding="utf-8"?><Error><Code>Error</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' });
client.createQueue('testqueue2', function(err, data) {
expect(err).to.not.be.null;
expect(data).to.be.undefined;
expect(azure.isDone()).to.be.true;
done();
});
});
});
describe('client with custom retry options', function() {
var client;
before(function(){
client = azureQueue.createClient({
retry: {
retries: 1,
firstDelay: 50,
nextDelayMult: 1,
variability: 0,
transientErrors: [502]
}
});
});
afterEach(function(){
nock.cleanAll();
});
it('should return error immediately if it is not a transient one', function(done) {
var azure = nock('http://127.0.0.1:10001')
.put('/devstoreaccount1/testqueue2')
.reply(503, '<?xml version="1.0" encoding="utf-8"?><Error><Code>Error</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' });
client.createQueue('testqueue2', function(err, data) {
expect(err).to.not.be.null;
expect(data).to.be.undefined;
expect(azure.isDone()).to.be.true;
done();
});
});
it('should make only one retry', function(done) {
var azure = nock('http://127.0.0.1:10001')
.put('/devstoreaccount1/testqueue2')
.reply(502, '<?xml version="1.0" encoding="utf-8"?><Error><Code>Error</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' })
.put('/devstoreaccount1/testqueue2')
.reply(502, '<?xml version="1.0" encoding="utf-8"?><Error><Code>Error2</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' })
client.createQueue('testqueue2', function(err, data) {
expect(err).to.not.be.null;
expect(err).to.have.property('code', 'Error2');
expect(err).to.have.property('retriesMade', 1);
expect(data).to.be.undefined;
expect(azure.isDone()).to.be.true;
done();
});
});
it('should start counting retries again in next request', function(done) {
var azure = nock('http://127.0.0.1:10001')
.put('/devstoreaccount1/testqueue2')
.reply(502, '<?xml version="1.0" encoding="utf-8"?><Error><Code>Error</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' })
.put('/devstoreaccount1/testqueue2')
.reply(502, '<?xml version="1.0" encoding="utf-8"?><Error><Code>Error2</Code><Message>SomeError</Message></Error>', { 'transfer-encoding': 'chunked',
server: 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id': '34ecf932-5706-43ca-83a9-eecdce111c3f',
'x-ms-version': '2014-02-14',
date: 'Wed, 02 Jul 2014 09:08:07 GMT' })
client.createQueue('testqueue2', function(err, data) {
expect(err).to.not.be.null;
expect(err).to.have.property('code', 'Error2');
expect(err).to.have.property('retriesMade', 1);
expect(data).to.be.undefined;
expect(azure.isDone()).to.be.true;
done();
});
});
});
|
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
inputValue: "", //搜索框输入的值
// 页面配置
winWidth: 0,
winHeight: 0,
// tab切换
currentTab: 0,
isHideLoadMore: false,
hasRefesh: false,
hidden: false,
zhinengtuijiandata: [],
jianglizuigaodata: [],
youhuizuidadata: [],
xiaoliangzuigaodata: [],
zhinengtuijianpage: 1,
jianglizuigaopage: 1,
youhuizuidapage: 1,
xiaoliangzuigaopage: 1
},
//获取输入框的输入信息
bindInput: function(e) {
this.setData({
inputValue: e.detail.value
})
},
//清楚输入框数据
clearInput: function() {
this.setData({
inputValue: ""
})
},
//搜索
setSearchStorage: function() {
//let data;
var that = this;
console.log(that.data.currentTab)
if (that.data.currentTab == 0) {
that.zhinengtuijiansearch();
} else if (that.data.currentTab == 1) {
that.jianglizuigaosearch();
} else if (that.data.currentTab == 2) {
that.youhuizuidasearch();
} else if (that.data.currentTab == 3) {
that.xiaoliangzuigaosearch();
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
var that = this;
wx.getSystemInfo({
success: function(res) {
that.setData({
winWidth: res.windowWidth,
winHeight: res.windowHeight
});
}
});
var keyword = options.keyword;
that.setData({
inputValue: keyword
})
that.zhinengtuijiansearch();
// console.log(keyword)
},
onShareAppMessage: function(res) {
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: '【@我】快来使用云云实惠购',
path: '/pages/login/login',
imageUrl: ''
}
},
// 滑动切换tab
bindChange: function(e) {
var that = this;
that.setData({
currentTab: e.detail.current
});
var tabindexs = e.detail.current;
// console.log(tabindexs);
if (tabindexs == 0) {
that.zhinengtuijiansearch();
} else if (tabindexs == 1) {
that.jianglizuigaosearch();
} else if (tabindexs == 2) {
that.youhuizuidasearch();
} else if (tabindexs == 3) {
that.xiaoliangzuigaosearch();
}
},
// 点击tab切换
swichNav: function(e) {
var that = this;
if (this.data.currentTab === e.target.dataset.current) {
return false;
} else {
that.setData({
currentTab: e.target.dataset.current
})
var tabindex = e.target.dataset.current;
// console.log(tabindex);
if (tabindex == 0) {
that.zhinengtuijiansearch();
} else if (tabindex == 1) {
that.jianglizuigaosearch();
} else if (tabindex == 2) {
that.youhuizuidasearch();
} else if (tabindex == 3) {
that.xiaoliangzuigaosearch();
}
}
},
//点击跳转到商品详情
bindViewTap: function(e) {
var productId = e.currentTarget.dataset.id;
// console.log(productId);
// console.log(that.data.banner)
wx.navigateTo({
url: '../pinpagedetail/pinpagedetail?productId=' + productId
});
// console.log(productId)
},
//智能推荐
zhinengtuijiansearch: function(e) {
var that = this;
//请求搜索
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: 1,
pageSize: 10,
sortType: 0,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
// console.log(res)
if (res.data.result.length < 10) {
that.setData({
nulldata: true
})
}
that.setData({
zhinengtuijiandata: res.data.result,
hidden: true
})
},
fail: function(res) {
console.log(res)
},
})
},
//智能推荐商品上拉加载更多
zhinengtuijianloadMore: function(e) {
setTimeout(() => {
// console.log('加载更多')
var that = this;
var pageRows = 10;
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: ++that.data.zhinengtuijianpage,
pageSize: 10,
sortType: 0,
withCoupon: false
},
header: {},
method: 'GET',
success: function(res) {
// console.log(res.data);
if (res.statusCode == 200) {
if (res.data.result == '') {
that.setData({
nulldata: true
})
}
// console.log(res.data.result)
that.setData({
zhinengtuijiandata: that.data.zhinengtuijiandata.concat(res.data.result),
isHideLoadMore: false,
hidden: true,
hasRefesh: false,
});
}
console.log(that.data.zhinengtuijianpage)
}
})
}, 1000)
},
//智能推荐商品下拉刷新
zhinengtuijianrefesh: function(e) {
// console.log('加载更多')
var that = this;
that.setData({
hasRefesh: true,
});
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: 1,
pageSize: 10,
sortType: 0,
withCoupon: false
},
header: {},
method: 'GET',
success: function(res) {
// console.log(res.data);
if (res.statusCode == 200) {
// console.log(res.data)
// console.log(res.data.result)
// console.log(res.data.result.length)
var PIC = res.data.result;
that.setData({
zhinengtuijiandata: PIC,
zhinengtuijianpage: 1,
hasRefesh: false,
hidden: true,
});
// console.log(that.data.page)
// console.log(PIC)
}
}
})
},
//奖励最高
jianglizuigaosearch: function(e) {
var that = this;
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: 1,
pageSize: 10,
sortType: 2,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
// console.log(res)
if (res.data.result.length < 9) {
that.setData({
jianglizuigaonulldata: true
})
}
that.setData({
jianglizuigaodata: res.data.result,
hidden: true
})
},
fail: function(res) {
console.log(res)
},
})
},
//奖励最高商品上拉加载更多
jianglizuigaoloadMore: function(e) {
setTimeout(() => {
// console.log('加载更多')
var that = this;
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: ++that.data.jianglizuigaopage,
pageSize: 10,
sortType: 2,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
// console.log(res)
if (res.statusCode == 200) {
if (res.data.result == '') {
that.setData({
jianglizuigaonulldata: true
})
}
// console.log(res.data.result)
that.setData({
jianglizuigaodata: that.data.jianglizuigaodata.concat(res.data.result),
isHideLoadMore: false,
hidden: true,
hasRefesh: false,
});
}
console.log(that.data.jianglizuigaopage)
},
fail: function(res) {
console.log(res)
}
})
}, 1000)
},
//奖励最高商品下拉刷新
jianglizuigaorefesh: function() {
var that = this;
that.setData({
hasRefesh: true,
});
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: 1,
pageSize: 10,
sortType: 2,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
if (res.statusCode == 200) {
var PIC = res.data.result;
that.setData({
jianglizuigaodata: PIC,
jianglizuigaopage: 1,
hasRefesh: false,
hidden: true,
});
}
}
})
},
//优惠最大
youhuizuidasearch: function(e) {
var that = this;
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: 1,
pageSize: 10,
sortType: 8,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
// console.log(res)
if (res.data.result.length < 9) {
that.setData({
youhuizuidanulldata: true
})
}
that.setData({
youhuizuidadata: res.data.result,
hidden: true
})
},
fail: function(res) {
console.log(res)
},
})
},
//优惠最大商品上拉加载更多
youhuizuidaloadMore: function(e) {
setTimeout(() => {
// console.log('加载更多')
var that = this;
var pageRows = 10;
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: ++that.data.youhuizuidapage,
pageSize: 10,
sortType: 8,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
// console.log(res)
if (res.statusCode == 200) {
if (res.data.result == '') {
that.setData({
youhuizuidanulldata: true
})
}
// console.log(res.data.result)
that.setData({
youhuizuidadata: that.data.youhuizuidadata.concat(res.data.result),
isHideLoadMore: false,
hidden: true,
hasRefesh: false,
});
}
console.log(that.data.youhuizuidapage)
},
fail: function(res) {
console.log(res)
}
})
}, 1000)
},
//优惠最大商品下拉刷新
youhuizuidarefesh: function() {
var that = this;
that.setData({
hasRefesh: true,
});
var pageRows = 10;
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: 1,
pageSize: 10,
sortType: 8,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
if (res.statusCode == 200) {
var PIC = res.data.result;
that.setData({
youhuizuidadata: PIC,
youhuizuidapage: 1,
hasRefesh: false,
hidden: true,
});
}
}
})
},
//销量最高
xiaoliangzuigaosearch: function(e) {
var that = this;
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: 1,
pageSize: 10,
sortType: 6,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
// console.log(res)
if (res.data.result.length < 9) {
that.setData({
xiaoliangzuigaonulldata: true
})
}
that.setData({
xiaoliangzuigaodata: res.data.result,
hidden: true
})
},
fail: function(res) {
console.log(res)
},
})
},
//销量最高商品上拉加载更多
xiaoliangzuigaoloadMore: function(e) {
setTimeout(() => {
// console.log('加载更多')
var that = this;
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: ++that.data.xiaoliangzuigaopage,
pageSize: 10,
sortType: 6,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
// console.log(res)
if (res.statusCode == 200) {
// console.log(res.data.result)
if (res.data.result == '') {
that.setData({
xiaoliangzuigaonulldata: true
})
}
that.setData({
xiaoliangzuigaodata: that.data.xiaoliangzuigaodata.concat(res.data.result),
isHideLoadMore: false,
hidden: true,
hasRefesh: false,
});
}
console.log(that.data.xiaoliangzuigaopage)
},
fail: function(res) {
console.log(res)
}
})
}, 1000)
},
//销量最高商品下拉刷新
xiaoliangzuigaorefesh: function() {
var that = this;
that.setData({
hasRefesh: true,
});
wx.request({
url: app.globalData.pinduoduogoodurl,
data: {
keyword: that.data.inputValue.trim(),
page: 1,
pageSize: 10,
sortType: 6,
withCoupon: false
},
header: {},
method: 'GET',
dataType: '',
success: function(res) {
if (res.statusCode == 200) {
var PIC = res.data.result;
that.setData({
xiaoliangzuigaodata: PIC,
xiaoliangzuigaopage: 1,
hasRefesh: false,
hidden: true,
});
}
}
})
},
})
|
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
const style = {
alignItems: 'center',
width: '100vw',
height: '100vh',
display: 'flex',
justifyContent: 'center'
};
ReactDOM.render(
<MuiThemeProvider>
<div className="app" style={style}>
<App/>
</div>
</MuiThemeProvider>,
document.getElementById('root'));
|
(function () {
"use strict";
function GameArea(convasX, convasY, width, height, statusAreaWidth, componentFactory, drawer) {
this.x = convasX;
this.y = convasY;
this.drawer = drawer;
this.width = width;
this.height = height;
this.statusAreaWidth = statusAreaWidth;
this.componentFactory = componentFactory;
this.basicLength = width / 10; // the length of the smallest building block
this.componentNo = -1;
this.borderColor = 'white';
this.seperatorColor = '#d3d3d3';
// coordinates for the game first index; 0 not taken, 1 taken, 2 tetris
// second index: 0 not border, 1 border
(() => {
let matrix = [];
for (let i = convasX; i < convasX + width; i++) {
let matrixInner = [];
for (let j = convasY; j < convasY + height; j++) {
matrixInner.push([0, 0]);
}
matrix.push(matrixInner);
}
this.matrix = matrix;
})();
}
GameArea.prototype.initComponent = function () {
this.componentNo = this.componentNo === -1 ? getRandomInt(0, 6) : this.componentNo;
let x = this.x + this.width / 2;
let y = this.y;
this.component = this.componentFactory.initComponent(this.componentNo, x, y);
};
GameArea.prototype.drawNextComponent = function () {
let textHeight = 140;
let height = textHeight + 20;
let x = this.x + this.width + this.statusAreaWidth / 3;
this.drawer.clearRect(
this.x + this.width + 1,
this.y + textHeight - 10,
this.statusAreaWidth,
this.height
);
this.drawer.fillText("Next: ", x, textHeight);
this.componentNo = getRandomInt(0, 6);
x = this.x + this.width + this.statusAreaWidth / 2;
let y = this.y + height;
let component = this.componentFactory.initComponentDrawing(this.componentNo, x, y);
component.coordinates.forEach((item) => {
if(item[2] === 0){
this.drawer.fillRect(item[0], item[1], 1, 1);
} else{
this.drawer.fillRect(item[0], item[1], 1, 1, this.borderColor);
}
});
};
GameArea.prototype.initCanvas = function () {
this.drawer.initCanvas();
this.drawSeperator();
};
GameArea.prototype.drawSeperator = function () {
let x = this.x + this.width;
let y = this.y;
let width = 1;
let height = this.y + this.height;
this.drawer.fillRect(x, y, width, height, this.seperatorColor);
};
GameArea.prototype.clearCanvas = function () {
this.drawer.clearRect(this.x, this.y, this.width, this.height);
};
GameArea.prototype.drawComponent = function () {
this.component.coordinates.forEach((item) => {
if(item[2] === 0){
this.drawer.fillRect(item[0], item[1], 1, 1);
} else{
this.drawer.fillRect(item[0], item[1], 1, 1, this.borderColor);
}
});
};
GameArea.prototype.eraseComponent = function () {
// this.context.fillStyle = this.color;
this.component.coordinates.forEach((item)=>{
this.drawer.clearRect(item[0], item[1], 1, 1);
})
};
GameArea.prototype.transformComponent = function () {
if (this.component.done) return;
this.eraseComponent();
// -1 because canvas starts from 1 but matrix from 0
let boundaryLeft = this.x;
let boundaryRight = this.x + this.width - 1;
let bottomY = this.y + this.height - 1;
this.component.transform(boundaryLeft, boundaryRight, bottomY, this.matrix);
this.drawComponent();
};;
GameArea.prototype.updateComponent = function () {
let bottomY = this.y + this.height - 1;
this.component.update(bottomY, this.matrix);
};
GameArea.prototype.changeCompHorizontalSpeed = function (speedX) {
if (this.component.done) return;
// -1 because canvas starts from 1 but matrix from 0
let boundaryLeft = this.x;
let boundaryRight = this.x + this.width - 1;
this.eraseComponent();
this.component.changeHorizontalSpeed(speedX, this.matrix, boundaryLeft, boundaryRight)
this.drawComponent();
};
GameArea.prototype.reverseCompHorizontalSpeed = function () {
this.component.revertHorizontalSpeed();
};
GameArea.prototype.updateScoreBoard = function (score) {
let x = this.x + this.width + this.statusAreaWidth / 3;
let y = this.y;
let width = 100;
let height = 80;
this.drawer.clearRect(x, height - 10, width, 35);
this.drawer.fillText('Score: ', x, height);
this.drawer.fillText(score, x + 10, height + 20);
};
GameArea.prototype.updateLevel= function (level) {
let x = this.x + this.width + this.statusAreaWidth / 3;
let y = this.y;
let width = 100;
let height = 30;
this.drawer.clearRect(x, height - 10, width, 35);
this.drawer.fillText('Level: ', x, height);
this.drawer.fillText(level, x + 10, height + 20);
};
GameArea.prototype.isComponentDone = function () {
return this.component.done;
};
GameArea.prototype.isGameOver = function () {
return this.component.isGameOver(this.y);
};
GameArea.prototype.updateMatrix = function () {
this.component.coordinates.forEach((item) => {
// 1 means taken
this.matrix[item[0]][item[1]][0] = 1;
this.matrix[item[0]][item[1]][1] = item[2];
});
};
GameArea.prototype.checkTetris = function () {
// mark tetrix states
let topCoord = this.component.getTopLeftCoord();
let topCoordY = topCoord[1];
let lowerBound = topCoordY + this.component.height;
let shouldUpdateRest = false;
// loop through the Ys
for (let i = topCoordY; i < lowerBound; i ++) {
let matrixlength = this.matrix.length;
let tetris = true;
for (let j = 0; j < matrixlength; j++) {
if (this.matrix[j][i][0] === 0) {
tetris = false;
break;
}
}
if (tetris) {
this.score++;
shouldUpdateRest = true;
for (let j = 0; j < matrixlength; j++) {
this.matrix[j][i][0] = 2;
}
}
}
return shouldUpdateRest;
};
GameArea.prototype.updateTetris = function () {
// update the rest of matrix
let lines = 0;
let matrixBottom = this.matrix[0].length - 1; // -1 because matrix height starts from 0 not 1
let matrixLength = this.matrix.length;
for (let i = matrixBottom; i >= 0; i--) {
if (this.matrix[0][i][0] === 2) {
lines++;
// update all to 0
for (let j = 0; j < matrixLength; j++) {
this.matrix[j][i][0] = 0;
}
} else {
if (lines > 0) {
// update new pos by lines
for (let j = 0; j < matrixLength; j++) {
let originalVal = this.matrix[j][i][0];
let originalBorder = this.matrix[j][i][1];
this.matrix[j][i][0] = 0;
this.matrix[j][i + lines][0] = originalVal;
this.matrix[j][i + lines][1] = originalBorder;
}
}
}
}
let score = lines / this.basicLength * 10;
return score;
};
GameArea.prototype.redrawMatrix = function () {
let matrixLength = this.matrix.length;
let matrixHeight = this.matrix[0].length;
for (let i = 0; i < matrixLength; i++) {
for (let j = 0; j < matrixHeight; j++) {
if (this.matrix[i][j][0] === 1) {
if(this.matrix[i][j][1] === 0){
this.drawer.fillRect(i, j, 1, 1);
} else {
this.drawer.fillRect(i, j, 1, 1, this.borderColor);
}
}
}
}
};
GameArea.prototype.showTetrix = function () {
let matrixLength = this.matrix.length;
let matrixHeight = this.matrix[0].length;
for (let i = 0; i < matrixLength; i++) {
for (let j = 0; j < matrixHeight; j++) {
if (this.matrix[i][j][0] === 2) {
if(this.matrix[i][j][1] === 0) {
this.drawer.fillRect(i, j, 1, 1);
} else {
this.drawer.fillRect(i, j, 1, 1, this.borderColor);
}
}
}
}
};
GameArea.prototype.hideTetrix = function () {
let matrixLength = this.matrix.length;
let matrixHeight = this.matrix[0].length;
for (let i = 0; i < matrixLength; i++) {
for (let j = 0; j < matrixHeight; j++) {
if (this.matrix[i][j][0] === 2) {
this.drawer.clearRect(i, j, 1, 1);
}
}
}
};
GameArea.prototype.showTetrixEffects = function (ms) {
let msEach = ms / 6;
return new Promise((resolve, reject) => {
setTimeout(this.hideTetrix.bind(this), msEach);
setTimeout(this.showTetrix.bind(this), msEach * 2);
setTimeout(this.hideTetrix.bind(this), msEach * 3);
setTimeout(this.showTetrix.bind(this), msEach * 4);
setTimeout(this.hideTetrix.bind(this), msEach * 5);
setTimeout(() => {
this.showTetrix();
resolve();
}, msEach * 6);
});
};
GameArea.prototype.tetris = function () {
return this.checkTetris();
};
const getRandomInt = function(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
window.GameArea = GameArea || {};
})();
|
var inherits = require('util').inherits;
var debug = require('debug')('homebridge-logic');
module.exports = function (Service, Characteristic, CustomCharacteristic, CustomUUID) {
VariableAddTimerService = function(displayName, subtype) {
Service.call(this, displayName, CustomUUID.VariableAddTimerService, subtype);
this.addCharacteristic(CustomCharacteristic.VariableName);
this.addCharacteristic(CustomCharacteristic.TimerDays);
this.addCharacteristic(CustomCharacteristic.TimerHours);
this.addCharacteristic(CustomCharacteristic.TimerMinutes);
this.addCharacteristic(CustomCharacteristic.TimerSeconds);
this.addCharacteristic(CustomCharacteristic.VariableAdd);
};
inherits(VariableAddTimerService, Service);
CustomCharacteristic.TimerDays = function() {
Characteristic.call(this, '› Days', CustomUUID.TimerDaysCharacteristic);
this.setProps({
format: Characteristic.Formats.UINT8,
maxValue: 31,
minValue: 0,
minStep: 1,
perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE]
});
this.value = this.getDefaultValue();
}
inherits(CustomCharacteristic.TimerDays, Characteristic);
CustomCharacteristic.TimerHours = function() {
Characteristic.call(this, '› Hours', CustomUUID.TimerHoursCharacteristic);
this.setProps({
format: Characteristic.Formats.UINT8,
maxValue: 24,
minValue: 0,
minStep: 1,
perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE]
});
this.value = this.getDefaultValue();
}
inherits(CustomCharacteristic.TimerHours, Characteristic);
CustomCharacteristic.TimerMinutes = function() {
Characteristic.call(this, '› Minutes', CustomUUID.TimerMinutesCharacteristic);
this.setProps({
format: Characteristic.Formats.UINT8,
maxValue: 60,
minValue: 0,
minStep: 1,
perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE]
});
this.value = this.getDefaultValue();
}
inherits(CustomCharacteristic.TimerMinutes, Characteristic);
CustomCharacteristic.TimerSeconds = function() {
Characteristic.call(this, '› Seconds', CustomUUID.TimerSecondsCharacteristic);
this.setProps({
format: Characteristic.Formats.UINT8,
maxValue: 60,
minValue: 0,
minStep: 1,
perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE]
});
this.value = this.getDefaultValue();
}
inherits(CustomCharacteristic.TimerSeconds, Characteristic);
return VariableAddTimerService;
}
|
import { connect } from 'react-redux';
import SignUpForm from 'src/components/Pages/SignUpForm';
import {
handleNicknameInput,
handleEmailInput,
handlePasswordInput,
handleSignUpSubmit,
clearSignupState,
} from 'src/store/reducers/user';
const mapStateToProps = (state) => ({
signupSuccessMessage: state.user.signupSuccessMessage,
signupErrors: state.user.signupErrors,
emailInput: state.user.emailInput,
nicknameInput: state.user.nicknameInput,
passwordInput: state.user.passwordInput,
});
const mapDispatchToProps = (dispatch) => ({
handleNickname: (currentNickname) => {
dispatch(handleNicknameInput(currentNickname));
},
handleEmail: (currentEmail) => {
dispatch(handleEmailInput(currentEmail));
},
handlePassword: (currentPassword) => {
dispatch(handlePasswordInput(currentPassword));
},
handleSignUp: () => {
dispatch(handleSignUpSubmit());
},
clearSignup: () => {
dispatch(clearSignupState());
},
});
const SignUpFormContainer = connect(
mapStateToProps,
mapDispatchToProps,
)(SignUpForm);
export default SignUpFormContainer;
|
// allows you create array with already filled elements;
let scores = Array(10).fill(0);
// the have extra perimeters 0,3 = the element from 0 to 3 with the number 10
let scores2 = [10,2,3,4,5].fill(10,0,3);
console.log(scores2)
console.log(scores);
|
var MyApp = MyApp || {};
MyApp.wildifePreserveSomulator = function (animalMaker) {
//프라이빗 변수
var animals = [];
return {
addAnimal(species, sex) {
animals.push(animalMaker.make(species, sex));
},
getAnimalCount() {
return animals.length;
}
};
};
MyApp.singleWildlifePrserveSimulator = (function () {
var animals = [];
return {
addAnimal(animalMaker, specise, sex) {
animals.push(animalMaker.make(specise, sex));
},
getAnimalCount() {
return animals.length;
}
};
})();
var preserve = MyApp.wildifePreserveSomulator(realAnimalMaker);
preserve.addAnimal(gorilla, female);
MyApp.singleWildlifePrserveSimulator(realAnimalMaker, gorilla, female);
|
const url = 'http://localhost:3000/todos';
displayTodos();
const addTodoButton = document.querySelector('#addTodoButton');
addTodoButton.addEventListener('click', addTodo);
function getTodos() {
return fetch(url).then((res) => res.json());
}
function addTodo() {
const text = document.querySelector('#todoText').value;
const payload = { text, completed: false };
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
})
.then(() => displayTodos());
}
async function displayTodos() {
const todos = await getTodos();
const todosHtml = createTodosHtml(todos);
const section = document.querySelector('#todoList');
section.innerHTML = null;
section.append(todosHtml);
section.addEventListener('click', handleCheckboxClick);
}
function createTodosHtml(todos) {
const fragment = document.createDocumentFragment();
todos.forEach((todo) => {
const text = document.createElement('p');
text.innerHTML = todo.text;
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.checked = todo.completed;
checkbox.setAttribute('todoId', todo.id);
text.prepend(checkbox);
fragment.append(text);
});
return fragment;
}
function handleCheckboxClick(event) {
if (event.target.type !== 'checkbox') {
return;
}
const todoId = event.target.getAttribute('todoId')
fetch(`${url}/${todoId}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ completed: event.target.checked })
})
.then((res) => console.log(res))
}
|
import { createRouter, createWebHistory } from 'vue-router';
import CoachDetail from './pages/coaches/CoachDetail.vue';
import CoachesList from './pages/coaches/CoachesList.vue';
import CoachRegistration from './pages/coaches/CoachRegistration.vue';
import ContactCoach from './pages/requests/ContactCoach.vue';
import RequestsReceived from './pages/requests/RequestsReceived.vue';
import NotFound from './pages/NotFound.vue';
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', redirect: '/coaches' },
{ path: '/coaches', comment: CoachesList },
{
path: '/coaches:id',
comment: CoachDetail,
children: [{ path: 'contact', component: ContactCoach }],
},
{ path: '/register', comment: CoachRegistration },
{ path: '/requests', comment: RequestsReceived },
{ path: '/:notFound(.*)', comment: NotFound },
],
});
export default router;
|
import {NAME} from './constants';
import saga from './saga';
import {start, TICK, tick} from "./actions";
export default {
NAME,
saga,
start,
TICK,
tick,
};
|
import React, {Component} from 'react'
import Breadcrumb from './Breadcrumb'
import RightNav from './TopNav'
import RepoCharts from './RepoCharts'
import List from './List'
import '../../../stylesheets/finding-repos.css'
export default class Index extends Component {
static contextTypes = {
router: React.PropTypes.object
}
render() {
var searchParams = new URLSearchParams(this.context.router.history.location.search);
var {ownerType, scanType, group,} = this.props.match.params;
var {path} = this.props.match;
var repoId = searchParams.get("repoId");
var severity = searchParams.get("severity");
return (
<div class="page-wrapper">
<RightNav ownerType={ownerType} scanType={scanType} repoId={repoId} group={group} path={path}/>
<Breadcrumb ownerType={ownerType} scanType={scanType} repoId={repoId} group={group} pageTitle={"Severity Findings"}/>
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="card top-buffer">
<div class="card-body">
<List ownerType={ownerType} scanType={scanType} repoId={repoId} group={group} severity={severity}/>
</div>
</div>
</div>
</div>
</section>
</div>
)
}
}
|
// Files to cache
var cacheName = 'ginkoCache-v1';
var appShellFiles = [
'',
'index.html',
'app.js',
'style.css',
'icons/favicon.ico',
'icons/icon-32.png',
'icons/icon-64.png',
'icons/icon-96.png',
'icons/icon-128.png',
'icons/icon-168.png',
'icons/icon-192.png',
'icons/icon-256.png',
'icons/icon-512.png',
'icons/maskable_icon.png'
];
// Installing Service Worker
self.addEventListener('install', function(e) {
console.log('[Service Worker] Install');
e.waitUntil(
caches.open(cacheName).then(function(cache) {
console.log('[Service Worker] Caching all: app shell and content');
return cache.addAll(appShellFiles);
})
);
});
// Fetching content using Service Worker
self.addEventListener('fetch', function(e) {
e.respondWith(
caches.match(e.request).then(function(r) {
console.log('[Service Worker] Fetching resource: '+e.request.url);
return r || fetch(e.request).then(function(response) {
return caches.open(cacheName).then(function(cache) {
console.log('[Service Worker] Caching new resource: ' + e.request.url);
cache.put(e.request, response.clone());
return response;
});
});
})
);
});
|
import {
GraphQLObjectType,
GraphQLString,
GraphQLID,
GraphQLList,
} from 'graphql';
import ClassType from './ClassType';
import RaceType from './RaceType';
const ProficiencyType = new GraphQLObjectType({
name: 'Proficiency',
description: 'The class you pick provides you with different proficiencies',
fields: () => ({
id: {
type: GraphQLID,
description: 'The proficiency id'
},
name: {
type: GraphQLString,
description: 'The proficiency name'
},
classes: {
type: new GraphQLList(ClassType),
description: 'List of classes that provide this proficiency'
},
// races: {
// type: new GraphQLList(RaceType),
// description: 'List of races that provide this proficiency'
// }
})
});
export default ProficiencyType;
|
exports.gen_salt_sync = function(num)
{
return '';
};
exports.encrypt_sync = function(password,salt)
{
return password;
};
exports.compare_sync = function(password,hashedPassword)
{
return password == hashedPassword;
};
|
//3
function hb(hbtn,cssname,offset){
var a,b,c,d;
d=$('.hbtn').offset().top; //元素相对于窗口的距离
console.log(d)
a=eval(d + offset);
b=$(window).scrollTop(); //监控窗口已滚动的距离;
c=$(window).height(); //浏览器窗口的高度
if(b+c>d+200){
$(('.hbtn')).addClass((cssname));
}
}
$(document).ready(function(e) {
$(window).scroll(function(){
hb(".hbtn",'hbt',500);
}
)
});
//4
function gdjz(box4,cssname,offset){
var a,b,c,d;
d=$('.box4').offset().top; //元素相对于窗口的距离
console.log(d)
a=eval(d + offset);
b=$(window).scrollTop(); //监控窗口已滚动的距离;
c=$(window).height(); //浏览器窗口的高度
if(b+c>d){
$(('.box4')).addClass((cssname));
}
}
$(document).ready(function(e) {
$(window).scroll(function(){
gdjz(".box4",'xz',500);
}
)
});
//5
function b5tn(b5lf,cssname,offset){
var a,b,c,d;
d=$('.b5lf').offset().top; //元素相对于窗口的距离
console.log(d)
a=eval(d + offset);
b=$(window).scrollTop(); //监控窗口已滚动的距离;
c=$(window).height(); //浏览器窗口的高度
if(b+c>d+200){
$(('.b5lf')).addClass((cssname));
}
}
$(document).ready(function(e) {
$(window).scroll(function(){
b5tn(".b5lf",'b5',500);
}
)
});
//5-1
function b5tn2(b5rt,cssname,offset){
var a,b,c,d;
d=$('.b5rt>img').offset().top; //元素相对于窗口的距离
console.log(d)
a=eval(d + offset);
b=$(window).scrollTop(); //监控窗口已滚动的距离;
c=$(window).height(); //浏览器窗口的高度
if(b+c>d+200){
$(('.b5rt>img')).addClass((cssname));
}
}
$(document).ready(function(e) {
$(window).scroll(function(){
b5tn2(".b5rt>img",'b5img',500);
}
)
});
//6
function b6tn(hbtn6,cssname,offset){
var a,b,c,d;
d=$('.hbtn6').offset().top; //元素相对于窗口的距离
console.log(d)
a=eval(d + offset);
b=$(window).scrollTop(); //监控窗口已滚动的距离;
c=$(window).height(); //浏览器窗口的高度
if(b+c>d+200){
$(('.hbtn6')).addClass((cssname));
}
}
$(document).ready(function(e) {
$(window).scroll(function(){
b6tn(".hbtn6",'hb6',500);
}
)
});
//7
function b7dh(box7,cssname,offset){
var a,b,c,d;
d=$('.box7').offset().top; //元素相对于窗口的距离
console.log(d)
a=eval(d + offset);
b=$(window).scrollTop(); //监控窗口已滚动的距离;
c=$(window).height(); //浏览器窗口的高度
if(b+c>d){
$(('.box7')).addClass((cssname));
}
}
$(document).ready(function(e) {
$(window).scroll(function(){
b7dh(".box7",'boxdh',500);
}
)
});
|
TEMP['notify'] = function(air){
window.Notification = window.Notification || window.webkitNotifications;
var notifiesLists=[];
//-------------------------------------notifyDesktop
var Desktoptimeing={};
var notifyND=0;
var notifyDesktop = function(option){
var defaultOptions={
id:"default"+notifyND++,
icon:"",
title:"",
text:"",
onclick:null,
autoFadeOut:air.Options.NotifyAutoFadeOutTime
};
option = $.extend(defaultOptions,option);
if(window.Notification){
if (!(window.Notification.permission == 'granted' || window.Notification.length>0)) {
RequestPermission(function(){
notifyDesktop(option);
});
}else {
try{
notifiesLists.push({
icon:option.icon,
title:option.title,
text:option.text
});
window._notification = new Notification(option.title,{body:option.text,icon:option.icon,tag:option.id});//,tag:title
_notification.onshow=function(){
console.log("try onshow");
if(Desktoptimeing[option.id]){
clearTimeout(Desktoptimeing[option.id]);
}
if(option.autoFadeOut)
Desktoptimeing[option.id] = setTimeout(function(){
console.log("try closing");
_notification.close();
Desktoptimeing[option.id]=null;
},option.autoFadeOut);
};
_notification.onclick=function(){
if(option.onclick){
option.onclick();
}
_notification.close();
};
}catch(e){
console.log(e);
}
}
}else{
console.log("Notification 未启用");
}
};
function RequestPermission(callback) {
window.Notification.requestPermission(callback);
}
//-------------------------------------notifyInwindow
var notifies={};
var notifyN=0;
var Localtimeing={};
var template = air.require("Templete").notifyLocalTemplate;
var notifyLocal = function(option){
var defaultOptions={
id:"default"+notifyN++,
icon:"",
title:"",
text:"",
onclick:null,
autoFadeOut:air.Options.NotifyAutoFadeOutTime
};
option = $.extend(defaultOptions,option);
option.text = option.text.replace("\n","<br />");
var o={
ID:option.id,
IMG:'<img src="'+option.icon+'" />',
TITLE:option.title,
TEXT:option.text
};
var tar = $(air.require("UI").substitute(template,o));
if($(".notify-"+option.id).length>0){
if(Localtimeing[option.id])clearTimeout(Localtimeing[option.id]);
$(".notify-"+option.id).remove();
}
notifiesLists.push({
icon:option.icon,
title:option.title,
text:option.text
});
air.Options.notifyContainer.prepend(tar);
if(option.autoFadeOut)
Localtimeing[option.id]=setTimeout(function(){tar.fadeOut(function(){$(this).remove();});},option.autoFadeOut);
tar.click(function(){
if(option.onclick){
option.onclick();
}
if(Localtimeing[option.id])
clearTimeout(Localtimeing[option.id]);
tar.fadeOut(function(){$(this).remove();});
});
};
//------------------------
var simpleNotify=function(icon,title,text,click){
var opt = {icon:icon,title:title,text:text,id:title.replace(" ",""),onclick:click};
if(air.Options.windowActive){
notifyLocal(opt);
}else{
notifyDesktop(opt);
}
};
var notify=function(opt){
if(air.Options.windowActive){
notifyLocal(opt);
}else{
notifyDesktop(opt);
}
};
//--------------------------
var alertNotify=function(title,text,click){
simpleNotify(air.Options.imagePath+"icon-alert.png",title,text,click);
};
var warningNotify=function(title,text,click){
simpleNotify(air.Options.imagePath+"icon-inf.png",title,text,click);
};
var removeNotify=function(id){
if($(".notify-"+id).length>0){
$(".notify-"+id).remove();
}
};
//------------------------------
var toastT=null;
var toast=function(text,time){
var time = time?time:1000;
if(toastT!=null){clearTimeout(toastT);}
$(".layout-toast-content").text(text);
$(".layout-toast").fadeIn(function(){
toastT = setTimeout(function(){
$(".layout-toast").fadeOut();
},time);
});
};
return {
toast:toast,
notifiesList:notifiesLists,
removeNotify:removeNotify,
notify:notify,
simpleNotify:simpleNotify,
notifyDesktop:notifyDesktop,
notifyLocal:notifyLocal,
alertNotify:alertNotify,
warningNotify:warningNotify
};
};
|
.pragma library
//血量坐标
/*
var bloodX = 0
var bloodY = 0
var bloodDX = 20
var bloodDy = 20
var Blood = 123
*/
var Z_ShouPai = 10
var Z_Player = 20
var Z_Line = 30
//延时
var Question_Choice_Time = 7000 //问题选择时间
var Question_ShowChoice_Time = 3000 //问题展示时间
var ChuPai_Time = 10000 //出牌时间,不能小于DELAY_TIME_COMPUTER
/*
function ClassPet() {
this.id = 0;
this.name = "爱宠"; //宠物名
this.pic = 1; //图片号,从1开始,0表示无此宠物或战斗时的不存在
//int ill; //0不忙,1为已选择过,2为生病
this.status = 1; //状态
//char level; //级别
this.exp = 1; //战斗经验
this.maxHP = 50; //血上限 //9999
this.remainHP = 50; //剩余血 //9999 0表示死亡或不存在(用这个判断)
this.attack = 10; //攻击 //999
this.defense = 10; //防御
this.speed = 5; //速度
this.luck = 5; //幸运
this.power = 5; //灵力
//五行
this.fiveProperty = [5,5,5,5,5];
//int fiveProperty[5]; //风攻|土攻|雷攻|水攻|火攻
this.attackProp = 0;
this.defentProp = 0;
this.propCount = [0,0,0,0,0];
}
*/
|
import React, {Component} from 'react';
/* renders chatbar - allows for TAB (preffered),
ENTER or 'click in chatbar-message(onBlur)' to trigger name change event*/
class ChatBar extends Component {
// a local state of username is set until event is triggered
state = { currentUser: this.props.currentUser }
// if user clicks ENTER this will also be event like BLUR events
changeNameOnEnter = (event) => {
if (event.key === 'Enter') {
this.changeNameOnBlur(event)
}
}
/* if user enters name and changes focus to 'cb-message' thru clicking in same or TAB
.... then event is passed to App ... unless empty then Anon is passed*/
changeNameOnBlur = (event) => {
this.props.changeName(event);
if(!event.target.value) this.setState({ currentUser: { name: 'Anon' } })
}
// changes username state as user types in name but it is now local until ENTER or BLUR event is triggered.
handleNameChange = (event) => {
const currentUser = { name: event.target.value }
this.setState({ currentUser });
}
render() {
return (
<footer className="chatbar">
<input
className="chatbar-username"
placeholder="Ur name and TAB to enter message (Optional)"
value={this.state.currentUser.name}
onKeyPress={this.changeNameOnEnter}
onBlur={this.changeNameOnBlur}
onChange={this.handleNameChange}
/>
<input
onKeyPress={this.props.postChat}
className="chatbar-message"
placeholder="Type a message and hit ENTER" />
</footer>
)
}
}
// eliminates validation errors on props (replaces react proptypes)
ChatBar.propTypes = {
postChat: function(obj) {
if(typeof obj === 'object') return null;
throw Error(`expecting an object but got ${typeof obj}`);
},
changeName: function(obj) {
if(typeof obj === 'object') return null;
throw Error(`expecting an object but got ${typeof obj}`);
},
}
export default ChatBar;
|
require('./bootstrap');
window.Vue = require('vue');
Vue.component('single-thread', require('./components/Thread.vue').default);
Vue.component('threads', require('./components/Threads.vue').default);
Vue.component('comments', require('./components/Comments.vue').default);
const app = new Vue({
el: '#app',
});
|
import React from 'react';
import BuyWidget from '../portfolio/BuyWidget';
import Allocation from '../portfolio/Allocation'
import { user_portfolio_value, fromStringtoDollar, user_usd_amount, user_ticker_quantity } from '../../util/transactions';
class Trade extends React.Component {
constructor(props){
super(props)
this.state = {
mode : 'Buy'
}
};
componentDidMount() {
this.props.getAssets();
this.props.fetchTransactions();
}
BuyorSellCrypto(ticker, amount_usd, exc_rate, ticker_quantity, type) {
const transaction = {
ticker: ticker,
price: exc_rate,
amount: ticker_quantity,
type: type
};
this.props.createTransaction(transaction);
};
render(){
const {assets, transactions} = this.props;
const {mode} = this.state;
return(
<div className='buy_and_sell_container'>
<div className='buy_and_recent_container'>
<div className='buy_widget_container'>
<div className='buy_and_sell'>
<div className='buy_sell_button_container'>
<button className='buy_sell_button' onClick={() => { this.setState({ mode: "Buy" }) }}>Buy</button>
<button className='buy_sell_button' onClick={() => this.setState({ mode: "Sell" })}>Sell</button>
</div>
<div className='crypto_list'>
{assets['BTC'] &&
<>
<BuyWidget
mode={mode}
available_usd={user_usd_amount(transactions)}
ticker_amount={user_ticker_quantity("BTC", transactions)}
BuyorSellCrypto={this.BuyorSellCrypto.bind(this)}
ticker='BTC'
conversion_rate={parseFloat(assets['BTC']['conversion']).toFixed(6)}
asset_name="Bitcoin"
ticker_value={fromStringtoDollar(assets['BTC']['USD']['PRICE'])}
/>
<BuyWidget
mode={mode}
available_usd={user_usd_amount(transactions)}
ticker_amount={user_ticker_quantity("ETH", transactions)}
BuyorSellCrypto={this.BuyorSellCrypto.bind(this)}
ticker='ETH'
conversion_rate={parseFloat(assets['ETH']['conversion']).toFixed(6)}
asset_name="Ethereum"
ticker_value={fromStringtoDollar(assets['ETH']['USD']['PRICE'])}
/>
<BuyWidget
mode={mode}
available_usd={user_usd_amount(transactions)}
ticker_amount={user_ticker_quantity("BCH", transactions)}
BuyorSellCrypto={this.BuyorSellCrypto.bind(this)}
ticker='BCH'
conversion_rate={parseFloat(assets['BCH']['conversion']).toFixed(6)}
asset_name="Bitcoin Cash"
ticker_value={fromStringtoDollar(assets['BCH']['USD']['PRICE'])}
/>
<BuyWidget
mode={mode}
BuyorSellCrypto={this.BuyorSellCrypto.bind(this)}
available_usd={user_usd_amount(transactions)}
ticker_amount={user_ticker_quantity("LTC", transactions)}
ticker='LTC'
conversion_rate={parseFloat(assets['LTC']['conversion']).toFixed(6)}
asset_name="Litecoin"
ticker_value={fromStringtoDollar(assets['LTC']['USD']['PRICE'])}
/>
<BuyWidget
mode={mode}
BuyorSellCrypto={this.BuyorSellCrypto.bind(this)}
available_usd={user_usd_amount(transactions)}
ticker_amount={user_ticker_quantity("EOS", transactions)}
ticker='EOS'
conversion_rate={parseFloat(assets['EOS']['conversion']).toFixed(6)}
asset_name="EOS"
ticker_value={fromStringtoDollar(assets['EOS']['USD']['PRICE'])}
/>
</>
}
</div>
</div>
</div>
<div className='allocation_table_container_trade'>
<table className='allocation_table_trade'>
<th className='table_header_trade'>
<th>Your Assets</th>
</th>
<Allocation assets={assets}
transactions={transactions}
assetname='Bitcoin'
ticker='BTC'
lower_ticker='btc'
img='http://www.thecoinface.com/assets/btc-8022fd53c251f18cb39cefede445f1c78a3b265989232f0bb46b9c4622e55a9e.png'
pieChart={this.state.data}
/>
<Allocation assets={assets}
transactions={transactions}
assetname='Ethereum'
ticker='ETH'
lower_ticker='btc'
img='http://www.thecoinface.com/assets/eth-99bf2102cc13a51bb226f931b8d0fa4c5b3ca9dc4179167e89d7ee3f677c3fdb.png'
pieChart={this.state.data}
/>
<Allocation
assets={assets}
transactions={transactions}
assetname='BitcoinCash'
ticker='BCH'
lower_ticker='bch'
img='http://www.thecoinface.com/assets/bch-03a53cc37436a99ba854e42df693fa52d92d88cbbce362fa217efd0e85be5e1f.png'
pieChart={this.state.data}
/>
<Allocation
assets={assets}
transactions={transactions}
assetname='Litecoin'
ticker='LTC'
lower_ticker='ltc'
img='http://www.thecoinface.com/assets/ltc-7160750bcbc115ac8a3229bc1120fb59e96a737d607a57b42fa8e2b092a14159.png'
pieChart={this.state.data}
/>
<Allocation
assets={assets}
transactions={transactions}
assetname='EOS'
ticker='EOS'
lower_ticker='eos'
img='https://dynamic-assets.coinbase.com/deaca3d47b10ed4a91a872e9618706eec34081127762d88f2476ac8e99ada4b48525a9565cf2206d18c04053f278f693434af4d4629ca084a9d01b7a286a7e26/asset_icons/1f8489bb280fb0a0fd643c1161312ba49655040e9aaaced5f9ad3eeaf868eadc.png'
pieChart={this.state.data}
/>
<tr className='usd_row'>
<td className='first_col'>
<div className='pic'><img src={`https://dynamic-assets.coinbase.com/3c15df5e2ac7d4abbe9499ed9335041f00c620f28e8de2f93474a9f432058742cdf4674bd43f309e69778a26969372310135be97eb183d91c492154176d455b8/asset_icons/9d67b728b6c8f457717154b3a35f9ddc702eae7e76c4684ee39302c4d7fd0bb8.png`} height='36' width='36' /></div>
<div className='crypto_name'>{`US Dollar`} <div className='symbol'>{`USD`}</div></div>
</td>
<td className='ticker_quant'>{'$ ' + parseFloat((user_usd_amount(transactions))).toFixed(2)}</td>
</tr>
</table>
</div>
</div>
<div className='FooterTrade'>
<div className='title_footer' to='/'>Cryptobase</div>
<div className='websites'>
<a className='Git' href="https://github.com/timscatterday">GitHub</a>
<a className='LinkedIn' href="https://www.linkedin.com/in/timothy-scatterday-09283067/">LinkedIn</a>
</div>
<div className='copyrightandnomics'>
<p class="copyright"> © 2020 CryptoBase by Tim Scatterday</p>
<div className='nomics'><a href="https://nomics.com">Crypto Market Cap & Pricing Data Provided By Nomics</a></div>
</div>
</div>
</div>
)
}
};
export default Trade;
|
const fetch = require('node-fetch');
const getSongSource = (songId) => {
return new Promise((resolve, reject) => {
fetch(`http://www.kuwo.cn/url?format=mp3&rid=${songId}&response=url&type=convert_url3&br=128kmp3&from=web`, {
headers: {
cookie: '_ga=GA1.2.1675613707.1589085909; _gid=GA1.2.1099796595.1589085909; Hm_lvt_cdb524f42f0ce19b169a8071123a4797=1589085909,1589087176; Hm_lpvt_cdb524f42f0ce19b169a8071123a4797=1589089377; kw_token=GJZXJFO04YH; _gat=1',
csrf: 'GJZXJFO04YH',
referer: 'http://www.kuwo.cn',
},
})
.then(res => res.json())
.then(json => {
if (json.code === 200) {
resolve({
songSource: json.url,
});
} else {
reject({ message: 'err' });
}
})
.catch(err => reject(err));
});
};
// 我欲成仙
// getSongSource(296348)
// .then(url => console.log(url))
// .catch(err => console.error(err));
module.exports = {
getSongSource
};
|
import service from './index';
export default {
get(url, data = {}) {
return service({
url: url,
method: 'get',
params: data,
});
},
post(url, data, params) {
return service({
url: url,
method: 'post',
data,
params: params,
});
},
};
|
var fs = require('fs');
var dir1 = 'C:/Users/JUAN JOSE/node/models';
var dir2 = 'C:/Users/JUAN JOSE/node/models/v1';
if(!fs.existsSync(dir1)){
fs.mkdirSync(dir1);
console.log("La primer carpeta se creo de forma correcta");
if(!fs.existsSync(dir2)){
fs.mkdirSync(dir2);
console.log("La segunda carpeta se creo de forma correcta");
}
}
|
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const yargs = require('yargs');
const { runUpdatePrompts, runInitPrompts } = require('./run-prompts');
const { checkProjectExists } = require('./helpers');
const pkg = require('../package.json');
const { log } = require('@js-lib/util');
const config = require('@js-lib/config');
const cli = require('../index.js');
log()
yargs
.usage('usage: jslib [options]')
.usage('usage: jslib <command> [options]')
.example('jslib new myproject', '新建一个项目 myproject')
.alias("h", "help")
.alias("v", "version")
.command(['new', 'n'], '新建一个项目', function (yargs) {
return yargs.option('force', {
alias: 'f',
describe: '强制新建',
}).option('config', {
alias: 'c',
describe: '仅初始化配置文件',
})
}, function (argv) {
runInitPrompts(argv._[1]).then(function(answers) {
init(argv, answers);
});
})
.command(['update', 'u'], '更新一个项目', function (yargs) {
if (!checkProjectExists(process.cwd(), 'jslib.json')) {
console.error('error: 这不是一个jslib库,缺少jslib.json文件');
return;
}
const json = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), 'jslib.json'), { encoding: 'utf8' }));
runUpdatePrompts().then(function(answers) {
update(json, answers);
});
})
.demandCommand()
.epilog('copyright 2018-2019')
.argv;
function init(argv, answers) {
const cmdPath = process.cwd();
const {name, npmname, username, type, lang} = answers;
const pathname = String(typeof argv._[1] !== 'undefined' ? argv._[1] : name);
const option = {
pathname, // 创建的名字
name: String(name), // 项目名字 readme
npmname: String(npmname), // 发布到npm的名字,有可能和项目名字不一样,比如带scope
umdname: String(npmname).split('/').pop(), // @yan/xxx -> xxx
username: String(username),
type,
lang,
version: pkg.version,
};
// 运行命令
if (!pathname) {
console.error('error: jslib create need name');
return;
}
if (checkProjectExists(cmdPath, pathname) && !argv.force) {
console.error('error: The project is already existed! If you really want to override it, use --force argv to bootstrap!');
return;
}
config.init(cmdPath, '', option);
// 仅初始化配置文件
if (argv.config) {
return;
}
cli.init(cmdPath, option);
}
function update(option, answers) {
const cmdPath = process.cwd();
option.umdname = option.npmname.split('/').pop();
cli.update(cmdPath, option, answers);
}
|
//variable which holds the information of the reviewer
var names = [ "Susan Smith","Anna Johnson","Peter Jones","Bill Anderson"];
var job = ["WEB DEVELOPER","WEB DESIGNER","INTERN","THE BOSS"];
var review = ["I'm baby meggings twee health goth +1. Bicycle rights tumeric chartreuse before they sold out chambray pop-up. Shaman humblebrag pickled coloring book salvia hoodie, cold-pressed four dollar toast everyday carry",
"Helvetica artisan kinfolk thundercats lumbersexual blue bottle. Disrupt glossier gastropub deep v vice franzen hell of brooklyn twee enamel pin fashion axe.photo booth jean shorts artisan narwhal.",
"Sriracha literally flexitarian irony, vape marfa unicorn. Glossier tattooed 8-bit, fixie waistcoat offal activated charcoal slow-carb marfa hell of pabst raclette post-ironic jianbing swag.",
"Edison bulb put a bird on it humblebrag, marfa pok pok heirloom fashion axe cray stumptown venmo actually seitan. VHS farm-to-table schlitz, edison bulb pop-up 3 wolf moon tote bag street art shabby chic."
];
var index=0;
var pic = 0;
//This function changes the necessary divs to show different reviews of different people
function change(index){
pic = index+1;
$("#profilePic").attr("src", "images/person-"+pic+".jpg");
$("#name").html(names[index]);
$("#title").html(job[index]);
$("#review-text").html(review[index]);
}
//when left arrow is clicked then index is increased
$("#right").click( function(){
index += 1;
if (index > 3){
index =0;
}
change(index);
});
//when left arrow is clicked then index is reduced
$("#left").click( function(){
index -= 1;
if (index < 0) {
index = 3;
}
change(index);
});
//surprise button chooses a review randomly
$("#surprise").click(function(){
index = Math.floor((Math.random() * 4) + 1) - 1;
change(index);
});
|
import * as actionTypes from "./actions";
import { initialState } from "./initialState";
const reducer = (oldState = initialState, action) => {
switch (action.type) {
case actionTypes.NEW_CHARGE:
return { ...oldState, charge: action.payload };
case actionTypes.LOAD:
return { ...oldState, loading: false, ...action.payload };
case actionTypes.LOADING_START:
return { ...oldState, loading: true };
case actionTypes.LOADING_STOP:
return { ...oldState, loading: false };
default:
return oldState;
}
};
export default reducer;
|
'use strict';
/* Controllers */
var todosApp = angular.module('todoApp', []);
var siteurl = wnm_custom.site_url;
todosApp.controller('TodoListController', function ( $scope, $http ) {
$scope.getTodos = function () {
$http.get( siteurl + "/wp-json/wp/v2/todo" ).success( function( response ) {
$scope.todos = response;
});
};
$scope.addTodo = function() {
var itemsObject = [];
var arr_items_dates = '';
var items = $scope.addtodoitem;
var items_todos = items.todo;
var arr_items_todos = items_todos.split(',');
if( items.duedate ) {
var items_dates = items.duedate;
arr_items_dates = items_dates.split(',');
} else {
arr_items_dates = '';
}
for (var i = 0; i < arr_items_todos.length; i++ ) {
var item_todo = arr_items_todos[i];
var item_date = arr_items_dates[i];
var itemObj = {
itemname: item_todo,
duedate: item_date
};
itemsObject.push(itemObj);
}
var req = {
method: 'POST',
url: siteurl + '/wp-json/wp/v2/posts/todos',
data: { 'todos' : itemsObject },
headers: {
'Authorization': 'Basic YWRtaW46Y24xMjM0NQ=='
},
}
$http(req).success( function ( data ) {
$scope.getTodos();
$scope.addtodoitem = '';
})
return;
};
$scope.updateTodos = function(todo) {
if ( 'true' === todo.is_done ) {
var is_done_val = "false";
} else {
var is_done_val = "true";
};
var req = {
method: 'PUT',
url: siteurl + '/wp-json/wp/v2/posts/todos/update',
data: { 'todo_id' : todo.id, 'todo_is_done' : is_done_val},
headers: {
'Authorization': 'Basic YWRtaW46Y24xMjM0NQ=='
},
}
$http(req).success( function ( data ) {
$scope.getTodos();
$scope.addtodoitem = '';
})
return;
}
$scope.deleteTodos = function(todo) {
var req = {
method: 'DELETE',
url: siteurl + '/wp-json/wp/v2/posts/todos/delete/'+todo.id,
headers: {
'Authorization': 'Basic YWRtaW46Y24xMjM0NQ=='
},
}
$http(req).success( function ( data ) {
$scope.getTodos();
$scope.addtodoitem = '';
})
return;
}
$scope.getTodos();
});
|
import styled from "styled-components";
const UserInfoTitle = styled.p`
font-weight: bold;
color: ${props => props.theme.userInfo.title.color};
font-size: ${props => props.theme.userInfo.title.size}em;
margin-bottom: ${props => props.theme.userInfo.spacingY}em;
`;
UserInfoTitle.displayName = "UserInfoTitle";
export default UserInfoTitle;
|
/*jshint esversion: 6*/
const { Worker, parentPort, workerData } = require("worker_threads");
console.log("Heart Rate data for avg calculation");
const heartRateDataArray = workerData;
// this accepts the accumulator as 0/intial value as 0 and sums with all heartrate values
const heartRateAvg = array => array.reduce((accumulator, value) => accumulator + value.heartRate, 0);
parentPort.postMessage(heartRateAvg(heartRateDataArray)/heartRateDataArray.length);
|
// Event model
var Event = require("./models/event");
var Miracle = require ("./models/miracle");
var Resource = require ("./models/resource");
module.exports = function(app, passport) {
// Get method
app.get('/', function(req, res) {
console.log('Nemam Amma Bhagavan Sharanam -- Is the user authenticated?' + req.user);
//res.render('index.html');
});
// routes for MONGO DB access
app.get('/api/getEvents', function(req, res) {
// use mongoose to get all events in the database
Event.find(function(err, events) {
// if there is an error retrieving, send the error. nothing after res.send(err) will execute
if (err) res.send(err)
else res.json(events); // return all events in JSON format
});
});
// create event and send back all events after creation
app.post('/api/addEvent', function(req, res) {
console.log("Nemam Amma Bhagavan Sharanam -- Storing - start" + req.body.start + " - end - " + req.body.end + " User: " + req.user);
// Store an event in MongoDB, information comes from AJAX request from Angular
Event.create({
title : req.body.title,
start: req.body.start,
end: req.body.end,
allDay: req.body.allDay,
url: req.body.url,
description: req.body.description
}, function(err, event) {
if (err) res.send(err);
else
{
res.json(event);
console.log("Nemam Amma Bhagavan Sharanam -- Adding Event Start Time" + event.start);
} // added Event send response
//});
}); // Event.create
}); // addEvent POST route
// Name: Delete an Event using Event Id
// Descr: Remove the event and send the status response
app.delete('/api/deleteEvent/:id', function(req, res) {
console.log("Nemam Amma Bhagavan Sharanam -- Id:" + req.params.id);
// Remove the Event using id parameter from the endpoint
Event.remove({
_id: req.params.id
}, function(err, event) {
if (err) return res.send(err);
else res.json({ message: 'Successfully deleted' });
}); // Event.remove - Mongoose call
}); // app.delete
// Name: Session Post Route - Login to the site
// Descr: Call the passport.authenticate method and redirect accordingly
app.post('/api/auth/session', function(req, res, next) {
passport.authenticate('local-login', function(err, user, info) {
var error = err || info;
console.log("Nemam Amma Bhagavan Sharanam -- User is" + user.name);
if (error) {
console.log("Nemam Amma Bhagavan Sharanam -- error in post");
return res.json({error: error});
} // error
//req.logIn(user, function(err) {
// if (err) return res.send(err);
// console.log("Nemam Amma Bhagavan Sharanam -- User is" + user);
res.json({user: user});
// }); // logIn
})(req, res, next); // passport.authenticate
}); // session route
// Name: AddMiracle
// Descr: Store Miracle into mongo db
app.post('/api/addMiracle', function(req, res) {
// Store an event in MongoDB, information comes from AJAX request from Angular
Miracle.create({
name: req.body.name,
date: req.body.date,
location: req.body.location,
category: req.body.category,
title: req.body.title,
desc: req.body.desc,
username: req.body.username
}, function(err, miracle) {
if (err) res.send(err);
else
{
// return miracle object
res.json(miracle);
console.log("Nemam Amma Bhagavan Sharanam -- Adding Miracle for date:" + miracle.date + miracle.title + req.body.name);
}
//});
}); // Miracle.create
}); // addMiracle POST route
app.get('/api/getMiracles', function(req, res) {
console.log("Nemam Amma Bhagavan Sharanam -- Items to be limited" + req.query.itemsPerPage);
// use mongoose to get all miracles in the database
Miracle.count({}, function(err, count){
Miracle.find({})
.limit(req.query.itemsPerPage)
.skip(req.query.itemsPerPage * (req.query.currentPage - 1))
.sort({ date: 'desc' })
.exec(function(err, miracles) {
// if there is an error retrieving, send the error. nothing after res.send(err) will execute
if (err) res.send(err)
else res.json({count: count, miracles: miracles}); // return all events in JSON format
}); // Miracle.find
}) // Miralce.count
}); // app.get miracles
// Name: Delete a list of miracles using Miracle Id
// Descr: Remove each miralce from mongo db
app.delete('/api/deleteMiracles', function(req, res) {
var miraclesToDelete = (req.query.count == 1) ? [req.query.miraclesToDelete] : req.query.miraclesToDelete;
console.log("Nemam Amma Bhagavan Sharanam -- Deleting" + miraclesToDelete.length);
for (i = 0; i < miraclesToDelete.length; i++)
{
Miracle.remove({
_id: miraclesToDelete[i]
}, function(err, event) {
if (err) return res.send(err);
}); // Miracle.remove - Mongoose cal;
}
res.json({ message: 'Successfully deleted' });
}); // app.delete
// Name: AddResource
// Descr: Store Resource into mongo db
app.post('/api/addResource', function(req, res) {
// Store an event in MongoDB, information comes from AJAX request from Angular
Resource.create({
date: req.body.date,
topic: req.body.category,
title: req.body.title,
desc: req.body.desc,
username: req.body.username
}, function(err, resource) {
if (err) res.send(err);
else
{
// return resource object
res.json(resource);
console.log("Nemam Amma Bhagavan Sharanam -- Adding Resource for date:" + resource.date + resource.title);
}
}); // Resource.create
}); // addResource POST route
app.get('/api/getResources', function(req, res) {
console.log("Nemam Amma Bhagavan Sharanam -- Items to be limited" + req.query.itemsPerPage);
// use mongoose to get all miracles in the database
Resource.count({}, function(err, count){
Resource.find({})
.limit(req.query.itemsPerPage)
.skip(req.query.itemsPerPage * (req.query.currentPage - 1))
.sort({ date: 'desc' })
.exec(function(err, resources) {
// if there is an error retrieving, send the error. nothing after res.send(err) will execute
if (err) res.send(err)
else res.json({count: count, resources: resources}); // return all events in JSON format
}); // Resource.find
}) // Resource.count
}); // app.get resources
// Name: Delete a list of resources using Resource Id
// Descr: Remove each resource from mongo db
app.delete('/api/deleteResources', function(req, res) {
var resourcesToDelete = (req.query.count == 1) ? [req.query.resourcesToDelete] : req.query.resourcesToDelete;
console.log("Nemam Amma Bhagavan Sharanam -- Deleting" + resourcesToDelete.length);
for (i = 0; i < resourcesToDelete.length; i++)
{
Resource.remove({
_id: resourcesToDelete[i]
}, function(err, event) {
if (err) return res.send(err);
}); // Resource.remove - Mongoose cal;
}
res.json({ message: 'Successfully deleted' });
}); // app.delete
} // Module.exports
// route middleware to make sure a user is logged in
function isLoggedIn(req, res, next) {
// if user is authenticated in the session, carry on
if (req.isAuthenticated())
return next();
// if they aren't redirect them to the home page
res.redirect('/');
}
|
import React, {useState } from "react";
import SearchIcon from '@material-ui/icons/Search';
import { connect } from 'react-redux';
import {searchUserMsg} from "../../actions/searchAction"
import { Redirect } from "react-router-dom";
function SearchUserFrom(props) {
let [user, setUser] = useState({});
let handleChange = (e) => {
let name = e.target.name;
let value = e.target.value;
user[name] = value;
setUser(user);
}
let search = (e) => {
e.preventDefault();
const payload = {
method: 'POST',
headers: new Headers({
"X-Api-Key": JSON.parse(localStorage.getItem("token")),
'Content-Type': 'application/json'
}),
body: JSON.stringify(user)
}
fetch('http://localhost:5000/searchuser', payload)
.then(response => response.json())
.then((data) => {
console.log(data);
props.searchUserMsg(data)
});
}
return (
<div className="p-4">
<h4 className="text-gray globle-tile">Chats</h4>
<form className="search-form pl-3 p-2 mt-4" onSubmit={search}>
<SearchIcon className="text-muted" />
<input onChange={handleChange} name="user" placeholder="Search messages or users" className="ml-2 p-1 bg-transparent" />
</form>
<h5 className="text-gray globle-tile mt-4">Recent</h5>
</div>
);
}
export default connect(null,{searchUserMsg})(SearchUserFrom);
|
module.exports = {
DB: 'mongodb://obiwan2.univ-brest.fr/OdysseaSpatium'
}
|
import ReactDOM from 'react-dom';
import React, { Fragment } from 'react';
import './../base/_base.scss';
import './../pages/cloud-town/_cloud-town.scss';
import CloudTown from './../pages/cloud-town/CloudTown';
import './../header/_header.scss';
import Header from '../header/Header';
ReactDOM.render(
<Fragment>
<Header url='/#/cloud-town' />
<CloudTown />
</Fragment>
, document.getElementById('root'));
|
const dt = new Date();
const day = dt.getDate();
const month = dt.getMonth();
const year = dt.getFullYear();
const monthName = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
const dayButton = document.querySelector("#dayButton");
const dateDisplay = document.querySelector(".hidden").innerText;
const twoDigitDay = day <= 9 ? `0${day}` : `${day}`;
const twoDigitMonth = month + 1 <= 9 ? `0${month + 1}` : `${month + 1}`;
const date = { d: `${year}-${twoDigitMonth}-${twoDigitDay}` };
const main = document.querySelector(".flex");
const btn = document.querySelector("#btn");
const dropDownTeacher = document.querySelector(".drop-teacher");
const dropDownBatch = document.querySelector(".drop-batch");
const updateBtn = document.querySelector("#updateBtn");
const batchName = document.querySelector("#batch_name");
const teacherName = document.querySelector("#teacher_name");
const updateteacherdropDown = document.querySelector("#newTName");
const updateBatchDropDown = document.querySelector("#newBName");
displayTeacherName(dropDownTeacher);
displayTeacherName(teacherName);
displayTeacherName(updateteacherdropDown);
displayBatchName(dropDownBatch);
displayBatchName(batchName);
displayBatchName(updateBatchDropDown);
displayEvents("All", "All");
filter();
const openModalButtons = document.querySelectorAll("[data-modal-target]");
const closeModalButtons = document.querySelectorAll("[data-close-button]");
const overlay = document.getElementById("overlay");
openModalButtons.forEach((button) => {
button.addEventListener("click", () => {
const modal = document.querySelector(button.dataset.modalTarget);
openModal(modal);
});
});
overlay.addEventListener("click", () => {
const modals = document.querySelectorAll(".modal.active");
modals.forEach((modal) => {
closeModal(modal);
});
});
closeModalButtons.forEach((button) => {
button.addEventListener("click", () => {
const modal = button.closest(".modal");
closeModal(modal);
});
});
function openModal(modal) {
if (modal == null) return;
modal.classList.add("active");
overlay.classList.add("active");
}
function closeModal(modal) {
if (modal == null) return;
modal.classList.remove("active");
overlay.classList.remove("active");
}
document.querySelector(".weekBtn").addEventListener("click", () => {
window.location = "/week";
});
document.querySelector(".monthBtn").addEventListener("click", () => {
window.location = "/week";
});
|
// See src/models/gameState/gameState.ts
|
'use strict';
require('dotenv').config()
const mongoose = require('mongoose')
const Survey = require('../../models/survey');
mongoose.set('useCreateIndex', true);
const uri = process.env.MONGODB_URI;
let question = "What do you call the auxiliary brake that's attached to a rear wheel or the transmission and keeps the car from moving accidentally?";
let options = ["emergency brake",
"parking brake",
"e brake",
"hand brake"];
let language = "English";
let createdBy = "000000";
const responses = require('./parkingbrake');
mongoose.connect(uri, { useNewUrlParser: true, useCreateIndex: true })
.then(() => {
Survey.create([{question, options, createdBy, language, responses}])
.then(survey => {
console.log("survey");
} )
.catch(err => {
console.log("ERROR", err);
})
})
.catch(err => {
console.log('error connecting', err);
});
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.