give-dialog.vue 106 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976
  1. <template>
  2. <div class="overlay" v-if="visible">
  3. <div class="content"
  4. :style="{
  5. height: showComType === 'preview' ? 'calc(100vh - 40px)' : dialogStyle.dialogHeight + 'px',
  6. width: dialogStyle.dialogContentWidth + 'px',
  7. }">
  8. <div class="pop-mask"
  9. v-show="showCurrencyPop || showCurrencySelect"
  10. @click.stop="showCurrencyPop = false; showCurrencySelect=false">
  11. </div>
  12. <!-- head -->
  13. <give-dialog-head
  14. :title="publishType == 'REDPACKET' ? currentComData[showComType]['title'] : 'Tool Box'"
  15. :publishType="publishType"
  16. :showComType="showComType"
  17. :toolBoxPageData="toolBoxPageData"
  18. @close="close"></give-dialog-head>
  19. <!-- 内容 -->
  20. <div class="body">
  21. <!-- 充值组件 -->
  22. <top-up
  23. v-if="showComType == 'topUp'"
  24. :currentCurrencyInfo="tempCurrentCurrencyInfo"
  25. @topUpDone="topUpDone">
  26. </top-up>
  27. <!-- 自定义红包封面 -->
  28. <giveaway-poster
  29. v-else-if="showComType == 'poster'"
  30. :baseFormData="baseFormData"
  31. :currentCurrencyInfo="currentCurrencyInfo"
  32. :customPosterInfo="customPosterInfo"
  33. @selectImage="selectImage"
  34. @confirmData="confirmData">
  35. </giveaway-poster>
  36. <!-- 表单填写容器 -->
  37. <div class="body-content" v-else>
  38. <!-- 货币列表 -->
  39. <div class="currency-pop" v-show="showCurrencyPop">
  40. <currency-list
  41. ref="currencyListDom"
  42. :showGeneralLottery="showGeneralLottery"
  43. @selectCurrency="selectCurrency"
  44. @setCurrencyList="setCurrentCurrencyInfo"
  45. @addGeneralLottery="addCustomizedRewardHandle"></currency-list>
  46. </div>
  47. <!-- 通用奖品编辑弹窗 -->
  48. <div class="customized-reward-edit-popup" v-if="showCustomizedRewardEditPopup">
  49. <customized-reward-edit-popup
  50. ref="rewardEditDom"
  51. :customizedReward="baseFormData.customizedReward"
  52. :rewardType="baseFormData.rewardType"
  53. @closeRewardPopup="closeRewardPopup"
  54. @removeReward="removeReward"
  55. @submitReward="submitReward"></customized-reward-edit-popup>
  56. </div>
  57. <div class="currency-pop-select" v-show="showCurrencySelect">
  58. <currency-select
  59. ref="currencySelectDom"
  60. :list="tempCurrentCurrencyList"
  61. @selectCurrency="selectCurrencyAfter"></currency-select>
  62. </div>
  63. <div class="left" v-if="showComType != 'preview' && toolBoxPageData.activePage != 'PREVIEW'">
  64. <div class="tab-item"
  65. :class="{'active-tab': item.type == publishType}"
  66. v-for="(item, index) in leftTabList"
  67. :key="index"
  68. @click="clickLeftTab(item, index)"
  69. >
  70. <img class="icon" :src="item.icon"/>
  71. </div>
  72. </div>
  73. <div class="right"
  74. :class="{'fill-right': showComType == 'preview' || toolBoxPageData.activePage == 'PREVIEW'}">
  75. <global-tip :type="'2'"></global-tip>
  76. <template v-if="publishType == 'TOOL_BOX'">
  77. <tool-box
  78. :pageData="{
  79. 'linkInputDescImage': toolBoxPageData.postEditorLinkInputDescImage,
  80. 'defaultLinkTitle': toolBoxPageData.postEditorDefaultLinkTitle
  81. }"
  82. :activePage="toolBoxPageData.activePage" @onPageChange="onToolBoxPageChange"
  83. @toolBoxPublishFinish="toolBoxPublishFinish"></tool-box>
  84. </template>
  85. <template v-else>
  86. <div class="form-wrapper" v-if="showComType == 'default'">
  87. <div class="form-left-sheet">
  88. <div class="base-form-wrapper">
  89. <div class="form-cell-content">
  90. <div class="select-mode-ele">
  91. <template v-for="(item, index) in publishModeList" :key="index">
  92. <img class="img"
  93. :src="selectModeInfo.index == index ? item.imgActive : item.imgInActive"
  94. @click="selectPublishMode(item, index)">
  95. <img class="img-tips" :src="item.imgInfoSrc" v-if="selectModeInfo.index == index" />
  96. </template>
  97. </div>
  98. <!-- 金额 -->
  99. <div class="form-base">
  100. <div class="form-cell">
  101. <div class="cell-title">
  102. <img class="title-icon" :src="require('@/assets/svg/icon-form-amount.svg')" />
  103. Amount
  104. </div>
  105. <div class="cell-content flex">
  106. <div class="currency-select"
  107. :class="{'selected': currencySelectCpd}"
  108. @click="selectCurrencyPopHandle">
  109. <img class="icon"
  110. v-if="currentIconCpd"
  111. :src="currentIconCpd"/>
  112. <component-zoom width="100" :txt="currentPrizeCpd">
  113. <div class="text">
  114. {{currentPrizeCpd}}
  115. </div>
  116. </component-zoom>
  117. <img class="arrow"
  118. :src="currentArrowCpd"/>
  119. </div>
  120. <form-input class="margin-left-10"
  121. :suffix="baseFormData.rewardType === RewardType.custom ? 'items' : currentCurrencyInfo.currencyCode ? currentPrizeCpd : ''">
  122. <template v-slot:content>
  123. <input style="width: 100px"
  124. v-model="baseFormData.amountValue"
  125. placeholder="0"
  126. autofocus
  127. @input="onAmountInput"
  128. @blur="onAmountBlur"/>
  129. </template>
  130. </form-input>
  131. <form-input class="margin-left-10"
  132. v-if="currentCurrencyInfo.currencyCode != 'USD' && baseFormData.rewardType != RewardType.custom"
  133. prefix="=$"
  134. suffix="USD">
  135. <template v-slot:content>
  136. <input style="width: 85px"
  137. v-model="treasureFormData.usdEstimateOrderAmount"
  138. @input="onUsdEstimateOrderAmountInput"
  139. @blur="onUsdEstimateOrderAmountInput"
  140. placeholder="0"/>
  141. </template>
  142. </form-input>
  143. </div>
  144. <!-- 刷新按钮、充值 -->
  145. <div class="currency-operation"
  146. v-if="currentCurrencyInfo.currencyCode">
  147. <div class="amount">
  148. Balance:
  149. <a-tooltip :title="currentCurrencyInfo.balance">
  150. {{ getBit(currentCurrencyInfo.balance) }}
  151. </a-tooltip>
  152. <img :class="{ 'icon-refresh-rotate': refreshRotate }"
  153. :src="require('@/assets/svg/icon-form-refresh.svg')"
  154. @click="updateCurrencyBanlce"/>
  155. </div>
  156. <div v-if="currentCurrencyInfo.currencyCode != 'USD'"
  157. class="top-up"
  158. @click="goTopUp">Deposit</div>
  159. </div>
  160. <div class="usd-min-message" v-show="isShowUsdMinMessage" v-html="selectModeInfo.type != PlayType.treasure ? checkUsdMinNumber('inTemplate') : checkTreasureAmountRange('inTemplate')"></div>
  161. </div>
  162. <!-- 人数 -->
  163. <div class="form-cell">
  164. <div class="cell-title">
  165. <img class="title-icon" :src="require('@/assets/svg/icon-form-winners.svg')" />
  166. {{selectModeInfo.type != PlayType.treasure ? 'Winners' : 'New Follower'}}
  167. </div>
  168. <div class="cell-content">
  169. <div>
  170. <form-input :suffix="selectModeInfo.type != PlayType.treasure ? 'People' : 'Follower'">
  171. <template v-slot:content>
  172. <input style="width: 120px"
  173. v-model="baseFormData.totalCount"
  174. placeholder="0"
  175. :disabled="baseFormData.rewardType === RewardType.custom"
  176. @input="onCountInput"
  177. @blur="onCountBlur"/>
  178. </template>
  179. </form-input>
  180. <div v-if="selectModeInfo.type == PlayType.treasure">
  181. <span>$0.02</span> Per New Follower
  182. </div>
  183. </div>
  184. <div class="count-msg" v-show="selectModeInfo.type == PlayType.common">Recommend Winners 50~500</div>
  185. </div>
  186. </div>
  187. <!-- 开奖时间 -->
  188. <div class="form-cell" v-if="selectModeInfo.type == PlayType.lottery">
  189. <div class="cell-title">
  190. <img class="title-icon" :src="require('@/assets/svg/icon-form-time.svg')" />
  191. Automatically Draw in
  192. </div>
  193. <div class="cell-content">
  194. <form-input suffix="Hour">
  195. <template v-slot:content>
  196. <input v-model="baseFormData.validityDuration"
  197. placeholder="0"
  198. @input="onValidityDurationInput"
  199. @blur="onValidityDurationBlur"/>
  200. </template>
  201. </form-input>
  202. </div>
  203. </div>
  204. <!-- 夺宝 follow -->
  205. <div class="form-cell" v-if="selectModeInfo.type == PlayType.treasure">
  206. <div class="cell-title">
  207. <img class="title-icon" :src="require('@/assets/svg/icon-form-follow.svg')" />
  208. Follow
  209. </div>
  210. <div class="cell-content">
  211. <follow-input style="padding: 0"
  212. padding="10px 12px"
  213. :isAddSelf="!isBack"
  214. :atUserList="atUserList"
  215. @addUser="addFollowUser"
  216. @setUser="setFollowUser"
  217. @delUser="delFollowUser"></follow-input>
  218. </div>
  219. </div>
  220. <!-- 任务 -->
  221. <div class="form-cell" v-if="selectModeInfo.type != PlayType.treasure">
  222. <div class="cell-title">
  223. <img class="title-icon" :src="require('@/assets/svg/icon-form-task.svg')"/>
  224. Tasks
  225. </div>
  226. <div class="form-cell-content form-require">
  227. <!-- 转推、like、关注 -->
  228. <div v-for="(item, index) in formList"
  229. :key="index">
  230. <div v-if="item.show" class="form-item"
  231. :class="{ 'border-hide': formList.length - 1 == index }">
  232. <div class="item-left">
  233. <div class="label">
  234. <img class="icon" :src="item.icon"/>
  235. {{ item.label }}
  236. </div>
  237. <div class="control"
  238. v-if="item.nodeType == 'textarea'">
  239. <follow-input
  240. padding="4px 12px"
  241. :isAddSelf="!isBack"
  242. :atUserList="atUserList"
  243. @addUser="addFollowUser"
  244. @setUser="setFollowUser"
  245. @delUser="delFollowUser"></follow-input>
  246. </div>
  247. <div class="control"
  248. v-if="item.nodeType == 'input'">
  249. <div v-if="showDiscordInvitePop"
  250. class="discord-invite-info"
  251. @click="showDiscordInvitePop = false">
  252. <img class="icon" :src="discordInviteInfo.icon || require('@/assets/svg/icon-discord-mini.svg')" />
  253. <span class="name">{{discordInviteInfo.name}}</span>
  254. </div>
  255. <input v-model="item.text"
  256. placeholder="Enter discord invite link"
  257. class="discord-address"
  258. @input="onIptDiscordAddress($event, index)"
  259. @blur="onBlurDiscordAddress($event, index)" />
  260. </div>
  261. </div>
  262. <div>
  263. <a-switch
  264. v-if="item.type > 3"
  265. v-model:checked="item.checked"
  266. @change="formSwitchChange($event, item, index)"/>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. </div>
  273. <!-- 提示 -->
  274. <ul class="tips-wrapper" v-if="selectModeInfo.type != PlayType.treasure">
  275. <li class="row" style="white-space:nowrap;">
  276. Rewards can only be claimed after the target user completes all tasks you set.
  277. </li>
  278. <li class="row">
  279. Each user can only receive a reward once per task.
  280. </li>
  281. <li class="row" v-show="selectModeInfo.type == PlayType.common">
  282. 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.
  283. </li>
  284. </ul>
  285. </div>
  286. </div>
  287. </div>
  288. <div class="form-right-sheet">
  289. <!-- 自定义封面事件 -->
  290. <div style="width: 375px;height: 500px; zoom: .74;margin-left: 80px">
  291. <custom-card-cover :data="{
  292. ...baseFormData,
  293. ...currentCurrencyInfo,
  294. usdEstimateOrderAmount: treasureFormData.usdEstimateOrderAmount,
  295. upGainAmountUsdValue: treasureFormData.upGainAmountUsdValue,
  296. currencyIconUrl: currentCurrencyInfo.iconPath,
  297. customPosterUrl: customPosterInfo && customPosterInfo.after && customPosterInfo.after.imagePath || '',
  298. userInfo: {
  299. nickName: userInfo.name,
  300. avatarUrl: userInfo.avatarUrl
  301. },
  302. }"></custom-card-cover>
  303. </div>
  304. <div class="custom-cover-btn"
  305. v-if="selectModeInfo.type != PlayType.treasure"
  306. @click="customCoverImg">
  307. <img :src="require('@/assets/svg/icon-custom-cover-btn.svg')" />
  308. Custom
  309. </div>
  310. </div>
  311. <div class="submit-btn-wrapper">
  312. <div class="submit-btn"
  313. :class="{ 'disabled-submit': iptErrMsgTxt != ''}"
  314. @click="confirm">
  315. <img class="icon-loading"
  316. v-if="submitIng"
  317. :src="require('@/assets/svg/icon-btn-loading.svg')"/>
  318. {{iptErrMsgTxt ? iptErrMsgTxt : 'NEXT'}}
  319. </div>
  320. </div>
  321. </div>
  322. <!-- 预览 -->
  323. <template v-else-if="showComType == 'preview'">
  324. <preview-sheet
  325. :baseFormData="{
  326. ...baseFormData,
  327. addFans: baseFormData.totalCount,
  328. }"
  329. :upGainAmountUsdValue="treasureFormData.upGainAmountUsdValue"
  330. :currentCurrencyInfo="currentCurrencyInfo"
  331. :tempCurrentCurrencyInfo="tempCurrentCurrencyInfo"
  332. :publishRes="publishRes"
  333. :previewFontSize="previewFontSize"
  334. :customPosterData="customPosterData"
  335. :finalAmountData="finalAmountData"
  336. @onTopUpDone="topUpDone"
  337. @onUpdateCurrencyBanlce="updateCurrencyBanlce"></preview-sheet>
  338. </template>
  339. <!-- 支付按钮 -->
  340. <div class="payment" v-show="showComType == 'preview'">
  341. <pay-button
  342. ref="payButtonDom"
  343. v-if="isMoneyRewardCpd"
  344. :finalAmountData="finalAmountData"
  345. :payConfig="{
  346. feeDesc: payConfig.feeDesc,
  347. amount: baseFormData.amountValue,
  348. postId
  349. }"
  350. :currentCurrencyInfo="currentCurrencyInfo"
  351. :USDepositStatus = "USDepositStatus"
  352. @showDepositMask="showDepositMessageBox = true"
  353. @payFinish="payFinish">
  354. <template v-slot:balance>
  355. <div class="balance" v-if="Number(baseFormData.amountValue) <= Number(currentCurrencyInfo.balance) || currentCurrencyInfo.currencyCode == 'USD' ">
  356. <img class="icon" src="@/assets/subject/icon-balance.png" />
  357. <div class="con">
  358. <div class="desc">Balance</div>
  359. <div class="price">
  360. <template v-if="currentCurrencyInfo.currencyCode == 'USD'">
  361. $
  362. </template>
  363. {{currentCurrencyInfo.balance}}
  364. <template v-if="currentCurrencyInfo.currencyCode != 'USD'">
  365. {{currentCurrencyInfo.tokenSymbol}}
  366. </template>
  367. </div>
  368. </div>
  369. <img class="refresh"
  370. :class="{ 'icon-refresh-rotate': refreshRotate }"
  371. :src=" require('@/assets/svg/icon-form-refresh.svg')"
  372. @click="updateCurrencyBanlce"/>
  373. </div>
  374. </template>
  375. </pay-button>
  376. <div v-else class="btn-wrap" @click="payStatusHandle(1)"><div class="custom-submit">Confirm</div></div>
  377. </div>
  378. </template>
  379. </div>
  380. </div>
  381. </div>
  382. </div>
  383. <!-- 提示 -->
  384. <message-box
  385. :dialogVisible="showMessageBox"
  386. :title="messageBoxData.title"
  387. :content="messageBoxData.content"
  388. cancelTxt="Not yet"
  389. confirmTxt="Deposit"
  390. @cancel="messageBoxCancel"
  391. @confirm="messageBoxConfirm"></message-box>
  392. <!-- 预览页充值 -->
  393. <message-box
  394. :dialogVisible="showDepositMessageBox"
  395. title="Is the Deposit Completed?"
  396. @cancel="depositAchCancel"
  397. @confirm="depositAchConfirm"></message-box>
  398. <!-- 裁剪 -->
  399. <div class="dialog" v-if="cropperDialog">
  400. <div class="corp-title">
  401. <img class="back" :src="require('@/assets/svg/icon-back.svg')" @click="hiddenDialog" />
  402. <span>Crop</span>
  403. </div>
  404. <div class="corp-content">
  405. <vue-cropper
  406. ref="refCropper"
  407. :img="cropperOption.img"
  408. :output-type="cropperOption.outputType"
  409. :infoTrue="cropperOption.infoTrue"
  410. :full="cropperOption.full"
  411. :fixed="cropperOption.fixed"
  412. :fixed-number="cropperOption.fixedNumber"
  413. :auto-crop="cropperOption.autoCrop"
  414. :auto-crop-width="cropperOption.autoCropWidth"
  415. :auto-crop-height="cropperOption.autoCropHeight"
  416. :center-box="cropperOption.centerBox"
  417. :high="cropperOption.high"
  418. :max-img-size="cropperOption.max">
  419. </vue-cropper>
  420. </div>
  421. <div class="corp-footer">
  422. <button v-if="cropperLoading" class="confirm disable">
  423. <img :src=" require('@/assets/svg/icon-btn-loading.svg') " />
  424. <span>Confirm</span>
  425. </button>
  426. <button v-else class="confirm" @click="confirmImage">Confirm</button>
  427. </div>
  428. </div>
  429. <div class="dialog-mask" v-if="cropperDialog"></div>
  430. </div>
  431. </template>
  432. <script setup>
  433. import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, provide, computed } from "vue";
  434. import { postPublish, syncChainTokenRechargeRecord, getCurrencyInfoByCode, getUser } from "@/http/publishApi";
  435. import { getInviteGuildInfo, getInviteGuildInfoByOpenApi, saveInviteGuildInfo } from "@/http/discordApi";
  436. import { payCalcFee, getPayConfig } from "@/http/pay";
  437. import { upGainCalculate } from "@/http/treasureApi";
  438. import { getFrontConfig, calcRechargePayAmount } from "@/http/account";
  439. import { uploadSignature, uploadFile } from '@/http/media';
  440. import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
  441. import { debounce, getBit } from "@/uilts/help"
  442. import { PlayType, RewardType, TaskType } from '@/types';
  443. import Report from "@/log-center/log"
  444. import { ElMessage, ElLoading } from "element-plus";
  445. import "element-plus/es/components/message/style/css";
  446. import "element-plus/es/components/loading/style/css";
  447. import 'vue-cropper/dist/index.css'
  448. import { VueCropper } from "vue-cropper";
  449. import {create, all} from "mathjs";
  450. import { message } from 'ant-design-vue';
  451. import messageBox from "@/view/components/message-box.vue";
  452. import currencyList from "@/view/components/currency-list.vue";
  453. import currencySelect from "@/view/components/currency-select.vue";
  454. import followInput from "@/view/iframe/publish/components/follow-input";
  455. import payButton from "@/view/iframe/publish/components/pay-button";
  456. import topUp from "@/view/iframe/publish/components/top-up.vue";
  457. import toolBox from '@/view/iframe/publish/tool-box/index.vue'
  458. import giveawayPoster from '@/view/iframe/publish/components/giveaway-poster.vue';
  459. import giveDialogHead from "@/view/iframe/publish/components/give-dialog-head";
  460. import previewSheet from "@/view/iframe/publish/components/preview-sheet.vue";
  461. import formInput from "@/view/iframe/publish/components/form-input.vue";
  462. import GlobalTip from '@/view/components/global-tip.vue'
  463. import customCardCover from '@/view/components/custom-card-cover.vue'
  464. import CustomizedRewardEditPopup from '@/view/iframe/publish/components/customized-reward-edit';
  465. import ComponentZoom from '@/view/components/component-zoom.vue'
  466. const config = {
  467. number: 'BigNumber',
  468. }
  469. const math = create(all, config);
  470. //临时货币信息
  471. let tempCurrentCurrencyInfo = ref({});
  472. let tempCurrentCurrencyList = ref([]);
  473. let payConfig = ref({});
  474. let timer = ref(null);
  475. // 发布后返回的结果
  476. let publishRes = reactive({});
  477. //弹窗是否展示
  478. let visible = ref(false);
  479. let publishType = ref('REDPACKET');
  480. let userInfo = ref({})
  481. //弹窗高度
  482. let dialogStyle = reactive({
  483. dialogHeight: 670,
  484. dialogContentWidth: 1100
  485. })
  486. let USDepositStatus = ref('DEFAULT');
  487. let cropperOption = ref({
  488. img: '',
  489. full: true,
  490. infoTrue: true,
  491. fixed: true,
  492. fixedNumber: [16, 8.396],
  493. outputType: 'png',
  494. autoCrop: true,
  495. autoCropWidth: 99999,
  496. autoCropHeight: 99999,
  497. centerBox: true,
  498. high: true,
  499. max: 99999,
  500. })
  501. let cropperDialog = ref(false)
  502. let cropperLoading = ref(false)
  503. let cropperType = ref('before')
  504. let customPosterInfo = ref({})
  505. let customPosterData = ref({})
  506. let customShowNewImage = ref(false)
  507. let refCropper = ref('')
  508. // 当前展示组件内容 default(表单) preview(预览) topUp(充值)
  509. let showComType = ref("default");
  510. let currentComData = {
  511. default: {
  512. title: "Giveaway",
  513. },
  514. preview: {
  515. title: "Giveaway",
  516. },
  517. topUp: {
  518. title: "Deposit",
  519. },
  520. poster: {
  521. title: "Giveaway Poster",
  522. }
  523. };
  524. // 机器人开关
  525. let openAntiBot = ref(false);
  526. // 是否正在提交
  527. let submitIng = ref(false);
  528. // 艾特关注人列表
  529. let atUserList = ref([]);
  530. // 表单错误提示
  531. let iptErrMsgTxt = ref("Select a reward");
  532. // usd最小金额限制提示展示
  533. let isShowUsdMinMessage = ref(false);
  534. // 是否返回
  535. let isBack = ref(false);
  536. // 展示消息提示
  537. let showMessageBox = ref(false);
  538. let showDepositMessageBox = ref(false);
  539. // 展示货币列表pop
  540. let showCurrencyPop = ref(false);
  541. let showCurrencySelect = ref(false);
  542. // 货币列表的dom
  543. let currencyListDom = ref(null);
  544. let payButtonDom = ref(null);
  545. // 刷新按钮旋转
  546. let refreshRotate = ref(false);
  547. // 预览字体大小
  548. let previewFontSize = ref(56);
  549. let postId = ref('');
  550. let showGeneralLottery = ref(false);
  551. let selectModeInfo = reactive({
  552. index: 0,
  553. type: PlayType.treasure
  554. })
  555. // 余额是否同步中
  556. let asyncIng = ref(false);
  557. let messageBoxData = ref({
  558. title: "",
  559. content: "",
  560. });
  561. // 真实支付金额数据
  562. let finalAmountData = ref({
  563. currencyCode: '',
  564. feeAmountValue: 0,
  565. finalAmountValue: 0,
  566. requestAmountValue: 0,
  567. });
  568. // 表单数据
  569. let baseFormData = reactive({
  570. amountCurrencyCode: "",
  571. amountValue: "",
  572. totalCount: "",
  573. validityDuration: "",
  574. type: selectModeInfo.type,
  575. rewardType: RewardType.money,
  576. customizedReward: "",
  577. });
  578. const defaultCurrentCurrencyInfo = {
  579. currencyCode: "",
  580. currencyName: "",
  581. balance: "",
  582. currencyType: "",
  583. iconPath: "",
  584. minAmount: "",
  585. tokenChain: "",
  586. tokenSymbol: "",
  587. usdEstimateBalance: ""
  588. }
  589. // 当前选择的货币信息
  590. let currentCurrencyInfo = ref(defaultCurrentCurrencyInfo);
  591. const discordIptErrTxt = 'Discord invite link is wrong';
  592. const discordIptEmptyErrTxt = 'Enter discord invite link';
  593. const discordIptNerverExpiresErrTxt = 'Make sure the Discord link never expires'
  594. const requireFollowTxt = '添加 follow 任务'
  595. let iptErrType = ''; //discord
  596. let formList = reactive([
  597. {
  598. label: "Follow",
  599. icon: require("@/assets/svg/icon-task-twitter.svg"),
  600. nodeType: "textarea",
  601. type: TaskType.twitterFollow,
  602. text: [],
  603. checked: true,
  604. show: true
  605. },
  606. {
  607. label: "Retweet & Like",
  608. icon: require("@/assets/svg/icon-task-twitter.svg"),
  609. nodeType: "div",
  610. type: TaskType.twitterRetweet,
  611. checked: true,
  612. show: true
  613. },
  614. {
  615. label: "Like Tweet",
  616. icon: require("@/assets/svg/icon-task-twitter.svg"),
  617. nodeType: "div",
  618. type: TaskType.twitterLikeTweet,
  619. checked: true,
  620. show: false
  621. },
  622. {
  623. label: "Comment and Tag 3 friends",
  624. icon: require("@/assets/svg/icon-task-twitter.svg"),
  625. nodeType: "div",
  626. type: TaskType.twitterCommentAndTag,
  627. checked: true,
  628. show: true
  629. },
  630. {
  631. label: "Repost to Facebook",
  632. icon: require("@/assets/svg/icon-task-facebook.svg"),
  633. nodeType: "div",
  634. text: '',
  635. type: TaskType.repostToFacebook,
  636. checked: false,
  637. show: true
  638. },
  639. {
  640. label: "Join Discord",
  641. icon: require("@/assets/svg/icon-discord-mini.svg"),
  642. nodeType: "input",
  643. text: '',
  644. type: TaskType.joinDiscord,
  645. checked: false,
  646. show: true
  647. },
  648. ]);
  649. let publishModeList = reactive([
  650. {
  651. imgActive: require("@/assets/svg/img-T1.svg"),
  652. imgInActive: require("@/assets/svg/img-T0.svg"),
  653. imgInfoSrc: require("@/assets/svg/img-P1.svg"),
  654. type: PlayType.treasure
  655. },
  656. {
  657. imgActive: require("@/assets/svg/img-LT1.svg"),
  658. imgInActive: require("@/assets/svg/img-LT0.svg"),
  659. imgInfoSrc: require("@/assets/svg/img-P2.svg"),
  660. type: PlayType.lottery
  661. },
  662. {
  663. imgActive: require("@/assets/svg/img-A1.svg"),
  664. imgInActive: require("@/assets/svg/img-A0.svg"),
  665. imgInfoSrc: require("@/assets/svg/img-P3.svg"),
  666. type: PlayType.common
  667. }
  668. ])
  669. let discordInviteInfo = ref({});
  670. let showDiscordInvitePop = ref(false);
  671. let showCustomizedRewardEditPopup = ref(false);
  672. let lotteryMaxHourDuration = 168;
  673. let leftTabList = reactive([
  674. {
  675. icon: require('@/assets/svg/icon-gift-pack.svg'),
  676. type: 'REDPACKET'
  677. },
  678. {
  679. icon: require('@/assets/svg/icon-tool-box-02.svg'),
  680. type: 'TOOL_BOX'
  681. }
  682. ])
  683. let toolBoxPageData = reactive({
  684. activePage: 'EDITOR', //EDITOR PREVIEW
  685. postEditorLinkInputDescImage: '',
  686. postEditorDefaultLinkTitle: ''
  687. })
  688. let treasureFormData = reactive({
  689. usdEstimateOrderAmount: '',
  690. fansUnitAmount: '',
  691. upGainAmountUsdValue: 0,
  692. })
  693. const props = defineProps({
  694. dialogData: {
  695. type: Object,
  696. default: () => {
  697. return {
  698. visible: false,
  699. type: 'REDPACKET'
  700. }
  701. },
  702. },
  703. });
  704. //selected prize icon cpd
  705. let currentIconCpd = computed(() => {
  706. if(baseFormData.rewardType === RewardType.custom) {
  707. return require("@/assets/svg/icon-gift.svg");
  708. } else {
  709. return currentCurrencyInfo.value.iconPath;
  710. }
  711. })
  712. // selected prize cpd
  713. let currentPrizeCpd = computed(() => {
  714. const {currencyCode, tokenSymbol} = currentCurrencyInfo.value
  715. if(baseFormData.rewardType === RewardType.custom) {
  716. return baseFormData.customizedReward;
  717. } else if(currencyCode == "USD") {
  718. return "USD";
  719. } else {
  720. return tokenSymbol || "Select a reward";
  721. }
  722. })
  723. let currencySelectCpd = computed(() => {
  724. return baseFormData.customizedReward || currentCurrencyInfo.value.currencyCode;
  725. })
  726. let currentArrowCpd = computed(() => {
  727. if(baseFormData.rewardType === RewardType.custom) {
  728. return require("@/assets/svg/icon-cell-arrow-right.svg");
  729. } else {
  730. return currentCurrencyInfo.value.currencyCode ? require("@/assets/svg/icon-form-arrow-down.svg") : require("@/assets/svg/icon-form-white-arrow-down.svg");
  731. }
  732. })
  733. let isMoneyRewardCpd =computed(() => baseFormData.rewardType === RewardType.money);
  734. watch(
  735. () => props.dialogData,
  736. (newVal) => {
  737. visible.value = newVal.visible;
  738. USDepositStatus.value = "DEFAULT"
  739. if (newVal.visible) {
  740. publishType.value = newVal.type;
  741. Report.reportLog({
  742. pageSource: Report.pageSource.publisherDialog,
  743. businessType: Report.businessType.pageView,
  744. });
  745. getLocalCurrencyInfoByCode();
  746. setTimeout(() => {
  747. setDialogStyle();
  748. }, 300);
  749. // 更新余额
  750. clearInterval(timer.value);
  751. timer.value = setInterval(() => {
  752. getCurrencyInfo({loop: true});
  753. }, 10000)
  754. } else {
  755. clearInterval(timer.value);
  756. }
  757. },
  758. {
  759. deep: true
  760. }
  761. );
  762. const emits = defineEmits(["close", "confirm", "postPublishFinish"]);
  763. const close = () => {
  764. USDepositStatus.value = "DEFAULT"
  765. if(publishType.value == 'TOOL_BOX') {
  766. closeToolBoxPage()
  767. } else {
  768. if (showComType.value != "default") {
  769. showComType.value = "default";
  770. isBack.value = true;
  771. } else {
  772. initParams();
  773. closeDialog();
  774. }
  775. }
  776. };
  777. const closeToolBoxPage = () => {
  778. if(toolBoxPageData.activePage == "EDITOR") {
  779. closeDialog();
  780. } else if(toolBoxPageData.activePage == "PREVIEW") {
  781. toolBoxPageData.activePage = "EDITOR";
  782. }
  783. };
  784. const closeDialog = () => {
  785. visible.value = false;
  786. emits("close", false);
  787. }
  788. /**
  789. * 设置弹窗高度
  790. */
  791. const setDialogStyle = (resize = false) => {
  792. nextTick(() => {
  793. let clientHeight = window.innerHeight;
  794. let clientWidth = window.innerWidth;
  795. let gapSafe = 40;
  796. if (dialogStyle.dialogHeight > clientHeight - gapSafe) {
  797. dialogStyle.dialogHeight = clientHeight - gapSafe;
  798. } else {
  799. if(resize) {
  800. dialogStyle.dialogHeight = 720;
  801. }
  802. }
  803. if(dialogStyle.dialogContentWidth > clientWidth - gapSafe) {
  804. dialogStyle.dialogContentWidth = clientWidth - gapSafe;
  805. } else {
  806. if(resize) {
  807. dialogStyle.dialogContentWidth = 1080;
  808. }
  809. }
  810. })
  811. };
  812. const selectCurrencyPopHandle = () => {
  813. Report.reportLog({
  814. pageSource: Report.pageSource.currencySelectorPage,
  815. businessType: Report.businessType.pageView,
  816. });
  817. if(baseFormData.rewardType === RewardType.custom) {
  818. showCustomizedRewardEditPopup.value = true
  819. } else {
  820. showCurrencyPop.value = true;
  821. nextTick(() => {
  822. if(currencyListDom.value) {
  823. currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList({pageNum: 1});
  824. }
  825. })
  826. }
  827. }
  828. const saveDiscordGuildInfo = () => {
  829. let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
  830. //保存服务器信息
  831. Report.reportLog({
  832. pageSource: Report.pageSource.publisherDialog,
  833. businessType: Report.businessType.buttonClick,
  834. objectType: Report.objectType.saveDiscordGuildData
  835. }, {
  836. reportData: discordInviteInfo.value
  837. });
  838. if(guildId && inviteCode && inviteUrl) {
  839. saveInviteGuildInfo({
  840. params: {
  841. guildId,
  842. inviteCode,
  843. inviteUrl
  844. }
  845. })
  846. }
  847. }
  848. const confirm = () => {
  849. if (submitIng.value || iptErrMsgTxt.value) {
  850. return;
  851. }
  852. let { totalCount = 0 } = baseFormData;
  853. if(selectModeInfo.type != PlayType.treasure) {
  854. if (!totalCount) {
  855. return;
  856. }
  857. saveDiscordGuildInfo();
  858. }
  859. submitRequest();
  860. };
  861. /**
  862. * 货币列表-选中货币
  863. */
  864. const selectCurrency = (params) => {
  865. let { currencies } = params;
  866. tempCurrentCurrencyList.value = currencies;
  867. if (currencies.length > 1) {
  868. showCurrencyPop.value = false;
  869. showCurrencySelect.value = true;
  870. } else {
  871. selectCurrencyAfter(currencies[0])
  872. }
  873. };
  874. const selectCurrencyAfter = (params, openWindow = true) => {
  875. tempCurrentCurrencyInfo.value = params;
  876. showCurrencySelect.value = false;
  877. currentCurrencyInfo.value = params;
  878. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  879. if (openWindow === false) {
  880. return
  881. };
  882. if (params.currencyCode != "USD" && params.balance < params.minAmount) {
  883. let tokenSymbol = params.currencyCode == 'USD' ? 'USD' : params.tokenSymbol;
  884. messageBoxBlock({
  885. title: `Whether to deposit ${tokenSymbol}`,
  886. content: `Insufficient ${tokenSymbol} balance`,
  887. });
  888. } else {
  889. setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
  890. showCurrencyPop.value = false;
  891. finalAmountData.value.currencyCode = currentCurrencyInfo.value.currencyCode;
  892. resetFormIpt(false);
  893. onIptSetErrorTxt();
  894. }
  895. baseFormData.customizedReward = "";
  896. baseFormData.rewardType = RewardType.money;
  897. }
  898. const resetFormIpt = (clearMode = true) => {
  899. baseFormData.amountValue = "";
  900. baseFormData.totalCount = "";
  901. baseFormData.validityDuration = "";
  902. baseFormData.rewardType = RewardType.money;
  903. baseFormData.customizedReward = "";
  904. treasureFormData.usdEstimateOrderAmount = "";
  905. if(clearMode) {
  906. selectModeInfo.index = 0;
  907. selectModeInfo.type = publishModeList[selectModeInfo.index]['type'];
  908. baseFormData.type = selectModeInfo.type;
  909. }
  910. }
  911. const setLocalSelectCurrencyInfo = (params = {}) => {
  912. setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})
  913. }
  914. const setCurrentCurrencyListInfo = (params = {}) => {
  915. setChromeStorage({ selectCurrencyList : JSON.stringify(params)})
  916. }
  917. /**
  918. * 获取完货币列表
  919. */
  920. const setCurrentCurrencyInfo = (params) => {
  921. }
  922. const messageBoxBlock = ({ title = "", content = "" }) => {
  923. showMessageBox.value = true;
  924. messageBoxData.value.title = title;
  925. messageBoxData.value.content = content;
  926. };
  927. /**
  928. * 确定
  929. */
  930. const messageBoxConfirm = () => {
  931. showMessageBox.value = false;
  932. goTopUp();
  933. };
  934. /**
  935. * 取消
  936. */
  937. const messageBoxCancel = () => {
  938. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  939. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  940. setCurrentCurrencyListInfo(tempCurrentCurrencyList.value);
  941. showMessageBox.value = false;
  942. showCurrencyPop.value = false;
  943. showCurrencySelect.value = false;
  944. resetFormIpt(false);
  945. onIptSetErrorTxt();
  946. };
  947. /**
  948. * 去充值
  949. */
  950. const goTopUp = () => {
  951. Report.reportLog({
  952. pageSource: Report.pageSource.rechargePage,
  953. businessType: Report.businessType.pageView,
  954. });
  955. showComType.value = 'topUp';
  956. }
  957. /*
  958. * 自定义封面
  959. */
  960. const customCoverImg = () => {
  961. customPosterInfo.value = {}
  962. if (Object.keys(customPosterData.value).length > 0) {
  963. customPosterInfo.value = customPosterData.value;
  964. }
  965. showComType.value = 'poster';
  966. customShowNewImage.value = false;
  967. setChromeStorage({ custom_poster_guide: Date.now() });
  968. }
  969. /**
  970. * 充值done事件
  971. */
  972. const topUpDone = () => {
  973. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  974. showCurrencyPop.value = false;
  975. showCurrencySelect.value = false;
  976. showComType.value = 'default';
  977. onIptSetErrorTxt();
  978. asyncTokenRechRecord((res) => {
  979. if(res.code == 0 && res.data && res.data.length) {
  980. let currencyInfo = res.data[0];
  981. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  982. currentCurrencyInfo.value.balance = currencyInfo.balance;
  983. onIptSetErrorTxt()
  984. }
  985. }
  986. })
  987. }
  988. /**
  989. * 更新货币余额
  990. */
  991. const updateCurrencyBanlce = async () => {
  992. if(!refreshRotate.value) {
  993. refreshRotate.value = true;
  994. setTimeout(() => {
  995. refreshRotate.value = false;
  996. }, 1000)
  997. }
  998. if(currentCurrencyInfo.value.currencyCode == 'USD') {
  999. let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
  1000. calcRechPayAmount({
  1001. currencyCode: currentCurrencyInfo.value.currencyCode,
  1002. orderAmountValue: baseFormData.amountValue,
  1003. payChannel: 'ach'
  1004. });
  1005. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  1006. currentCurrencyInfo.value = currencyInfoRes.data;
  1007. }
  1008. } else {
  1009. asyncTokenRechRecord((res) => {
  1010. if(res.code == 0 && res.data && res.data.length) {
  1011. let currencyInfo = res.data[0];
  1012. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  1013. currentCurrencyInfo.value.balance = currencyInfo.balance;
  1014. }
  1015. }
  1016. })
  1017. }
  1018. }
  1019. /**
  1020. * 同步链上交易
  1021. */
  1022. const asyncTokenRechRecord = (cb) => {
  1023. if(asyncIng.value) {
  1024. return;
  1025. }
  1026. asyncIng.value = true;
  1027. syncChainTokenRechargeRecord({
  1028. params: {
  1029. currencyCode: currentCurrencyInfo.value.currencyCode
  1030. }
  1031. }).then(res => {
  1032. asyncIng.value = false;
  1033. cb && cb(res)
  1034. }).catch((err) => {
  1035. asyncIng.value = false;
  1036. })
  1037. }
  1038. /**
  1039. * 提交表单请求
  1040. */
  1041. const submitRequest = async () => {
  1042. let {
  1043. amountValue = 0,
  1044. totalCount = 0,
  1045. rewardType = RewardType.money,
  1046. customizedReward = ""
  1047. } = baseFormData;
  1048. baseFormData.amountCurrencyCode = currentCurrencyInfo.value.currencyCode;
  1049. // 组装提交参数
  1050. let finishConditions = selectModeInfo.type != PlayType.treasure ? getFinishCondition() : getTreasureFinishCondition();
  1051. let receiveConditions = openAntiBot.value ? "" : [];
  1052. let validityDuration = '';
  1053. if(baseFormData.type == PlayType.lottery) {
  1054. //小时转毫秒
  1055. let unit = process.env.NODE_ENV != 'production' ? 60 * 1000 : 60 * 60 * 1000;
  1056. validityDuration = baseFormData.validityDuration * unit;
  1057. } else {
  1058. validityDuration = '';
  1059. }
  1060. // 提交参数
  1061. let formData = {
  1062. amountValue,
  1063. totalCount,
  1064. finishConditions,
  1065. receiveConditions,
  1066. type: baseFormData.type,
  1067. posterType: 1,
  1068. validityDuration,
  1069. rewardType,
  1070. };
  1071. if(rewardType === RewardType.custom) {
  1072. // 通用奖品 类型的活动,添加奖品名称
  1073. formData.customizedReward = customizedReward;
  1074. delete formData.amountValue;
  1075. } else {
  1076. // 货币类型 添加货币code
  1077. formData.amountCurrencyCode = baseFormData.amountCurrencyCode;
  1078. formData.payAmountValue = baseFormData.payAmountValue;
  1079. }
  1080. submitIng.value = true;
  1081. // 自定义封面
  1082. if (Object.keys(customPosterData.value).length > 0) {
  1083. formData['posterType'] = 2;
  1084. if (customPosterData.value && customPosterData.value.after) {
  1085. formData['customPosterInstalled'] = customPosterData.value.after.objectKey || ''
  1086. }
  1087. if (customPosterData.value && customPosterData.value.before) {
  1088. formData['customPosterUninstalled'] = customPosterData.value.before.objectKey || ''
  1089. }
  1090. }
  1091. // 法币支付需要计算费率
  1092. if(formData.amountCurrencyCode == "USD") {
  1093. // 获取充值金额
  1094. await calcRechPayAmount({
  1095. currencyCode: currentCurrencyInfo.value.currencyCode,
  1096. orderAmountValue: baseFormData.amountValue,
  1097. payChannel: 'ach'
  1098. });
  1099. }
  1100. let data = {
  1101. params: {
  1102. postBizData: JSON.stringify(formData),
  1103. postSrc: 1, //1 twitter
  1104. postType: 1, //1 红包
  1105. },
  1106. };
  1107. postPublish(data).then((res) => {
  1108. submitIng.value = false;
  1109. if (res.code == 0) {
  1110. publishRes = res.data;
  1111. postId.value = res.data.postId;
  1112. Report.reportLog({
  1113. pageSource: Report.pageSource.previewPage,
  1114. businessType: Report.businessType.pageView,
  1115. });
  1116. showComType.value = "preview";
  1117. previewFontSize.value = calcFontSize(baseFormData.amountValue, 238, 56);
  1118. isBack.value = false;
  1119. } else {
  1120. console.log(res);
  1121. }
  1122. })
  1123. .catch((err) => {
  1124. console.log(err);
  1125. });
  1126. };
  1127. const getFinishCondition = () => {
  1128. let finishConditions = [];
  1129. for (let i = 0; i < formList.length; i++) {
  1130. let item = {};
  1131. item.type = formList[i]["type"];
  1132. if (item.type == TaskType.twitterFollow && atUserList.value.length) {
  1133. // follow 参数
  1134. let relatedUsers = atUserList.value.filter(item => item.name);
  1135. item.relatedUsers = relatedUsers;
  1136. finishConditions.push(item);
  1137. } else if (formList[i]["type"] == TaskType.joinDiscord) {
  1138. // join discord
  1139. if(formList[i]["checked"] && formList[i]["text"]) {
  1140. item.bizData = JSON.stringify({inviteUrl: formList[i]["text"]});
  1141. finishConditions.push(item);
  1142. }
  1143. } else if (formList[i]["checked"]) {
  1144. // 其余任务
  1145. finishConditions.push(item);
  1146. }
  1147. }
  1148. return finishConditions;
  1149. }
  1150. const getTreasureFinishCondition = () => {
  1151. let finishConditions = [
  1152. {
  1153. type: TaskType.twitterLikeTweet
  1154. },
  1155. {
  1156. type: TaskType.twitterRePost
  1157. }
  1158. ];
  1159. if(atUserList.value.length) {
  1160. let relatedUsers = atUserList.value.filter(item => item.name);
  1161. finishConditions.push({
  1162. relatedUsers,
  1163. type: TaskType.twitterFollow
  1164. });
  1165. }
  1166. return finishConditions;
  1167. };
  1168. const calcFontSize = (str, domWidth, maxSize) => {
  1169. let lenstr = str.length;
  1170. let num = parseInt(domWidth / lenstr);
  1171. let fontSize = num < maxSize ? num : maxSize
  1172. return fontSize;
  1173. }
  1174. /**
  1175. * 初始化提交参数
  1176. */
  1177. const initParams = () => {
  1178. resetFormIpt();
  1179. // clear follow value
  1180. atUserList.value = [];
  1181. submitIng.value = false;
  1182. isBack.value = false;
  1183. showCurrencyPop.value = false;
  1184. showCurrencySelect.value = false;
  1185. openAntiBot.value = false;
  1186. tempCurrentCurrencyInfo.value = {};
  1187. currentCurrencyInfo.value = {};
  1188. publishType.value = 'REDPACKET';
  1189. // clear discord value
  1190. setDiscordIptTxt({text: ''});
  1191. discordInviteInfo.value = {};
  1192. customPosterInfo.value = {};
  1193. customPosterData.value = {};
  1194. };
  1195. const setDiscordIptTxt = ({text}) => {
  1196. const index = formList.findIndex(item => item.type == TaskType.joinDiscord);
  1197. formList[index]['text'] = text;
  1198. }
  1199. const calcRechPayAmount = async (params) => {
  1200. let res = await calcRechargePayAmount({
  1201. params : params
  1202. })
  1203. if (res.code == 0) {
  1204. let { feeDesc } = res.data;
  1205. payConfig.value.feeDesc = feeDesc;
  1206. finalAmountData.value = res.data;
  1207. }
  1208. return res.data;
  1209. }
  1210. /**
  1211. * 支付完成回调
  1212. */
  1213. const payFinish = (params) => {
  1214. let {payStatus} = params;
  1215. // 余额支付
  1216. payStatusHandle(payStatus);
  1217. };
  1218. const payStatusHandle = (payStatus) => {
  1219. //支付状态 0:未支付,1:支付成功,2:支付失败,3:已关闭,4:已退款
  1220. switch (payStatus) {
  1221. case 1:
  1222. emits("postPublishFinish", { publishRes });
  1223. showComType.value = "default";
  1224. initParams();
  1225. break;
  1226. case 2:
  1227. break;
  1228. case 3:
  1229. break;
  1230. case 4:
  1231. break;
  1232. }
  1233. }
  1234. /**
  1235. * follow组件触发新增关注人
  1236. */
  1237. const addFollowUser = (params) => {
  1238. atUserList.value.push(params);
  1239. };
  1240. const setFollowUser = (params) => {
  1241. atUserList.value[params.index]["name"] = params.name;
  1242. let userList = atUserList.value.filter(item => item.name);
  1243. if(selectModeInfo.type == PlayType.treasure) {
  1244. if(!userList.length) {
  1245. if(!iptErrMsgTxt.value) {
  1246. iptErrMsgTxt.value = requireFollowTxt;
  1247. }
  1248. } else {
  1249. if (iptErrMsgTxt.value == requireFollowTxt) {
  1250. iptErrMsgTxt.value = ""
  1251. }
  1252. }
  1253. }
  1254. };
  1255. const delFollowUser = (params) => {
  1256. atUserList.value.splice(params.index, 1);
  1257. let userList = atUserList.value.filter(item => item.name);
  1258. if(selectModeInfo.type == PlayType.treasure) {
  1259. if(!userList.length) {
  1260. if(!iptErrMsgTxt.value) {
  1261. iptErrMsgTxt.value = requireFollowTxt;
  1262. }
  1263. } else {
  1264. if (iptErrMsgTxt.value == requireFollowTxt) {
  1265. iptErrMsgTxt.value = ""
  1266. }
  1267. }
  1268. }
  1269. };
  1270. const calcUsdEstimate = (params) => {
  1271. if(!currentCurrencyInfo.value.currencyCode) {
  1272. return;
  1273. }
  1274. let {type} = params;
  1275. let calcData = {amount: 0, usdPrice: currentCurrencyInfo.value.usdPrice};
  1276. switch (type) {
  1277. case 'ORDER_AMOUNT':
  1278. calcData.amount = baseFormData.amountValue;
  1279. treasureFormData.usdEstimateOrderAmount = calcToken2UsdEstimate(calcData);
  1280. break;
  1281. }
  1282. }
  1283. const calcTokenEstimate = (params) => {
  1284. if(!currentCurrencyInfo.value.currencyCode) {
  1285. return;
  1286. }
  1287. let {type} = params;
  1288. let calcData = {amount: 0, usdPrice: currentCurrencyInfo.value.usdPrice};
  1289. switch (type) {
  1290. case 'ORDER_AMOUNT':
  1291. calcData.amount = treasureFormData.usdEstimateOrderAmount;
  1292. baseFormData.amountValue = calcUsd2TokenEstimate(calcData);
  1293. break;
  1294. }
  1295. }
  1296. /**
  1297. * token 转 USD 估值
  1298. */
  1299. const calcToken2UsdEstimate = (params) => {
  1300. if(!params.amount) {
  1301. return '';
  1302. }
  1303. let val = +math.format(math.evaluate(`${params.amount} * ${params.usdPrice}`));
  1304. return Math.floor(val * 100) / 100;
  1305. };
  1306. /**
  1307. * USD 转 token 估值
  1308. */
  1309. const calcUsd2TokenEstimate = (params) => {
  1310. if(!params.amount) {
  1311. return '';
  1312. }
  1313. let val = +math.format(math.evaluate(`${params.amount} / ${params.usdPrice}`)) ;
  1314. return val;
  1315. };
  1316. /**
  1317. * 计算粉丝单价
  1318. */
  1319. const calcFansUnitAmount = () => {
  1320. if(!baseFormData.totalCount || !baseFormData.amountValue) {
  1321. return;
  1322. }
  1323. let unitAmount = baseFormData.amountValue / baseFormData.totalCount;
  1324. if(currentCurrencyInfo.value.currencyCode != 'USD') {
  1325. unitAmount = calcToken2UsdEstimate({amount: unitAmount, usdPrice: currentCurrencyInfo.value.usdPrice });
  1326. }
  1327. return unitAmount;
  1328. };
  1329. const setUpGainAmountUsdValue = (params) => {
  1330. const { usdPrice, currencyCode } = currentCurrencyInfo.value;
  1331. let {totalAmount, unitPrice} = params;
  1332. if(!currencyCode) return;
  1333. upGainCalculate({
  1334. params: {
  1335. amountValue: totalAmount,
  1336. currencyUsdPrice: usdPrice,
  1337. fansUnitAmountValue: unitPrice
  1338. }
  1339. }).then(res => {
  1340. if(res.code == 0 && res.data) {
  1341. treasureFormData.upGainAmountUsdValue = res.data.upGainAmountUsdValue
  1342. }
  1343. })
  1344. }
  1345. /**
  1346. * 奖励总金额 美元估值
  1347. */
  1348. const onUsdEstimateOrderAmountInput = () => {
  1349. let val = treasureFormData.usdEstimateOrderAmount;
  1350. val = String(val).replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1');
  1351. if(val == '00') {
  1352. val = '0'
  1353. }
  1354. treasureFormData.usdEstimateOrderAmount = val;
  1355. calcTokenEstimate({type: 'ORDER_AMOUNT'});
  1356. onIptSetErrorTxt();
  1357. if(selectModeInfo.type == PlayType.treasure) {
  1358. treasureFormData.fansUnitAmount = calcFansUnitAmount();
  1359. }
  1360. return val;
  1361. };
  1362. const onAmountInput = () => {
  1363. let val = baseFormData.amountValue;
  1364. // val = val.replace(/[^\d^\.]+/g, "");
  1365. val = String(val).replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  1366. const maxCount = baseFormData.rewardType === RewardType.money ? Number.MAX_SAFE_INTEGER : 100000000;
  1367. if(val == '00') {
  1368. val = '0'
  1369. }
  1370. if(val.indexOf('.') > -1){ //校验 例:00.12 => 0.12
  1371. let arr = val.split('.');
  1372. if(arr[0].startsWith('0')) {
  1373. let num = +arr[0];
  1374. val = num + '.' + arr[1];
  1375. }
  1376. }
  1377. if (baseFormData.rewardType === RewardType.custom) {
  1378. val = val.replace(/^(0)*/, '').replace(/\./, ''); // 通用奖品类型 过滤掉起始位的0和小数点符号
  1379. if (val > maxCount) {
  1380. val = maxCount
  1381. }
  1382. baseFormData.totalCount = val;
  1383. }
  1384. baseFormData.amountValue = val;
  1385. calcUsdEstimate({type: 'ORDER_AMOUNT'});
  1386. if(selectModeInfo.type == PlayType.treasure) {
  1387. treasureFormData.fansUnitAmount = calcFansUnitAmount();
  1388. }
  1389. onIptSetErrorTxt();
  1390. return val;
  1391. };
  1392. const onCountInput = () => {
  1393. let val = baseFormData.totalCount;
  1394. const maxCount = 100000000;
  1395. if (val == 0) {
  1396. val = "";
  1397. }
  1398. val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  1399. if(val > maxCount) {
  1400. val = maxCount
  1401. }
  1402. baseFormData.totalCount = val;
  1403. if(selectModeInfo.type == PlayType.treasure) {
  1404. treasureFormData.fansUnitAmount = calcFansUnitAmount();
  1405. }
  1406. onIptSetErrorTxt();
  1407. return val;
  1408. };
  1409. const onValidityDurationInput = () => {
  1410. validityDurationHandler()
  1411. let val = onIptSetErrorTxt();
  1412. return val;
  1413. }
  1414. const onValidityDurationBlur = () => {
  1415. validityDurationHandler();
  1416. let val = onIptSetErrorTxt();
  1417. return val;
  1418. }
  1419. const validityDurationHandler = () => {
  1420. let val = baseFormData.validityDuration;
  1421. if (val == 0) {
  1422. val = "";
  1423. } else if(val > lotteryMaxHourDuration) {
  1424. val = lotteryMaxHourDuration+'';
  1425. }
  1426. val = val.replace(/[^\d]/g, "");
  1427. baseFormData.validityDuration = val;
  1428. return val;
  1429. }
  1430. /**
  1431. * 金额输入失焦
  1432. */
  1433. const onAmountBlur = () => {
  1434. onIptSetErrorTxt();
  1435. };
  1436. /**
  1437. * count失焦,校验输入结果
  1438. */
  1439. const onCountBlur = () => {
  1440. onIptSetErrorTxt();
  1441. };
  1442. /**
  1443. * 输入结果金额和数量 (金额/数量)是否小于最小货币单位
  1444. */
  1445. const calcIptValue = (cb) => {
  1446. let amountValue = baseFormData.amountValue;
  1447. let totalCount = baseFormData.totalCount;
  1448. let flag = true;
  1449. if (!amountValue || !totalCount) {
  1450. return {
  1451. flag
  1452. };
  1453. }
  1454. if (math.format(math.evaluate(`${baseFormData.amountValue} / ${baseFormData.totalCount}`)) < +currentCurrencyInfo.value.minAmount) {
  1455. flag = false;
  1456. }
  1457. return {
  1458. flag,
  1459. count: Math.floor(math.format(math.evaluate(`${baseFormData.amountValue} / ${currentCurrencyInfo.value.minAmount}`)))
  1460. }
  1461. };
  1462. /**
  1463. * usd最小金额判断
  1464. * luckdropPostConfig是一个列表,需要根据当前的玩法选择对应的Limit信息比对
  1465. * luckdropPostConfig[i].usdLimitEnable 当前选中的token是否开启usd最小金额判断
  1466. */
  1467. const checkUsdMinNumber = (isInTemplate) => {
  1468. let forbiddenText = '';
  1469. const { usdPrice, luckdropPostConfig = [] } = currentCurrencyInfo.value;
  1470. let currentLuckDropConfig = luckdropPostConfig.find(item => item.luckdropType === selectModeInfo.type);
  1471. if (baseFormData.rewardType === RewardType.money && currentLuckDropConfig?.usdLimitEnable === 1) {
  1472. const { amountValue, totalCount } = baseFormData;
  1473. if (currentLuckDropConfig?.minTotalUsdAmount === 0 || currentLuckDropConfig?.minAvgUsdAmount === 0) {
  1474. // 当前token允许的usd最小金额为0 或单个红包最小金额为0,则无限制
  1475. return forbiddenText;
  1476. } else {
  1477. const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? math.format(math.evaluate(amountValue * usdPrice)) < currentLuckDropConfig.minTotalUsdAmount : false;
  1478. const isAvgForbidden = currentLuckDropConfig?.minAvgUsdAmount ? math.format(math.evaluate(amountValue / totalCount * usdPrice)) < currentLuckDropConfig.minAvgUsdAmount : false;
  1479. forbiddenText = isAmountForbidden && isAvgForbidden ?
  1480. `The prize pool must be above ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minTotalUsdAmount + '</span>') : ('$' + currentLuckDropConfig.minTotalUsdAmount)}
  1481. or the average prize must be above
  1482. ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minAvgUsdAmount +' per person.</span>' ): ('$' + currentLuckDropConfig.minAvgUsdAmount + ' per person.') }`
  1483. : '';
  1484. }
  1485. }
  1486. return forbiddenText;
  1487. };
  1488. const checkTreasureAmountRange = (isInTemplate) => {
  1489. let forbiddenText = '';
  1490. const { usdPrice, minAmount, luckdropPostConfig = [] } = currentCurrencyInfo.value;
  1491. let currentLuckDropConfig = luckdropPostConfig.find(item => item.luckdropType === selectModeInfo.type);
  1492. if (currentLuckDropConfig?.usdLimitEnable === 1) {
  1493. if (currentLuckDropConfig?.minTotalUsdAmount === 0 || currentLuckDropConfig?.minAvgUsdAmount === 0) {
  1494. // 当前token允许的usd最小金额为0 或单个红包最小金额为0,则无限制
  1495. return forbiddenText;
  1496. } else {
  1497. let txt = `The prize pool must be above ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minTotalUsdAmount + '</span>') : ('$' + currentLuckDropConfig.minTotalUsdAmount)}
  1498. or the average prize must be above
  1499. ${isInTemplate ? ('<span class="font-color-1D9BF0">$' + currentLuckDropConfig.minAvgUsdAmount +' per person.</span>' ): ('$' + currentLuckDropConfig.minAvgUsdAmount + ' per person.') }`
  1500. const isAmountForbidden = currentLuckDropConfig?.minTotalUsdAmount ? +math.format(math.evaluate(baseFormData.amountValue * usdPrice)) < currentLuckDropConfig?.minTotalUsdAmount : false;
  1501. const isAvgForbidden = treasureFormData.fansUnitAmount !== '' && currentLuckDropConfig?.minAvgUsdAmount ? treasureFormData.fansUnitAmount < minAmount || treasureFormData.fansUnitAmount < currentLuckDropConfig?.minAvgUsdAmount : false;
  1502. forbiddenText = isAmountForbidden || isAvgForbidden ? txt : '';
  1503. }
  1504. }
  1505. return forbiddenText;
  1506. };
  1507. const treasureFormValidata = () => {
  1508. console.log('treasureFormValidata')
  1509. isShowUsdMinMessage.value = false;
  1510. let userList = atUserList.value.filter(item => item.name);
  1511. if(!currentCurrencyInfo.value.currencyCode) {
  1512. iptErrMsgTxt.value = "Select a reward"
  1513. } else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
  1514. iptErrMsgTxt.value = "Enter an amount";
  1515. } else if (iptErrMsgTxt.value = checkTreasureAmountRange()) {
  1516. //amount 是否大于 最小总金额
  1517. isShowUsdMinMessage.value = true;
  1518. } else if (!baseFormData.totalCount || baseFormData.totalCount == '0') {
  1519. // 输入Follower
  1520. iptErrMsgTxt.value = "Enter the number of follower";
  1521. } else if(iptErrMsgTxt.value = checkTreasureAmountRange()) {
  1522. // 粉丝单价是否 小于总金额规则 大于最小粉丝单价 、大于币种最小精度
  1523. isShowUsdMinMessage.value = true;
  1524. } else if(!userList.length) {
  1525. iptErrMsgTxt.value = requireFollowTxt;
  1526. } else {
  1527. isShowUsdMinMessage.value = false;
  1528. iptErrMsgTxt.value = "";
  1529. }
  1530. };
  1531. /**
  1532. * 输入时 检测设置错误信息
  1533. */
  1534. const onIptSetErrorTxt = (params = {}) => {
  1535. if(baseFormData.type == PlayType.treasure) {
  1536. treasureFormValidata();
  1537. return;
  1538. }
  1539. if((baseFormData.rewardType === RewardType.money && !currentCurrencyInfo.value.currencyCode)
  1540. || (baseFormData.rewardType === RewardType.custom && !baseFormData.customizedReward)) {
  1541. iptErrMsgTxt.value = "Select a reward"
  1542. } else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
  1543. iptErrMsgTxt.value = "Enter an amount";
  1544. } else if (baseFormData.type != PlayType.treasure && (!baseFormData.totalCount || baseFormData.totalCount == '0')) {
  1545. iptErrMsgTxt.value = "Enter the number of winners";
  1546. } else if (iptErrMsgTxt.value = checkUsdMinNumber()) {
  1547. // 最小法币金额限制
  1548. return isShowUsdMinMessage.value = true;
  1549. } else if(baseFormData.rewardType === RewardType.money && baseFormData.type != PlayType.treasure && +baseFormData.amountValue <= +currentCurrencyInfo.value.balance) {
  1550. // 输入金额 小于 余额
  1551. let res = calcIptValue();
  1552. if (!res.flag) {
  1553. iptErrMsgTxt.value = `${baseFormData.amountValue} ${currentCurrencyInfo.value.tokenSymbol} Can send up to ${res.count} winners`;
  1554. } else {
  1555. if(baseFormData.type == PlayType.lottery && !baseFormData.validityDuration) {
  1556. iptErrMsgTxt.value = "Enter Automatically Draw";
  1557. } else {
  1558. //清空错误提示
  1559. iptErrMsgTxt.value = "";
  1560. if(params.actionType != 'discord_blur') {
  1561. setDiscordErrTxt({getDuildId: true});
  1562. }
  1563. }
  1564. }
  1565. } else if(baseFormData.type == PlayType.lottery && !baseFormData.validityDuration) {
  1566. // 抽奖模式 没有输入时长
  1567. iptErrMsgTxt.value = "Enter Automatically Draw";
  1568. } else {
  1569. if(baseFormData.type != PlayType.treasure) {
  1570. setDiscordErrTxt({getDuildId: true}, () => {
  1571. iptErrMsgTxt.value = '';
  1572. });
  1573. }
  1574. }
  1575. }
  1576. /**
  1577. * 监听开关触发事件
  1578. */
  1579. const formSwitchChange = (val, params, index) => {
  1580. closeDiscordTask(val, params, index);
  1581. }
  1582. const closeDiscordTask = (val, params, index) => {
  1583. if(params.type == TaskType.joinDiscord) {
  1584. if(!val) {
  1585. //错误类型 discord 清空discord错误校验
  1586. if(iptErrType == 'discord') {
  1587. iptErrMsgTxt.value = '';
  1588. formList[index]['text'] = '';
  1589. onIptSetErrorTxt();
  1590. }
  1591. } else {
  1592. onIptSetErrorTxt();
  1593. }
  1594. }
  1595. }
  1596. /** 监听 discord 输入 */
  1597. const onIptDiscordAddress = (e, index) => {
  1598. let val = formList[index].text;
  1599. let checked = formList[index].checked;
  1600. if(val && !checked) {
  1601. checked = true;
  1602. formList[index].checked = checked;
  1603. formList[index].text = formList[index].text.replace(/\s/g,'');
  1604. } else if(!val){
  1605. discordInviteInfo.value = {};
  1606. }
  1607. onIptDiscordDebounce()
  1608. }
  1609. const onBlurDiscordAddress = (e, index) => {
  1610. setDiscordErrTxt({fromType: 'discord', showPop: false, actionType: 'discord_blur'});
  1611. }
  1612. const getDiscordIptData = () => {
  1613. let discordItem = formList.find(item => item.type == TaskType.joinDiscord);
  1614. return discordItem;
  1615. }
  1616. /**
  1617. * 设置输入discord错误提示信息
  1618. */
  1619. const setDiscordErrTxt = (params = {showPop: false}, cb) => {
  1620. let discordData = getDiscordIptData() || {};
  1621. if(discordData.checked) {
  1622. if(discordData.text) {
  1623. let validata = checkInviteUrl(discordData.text);
  1624. if(validata) {
  1625. getDiscordInviteInfo({inviteUrl: discordData.text, getDuildId: params.getDuildId}, (res) => {
  1626. console.log('discordData',res)
  1627. // 未知的邀请链接
  1628. if(res.inviteCode != res.data.code || !res.data.guildId) {
  1629. iptErrMsgTxt.value = discordIptErrTxt;
  1630. iptErrType = 'discord';
  1631. } else {
  1632. if(res.data.expires !== null) {
  1633. // 不是永久邀请链接
  1634. iptErrMsgTxt.value = discordIptNerverExpiresErrTxt;
  1635. iptErrType = '';
  1636. } else {
  1637. if(iptErrMsgTxt.value) {
  1638. iptErrMsgTxt.value = '';
  1639. iptErrType = '';
  1640. }
  1641. if(params.showPop && res.data) {
  1642. showDiscordInvitePop.value = true;
  1643. setTimeout(() => {
  1644. showDiscordInvitePop.value = false;
  1645. }, 2000)
  1646. }
  1647. if(params.fromType == 'discord') {
  1648. onIptSetErrorTxt();
  1649. }
  1650. }
  1651. }
  1652. cb && cb(res)
  1653. })
  1654. } else {
  1655. iptErrMsgTxt.value = discordIptErrTxt;
  1656. iptErrType = 'discord';
  1657. }
  1658. } else {
  1659. if(params.actionType == 'discord_blur') {
  1660. onIptSetErrorTxt({acitonType: 'discord_blur'});
  1661. } else {
  1662. // 设置空提示
  1663. iptErrMsgTxt.value = discordIptEmptyErrTxt;
  1664. iptErrType = 'discord';
  1665. }
  1666. }
  1667. } else {
  1668. cb && cb();
  1669. }
  1670. }
  1671. const onIptDiscordDebounce = debounce(function() {
  1672. setDiscordErrTxt({fromType: 'discord', showPop: true});
  1673. }, 800)
  1674. /**
  1675. * 校验 discord邀请url
  1676. */
  1677. const checkInviteUrl = (inviteUrl) => {
  1678. let flag = false;
  1679. const INVITE_URL_PREFIX_1 = 'https://discord.gg/';
  1680. const INVITE_URL_PREFIX_2 = 'https://discord.com/invite/';
  1681. const INVITE_URL_PREFIX_3 = 'http://discord.gg/';
  1682. const INVITE_URL_PREFIX_4 = 'http://discord.com/invite/';
  1683. const INVITE_URL_PREFIX_5 = 'discord.gg/';
  1684. const INVITE_URL_PREFIX_6 = 'discord.com/invite/';
  1685. 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]
  1686. if(inviteUrl) {
  1687. if(arr.indexOf(inviteUrl) > -1) {
  1688. flag = false;
  1689. } else {
  1690. let isPass = false;
  1691. for(let i = 0; i < arr.length; i++) {
  1692. let item = arr[i];
  1693. if(inviteUrl.startsWith(item)) {
  1694. isPass = true;
  1695. break;
  1696. }
  1697. }
  1698. flag = isPass;
  1699. }
  1700. }
  1701. return flag;
  1702. }
  1703. /**获取discord 邀请信息 */
  1704. const getDiscordInviteInfo = ({inviteUrl, getDuildId}, cb) => {
  1705. if(!inviteUrl) return;
  1706. let inviteCode = '';
  1707. let arr = inviteUrl.split('/');
  1708. if(arr.length > 0) {
  1709. inviteCode = arr[arr.length - 1];
  1710. }
  1711. if(!getDuildId && discordInviteInfo.value.guildId && discordInviteInfo.value.inviteCode == inviteCode) {
  1712. return;
  1713. }
  1714. getInviteGuildInfo({
  1715. inviteCode
  1716. }).then(res => {
  1717. let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
  1718. if(resData.data.guildId) {
  1719. cb && cb(resData);
  1720. } else {
  1721. //DISCORD 接口未获取到服务器信息 resdata
  1722. Report.reportLog({
  1723. pageSource: Report.pageSource.publisherDialog,
  1724. businessType: Report.businessType.buttonClick,
  1725. objectType: Report.objectType.getDiscordGuildNoData
  1726. }, {
  1727. resData: resData
  1728. });
  1729. getGuildInfoByOpenApi({inviteCode}, cb);
  1730. }
  1731. }).catch((err) => {
  1732. //DISCORD 接口 catch
  1733. Report.reportLog({
  1734. pageSource: Report.pageSource.publisherDialog,
  1735. businessType: Report.businessType.buttonClick,
  1736. objectType: Report.objectType.getDiscordGuildCatch
  1737. }, {
  1738. err: err
  1739. });
  1740. let errMsg = err;
  1741. if(typeof errMsg == 'object') {
  1742. errMsg = JSON.stringify(err);
  1743. }
  1744. if(errMsg.indexOf('code 404') > -1) {
  1745. discordInviteInfo.value = {};
  1746. iptErrMsgTxt.value = discordIptErrTxt;
  1747. } else {
  1748. getGuildInfoByOpenApi({inviteCode}, cb);
  1749. }
  1750. });
  1751. }
  1752. const getGuildInfoByOpenApi = (params, cb) => {
  1753. let { inviteCode } = params;
  1754. getInviteGuildInfoByOpenApi({
  1755. inviteCode
  1756. }).then(res => {
  1757. let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
  1758. if(resData.data.guildId) {
  1759. cb && cb(resData);
  1760. } else {
  1761. //OPENAPI 接口未获取到服务器信息 resdata
  1762. Report.reportLog({
  1763. pageSource: Report.pageSource.publisherDialog,
  1764. businessType: Report.businessType.buttonClick,
  1765. objectType: Report.objectType.getDiscordGuildOpenApiNoData
  1766. }, {
  1767. resData: resData
  1768. });
  1769. }
  1770. }).catch((err) => {
  1771. // OPENAPI 接口 catch 限频
  1772. Report.reportLog({
  1773. pageSource: Report.pageSource.publisherDialog,
  1774. businessType: Report.businessType.buttonClick,
  1775. objectType: Report.objectType.getDiscordGuildOpenApiCatch
  1776. }, {
  1777. err: err
  1778. });
  1779. if(iptErrMsgTxt.value && iptErrType == 'discord') {
  1780. iptErrMsgTxt.value = '';
  1781. iptErrType = '';
  1782. }
  1783. });
  1784. }
  1785. const inviteGuildResHandler = (res, params) => {
  1786. let {inviteCode, inviteUrl} = params;
  1787. if(!res) {
  1788. res = {};
  1789. }
  1790. let {name, icon, id} = res.guild || {};
  1791. icon = icon && id ? `https://cdn.discordapp.com/icons/${id}/${icon}.png` : '';
  1792. let resData = {
  1793. inviteCode,
  1794. data: {
  1795. code: res.code,
  1796. guildId: id,
  1797. inviteUrl,
  1798. inviteCode,
  1799. expires: res.expires_at,
  1800. name,
  1801. icon,
  1802. }
  1803. }
  1804. if(res.code == inviteCode) {
  1805. discordInviteInfo.value = resData.data;
  1806. } else {
  1807. discordInviteInfo.value = {};
  1808. iptErrMsgTxt.value = discordIptErrTxt;
  1809. }
  1810. return resData;
  1811. };
  1812. /**
  1813. * 获取支付配置(paypalClientId)
  1814. */
  1815. const setPayConfig = () => {
  1816. getPayConfig({
  1817. params: {},
  1818. }).then((res) => {
  1819. if (res.code == 0) {
  1820. payConfig.value = res.data;
  1821. }
  1822. });
  1823. };
  1824. /**
  1825. * 获取配置
  1826. */
  1827. const setFrontConfig = () => {
  1828. getFrontConfig({
  1829. params: {},
  1830. }).then((res) => {
  1831. if (res.code == 0) {
  1832. lotteryMaxHourDuration = res.data.lotteryMaxHourDuration;
  1833. toolBoxPageData.postEditorLinkInputDescImage = res.data.postEditorLinkInputDescImage;
  1834. toolBoxPageData.postEditorDefaultLinkTitle = res.data.postEditorDefaultLinkTitle;
  1835. }
  1836. });
  1837. };
  1838. const getUserName = (screenName) => {
  1839. if(!screenName) return;
  1840. getUser({
  1841. params:{
  1842. screenName
  1843. }
  1844. }).then(res => {
  1845. if(res.code == 0) {
  1846. userInfo.value.name = res.data.name || ''
  1847. }
  1848. console.log(userInfo.value, 'userinfo')
  1849. });
  1850. }
  1851. /**
  1852. * 默认获取上次选中的货币信息
  1853. */
  1854. const getLocalCurrencyInfoByCode = async () => {
  1855. let storageUserInfo = await getChromeStorage('userInfo') || {};
  1856. userInfo.value = storageUserInfo;
  1857. getUserName(storageUserInfo.nickName);
  1858. if(!currentCurrencyInfo.value.currencyCode) {
  1859. getCurrencyInfo();
  1860. }
  1861. }
  1862. const getCurrencyInfo = async (_params) => {
  1863. let { loop = false} = _params || {};
  1864. if (userInfo.value && userInfo.value.accessToken) {
  1865. let {currencyCode = ''} = await getChromeStorage('selectCurrencyInfo') || {};
  1866. if(currencyCode) {
  1867. let currencyInfoRes = await getCurrencyByCode({currencyCode});
  1868. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  1869. let currentCurrencyCode= currentCurrencyInfo.value.currencyCode;
  1870. if(currentCurrencyCode && currentCurrencyCode == currencyInfoRes.data.currencyCode || !currentCurrencyCode) {
  1871. currentCurrencyInfo.value = currencyInfoRes.data;
  1872. tempCurrentCurrencyInfo.value = currencyInfoRes.data;
  1873. if(!loop) {
  1874. onIptSetErrorTxt();
  1875. }
  1876. }
  1877. }
  1878. }
  1879. getChromeStorage('selectCurrencyList', (res) => {
  1880. if (showCurrencySelect.value === false) {
  1881. tempCurrentCurrencyList.value = res;
  1882. }
  1883. })
  1884. }
  1885. }
  1886. const getCurrencyByCode = async (params) => {
  1887. let res = await getCurrencyInfoByCode({
  1888. params: {
  1889. currencyCode: params.currencyCode
  1890. }
  1891. })
  1892. return res || {};
  1893. }
  1894. const selectPublishMode = (params, index) => {
  1895. selectModeInfo.index = index;
  1896. selectModeInfo.type = params.type;
  1897. baseFormData.type = params.type;
  1898. if(params.type == PlayType.treasure) {
  1899. baseFormData.rewardType = RewardType.money;
  1900. baseFormData.customizedReward = '';
  1901. showGeneralLottery.value = false;
  1902. } else {
  1903. showGeneralLottery.value = true;
  1904. }
  1905. onIptSetErrorTxt();
  1906. }
  1907. const clickLeftTab = (params, index) => {
  1908. publishType.value = params.type;
  1909. }
  1910. const onToolBoxPageChange = (params) => {
  1911. toolBoxPageData.activePage = params.page;
  1912. };
  1913. const toolBoxPublishFinish = (params) => {
  1914. toolBoxPageData.activePage = 'EDITOR';
  1915. emits("postPublishFinish", { publishRes: params.publishRes });
  1916. }
  1917. // 截图相关
  1918. const showDialog = () => {
  1919. cropperDialog.value = true;
  1920. }
  1921. const hiddenDialog = () => {
  1922. cropperDialog.value = false;
  1923. cropperLoading.value = false;
  1924. }
  1925. const selectImage = (option) => {
  1926. // 设置图片
  1927. cropperOption.value.img = option.file
  1928. // 选取比例
  1929. if (option && option.type && option.type == 2) {
  1930. cropperType.value = 'after';
  1931. cropperOption.value.fixedNumber = [1, 1];
  1932. } else {
  1933. cropperType.value = 'before';
  1934. cropperOption.value.fixedNumber = [16, 8.396];
  1935. }
  1936. nextTick(() => {
  1937. showDialog()
  1938. })
  1939. }
  1940. const confirmImage = () => {
  1941. let contentType = 'image/png';
  1942. cropperLoading.value = true;
  1943. if (refCropper.value) {
  1944. refCropper.value.getCropBlob(imgData => {
  1945. uploadSignature({
  1946. params: {
  1947. bizType: 1,
  1948. fileType: 1,
  1949. contentType: contentType,
  1950. fileSuffix: 'png',
  1951. }
  1952. }).then(res => {
  1953. let { code, data } = res;
  1954. if (code === 0) {
  1955. let reader = new FileReader()
  1956. reader.readAsArrayBuffer(imgData)
  1957. reader.onload = function(e) {
  1958. let execFile = e.target.result;
  1959. uploadFile({
  1960. url: data.url,
  1961. data: new Blob([execFile]),
  1962. headers: {
  1963. 'Authorization': data.authorization,
  1964. 'x-amz-date': data.date,
  1965. 'Content-Type': contentType
  1966. }
  1967. }).then(res => {
  1968. let { status } = res
  1969. if (status == 200) {
  1970. successImage(data)
  1971. }
  1972. }).finally(() => {
  1973. cropperLoading.value = false;
  1974. })
  1975. }
  1976. }
  1977. })
  1978. })
  1979. }
  1980. }
  1981. const successImage = (data) => {
  1982. hiddenDialog()
  1983. // setPosterInfo
  1984. customPosterInfo.value[cropperType.value] = data;
  1985. }
  1986. const confirmData = (data) => {
  1987. close()
  1988. customPosterData.value = customPosterInfo.value;
  1989. }
  1990. /**
  1991. * 显示通用奖品名称编辑框
  1992. */
  1993. const addCustomizedRewardHandle = () => {
  1994. showCurrencyPop.value = false;
  1995. showCustomizedRewardEditPopup.value = true;
  1996. }
  1997. const closeRewardPopup = () => {
  1998. showCustomizedRewardEditPopup.value = false;
  1999. }
  2000. const removeReward = () => {
  2001. showCustomizedRewardEditPopup.value = false;
  2002. resetFormIpt(false);
  2003. onIptSetErrorTxt();
  2004. }
  2005. // 提交通用奖品
  2006. const submitReward = (reward) => {
  2007. if(baseFormData.customizedReward !== reward) {
  2008. // 有修改时,重置之前已提交的数据
  2009. resetFormIpt(false);
  2010. }
  2011. baseFormData.rewardType = RewardType.custom;
  2012. baseFormData.customizedReward = reward;
  2013. showCustomizedRewardEditPopup.value = false;
  2014. currentCurrencyInfo.value = defaultCurrentCurrencyInfo;
  2015. setLocalSelectCurrencyInfo(defaultCurrentCurrencyInfo);
  2016. onIptSetErrorTxt();
  2017. }
  2018. const updateUSDeposit = async () => {
  2019. if(showDepositMessageBox.value) {
  2020. let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
  2021. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  2022. currentCurrencyInfo.value = currencyInfoRes.data;
  2023. let {balance} = currencyInfoRes.data;
  2024. if(balance >= finalAmountData.value.orderAmountValue) {
  2025. USDepositStatus.value = 'SUCCESS';
  2026. }
  2027. }
  2028. }
  2029. };
  2030. const depositAchCancel = async () => {
  2031. showDepositMessageBox.value = false;
  2032. let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
  2033. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  2034. currentCurrencyInfo.value = currencyInfoRes.data;
  2035. let {balance} = currencyInfoRes.data;
  2036. if(balance >= finalAmountData.value.orderAmountValue) {
  2037. USDepositStatus.value = 'SUCCESS';
  2038. }
  2039. }
  2040. }
  2041. const depositAchConfirm = async () => {
  2042. let currencyInfoRes = await getCurrencyByCode({currencyCode: currentCurrencyInfo.value.currencyCode});
  2043. if(currencyInfoRes.code == 0 && currencyInfoRes.data) {
  2044. showDepositMessageBox.value = false;
  2045. currentCurrencyInfo.value = currencyInfoRes.data;
  2046. let {balance} = currencyInfoRes.data;
  2047. if(balance >= finalAmountData.value.orderAmountValue) {
  2048. USDepositStatus.value = 'SUCCESS';
  2049. payButtonDom.value && payButtonDom.value.balancePay();
  2050. } else {
  2051. message.info('Deposit failed, please try again later');
  2052. }
  2053. }
  2054. }
  2055. const onPageVisbile = () => {
  2056. document.addEventListener('visibilitychange', function () {
  2057. let isHidden = document.hidden;
  2058. if (!isHidden) {
  2059. updateUSDeposit();
  2060. }
  2061. });
  2062. }
  2063. onMounted(() => {
  2064. setFrontConfig();
  2065. setPayConfig();
  2066. getLocalCurrencyInfoByCode();
  2067. onPageVisbile();
  2068. window.addEventListener('resize', function () {
  2069. setDialogStyle(true);
  2070. })
  2071. // showNewImage
  2072. getChromeStorage('custom_poster_guide', (info) => {
  2073. if (!info) {
  2074. customShowNewImage.value = true
  2075. }
  2076. })
  2077. });
  2078. </script>
  2079. <style lang="scss">
  2080. .font-color-1D9BF0 {
  2081. color: #1D9BF0;
  2082. }
  2083. .margin-left-10 {
  2084. margin-left: 10px;
  2085. }
  2086. </style>
  2087. <style lang="scss" scoped>
  2088. :deep() .ant-switch {
  2089. background-color: #E9ECEE;
  2090. height: 14px;
  2091. line-height: 16px;
  2092. min-width: 36px;
  2093. }
  2094. :deep() .ant-switch-checked {
  2095. background-color: #AED8F5 !important;
  2096. }
  2097. :deep() .ant-switch::after {
  2098. width: 20px;
  2099. height: 20px;
  2100. top: -4px;
  2101. left: -1px;
  2102. }
  2103. :deep() .ant-switch-checked::after {
  2104. background-color: #1D9BF0 !important;
  2105. margin-left: 3px;
  2106. left: 100% !important;
  2107. }
  2108. .overlay {
  2109. position: fixed;
  2110. top: 0;
  2111. right: 0;
  2112. bottom: 0;
  2113. left: 0;
  2114. z-index: 1000;
  2115. width: 100%;
  2116. height: 100%;
  2117. background-color: rgba(0, 0, 0, 0.5);
  2118. overflow: auto;
  2119. .content {
  2120. height: 620px;
  2121. background: #ffffff;
  2122. border-radius: 20px;
  2123. position: absolute;
  2124. left: 50%;
  2125. top: 50%;
  2126. transform: translate(-50%, -50%);
  2127. box-sizing: border-box;
  2128. z-index: 2000;
  2129. max-height: 825px;
  2130. .pop-mask {
  2131. width: 100%;
  2132. height:100%;
  2133. position: absolute;
  2134. z-index:900;
  2135. }
  2136. .body {
  2137. box-sizing: border-box;
  2138. height: calc(100% - 48px);
  2139. display: flex;
  2140. position: relative;
  2141. .body-content {
  2142. display:flex;
  2143. width:100%;
  2144. }
  2145. .currency-pop {
  2146. position: absolute;
  2147. width: 375px;
  2148. height: 480px;
  2149. top: 85px;
  2150. left: 88px;
  2151. z-index: 1000;
  2152. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  2153. background-color: #fff;
  2154. border-radius: 20px;
  2155. overflow-y: auto;
  2156. }
  2157. .currency-pop-select {
  2158. position: absolute;
  2159. width: 375px;
  2160. max-height: 480px;
  2161. top: 85px;
  2162. left: 88px;
  2163. z-index: 1000;
  2164. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  2165. background-color: #fff;
  2166. border-radius: 20px;
  2167. overflow-y: scroll;
  2168. }
  2169. .left,
  2170. .right {
  2171. height: 100%;
  2172. }
  2173. .left {
  2174. width: 50px;
  2175. display: flex;
  2176. flex-direction: column;
  2177. align-items: center;
  2178. .tab-item {
  2179. width: 100%;
  2180. height: 55px;
  2181. display: flex;
  2182. align-items: center;
  2183. justify-content: center;
  2184. cursor: pointer;
  2185. }
  2186. .active-tab {
  2187. background-color: #D2EAFC;
  2188. }
  2189. .bottom {
  2190. .icon {
  2191. display: block;
  2192. margin-bottom: 26px;
  2193. }
  2194. }
  2195. }
  2196. .right {
  2197. width: calc(100% - 50px);
  2198. box-sizing: border-box;
  2199. position: relative;
  2200. border-left: 1px solid #ececec;
  2201. .form-wrapper {
  2202. padding: 18px 80px 18px 80px;
  2203. height: calc(100% - 80px);
  2204. overflow: auto;
  2205. box-sizing: border-box;
  2206. display: flex;
  2207. .form-left-sheet {
  2208. width: 500px;
  2209. }
  2210. .form-right-sheet {
  2211. .custom-cover-btn {
  2212. margin-top: 12px;
  2213. display: flex;
  2214. align-items: center;
  2215. cursor: pointer;
  2216. color: #494949;
  2217. font-weight: 400;
  2218. font-size: 12px;
  2219. float: right;
  2220. }
  2221. }
  2222. .base-form-wrapper {
  2223. margin-right: 30px;
  2224. width: 100%;
  2225. .form-cell-content {
  2226. .select-mode-ele {
  2227. display: flex;
  2228. cursor: pointer;
  2229. position: relative;
  2230. height: 120px;
  2231. img {
  2232. -webkit-user-drag: none;
  2233. }
  2234. .img:last-child {
  2235. margin-right: 0px !important;
  2236. }
  2237. .img {
  2238. width: 158px;
  2239. height: 80px;
  2240. border-radius: 5px;
  2241. margin-right: 13px;
  2242. }
  2243. .img-tips {
  2244. position: absolute;
  2245. left: 0;
  2246. bottom: -2px;
  2247. }
  2248. }
  2249. .form-base {
  2250. .form-cell {
  2251. margin-top: 28px;
  2252. .cell-title {
  2253. color: #2F2F2F;
  2254. font-weight: 500;
  2255. font-size: 13px;
  2256. display: flex;
  2257. align-items: center;
  2258. margin-bottom: 10px;
  2259. .title-icon {
  2260. width: 20px;
  2261. margin-right: 4px;
  2262. }
  2263. }
  2264. .flex {
  2265. display: flex;
  2266. align-items: center;
  2267. }
  2268. .cell-content {
  2269. input {
  2270. width: 178px;
  2271. font-weight: 500;
  2272. font-size: 14px;
  2273. color: #000000;
  2274. border: none;
  2275. outline: none;
  2276. box-sizing: border-box;
  2277. }
  2278. input::placeholder {
  2279. color: #999999;
  2280. }
  2281. input:disabled {
  2282. color: #999999;
  2283. background-color: #fff;
  2284. }
  2285. .count-msg {
  2286. font-weight: 400;
  2287. font-size: 12px;
  2288. color: #B3B3B3;
  2289. margin-top: 12px;
  2290. }
  2291. .cost-txt {
  2292. color: #7E7E7E;
  2293. font-weight: 400;
  2294. font-size: 12px;
  2295. margin-left: 10px;
  2296. }
  2297. }
  2298. }
  2299. .currency-select {
  2300. cursor: pointer;
  2301. background: #1D9BF0;
  2302. padding: 0 10px;
  2303. border-radius: 5px;
  2304. color: #fff;
  2305. width: max-content;
  2306. max-width: 234px;
  2307. display: flex;
  2308. align-items: center;
  2309. height: 38px;
  2310. box-sizing: border-box;
  2311. .icon {
  2312. width: 20px;
  2313. margin-right: 8px;
  2314. }
  2315. .text {
  2316. white-space: nowrap;
  2317. font-weight: 500;
  2318. font-size: 14px;
  2319. }
  2320. .arrow {
  2321. margin-left: 5px;
  2322. }
  2323. }
  2324. .selected {
  2325. background: #FFF !important;
  2326. border: 1px solid #D9D9D9;
  2327. .text {
  2328. color: #000 !important;
  2329. }
  2330. }
  2331. .automatically-input {
  2332. border-top: 1px solid #D1D9DD;
  2333. .input-wrapper {
  2334. margin-right: 16px;
  2335. box-sizing: border-box;
  2336. input {
  2337. padding-right: 4px !important;
  2338. }
  2339. .unit {
  2340. font-weight: 700;
  2341. font-size: 26px;
  2342. opacity: 0.5;
  2343. }
  2344. }
  2345. }
  2346. }
  2347. }
  2348. }
  2349. .currency-operation {
  2350. position: relative;
  2351. box-sizing: border-box;
  2352. display: flex;
  2353. align-items: center;
  2354. margin-top: 8px;
  2355. background: #F8F8F8;
  2356. border-radius: 3px;
  2357. width: 100%;
  2358. height: 28px;
  2359. padding-left: 10px;
  2360. .balance,
  2361. .amount {
  2362. display: flex;
  2363. align-items: center;
  2364. }
  2365. .amount {
  2366. font-weight: 400;
  2367. font-size: 12px;
  2368. color: #A39F9F;
  2369. img {
  2370. margin-left: 6px;
  2371. cursor: pointer;
  2372. }
  2373. }
  2374. .top-up {
  2375. font-weight: 500;
  2376. font-size: 12px;
  2377. color: #1D9BF0;
  2378. cursor: pointer;
  2379. margin-left: 4px;
  2380. }
  2381. }
  2382. .form-label {
  2383. margin-top: 14px;
  2384. margin-bottom: 10px;
  2385. font-weight: 500;
  2386. font-size: 14px;
  2387. display: flex;
  2388. align-items: center;
  2389. justify-content: space-between;
  2390. .icon-add-task {
  2391. cursor: pointer;
  2392. }
  2393. }
  2394. .form-require {
  2395. box-sizing: border-box;
  2396. border-radius: 15px;
  2397. border: 1px solid #D1D9DD;
  2398. .form-item {
  2399. min-height: 54px;
  2400. display: flex;
  2401. align-items: center;
  2402. justify-content: space-between;
  2403. margin: 0 16px;
  2404. border-bottom: 1px solid #ececec;
  2405. padding: 8px 0;
  2406. box-sizing: border-box;
  2407. .item-left {
  2408. display: flex;
  2409. }
  2410. .label {
  2411. min-width: 76px;
  2412. display: flex;
  2413. align-items: center;
  2414. font-size: 15px;
  2415. font-weight: 500;
  2416. .icon {
  2417. margin-right: 10px;
  2418. }
  2419. }
  2420. .control {
  2421. min-width: 258px;
  2422. margin-left: 6px;
  2423. box-sizing: border-box;
  2424. position: relative;
  2425. .discord-address {
  2426. border: none;
  2427. outline: none;
  2428. color: #1D9BF0;
  2429. font-weight: 500;
  2430. font-size: 14px;
  2431. width: 100%;
  2432. height: 34px;
  2433. padding-left: 15px;
  2434. }
  2435. .discord-address::placeholder {
  2436. color: #c5c5c5;
  2437. }
  2438. .discord-invite-info {
  2439. position: absolute;
  2440. top: 40px;
  2441. left: 0;
  2442. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  2443. background: #fff;
  2444. border-radius: 16px;
  2445. padding: 16px;
  2446. box-sizing: border-box;
  2447. display: flex;
  2448. align-items: center;
  2449. cursor: pointer;
  2450. .icon {
  2451. width: 40px;
  2452. height: 40px;
  2453. margin-right: 10px;
  2454. border-radius: 50%;
  2455. }
  2456. .name {
  2457. font-weight: 600;
  2458. font-size: 16px;
  2459. color: #101419;
  2460. width: 193px;
  2461. height: 20px;
  2462. overflow: hidden;
  2463. white-space: nowrap;
  2464. text-overflow: ellipsis;
  2465. display: inline-block;
  2466. }
  2467. }
  2468. }
  2469. .icon-task-close {
  2470. margin-left: 6px;
  2471. cursor: pointer;
  2472. }
  2473. }
  2474. .border-hide {
  2475. border-bottom: none !important;
  2476. }
  2477. }
  2478. }
  2479. .usd-min-message {
  2480. font-style: normal;
  2481. font-weight: 400;
  2482. font-size: 12px;
  2483. line-height: 16px;
  2484. letter-spacing: 0.3px;
  2485. color: #C88726;
  2486. margin-top: 8px;
  2487. }
  2488. .tips-wrapper {
  2489. margin: 16px 0 0 12px !important;
  2490. padding: 0px !important;
  2491. .title,
  2492. .row {
  2493. font-weight: 400;
  2494. font-size: 12px;
  2495. color: #A39F9F;
  2496. }
  2497. .row {
  2498. box-sizing: border-box;
  2499. line-height: 16px;
  2500. }
  2501. }
  2502. .submit-btn-wrapper {
  2503. width: 100%;
  2504. background: #fff;
  2505. position: absolute;
  2506. bottom: 18px;
  2507. left: 0;
  2508. box-sizing: border-box;
  2509. padding: 16px 18px 0 18px;
  2510. .submit-btn {
  2511. width: 100%;
  2512. height: 46px;
  2513. text-align: center;
  2514. background: #4a99e9;
  2515. border-radius: 100px;
  2516. color: #fff;
  2517. display: flex;
  2518. align-items: center;
  2519. justify-content: center;
  2520. font-size: 16px;
  2521. font-weight: 500;
  2522. cursor: pointer;
  2523. .icon-loading {
  2524. width: 20px;
  2525. height: 20px;
  2526. margin-right: 3px;
  2527. }
  2528. }
  2529. .disabled-submit {
  2530. background-color: #D9D9D9;
  2531. }
  2532. }
  2533. }
  2534. .fill-right {
  2535. width: 100% !important;
  2536. border-bottom-left-radius: 16px;
  2537. }
  2538. }
  2539. }
  2540. }
  2541. .icon-refresh-rotate {
  2542. transform: rotate(360deg);
  2543. transition-duration: 1s;
  2544. }
  2545. .payment {
  2546. .balance {
  2547. display: flex;
  2548. margin-right: 20px;
  2549. .icon {
  2550. width: 40px;
  2551. height: 40px;
  2552. }
  2553. .con {
  2554. padding: 0 5px;
  2555. .desc {
  2556. color: rgba($color: #000000, $alpha: 0.5);
  2557. font-size: 12px;
  2558. margin-bottom: 4px;
  2559. }
  2560. .price {
  2561. font-size: 14px;
  2562. font-weight: bold;
  2563. word-break: break-all;
  2564. }
  2565. }
  2566. .refresh {
  2567. width: 40px;
  2568. cursor: pointer;
  2569. margin-left: -5px;
  2570. }
  2571. }
  2572. .btn-wrap {
  2573. width: 100%;
  2574. height: 80px;
  2575. background-color: #fff;
  2576. position: absolute;
  2577. left: 0;
  2578. bottom: 0;
  2579. box-shadow: 0px -1px 0px #ececec;
  2580. border-bottom-right-radius: 16px;
  2581. padding: 12px 30px;
  2582. box-sizing: border-box;
  2583. display: flex;
  2584. align-items: center;
  2585. justify-content: flex-end;
  2586. border-bottom-left-radius: 16px;
  2587. z-index: 999;
  2588. .custom-submit {
  2589. width: 200px;
  2590. height: 50px;
  2591. background: #1D9BF0;
  2592. border-radius: 50px;
  2593. font-weight: 700;
  2594. font-size: 18px;
  2595. line-height: 50px;
  2596. text-align: center;
  2597. letter-spacing: 0.3px;
  2598. color: #FFFFFF;
  2599. cursor: pointer;
  2600. }
  2601. }
  2602. }
  2603. .dialog {
  2604. position: absolute;
  2605. z-index: 2002;
  2606. top: 50%;
  2607. left: 50%;
  2608. transform: translate(-50%, -50%);
  2609. width: 800px;
  2610. height: calc(100% - 100px);
  2611. border-radius: 20px;
  2612. background-color: #ffffff;
  2613. .corp-title {
  2614. display: flex;
  2615. height: 48px;
  2616. align-items: center;
  2617. .back {
  2618. cursor: pointer;
  2619. width: 24px;
  2620. height: 24px;
  2621. margin: 0 12px;
  2622. }
  2623. span {
  2624. font-size: 16px;
  2625. font-weight: 500;
  2626. }
  2627. }
  2628. .corp-content {
  2629. width: 472px;
  2630. margin: auto;
  2631. height: calc(100% - 130px);
  2632. }
  2633. .corp-footer {
  2634. display: flex;
  2635. align-items: center;
  2636. justify-content: right;
  2637. height: 80px;
  2638. text-align: right;
  2639. padding-right: 30px;
  2640. .confirm {
  2641. cursor: pointer;
  2642. border: 0;
  2643. width: 200px;
  2644. height: 50px;
  2645. color: #ffffff;
  2646. font-size: 18px;
  2647. font-weight: 700;
  2648. border-radius: 25px;
  2649. background: #1D9BF0;
  2650. &.disable {
  2651. background: #D9D9D9;
  2652. img {
  2653. width: 20px;
  2654. margin-right: 10px;
  2655. }
  2656. }
  2657. }
  2658. }
  2659. }
  2660. .dialog-mask {
  2661. position: absolute;
  2662. z-index: 2001;
  2663. top: 0;
  2664. left: 0;
  2665. width: 100%;
  2666. height: 100%;
  2667. background-color: rgba(0, 0, 0, 0.5);
  2668. }
  2669. :deep() .vue-cropper {
  2670. background-image: none;
  2671. }
  2672. :deep() .cropper-modal {
  2673. background: rgba(0, 0, 0, .05);
  2674. }
  2675. </style>