give-dialog.vue 87 KB

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