123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703 |
- <template>
- <div class="overlay" v-if="visible">
- <div class="content"
- :style="{
- height: showComType === 'preview' ? 'calc(100vh - 40px)' : dialogStyle.dialogHeight + 'px',
- width: dialogStyle.dialogContentWidth + 'px',
- }">
- <div class="pop-mask"
- v-show="showCurrencyPop || showCurrencySelect"
- @click.stop="showCurrencyPop = false; showCurrencySelect=false">
- </div>
- <!-- 头部 -->
- <div class="head">
- <div class="left">
- <!-- 关闭按钮 -->
- <div class="close-btn" @click="close">
- <template v-if="publishType == 'TOOL_BOX'">
- <img class="icon-close"
- :src="require('@/assets/svg/icon-close.svg')"
- v-if="toolBoxPageData.activePage == 'EDITOR'"/>
- <img class="icon-close"
- :src="require('@/assets/svg/icon-back.svg')"
- v-else/>
- </template>
- <template v-else>
- <img class="icon-close"
- :src="require('@/assets/svg/icon-close.svg')"
- v-if="showComType == 'default'"/>
- <img class="icon-close"
- :src="require('@/assets/svg/icon-back.svg')"
- v-else/>
- </template>
- </div>
- <!-- 标题 -->
- <div class="title">
- {{publishType.value == 'REDPACKET' ? currentComData[showComType]["title"] : 'Tool Box' }}
- </div>
- </div>
- <div class="right">
- <!-- 更多按钮 -->
- <img :src="require('@/assets/svg/icon-more-l.svg')"
- class="more"
- @click="showMoreOption = true">
- <div class="area-option"
- v-if="showMoreOption"
- @click="showMoreOption = false">
- <div class="option">
- <div class="item" @click="goTransactionsList()">
- <img :src="require('@/assets/svg/icon-menu.svg')">
- <span>Transaction History</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 内容 -->
- <div class="body">
- <!-- 充值组件 -->
- <top-up
- v-if="showComType == 'topUp'"
- :asyncIng="asyncIng"
- :currentCurrencyInfo="tempCurrentCurrencyInfo"
- @topUpDone="topUpDone">
- </top-up>
- <!-- 自定义红包封面 -->
- <giveaway-poster
- v-else-if="showComType == 'poster'"
- :baseFormData="baseFormData"
- :currentCurrencyInfo="currentCurrencyInfo"
- :customPosterInfo="customPosterInfo"
- @selectImage="selectImage"
- @confirmData="confirmData">
- </giveaway-poster>
- <!-- 表单填写容器 -->
- <div class="body-content" v-else>
- <!-- 货币列表 -->
- <div class="currency-pop" v-show="showCurrencyPop">
- <currency-list
- ref="currencyListDom"
- @selectCurrency="selectCurrency"
- @setCurrencyList="setCurrentCurrencyInfo"></currency-list>
- </div>
- <div class="currency-pop-select" v-show="showCurrencySelect">
- <currency-select
- ref="currencySelectDom"
- :list="tempCurrentCurrencyList"
- @selectCurrency="selectCurrencyAfter"></currency-select>
- </div>
- <div class="left" v-if="showComType != 'preview' && toolBoxPageData.activePage != 'PREVIEW'">
- <div class="tab-item"
- :class="{'active-tab': item.type == publishType}"
- v-for="(item, index) in leftTabList"
- :key="index"
- @click="clickLeftTab(item, index)"
- >
- <img class="icon" :src="item.icon"/>
- </div>
- </div>
- <div class="right"
- :class="{'fill-right': showComType == 'preview' || toolBoxPageData.activePage == 'PREVIEW'}">
- <global-tip :type="'2'"></global-tip>
-
- <template v-if="publishType == 'TOOL_BOX'">
- <tool-box
- :pageData="{
- 'linkInputDescImage': toolBoxPageData.postEditorLinkInputDescImage
- }"
- :activePage="toolBoxPageData.activePage" @onPageChange="onToolBoxPageChange"
- @toolBoxPublishFinish="toolBoxPublishFinish"></tool-box>
- </template>
- <template v-else>
- <div class="form-wrapper" v-if="showComType == 'default'">
- <div class="form-cell-item base-form-wrapper">
- <div class="title">
- <img class="icon" :src="require('@/assets/svg/icon-reward-v2.svg')"/>
- Reward
- </div>
- <div class="form-cell-content">
- <div class="select-mode-ele">
- <img v-for="(item, index) in publishModeList"
- :key="index"
- :src="selectModeInfo.index == index ? item.imgActive : item.imgInActive"
- @click="selectPublishMode(item, index)">
- </div>
- <!-- 金额、数量 -->
- <div class="form-base">
- <div class="item currency-select-wrapper">
- <div>
- <div class="label currency-select"
- :class="{'selected': currentCurrencyInfo.currencyCode}"
- @click="selectCurrencyPopHandle">
- <img class="icon"
- v-if="currentCurrencyInfo.iconPath"
- :src="currentCurrencyInfo.iconPath"/>
- <div class="text">
- {{currentCurrencyInfo.currencyCode == 'USD' ? 'USD' : currentCurrencyInfo.tokenSymbol || 'Select a reward'}}
- </div>
- <img class="arrow"
- :src="currentCurrencyInfo.currencyCode ?
- require('@/assets/svg/icon-form-arrow-down.svg') : require('@/assets/svg/icon-form-white-arrow-down.svg')"/>
- </div>
- <!-- 刷新按钮、充值 -->
- <div class="currency-operation"
- v-if="currentCurrencyInfo.currencyCode">
- <div class="amount">
- Balance:
- <a-tooltip :title="currentCurrencyInfo.balance">
- {{ getBit(currentCurrencyInfo.balance) }}
- </a-tooltip>
- <img :class="{ 'icon-refresh-rotate': refreshRotate }"
- :src="require('@/assets/svg/icon-form-refresh.svg')"
- @click="updateCurrencyBanlce"/>
- </div>
- <div v-if="currentCurrencyInfo.currencyCode != 'USD'"
- class="top-up"
- @click="goTopUp">Deposit</div>
- </div>
- </div>
- <input v-model="baseFormData.amountValue"
- placeholder="0"
- autofocus
- @input="onAmountInput"
- @blur="onAmountBlur"/>
- </div>
- <div class="item winners-count-input">
- <div>
- <div class="label">
- <img class="icon"
- :src="require('@/assets/svg/icon-winner-v2.svg')"/>
- Winner Count
- </div>
- <div class="msg" v-show="selectModeInfo.type == 1">Recommend Winners 100~10000</div>
- </div>
- <input v-model="baseFormData.totalCount"
- placeholder="0"
- @input="onCountInput"
- @blur="onCountBlur"/>
- </div>
- <div class="item automatically-input" v-if="selectModeInfo.type == 2">
- <div class="label">
- <img class="icon"
- :src="require('@/assets/svg/icon-automatically.svg')"/>
- Automatically Draw in
- </div>
- <div class="input-wrapper">
- <input v-model="baseFormData.validityDuration"
- placeholder="0"
- @input="onValidityDurationInput"
- @blur="onValidityDurationBlur"/>
- <span class="unit">h</span>
- </div>
- </div>
- </div>
- <div class="giveaway-poster" @click="customCoverImg">
- <div class="show-img">
- <div
- :style="{
- 'zoom': 55 / 500,
- 'position': 'absolute',
- 'width': '345px',
- }">
- <custom-card-cover
- :data="{
- totalCount: baseFormData.totalCount,
- amountValue: baseFormData.amountValue,
- tokenSymbol: currentCurrencyInfo.tokenSymbol,
- currencyIconUrl: currentCurrencyInfo.iconPath,
- type: baseFormData.type,
- validityDuration: baseFormData.validityDuration,
- customPosterUrl: customPosterData && customPosterData.after && customPosterData.after.imagePath || '',
- }">
- </custom-card-cover>
- </div>
- </div>
- <div class="show-font">
- <span>Giveaway Poster</span>
- <img class="new" v-if="customShowNewImage" :src=" require('@/assets/svg/img-new.svg') " />
- </div>
- <div class="show-placeholder">Replace</div>
- <div class="arrow">
- <img :src=" require('@/assets/svg/icon-cell-arrow-right.svg') " />
- </div>
- </div>
- <!-- 提示 -->
- <ul class="tips-wrapper">
- <li class="row" style="white-space:nowrap;">
- Rewards can only be claimed after the target user completes all tasks you set.
- </li>
- <li class="row">
- Each user can only receive a reward once per task.
- </li>
- <li class="row" v-show="selectModeInfo.type == 1">
- The reward will expire in 7 days once issued. Please promote it as much as possible within this period. After the experiment, the remaining rewards will be returned to your DeNet Wallet.
- </li>
- </ul>
- </div>
- </div>
- <div class="form-cell-item task-wrapper">
- <div class="title">
- <img class="icon" :src="require('@/assets/svg/icon-tasks-v2.svg')"/>
- Tasks
- </div>
- <div class="form-cell-content form-require">
- <!-- 转推、like、关注 -->
- <div v-for="(item, index) in formList"
- :key="index">
- <div v-if="item.show" class="form-item"
- :class="{ 'border-hide': formList.length - 1 == index }">
- <div class="item-left">
- <div class="label">
- <img class="icon" :src="item.icon"/>
- {{ item.label }}
- </div>
- <div class="control"
- v-if="item.nodeType == 'textarea'">
- <follow-input
- :isAddSelf="!isBack"
- :atUserList="atUserList"
- @addUser="addFollowUser"
- @setUser="setFollowUser"
- @delUser="delFollowUser"></follow-input>
- </div>
- <div class="control"
- v-if="item.nodeType == 'input'">
- <div v-if="showDiscordInvitePop"
- class="discord-invite-info"
- @click="showDiscordInvitePop = false">
- <img class="icon" :src="discordInviteInfo.icon || require('@/assets/svg/icon-discord-mini.svg')" />
- <span class="name">{{discordInviteInfo.name}}</span>
- </div>
- <input v-model="item.text"
- placeholder="Enter discord invite link"
- class="discord-address"
- @input="onIptDiscordAddress($event, index)"
- @blur="onBlurDiscordAddress($event, index)" />
- </div>
- </div>
-
- <div>
- <a-switch
- v-if="item.type > 3"
- v-model:checked="item.checked"
- @change="formSwitchChange($event, item, index)"/>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="submit-btn-wrapper">
- <div class="submit-btn"
- :class="{ 'disabled-submit': iptErrMsgTxt != ''}"
- @click="confirm">
- <img class="icon-loading"
- v-if="submitIng"
- :src="require('@/assets/svg/icon-btn-loading.svg')"
- />
- {{iptErrMsgTxt ? iptErrMsgTxt : 'NEXT'}}
- </div>
- </div>
- </div>
- <!-- 预览 -->
- <template v-else-if="showComType == 'preview'">
- <div class="preview">
- <div class="card"
- :class="{ center: Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance) }">
- <div class="card-title">
- <img class="img"
- v-if="Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)"
- :src=" require('@/assets/subject/top-01.svg') " />
- <div class="font">
- Preview: <span>{{installStatus ? 'After' : 'Before' }}</span> DeNet Installed
- </div>
- </div>
- <div class="flash">
- <preview-card
- :currentCurrencyInfo="currentCurrencyInfo"
- :postData="publishRes"
- :baseFormData="baseFormData"
- :amountFontSize="previewFontSize"
- :customPosterInfo="customPosterData"
- ></preview-card>
- </div>
- </div>
- <!-- 需充值 -->
- <div class="card-content" v-if="Number(baseFormData.amountValue) > Number(currentCurrencyInfo.balance)">
- <template v-if="currentCurrencyInfo.currencyCode === 'USD'">
- <div class="card-title">
- <img class="img" :src=" require('@/assets/subject/top-02.svg') " />
- <div class="font">Deposit to Send Giveaway</div>
- </div>
- <div class="card-list">
- <div class="item">
- <div class="l">Giveaway Amount</div>
- <div class="r"></div>
- </div>
- <div class="item">
- <div class="l">Balance</div>
- <div class="r"></div>
- </div>
- <div class="item">
- <div class="l">Paypal charges fee ()</div>
- <div class="r"></div>
- </div>
- <div class="item">
- <div class="l">Deposit Amount</div>
- <div class="r"></div>
- </div>
- </div>
- </template>
- <template v-else>
- <div class="card-title">
- <img class="img" :src=" require('@/assets/subject/top-02.svg') " />
- <div class="font">Deposit to Send Giveaway</div>
- </div>
- <top-up2
- :asyncIng="asyncIng"
- :currentCurrencyInfo="tempCurrentCurrencyInfo"
- @topUpDone="topUpDone">
- </top-up2>
- <div class="card-title">
- <img class="img" :src=" require('@/assets/subject/top-03.svg') " />
- <div class="font">Wait for the amount to arrive</div>
- </div>
- <div class="card-amount">
- <img class="icon" src="@/assets/subject/icon-balance.png" />
- <div class="con">
- <div class="desc">Balance</div>
- <div class="price">{{currentCurrencyInfo.balance}} {{currentCurrencyInfo.tokenSymbol}}</div>
- </div>
- <img
- class="refresh"
- :class="{ 'icon-refresh-rotate': refreshRotate }"
- @click="updateCurrencyBanlce"
- :src=" require('@/assets/svg/icon-form-refresh-blue.svg') "
- />
- </div>
- </template>
- </div>
- </div>
- </template>
- <!-- paypal支付按钮 -->
- <div class="payment" v-show="showComType == 'preview'">
- <paypal-button
- :finalAmountData="finalAmountData"
- :payConfig="{
- paypalClientId,
- feeDesc: payConfig.feeDesc,
- paypalHtml,
- amount: baseFormData.amountValue,
- postId
- }"
- :currentCurrencyInfo="currentCurrencyInfo"
- @payPalFinsh="payPalFinsh">
- <template v-slot:balance>
- <div class="balance" v-if="Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance)">
- <img class="icon" src="@/assets/subject/icon-balance.png" />
- <div class="con">
- <div class="desc">Balance</div>
- <div class="price">{{currentCurrencyInfo.balance}} {{currentCurrencyInfo.tokenSymbol}}</div>
- </div>
- <img class="refresh"
- :class="{ 'icon-refresh-rotate': refreshRotate }"
- :src=" require('@/assets/svg/icon-form-refresh.svg')"
- @click="updateCurrencyBanlce"/>
- </div>
- </template>
- </paypal-button>
- </div>
- </template>
- </div>
- </div>
- </div>
- </div>
-
- <!-- 提示 -->
- <message-box
- :dialogVisible="showMessageBox"
- :title="messageBoxData.title"
- :content="messageBoxData.content"
- @cancel="messageBoxCancel"
- @confirm="messageBoxConfirm"
- ></message-box>
- <!-- 裁剪 -->
- <div class="dialog" v-if="cropperDialog">
- <div class="corp-title">
- <img class="back" :src="require('@/assets/svg/icon-back.svg')" @click="hiddenDialog" />
- <span>Crop</span>
- </div>
- <div class="corp-content">
- <vue-cropper
- ref="refCropper"
- :img="cropperOption.img"
- :output-type="cropperOption.outputType"
- :infoTrue="cropperOption.infoTrue"
- :full="cropperOption.full"
- :fixed="cropperOption.fixed"
- :fixed-number="cropperOption.fixedNumber"
- :auto-crop="cropperOption.autoCrop"
- :auto-crop-width="cropperOption.autoCropWidth"
- :auto-crop-height="cropperOption.autoCropHeight"
- :center-box="cropperOption.centerBox"
- :high="cropperOption.high"
- :max-img-size="cropperOption.max">
- </vue-cropper>
- </div>
- <div class="corp-footer">
- <button v-if="cropperLoading" class="confirm disable">
- <img :src=" require('@/assets/svg/icon-btn-loading.svg') " />
- <span>Confirm</span>
- </button>
- <button v-else class="confirm" @click="confirmImage">Confirm</button>
- </div>
- </div>
- <div class="dialog-mask" v-if="cropperDialog"></div>
- </div>
- </template>
- <script setup>
- import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, provide, getCurrentInstance } from "vue";
- import { postPublish, verifyPaypalResult, syncChainTokenRechargeRecord, getCurrencyInfoByCode } from "@/http/publishApi";
- import { getInviteGuildInfo, getInviteGuildInfoByOpenApi, saveInviteGuildInfo } from "@/http/discordApi";
- import { payCalcFee, getPayConfig } from "@/http/pay";
- import { getFrontConfig } from "@/http/account";
- import { uploadSignature, uploadFile } from '@/http/media';
- import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
- import { debounce, getBit } from "@/uilts/help"
- import Report from "@/log-center/log"
- import { ElMessage, ElLoading } from "element-plus";
- import "element-plus/es/components/message/style/css";
- import "element-plus/es/components/loading/style/css";
- import 'vue-cropper/dist/index.css'
- import { VueCropper } from "vue-cropper";
- import {create, all} from "mathjs";
- import messageBox from "@/view/components/message-box.vue";
- import currencyList from "@/view/components/currency-list.vue";
- import currencySelect from "@/view/components/currency-select.vue";
- import previewCard from "@/view/iframe/publish/components/preview-card";
- import followInput from "@/view/iframe/publish/components/follow-input";
- import paypalButton from "@/view/iframe/publish/components/paypal-button";
- import topUp from "@/view/iframe/publish/components/top-up.vue";
- import topUp2 from "@/view/iframe/publish/components/top-up2.vue";
- import toolBox from '@/view/iframe/publish/tool-box/index.vue'
- import giveawayPoster from '@/view/iframe/publish/components/giveaway-poster.vue';
- import GlobalTip from '@/view/components/global-tip.vue'
- import customCardCover from '@/view/components/custom-card-cover.vue'
- const currentInstance = getCurrentInstance();
- const config = {
- number: 'BigNumber',
- }
- const math = create(all, config);
- //临时货币信息
- let tempCurrentCurrencyInfo = ref({});
- let tempCurrentCurrencyList = ref([]);
- let paypalClientId = ref("");
- let payConfig = ref({});
- let paypalHtml = ref("");
- let installStatus = ref(false);
- let timer = ref(null);
- provide('installStatus', installStatus)
- // 发布后返回的结果
- let publishRes = reactive({});
- //弹窗是否展示
- let visible = ref(false);
- let publishType = ref('REDPACKET');
- //弹窗高度
- let dialogStyle = reactive({
- dialogHeight: 670,
- dialogContentWidth: 1100
- })
- let cropperOption = ref({
- img: '',
- full: true,
- infoTrue: true,
- fixed: true,
- fixedNumber: [16, 8.396],
- outputType: 'png',
- autoCrop: true,
- autoCropWidth: 99999,
- autoCropHeight: 99999,
- centerBox: true,
- high: true,
- max: 99999,
- })
- let cropperDialog = ref(false)
- let cropperLoading = ref(false)
- let cropperType = ref('before')
- let customPosterInfo = ref({})
- let customPosterData = ref({})
- let customShowNewImage = ref(false)
- let refCropper = ref('')
- // 当前展示组件内容 default(表单) preview(预览) topUp(充值)
- let showComType = ref("default");
- let currentComData = {
- default: {
- title: "Giveaway",
- },
- preview: {
- title: "Giveaway",
- },
- topUp: {
- title: "Deposit",
- },
- poster: {
- title: "Giveaway Poster",
- }
- };
- // 机器人开关
- let openAntiBot = ref(false);
- // 是否正在提交
- let submitIng = ref(false);
- // 艾特关注人列表
- let atUserList = ref([]);
- // 表单错误提示
- let iptErrMsgTxt = ref("Select a reward");
- // 是否返回
- let isBack = ref(false);
- // 展示消息提示
- let showMessageBox = ref(false);
- // 展示货币列表pop
- let showCurrencyPop = ref(false);
- let showCurrencySelect = ref(false);
- // 展示更多按钮下的选项
- let showMoreOption = ref(false);
- // 货币列表的dom
- let currencyListDom = ref('');
- // 刷新按钮旋转
- let refreshRotate = ref(false);
- // 预览字体大小
- let previewFontSize = ref(56);
- let postId = ref('');
- let selectModeInfo = reactive({
- index: 0,
- type: 2 // 1: 红包 2: 抽奖
- })
- // 余额是否同步中
- let asyncIng = ref(false);
- let messageBoxData = ref({
- title: "",
- content: "",
- });
- // 真实支付金额数据
- let finalAmountData = ref({
- currencyCode: '',
- feeAmountValue: 0,
- finalAmountValue: 0,
- requestAmountValue: 0,
- });
- // 表单数据
- let baseFormData = reactive({
- amountCurrencyCode: "",
- amountValue: "",
- totalCount: "",
- validityDuration: "",
- type: selectModeInfo.type
- });
- // 当前选择的货币信息
- let currentCurrencyInfo = ref({
- currencyCode: "",
- currencyName: "",
- balance: "",
- currencyType: "",
- iconPath: "",
- minAmount: "",
- tokenChain: "",
- tokenSymbol: "",
- usdEstimateBalance: ""
- });
- const discordIptErrTxt = 'Discord invite link is wrong';
- const discordIptEmptyErrTxt = 'Enter discord invite link';
- const discordIptNerverExpiresErrTxt = 'Make sure the Discord link never expires'
- let iptErrType = ''; //discord
- let formList = reactive([
- {
- label: "Follow",
- icon: require("@/assets/svg/icon-task-twitter.svg"),
- nodeType: "textarea",
- type: 1,
- text: [],
- checked: true,
- show: true
- },
- {
- label: "Retweet & Like",
- icon: require("@/assets/svg/icon-task-twitter.svg"),
- nodeType: "div",
- type: 3,
- checked: true,
- show: true
- },
- {
- label: "Like Tweet",
- icon: require("@/assets/svg/icon-task-twitter.svg"),
- nodeType: "div",
- type: 2,
- checked: true,
- show: false
- },
- {
- label: "Comment and Tag 3 friends",
- icon: require("@/assets/svg/icon-task-twitter.svg"),
- nodeType: "div",
- type: 9,
- checked: true,
- show: true
- },
- {
- label: "Repost to Facebook",
- icon: require("@/assets/svg/icon-task-facebook.svg"),
- nodeType: "div",
- text: '',
- type: 8,
- checked: false,
- show: true
- },
- {
- label: "Join Discord",
- icon: require("@/assets/svg/icon-discord-mini.svg"),
- nodeType: "input",
- text: '',
- type: 7,
- checked: false,
- show: true
- },
- ]);
- let publishModeList = reactive([
- {
- imgActive: require("@/assets/svg/img-A1.svg"),
- imgInActive: require("@/assets/svg/img-A0.svg"),
- type: 2
- },
- {
- imgActive: require("@/assets/svg/img-B1.svg"),
- imgInActive: require("@/assets/svg/img-B0.svg"),
- type: 1
- }
- ])
- let discordInviteInfo = ref({});
- let showDiscordInvitePop = ref(false);
- let lotteryMaxHourDuration = 168;
- let leftTabList = reactive([
- {
- icon: require('@/assets/svg/icon-gift-pack.svg'),
- type: 'REDPACKET'
- },
- {
- icon: require('@/assets/svg/icon-tool-box-02.svg'),
- type: 'TOOL_BOX'
- }
- ])
- let toolBoxPageData = reactive({
- activePage: 'EDITOR', //EDITOR PREVIEW
- postEditorLinkInputDescImage: ''
- })
- const props = defineProps({
- dialogData: {
- type: Object,
- default: () => {
- return {
- visible: false,
- type: 'REDPACKET'
- }
- },
- },
- });
- watch(
- () => props.dialogData,
- (newVal) => {
- visible.value = newVal.visible;
- if (newVal.visible) {
- publishType.value = newVal.type;
- Report.reportLog({
- pageSource: Report.pageSource.publisherDialog,
- businessType: Report.businessType.pageView,
- });
- getLocalCurrencyInfoByCode();
- setTimeout(() => {
- setDialogStyle();
- }, 300);
- // 更新余额
- clearInterval(timer.value);
- timer.value = setInterval(() => {
- getCurrencyInfo({loop: true});
- }, 10000)
- } else {
- clearInterval(timer.value);
- }
- },
- {
- deep: true
- }
- );
- const emits = defineEmits(["close", "confirm", "postPublishFinish"]);
- const close = () => {
- if(publishType.value == 'TOOL_BOX') {
- closeToolBoxPage()
- } else {
- if (showComType.value != "default") {
- showComType.value = "default";
- isBack.value = true;
- } else {
- initParams();
- emits("close", false);
- }
- }
- };
- const closeToolBoxPage = () => {
- if(toolBoxPageData.activePage == "EDITOR") {
- emits("close", false);
- } else if(toolBoxPageData.activePage == "PREVIEW") {
- toolBoxPageData.activePage = "EDITOR";
- }
- };
- /**
- * 设置弹窗高度
- */
- const setDialogStyle = (resize = false) => {
- nextTick(() => {
- let clientHeight = window.innerHeight;
- let clientWidth = window.innerWidth;
- let gapSafe = 40;
- if (dialogStyle.dialogHeight > clientHeight - gapSafe) {
- dialogStyle.dialogHeight = clientHeight - gapSafe;
- } else {
- if(resize) {
- dialogStyle.dialogHeight = 680;
- }
- }
- if(dialogStyle.dialogContentWidth > clientWidth - gapSafe) {
- dialogStyle.dialogContentWidth = clientWidth - gapSafe;
- } else {
- if(resize) {
- dialogStyle.dialogContentWidth = 1080;
- }
- }
- })
- };
- const selectCurrencyPopHandle = () => {
- Report.reportLog({
- pageSource: Report.pageSource.currencySelectorPage,
- businessType: Report.businessType.pageView,
- });
- showCurrencyPop.value = true;
- nextTick(() => {
- if(currencyListDom.value) {
- currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList();
- }
- })
- }
- /**
- * 获取实际支付金额
- */
- const getPayAmount = async (amountValue) => {
- let res = await payCalcFee({
- params: {
- amountValue,
- currencyCode: currentCurrencyInfo.value.currencyCode,
- payChannel: 'paypal',
- },
- });
- if (res.code == 0) {
- let { finalAmountValue, feeDesc } = res.data;
- payConfig.value.feeDesc = feeDesc;
- if (finalAmountValue > 0) {
- finalAmountData.value = res.data;
- }
- }
- return res.data;
- };
- const saveDiscordGuildInfo = () => {
- let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
- //保存服务器信息
- Report.reportLog({
- pageSource: Report.pageSource.publisherDialog,
- businessType: Report.businessType.buttonClick,
- objectType: Report.objectType.saveDiscordGuildData
- }, {
- reportData: discordInviteInfo.value
- });
- if(guildId && inviteCode && inviteUrl) {
- saveInviteGuildInfo({
- params: {
- guildId,
- inviteCode,
- inviteUrl
- }
- })
- }
- }
- const confirm = () => {
- if (submitIng.value || iptErrMsgTxt.value) {
- return;
- }
- let { totalCount = 0 } = baseFormData;
- if (!totalCount) {
- return;
- }
- saveDiscordGuildInfo();
- submitRequest();
- };
- /**
- * 货币列表-选中货币
- */
- const selectCurrency = (params) => {
- let { currencies } = params;
- tempCurrentCurrencyList.value = currencies;
- if (currencies.length > 1) {
- showCurrencyPop.value = false;
- showCurrencySelect.value = true;
- } else {
- selectCurrencyAfter(currencies[0])
- }
- };
- const selectCurrencyAfter = (params, openWindow = true) => {
- tempCurrentCurrencyInfo.value = params;
- showCurrencySelect.value = false;
- currentCurrencyInfo.value = params;
- setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
- if (openWindow === false) {
- return
- };
- if (params.currencyCode != "USD" && params.balance < params.minAmount) {
- let tokenSymbol = params.currencyCode == 'USD' ? 'USD' : params.tokenSymbol;
- messageBoxBlock({
- title: `Whether to deposit ${tokenSymbol}`,
- content: `Insufficient ${tokenSymbol} balance`,
- });
- } else {
- setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
- showCurrencyPop.value = false;
- finalAmountData.value.currencyCode = currentCurrencyInfo.value.currencyCode;
- resetFormIpt(false);
- onIptSetErrorTxt();
- }
- }
- const resetFormIpt = (clearMode = true) => {
- baseFormData.amountValue = "";
- baseFormData.totalCount = "";
- baseFormData.validityDuration = "";
- if(clearMode) {
- selectModeInfo.index = 0;
- selectModeInfo.type = publishModeList[selectModeInfo.index]['type'];
- baseFormData.type = selectModeInfo.type;
- }
- }
- const setLocalSelectCurrencyInfo = (params = {}) => {
- setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})
- }
- const setCurrentCurrencyListInfo = (params = {}) => {
- setChromeStorage({ selectCurrencyList : JSON.stringify(params)})
- }
- /**
- * 获取完货币列表
- */
- const setCurrentCurrencyInfo = (params) => {
- }
- const messageBoxBlock = ({ title = "", content = "" }) => {
- showMessageBox.value = true;
- messageBoxData.value.title = title;
- messageBoxData.value.content = content;
- };
- /**
- * 确定
- */
- const messageBoxConfirm = () => {
- showMessageBox.value = false;
- goTopUp();
- };
- /**
- * 取消
- */
- const messageBoxCancel = () => {
- currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
- setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
- setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
- showMessageBox.value = false;
- showCurrencyPop.value = false;
- showCurrencySelect.value = false;
- resetFormIpt(false);
- onIptSetErrorTxt();
- };
- /**
- * 去充值
- */
- const goTopUp = () => {
- Report.reportLog({
- pageSource: Report.pageSource.rechargePage,
- businessType: Report.businessType.pageView,
- });
- showComType.value = 'topUp';
- }
- /*
- * 自定义封面
- */
- const customCoverImg = () => {
- customPosterInfo.value = {}
- if (Object.keys(customPosterData.value).length > 0) {
- customPosterInfo.value = customPosterData.value;
- }
- showComType.value = 'poster';
- customShowNewImage.value = false;
- setChromeStorage({ custom_poster_guide: Date.now() });
- }
- /**
- * 充值done事件
- */
- const topUpDone = () => {
- currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
- asyncIng.value = true;
- asyncIng.value = false;
- showCurrencyPop.value = false;
- showCurrencySelect.value = false;
- showComType.value = 'default';
- onIptSetErrorTxt()
-
- asyncTokenRechRecord((res) => {
- if(res.code == 0 && res.data && res.data.length) {
- let currencyInfo = res.data[0];
- if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
- currentCurrencyInfo.value.balance = currencyInfo.balance;
- onIptSetErrorTxt()
- }
- }
- })
- }
- /**
- * 更新货币余额
- */
- const updateCurrencyBanlce = () => {
- if(!refreshRotate.value) {
- refreshRotate.value = true;
- setTimeout(() => {
- refreshRotate.value = false;
- }, 1000)
- }
- asyncTokenRechRecord((res) => {
- if(res.code == 0 && res.data && res.data.length) {
- let currencyInfo = res.data[0];
- if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
- currentCurrencyInfo.value.balance = currencyInfo.balance;
- }
- }
- })
- }
- /**
- * 同步链上交易
- */
- const asyncTokenRechRecord = (cb) => {
- syncChainTokenRechargeRecord({
- params: {
- currencyCode: currentCurrencyInfo.value.currencyCode
- }
- }).then(res => {
- cb && cb(res)
- })
- }
- /**
- * 提交表单请求
- */
- const submitRequest = async () => {
- let { amountValue = 0, totalCount = 0 } = baseFormData;
- baseFormData.amountCurrencyCode = currentCurrencyInfo.value.currencyCode;
- // 组装提交参数
- let finishConditions = [];
- for (let i = 0; i < formList.length; i++) {
- let item = {};
- item.type = formList[i]["type"];
- if (item.type == 1 && atUserList.value.length) {
- // follow 参数
- let relatedUsers = atUserList.value.filter(item => item.name);
- item.relatedUsers = relatedUsers;
- finishConditions.push(item);
- } else if (formList[i]["type"] == 7) {
- // join discord
- if(formList[i]["checked"] && formList[i]["text"]) {
- item.bizData = JSON.stringify({inviteUrl: formList[i]["text"]});
- finishConditions.push(item);
- }
- } else if (formList[i]["checked"]) {
- // 其余任务
- finishConditions.push(item);
- }
- }
- let receiveConditions = openAntiBot.value ? "" : [];
- let validityDuration = '';
- if(baseFormData.type == 2) {
- //小时转毫秒
- let unit = process.env.NODE_ENV != 'production' ? 60 * 1000 : 60 * 60 * 1000;
- // let unit = 60 * 60 * 1000
- validityDuration = baseFormData.validityDuration * unit;
- } else {
- validityDuration = '';
- }
- // 提交参数
- let formData = {
- amountCurrencyCode: baseFormData.amountCurrencyCode,
- amountValue,
- totalCount,
- finishConditions,
- receiveConditions,
- payAmountValue: amountValue,
- type: baseFormData.type,
- posterType: 1,
- validityDuration
- };
- submitIng.value = true;
- // 自定义封面
- if (Object.keys(customPosterData.value).length > 0) {
- formData['posterType'] = 2;
- if (customPosterData.value && customPosterData.value.after) {
- formData['customPosterInstalled'] = customPosterData.value.after.objectKey || ''
- }
- if (customPosterData.value && customPosterData.value.before) {
- formData['customPosterUninstalled'] = customPosterData.value.before.objectKey || ''
- }
- }
- // 法币支付需要计算费率
- if(formData.amountCurrencyCode == "USD") {
- let payAmountRes = await getPayAmount(amountValue);
- formData["payAmountValue"] = payAmountRes.finalAmountValue;
- }
- let data = {
- params: {
- postBizData: JSON.stringify(formData),
- postSrc: 1, //1 twitter
- postType: 1, //1 红包
- },
- };
- postPublish(data).then((res) => {
- submitIng.value = false;
- if (res.code == 0) {
- publishRes = res.data;
- postId.value = res.data.postId;
- Report.reportLog({
- pageSource: Report.pageSource.previewPage,
- businessType: Report.businessType.pageView,
- });
- showComType.value = "preview";
- previewFontSize.value = calcFontSize(baseFormData.amountValue, 238, 56);
- isBack.value = false;
- } else {
- console.log(res);
- }
- })
- .catch((err) => {
- console.log(err);
- });
- };
- const calcFontSize = (str, domWidth, maxSize) => {
- let lenstr = str.length;
- let num = parseInt(domWidth / lenstr);
- let fontSize = num < maxSize ? num : maxSize
- return fontSize;
- }
- /**
- * 初始化提交参数
- */
- const initParams = () => {
- resetFormIpt();
- // clear follow value
- atUserList.value = [];
- submitIng.value = false;
- isBack.value = false;
- showCurrencyPop.value = false;
- showCurrencySelect.value = false;
- openAntiBot.value = false;
- tempCurrentCurrencyInfo.value = {};
- currentCurrencyInfo.value = {};
- publishType.value = 'REDPACKET';
- // clear discord value
- setDiscordIptTxt({text: ''});
- discordInviteInfo.value = {};
- customPosterInfo.value = {};
- customPosterData.value = {};
- };
- const setDiscordIptTxt = ({text}) => {
- const index = formList.findIndex(item => item.type == 7);
- formList[index]['text'] = text;
- }
- /**
- * 支付完成回调
- */
- const payPalFinsh = (params) => {
- let {payNetwork, payStatus} = params;
- // token 支付
- if(payNetwork == 'bsc') {
- payStatusHandle(payStatus);
- } else {
- // 法币支付
- let transaction = params.transaction;
- let loadingInstance = ElLoading.service({
- background: "rgba(0,0,0,.3)",
- });
- verifyPaypalResult({
- params: {
- paypalTransactionId: transaction.id,
- postId: publishRes.postId,
- paypalClientId: paypalClientId.value,
- },
- }).then((res) => {
- loadingInstance.close();
- if (res.code == 0) {
- if (res.data) {
- payStatusHandle(res.data.payStatus)
- }
- }
- })
- .catch(() => {
- loadingInstance.close();
- });
- }
- };
- const payStatusHandle = (payStatus) => {
- //支付状态 0:未支付,1:支付成功,2:支付失败,3:已关闭,4:已退款
- switch (payStatus) {
- case 1:
- emits("postPublishFinish", { publishRes });
- showComType.value = "default";
- initParams();
- break;
- case 2:
- // ElMessage({
- // message: "Pay Fail",
- // type: "warning",
- // });
- break;
- case 3:
- // ElMessage({
- // message: "Pay Exceptions",
- // type: "warning",
- // });
- break;
- case 4:
- // ElMessage({
- // message: "Pay Exceptions",
- // type: "warning",
- // });
- break;
- }
- }
- /**
- * follow组件触发新增关注人
- */
- const addFollowUser = (params) => {
- atUserList.value.push(params);
- };
- const setFollowUser = (params) => {
- atUserList.value[params.index]["name"] = params.name;
- };
- const delFollowUser = (params) => {
- atUserList.value.splice(params.index, 1);
- };
- const onAmountInput = () => {
- let val = baseFormData.amountValue;
- // val = val.replace(/[^\d^\.]+/g, "");
- val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
- if(val == '00') {
- val = '0'
- }
- if(val.indexOf('.') > -1){ //校验 例:00.12 => 0.12
- let arr = val.split('.');
- if(arr[0].startsWith('0')) {
- let num = +arr[0];
- val = num + '.' + arr[1];
- }
- }
- baseFormData.amountValue = val;
- setInputErrorMsg({from: 'amount', type:'input'});
- return val;
- };
- const onCountInput = () => {
- let val = baseFormData.totalCount;
- const maxCount = 100000000;
- if (val == 0) {
- val = "";
- }
- val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
- if(val > maxCount) {
- val = maxCount
- }
- baseFormData.totalCount = val;
- setInputErrorMsg({from: 'count', type:'input'});
- return val;
- };
- const onValidityDurationInput = () => {
- let val = baseFormData.validityDuration;
- if (val == 0) {
- val = "";
- } else if(val > lotteryMaxHourDuration) {
- val = lotteryMaxHourDuration+'';
- }
- val = val.replace(/[^\d]/g, "");
- baseFormData.validityDuration = val;
- setInputErrorMsg();
- return val;
- }
- const onValidityDurationBlur = () => {
- let val = baseFormData.validityDuration;
- if (val == 0) {
- val = "";
- } else if(val > lotteryMaxHourDuration) {
- val = lotteryMaxHourDuration+'';
- }
- val = val.replace(/[^\d]/g, "");
- baseFormData.validityDuration = val;
- setInputErrorMsg();
- return val;
- }
- /**
- * 金额输入失焦
- */
- const onAmountBlur = () => {
- setInputErrorMsg({from: 'amount', type:'blur'});
- };
- /**
- * count失焦,校验输入结果
- */
- const onCountBlur = () => {
- setInputErrorMsg({from: 'count', type:'blur'});
- };
- /**
- * 输入结果金额和数量 (金额/数量)是否小于最小货币单位
- */
- const calcIptValue = (cb) => {
- let amountValue = baseFormData.amountValue;
- let totalCount = baseFormData.totalCount;
- let flag = true;
- if (!amountValue || !totalCount) {
- return {
- flag
- };
- }
- if (math.format(math.evaluate(`${baseFormData.amountValue} / ${baseFormData.totalCount}`)) < +currentCurrencyInfo.value.minAmount) {
- flag = false;
- }
- return {
- flag,
- count: Math.floor(math.format(math.evaluate(`${baseFormData.amountValue} / ${currentCurrencyInfo.value.minAmount}`)))
- }
- };
- /**
- * 设置输入提示语
- */
- const setInputErrorMsg = () => {
- onIptSetErrorTxt();
- };
- /**
- * 输入时 检测设置错误信息
- */
- const onIptSetErrorTxt = (params = {}) => {
- if(!currentCurrencyInfo.value.currencyCode) {
- iptErrMsgTxt.value = "Select a reward"
- } else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
- iptErrMsgTxt.value = "Enter an amount";
- } else if (!baseFormData.totalCount || baseFormData.totalCount == '0') {
- iptErrMsgTxt.value = "Enter the number of winners";
- } else if(+baseFormData.amountValue <= +currentCurrencyInfo.value.balance) {
- // 输入金额 小于 余额
- let res = calcIptValue();
- if (!res.flag) {
- iptErrMsgTxt.value = `${baseFormData.amountValue} ${currentCurrencyInfo.value.tokenSymbol} Can send up to ${res.count} winners`;
- } else {
- if(baseFormData.type == 2 && !baseFormData.validityDuration) {
- iptErrMsgTxt.value = "Enter Automatically Draw";
- } else {
- //清空错误提示
- iptErrMsgTxt.value = "";
- if(params.actionType != 'discord_blur') {
- setDiscordErrTxt({getDuildId: true});
- }
- }
- }
- } else if(baseFormData.type == 2 && !baseFormData.validityDuration) {
- // 抽奖模式 没有输入时长
- iptErrMsgTxt.value = "Enter Automatically Draw";
- } else {
- setDiscordErrTxt({getDuildId: true}, () => {
- iptErrMsgTxt.value = '';
- });
- }
- }
- /**
- * 监听开关触发事件
- */
- const formSwitchChange = (val, params, index) => {
- closeDiscordTask(val, params, index);
- }
- const hideTask = (params, index) => {
- formList[index]['checked'] = false;
- formList[index]['show'] = false;
- closeDiscordTask(false, {type: 7}, index)
- }
- const clickDropdown = (params, index) => {
- formList[index]['show'] = true;
- formList[index]['checked'] = true;
- }
- const closeDiscordTask = (val, params, index) => {
- if(params.type == 7) {
- if(!val) {
- //错误类型 discord 清空discord错误校验
- if(iptErrType == 'discord') {
- iptErrMsgTxt.value = '';
- formList[index]['text'] = '';
- onIptSetErrorTxt();
- }
- } else {
- onIptSetErrorTxt();
- }
- }
- }
- /** 监听 discord 输入 */
- const onIptDiscordAddress = (e, index) => {
- let val = formList[index].text;
- let checked = formList[index].checked;
- if(val && !checked) {
- checked = true;
- formList[index].checked = checked;
- formList[index].text = formList[index].text.replace(/\s/g,'');
- } else if(!val){
- discordInviteInfo.value = {};
- }
- onIptDiscordDebounce()
- }
- const onBlurDiscordAddress = (e, index) => {
- setDiscordErrTxt({fromType: 'discord', showPop: false, actionType: 'discord_blur'});
- }
- const getDiscordIptData = () => {
- let discordItem = formList.find(item => item.type == 7);
- return discordItem;
- }
- /**
- * 设置输入discord错误提示信息
- */
- const setDiscordErrTxt = (params = {showPop: false}, cb) => {
- let discordData = getDiscordIptData() || {};
- if(discordData.checked) {
- if(discordData.text) {
- let validata = checkInviteUrl(discordData.text);
- if(validata) {
- getDiscordInviteInfo({inviteUrl: discordData.text, getDuildId: params.getDuildId}, (res) => {
- console.log('discordData',res)
- // 未知的邀请链接
- if(res.inviteCode != res.data.code || !res.data.guildId) {
- iptErrMsgTxt.value = discordIptErrTxt;
- iptErrType = 'discord';
- } else {
- if(res.data.expires !== null) {
- // 不是永久邀请链接
- iptErrMsgTxt.value = discordIptNerverExpiresErrTxt;
- iptErrType = '';
- } else {
- if(iptErrMsgTxt.value) {
- iptErrMsgTxt.value = '';
- iptErrType = '';
- }
- if(params.showPop && res.data) {
- showDiscordInvitePop.value = true;
- setTimeout(() => {
- showDiscordInvitePop.value = false;
- }, 2000)
- }
- if(params.fromType == 'discord') {
- onIptSetErrorTxt();
- }
- }
- }
- cb && cb(res)
- })
- } else {
- iptErrMsgTxt.value = discordIptErrTxt;
- iptErrType = 'discord';
- }
- } else {
- if(params.actionType == 'discord_blur') {
- onIptSetErrorTxt({acitonType: 'discord_blur'});
- } else {
- // 设置空提示
- iptErrMsgTxt.value = discordIptEmptyErrTxt;
- iptErrType = 'discord';
- }
- }
- } else {
- cb && cb();
- }
- }
- const onIptDiscordDebounce = debounce(function() {
- setDiscordErrTxt({fromType: 'discord', showPop: true});
- }, 800)
- /**
- * 校验 discord邀请url
- */
- const checkInviteUrl = (inviteUrl) => {
- let flag = false;
- const INVITE_URL_PREFIX_1 = 'https://discord.gg/';
- const INVITE_URL_PREFIX_2 = 'https://discord.com/invite/';
- const INVITE_URL_PREFIX_3 = 'http://discord.gg/';
- const INVITE_URL_PREFIX_4 = 'http://discord.com/invite/';
- const INVITE_URL_PREFIX_5 = 'discord.gg/';
- const INVITE_URL_PREFIX_6 = 'discord.com/invite/';
- const arr = [INVITE_URL_PREFIX_1, INVITE_URL_PREFIX_2, INVITE_URL_PREFIX_3, INVITE_URL_PREFIX_4, INVITE_URL_PREFIX_5, INVITE_URL_PREFIX_6]
- if(inviteUrl) {
- if(arr.indexOf(inviteUrl) > -1) {
- flag = false;
- } else {
- let isPass = false;
- for(let i = 0; i < arr.length; i++) {
- let item = arr[i];
- if(inviteUrl.startsWith(item)) {
- isPass = true;
- break;
- }
- }
- flag = isPass;
- }
- }
- return flag;
- }
- /**获取discord 邀请信息 */
- const getDiscordInviteInfo = ({inviteUrl, getDuildId}, cb) => {
- if(!inviteUrl) return;
- let inviteCode = '';
- let arr = inviteUrl.split('/');
- if(arr.length > 0) {
- inviteCode = arr[arr.length - 1];
- }
- if(!getDuildId && discordInviteInfo.value.guildId && discordInviteInfo.value.inviteCode == inviteCode) {
- return;
- }
- getInviteGuildInfo({
- inviteCode
- }).then(res => {
- let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
- if(resData.data.guildId) {
- cb && cb(resData);
- } else {
- //DISCORD 接口未获取到服务器信息 resdata
- Report.reportLog({
- pageSource: Report.pageSource.publisherDialog,
- businessType: Report.businessType.buttonClick,
- objectType: Report.objectType.getDiscordGuildNoData
- }, {
- resData: resData
- });
- getGuildInfoByOpenApi({inviteCode}, cb);
- }
- }).catch((err) => {
- //DISCORD 接口 catch
- Report.reportLog({
- pageSource: Report.pageSource.publisherDialog,
- businessType: Report.businessType.buttonClick,
- objectType: Report.objectType.getDiscordGuildCatch
- }, {
- err: err
- });
- let errMsg = err;
- if(typeof errMsg == 'object') {
- errMsg = JSON.stringify(err);
- }
- if(errMsg.indexOf('code 404') > -1) {
- discordInviteInfo.value = {};
- iptErrMsgTxt.value = discordIptErrTxt;
- } else {
- getGuildInfoByOpenApi({inviteCode}, cb);
- }
- });
- }
- const getGuildInfoByOpenApi = (params, cb) => {
- let { inviteCode } = params;
- getInviteGuildInfoByOpenApi({
- inviteCode
- }).then(res => {
- let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
- if(resData.data.guildId) {
- cb && cb(resData);
- } else {
- //OPENAPI 接口未获取到服务器信息 resdata
- Report.reportLog({
- pageSource: Report.pageSource.publisherDialog,
- businessType: Report.businessType.buttonClick,
- objectType: Report.objectType.getDiscordGuildOpenApiNoData
- }, {
- resData: resData
- });
- }
- }).catch((err) => {
- // OPENAPI 接口 catch 限频
- Report.reportLog({
- pageSource: Report.pageSource.publisherDialog,
- businessType: Report.businessType.buttonClick,
- objectType: Report.objectType.getDiscordGuildOpenApiCatch
- }, {
- err: err
- });
- if(iptErrMsgTxt.value && iptErrType == 'discord') {
- iptErrMsgTxt.value = '';
- iptErrType = '';
- }
- });
- }
- const inviteGuildResHandler = (res, params) => {
- let {inviteCode, inviteUrl} = params;
- if(!res) {
- res = {};
- }
- let {name, icon, id} = res.guild || {};
- icon = icon && id ? `https://cdn.discordapp.com/icons/${id}/${icon}.png` : '';
- let resData = {
- inviteCode,
- data: {
- code: res.code,
- guildId: id,
- inviteUrl,
- inviteCode,
- expires: res.expires_at,
- name,
- icon,
- }
- }
- if(res.code == inviteCode) {
- discordInviteInfo.value = resData.data;
- } else {
- discordInviteInfo.value = {};
- iptErrMsgTxt.value = discordIptErrTxt;
- }
- return resData;
- };
- /**
- * 获取支付配置(paypalClientId)
- */
- const setPayConfig = () => {
- getPayConfig({
- params: {},
- }).then((res) => {
- if (res.code == 0) {
- payConfig.value = res.data;
- paypalClientId.value = res.data.paypalClientId;
- }
- });
- };
- /**
- * 获取配置
- */
- const setFrontConfig = () => {
- getFrontConfig({
- params: {},
- }).then((res) => {
- if (res.code == 0) {
- paypalHtml.value = res.data.paypalHtml;
- lotteryMaxHourDuration = res.data.lotteryMaxHourDuration;
- toolBoxPageData.postEditorLinkInputDescImage = res.data.postEditorLinkInputDescImage;
- }
- });
- };
- const goTransactionsList = () => {
- window.open(`${chrome.runtime.getURL('/iframe/home.html#/transactions')}`)
- }
- /**
- * 默认获取上次选中的货币信息
- */
- const getLocalCurrencyInfoByCode = () => {
- if(!currentCurrencyInfo.value.currencyCode) {
- getCurrencyInfo();
- }
- }
- const getCurrencyInfo = async (_params) => {
- let { loop = false} = _params || {};
- let {accessToken = ''} = await getChromeStorage('userInfo') || {};
- if (accessToken) {
- getChromeStorage('selectCurrencyInfo', (res) => {
- if(res && res.currencyCode) {
- getCurrencyInfoByCode({
- params: {
- currencyCode: res.currencyCode
- }
- }).then(res => {
- if(res.code == 0 && res.data) {
- currentCurrencyInfo.value = res.data;
- tempCurrentCurrencyInfo.value = res.data;
- if(!loop) {
- onIptSetErrorTxt();
- }
- }
- });
- }
- })
- getChromeStorage('selectCurrencyList', (res) => {
- if (showCurrencySelect.value === false) {
- tempCurrentCurrencyList.value = res;
- }
- })
- }
- }
- const selectPublishMode = (params, index) => {
- selectModeInfo.index = index;
- selectModeInfo.type = params.type;
- baseFormData.type = params.type;
- setInputErrorMsg();
- }
- const clickLeftTab = (params, index) => {
- publishType.value = params.type;
- }
- const onToolBoxPageChange = (params) => {
- toolBoxPageData.activePage = params.page;
- };
- const toolBoxPublishFinish = (params) => {
- toolBoxPageData.activePage = 'EDITOR';
- emits("postPublishFinish", { publishRes: params.publishRes });
- }
- // 截图相关
- const showDialog = () => {
- cropperDialog.value = true;
- }
- const hiddenDialog = () => {
- cropperDialog.value = false;
- cropperLoading.value = false;
- }
- const selectImage = (option) => {
- // 设置图片
- cropperOption.value.img = option.file
- // 选取比例
- if (option && option.type && option.type == 2) {
- cropperType.value = 'after';
- cropperOption.value.fixedNumber = [1, 1];
- } else {
- cropperType.value = 'before';
- cropperOption.value.fixedNumber = [16, 8.396];
- }
- nextTick(() => {
- showDialog()
- })
- }
- const confirmImage = () => {
- let contentType = 'image/png';
- cropperLoading.value = true;
-
- if (refCropper.value) {
- refCropper.value.getCropBlob(imgData => {
- uploadSignature({
- params: {
- bizType: 1,
- fileType: 1,
- contentType: contentType,
- fileSuffix: 'png',
- }
- }).then(res => {
- let { code, data } = res;
- if (code === 0) {
- let reader = new FileReader()
- reader.readAsArrayBuffer(imgData)
- reader.onload = function(e) {
- let execFile = e.target.result;
- uploadFile({
- url: data.url,
- data: new Blob([execFile]),
- headers: {
- 'Authorization': data.authorization,
- 'x-amz-date': data.date,
- 'Content-Type': contentType
- }
- }).then(res => {
- let { status } = res
- if (status == 200) {
- successImage(data)
- }
- }).finally(() => {
- cropperLoading.value = false;
- })
- }
- }
- })
- })
- }
- }
- const successImage = (data) => {
- hiddenDialog()
- // setPosterInfo
- customPosterInfo.value[cropperType.value] = data;
- }
- const confirmData = (data) => {
- close()
- customPosterData.value = customPosterInfo.value;
- }
- onMounted(() => {
- setFrontConfig();
- setPayConfig();
- getLocalCurrencyInfoByCode();
- window.addEventListener('resize', function () {
- setDialogStyle(true);
- })
- // showNewImage
- getChromeStorage('custom_poster_guide', (info) => {
- if (!info) {
- customShowNewImage.value = true
- }
- })
- });
- </script>
- <style lang="scss" scoped>
- :deep() .ant-switch {
- background-color: #E9ECEE;
- height: 14px;
- line-height: 16px;
- min-width: 36px;
- }
- :deep() .ant-switch-checked {
- background-color: #AED8F5 !important;
- }
- :deep() .ant-switch::after {
- width: 20px;
- height: 20px;
- top: -4px;
- left: -1px;
- }
- :deep() .ant-switch-checked::after {
- background-color: #1D9BF0 !important;
- margin-left: 3px;
- left: 100% !important;
- }
- .overlay {
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- z-index: 1000;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.5);
- overflow: auto;
- .content {
- height: 620px;
- background: #ffffff;
- border-radius: 20px;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- box-sizing: border-box;
- z-index: 2000;
- max-height: 825px;
- .pop-mask {
- width: 100%;
- height:100%;
- position: absolute;
- z-index:900;
- }
- .head {
- border-bottom: 1px solid #ececec;
- height: 48px;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 14px;
- .left {
- display: flex;
- align-items: center;
- .title {
- font-size: 16px;
- font-weight: 500;
- }
- .close-btn {
- display: flex;
- align-items: center;
- width: max-content;
- margin-right: 12px;
- cursor: pointer;
- }
- }
- .right {
- .more {
- cursor: pointer;
- }
- .area-option {
- width: 100%;
- height: 100%;
- position: absolute;
- top: 0;
- left: 0;
- z-index: 111;
- .option {
- position: absolute;
- top: 43px;
- right: 15px;
- background: #fff;
- filter: drop-shadow(0px 3px 20px rgba(0, 0, 0, 0.2));
- width: 240px;
- border-radius: 15px;
- overflow: hidden;
- .item {
- width: 100%;
- height: 50px;
- display: flex;
- align-items: center;
- cursor: pointer;
- border-top: 1px solid #E9E9E9;
- img {
- margin-left: 15px;
- width: 30px;
- height: 30px;
- margin-right: 6px;
- }
- span {
- font-weight: 500;
- font-size: 14px;
- }
- }
- .item:first-child {
- border-top: 0;
- }
- .item:hover {
- background: #F5F5F5;
- }
- }
- }
- }
- }
- .body {
- box-sizing: border-box;
- height: calc(100% - 48px);
- display: flex;
- position: relative;
- .body-content {
- display:flex;
- width:100%;
- }
- .currency-pop {
- position: absolute;
- width: 375px;
- height: 480px;
- top: 85px;
- left: 88px;
- z-index: 1000;
- box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
- background-color: #fff;
- border-radius: 20px;
- overflow-y: auto;
- }
-
- .currency-pop-select {
- position: absolute;
- width: 375px;
- max-height: 480px;
- top: 85px;
- left: 88px;
- z-index: 1000;
- box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
- background-color: #fff;
- border-radius: 20px;
- overflow-y: scroll;
- }
- .left,
- .right {
- height: 100%;
- }
- .left {
- width: 50px;
- display: flex;
- flex-direction: column;
- align-items: center;
- .tab-item {
- width: 100%;
- height: 55px;
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- }
- .active-tab {
- background-color: #D2EAFC;
- }
- .bottom {
- .icon {
- display: block;
- margin-bottom: 26px;
- }
- }
- }
- .right {
- width: calc(100% - 50px);
- box-sizing: border-box;
- position: relative;
- border-left: 1px solid #ececec;
- .form-wrapper {
- padding: 18px 18px 18px 18px;
- height: calc(100% - 80px);
- overflow: auto;
- box-sizing: border-box;
- display: flex;
- .task-wrapper {
- width: 480px;
- }
- .form-cell-item {
- height: 100%;
- .title {
- display: flex;
- align-items: center;
- font-weight: 500;
- font-size: 15px;
- .icon {
- width: 20px;
- height: 20px;
- margin-right: 5px;
- }
- }
- .form-cell-content {
- margin-top: 12px;
- box-sizing: border-box;
- }
- }
- .base-form-wrapper {
- width: 450px;
- margin-right: 30px;
- .form-cell-content {
- .select-mode-ele {
- display: flex;
- cursor: pointer;
- img:first-child {
- margin-right: 10px;
- }
- img {
- -webkit-user-drag: none;
- width: 220px;
- height: 90px;
- }
- }
- .form-base {
- margin-top: 20px;
- border: 1px solid #D1D9DD;
- border-radius: 14px;
- box-sizing: border-box;
- padding-left: 14px;
- .item {
- box-sizing: border-box;
- padding: 7px 0;
- min-height: 76px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- input {
- width: 178px;
- text-align: right;
- font-weight: 700;
- font-size: 26px;
- border: none;
- outline: none;
- box-sizing: border-box;
- }
- input::placeholder {
- color: #c5c5c5;
- }
- input {
- padding-right: 16px;
- }
- .label {
- font-weight: 500;
- font-size: 15px;
- display: flex;
- align-items: center;
- .icon {
- width: 20px;
- height: 20px;
- margin-right: 8px;
- }
- }
- }
- .currency-select-wrapper {
- overflow: hidden;
- .currency-select {
- cursor: pointer;
- background: #1D9BF0;
- padding: 6px 10px;
- border-radius: 12px;
- color: #fff;
- width: max-content;
- max-width: 234px;
- .text {
- word-break: break-all;
- }
- .arrow {
- margin-left: 5px;
- }
- }
- .selected {
- background: #F4F4F4 !important;
- color: #000 !important;
- }
- }
- .winners-count-input {
- border-top: 1px solid #D1D9DD;
- .msg {
- font-weight: 400;
- font-size: 12px;
- color: #A39F9F;
- margin-top: 8px
- }
- }
- .automatically-input {
- border-top: 1px solid #D1D9DD;
- .input-wrapper {
- margin-right: 16px;
- box-sizing: border-box;
- input {
- padding-right: 4px !important;
- }
- .unit {
- font-weight: 700;
- font-size: 26px;
- opacity: 0.5;
- }
- }
- }
- }
- }
- }
- .currency-operation {
- position: relative;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- margin-top: 8px;
- .balance,
- .amount {
- display: flex;
- align-items: center;
- }
- .amount {
- font-weight: 400;
- font-size: 12px;
- color: #A39F9F;
- img {
- margin-left: 6px;
- cursor: pointer;
- }
- }
- .top-up {
- font-weight: 500;
- font-size: 12px;
- color: #1D9BF0;
- cursor: pointer;
- margin-left: 4px;
- }
- }
- .form-label {
- margin-top: 14px;
- margin-bottom: 10px;
- font-weight: 500;
- font-size: 14px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .icon-add-task {
- cursor: pointer;
- }
- }
- .form-require {
- box-sizing: border-box;
- border-radius: 15px;
- border: 1px solid #D1D9DD;
- .form-item {
- min-height: 54px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 0 16px;
- border-bottom: 1px solid #ececec;
- padding: 8px 0;
- box-sizing: border-box;
-
- .item-left {
- display: flex;
- }
- .label {
- min-width: 76px;
- display: flex;
- align-items: center;
- font-size: 15px;
- font-weight: 500;
- .icon {
- margin-right: 10px;
- }
- }
- .control {
- min-width: 258px;
- margin-left: 6px;
- box-sizing: border-box;
- position: relative;
- .discord-address {
- border: none;
- outline: none;
- color: #1D9BF0;
- font-weight: 500;
- font-size: 14px;
- width: 100%;
- height: 34px;
- padding-left: 15px;
- }
- .discord-address::placeholder {
- color: #c5c5c5;
- }
- .discord-invite-info {
- position: absolute;
- top: 40px;
- left: 0;
- box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
- background: #fff;
- border-radius: 16px;
- padding: 16px;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- cursor: pointer;
- .icon {
- width: 40px;
- height: 40px;
- margin-right: 10px;
- border-radius: 50%;
- }
- .name {
- font-weight: 600;
- font-size: 16px;
- color: #101419;
- width: 193px;
- height: 20px;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- display: inline-block;
- }
- }
- }
- .icon-task-close {
- margin-left: 6px;
- cursor: pointer;
- }
- }
- .border-hide {
- border-bottom: none !important;
- }
- }
- }
- .giveaway-poster {
- display: flex;
- align-items: center;
- flex-direction: row;
- cursor: pointer;
- height: 84px;
- margin-top: 20px;
- border-radius: 14px;
- border: 1px solid #D1D9DD;
- .show-img {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 45px;
- height: 60px;
- margin-left: 14px;
- margin-right: 14px;
- }
- .show-font {
- position: relative;
- font-size: 15px;
- font-weight: 500;
- .new {
- width: 40px;
- height: 18px;
- margin-left: 10px;
- }
- }
- .show-placeholder {
- flex: 1;
- color: #1D9BF0;
- font-size: 15px;
- font-weight: 500;
- text-align: right;
- }
- .arrow {
- width: 18px;
- height: 24px;
- margin-left: 2px;
- margin-right: 12px;
- }
- }
- .tips-wrapper {
- margin: 16px 0 0 12px !important;
- padding: 0px !important;
- .title,
- .row {
- font-weight: 400;
- font-size: 12px;
- color: #A39F9F;
- }
- .row {
- box-sizing: border-box;
- line-height: 16px;
- }
- }
- .submit-btn-wrapper {
- width: 100%;
- background: #fff;
- position: absolute;
- bottom: 18px;
- left: 0;
- box-sizing: border-box;
- padding: 16px 18px 0 18px;
- .submit-btn {
- width: 100%;
- height: 46px;
- text-align: center;
- background: #4a99e9;
- border-radius: 100px;
- color: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 16px;
- font-weight: 500;
- cursor: pointer;
- .icon-loading {
- width: 20px;
- height: 20px;
- margin-right: 3px;
- }
- }
- .disabled-submit {
- background-color: #D9D9D9;
- }
- }
- }
- .fill-right {
- width: 100% !important;
- border-bottom-left-radius: 16px;
- }
- }
- }
- }
- .preview {
- padding: 30px 40px;
- height: calc(100% - 80px);
- overflow-y: auto;
- .card {
- float: left;
- width: 480px;
- position: relative;
- .flash {
- overflow: hidden;
- height: 600px;
- border-radius: 26px;
- border: solid 1px #ECECEC;
- }
- &.center {
- margin-left: 50%;
- transform: translateX(-50%);
- }
- }
- .card-title {
- height: 32px;
- .img {
- float: left;
- width: 20px;
- height: 20px;
- margin-right: 8px;
- }
- .font {
- float: left;
- font-size: 17px;
- font-weight: 500;
- span {
- color: #0091e9;
- }
- }
- }
- .card-content {
- float: right;
- width: 500px;
- }
- .card-amount {
- overflow: hidden;
- display: flex;
- height: 80px;
- align-items: center;
- padding: 20px;
- border-radius: 20px;
- border: 1px solid #E6E6E6;
- .icon {
- width: 40px;
- height: 40px;
- }
- .con {
- flex: 1;
- padding: 0 10px;
- .desc {
- color: rgba($color: #000000, $alpha: 0.5);
- font-size: 12px;
- margin-bottom: 4px;
- }
- .price {
- font-size: 16px;
- font-weight: bold;
- word-break: break-all;
- }
- }
- .refresh {
- cursor: pointer;
- width: 30px;
- height: 30px;
- margin-top: -5px;
- }
- }
- .card-list {
- padding: 20px;
- border-radius: 20px;
- border: 1px solid #E6E6E6;
- .item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 47px;
- font-size: 14px;
- font-weight: 500;
- box-shadow: inset 0px -1px 0px #EAEAEA;
- }
- }
- }
- .icon-refresh-rotate {
- transform: rotate(360deg);
- transition-duration: 1s;
- }
- .payment {
- .balance {
- display: flex;
- margin-right: 20px;
- .icon {
- width: 40px;
- height: 40px;
- }
- .con {
- padding: 0 5px;
- .desc {
- color: rgba($color: #000000, $alpha: 0.5);
- font-size: 12px;
- margin-bottom: 4px;
- }
- .price {
- font-size: 14px;
- font-weight: bold;
- word-break: break-all;
- }
- }
- .refresh {
- width: 40px;
- cursor: pointer;
- margin-left: -5px;
- }
- }
- }
- .dialog {
- position: absolute;
- z-index: 2002;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 800px;
- height: calc(100% - 100px);
- border-radius: 20px;
- background-color: #ffffff;
- .corp-title {
- display: flex;
- height: 48px;
- align-items: center;
- .back {
- cursor: pointer;
- width: 24px;
- height: 24px;
- margin: 0 12px;
- }
- span {
- font-size: 16px;
- font-weight: 500;
- }
- }
- .corp-content {
- width: 472px;
- margin: auto;
- height: calc(100% - 130px);
- }
- .corp-footer {
- display: flex;
- align-items: center;
- justify-content: right;
- height: 80px;
- text-align: right;
- padding-right: 30px;
- .confirm {
- cursor: pointer;
- border: 0;
- width: 200px;
- height: 50px;
- color: #ffffff;
- font-size: 18px;
- font-weight: 700;
- border-radius: 25px;
- background: #1D9BF0;
- &.disable {
- background: #D9D9D9;
- img {
- width: 20px;
- margin-right: 10px;
- }
- }
- }
- }
- }
- .dialog-mask {
- position: absolute;
- z-index: 2001;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.5);
- }
- :deep() .vue-cropper {
- background-image: none;
- }
- :deep() .cropper-modal {
- background: rgba(0, 0, 0, .05);
- }
- </style>
|