You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
457 lines
16 KiB
457 lines
16 KiB
$(document).ready(function() {
|
|
var notRadio = '';
|
|
var yesRadio = '';
|
|
var notChecked = '';
|
|
var checked = '';
|
|
var payResultTimer = null;
|
|
|
|
var isPayDialog = false
|
|
var allPostData=new Object()
|
|
$.get('你的接口URL', function(response) {
|
|
// 请求成功时的回调函数
|
|
console.log(response);
|
|
}).fail(function(xhr, status, error) {
|
|
// 请求失败时的回调函数
|
|
console.log(error);
|
|
});
|
|
//step监听滚动位置
|
|
$(window).scroll(function() {
|
|
var element = $('.step_back');
|
|
var distanceToTop = element.offset().top - $(this).scrollTop();
|
|
if(distanceToTop <= 64){
|
|
element.addClass('stickyStep')
|
|
}else{
|
|
element.removeClass('stickyStep')
|
|
}
|
|
});
|
|
function getFormData() {
|
|
var formData = new FormData(document.querySelector('form'));
|
|
var data = {};
|
|
for (var [key, value] of formData.entries()) {
|
|
data[key] = value;
|
|
}
|
|
console.log(data);
|
|
}
|
|
//标题输入字数
|
|
$('.inputChange').on('input', function() {
|
|
// var maxLength = $(this).attr('maxlength');
|
|
var currentLength = $(this).val().length;
|
|
if(currentLength > 0){
|
|
$('.normal_recommend_title').addClass('recommend_title')
|
|
}else{
|
|
$('.normal_recommend_title').removeClass('recommend_title')
|
|
}
|
|
$('.inputText').text(currentLength + '/' + '50');
|
|
if(currentLength >50){
|
|
$('.inputText').addClass('warnInputText')
|
|
}else{
|
|
$('.inputText').removeClass('warnInputText')
|
|
// $('.inputText').removeClass('recommend_title')
|
|
}
|
|
});
|
|
// $('.inputChange').on('blur', function() {
|
|
// console.log('blur----');
|
|
// getAiTitleList()
|
|
// });
|
|
$('.normal_step').click(function(e) {
|
|
|
|
});
|
|
function showOptArea(area){
|
|
$('.opt-area').css('display','none');
|
|
$('#'+area).css('display','block');
|
|
}
|
|
function hideOptArea(){
|
|
$('.opt-area').css('display','none');
|
|
}
|
|
function getAiTitleList(){
|
|
let title = $('.inputChange').val();
|
|
let title_type = $('#project_select').val()
|
|
console.log($('#project_select'),title_type);
|
|
$.ajax({
|
|
type: "post",
|
|
url: 'http://aitest.chachongz.com/ajax_advise_ai_title',
|
|
data: {
|
|
title: title,
|
|
title_type: title_type
|
|
},
|
|
success: function(jsondata) {
|
|
// $('#cur_request').val(0)
|
|
|
|
var res = JSON.parse(jsondata);
|
|
console.log(res,'=====');
|
|
// if(!res.status){
|
|
// alert(res.info);
|
|
// return false;
|
|
// }
|
|
|
|
// if(res.data.title != $('#cur_title').val()){
|
|
// return false;
|
|
// }
|
|
|
|
// if(res.data.list.length>0){
|
|
// let html = ''
|
|
// res.data.list.forEach(function(item) {
|
|
// html += '<div onclick="confirmTitle(this)" class="advise-li">'+item+'</div>';
|
|
// });
|
|
// $('#advise-ul').html(html);
|
|
|
|
// let ani3 = stepLoading(3, 'done')
|
|
// ani3.addEventListener('complete', function() {
|
|
// stepDone(3, ani3)
|
|
|
|
// //第四步默认完成
|
|
// let ani4 = stepLoading(4, 'done')
|
|
// ani4.addEventListener('complete', function() {
|
|
// ani4.destroy();
|
|
// });
|
|
|
|
// showAdviseList()
|
|
// });
|
|
// }
|
|
}
|
|
});
|
|
}
|
|
function checkAiTitle() {
|
|
let title = $('.inputChange').val();
|
|
$.ajax({
|
|
type: "post",
|
|
url: '/ajax_check_ai_title',
|
|
data: {
|
|
title: title
|
|
},
|
|
success: function (jsondata) {
|
|
var res = JSON.parse(jsondata);
|
|
if (!res.status) {
|
|
alert(res.info);
|
|
return false;
|
|
}
|
|
|
|
$('#cur_title_type').val(res.data);
|
|
|
|
if (res.status && res.data != 1) {
|
|
if($('#loading').css('display') == 'none'){
|
|
showOptArea('not-title');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function showAdviseTitle(){
|
|
console.log('haha');
|
|
}
|
|
function getWordCountList(){
|
|
var chkType = $('li.active_select').attr('type');
|
|
var word_list_str = $("#word_list_str"+chkType).val();
|
|
|
|
$('.form_essayWords').addClass('disNone');
|
|
if(word_list_str){
|
|
var word_list = word_list_str.split(",");
|
|
if(word_list.length>0){
|
|
$('.form_essayWords').removeClass('disNone');
|
|
}
|
|
}
|
|
}
|
|
$('.pay_every').click(function(e){
|
|
if ($('.pay_every').hasClass('pay_active')) {
|
|
$('.pay_every').removeClass('pay_active')
|
|
}
|
|
$(this).addClass('pay_active')
|
|
let pay_type = $('.pay_active').attr('pay_type');
|
|
allPostData = {...allPostData,pay_type}
|
|
// $('#totalMoney').text('')
|
|
payAction()
|
|
// getPayQrcode(postData,check_flag)
|
|
|
|
})
|
|
$('.close_modal').on('click',function(e){
|
|
$('.pageMask').addClass('hide');
|
|
$('.payModal').addClass('hide');
|
|
if(!$('.pay_detail').hasClass('hide')){
|
|
$('.pay_detail').addClass('hide')
|
|
}
|
|
if($('.modal_mes').hasClass('hide')){
|
|
$('.modal_mes').removeClass('hide')
|
|
}
|
|
if($('.pay_content').hasClass('hide')){
|
|
$('.pay_content').removeClass('hide')
|
|
}
|
|
clearTimeout(payResultTimer);
|
|
|
|
// clearInterval()
|
|
})
|
|
function getPayType() {
|
|
var paytype = $('.pay_active').attr('pay_type');
|
|
return paytype;
|
|
}
|
|
function payAction(){
|
|
let check_type = $('li.active_select').attr('type');
|
|
let check_flag = $('li.active_select').attr('check_flag');
|
|
let pay_type = getPayType();
|
|
let title = $('.inputChange').val();
|
|
// goods_id 0
|
|
// const postData = {
|
|
// title:'88',
|
|
// check_type,
|
|
// pay_type,
|
|
// get_pay_goods:'1',
|
|
// aiessay_wordnum:'3000',
|
|
// // recharge_goods_id:'0',
|
|
// // value_added_services:''//增值服务
|
|
// }
|
|
const postData = {
|
|
title: '123',
|
|
check_type: '94',
|
|
pay_type,
|
|
get_pay_goods: '1',
|
|
aiessay_wordnum: '3000'
|
|
}
|
|
allPostData = {...allPostData,check_flag,recharge_goods_id:'0',...postData}
|
|
|
|
if(check_type == '94'){
|
|
|
|
}
|
|
|
|
//检验信息
|
|
getPayQrcode(postData)
|
|
}
|
|
$('#formInputSumbtn').on('click',function(e){
|
|
payAction()
|
|
})
|
|
function getPayQrcode(postData){
|
|
|
|
$.ajax({
|
|
type: "post",
|
|
dataType:'json',
|
|
url: 'http://aitest.chachongz.com/'+ allPostData.check_flag+'/ajax_check_aisubmit',
|
|
data: {
|
|
...postData
|
|
},
|
|
success: function (res) {
|
|
if(res.data.user_not_enough_money) {
|
|
if(isPayDialog){
|
|
$('.pageMask').addClass('hide');
|
|
$('.payModal').addClass('hide');
|
|
}
|
|
$('.pageMask').removeClass('hide');
|
|
$('.payModal').removeClass('hide');
|
|
isPayDialog = true
|
|
if(postData.pay_type == 2 || postData.pay_type == 3){
|
|
getRechargePayUrl()
|
|
// getRechargeGoods(payInfo, configData);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function getRechargePayUrl(){
|
|
console.log(allPostData,'allPostData');
|
|
var core_content = $('.coreWordCount').val();
|
|
var postData1 = new Object();
|
|
postData1.type = allPostData.check_type;
|
|
postData1.pay_type = allPostData.pay_type;
|
|
// postData1.value_added_services = configData.addedServicesStr;//增值服务
|
|
// if(configData.ppt_tpl != '') postData1.ppt_tpl = configData.ppt_tpl;//ppt
|
|
// postData1.recharge_goods_id = '0';
|
|
postData1.title = allPostData.title;
|
|
postData1.core_content = core_content;
|
|
// type==94
|
|
// var edu= parseInt($('#paper-edu-wrapper').find('input[type="radio"]:checked').val());
|
|
// if(edu<=0 || !edu) {
|
|
// alert("请选择您的学历");
|
|
// return;
|
|
// }
|
|
// if(!$('.form_essayWords').hasClass('hide')){
|
|
// var wordnums= parseInt($('.textLength').find('input[type="radio"]:checked').val());
|
|
// if(wordnums<=0 || isNaN(wordnums)) {
|
|
// alert("请选择您的字数");
|
|
// return;
|
|
// }
|
|
// }
|
|
// var major = parseInt($('#paper-major-wrapper').find('option:selected').val());
|
|
// if(major<=0 || !major) {
|
|
// alert("请选择您的专业");
|
|
// return;
|
|
// }
|
|
$.ajax({
|
|
url:"http://aitest.chachongz.com/"+allPostData.check_flag+'/ajax_get_ai_pay_url',
|
|
type:'post',
|
|
dataType:'json',
|
|
// data:{...postData1},
|
|
data:{
|
|
type: '94',
|
|
pay_type: postData1.pay_type,
|
|
value_added_services: '',
|
|
recharge_goods_id: '0',
|
|
title: '123',
|
|
fuid: '',
|
|
aiessay_wordnum: '3000',
|
|
aiessay_edu: '2',
|
|
aiessay_major: '1'
|
|
},
|
|
success:function(res){
|
|
if(res.status){
|
|
$('#qrcode').html('');
|
|
$('#qrcode').attr('tid', res.data.tid);
|
|
$('#qrcode').attr('paytype', postData1.pay_type);
|
|
$('#totalMoney').text(res.data.total_fee)
|
|
var qrcode = new QRCode(document.getElementById("qrcode"), {
|
|
text: res.data.qrcode_url,
|
|
width: 135,
|
|
height: 135,
|
|
colorDark : "#000000",
|
|
colorLight : "#ffffff",
|
|
correctLevel : QRCode.CorrectLevel.H
|
|
});
|
|
getRechargePayResult(res.data)
|
|
}else{
|
|
alert(res.info);
|
|
}
|
|
},
|
|
error:function(){
|
|
alert('网络错误1');
|
|
}
|
|
});
|
|
// console.log(allPostData,'allPostData====');
|
|
}
|
|
function getRechargePayResult(payinfo){
|
|
clearTimeout(payResultTimer);
|
|
if (payinfo.tid) {
|
|
ptid = payinfo.tid;
|
|
}
|
|
$.ajax({
|
|
url:"http://aitest.chachongz.com/"+ allPostData.check_flag +'/ajax_get_ai_pay_result',
|
|
type:'post',
|
|
dataType:'json',
|
|
data:{
|
|
tid:ptid,
|
|
pay_type:'2'},
|
|
success:function(res){
|
|
if(res.status){
|
|
if(res.data.pay_status == 'NOTPAY') {
|
|
payResultTimer = setTimeout(function(){
|
|
getRechargePayResult(payinfo);
|
|
}, 2000);
|
|
return;
|
|
}else if(res.data.pay_status == 'SUCCESS'){
|
|
if(isPayDialog){
|
|
// $('.pageMask').addClass('hide');
|
|
$('.pay_content').addClass('hide');
|
|
$('.modal_mes').addClass('hide');
|
|
$('.pay_detail').removeClass('hide');
|
|
}
|
|
payresultAction(res)
|
|
}
|
|
clearTimeout(payResultTimer);
|
|
return;
|
|
}
|
|
|
|
clearTimeout(payResultTimer);
|
|
alert(res.info);
|
|
},
|
|
error:function(err){
|
|
alert('网络错误2');
|
|
}
|
|
});
|
|
|
|
}
|
|
payresultAction({data:{tid:'99237482378','wechat_qrcode_url':'iuyeriuweyi'}})
|
|
function payresultAction(res) {
|
|
var data = res.data;
|
|
if(data.wechat_qrcode_url){
|
|
$('#pay_succ_tid').text(data.tid)
|
|
// $('#qrcode1').attr('src', data.wechat_qrcode_url);
|
|
$('#qrcode1').attr('src', "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQFX8DwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAyZ0dySDRYMTVmZmsxTHM4ODFEY3YAAgTcO2FnAwQAjScA");
|
|
|
|
}
|
|
$('.payresultBtn2').click(function(){
|
|
location.href = "http://aitest.chachongz.com/report2?oid="+data.tid;
|
|
});
|
|
$('.payresultBtn1').click(function(){
|
|
console.log(isPayDialog,'isPayDialog----');
|
|
if(isPayDialog) {
|
|
location.reload();
|
|
return;
|
|
}
|
|
// location.href = "/modelessay";
|
|
});
|
|
$('#copy_tid').unbind('click');
|
|
var clipboard2 = new ClipboardJS('#copy_tid', {
|
|
text: function () {
|
|
return $('#pay_succ_tid').text();
|
|
}
|
|
});
|
|
clipboard2.on('success', function(e) {
|
|
alert('复制成功')
|
|
})
|
|
|
|
}
|
|
|
|
|
|
$('li').click(function(e) {
|
|
|
|
if ($('li').hasClass('active_select')) {
|
|
$('li').removeClass('active_select')
|
|
}
|
|
$(this).addClass('active_select')
|
|
getWordCountList();
|
|
|
|
var t = $('li.active_select').attr('type');
|
|
console.log(t,'=======ttttt');
|
|
if(t =='94'){//字数
|
|
$('.form_essayWords').show();
|
|
$('.side_info').show();
|
|
$('.btn_result').show()
|
|
$('.btn_result_now').hide()
|
|
$('.key_words').addClass('hide')
|
|
} else{
|
|
$('.btn_result').hide()
|
|
$('.btn_result_now').show()
|
|
$('.form_essayWords').hide();
|
|
$('.side_info').hide();
|
|
$('.key_words').removeClass('hide')
|
|
}
|
|
if(t == '64'){
|
|
$('.key_words').show()
|
|
}else{
|
|
$('.key_words').hide()
|
|
}
|
|
if (['81','85'].indexOf(t) !== -1) {//
|
|
$('.coreContent').show();
|
|
} else{
|
|
$('.coreContent').hide();
|
|
}
|
|
// $("#downdemo").attr('href', '/downreportdemo/type/'+t);
|
|
//图表公式
|
|
var table_formula_types = getTableFormulaTypes('support_table_formula_types');
|
|
if (table_formula_types) {
|
|
if (table_formula_types.indexOf(t) !== -1) {
|
|
$('#paper-table_and_formulas-wrapper').parent().show();
|
|
} else{
|
|
$('#paper-table_and_formulas-wrapper').parent().hide();
|
|
}
|
|
}
|
|
changeLiActive(t,'support_titleMore','.normal_recommend_title')// 标题优化
|
|
changeLiActive(t,'support_pro','.custom-select')// 专业优化
|
|
changeLiActive(t,'support_edu','.formItem_pro')// 学历优化
|
|
});
|
|
|
|
function changeLiActive(t,attr_type,ele){
|
|
var support_titleMore = getTableFormulaTypes(attr_type);
|
|
if (support_titleMore) {
|
|
if (support_titleMore.indexOf(t) !== -1) {
|
|
$(ele).removeClass('disNone');
|
|
// $(ele).css('display','block')
|
|
} else{
|
|
$(ele).addClass('disNone');
|
|
// $(ele).css('display','none')
|
|
}
|
|
}
|
|
}
|
|
function getTableFormulaTypes(attr_type) {
|
|
var support_table_formula_types = $("#htmlconfig").attr(attr_type);
|
|
if (!support_table_formula_types) return '';
|
|
|
|
var support_table_formula_types_arr = support_table_formula_types.split(",");
|
|
return support_table_formula_types_arr;
|
|
}
|
|
});
|