UNPKG

lixin-web

Version:

vue and bootstrap

101 lines (91 loc) 2.67 kB
$(function(){ if(AppData.isLogin()) { $('[data-field="username"]').val(AppData.getMainAccount().username); // LoginForm.destroy(); } else { // LoginForm.init(); } if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))){ /* new WOW().init();*/ }; $('.a2 .c3 .e1').click(function(){ $('.a2 .c3 .e1 .f1').removeClass('active'); $(this).find('.f1').addClass('active'); }); $('.a2 .e1:eq(0)').click(); $('.a.a2 .c6 .d2').click(function(){ if(!AppData.isLogin()) { App.alert('warning', '提示消息', '请先登录'); scrollTo(0,0); return; } var suject = $('#subject').val(); if(suject == ''){ App.alert('warning', '提示消息', '请填写主题'); return; } var content = $('#content').val(); if(content == ''){ App.alert('warning', '提示消息', '请填写内容'); return; } if(content.lengh >= 500){ App.alert('warning', '提示消息', '提交内容只能在500字内'); return; } var type = $('.e.e1 > .active').parent().text(); var data = {target: 'admin', subject: type + ':' + suject, content: content}; $.ajax({ type: 'post', url: '/api/account/send-message', data: data, timeout: 10000, dataType: 'json', success: function(response) { if(response.error == 0) { Will.success('您的投诉意见已提交成功,谢谢您的支持!'); $('#subject').val(''); $('#subjectPrompt').html('填写您想要告诉我们的主题'); $('#subjectPrompt').css('color', 'black'); $('#content').val(''); $('#contentPrompt').html('字数控制在500字'); $('#contentPrompt').css('color', 'black'); }else{ App.alert('warning', '提示消息', response.message); } } }); }); $('#subject').blur(function(){ if($(this).val() == ''){ $('#subjectPrompt').html('请填写主题'); $('#subjectPrompt').css('color', '#ec4646'); }else{ $('#subjectPrompt').html(''); } }); $('#subject').change(function(){ if($(this).val() == ''){ $('#subjectPrompt').html('请填写主题'); $('#subjectPrompt').css('color', '#ec4646'); }else{ $('#subjectPrompt').html(''); } }); $('#content').blur(function(){ if($(this).val() == ''){ $('#contentPrompt').html('请填写内容'); $('#contentPrompt').css('color', '#ec4646'); }else{ $('#contentPrompt').html(''); } }); $('#content').change(function(){ if($(this).val() == ''){ $('#contentPrompt').html('请填写内容'); $('#contentPrompt').css('color', '#ec4646'); }else{ $('#contentPrompt').html(''); } }) });