1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- var data = {};
- $(function() {
- init();
- // 保存
- $('#save').click(function() {
- var str ='';
- str+="[";
- $.each(data, function(i, val) {
- if (val.switchtype == 1) {
- // 评论
- if ($.trim($('#type1 .checked').text()) == "开") {
- str+='{"id":'+val.id+',"switchstate":1}';
- } else {
- str+='{"id":'+val.id+',"switchstate":2}';
- }
- }
- if (val.switchtype == 2) {
- // 认证
- if ($.trim($('#type2 .checked').text()) == "开") {
- str+='{"id":'+val.id+',"switchstate":1}';
- } else {
- str+='{"id":'+val.id+',"switchstate":2}';
- }
- }
- if(i+1 !=2){
- str+=',';
- }
- });
- str+="]";
- update(str);
- });
- });
- function init() {
- var param = {};
- $.post("/JkEdu/ConfigSystem/getConfigSys", param, function(result) {
- console.log(result.Code);
- if (result.Code == 10000) {
- data = result.result;
- $.each(data, function(i, val) {
- console.log(val.switchtype);
- if (val.switchtype == 1) {
- $('#type1').radioGroup({
- operate : 'setKey',
- opreateDataKey : val.switchstate
- });
- } else if (val.switchtype == 2) {
- $('#type2').radioGroup({
- operate : 'setKey',
- opreateDataKey : val.switchstate
- });
- }
- });
- }
- });
- }
- function update(params) {
- console.log(params);
- param = {};
- param.params=params;
- $.post("/JkEdu/ConfigSystem/updateConfigSys", param, function(result) {
- console.log(result.Code);
- if (result.Code == 10000) {
- return true;
- } else {
- return false;
- }
- });
- }
|