123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- var nei="";
- var ask="";
- //发布框等字数统计
- function checkWord(len, evt, wordCheckNumID) {
- if (evt == null)
- evt = window.event;
- var src = evt.srcElement ? evt.srcElement : evt.target;
- var str = src.value.trim();
- myLen = 0;
- i = 0;
- for (; (i < str.length) && (myLen <= len * 2); i++) {
- if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128)
- myLen++;
- else
- myLen += 2;
- }
- if (myLen > len * 2) {
- src.value = str.substring(0, i - 1);
- } else {
- document.getElementById(wordCheckNumID).innerHTML = Math
- .floor((len * 2 - myLen) / 2);
- }
- }
- $(function() {
-
- $("#additionalclose").click(function() {
-
- $('#additional_content').toggle(1000);
-
- });
-
- $("#toaskclose").click(function() {
-
- $('#to_ask_info').toggle(1000);
-
- });
-
- //追问
- $("#to_ask").click(function() {
-
- if(typeof( ask) =="string"){
- ask = new UE.ui.Editor();
- ask.render('to_ask_text');
- }
-
- $('#to_ask_info').toggle(1000);
- });
-
- //不满意
- $("#answer_no_satisfy").click(function() {
-
- var qid=$("#qid").val();
-
- var url="/ajax/vip_question/refunds";
-
- $.ajax({
- url:url,
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- qid:qid
- },
- global: true,
- success: function(data){
- if(data.refunds==1){
- easyDialog.open({
- container : {
- header : '确认该答案为不满意',
- content : data.message+"<br/>原因:<input type='text' name='refunds_content' id='refunds_content' value=''/>",
- yesFn : setnosatisfy,
- noFn : true
- },
- overlay : false
- });
- }else{
- easyDialog.open({
- container : {
- header : '确认该答案为不满意',
- content : data.message,
- noFn : true
- },
- overlay : false
- });
- }
-
- },
- error:function(err){
-
- easyDialog.open({
- container : { content : '无法读取,请重新操作'},
- autoClose : 1500,
- overlay : false
- });
-
- }
- });
-
-
-
- });
-
- //满意
- $("#answer_satisfy").click(function() {
- easyDialog.open({
- container : {
- header : '确认该答案为满意',
- content : '点击‘确定’完成这次提问;答疑满意后还能进行追问!',
- yesFn : setsatisfy,
- noFn : true
- },
- overlay : false
- });
- });
-
- var setnosatisfy=function(){
- var form1 = $("#setnosatisfy");
- $("#refunds_description").attr("value",$("#refunds_content").val());
- form1.submit();
- }
-
- var setsatisfy=function(){
- var form1 = $("#setsatisfy");
-
- form1.submit();
- }
-
- /**
- * 补充问题
- */
- $("#additional_button").click(function() {
-
- if(typeof( nei) =="string"){
- nei = new UE.ui.Editor();
- nei.render('description_text');
- }
-
- $('#additional_content').toggle(1000);
- });
-
- $("#additional").click(function() {
- var qid=$("#qid").val();
-
- if(!nei.hasContents()){ //此处以非空为例
- alert("请输入内容");
- return false;
- }
-
- var content=nei.getContent();
-
- var html='<div class="pgBoxExtra"><p>'+content+'</p></div>';
-
- $("#description_pg").html(html);
-
- $('#description_pg').hide();
-
- var url="/ajax/vip_question/edit";
-
- $.ajax({
- url:url,
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- qid:qid,
- description:content
- },
- global: true,
- success: function(data){
-
- $('#description_pg').toggle(1000);
-
- $("#additional_button").remove();
-
- $("#additional_content").remove();
-
- },
- error:function(err){
- // document.getElementById('i_commont').innerHTML = err.responseText;
- }
- });
-
- });
-
- $("#addtoaskvip").click(function() {
- if(!ask.hasContents()){ //此处以非空为例
- alert("请输入内容");
- return false;
- }else{
- answer=window.confirm("追问后,该提问自动设为‘满意’");
-
- if(answer==true)
- return true;
- else
- return false;
- }
-
- });
-
- $("#submit_comment").click(function() {
-
- var c_content=$('#comment_content').val();
-
- var username=$('#username').val();
-
- var qid=$("#qid").val();
-
- if(c_content==""){
- alert("请输入内容");
- return false;
- }
-
- var html='<blockquote><b>'+username+'</b>评价:'+c_content+'</blockquote>';
-
- $("#aj_comment").html(html);
-
- $('#aj_comment').hide();
-
- var url="/ajax/vip_question/comment";
-
- $.ajax({
- url:url,
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- qid:qid,
- comment:c_content
- },
- global: true,
- success: function(data){
- $('#aj_comment').toggle(1000);
-
- $("#enter_comment").remove();
-
- },
- error:function(err){
- document.getElementById('aj_comment').innerHTML = err.responseText;
- }
- });
-
- });
-
-
- $("#add_discuss").click(function() {
-
- var discuss_content=$("#discuss_content").val();
-
- if(discuss_content==""){
- alert("请输入内容");
- return false;
- }
-
- });
-
- $("input[id^='add_discuss_chire']").click(function() {
- var id=parseInt($(this).attr('data'));
- var discuss_content=$("#discuss_content_"+id).val();
-
- if(discuss_content==""){
- alert("请输入内容");
- return false;
- }
-
- });
-
- //显示子评论
- $("a[id^='show_chir_discuss_']").click(function() {
-
- var id=parseInt($(this).attr('data'));
-
- $('#chircomm_'+id).toggle(1000);
-
- var cla=$('#open_'+id).attr("class");
-
- if(cla=="openUp"){
- $('#open_'+id).removeClass('openUp');
-
- $('#open_'+id).addClass('openDown');
- }else{
- $('#open_'+id).removeClass('openDown');
-
- $('#open_'+id).addClass('openUp');
- }
-
- });
-
-
-
- })
|