123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- $(function() {
-
- $('.phone-main').height($('.phone-wrap').height() - $('.phone-header').height());
- //预览
- $('#preview').click(function(){
-
- if($.trim($('#state .checked').text())=="开启"){
- if($.trim($('#position .checked').text()) == '顶部与尾部均添加'){
- $('.position-t').show();
- $('.position-b').show();
- }else{
- if($.trim($('#position .checked').text()) == '文章顶部'){
- $('.position-t').show().siblings().hide();
- }else{
- $('.position-b').show().siblings().hide();
- }
- }
-
- }else{
- $('.position-t').hide();
- $('.position-b').hide();
- }
-
- });
- //保存
- $('#save').click(function(){
- var position=1;
- var state=1;
- if($.trim($('#state .checked').text())=="开启"){
- state=1;
- if($.trim($('#position .checked').text()) == '顶部与尾部均添加'){
- position=3;
- }else{
- if($.trim($('#position .checked').text()) == '文章顶部'){
- position=1;
- }else{
- position=2;
- }
- }
-
- }else{
- state=2;
- }
- update(position,state);
- });
-
- init();
-
- //删除当前图片
- $('.icon-close').click(function(){
- $(this).parent('.upload-img').remove();
- });
- });
- function init(){
- var param = {};
- $.post("/JkEdu/Signature/getSignature", param, function(result) {
- console.log(result.Code);
- if(result.Code==10000){
- if(result.result[0].state==1){
- if(result.result[0].position==1){
- $('.position-t').show().siblings().hide();
- }else if(result.result[0].position==2){
- $('.position-b').show().siblings().hide();
- }else{
- $('.position-t').show();
- $('.position-b').show();
- }
- }else{
- $('.position-t').hide();
- $('.position-b').hide();
- }
-
- $('#state').radioGroup({operate:'setKey',opreateDataKey:result.result[0].state});
- $('#position').radioGroup({operate:'setKey',opreateDataKey:result.result[0].position});
-
-
- // if(result.result[0].state=2){
- // $("label[name='state']:contains('开启')").addClass('checked');
- // $("label[name='state']:contains('开启')").find(':radio').prop("checked", "checked");
- // }else{
- // $("label[name='state']:contains('关闭')").addClass('checked');
- // $("label[name='state']:contains('关闭')").find(':radio').prop("checked", "checked");
- // }
- }
- });
- }
- function update(position,state){
- var param = {};
- param.position=position;
- param.state=state;
- $.post("/JkEdu/Signature/updateSignature", param, function(result) {
- console.log(result.Code);
- if(result.Code==10000){
- return true;
- }else{
- return false;
- }
- });
- }
|