How to use step2 method in wpt

Best JavaScript code snippet using wpt

Advertising.js

Source:Advertising.js Github

copy

Full Screen

1define([2 'app/controller/base',3 'app/module/validate',4 'app/interface/GeneralCtr',5 'app/interface/UserCtr',6 'app/interface/TradeCtr',7 'app/interface/AccountCtr',8 'app/interface/BaseCtr',9 'app/controller/Top',10 'app/controller/foo'11], function(base, Validate, GeneralCtr, UserCtr, TradeCtr, AccountCtr, BaseCtr, Top, Foo) {12 let langType = localStorage.getItem('langType') || 'ZH';13 var code = base.getUrlParam("code") || '';14 var coin = base.getUrlParam("coin") || 'BTC'; // 币种15 var status = '1';16 let adverType = base.getUrlParam("type") || 'sell';17 var mid = 0,18 jdLeft = 0,19 selOnlyCert = 0;20 var pay = '';21 var midBlv = 0;22 var isKup = true;23 let langText = '';24 if (langType === 'EN') {25 langText = '_en';26 }27 // step128 let payBigType = '';29 let paySubType = '';30 let paySearch = '';31 let tradeCoin = sessionStorage.getItem('tradeCoin') || '';32 let tradeCoin001 = sessionStorage.getItem('tradeCoin001') || '';33 let payList = [];34 let step1SelectName = [];35 let tradeType = 1;36 //step237 let step2TagInitData = [];38 // step339 let step3TagInitData = [];40 let targetArea = ''; // 目标国家41 let customTag = ''; // 用户自定义标签42 let step3ConditionConfig = {43 email: 0,44 mobile: 0,45 id: 046 }; // 验证47 let step3AreaLimit = ''; //国家/地区限制48 let step3Visible = ''; // 可见性49 let isAllowProxy = '';50 let cancelTimeInput = '';51 let href = '';52 let coinName = {53 'USDT': 'USDT',54 'BTC': base.getText('比特币')55 };56 let tradeObj = {57 'BTC': 'trade_btc_bail',58 'USDT': 'trade_usdt_bail'59 };60 let adverTypeObj = {61 'buy': '购买',62 'sell': '出售'63 };64 65 let step3TagsData = '';66 67 let rateList = [];68 69 let trade_btc_bail = '',70 trade_usdt_bail = '',71 defaultFee = ''72 ;73 if(!base.isLogin()){74 base.goLogin();75 return;76 }else {77 if(code) {78 href = window.location.href.split('?')[1];79 }80 if(location.href.indexOf('step2') !== -1) {81 step2Init();82 } else if(location.href.indexOf('step3') !== -1) {83 step3Init();84 } else {85 init();86 }87 }88 function init() {89 setHtml();90 base.showLoadingSpin();91 $('.head-nav-wrap .advertise').addClass('active');92 if (code != "") {93 $("#draftBtn").addClass("hidden");94 }95 $("#coin").text(coin.toUpperCase());96 $("#price").attr("disabled", true);97 $.when(98 GeneralCtr.getDictList({ "parentKey": "payment_method" }),99 TradeCtr.getPayCoinList(),100 BaseCtr.getCoinList(),101 GeneralCtr.rateList(),102 GeneralCtr.getSysConfig('trade_default_fee_rate')103 ).then((data1, data2, data3, data4, data5) => {104 defaultFee = +data5.cvalue * 100;105 rateList = data4;106 let tabHtml = '';107 data1.forEach((item, i) => {108 tabHtml += buildTabHtml(item, i)109 });110 $(".advertise-step1-tabs").append(tabHtml);111 getPayTypeList(data1[0].dkey);112 tradeCoin = data2[0].simpleName;113 let step1SelectHtml = '';114 data2.forEach((item, i) => {115 step1SelectHtml += buildStep1SelectHtml(item, i)116 });117 $("#tradeCoin").append(step1SelectHtml);118 let coinHtml = '';119 data3.forEach(item => {120 coinHtml += coinListHtml(item);121 });122 $('.advertise-coin-container').html(coinHtml);123 let tradeCoin001Init = sessionStorage.getItem('tradeCoin001');124 if(tradeCoin001Init) {125 $(`.icon_${tradeCoin001Init}`).addClass('icon-step1-selected');126 $('.user-option .option-coin').text(coinName[tradeCoin001Init]);127 $('.user-option li').eq(0).show();128 }129 let tradeCoinInit = sessionStorage.getItem('tradeCoin');130 if(tradeCoinInit) {131 let setValue = '';132 step1SelectName.forEach(item => {133 if(item.code === tradeCoinInit) {134 setValue = item.name;135 tradeCoin = item.code;136 }137 });138 $('.user-option .option-tran').text(tradeCoin);139 $('#tradeCoin').val(setValue);140 }else {141 sessionStorage.setItem('tradeCoin', 'CNY');142 }143 let jzxe = sessionStorage.getItem('jzxe');144 let zq = sessionStorage.getItem('zq');145 let min = sessionStorage.getItem('min');146 let max = sessionStorage.getItem('max');147 let step2AccuracyTags = sessionStorage.getItem('step2AccuracyTags');148 if(!!zq) {149 if(zq > 0) {150 $('.user-option .step2-xq').text(`赚得${zq}%`);151 } else {152 $('.user-option .step2-xq').text(`亏损${zq}%`);153 }154 $('.user-option li').eq(3).show(300);155 }else {156 $('.user-option li').eq(3).hide(300);157 }158 if(min && max && jzxe === '1') {159 let t_min = min + tradeCoin;160 let t_max = max + tradeCoin;161 $('.user-option .op-min').text(t_min);162 $('.user-option .op-max').text(t_max);163 $('.user-option li').eq(5).show(300);164 $('.user-option li').eq(4).hide(300);165 }166 if(step2AccuracyTags && step2AccuracyTags !== 'null') {167 if( jzxe === '2') {168 $('.user-option .op-tding').text(step2AccuracyTags);169 $('.user-option li').eq(4).show(300);170 $('.user-option li').eq(5).hide(300);171 }172 }173 }, base.hideLoadingSpin);174 addListener();175 var type=base.getUrlParam("type");176 if(type != "buy") {177 $(".advertise-step1-bigbigTitle .change").removeClass('sell').addClass('buy');178 $('.advertise-step1-bigbigTitle .title').html(base.getText(`卖出您的数字货币以获得利润`));179 $('.advertise-step1-bigbigTitle .text').html(`<p class="text">${base.getText(`想要获得数字货币吗?`)}<span class="change sell">${base.getText(`创建一个出价来购买数字货币`)}</span></p>`);180 tradeType = 1;181 } else {182 $(".advertise-step1-bigbigTitle .change").removeClass('buy').addClass('sell');183 $('.advertise-step1-bigbigTitle .title').html(base.getText('购买数字货币'));184 $('.advertise-step1-bigbigTitle .text').html(`<p class="text">${base.getText('想要出售数字货币吗?')}<span class="change buy">${base.getText('去出售数字货币')}</span></p>`);185 tradeType = 0;186 }187 }188 function salesCalculation() {189 let inputValue =$('#zqInput').val();190 let price = $('.step2-zq-tips .step2-za-tip-market-price .step2-zq-tip-weighter').text();191 let tipMyprice =$('.step2-zq-tips .step2-za-tip-my-price .step2-zq-tip-weighter');192 let tipRate = $('.step2-zq-tips .step2-za-tip-rate .step2-zq-tip-weighter');193 let myprice = price*(1+inputValue/100);194 tipMyprice.html(myprice.toFixed(8));195 if(inputValue !== ''){196 let value = ( Number(inputValue) + 100).toFixed(8);197 tipRate.html(value + '%');198 }else{199 tipRate.html(0 + '%');200 }201 var amountWeight =(Number(myprice) - Number(price)).toFixed(8);202 if(amountWeight < 0){203 $('.step2-zq-tips .step2-za-tip-amount .tip').html(base.getText(`每${adverTypeObj[adverType]}一个${coinName[tradeCoin001]},我将亏损`));204 amountWeight = (-(amountWeight))205 }else{206 $('.step2-zq-tips .step2-za-tip-amount .tip').html(base.getText(`每${adverTypeObj[adverType]}一个${coinName[tradeCoin001]},我将赚取`));207 }208 $('.step2-zq-tips .step2-za-tip-amount .step2-zq-tip-weighter').html(amountWeight);209 }210 //step2 -计算每笔销售211 let timeout = null;212 $('#zqInput').keyup(function(){213 if(timeout) {214 clearTimeout(timeout);215 }216 timeout = setTimeout(() => {217 let inputValue = +$(this).val();218 if(!!inputValue) {219 if(inputValue > 0) {220 $('.user-step2_option .step2-xq').text(`赚得${inputValue}%`);221 } else {222 $('.user-step2_option .step2-xq').text(`亏损${inputValue}%`);223 }224 $('.user-step2_option li').eq(3).show(300);225 }else {226 $('.user-step2_option li').eq(3).hide(300);227 }228 sessionStorage.setItem('zq', inputValue);229 salesCalculation();230 }, 300);231 });232 if($('#zqInput').length > 0) {233 $('#zqInput').mousewheel(stopScrollFun);234 function stopScrollFun(evt) {235 evt = evt || window.event;236 if(evt.preventDefault) {237 // Firefox  238 evt.preventDefault();239 evt.stopPropagation();240 } else {241 // IE  242 evt.cancelBubble=true;243 evt.returnValue = false;244 }245 return false;246 }247 }248 249 function accuracyTags(step2SelectedData) {250 $("#step2AccuracyTags").select2({251 tags: true, //支持新增,默认为false252 maximumSelectionLength: 3, //最多能够选择的个数253 multiple: true, //支持多选,默认为false254 data: step2TagInitData, //下拉框绑定的数据255 allowClear: true, //支持清空,默认为false256 placeholder: base.getText('请选择标签') //提示语257 }).val(step2SelectedData).trigger('change'); //多选情况下给选中项的赋值258 }259 260 // step2 - 初始化方法261 function step2Init() {262 let optionPay = sessionStorage.getItem('optionPay');263 $('.advertise-step2-bigbigTitle .title').html(base.getText(`卖出您的数字货币以获得利润`));264 $('.advertise-step2-bigTitle .zffs').html(base.getText('支付方式'));265 $('.advertise-step2-bigTitle .tksm').html(base.getText('条款和说明'));266 $('.advertise-step2-bigTitle .llzd').html(base.getText('利润率和最低/最高金额'));267 $('.xzqds').html(`<span class="step2">Step2:</span>${base.getText('您想赚取多少利润?')}`);268 $('.advertise-step2-zq .advertise-step2-title').html(base.getText('我想要赚取'));269 $('.advertise-step2-zq .mbxs').html(base.getText('每笔销售'));270 $('.advertise-step2-zq .step2-za-tip-market-price').html(`${base.getText(`${coinName[tradeCoin001]}的当前市场为`)}<span class="step2-zq-tip-weighter"></span> <span class="step2-zq-tip-unit"> USD</span>`);271 $('.advertise-step2-zq .step2-za-tip-my-price').html(`${base.getText(`我正在以每个${coinName[tradeCoin001]}`)}<span class="step2-zq-tip-weighter"></span> <span class="step2-zq-tip-unit"> USD</span>${base.getText(`的价格${adverTypeObj[adverType]}。`)}`);272 $('.advertise-step2-zq .step2-za-tip-rate').html(`${base.getText(`我将获得${optionPay}价值的`)}<span class="step2-zq-tip-weighter"></span>`);273 $('.advertise-step2-zq .step2-za-tip-amount').html(`<span class="tip">${base.getText(`每${adverTypeObj[adverType]}一个${coinName[tradeCoin001]},我将赚取`)}</span><span class="step2-zq-tip-weighter"></span> <span class="step2-zq-tip-unit"> USD</span>。`);274 $('.advertise-step2-jyxe .jyxe').html(`<span class="step2-title step2-jyxe-title">${base.getText('我的交易限额')}</span><span class="jzxe" data-type="1">${base.getText('使用精准限额')}</span>`);275 $('.advertise-step2-jyxe .zdjye').html(base.getText('最低交易金额'));276 $('.advertise-step2-jyxe .zgjye').html(base.getText('最高交易金额'));277 $('.advertise-step2-jyxe .jyxe-tip1').html(base.getText('借助这些限额,人们可以在最低交易金额到最高交易金额范围内与您交易。'));278 $('.advertise-step2-jyxe .jyxe-tip2').html(base.getText(`当交易开始时,等额的${coinName[tradeCoin001]}将转到托管中。例如,当50USD的交易开始时,相应金额的${coinName[tradeCoin001]}将转入托管。`));279 $('.advertise-step2-jyxe .jyxe-tip3').html(`${base.getText('出价当前未公开显示。若要使其可见,请执行以下操作: 存入')} <span class="coin_bzj"></span> ${base.getText('保证金,或者请获得验证')}`);280 $('.advertise-setp2-cancel-transcation .advertise-step2-title').html(base.getText('如果买家不在以下时间内支付'));281 $('.advertise-setp2-cancel-transcation .fz').html(base.getText('分钟'));282 $('.advertise-setp2-cancel-transcation .qxjy').html(base.getText('交易将被取消'));283 $('.advertise-setp2-cancel-transcation .step2-cencel-tip').html(base.getText('对您的出价感兴趣的人有多少时间来实际支付,如果买家未在付款窗口过期前点击“标记为已付款”,则交易将自动取消'));284 $('.xyb').html(base.getText('下一步'));285 if(!tradeCoin001) {286 base.showMsg(base.getText('请先进行第一步'));287 setTimeout(() => {288 base.gohref('../trade/advertise.html');289 }, 1000);290 return;291 }292 base.showLoadingSpin();293 $.when(294 TradeCtr.getMarket(sessionStorage.getItem('tradeCoin'), tradeCoin001),295 GeneralCtr.getSysConfig('trade_validate_min_minutes'),296 GeneralCtr.getSysConfig(tradeObj[tradeCoin001]),297 GeneralCtr.getSysConfigType('trade_rule', true),298 GeneralCtr.getDictList({ parentKey: 'trade_price_type' })299 ).then((data1, data2, data3, data4, data5) => {300 trade_btc_bail = data4.trade_btc_bail;301 trade_usdt_bail = data4.trade_usdt_bail;302 base.hideLoadingSpin();303 let timeInput = sessionStorage.getItem('cancelTime') || '';304 if(timeInput) {305 cancelTimeInput = timeInput;306 }else {307 cancelTimeInput = data2.cvalue;308 }309 $('#cancelTimeInput').val(cancelTimeInput);310 $('.step2-zq-tips .step2-za-tip-market-price .step2-zq-tip-weighter').html(data1[0].lastPrice);311 $('.step2-zq-tips .step2-zq-tip-unit ,.advertise-step2-jyxe .step2-input .step2-input-tip,.min-price .step2-input-tip').html(data1[0].referCurrency);312 salesCalculation();313 data5.map((item) => {314 item.text = item.dvalue;315 item.id = item.dvalue;316 });317 step2TagInitData = data5;318 let step2SelectedData = [];319 accuracyTags(step2SelectedData);320 let feeRate = sessionStorage.getItem('feeRate');321 let tradeCoin001 = sessionStorage.getItem('tradeCoin001');322 let tradeCoin = sessionStorage.getItem('tradeCoin');323 $('.coin_bzj').text((tradeCoin001 === 'BTC' ? trade_btc_bail : trade_usdt_bail) + ' ' + tradeCoin001);324 $('.user-step2_option .option-coin').text(coinName[tradeCoin001]);325 $('.user-step2_option .option-pay').text(optionPay);326 $('.user-step2_option .option-tran').text(tradeCoin);327 $('.user-step2_option .fee').text(feeRate);328 $('.user-step2_option li').eq(0).show(300);329 $('.user-step2_option li').eq(1).show(300);330 $('.user-step2_option li').eq(2).show(300);331 let jzxe = sessionStorage.getItem('jzxe');332 let zq = sessionStorage.getItem('zq');333 let min = sessionStorage.getItem('min');334 let max = sessionStorage.getItem('max');335 let step2AccuracyTags = sessionStorage.getItem('step2AccuracyTags');336 if(jzxe) {337 if(jzxe === '2'){338 $('.jzxe').text(base.getText('使用交易金额'));339 $('.step2-min,.step2-max').hide();340 $('.step2-accuracy').show();341 $('.jzxe').attr('data-type','2');342 }else{343 $('.jzxe').text(base.getText('使用精准限额'));344 $('.step2-min,.step2-max').show();345 $('.step2-accuracy').hide();346 $('.jzxe').attr('data-type','1');347 }348 }349 if(zq) {350 $('#zqInput').val(zq);351 let price = $('.step2-zq-tips .step2-za-tip-market-price .step2-zq-tip-weighter').text();352 let myprice = price*(1 + zq / 100);353 let tipMyprice = $('.step2-zq-tips .step2-za-tip-my-price .step2-zq-tip-weighter');354 let tipRate = $('.step2-zq-tips .step2-za-tip-rate .step2-zq-tip-weighter');355 tipMyprice.html(myprice);356 tipRate.text(zq + '%');357 let amountWeight =(Number(myprice) - Number(price)).toFixed(8);358 if(amountWeight < 0){359 $('.step2-zq-tips .step2-za-tip-amount .tip').html(base.getText(`每${adverTypeObj[adverType]}一个${coinName[tradeCoin001]},我将亏损`));360 amountWeight = (-(amountWeight))361 }else{362 $('.step2-zq-tips .step2-za-tip-amount .tip').html(base.getText(`每${adverTypeObj[adverType]}一个${coinName[tradeCoin001]},我将赚取`));363 }364 $('.step2-zq-tips .step2-za-tip-amount .step2-zq-tip-weighter').html(amountWeight);365 if(!!zq) {366 if(zq > 0) {367 $('.user-step2_option .step2-xq').text(`赚得${zq}%`);368 } else {369 $('.user-step2_option .step2-xq').text(`亏损${zq}%`);370 }371 $('.user-step2_option li').eq(3).show(300);372 }else {373 $('.user-step2_option li').eq(3).hide(300);374 }375 }376 if(min) {377 $('#minInput').val(min);378 }379 if(max) {380 $('#maxInput').val(max)381 }382 if(min && max && jzxe === '1') {383 let t_min = min + tradeCoin;384 let t_max = max + tradeCoin;385 $('.user-step2_option .op-min').text(t_min);386 $('.user-step2_option .op-max').text(t_max);387 $('.user-step2_option li').eq(5).show(300);388 $('.user-step2_option li').eq(4).hide(300);389 }390 if(step2AccuracyTags && step2AccuracyTags !== 'null') {391 $("#step2AccuracyTags").select2("val", [step2AccuracyTags.split(',')]);392 if( jzxe === '2') {393 $('.user-step2_option .op-tding').text(step2AccuracyTags);394 $('.user-step2_option li').eq(4).show(300);395 $('.user-step2_option li').eq(5).hide(300);396 }397 }398 if (code !== "") {399 getAdvertiseDetail();400 }401 }, base.hideLoadingSpin);402 addListener();403 let type = base.getUrlParam('type');404 if(type === 'buy') {405 $('.advertise-step2-bigbigTitle .title,.advertise-step3-bigbigTitle .title').text(base.getText(`购买数字货币`));406 }else{407 $('.advertise-step2-bigbigTitle .title,.advertise-step3-bigbigTitle .title').text(base.getText(`卖出您的数字货币以获得利润`));408 }409 }410 // step3 - 初始化方法411 function step3Init() {412 setHtml();413 $('.advertise-step3-bigbigTitle .title').html(base.getText('卖出您的数字货币以获得利润'));414 $('.advertise-step3-bigTitle .zffs').html(base.getText('支付方式'));415 $('.advertise-step3-bigTitle .mjtk').html(base.getText('条款和说明'));416 $('.advertise-step3-bigTitle .llv').html(base.getText('利润率和最低/最高金额'));417 $('.nxysm').html(`<span class="step3">Step3:</span>${base.getText('您需要客户提供什么?')}`);418 $('.advertise-step3-box .advertise-step3-tags-title').html(base.getText('选择最能描述您的出价的标签'));419 $('.advertise-step3-box .step3-tip-tags').html(base.getText('添加描述您的出价条款的简要标签,例如“无需ID”、“无需收据”,最多3个标签。'));420 $('.advertise-step3-box .advertise-step3-my-tag-title').html(base.getText('您的出价标签'));421 $('.advertise-step3-box .step3-tip-my-tag').html(base.getText('任何如“立即放行”或“无需收据”等推广内容将显示在支付方式后面。'));422 $('.advertise-step3-box .advertise-step3-clause-title').html(base.getText('为买家编写您的条款'));423 $('.advertise-step3-box .step3-tip-clause').html(base.getText('在您的出价列表中公开显示。出价条款必须向用户说明一些信息,如:接受现金或亲自到银行分行,或访问一个外部网站等。这些信息并不足以完成交易,只是可以让他们知道会发生什么情况。'));424 $('.advertise-step3-box .advertise-step3-explain-title').html(base.getText('确切的交易说明'));425 $('.advertise-step3-box .step3-tip-explain').html(base.getText('一旦交易开始即显示。交易说明必须简短、情绪,并尽可能以列表形式组织。需要清晰的分布说明。较长的文本请放至底部。'));426 $('.advertise-step3-target-area-title').html(base.getText('目标国家/地区'));427 $('.advertise-step3-target-area .gjdq').html(base.getText('选择要作为目标的国家/地区,此市场将产生额外流量。'));428 $('.advertise-step3-target-area .jg').html(base.getText('警告:对不符合的出价滥用此功能可能会导致账户被封停。'));429 $('.advertise-step3-condition .advertise-step3-condition-title').html(base.getText('验证'));430 $('.advertise-step3-condition .dzyj').html(`<i class="icon-step3-checked" data-code="email"></i>${base.getText('需要交易伙伴验证过他们的电子邮件')}`);431 $('.advertise-step3-condition .dh').html(`<i class="icon-step3-checked" data-code="mobile"></i>${base.getText('需要交易伙伴验证过他们的电话')}`);432 $('.advertise-step3-condition .sf').html(`<i class="icon-step3-checked" data-code="id"></i>${base.getText('需要交易伙伴验证过他们的身份')}`);433 $('.advertise-step3-visible-title').html(base.getText('可见性'));434 $('.visible-checkbox-item').html(`<i class="icon-step3-checked"></i>${base.getText('仅向受信任列表中的用户显示此出价')}`);435 $('.advertise-step3-min-trade-num-title').html(base.getText('需要的最小交易次数'));436 $('.advertise-step3-min-trade-num .step2-cencel-tip').html(base.getText('只有至少拥有这么多次交易的用户才能看到您的出价'));437 $('.advertise-step3-min-trade-num .step3-input-tip').html(base.getText('过去的交易'));438 $('.advertise-step3-area-limit-title').html(base.getText('国家/地区限制'));439 $('.advertise-step3-area-limit .step2-cencel-tip').html(base.getText('让您的出价对正从您在下面定义的国家/地区浏览的用户可见隐藏'));440 $('.advertise-step3-area-limit .byxgj').html(`<i class="icon-step3-checked" data-code="notAllow"></i>${base.getText('不允许的国家/地区')}`);441 $('.advertise-step3-area-limit .yxgj').html(`<i class="icon-step3-checked" data-code="allow"></i>${base.getText('允许的国家/地区')}`);442 $('.advertise-step3-vpn .advertise-step3-vpn-title').html(base.getText('代理/VPN 限制'));443 $('.advertise-step3-vpn .advertise-step3-vpn-title').html(`<i class="icon-step3-checked" data-code="0"></i>${base.getText('禁止VPN、Tor、代理和其他匿名用户')}`);444 445 base.showLoadingSpin();446 $.when(447 TradeCtr.getTagsList({ status: 1 }),448 TradeCtr.getCountryList({ status: 1 })449 ).then((data1, data2) => {450 base.hideLoadingSpin();451 data1.map((item) => {452 item.text = item.name;453 });454 step3TagInitData = data1;455 let step3SelectedData = [];456 select2WithData(step3SelectedData);457 let step3CountryListHtml = '';458 data2.map((item, i) => {459 step3CountryListHtml += buildStep3CountryListHtml(item);460 });461 $('#targetArea').html(step3CountryListHtml);462 if (code !== "") {463 getAdvertiseDetail();464 }465 let optionPay = sessionStorage.getItem('optionPay');466 let feeRate = sessionStorage.getItem('feeRate');467 let step3TagsDataInit = sessionStorage.getItem('step3TagsData');468 let myTagInput = sessionStorage.getItem('myTagInput');469 let clauseTextarea = sessionStorage.getItem('clauseTextarea');470 let explainTextarea = sessionStorage.getItem('explainTextarea');471 if(step3TagsDataInit) {472 $('#step3Tags').select2("val", [step3TagsDataInit.split('||')]);473 }474 if(myTagInput) {475 $('#myTagInput').val(myTagInput);476 }477 if(clauseTextarea) {478 $('#clauseTextarea').val(clauseTextarea);479 }480 if(explainTextarea) {481 $('#explainTextarea').val(explainTextarea);482 }483 let tradeCoin001Init = sessionStorage.getItem('tradeCoin001');484 if(tradeCoin001Init) {485 $('.user-step3_option .option-coin').text(coinName[tradeCoin001Init]);486 $('.user-step3_option li').eq(0).show();487 }488 if(optionPay) {489 $('.user-step3_option .option-pay').text(optionPay);490 $('.user-step3_option .option-tran').text(tradeCoin);491 $('.user-step3_option li').eq(1).show();492 }493 if(feeRate) {494 $('.user-step3_option .fee').text(feeRate);495 $('.user-step3_option li').eq(2).show();496 }497 let jzxe = sessionStorage.getItem('jzxe');498 let zq = sessionStorage.getItem('zq');499 let min = sessionStorage.getItem('min');500 let max = sessionStorage.getItem('max');501 let step2AccuracyTags = sessionStorage.getItem('step2AccuracyTags');502 if(!!zq) {503 if(zq > 0) {504 $('.user-step3_option .step2-xq').text(`赚得${zq}%`);505 } else {506 $('.user-step3_option .step2-xq').text(`亏损${zq}%`);507 }508 $('.user-step3_option li').eq(3).show(300);509 }else {510 $('.user-step3_option li').eq(3).hide(300);511 }512 if(min && max && jzxe === '1') {513 let t_min = min + tradeCoin;514 let t_max = max + tradeCoin;515 $('.user-step3_option .op-min').text(t_min);516 $('.user-step3_option .op-max').text(t_max);517 $('.user-step3_option li').eq(5).show(300);518 $('.user-step3_option li').eq(4).hide(300);519 }520 if(step2AccuracyTags && step2AccuracyTags !== 'null') {521 if( jzxe === '2') {522 $('.user-step3_option .op-tding').text(step2AccuracyTags);523 $('.user-step3_option li').eq(4).show(300);524 $('.user-step3_option li').eq(5).hide(300);525 }526 }527 }, base.hideLoadingSpin);528 addListener();529 let type = base.getUrlParam('type');530 if(type === 'buy') {531 $('.advertise-step2-bigbigTitle .title,.advertise-step3-bigbigTitle .title').text(base.getText(`购买数字货币`));532 }else {533 $('.advertise-step2-bigbigTitle .title,.advertise-step3-bigbigTitle .title').text(base.getText(`卖出您的数字货币以获得利润`));534 }535 }536 function select2WithData(step3SelectedData) {537 $("#step3Tags").select2({538 tags: true, //支持新增,默认为false539 maximumSelectionLength: 3, //最多能够选择的个数540 multiple: true, //支持多选,默认为false541 data: step3TagInitData, //下拉框绑定的数据542 allowClear: true, //支持清空,默认为false543 placeholder: base.getText('请选择标签') //提示语544 }).val(step3SelectedData).trigger('change'); //多选情况下给选中项的赋值545 }546 // step1-构建顶部tab的dom结构547 function buildTabHtml(data, i) {548 let classHtml;549 if(i === 0) {550 classHtml = 'tab-item active';551 } else {552 classHtml = 'tab-item'553 }554 return `<span class="${classHtml}" data-index=${i} data-dkey=${data.dkey}>${data.dvalue}<i class="active-triangle"></i></span>`555 }556 557 function coinListHtml(data) {558 return `<div class="advertise-coin-item" data-symbol=${data.symbol}>559 <span>${data.symbol}</span><i class="icon_${data.symbol} icon-step1-unselected"></i>560 </div>`;561 }562 // step1-构建交易货币select的dom结构563 function buildStep1SelectHtml(data, i) {564 step1SelectName.push({565 name: data.name,566 code: data.simpleName567 });568 return `<option class="trade-item" value=${data.name} data-code=${data.simpleName}>${data.name}</option>`569 }570 // 构建list的dom结构571 function buildListHtml(data, i) {572 payList.push({573 name: data.name,574 code: data.code575 });576 return `<div class="advertise-payType-item ${data.code}" data-code=${data.code}>577 <span>${data.name}</span><i class="icon icon-step1-unselected"></i>578 </div>`579 }580 // step3 - 构建目标国家/地区list581 function buildStep3CountryListHtml(data) {582 return `<option value=${data.code}>${data.chineseName}</option>`583 }584 // 列表查付款方式585 function getPayTypeList(dkey) {586 let config;587 if(dkey) {588 config = {type: dkey, status: 1};589 } else {590 config = {type: payBigType, name: paySearch, status: 1}591 }592 return TradeCtr.getPayTypeList(config).then((res) => {593 let listHtml = '';594 res.forEach((item, i) => {595 listHtml += buildListHtml(item, i)596 });597 $(".advertise-payType-item-container").html(listHtml);598 let paySubTypeInit = sessionStorage.getItem('paySubType');599 if(paySubTypeInit) {600 $('.advertise-payType-item-container .' + paySubTypeInit).addClass('on');601 paySubType = paySubTypeInit;602 let optionPay = $('.advertise-payType-item-container .' + paySubTypeInit).children('span').text();603 sessionStorage.setItem('optionPay', optionPay);604 $('.user-option .option-pay').text(optionPay);605 let feeRateData = rateList.filter(item => item.paymentCode === paySubType);606 let feeRate = '';607 debugger608 if(feeRateData.length > 0) {609 feeRate = feeRateData[0].feeRate;610 $('.user-option .fee').text(feeRate);611 sessionStorage.setItem('feeRate', feeRate);612 }else {613 $('.user-option .fee').text(defaultFee);614 sessionStorage.setItem('feeRate', defaultFee);615 }616 $('.user-option li').eq(1).show(300);617 $('.user-option li').eq(2).show(300);618 }619 if (code !== "") {620 getAdvertiseDetail();621 }622 })623 }624 function setHtml() {625 $('.fy_gjsz').html(base.getText('高级选项'));626 $('.fy_xsgjsz').html(base.getText('高级选项') + '...');627 $('.ljfb').html(base.getText('立即发布'));628 $('.advertise-out-container .advertise-step1-bigbigTitle .title').html(base.getText(`卖出您的数字货币以获得利润`));629 $('.advertise-out-container .advertise-step1-bigTitle .zffs').html(base.getText('支付方式'));630 $('.advertise-out-container .advertise-step1-bigTitle .mjtk').html(base.getText('条款和说明'));631 $('.advertise-out-container .advertise-step1-bigTitle .llv').html(base.getText('利润率和最低/最高金额'));632 $('.advertise-out-container .advertise-step1-bigTitle .ndkh').html(`<span class="step1">Step1:</span>${base.getText('您的客户将以哪种方式向您付款?')}`);633 $('.advertise-out-container .advertise-step1-bigbigTitle .text').html(`${base.getText(`想要获得数字货币吗?`)}<span class="change sell"> ${base.getText(`创建一个出价来购买数字货币`)}</span>`);634 $('.advertise-out-container #tradeCurrency').attr('placeHolder', base.getText('在所有支付方式中搜索'));635 $('.advertise-out-container .advertise-step1-title').html(base.getText('支付方式'));636 $('.advertise-out-container .advertise-payType-title').html(base.getText('选择下面的支付方式'));637 $('.advertise-out-container .advertise-step1-title').html(base.getText('我将以如下数字货币交易'));638 $('.advertise-out-container .step1-my-trade-coin-tips').html(base.getText(`您的出价将以选定数字货币${adverTypeObj[adverType]}。例如,如果您选择美元,则您的出价将对希望以美元购买的所有人可见。`));639 $('.advertise-out-container .advertise-step1-btn').html(base.getText('下一步'));640 }641 //获取广告详情642 function getAdvertiseDetail() {643 return TradeCtr.getAdvertiseDetail(code).then((data) => {644 pay = data.tradeCurrency;645 if(pay == 'CNY'){646 $('.m-type').text('CNY');647 }else{648 $('.m-type').text('USD');649 }650 status = data.status;651 data.premiumRate = (data.premiumRate * 100).toFixed(2);652 data.minTrade = data.minTrade;653 data.maxTrade = (Math.floor(parseInt(data.maxTrade) * 100) / 100).toFixed(2);654 mid = data.marketPrice;655 var tradeCoin = data.tradeCoin;656 if($('.advertise-coin-container').length > 0) {657 tradeCoin001 = tradeCoin;658 $(`.icon_${tradeCoin001}`).addClass('icon-step1-selected');659 //币种660 if(data.tradeCurrency == 'CNY'){661 $("#tradeCoin").val(base.getText('人民币'))662 }else{663 $("#tradeCoin").val(base.getText('美元'))664 }665 sessionStorage.setItem('tradeCoin', data.tradeCurrency);666 sessionStorage.setItem('tradeCoin001', tradeCoin);667 }668 data.totalCount = base.formatMoney(data.totalCountString, '', tradeCoin);669 //广告类型670 if (data.tradeType == '1') {671 $(".trade-type .item").eq(0).addClass("on").siblings('.item').removeClass("on").addClass("hidden")672 } else {673 $(".trade-type .item").eq(1).addClass("on").siblings('.item').removeClass("on").addClass("hidden")674 }675 // $(".trade-type .item.on .icon-check").click();676 $("#form-wrapper").setForm(data);677 if($(".advertise-payType-item").length > 0){678 $(".advertise-payType-item").each(function(){679 paySubType = data.payType;680 if($(this).attr("data-code") == data.payType){681 $(this).addClass("on").siblings().removeClass("on");682 }683 });684 }685 $("#coin").text($("#tradeCoin").val());686 $("#price").attr("data-coin", $("#tradeCoin").val());687 $("#price").val((Math.floor(data.truePrice * 100) / 100).toFixed(2));688 var type =base.getUrlParam('type');689 if(type == 'sell') {690 $('.advertise-step1-bigbigTitle .text').removeClass('buy').addClass('sell');691 $('.advertise-step1-bigbigTitle .title').html(base.getText(`卖出您的数字货币以获得利润`));692 $('.advertise-step1-bigbigTitle .text').html(`<p class="text">${base.getText(`想要获得数字货币吗?`)}<span class="change sell">${base.getText(`创建一个出价来购买数字货币`)}</span></p>`);693 tradeType = 1;694 } else {695 $('.advertise-step1-bigbigTitle .text').removeClass('sell').addClass('buy');696 $('.advertise-step1-bigbigTitle .title').html(base.getText(`购买数字货币`));697 $('.advertise-step1-bigbigTitle .text').html(`<p class="text">${base.getText(`想要出售数字货币吗?`)}<span class="change buy">${base.getText(`去出售数字货币`)}</span></p>`);698 tradeType = 0;699 }700 //step2701 $("#zqInput").val(data.premiumRate);702 salesCalculation();703 if(data.fixTrade !== ''){704 $('.jzxe').text(base.getText('使用交易金额'));705 $('.step2-min,.step2-max').hide();706 $('.step2-accuracy').show();707 var fixTrade = data.fixTrade;708 fixTrade = fixTrade.split('||');709 $("#step2AccuracyTags").select2("val", [fixTrade]);710 $('.jzxe').attr('data-type','2');711 }else{712 $('.jzxe').text(base.getText('使用精准限额'));713 $('.step2-min,.step2-max').show();714 $('.step2-accuracy').hide();715 $("#minInput").val(data.minTrade);716 $("#maxInput").val(data.maxTrade);717 $('.jzxe').attr('data-type','1');718 }719 $("#cancelTimeInput").val(data.payLimit);720 //step3721 var platTag = data.platTag;722 platTag=platTag.split('||');723 $("#step3Tags").length > 0 && $("#step3Tags").select2("val", [platTag]);724 $("#myTagInput").val(data.customTag);725 $("#clauseTextarea").val(data.item);726 $("#explainTextarea").val(data.leaveMessage);727 //正式728 //账户余额729 $(".accountLeftCountString").text($(".accountLeftCountString").attr('data-amount'));730 //是否仅粉丝731 if (data.onlyTrust == '1') {732 $("#onlyTrust").addClass("on")733 } else {734 $("#onlyTrust").removeClass("on")735 }736 //开放时间737 if (data.displayTime.length && data.displayTime.length > 0) { //自定义738 $(".time-type .item").eq(1).addClass("on").siblings(".item").removeClass("on");739 $("#timeWrap").removeClass("hide")740 $("#timeWrap .time-item:nth-of-type(1) .startTime").val(data.displayTime[0].startTime);741 $("#timeWrap .time-item:nth-of-type(1) .endTime").val(data.displayTime[0].endTime);742 $("#timeWrap .time-item:nth-of-type(2) .startTime").val(data.displayTime[1].startTime);743 $("#timeWrap .time-item:nth-of-type(2) .endTime").val(data.displayTime[1].endTime);744 $("#timeWrap .time-item:nth-of-type(3) .startTime").val(data.displayTime[2].startTime);745 $("#timeWrap .time-item:nth-of-type(3) .endTime").val(data.displayTime[2].endTime);746 $("#timeWrap .time-item:nth-of-type(4) .startTime").val(data.displayTime[3].startTime);747 $("#timeWrap .time-item:nth-of-type(4) .endTime").val(data.displayTime[3].endTime);748 $("#timeWrap .time-item:nth-of-type(5) .startTime").val(data.displayTime[4].startTime);749 $("#timeWrap .time-item:nth-of-type(5) .endTime").val(data.displayTime[4].endTime);750 $("#timeWrap .time-item:nth-of-type(6) .startTime").val(data.displayTime[5].startTime);751 $("#timeWrap .time-item:nth-of-type(6) .endTime").val(data.displayTime[5].endTime);752 $("#timeWrap .time-item:nth-of-type(7) .startTime").val(data.displayTime[6].startTime);753 $("#timeWrap .time-item:nth-of-type(7) .endTime").val(data.displayTime[6].endTime);754 } else { // 任何时候755 $(".time-type .item").eq(0).addClass("on").siblings(".item").removeClass("on");756 $("#timeWrap").addClass("hide")757 }758 if (data.status == "1") {759 $("#doDownBtn").removeClass("hidden")760 }761 base.hideLoadingSpin();762 }, base.hideLoadingSpin)763 }764 //获取广告说明 type = buy ,sell765 function getExplain(type) {766 var param = '';767 if (type == 'buy') {768 param = 'buy_ads_hint'769 } else if (type == 'sell') {770 param = 'sell_ads_hint'771 }772 if(document.getElementById("form-wrapper")){773 document.getElementById("form-wrapper").reset();774 }775 $("#price").val(mid);776 return GeneralCtr.getSysConfigType(param, true).then((data) => {777 $("#displayTimeExp").html(data['displayTime'+langText]);778 $("#maxTradeExp").html(data['maxTrade'+langText])779 $("#minTradeExp").html(data['minTrade'+langText])780 $("#payLimitExp").html(data['payLimit'+langText])781 $("#payTypeExp").html(data['payType'+langText])782 $("#premiumRateExp").html(data['premiumRate'+langText])783 $("#priceExp").html(data['price'+langText]);784 if (type == 'buy') {785 $("#protectPriceExp").siblings('.txt').text(base.getText('最高价格') + ':');786 $("#protectPrice").attr('placeholder', base.getText('广告最高可成交的价格'));787 $("#totalCountExp").siblings('.txt').text(base.getText('购买总量') + ':');788 $("#totalCount").attr('placeholder', base.getText('请输入购买币的总量'));789 } else if (type == 'sell') {790 $("#protectPriceExp").siblings('.txt').text(base.getText('最低价格') + ':');791 $("#protectPrice").attr('placeholder', base.getText('广告最低可成交的价格'));792 $("#totalCountExp").siblings('.txt').text(base.getText('出售总量') + ':');793 $("#totalCount").attr('placeholder', base.getText('请输入售卖币的总量'));794 $('.advertise-step2-bigbigTitle .title,.advertise-step3-bigbigTitle .title').text(base.getText(`卖出您的数字货币以获得利润`));795 }796 $("#protectPriceExp").html(data['protectPrice'+langText]);797 $("#totalCountExp").html(data['totalCount'+langText]);798 $("#trustExp").html(data['trust'+langText]);799 base.hideLoadingSpin();800 }, base.hideLoadingSpin)801 }802 // 发布广告803 function publishAdvertising() {804 if(!$('#step3Tags').val()) {805 base.showMsg(base.getText('请选择标签'));806 return;807 }808 // if(!$('#myTagInput').val()) {809 // base.showMsg(base.getText('请填写自定义标签'));810 // return;811 // }812 if(!$('#clauseTextarea').val()) {813 base.showMsg(base.getText('请填写条款'));814 return;815 }816 if(!$('#explainTextarea').val()) {817 base.showMsg(base.getText('请填写交易说明'));818 return;819 }820 base.showLoadingSpin();821 let platTag = $('#step3Tags').val().join('||');822 let step2AccuracyTags = sessionStorage.getItem('step2AccuracyTags');823 step2AccuracyTags = step2AccuracyTags.split(',').join('||').toString();824 if(step2AccuracyTags === 'null'){825 step2AccuracyTags = '';826 }827 return TradeCtr.submitAdvertise({828 allowCountry: targetArea,829 fixTrade:step2AccuracyTags || undefined,830 customTag: $('#myTagInput').val(),831 isValidateEmail: step3ConditionConfig.email,832 isValidateIdentity: step3ConditionConfig.id,833 isValidateTelephone: step3ConditionConfig.mobile,834 item: $('#clauseTextarea').val(),835 leaveMessage: $('#explainTextarea').val(),836 maxTrade: Number(sessionStorage.getItem('max')) || undefined,837 minTrade: Number(sessionStorage.getItem('min')) || undefined,838 notAllowCountry: step3AreaLimit,839 onlyTrust: 0,840 payLimit: sessionStorage.getItem('cancelTime'),841 payType: sessionStorage.getItem('paySubType'),842 platTag: platTag,843 premiumRate: sessionStorage.getItem('zq') / 100,844 targetCountry: $('#targetArea').val(),845 tradeCurrency: sessionStorage.getItem('tradeCoin'),846 tradeType: Number(sessionStorage.getItem('tradeType')),847 tradeCoin: sessionStorage.getItem('tradeCoin001'),848 isAllowProxy: isAllowProxy || 1849 }).then((res) => {850 base.showMsg(base.getText('操作成功'));851 sessionStorage.removeItem('cancelTime');852 sessionStorage.removeItem('myTagInput');853 sessionStorage.removeItem('clauseTextarea');854 sessionStorage.removeItem('explainTextarea');855 sessionStorage.removeItem('jzxe');856 sessionStorage.removeItem('step2AccuracyTags');857 sessionStorage.removeItem('max');858 sessionStorage.removeItem('min');859 sessionStorage.removeItem('tradeCoin');860 sessionStorage.removeItem('zq');861 sessionStorage.removeItem('step3TagsData');862 sessionStorage.removeItem('tradeCoin001');863 sessionStorage.removeItem('tradeType');864 sessionStorage.removeItem('paySubType');865 if (parseInt(sessionStorage.getItem('tradeType')) === 0) {866 base.gohref('../order/order-list.html?coin=' + coin + '&adverType=BUY&mod=gg');867 } else {868 base.gohref('../order/order-list.html?coin=' + coin + '&adverType=SELL&mod=gg');869 }870 base.showLoadingSpin();871 }, base.hideLoadingSpin);872 }873 let tag3Time = '';874 function addListener() {875 $('#zqInput').change(function() {876 if($(this).val()) {877 sessionStorage.setItem('zq', $(this).val());878 }879 });880 $('#minInput').change(function() {881 if($(this).val()) {882 sessionStorage.setItem('min', $(this).val());883 }884 });885 $('#maxInput').change(function() {886 if($(this).val()) {887 sessionStorage.setItem('max', $(this).val());888 }889 });890 $("#myTagInput").change(function() {891 if($(this).val()) {892 sessionStorage.setItem('myTagInput', $(this).val());893 }894 });895 $('#step2AccuracyTags').change(function() {896 if($(this).val()) {897 sessionStorage.setItem('step2AccuracyTags', $(this).val());898 }899 });900 $("#clauseTextarea").change(function() {901 if($(this).val()) {902 sessionStorage.setItem('clauseTextarea', $(this).val());903 }904 });905 $("#explainTextarea").change(function() {906 if($(this).val()) {907 sessionStorage.setItem('explainTextarea', $(this).val());908 }909 });910 $("#step3Tags").change(function() {911 if($(this).val()) {912 step3TagsData = $(this).val().join('||');913 }914 if(tag3Time) {915 clearTimeout(tag3Time);916 }917 tag3Time = setTimeout(() => {918 sessionStorage.setItem('step3TagsData', step3TagsData);919 }, 500);920 });921 $('.advertise-coin-container').on('click', '.advertise-coin-item', function(){922 $(this).children('i').addClass('icon-step1-selected');923 $(this).siblings().children('i').removeClass('icon-step1-selected');924 tradeCoin001 = $(this).attr('data-symbol');925 sessionStorage.setItem('tradeCoin001', tradeCoin001);926 $('.user-option li').eq(0).show(300);927 $('.user-option .option-coin').text(coinName[tradeCoin001]);928 });929 //選擇切換-点击930 $(".trade-type .icon-check").click(function() {931 var _this = $(this);932 base.showLoadingSpin();933 //在线出售934 if (_this.parent(".item").index() == '0') {935 $(".accountCount").removeClass("hidden");936 getExplain('sell')937 //在线购买938 } else if (_this.parent(".item").index() == '1') {939 $(".accountCount").addClass("hidden");940 getExplain('buy');941 $('.num-go').css('left', '50%');942 $('.yj-num').val('0.00');943 }944 _this.parent(".item").addClass("on").siblings(".item").removeClass("on");945 })946 //受信任-点击947 $("#onlyTrust").click(function() {948 if ($(this).hasClass("on")) {949 $(this).removeClass("on");950 } else {951 $(this).addClass("on");952 }953 })954 //開放時間選擇-点击955 $(".time-type .icon-check").click(function() {956 var _this = $(this);957 _this.parent(".item").addClass("on").siblings(".item").removeClass("on");958 if (_this.parent(".item").hasClass("all")) {959 $("#timeWrap").addClass("hide")960 } else {961 $("#timeWrap").removeClass("hide")962 }963 })964 //显示高级设置 - 点击965 $(".advertise-hidden").click(function() {966 var _this = $(this);967 if (_this.hasClass("hide")) {968 $(".advertise-set .set-wrap").removeClass("hidden");969 _this.removeClass("hide");970 _this.text(base.getText('隐藏高级设置') + "...")971 } else {972 $(".advertise-set .set-wrap").addClass("hidden");973 _this.text(base.getText('显示高级设置') + "...");974 _this.addClass("hide")975 }976 });977 var _formWrapper = $("#form-wrapper");978 _formWrapper.validate({979 'rules': {980 "truePrice": {981 required: true,982 number: true,983 amountCny: true984 },985 "premiumRate": {986 required: true,987 number: true,988 tofixed2: true,989 range: [-99.99, 99.99]990 },991 "protectPrice": {992 required: true,993 number: true,994 amountCny: true995 },996 "minTrade": {997 required: true,998 number: true,999 amountCny: true1000 },1001 "maxTrade": {1002 required: true,1003 number: true,1004 amountCny: true1005 },1006 "totalCount": {1007 required: true,1008 number: true,1009 amountEth: true1010 },1011 "payType": {1012 required: true,1013 },1014 "payLimit": {1015 required: true,1016 },1017 "leaveMessage": {1018 required: true,1019 },1020 },1021 onkeyup: false1022 })1023 $('.yj-num').keyup(function(){//(parWidth * data.premiumRate) / 100;1024 let leftValue = parseFloat($(".yj-num").val());1025 if($(".yj-num").val() != '-' && $(".yj-num").val().length == 1){1026 if(isNaN(leftValue)){1027 base.showMsg(base.getText('请输入数字'));1028 }1029 return;1030 }1031 if($(".yj-num").val() == ''){1032 $(".yj-num").val('0');1033 leftValue = 0;1034 }1035 if(leftValue > 50){1036 $(".yj-num").val('50');1037 leftValue = 50;1038 }1039 if(leftValue < -50){1040 $(".yj-num").val('-50');1041 leftValue = -50;1042 }1043 let parWidth = $('.num-huadtiao').width();1044 jdLeft = (parWidth * leftValue) / 100;1045 isKup = false;1046 let jdValue = (mid * (1 + (leftValue / 100))).toFixed(2);1047 let ccWidth = 50 / $('.num-huadtiao').width();1048 $("#price").val(jdValue);1049 $('.num-go').css({1050 left: (50 + leftValue - ccWidth) + '%'1051 });1052 })1053 // step1 - 下一步按钮点击事件1054 $('.advertise-step1-btn').on('click', () => {1055 if(!tradeCoin001) {1056 base.showMsg(base.getText('请选择币种'));1057 return;1058 }1059 if(!paySubType) {1060 base.showMsg(base.getText('请选择一种支付方式'));1061 return;1062 }1063 sessionStorage.setItem('payBigType', payBigType);1064 sessionStorage.setItem('paySubType', paySubType);1065 sessionStorage.setItem('tradeType', tradeType);1066 let type = tradeType === 1 ? 'sell' : 'buy';1067 if(code != ''){1068 base.gohref('../trade/advertise-step2.html?code='+code+'&coin='+coin+'&type='+type);1069 }else{1070 base.gohref('../trade/advertise-step2.html?type='+type);1071 }1072 });1073 // step2 - 下一步按钮点击事件1074 $('.xyb').on('click', () => {1075 if(!$('#zqInput').val() || !$('#cancelTimeInput').val()) {1076 base.showMsg(base.getText('请填写所有信息'));1077 return;1078 }1079 if(+$('#cancelTimeInput').val() < +cancelTimeInput) {1080 base.showMsg(`${base.getText('请填写大于')}${cancelTimeInput}${base.getText('的时间')}`);1081 return;1082 }1083 if($('.jzxe').attr('data-type') == 1){1084 if(!$('#minInput').val() || !$('#maxInput').val()){1085 base.showMsg(base.getText('请填写所有信息'));1086 return;1087 }1088 if($("#minInput").val() <= 0) {1089 base.showMsg(base.getText('单笔最小交易额必须大于0'));1090 return;1091 }1092 if(Number($("#minInput").val()) >= Number($("#maxInput").val())) {1093 base.showMsg(base.getText('最低不能大于最高交易额'));1094 return;1095 }1096 }else {1097 if(!$("#step2AccuracyTags").select2("val")){1098 base.showMsg(base.getText('请填写所有信息'));1099 return1100 }1101 }1102 if($('.jzxe').attr('data-type') == 1){1103 sessionStorage.setItem('step2AccuracyTags', '');1104 }else{1105 $('#minInput').val('');1106 $('#maxInput').val('');1107 }1108 sessionStorage.setItem('jzxe', $('.jzxe').attr('data-type'));1109 sessionStorage.setItem('zq', $('#zqInput').val());1110 sessionStorage.setItem('min', $('#minInput').val());1111 sessionStorage.setItem('max', $('#maxInput').val());1112 sessionStorage.setItem('step2AccuracyTags', $('#step2AccuracyTags').val() || '');1113 sessionStorage.setItem('cancelTime', $('#cancelTimeInput').val());1114 let type = +sessionStorage.getItem('tradeType') === 1 ? 'sell' : 'buy';1115 if(code != ''){1116 base.gohref('../trade/advertise-step3.html?code='+code+'&coin='+coin+'&type='+type);1117 }else{1118 base.gohref('../trade/advertise-step3.html?type='+type);1119 }1120 });1121 // step2 上一步1122 $('.step2-btns .syb').click(function() {1123 if(code !== '') {1124 base.gohref('../trade/advertise.html?' + href);1125 }else {1126 base.gohref('../trade/advertise.html');1127 }1128 });1129 // step3 - 立即发布按钮点击事件1130 $('.ljfb').on('click', () => {1131 if(code !== ''){1132 editAdvertise();//编辑广告1133 }else{1134 publishAdvertising();//发布广告1135 }1136 });1137 // step3 上一步1138 $('.btnWrap .syb').click(function() {1139 if(code !== '') {1140 base.gohref('../trade/advertise-step2.html?' + href);1141 }else {1142 base.gohref('../trade/advertise-step2.html');1143 }1144 });1145 // step1 - 搜索框1146 $("#tradeCurrency").bind('input propertychange',function(){1147 paySearch = $('#tradeCurrency').val();1148 getPayTypeList()1149 });1150 $('.icon-search').click(function () {1151 paySearch = $('#tradeCurrency').val();1152 getPayTypeList()1153 })1154 // step1-tab点击切换事件1155 $(".advertise-step1-tabs").on("click", ".tab-item", function (e){1156 let target = e.target;1157 $(target).addClass('active').siblings().removeClass('active');1158 payBigType = $(target).attr('data-dkey');1159 getPayTypeList($(target).attr('data-dkey'));1160 });1161 // step1-list点击事件1162 $('.advertise-payType-item-container').on('click', '.advertise-payType-item', (e) => {1163 let target = e.target;1164 paySubType = $(target).attr('data-code');1165 sessionStorage.setItem('paySubType', paySubType);1166 sessionStorage.setItem('optionPay', $(target).children('span').text());1167 let feeRateData = rateList.filter(item => item.paymentCode === paySubType);1168 let feeRate = '';1169 if(feeRateData.length > 0) {1170 feeRate = feeRateData[0].feeRate;1171 $('.user-option .fee').text(feeRate);1172 sessionStorage.setItem('feeRate', feeRate);1173 }else {1174 $('.user-option .fee').text(defaultFee);1175 sessionStorage.setItem('feeRate', defaultFee);1176 }1177 $('.user-option li').eq(1).show(300);1178 $('.user-option li').eq(2).show(300);1179 $('.user-option .option-pay').text($(target).children('span').text());1180 $(target).addClass('on').siblings().removeClass('on');1181 });1182 $('.advertise-payType-item-container').on('click', '.icon-step1-unselected,.on', (e) => {1183 e.stopPropagation();1184 let target = e.target;1185 paySubType = $(target).parent().attr('data-code');1186 sessionStorage.setItem('paySubType', paySubType);1187 $(target).parents('.advertise-payType-item').addClass('on').siblings('.advertise-payType-item').removeClass('on');1188 });1189 // step1-select点击事件1190 $('#tradeCoin').on('change', (e) => {1191 tradeCoin = $('#tradeCoin').find('option:selected').attr('data-code');1192 $('.user-option .option-tran').text(tradeCoin);1193 sessionStorage.setItem('tradeCoin', tradeCoin);1194 });1195 // step3-目标国家select点击事件1196 $('#targetArea').on('change', (e) => {1197 targetArea = $('#targetArea').find('option:selected').attr('value');1198 });1199 // step3 - 验证1200 $('.step3-condition-checkbox .condition-checkbox-item i').on('click', (e) => {1201 let target = e.target;1202 if($(target).attr('data-code') === 'email') {1203 if($(target).hasClass('on')) {1204 step3ConditionConfig.email = 0;1205 } else {1206 step3ConditionConfig.email = 1;1207 }1208 } else if($(target).attr('data-code') === 'mobile') {1209 if($(target).hasClass('on')) {1210 step3ConditionConfig.mobile = 0;1211 } else {1212 step3ConditionConfig.mobile = 1;1213 }1214 } else if($(target).attr('data-code') === 'id') {1215 if($(target).hasClass('on')) {1216 step3ConditionConfig.id = 0;1217 } else {1218 step3ConditionConfig.id = 1;1219 }1220 }1221 if($(target).hasClass('on')) {1222 $(target).removeClass('on');1223 } else {1224 $(target).addClass('on');1225 }1226 });1227 // step3 - 可见性1228 $('.step3-visible-checkbox .visible-checkbox-item i').on('click', (e) => {1229 let target = e.target;1230 if($(target).hasClass('on')) {1231 $(target).removeClass('on');1232 step3Visible = 0;1233 } else {1234 $(target).addClass('on');1235 step3Visible = 1;1236 }1237 });1238 // step3 - 国家/地区限制1239 $('.step3-area-limit-checkbox .area-limit-checkbox-item i').on('click', (e) => {1240 let target = e.target;1241 if($(target).hasClass('on')) {1242 $(target).removeClass('on');1243 return;1244 }1245 $($(target).addClass('on').parents('.area-limit-checkbox-item')[0]).siblings().children('i').removeClass('on');1246 step3AreaLimit = $(target).attr('data-code');1247 });1248 // vpn1249 $('.step3-vpn-checkbox .vpn-checkbox-item i').on('click', (e) => {1250 let target = e.target;1251 isAllowProxy = $(target).attr('data-code');1252 $(target).addClass('on').siblings.removeClass('on');1253 });1254 // 切换买币卖币1255 $('.advertise-step1-bigbigTitle .text').on('click', '.change', (e) => {1256 let target = e.target;1257 if($(target).hasClass('buy')) {1258 $(target).removeClass('buy').addClass('sell');1259 $('.advertise-step1-bigbigTitle .title').html(base.getText(`卖出您的数字货币以获得利润`));1260 $('.advertise-step1-bigbigTitle .text').html(`<p class="text">${base.getText('想要获得数字货币吗?')}<span class="change sell">${base.getText('创建一个出价来购买数字货币')}</span></p>`);1261 $('.advertise-step2-bigbigTitle .title,.advertise-step3-bigbigTitle .title').text(base.getText('卖出您的数字货币以获得利润'));1262 tradeType = 1;1263 } else {1264 $(target).removeClass('sell').addClass('buy');1265 $('.advertise-step1-bigbigTitle .title').html(base.getText('购买数字货币'));1266 $('.advertise-step1-bigbigTitle .text').html(`<p class="text">${base.getText('想要出售数字货币吗?')}<span class="change buy">${base.getText('去出售数字货币')}</span></p>`);1267 $('.advertise-step2-bigbigTitle .title,.advertise-step3-bigbigTitle .title').text(base.getText('购买数字货币'));1268 tradeType = 0;1269 }1270 });1271 1272 //精准查找切换1273 $('.jzxe').click(function () {1274 if($(this).attr('data-type') == 1){1275 $('.jzxe').text(base.getText('使用交易金额'));1276 $('.step2-min,.step2-max').hide();1277 $('.step2-accuracy').show();1278 $(this).attr('data-type',2);1279 let step2AccuracyTags = $('#step2AccuracyTags').val();1280 if(step2AccuracyTags) {1281 let tags = step2AccuracyTags.join();1282 $('.user-step2_option .op-tding').text(tags);1283 $('.user-step2_option li').eq(4).show(300);1284 $('.user-step2_option li').eq(5).hide(300);1285 }1286 sessionStorage.setItem('jzxe', 2);1287 }else{1288 $('.jzxe').text(base.getText('使用精准限额'));1289 $('.step2-min,.step2-max').show();1290 $('.step2-accuracy').hide();1291 sessionStorage.setItem('jzxe', 1);1292 $(this).attr('data-type',1);1293 let min = $('#minInput').val();1294 let max = $('#maxInput').val();1295 if(min && max) {1296 let t_min = min + tradeCoin;1297 let t_max = max + tradeCoin;1298 $('.user-step2_option .op-min').text(t_min);1299 $('.user-step2_option .op-max').text(t_max);1300 $('.user-step2_option li').eq(5).show(300);1301 $('.user-step2_option li').eq(4).hide(300);1302 }1303 }1304 });1305 base.hideLoadingSpin();1306 }1307 /**1308 * 编辑广告1309 */1310 function editAdvertise() {1311 if(!$('#step3Tags').val()) {1312 base.showMsg(base.getText('请选择标签'));1313 return;1314 }1315 // if(!$('#myTagInput').val()) {1316 // base.showMsg(base.getText('请填写自定义标签'));1317 // return;1318 // }1319 if(!$('#clauseTextarea').val()) {1320 base.showMsg(base.getText('请填写条款'));1321 return;1322 }1323 if(!$('#explainTextarea').val()) {1324 base.showMsg(base.getText('请填写交易说明'));1325 return;1326 }1327 base.showLoadingSpin();1328 let platTag = $('#step3Tags').val().join('||');1329 let step2AccuracyTags = sessionStorage.getItem('step2AccuracyTags')1330 step2AccuracyTags = step2AccuracyTags.split(',').join('||').toString()1331 if(step2AccuracyTags == 'null'){1332 step2AccuracyTags = '';1333 }1334 return TradeCtr.editAdvertise({1335 adsCode:code,1336 allowCountry: targetArea,1337 fixTrade:step2AccuracyTags || undefined,1338 customTag: $('#myTagInput').val(),1339 isValidateEmail: step3ConditionConfig.email,1340 isValidateIdentity: step3ConditionConfig.id,1341 isValidateTelephone: step3ConditionConfig.mobile,1342 item: $('#clauseTextarea').val(),1343 leaveMessage: $('#explainTextarea').val(),1344 maxTrade: Number(sessionStorage.getItem('max')) || undefined,1345 minTrade: Number(sessionStorage.getItem('min')) || undefined,1346 notAllowCountry: step3AreaLimit,1347 onlyTrust: 0,1348 payLimit: sessionStorage.getItem('cancelTime'),1349 payType: sessionStorage.getItem('paySubType'),1350 platTag: platTag,1351 premiumRate: sessionStorage.getItem('zq') / 100,1352 targetCountry: $('#targetArea').val(),1353 tradeCurrency: sessionStorage.getItem('tradeCoin'),1354 tradeCoin:sessionStorage.getItem('tradeCoin001'),1355 tradeType: Number(sessionStorage.getItem('tradeType')),1356 isAllowProxy: isAllowProxy || 11357 }).then((res) => {1358 let tType = sessionStorage.getItem('tradeType');1359 sessionStorage.removeItem('cancelTime');1360 sessionStorage.removeItem('myTagInput');1361 sessionStorage.removeItem('clauseTextarea');1362 sessionStorage.removeItem('explainTextarea');1363 sessionStorage.removeItem('jzxe');1364 sessionStorage.removeItem('step2AccuracyTags');1365 sessionStorage.removeItem('max');1366 sessionStorage.removeItem('min');1367 sessionStorage.removeItem('tradeCoin');1368 sessionStorage.removeItem('zq');1369 sessionStorage.removeItem('step3TagsData');1370 sessionStorage.removeItem('tradeCoin001');1371 sessionStorage.removeItem('tradeType');1372 sessionStorage.removeItem('paySubType');1373 base.showMsg(base.getText('操作成功'));1374 if (Number(tType) === 0) {1375 base.gohref('../order/order-list.html?coin=' + coin + '&adverType=BUY&mod=gg');1376 } else {1377 base.gohref('../order/order-list.html?coin=' + coin + '&adverType=SELL&mod=gg');1378 }1379 base.showLoadingSpin();1380 }, base.hideLoadingSpin);1381 }...

Full Screen

Full Screen

forms.py

Source:forms.py Github

copy

Full Screen

1from __future__ import unicode_literals2from django import forms, http3from django.conf import settings4from django.db import models5from django.test import TestCase6from django.template.response import TemplateResponse7from django.utils.importlib import import_module8from django.contrib.auth.models import User9from django.contrib.formtools.wizard.views import (WizardView,10 SessionWizardView,11 CookieWizardView)12class DummyRequest(http.HttpRequest):13 def __init__(self, POST=None):14 super(DummyRequest, self).__init__()15 self.method = POST and "POST" or "GET"16 if POST is not None:17 self.POST.update(POST)18 self.session = {}19 self._dont_enforce_csrf_checks = True20def get_request(*args, **kwargs):21 request = DummyRequest(*args, **kwargs)22 engine = import_module(settings.SESSION_ENGINE)23 request.session = engine.SessionStore(None)24 return request25class Step1(forms.Form):26 name = forms.CharField()27class Step2(forms.Form):28 name = forms.CharField()29class Step3(forms.Form):30 data = forms.CharField()31class CustomKwargsStep1(Step1):32 def __init__(self, test=None, *args, **kwargs):33 self.test = test34 return super(CustomKwargsStep1, self).__init__(*args, **kwargs)35class TestModel(models.Model):36 name = models.CharField(max_length=100)37 class Meta:38 app_label = 'formtools'39class TestModelForm(forms.ModelForm):40 class Meta:41 model = TestModel42TestModelFormSet = forms.models.modelformset_factory(TestModel, form=TestModelForm, extra=2)43class TestWizard(WizardView):44 storage_name = 'django.contrib.formtools.wizard.storage.session.SessionStorage'45 def dispatch(self, request, *args, **kwargs):46 response = super(TestWizard, self).dispatch(request, *args, **kwargs)47 return response, self48 def get_form_kwargs(self, step, *args, **kwargs):49 kwargs = super(TestWizard, self).get_form_kwargs(step, *args, **kwargs)50 if step == 'kwargs_test':51 kwargs['test'] = True52 return kwargs53class FormTests(TestCase):54 def test_form_init(self):55 testform = TestWizard.get_initkwargs([Step1, Step2])56 self.assertEqual(testform['form_list'], {'0': Step1, '1': Step2})57 testform = TestWizard.get_initkwargs([('start', Step1), ('step2', Step2)])58 self.assertEqual(59 testform['form_list'], {'start': Step1, 'step2': Step2})60 testform = TestWizard.get_initkwargs([Step1, Step2, ('finish', Step3)])61 self.assertEqual(62 testform['form_list'], {'0': Step1, '1': Step2, 'finish': Step3})63 def test_first_step(self):64 request = get_request()65 testform = TestWizard.as_view([Step1, Step2])66 response, instance = testform(request)67 self.assertEqual(instance.steps.current, '0')68 testform = TestWizard.as_view([('start', Step1), ('step2', Step2)])69 response, instance = testform(request)70 self.assertEqual(instance.steps.current, 'start')71 def test_persistence(self):72 testform = TestWizard.as_view([('start', Step1), ('step2', Step2)])73 request = get_request({'test_wizard-current_step': 'start',74 'name': 'data1'})75 response, instance = testform(request)76 self.assertEqual(instance.steps.current, 'start')77 instance.storage.current_step = 'step2'78 testform2 = TestWizard.as_view([('start', Step1), ('step2', Step2)])79 request.POST = {'test_wizard-current_step': 'step2'}80 response, instance = testform2(request)81 self.assertEqual(instance.steps.current, 'step2')82 def test_form_condition(self):83 request = get_request()84 testform = TestWizard.as_view(85 [('start', Step1), ('step2', Step2), ('step3', Step3)],86 condition_dict={'step2': True})87 response, instance = testform(request)88 self.assertEqual(instance.get_next_step(), 'step2')89 testform = TestWizard.as_view(90 [('start', Step1), ('step2', Step2), ('step3', Step3)],91 condition_dict={'step2': False})92 response, instance = testform(request)93 self.assertEqual(instance.get_next_step(), 'step3')94 def test_form_kwargs(self):95 request = get_request()96 testform = TestWizard.as_view([('start', Step1),97 ('kwargs_test', CustomKwargsStep1)])98 response, instance = testform(request)99 self.assertEqual(instance.get_form_kwargs('start'), {})100 self.assertEqual(instance.get_form_kwargs('kwargs_test'), {'test': True})101 self.assertEqual(instance.get_form('kwargs_test').test, True)102 def test_form_prefix(self):103 request = get_request()104 testform = TestWizard.as_view([('start', Step1), ('step2', Step2)])105 response, instance = testform(request)106 self.assertEqual(instance.get_form_prefix(), 'start')107 self.assertEqual(instance.get_form_prefix('another'), 'another')108 def test_form_initial(self):109 request = get_request()110 testform = TestWizard.as_view([('start', Step1), ('step2', Step2)],111 initial_dict={'start': {'name': 'value1'}})112 response, instance = testform(request)113 self.assertEqual(instance.get_form_initial('start'), {'name': 'value1'})114 self.assertEqual(instance.get_form_initial('step2'), {})115 def test_form_instance(self):116 request = get_request()117 the_instance = TestModel()118 testform = TestWizard.as_view([('start', TestModelForm), ('step2', Step2)],119 instance_dict={'start': the_instance})120 response, instance = testform(request)121 self.assertEqual(122 instance.get_form_instance('start'),123 the_instance)124 self.assertEqual(125 instance.get_form_instance('non_exist_instance'),126 None)127 def test_formset_instance(self):128 request = get_request()129 the_instance1, created = TestModel.objects.get_or_create(130 name='test object 1')131 the_instance2, created = TestModel.objects.get_or_create(132 name='test object 2')133 testform = TestWizard.as_view([('start', TestModelFormSet), ('step2', Step2)],134 instance_dict={'start': TestModel.objects.filter(name='test object 1')})135 response, instance = testform(request)136 self.assertEqual(list(instance.get_form_instance('start')), [the_instance1])137 self.assertEqual(instance.get_form_instance('non_exist_instance'), None)138 self.assertEqual(instance.get_form().initial_form_count(), 1)139 def test_done(self):140 request = get_request()141 testform = TestWizard.as_view([('start', Step1), ('step2', Step2)])142 response, instance = testform(request)143 self.assertRaises(NotImplementedError, instance.done, None)144 def test_revalidation(self):145 request = get_request()146 testform = TestWizard.as_view([('start', Step1), ('step2', Step2)])147 response, instance = testform(request)148 instance.render_done(None)149 self.assertEqual(instance.storage.current_step, 'start')150class SessionFormTests(TestCase):151 def test_init(self):152 request = get_request()153 testform = SessionWizardView.as_view([('start', Step1)])154 self.assertTrue(isinstance(testform(request), TemplateResponse))155class CookieFormTests(TestCase):156 def test_init(self):157 request = get_request()158 testform = CookieWizardView.as_view([('start', Step1)])...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1import Vue from 'vue'2import Router from 'vue-router'3import Layout from '@comp/layout/index'4import HomeIndex from '@page/home/index'5import LoginIndex from '@page/login/index'6import ActivityIndex from '@page/activity/index'7import MessageIndex from '@page/message/MessageIndex'8import MessageDetail from '@page/message/MessageDetail'9import RecruitmentIndex from '@page/message/RecruitmentIndex'10import RecruitmentDetail from '@page/message/RecruitmentDetail'11import PolicyIndex from '@page/policy/index'12import ActivityView from '@page/activity/view'13import TenementRepairsStep1 from '@page/serve/TenementRepairs/step1'14import TenementRepairsStep2 from '@page/serve/TenementRepairs/step2'15import TenementAppealStep1 from '@page/serve/TenementAppeal/step1'16import TenementAppealStep2 from '@page/serve/TenementAppeal/step2'17import DemandSubmissionStep1 from '@page/serve/DemandSubmission/step1'18import DemandSubmissionStep2 from '@page/serve/DemandSubmission/step2'19import ParkingApplyStep1 from '@page/serve/ParkingApply/step1'20import ParkingApplyStep2 from '@page/serve/ParkingApply/step2'21import ItRepairsStep1 from '@page/serve/ItRepairs/step1'22import ItRepairsStep2 from '@page/serve/ItRepairs/step2'23import AdvertisingApplyStep1 from '@page/serve/AdvertisingApply/step1'24import AdvertisingApplyStep2 from '@page/serve/AdvertisingApply/step2'25import PublicFacilitiesStep1 from '@page/serve/PublicFacilities/step1'26import PublicFacilitiesStep2 from '@page/serve/PublicFacilities/step2'27import EnterprisesRecordStep1 from '@page/serve/EnterprisesRecord/step1'28import EnterprisesRecordStep2 from '@page/serve/EnterprisesRecord/step2'29import RubbishDispositionStep1 from '@page/serve/RubbishDisposition/step1'30import RubbishDispositionStep2 from '@page/serve/RubbishDisposition/step2'31import UrbanRoadStep1 from '@page/serve/UrbanRoad/step1'32import UrbanRoadStep2 from '@page/serve/UrbanRoad/step2'33import NewLandProjectStep1 from '@page/serve/NewLandProject/step1'34import NewLandProjectStep2 from '@page/serve/NewLandProject/step2'35import NewRentalProjectStep1 from '@page/serve/NewRentalProject/step1'36import NewRentalProjectStep2 from '@page/serve/NewRentalProject/step2'37import NewTechProjectStep1 from '@page/serve/NewTechProject/step1'38import NewTechProjectStep2 from '@page/serve/NewTechProject/step2'39import ConferenceReservation from '@page/serve/ConferenceReservation/List'40import AdvertisingReservation from '@page/serve/AdvertisingReservation/List'41Vue.use(Router)42export default new Router({43 mode: 'history',44 routes: [45 {46 path: '/',47 component: Layout,48 children: [49 { path: 'home/index', name: 'HomeIndex', component: HomeIndex },50 { path: 'login/index', name: 'LoginIndex', component: LoginIndex },51 { path: 'activity/index', name: 'ActivityIndex', component: ActivityIndex },52 { path: 'message/index/:id', name: 'MessageIndex', component: MessageIndex },53 { path: 'message/detail/:id', name: 'MessageDetail', component: MessageDetail },54 { path: 'message/RecruitmentIndex', name: 'RecruitmentIndex', component: RecruitmentIndex },55 { path: 'message/RecruitmentDetail/:id', name: 'RecruitmentDetail', component: RecruitmentDetail },56 { path: 'policy/index', name: 'PolicyIndex', component: PolicyIndex },57 { path: 'activity/view/:id', name: 'ActivityView', component: ActivityView },58 { path: 'serve/TenementRepairs/step1', name: 'TenementRepairsStep1', component: TenementRepairsStep1 },59 { path: 'serve/TenementRepairs/step2', name: 'TenementRepairsStep2', component: TenementRepairsStep2 },60 { path: 'serve/TenementAppeal/step1', name: 'TenementAppealStep1', component: TenementAppealStep1 },61 { path: 'serve/TenementAppeal/step2', name: 'TenementAppealStep2', component: TenementAppealStep2 },62 { path: 'serve/DemandSubmission/step1', name: 'DemandSubmissionStep1', component: DemandSubmissionStep1 },63 { path: 'serve/DemandSubmission/step2', name: 'DemandSubmissionStep2', component: DemandSubmissionStep2 },64 { path: 'serve/ParkingApply/step1', name: 'ParkingApplyStep1', component: ParkingApplyStep1 },65 { path: 'serve/ParkingApply/step2', name: 'ParkingApplyStep2', component: ParkingApplyStep2 },66 { path: 'serve/ItRepairs/step1', name: 'ItRepairsStep1', component: ItRepairsStep1 },67 { path: 'serve/ItRepairs/step2', name: 'ItRepairsStep2', component: ItRepairsStep2 },68 { path: 'serve/AdvertisingApply/step1/:id', name: 'AdvertisingApplyStep1', component: AdvertisingApplyStep1 },69 { path: 'serve/AdvertisingApply/step2', name: 'AdvertisingApplyStep2', component: AdvertisingApplyStep2 },70 { path: 'serve/PublicFacilities/step1', name: 'PublicFacilitiesStep1', component: PublicFacilitiesStep1 },71 { path: 'serve/PublicFacilities/step2', name: 'PublicFacilitiesStep2', component: PublicFacilitiesStep2 },72 { path: 'serve/EnterprisesRecord/step1', name: 'EnterprisesRecordStep1', component: EnterprisesRecordStep1 },73 { path: 'serve/EnterprisesRecord/step2', name: 'EnterprisesRecordStep2', component: EnterprisesRecordStep2 },74 { path: 'serve/RubbishDisposition/step1', name: 'RubbishDispositionStep1', component: RubbishDispositionStep1 },75 { path: 'serve/RubbishDisposition/step2', name: 'RubbishDispositionStep2', component: RubbishDispositionStep2 },76 { path: 'serve/UrbanRoad/step1', name: 'UrbanRoadStep1', component: UrbanRoadStep1 },77 { path: 'serve/UrbanRoad/step2', name: 'UrbanRoadStep2', component: UrbanRoadStep2 },78 { path: 'serve/NewLandProject/step1', name: 'NewLandProjectStep1', component: NewLandProjectStep1 },79 { path: 'serve/NewLandProject/step2', name: 'NewLandProjectStep2', component: NewLandProjectStep2 },80 { path: 'serve/NewRentalProject/step1', name: 'NewRentalProjectStep1', component: NewRentalProjectStep1 },81 { path: 'serve/NewRentalProject/step2', name: 'NewRentalProjectStep2', component: NewRentalProjectStep2 },82 { path: 'serve/NewTechProject/step1', name: 'NewTechProjectStep1', component: NewTechProjectStep1 },83 { path: 'serve/NewTechProject/step2', name: 'NewTechProjectStep2', component: NewTechProjectStep2 },84 { path: 'serve/ConferenceReservation', name: 'ConferenceReservation', component: ConferenceReservation },85 { path: 'serve/AdvertisingReservation', name: 'AdvertisingReservation', component: AdvertisingReservation },86 ]87 }88 ]...

Full Screen

Full Screen

wizard2.js

Source:wizard2.js Github

copy

Full Screen

1window.document.addEventListener("DOMContentLoaded", async () => {2 const $actions = document.querySelectorAll("[data-action]");3 const actions = {4 on_no_dispute: onNoDispute,5 on_no_dispute_back: onNoDisputeBack,6 on_choose_letter_type: onChooseLetterType,7 on_choose_letter_recipient: onChooseLetterRecipient,8 step2_save_and_continue: step2SaveContinue,9 };10 $actions.forEach(($action) => {11 const key = $action.dataset.action;12 if (typeof actions[key] !== "function") return;13 const eventType = $($action).is(":radio") ? "change" : "click";14 $action.addEventListener(eventType, actions[key]);15 });16});17function onNoDispute() {18 const $step1 = document.querySelector(".step-1");19 const $step2 = document.querySelector(".step-2");20 const $step3 = document.querySelector(".step-3");21 const $radios = $step1.querySelectorAll("[type=radio");22 const $selects = $step1.querySelector(".step__1Selects");23 const $chooseLetter = $step1.querySelector(".step__chooseLetter");24 const $recipientSelect = $step1.querySelector(".step__letterRecipient");25 $step1.classList.add("step--active");26 $step2.classList.add("d-none");27 $selects.classList.add("step--disabled");28 $chooseLetter.classList.remove("d-none");29 $radios.forEach(($radio) => {30 $radio.checked = false;31 });32 $recipientSelect.classList.add("d-none");33 $step3.classList.add("d-none");34}35function onNoDisputeBack() {36 const $step1 = document.querySelector(".step-1");37 const $step2 = document.querySelector(".step-2");38 const $step3 = document.querySelector(".step-3");39 const $radios = $step1.querySelectorAll("[type=radio");40 const $selects = $step1.querySelector(".step__1Selects");41 const $chooseLetter = $step1.querySelector(".step__chooseLetter");42 const $step2Form = $step2.querySelector(".step__step2Form");43 const $step2Message = $step2.querySelector(".step__step2Message");44 const $step2DisputeCols = $step2.querySelectorAll(".step__step2DisputeCol");45 $selects.classList.remove("step--disabled");46 $step2.classList.remove("d-none");47 $step2.classList.remove("step--active");48 $step2.classList.add("step--disabled");49 $chooseLetter.classList.add("d-none");50 $radios.forEach(($radio) => {51 $radio.checked = false;52 });53 $step2Form.classList.add("d-none");54 $step2Message.classList.remove("d-none");55 $step3.classList.add("d-none");56 $step2DisputeCols.forEach(($col) => {57 $col.classList.remove("d-none");58 });59}60function onChooseLetterType(event) {61 const $step1 = document.querySelector(".step-1");62 const $step2 = document.querySelector(".step-2");63 const $step3 = document.querySelector(".step-3");64 const $recipientSelect = $step1.querySelector(".step__letterRecipient");65 const $recipient1 = $recipientSelect.querySelector("#recipient1");66 const $step2Form = $step2.querySelector(".step__step2Form");67 const $step2Message = $step2.querySelector(".step__step2Message");68 const $step2GenerateLetterBtn = $step2.querySelector("[data-action=step2_generate_letter]"); // prettier-ignore69 const $step2SaveContinue = $step2.querySelector("[data-action=step2_save_and_continue]"); // prettier-ignore70 $step1.classList.remove("step--active");71 $step2.classList.remove("step--disabled");72 $step2.classList.add("step--active");73 $step2Form.classList.remove("d-none");74 if (event.target.value === "round1") {75 $recipientSelect.classList.add("d-none");76 $step3.classList.add("d-none");77 $step3.classList.remove("step--active");78 $step3.classList.add("step--disabled");79 $step2Message.classList.remove("d-none");80 $step2GenerateLetterBtn.classList.remove("d-none");81 $step2SaveContinue.classList.add("d-none");82 } else {83 $recipient1.checked = true;84 $recipientSelect.classList.remove("d-none");85 $step3.classList.remove("d-none");86 $step2Message.classList.add("d-none");87 $step2GenerateLetterBtn.classList.add("d-none");88 $step2SaveContinue.classList.remove("d-none");89 }90}91function onChooseLetterRecipient(event) {92 const $step2 = document.querySelector(".step-2");93 const $step2DisputeCols = $step2.querySelectorAll(".step__step2DisputeCol");94 const classListFunc = event.target.value === "credit_bureau" ? "remove" : "add"; // prettier-ignore95 $step2DisputeCols.forEach(($col) => {96 $col.classList[classListFunc]("d-none");97 });98}99function step2SaveContinue() {100 const $step1 = document.querySelector(".step-1");101 const $step2 = document.querySelector(".step-2");102 const $step3 = document.querySelector(".step-3");103 $step1.classList.remove("step--active");104 $step2.classList.remove("step--active");105 $step3.classList.remove("step--disabled");106 $step3.classList.add("step--active");...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2wpt.step2('www.google.com', function(data) {3 console.log(data);4});5var request = require('request');6var wpt = {7 step1: function(url, callback) {8 var options = {9 }10 request(options, function(err, res, body) {11 if (!err && res.statusCode == 200) {12 var testId = body;13 callback(testId);14 } else {15 console.log(err);16 }17 });18 },19 step2: function(url, callback) {20 wpt.step1(url, function(testId) {21 var options = {22 }23 request(options, function(err, res, body) {24 if (!err && res.statusCode == 200) {25 var data = JSON.parse(body);26 if (data.statusCode == 200) {27 callback(data.data);28 } else {29 console.log(data.statusText);30 }31 } else {32 console.log(err);33 }34 });35 });36 }37}38module.exports = wpt;

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2wpt.step2('testStep1', function (err, data) {3 if (err) {4 console.log('Error: ' + err);5 } else {6 console.log('Data: ' + data);7 }8});9module.exports.step2 = function (testStep1, callback) {10 callback(null, 'testStep2');11};12var wpt = require('wpt');13wpt.step3('testStep2', function (err, data) {14 if (err) {15 console.log('Error: ' + err);16 } else {17 console.log('Data: ' + data);18 }19});20module.exports.step3 = function (testStep2, callback) {21 callback(null, 'testStep3');22};

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2var step2 = wpt.step2;3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9var wpt = require('./wpt.js');10var getLocations = wpt.getLocations;11getLocations(function(err, data) {12 if (err) {13 console.log(err);14 } else {15 console.log(data);16 }17});18var wpt = require('./wpt.js');19var getTests = wpt.getTests;20getTests(function(err, data) {21 if (err) {22 console.log(err);23 } else {24 console.log(data);25 }26});27var wpt = require('./wpt.js');28var getTests = wpt.getTests;29getTests(function(err, data) {30 if (err) {31 console.log(err);32 } else {33 console.log(data);34 }35});36var wpt = require('./wpt.js');37var getTests = wpt.getTests;38getTests(function(err, data)

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful