give-dialog.vue 107 KB

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