123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611 |
- var edi="";
- var nei="";
- var adm="";
- var edi_ans="";
- var setint;
- var test_edi=new Array();
- $(function() {
-
- $("#large").click(function() {
-
- if(typeof( edi) =="string"){
- edi = new UE.ui.Editor();
- edi.render('content');
- }
-
- $('#reply_answer').toggle(1000);
-
- $('#large').hide();
- });
-
- $("#answerclose").click(function() {
-
- $('#reply_answer').hide(1000);
-
- $('#large').show();
- });
-
- $("#additionalclose").click(function() {
-
- $('#additional_content').slideUp("normal");
-
- });
-
- $("#edit_questionclose").click(function() {
-
- $('#edit_question_content').hide(1000);
-
- });
-
- $("input[id^='edit_answerclose_']").click(function() {
- var aid=parseInt($(this).attr('data'));
-
- $('#edit_answer_content_'+aid).toggle(1000);
-
- });
-
- //追问
- $("a[id^='to_ask_']").click(function() {
-
- var id=parseInt($(this).attr('data'));
-
- $('#to_ask_info_'+id).show();
-
- $('#to_ask_'+id).hide();
- });
-
- $("a[id^='btn_gray_']").click(function() {
-
- var id=parseInt($(this).attr('data'));
-
- $('#to_ask_'+id).show();
-
- $('#to_ask_info_'+id).hide();
-
- });
-
- $("a[id^='answer_btn_gray_']").click(function() {
-
- var id=parseInt($(this).attr('data'));
- $('#answer_again_info_'+id).hide();
-
- $('#answer_again_'+id).show();
- });
-
- $("a[id^='answer_again_']").click(function() {
- var id=parseInt($(this).attr('data'));
-
- $('#answer_again_info_'+id).show(1000);
- $('#answer_again_'+id).hide();
- });
-
- $("#to_ask_submit").click(function() {
- var content=$("#tag").val();
-
- if(content==""){
- alert("请输入内容");
- return false;
- }
- });
-
- $("#doanswer").click(function (){
-
- if(!edi.hasContents()){ //此处以非空为例
- alert("请输入内容");
- return false;
- }else{
-
- $('#doanswer').hide();
-
- $('#loading').html('<div ><img src="http://zhzdwd.com/global/css/loadIco.gif">加载中...请稍候!</div>');
- return true;
- }
- });
-
- /**
- * 设置为最佳答案
- */
- $("a[id^='best_button_']").click(function() {
- var id=parseInt($(this).attr('data'));
- easyDialog.open({
- container : {
- header : '设置答案为最佳',
- content :'对回答者的感言:<input type="text" name="comment_text" id="comment_text" value="谢谢你的解答!" />',
- yesFn : function(){
-
- $("#comment").attr("value",$("#comment_text").val());
- $("#best_answer_form_"+id).submit();
- },
- noFn : true
- }
- });
-
- });
-
- /**
- * 补充问题
- */
- $("#additional_button").click(function() {
-
- if(typeof( nei) =="string"){
- nei = new UE.ui.Editor();
- nei.render('supply_text');
- }
-
- $('#additional_content').slideDown("normal");
- });
-
- $("#additional").click(function() {
- var qid=$("#qid").val();
-
- if(!nei.hasContents()){ //此处以非空为例
- alert("请输入内容");
- return false;
- }
-
- var content=nei.getContent();
-
- var html='<div class="pgBoxExtra"><p class="extraTitle">问题补充 刚刚</p><p></p><p>'+content+'</p><p></p></div>';
-
- $("#supply_pg").html(html);
-
- var url="/ajax/supply/doadd";
-
- $.ajax({
- url:url,
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- qid:qid,
- supply:content
- },
- global: true,
- success: function(data){
-
- $('#supply_pg').toggle(1000);
-
- $("#additional_button").remove();
-
- $("#additional_content").remove();
-
- $("#supply_disclick").html('补充问题');
- },
- error:function(err){
- // document.getElementById('i_commont').innerHTML = err.responseText;
- }
- });
-
- });
-
- /**
- * 增加悬赏值
- */
- $("#up_price").click(function() {
-
- var price=parseInt($("#up_price").attr('data'));
- //检出是否是数字
- if(price<=0){
- easyDialog.open({
- container : {
- content : '您的财富值不足,2秒后关闭...'
- },
- autoClose : 2000
- });
- return false;
- }
-
- var arr=new Array();
- var p=1;
- for(var i=5;i<=price;i=i+5){
-
- var str="<option value='"+i+"'>"+i+"</option>";
-
- arr.push(str);
-
- if(i>=50)break;
- }
- var option = arr.join("");
- easyDialog.open({
- container : {
- header : '悬赏值',
- content :'<p>请选择金额:<span id="error" style="color:red"></span></p><select id="add_price">'+option+'</select>元 (您当前余额:<b class="colOrange">¥'+price+'</b>元)</br><a href="/home_recharge">充值</a>',
- yesFn : upprice,
- noFn : true
- }
- });
- });
- var upprice=function(){
-
- var qid=$("#qid").val();
-
- $("#up_price").attr('data');
-
- var y_price=parseInt($("#askReward").html());
-
- var add_price=parseInt($("#add_price").find("option:selected").text());
-
- var price=$("#up_price").attr('data');
-
- if(add_price>price){
- alert("财富值不够");
- return false;
- }
-
- var url="/ajax/price/up";
- $.ajax({
- url:url,
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- qid:qid,
- price:price,
- add_price:add_price
- },
- global: true,
- success: function(data){
-
- $("#askReward").html(y_price+add_price);
-
- $("#up_price").attr('data',price-add_price);
-
- easyDialog.open({
- container : {
- content : '增加财富值成功'
- },
- autoClose : 1500,
- overlay : false
- });
-
- },
- error:function(err){
- easyDialog.open({
- container : {
- content : '请输入正确的参数'
- },
- autoClose : 2000,
- overlay : false
- });
- }
- });
- }
-
- /**
- * 关闭问题
- */
- $("a[id^='close_queston_']").click(function() {
-
- easyDialog.open({
- container : {
- header : '无满意答案',
- content : '是否关闭问题?',
- yesFn : close_queston,
- noFn : true
- },
- overlay : false
- });
- });
- var close_queston=function(){
- var qid=parseInt($("#close_queston_u").attr('data'));
-
- if( isNaN(qid)){
- easyDialog.open({
- container : {
- content : '请输入正确的参数'
- },
- autoClose : 1500,
- overlay : false
- });
- return false;
- }
- self.location='/question/close/'+qid;
-
-
- }
-
- /**
- * 编辑问题
- */
- $("#edit_question").click(function() {
-
- if(typeof( adm) =="string"){
- adm = new UE.ui.Editor();
-
- adm.render('content_text');
- }
-
- $('#edit_question_content').show(1000);
-
- setint = setInterval("if($('#supply_text')){adm.setContent($('#que_content').html());setint=window.clearInterval(setint);}",100);
-
- });
-
- $("#edit_question_action").click(function() {
-
- if(!adm.hasContents()){
- alert("请输入内容");
- return false;
- }
-
- var content_text=adm.getContent();
-
- var qid=parseInt($("#edit_question").attr('data'));
-
- var url="/ajax/question/edit";
-
- $.ajax({
- url:url,
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- qid:qid,
- content:content_text
- },
- global: true,
- success: function(data){
-
- $("#que_content").hide();
-
- $("#que_content").html(content_text);
-
- $("#edit_question_content").hide();
-
- $("#que_content").show(500);
- },
- error:function(err){
- }
- });
- });
-
- /**
- * 删除问题
- */
- $("#delete_queston").click(function() {
-
- easyDialog.open({
- container : {
- header : '删除问题',
- content : '是否删除问题?',
- yesFn : delete_queston,
- noFn : true
- },
- overlay : false
- });
- });
- var delete_queston=function(){
- var qid=parseInt($("#delete_queston").attr('data'));
-
- if( isNaN(qid)){
- easyDialog.open({
- container : {
- content : '请输入正确的参数'
- },
- autoClose : 1500,
- overlay : false
- });
- return false;
- }
- self.location='/question/delete/'+qid;
- }
-
- /**
- * 删除回答
- */
- $("a[id^='delete_answer_']").click(function() {
- var aids=$(this).attr('data');
- var a = aids.split("_");
- var aid=parseInt(a[0]);
-
- var qid=parseInt(a[1]);
- easyDialog.open({
- container : {
- header : '删除回答',
- content : '是否删除回答?',
- yesFn : function(){
-
- if( isNaN(aid)){
- easyDialog.open({
- container : {
- content : '请输入正确的参数'
- },
- autoClose : 1500,
- overlay : false
- });
- return false;
- }
- self.location='/answer/delete/'+aid+'/'+qid;
- },
- noFn : true
- },
- overlay : false
- });
- });
- var delete_answer=function(){
-
- if( isNaN(aid)){
- easyDialog.open({
- container : {
- content : '请输入正确的参数'
- },
- autoClose : 1500,
- overlay : false
- });
- return false;
- }
- self.location='/answer/delete/'+aid+'/'+qid;
- }
-
- /**
- * 编辑回答
- */
- $("a[id^='edit_answer_']").click(function() {
-
- var aid=parseInt($(this).attr('data'));
-
- var content=$("#ans_content_"+aid).html();
-
- if(typeof( edi_ans) =="string"){
- edi_ans = new UE.ui.Editor();
-
- edi_ans.render('edit_answer_text');
- }
-
- $('#edit_answer_content_'+aid).toggle(1000);
-
- setint = setInterval("if($('#edit_answer_text')){edi_ans.setContent($('#ans_content_"+aid+"').html());setint=window.clearInterval(setint);}",100);
-
- });
-
- $("input[id^='edit_answeraction_']").click(function() {
- if(!edi_ans.hasContents()){
- alert("请输入内容");
- return false;
- }
- console.log('d');
- var aid=parseInt($(this).attr('data'));
-
- var content_text=edi_ans.getContent();
-
- var url="/ajax/answer/edit";
-
- $.ajax({
- url:url,
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- aid:aid,
- content:content_text
- },
- global: true,
- success: function(data){
-
- $("#ans_content_"+aid).hide();
-
- $("#ans_content_"+aid).html(content_text);
-
- $("#edit_answer_content_"+aid).hide();
-
- $("#ans_content_"+aid).show(500);
- },
- error:function(err){
- easyDialog.open({
- container : { content : '请输入正确的参数'},
- autoClose : 1500,
- overlay : false
- });
- }
- });
-
- });
-
- /**
- * 管理员设置答案为最佳
- */
- $("a[id^='admin_best_answer']").click(function() {
- var id=parseInt($(this).attr('data'));
-
- easyDialog.open({
- container : {
- header : '设置为最佳答案',
- content : '是否将此答案设置为最佳?',
- yesFn : function(){
-
- $("#comment").attr("value",$("#comment_text").val());
- $("#best_answer_form_"+id).submit();
- },
- noFn : true
- },
- overlay : false
- });
- });
-
-
- /**
- * 赞同回答
- */
- $("div[id^='agree_']").click(function() {
-
- var url="/ajax/answer/support";
-
- var aid=$(this).attr('data');
-
- $.ajax({
- url:url,
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- aid:aid
- },
- global: true,
- success: function(data){
- easyDialog.open({
- container : { content : '设置成功'},
- autoClose : 1500,
- overlay : false
- });
- var Num=parseInt($("#agreeNum_"+aid).html());
-
- $("#agreeThis_"+aid).remove();
-
- $("#agreeThisDis_"+aid).html('<div class="agreeBtn"><b class="agreeTips">已赞同</b><b class="agreeNum">'+(Num+1)+'</b></div>');
- },
- error:function(err){
- easyDialog.open({
- container : { content : '请输入正确的参数'},
- autoClose : 1500,
- overlay : false
- });
- }
- });
-
-
- });
-
-
- /**
- * 提交追问
- */
- $("a[id^='to_ask_submit_']").click(function() {
-
- var aid=$(this).attr('data');
-
- if(!test_edi[aid].hasContents()){ //此处以非空为例
- easyDialog.open({
- container : { content : '请输入内容'},
- autoClose : 1000,
- overlay : false
- });
-
- return false;
- }else{
- test_edi[aid].sync();
- document.getElementById("toaskform_"+aid).submit();
-
- }
-
- });
-
-
-
-
-
- })
|