give-dialog.vue 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841
  1. <template>
  2. <div class="overlay" v-if="visible">
  3. <div class="content"
  4. :style="{
  5. height: dialogHeight + 'px',
  6. width: showComType != 'preview' ? '600px' : 'auto'}">
  7. <div class="pop-mask"
  8. v-show="showCurrencyPop"
  9. @click.stop="showCurrencyPop = false"></div>
  10. <!-- 头部 -->
  11. <div class="head">
  12. <div class="left">
  13. <!-- 关闭按钮 -->
  14. <div class="close-btn" @click="close">
  15. <img class="icon-close"
  16. :src="require('@/assets/svg/icon-close.svg')"
  17. v-if="showComType == 'default'"/>
  18. <img class="icon-close"
  19. :src="require('@/assets/svg/icon-back.svg')"
  20. v-else/>
  21. </div>
  22. <!-- 标题 -->
  23. <div class="title">
  24. {{ currentComData[showComType]["title"] }}
  25. </div>
  26. </div>
  27. <div class="right">
  28. <!-- 更多按钮 -->
  29. <img :src="require('@/assets/svg/icon-more-l.svg')"
  30. class="more"
  31. @click="showMoreOption = true">
  32. <div class="area-option"
  33. v-if="showMoreOption"
  34. @click="showMoreOption = false">
  35. <div class="option">
  36. <div class="item" @click="goTransactionsList()">
  37. <img :src="require('@/assets/svg/icon-menu.svg')">
  38. <span>Transaction History</span>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- 内容 -->
  45. <div class="body">
  46. <img src="@/assets/gif/icon-guide-select.gif"
  47. class="icon-guide-select"
  48. v-if="!currentCurrencyInfo.currencyCode && showComType == 'default'">
  49. <!-- 充值组件 -->
  50. <top-up v-if="showComType == 'topUp'"
  51. :asyncIng="asyncIng"
  52. :currentCurrencyInfo="tempCurrentCurrencyInfo"
  53. @topUpDone="topUpDone"></top-up>
  54. <!-- 表单填写容器 -->
  55. <div class="body-content" v-if="showComType != 'topUp'">
  56. <!-- 货币列表 -->
  57. <div class="currency-pop" v-show="showCurrencyPop">
  58. <currency-list
  59. ref="currencyListDom"
  60. @selectCurrency="selectCurrency"
  61. @setCurrencyList="setCurrentCurrencyInfo"></currency-list>
  62. </div>
  63. <div class="left" v-if="showComType != 'preview'">
  64. <div class="gift-pack-wrapper">
  65. <img class="icon"
  66. :src="require('@/assets/svg/icon-gift-pack.svg')"/>
  67. </div>
  68. <div class="bottom">
  69. </div>
  70. </div>
  71. <div class="right"
  72. :class="{'fill-right': showComType == 'preview'}">
  73. <div class="form-wrapper" v-if="showComType == 'default'">
  74. <img
  75. class="img-mode"
  76. :src="require('@/assets/svg/img-mode.svg')"
  77. />
  78. <!-- 金额、数量 -->
  79. <div class="form-base">
  80. <div class="item currency-select-wrapper">
  81. <div
  82. class="label currency-select"
  83. :class="{'selected': currentCurrencyInfo.currencyCode}"
  84. @click="selectCurrencyPopHandle"
  85. >
  86. <img v-if="currentCurrencyInfo.iconPath"
  87. class="icon"
  88. :src="currentCurrencyInfo.iconPath"
  89. />
  90. <div class="text">
  91. {{currentCurrencyInfo.currencyCode == 'USD' ? 'USD' : currentCurrencyInfo.tokenSymbol || 'Select a reward'}}
  92. </div>
  93. <img
  94. class="arrow"
  95. :src="currentCurrencyInfo.currencyCode ?
  96. require('@/assets/svg/icon-form-arrow-down.svg') : require('@/assets/svg/icon-form-white-arrow-down.svg')
  97. "
  98. />
  99. </div>
  100. <input
  101. v-model="baseFormData.amountValue"
  102. placeholder="0"
  103. autofocus
  104. @input="onAmountInput"
  105. @blur="onAmountBlur"
  106. />
  107. </div>
  108. <div class="item">
  109. <div class="label">
  110. <img
  111. class="icon"
  112. :src="
  113. require('@/assets/svg/icon-winners.svg')
  114. "
  115. />
  116. Winners
  117. </div>
  118. <input
  119. v-model="baseFormData.totalCount"
  120. placeholder="0"
  121. @input="onCountInput"
  122. @blur="onCountBlur"
  123. />
  124. </div>
  125. </div>
  126. <!-- 刷新按钮、充值 -->
  127. <div class="form-base-help" v-show="currentCurrencyInfo.currencyCode">
  128. <div class="currency-operation">
  129. <div class="balance">
  130. <img
  131. :src="
  132. require('@/assets/svg/icon-balance.svg')
  133. "
  134. />
  135. Balance
  136. </div>
  137. <div class="amount">
  138. {{currentCurrencyInfo.balance}}
  139. <img
  140. :class="{ 'icon-refresh-rotate': refreshRotate }"
  141. @click="updateCurrencyBanlce"
  142. :src="
  143. require('@/assets/svg/icon-form-refresh.svg')
  144. "
  145. />
  146. </div>
  147. <div v-if="currentCurrencyInfo.currencyCode != 'USD'" class="top-up" @click="goTopUp">Deposit</div>
  148. </div>
  149. <div class="msg">
  150. Recommend winners 100~10000
  151. </div>
  152. </div>
  153. <div class="form-label">Tasks</div>
  154. <!-- 转推、like、关注 -->
  155. <div class="form-require">
  156. <div
  157. class="form-item"
  158. v-for="(item, index) in formList"
  159. :key="index"
  160. >
  161. <div class="item-left">
  162. <div class="label">
  163. <img
  164. class="icon"
  165. :src="item.icon"
  166. />
  167. {{ item.label }}
  168. </div>
  169. <div
  170. class="control"
  171. v-if="item.nodeType == 'textarea'"
  172. >
  173. <follow-input
  174. :isAddSelf="!isBack"
  175. :atUserList="atUserList"
  176. @addUser="addFollowUser"
  177. @setUser="setFollowUser"
  178. @delUser="delFollowUser"
  179. ></follow-input>
  180. </div>
  181. <!-- join discord -->
  182. <div
  183. class="control"
  184. v-if="item.nodeType == 'input'"
  185. >
  186. <div v-if="showDiscordInvitePop"
  187. class="discord-invite-info"
  188. @click="showDiscordInvitePop = false">
  189. <img class="icon" :src="discordInviteInfo.icon || require('@/assets/svg/icon-discord-mini.svg')" />
  190. <span class="name">{{discordInviteInfo.name}}</span>
  191. </div>
  192. <input v-model="item.text"
  193. placeholder="Enter discord invite link"
  194. class="discord-address"
  195. @input="onIptDiscordAddress($event, index)"
  196. @blur="onBlurDiscordAddress($event, index)" />
  197. </div>
  198. </div>
  199. <el-switch
  200. v-if="item.type == 2 || item.type == 7"
  201. v-model="item.checked"
  202. @change="formSwitchChange($event, item, index)"
  203. />
  204. <img
  205. v-if="item.type == 3"
  206. :src="
  207. require('@/assets/svg/icon-option-checked.svg')
  208. "
  209. />
  210. </div>
  211. </div>
  212. <!-- 机器人 -->
  213. <!-- <div class="anti-bot-wrapper">
  214. <div class="label">
  215. <img
  216. :src="
  217. require('@/assets/svg/icon-anti-bot.svg')
  218. "
  219. class="icon-bot"
  220. />
  221. Anti Bot
  222. <img
  223. :src="
  224. require('@/assets/svg/icon-beta.svg')
  225. "
  226. class="icon-beta"
  227. />
  228. <img
  229. :src="
  230. require('@/assets/svg/icon-question.svg')
  231. "
  232. class="icon-question"
  233. />
  234. </div>
  235. <el-switch v-model="openAntiBot" />
  236. </div> -->
  237. <!-- 提示 -->
  238. <ul class="tips-wrapper">
  239. <li class="row">
  240. Rewards can only be claimed after the target user completes all tasks you set.
  241. </li>
  242. <li class="row">
  243. Each user can only receive a reward once per task.
  244. </li>
  245. <li class="row">
  246. 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.
  247. </li>
  248. </ul>
  249. <div class="submit-btn-wrapper">
  250. <div class="submit-btn"
  251. :class="{ 'disabled-submit': iptErrMsgTxt != '' && !depositGuide }"
  252. @click="confirm">
  253. <img
  254. class="icon-loading"
  255. v-if="submitIng"
  256. :src="
  257. require('@/assets/svg/icon-btn-loading.svg')
  258. "
  259. />
  260. {{iptErrMsgTxt ? iptErrMsgTxt : 'NEXT'}}
  261. </div>
  262. </div>
  263. </div>
  264. <!-- 预览 -->
  265. <template v-else-if="showComType == 'preview'">
  266. <preview-card
  267. :currentCurrencyInfo="currentCurrencyInfo"
  268. :postData="publishRes"
  269. :baseFormData="baseFormData"
  270. :amountFontSize="previewFontSize"
  271. ></preview-card>
  272. </template>
  273. <!-- paypal支付按钮 -->
  274. <div v-show="showComType == 'preview'">
  275. <paypal-button
  276. :finalAmountData="finalAmountData"
  277. :payConfig="{
  278. paypalClientId,
  279. feeDesc: payConfig.feeDesc,
  280. paypalHtml,
  281. amount: baseFormData.amountValue,
  282. postId
  283. }"
  284. :currentCurrencyInfo="currentCurrencyInfo"
  285. @payPalFinsh="payPalFinsh"
  286. ></paypal-button>
  287. </div>
  288. </div>
  289. </div>
  290. </div>
  291. </div>
  292. <!-- 提示 -->
  293. <message-box
  294. :dialogVisible="showMessageBox"
  295. :title="messageBoxData.title"
  296. :content="messageBoxData.content"
  297. @cancel="messageBoxCancel"
  298. @confirm="messageBoxConfirm"
  299. ></message-box>
  300. </div>
  301. </template>
  302. <script setup>
  303. import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick } from "vue";
  304. import { postPublish, verifyPaypalResult, syncChainTokenRechargeRecord, getCurrencyInfoByCode } from "@/http/publishApi";
  305. import { getInviteGuildInfo, saveInviteGuildInfo } from "@/http/discordApi";
  306. import { payCalcFee, getPayConfig } from "@/http/pay";
  307. import { getFrontConfig } from "@/http/account";
  308. import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
  309. import { debounce } from "@/uilts/help"
  310. import Report from "@/log-center/log"
  311. import { ElMessage, ElLoading } from "element-plus";
  312. import "element-plus/es/components/message/style/css";
  313. import {create, all} from "mathjs";
  314. import messageBox from "@/view/components/message-box.vue";
  315. import currencyList from "@/view/components/currency-list.vue";
  316. import previewCard from "@/view/iframe/publish/components/preview-card";
  317. import followInput from "@/view/iframe/publish/components/follow-input";
  318. import paypalButton from "@/view/iframe/publish/components/paypal-button";
  319. import topUp from "@/view/iframe/publish/components/top-up.vue";
  320. const config = {
  321. number: 'BigNumber',
  322. }
  323. const math = create(all, config);
  324. //临时货币信息
  325. let tempCurrentCurrencyInfo = ref({});
  326. let paypalClientId = ref("");
  327. let payConfig = ref({});
  328. let paypalHtml = ref("");
  329. // 发布后返回的结果
  330. let publishRes = reactive({});
  331. //弹窗是否展示
  332. let visible = ref(false);
  333. //弹窗高度
  334. let dialogHeight = ref(680);
  335. // 当前展示组件内容 default(表单) preview(预览) topUp(充值)
  336. let showComType = ref("default");
  337. let currentComData = {
  338. default: {
  339. title: "Giveaway",
  340. },
  341. preview: {
  342. title: "Preview",
  343. },
  344. topUp: {
  345. title: "Deposit",
  346. },
  347. };
  348. // 机器人开关
  349. let openAntiBot = ref(false);
  350. // 是否正在提交
  351. let submitIng = ref(false);
  352. // 艾特关注人列表
  353. let atUserList = ref([]);
  354. // 表单错误提示
  355. let iptErrMsgTxt = ref("Select a reward");
  356. // 是否返回
  357. let isBack = ref(false);
  358. // 展示消息提示
  359. let showMessageBox = ref(false);
  360. // 展示货币列表pop
  361. let showCurrencyPop = ref(false);
  362. // 展示更多按钮下的选项
  363. let showMoreOption = ref(false);
  364. // 货币列表的dom
  365. let currencyListDom = ref('');
  366. // 刷新按钮旋转
  367. let refreshRotate = ref(false);
  368. // 预览字体大小
  369. let previewFontSize = ref(56);
  370. let postId = ref('');
  371. // 余额是否同步中
  372. let asyncIng = ref(false);
  373. // 提交按钮-充值引导提示
  374. let depositGuide = ref(false);
  375. let messageBoxData = ref({
  376. title: "",
  377. content: "",
  378. });
  379. // 真实支付金额数据
  380. let finalAmountData = ref({
  381. currencyCode: '',
  382. feeAmountValue: 0,
  383. finalAmountValue: 0,
  384. requestAmountValue: 0,
  385. });
  386. // 表单数据
  387. let baseFormData = reactive({
  388. amountCurrencyCode: '',
  389. amountValue: "",
  390. totalCount: "",
  391. });
  392. // 当前选择的货币信息
  393. let currentCurrencyInfo = ref({
  394. currencyCode: "",
  395. currencyName: "",
  396. balance: "",
  397. currencyType: "",
  398. iconPath: "",
  399. minAmount: "",
  400. tokenChain: "",
  401. tokenSymbol: "",
  402. usdEstimateBalance: ""
  403. });
  404. const discordIptErrTxt = 'Discord invite link is wrong';
  405. const discordIptEmptyErrTxt = 'Enter discord invite link';
  406. let iptErrType = ''; //discord
  407. let formList = reactive([
  408. {
  409. label: "Follow",
  410. icon: require("@/assets/svg/icon-follow.svg"),
  411. nodeType: "textarea",
  412. type: 1,
  413. text: [],
  414. checked: true,
  415. },
  416. {
  417. label: "Retweet",
  418. icon: require("@/assets/svg/icon-retweet.svg"),
  419. nodeType: "div",
  420. type: 3,
  421. checked: true,
  422. },
  423. {
  424. label: "Like Tweet",
  425. icon: require("@/assets/svg/icon-like.svg"),
  426. nodeType: "div",
  427. type: 2,
  428. checked: true,
  429. },
  430. {
  431. label: "Join Discord",
  432. icon: require("@/assets/svg/icon-discord-mini.svg"),
  433. nodeType: "input",
  434. text: '',
  435. type: 7,
  436. checked: true,
  437. },
  438. ]);
  439. const discordInviteInfo = ref({});
  440. let showDiscordInvitePop = ref(false);
  441. const props = defineProps({
  442. dialogVisible: {
  443. type: Boolean,
  444. default: false,
  445. },
  446. });
  447. watch(
  448. () => props.dialogVisible,
  449. (newVal) => {
  450. console.log("watch", newVal);
  451. visible.value = newVal;
  452. if (newVal) {
  453. Report.reportLog({
  454. pageSource: Report.pageSource.publisherDialog,
  455. businessType: Report.businessType.pageView,
  456. });
  457. getLocalCurrencyInfoByCode();
  458. setTimeout(() => {
  459. setDialogHeight();
  460. }, 300);
  461. }
  462. }
  463. );
  464. const emits = defineEmits(["close", "confirm", "payPalFinsh"]);
  465. const close = () => {
  466. if (showComType.value != "default") {
  467. showComType.value = "default";
  468. calcDomZoom();
  469. isBack.value = true;
  470. } else {
  471. initParams();
  472. emits("close", false);
  473. }
  474. };
  475. /**
  476. * 设置弹窗高度
  477. */
  478. const setDialogHeight = (resize = false) => {
  479. nextTick(() => {
  480. let clientHeight = window.innerHeight;
  481. let gapSafe = 40;
  482. console.log('resize',resize)
  483. if (dialogHeight.value > clientHeight - gapSafe) {
  484. dialogHeight.value = clientHeight - gapSafe;
  485. } else {
  486. if(resize) {
  487. dialogHeight.value = 680;
  488. }
  489. }
  490. })
  491. };
  492. const selectCurrencyPopHandle = () => {
  493. Report.reportLog({
  494. pageSource: Report.pageSource.currencySelectorPage,
  495. businessType: Report.businessType.pageView,
  496. });
  497. showCurrencyPop.value = true;
  498. nextTick(() => {
  499. if(currencyListDom.value) {
  500. currencyListDom.value.getCurrencyInfoList && currencyListDom.value.getCurrencyInfoList();
  501. }
  502. })
  503. }
  504. /**
  505. * 获取实际支付金额
  506. */
  507. const getPayAmount = async (amountValue) => {
  508. let res = await payCalcFee({
  509. params: {
  510. amountValue,
  511. currencyCode: currentCurrencyInfo.value.currencyCode,
  512. payChannel: 'paypal',
  513. },
  514. });
  515. if (res.code == 0) {
  516. let { finalAmountValue, feeDesc } = res.data;
  517. payConfig.value.feeDesc = feeDesc;
  518. if (finalAmountValue > 0) {
  519. finalAmountData.value = res.data;
  520. }
  521. }
  522. return res.data;
  523. };
  524. const saveDiscordGuildInfo = () => {
  525. let {guildId, inviteCode, inviteUrl} = discordInviteInfo.value;
  526. if(guildId && inviteCode && inviteUrl) {
  527. saveInviteGuildInfo({
  528. params: {
  529. guildId,
  530. inviteCode,
  531. inviteUrl
  532. }
  533. })
  534. }
  535. }
  536. const confirm = () => {
  537. if(depositGuide.value) { //余额不够去充值
  538. goTopUp();
  539. return;
  540. }
  541. if (submitIng.value || iptErrMsgTxt.value) {
  542. return;
  543. }
  544. let { totalCount = 0 } = baseFormData;
  545. if (!totalCount) {
  546. return;
  547. }
  548. saveDiscordGuildInfo();
  549. submitRequest();
  550. };
  551. /**
  552. * 货币列表-选中货币
  553. */
  554. const selectCurrency = (params) => {
  555. tempCurrentCurrencyInfo.value = params;
  556. depositGuide.value = false;
  557. if(params.currencyCode != "USD" && params.balance < params.minAmount) {
  558. let tokenSymbol = params.currencyCode == 'USD' ? 'USD' : params.tokenSymbol;
  559. messageBoxBlock({
  560. title: `Whether to deposit ${tokenSymbol}`,
  561. content: `Insufficient ${tokenSymbol} balance`,
  562. });
  563. } else {
  564. currentCurrencyInfo.value = params;
  565. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  566. showCurrencyPop.value = false;
  567. finalAmountData.value.currencyCode = currentCurrencyInfo.value.currencyCode;
  568. calcDomZoom();
  569. resetFormIpt();
  570. onIptSetErrorTxt();
  571. }
  572. };
  573. const calcDomZoom = () => {
  574. nextTick(() => {
  575. let maxWidth = 68;
  576. var textWidth = document.querySelector('.text').offsetWidth;
  577. if(textWidth > 68) {
  578. var scale = maxWidth / textWidth;
  579. document.querySelector('.text').style.zoom = scale;
  580. }
  581. })
  582. }
  583. const resetFormIpt = () => {
  584. baseFormData.amountValue = "";
  585. baseFormData.totalCount = "";
  586. }
  587. const setLocalSelectCurrencyInfo = (params = {}) => {
  588. setChromeStorage({ selectCurrencyInfo : JSON.stringify(params)})
  589. }
  590. /**
  591. * 获取完货币列表
  592. */
  593. const setCurrentCurrencyInfo = (params) => {
  594. }
  595. const messageBoxBlock = ({ title = "", content = "" }) => {
  596. showMessageBox.value = true;
  597. messageBoxData.value.title = title;
  598. messageBoxData.value.content = content;
  599. };
  600. /**
  601. * 确定
  602. */
  603. const messageBoxConfirm = () => {
  604. showMessageBox.value = false;
  605. goTopUp();
  606. };
  607. /**
  608. * 取消
  609. */
  610. const messageBoxCancel = () => {
  611. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  612. setLocalSelectCurrencyInfo(currentCurrencyInfo.value);
  613. showMessageBox.value = false;
  614. showCurrencyPop.value = false;
  615. calcDomZoom();
  616. resetFormIpt();
  617. onIptSetErrorTxt();
  618. };
  619. /**
  620. * 去充值
  621. */
  622. const goTopUp = () => {
  623. Report.reportLog({
  624. pageSource: Report.pageSource.rechargePage,
  625. businessType: Report.businessType.pageView,
  626. });
  627. showComType.value = 'topUp';
  628. }
  629. /**
  630. * 充值done事件
  631. */
  632. const topUpDone = () => {
  633. currentCurrencyInfo.value = tempCurrentCurrencyInfo.value;
  634. asyncIng.value = true;
  635. depositGuide.value = false;
  636. asyncIng.value = false;
  637. showCurrencyPop.value = false;
  638. showComType.value = 'default';
  639. calcDomZoom();
  640. onIptSetErrorTxt()
  641. asyncTokenRechRecord((res) => {
  642. if(res.code == 0 && res.data && res.data.length) {
  643. let currencyInfo = res.data[0];
  644. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  645. currentCurrencyInfo.value.balance = currencyInfo.balance;
  646. onIptSetErrorTxt()
  647. }
  648. }
  649. })
  650. }
  651. /**
  652. * 更新货币余额
  653. */
  654. const updateCurrencyBanlce = () => {
  655. if(!refreshRotate.value) {
  656. refreshRotate.value = true;
  657. setTimeout(() => {
  658. refreshRotate.value = false;
  659. }, 1000)
  660. }
  661. asyncTokenRechRecord((res) => {
  662. if(res.code == 0 && res.data && res.data.length) {
  663. let currencyInfo = res.data[0];
  664. if(currencyInfo.currencyCode == currentCurrencyInfo.value.currencyCode) {
  665. currentCurrencyInfo.value.balance = currencyInfo.balance;
  666. }
  667. }
  668. })
  669. }
  670. /**
  671. * 同步链上交易
  672. */
  673. const asyncTokenRechRecord = (cb) => {
  674. syncChainTokenRechargeRecord({
  675. params: {
  676. currencyCode: currentCurrencyInfo.value.currencyCode
  677. }
  678. }).then(res => {
  679. cb && cb(res)
  680. })
  681. }
  682. /**
  683. * 提交表单请求
  684. */
  685. const submitRequest = async () => {
  686. let { amountValue = 0, totalCount = 0 } = baseFormData;
  687. baseFormData.amountCurrencyCode = currentCurrencyInfo.value.currencyCode;
  688. // 组装提交参数
  689. formList[0]["text"] = atUserList.value;
  690. let finishConditions = [];
  691. for (let i = 0; i < formList.length; i++) {
  692. let item = {};
  693. item.type = formList[i]["type"];
  694. if (item.type == 1 && formList[i]["text"]) {
  695. // follow 参数
  696. let relatedUsers = formList[i]["text"];
  697. item.relatedUsers = relatedUsers;
  698. finishConditions.push(item);
  699. } else if (formList[i]["type"] == 7) {
  700. // join discord
  701. if(formList[i]["checked"] && formList[i]["text"]) {
  702. item.bizData = JSON.stringify({inviteUrl: formList[i]["text"]});
  703. finishConditions.push(item);
  704. }
  705. } else if (formList[i]["checked"]) {
  706. finishConditions.push(item);
  707. }
  708. }
  709. let receiveConditions = openAntiBot.value ? "" : [];
  710. // 提交参数
  711. let formData = {
  712. amountCurrencyCode: baseFormData.amountCurrencyCode,
  713. amountValue,
  714. totalCount,
  715. finishConditions,
  716. receiveConditions,
  717. payAmountValue: amountValue
  718. };
  719. submitIng.value = true;
  720. // 法币支付需要计算费率
  721. if(formData.amountCurrencyCode == "USD") {
  722. let payAmountRes = await getPayAmount(amountValue);
  723. formData["payAmountValue"] = payAmountRes.finalAmountValue;
  724. }
  725. let data = {
  726. params: {
  727. postBizData: JSON.stringify(formData),
  728. postSrc: 1, //1 twitter
  729. postType: 1, //1 红包
  730. },
  731. };
  732. postPublish(data).then((res) => {
  733. submitIng.value = false;
  734. if (res.code == 0) {
  735. publishRes = res.data;
  736. postId.value = res.data.postId;
  737. Report.reportLog({
  738. pageSource: Report.pageSource.previewPage,
  739. businessType: Report.businessType.pageView,
  740. });
  741. showComType.value = "preview";
  742. previewFontSize.value = calcFontSize(baseFormData.amountValue, 238, 56);
  743. isBack.value = false;
  744. } else {
  745. console.log(res);
  746. }
  747. })
  748. .catch((err) => {
  749. console.log(err);
  750. });
  751. };
  752. const calcFontSize = (str, domWidth, maxSize) => {
  753. let lenstr = str.length;
  754. let num = parseInt(domWidth / lenstr);
  755. let fontSize = num < maxSize ? num : maxSize
  756. return fontSize;
  757. }
  758. /**
  759. * 初始化提交参数
  760. */
  761. const initParams = () => {
  762. resetFormIpt();
  763. // clear follow value
  764. formList[0].text = [];
  765. atUserList.value = [];
  766. submitIng.value = false;
  767. isBack.value = false;
  768. showCurrencyPop.value = false;
  769. openAntiBot.value = false;
  770. tempCurrentCurrencyInfo.value = {};
  771. currentCurrencyInfo.value = {};
  772. // clear discord value
  773. formList[3].text = '';
  774. discordInviteInfo.value = {};
  775. };
  776. /**
  777. * 支付完成回调
  778. */
  779. const payPalFinsh = (params) => {
  780. let {payNetwork, payStatus} = params;
  781. // token 支付
  782. if(payNetwork == 'bsc') {
  783. payStatusHandle(payStatus);
  784. } else {
  785. // 法币支付
  786. let transaction = params.transaction;
  787. let loadingInstance = ElLoading.service({
  788. background: "rgba(0,0,0,.3)",
  789. });
  790. verifyPaypalResult({
  791. params: {
  792. paypalTransactionId: transaction.id,
  793. postId: publishRes.postId,
  794. paypalClientId: paypalClientId.value,
  795. },
  796. }).then((res) => {
  797. loadingInstance.close();
  798. if (res.code == 0) {
  799. if (res.data) {
  800. payStatusHandle(res.data.payStatus)
  801. }
  802. }
  803. })
  804. .catch(() => {
  805. loadingInstance.close();
  806. });
  807. }
  808. };
  809. const payStatusHandle = (payStatus) => {
  810. //支付状态 0:未支付,1:支付成功,2:支付失败,3:已关闭,4:已退款
  811. switch (payStatus) {
  812. case 1:
  813. emits("payPalFinsh", { publishRes });
  814. showComType.value = "default";
  815. initParams();
  816. break;
  817. case 2:
  818. // ElMessage({
  819. // message: "Pay Fail",
  820. // type: "warning",
  821. // });
  822. break;
  823. case 3:
  824. // ElMessage({
  825. // message: "Pay Exceptions",
  826. // type: "warning",
  827. // });
  828. break;
  829. case 4:
  830. // ElMessage({
  831. // message: "Pay Exceptions",
  832. // type: "warning",
  833. // });
  834. break;
  835. }
  836. }
  837. /**
  838. * follow组件触发新增关注人
  839. */
  840. const addFollowUser = (params) => {
  841. atUserList.value.push(params);
  842. };
  843. const setFollowUser = (params) => {
  844. atUserList.value[params.index]["name"] = params.name;
  845. };
  846. const delFollowUser = (params) => {
  847. atUserList.value.splice(params.index, 1);
  848. };
  849. const onAmountInput = () => {
  850. let val = baseFormData.amountValue;
  851. // val = val.replace(/[^\d^\.]+/g, "");
  852. val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  853. if(val == '00') {
  854. val = '0'
  855. }
  856. if(val.indexOf('.') > -1){ //校验 例:00.12 => 0.12
  857. let arr = val.split('.');
  858. if(arr[0].startsWith('0')) {
  859. let num = +arr[0];
  860. val = num + '.' + arr[1];
  861. }
  862. }
  863. baseFormData.amountValue = val;
  864. setInputErrorMsg({from: 'amount', type:'input'});
  865. return val;
  866. };
  867. const onCountInput = () => {
  868. let val = baseFormData.totalCount;
  869. if (val == 0) {
  870. val = "";
  871. }
  872. // val = val.replace(/[^\d]/g, "");
  873. val = val.replace(/^\D*(\d*(?:\.\d{0,18})?).*$/g, '$1');
  874. baseFormData.totalCount = val;
  875. setInputErrorMsg({from: 'count', type:'input'});
  876. return val;
  877. };
  878. /**
  879. * 金额输入失焦
  880. */
  881. const onAmountBlur = () => {
  882. setInputErrorMsg({from: 'amount', type:'blur'});
  883. };
  884. /**
  885. * count失焦,校验输入结果
  886. */
  887. const onCountBlur = () => {
  888. setInputErrorMsg({from: 'count', type:'blur'});
  889. };
  890. /**
  891. * 输入结果金额和数量 (金额/数量)是否小于最小货币单位
  892. */
  893. const calcIptValue = (cb) => {
  894. let amountValue = baseFormData.amountValue;
  895. let totalCount = baseFormData.totalCount;
  896. let flag = true;
  897. if (!amountValue || !totalCount) {
  898. return {
  899. flag
  900. };
  901. }
  902. if (math.format(math.evaluate(`${baseFormData.amountValue} / ${baseFormData.totalCount}`)) < +currentCurrencyInfo.value.minAmount) {
  903. flag = false;
  904. }
  905. return {
  906. flag,
  907. count: Math.floor(math.format(math.evaluate(`${baseFormData.amountValue} / ${currentCurrencyInfo.value.minAmount}`)))
  908. }
  909. };
  910. /**
  911. * 设置输入提示语
  912. */
  913. const setInputErrorMsg = () => {
  914. onIptSetErrorTxt();
  915. };
  916. /**
  917. * 输入时 检测设置错误信息
  918. */
  919. const onIptSetErrorTxt = (params = {}) => {
  920. depositGuide.value = false;
  921. if(!currentCurrencyInfo.value.currencyCode) {
  922. iptErrMsgTxt.value = "Select a reward"
  923. } else if (!baseFormData.amountValue || baseFormData.amountValue == '0') {
  924. iptErrMsgTxt.value = "Enter an amount";
  925. } else if (!baseFormData.totalCount || baseFormData.totalCount == '0') {
  926. iptErrMsgTxt.value = "Enter the number of winners";
  927. } else if(+baseFormData.amountValue <= +currentCurrencyInfo.value.balance) {
  928. let res = calcIptValue();
  929. if (!res.flag) {
  930. iptErrMsgTxt.value = `${baseFormData.amountValue} ${currentCurrencyInfo.value.tokenSymbol} Can send up to ${res.count} winners`;
  931. } else {
  932. iptErrMsgTxt.value = "";
  933. if(params.actionType != 'discord_blur') {
  934. setDiscordErrTxt();
  935. }
  936. }
  937. } else if(currentCurrencyInfo.value.currencyCode != 'USD') {
  938. depositGuide.value = true;
  939. iptErrMsgTxt.value = `Insufficient ${currentCurrencyInfo.value.tokenSymbol} balance, please deposit`;
  940. }
  941. }
  942. /**
  943. * 监听开关触发事件
  944. */
  945. const formSwitchChange = (val, params, index) => {
  946. console.log('formSwitchChange')
  947. if(!val) {
  948. if(params.type == 7) {
  949. //错误类型 discord 清空discord错误校验
  950. if(iptErrType == 'discord') {
  951. iptErrMsgTxt.value = '';
  952. formList[index]['text'] = '';
  953. onIptSetErrorTxt();
  954. }
  955. }
  956. }
  957. }
  958. /** 监听 discord 输入 */
  959. const onIptDiscordAddress = (e, index) => {
  960. let val = formList[index].text;
  961. let checked = formList[index].checked;
  962. if(val && !checked) {
  963. checked = true;
  964. formList[index].checked = checked;
  965. formList[index].text = formList[index].text.replace(/\s/g,'');
  966. }
  967. onIptDiscordDebounce()
  968. }
  969. const onBlurDiscordAddress = (e, index) => {
  970. setDiscordErrTxt({fromType: 'discord', showPop: false, actionType: 'discord_blur'});
  971. }
  972. const getDiscordIptData = () => {
  973. let discordItem = formList.find(item => item.type == 7);
  974. return discordItem;
  975. }
  976. /**
  977. * 设置输入discord错误提示信息
  978. */
  979. const setDiscordErrTxt = (params = {showPop: false}) => {
  980. let discordData = getDiscordIptData() || {};
  981. if(discordData.checked) {
  982. if(discordData.text) {
  983. let validata = checkInviteUrl(discordData.text);
  984. if(validata) {
  985. getDiscordInviteInfo(discordData.text, (res) => {
  986. console.log('discordData',res)
  987. // 未知的邀请链接
  988. if(res.inviteCode != res.data.code || !res.data.guildId) {
  989. iptErrMsgTxt.value = discordIptErrTxt;
  990. iptErrType = 'discord';
  991. } else {
  992. if(iptErrMsgTxt.value) {
  993. iptErrMsgTxt.value = '';
  994. iptErrType = '';
  995. }
  996. if(params.showPop && res.data) {
  997. showDiscordInvitePop.value = true;
  998. setTimeout(() => {
  999. showDiscordInvitePop.value = false;
  1000. }, 2000)
  1001. }
  1002. if(params.fromType == 'discord') {
  1003. onIptSetErrorTxt();
  1004. }
  1005. }
  1006. })
  1007. } else {
  1008. iptErrMsgTxt.value = discordIptErrTxt;
  1009. iptErrType = 'discord';
  1010. }
  1011. } else {
  1012. if(params.actionType == 'discord_blur') {
  1013. onIptSetErrorTxt({acitonType: 'discord_blur'});
  1014. } else {
  1015. // 设置空提示
  1016. iptErrMsgTxt.value = discordIptEmptyErrTxt;
  1017. iptErrType = 'discord';
  1018. }
  1019. }
  1020. }
  1021. }
  1022. const onIptDiscordDebounce = debounce(function() {
  1023. setDiscordErrTxt({fromType: 'discord', showPop: true});
  1024. }, 800)
  1025. /**
  1026. * 校验 discord邀请url
  1027. */
  1028. const checkInviteUrl = (inviteUrl) => {
  1029. let flag = false;
  1030. const INVITE_URL_PREFIX_1 = 'https://discord.gg/';
  1031. const INVITE_URL_PREFIX_2 = 'https://discord.com/invite/';
  1032. const INVITE_URL_PREFIX_3 = 'http://discord.gg/';
  1033. const INVITE_URL_PREFIX_4 = 'http://discord.com/invite/';
  1034. const INVITE_URL_PREFIX_5 = 'discord.gg/';
  1035. const INVITE_URL_PREFIX_6 = 'discord.com/invite/';
  1036. 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]
  1037. if(inviteUrl) {
  1038. if(arr.indexOf(inviteUrl) > -1) {
  1039. flag = false;
  1040. } else {
  1041. let isPass = false;
  1042. for(let i = 0; i < arr.length; i++) {
  1043. let item = arr[i];
  1044. if(inviteUrl.startsWith(item)) {
  1045. isPass = true;
  1046. break;
  1047. }
  1048. }
  1049. flag = isPass;
  1050. }
  1051. }
  1052. return flag;
  1053. }
  1054. /**获取discord 邀请信息 */
  1055. const getDiscordInviteInfo = (inviteUrl, cb) => {
  1056. if(!inviteUrl) return;
  1057. let inviteCode = '';
  1058. let arr = inviteUrl.split('/');
  1059. if(arr.length > 0) {
  1060. inviteCode = arr[arr.length - 1];
  1061. }
  1062. if(discordInviteInfo.value.guildId && discordInviteInfo.value.inviteCode == inviteCode) {
  1063. return;
  1064. }
  1065. getInviteGuildInfo({
  1066. inviteCode
  1067. }).then(res => {
  1068. if(!res) {
  1069. res = {};
  1070. }
  1071. let {name, icon, id} = res.guild || {};
  1072. icon = icon && id ? `https://cdn.discordapp.com/icons/${id}/${icon}.png` : '';
  1073. let resData = {
  1074. inviteCode,
  1075. data: {
  1076. code: res.code,
  1077. guildId: id,
  1078. inviteUrl,
  1079. inviteCode,
  1080. name,
  1081. icon,
  1082. }
  1083. }
  1084. discordInviteInfo.value = resData.data;
  1085. cb && cb(resData);
  1086. }).catch((err) => {
  1087. if(iptErrMsgTxt.value && iptErrType == 'discord') {
  1088. iptErrMsgTxt.value = '';
  1089. iptErrType = '';
  1090. }
  1091. });
  1092. }
  1093. /**
  1094. * 获取支付配置(paypalClientId)
  1095. */
  1096. const setPayConfig = () => {
  1097. getPayConfig({
  1098. params: {},
  1099. }).then((res) => {
  1100. if (res.code == 0) {
  1101. payConfig.value = res.data;
  1102. paypalClientId.value = res.data.paypalClientId;
  1103. }
  1104. });
  1105. };
  1106. /**
  1107. * 获取配置
  1108. */
  1109. const setFrontConfig = () => {
  1110. getFrontConfig({
  1111. params: {},
  1112. }).then((res) => {
  1113. if (res.code == 0) {
  1114. paypalHtml.value = res.data.paypalHtml;
  1115. }
  1116. });
  1117. };
  1118. const goTransactionsList = () => {
  1119. window.open(`${chrome.runtime.getURL('/iframe/home.html#/transactions')}`)
  1120. }
  1121. /**
  1122. * 默认获取上次选中的货币信息
  1123. */
  1124. const getLocalCurrencyInfoByCode = () => {
  1125. if(!currentCurrencyInfo.value.currencyCode) {
  1126. getChromeStorage('selectCurrencyInfo', (res) => {
  1127. if(res && res.currencyCode) {
  1128. getCurrencyInfoByCode({
  1129. params: {
  1130. currencyCode: res.currencyCode
  1131. }
  1132. }).then(res => {
  1133. if(res.code == 0 && res.data) {
  1134. currentCurrencyInfo.value = res.data;
  1135. tempCurrentCurrencyInfo.value = res.data;
  1136. onIptSetErrorTxt();
  1137. }
  1138. });
  1139. }
  1140. })
  1141. }
  1142. }
  1143. onMounted(() => {
  1144. setFrontConfig();
  1145. setPayConfig();
  1146. getLocalCurrencyInfoByCode();
  1147. document.onkeydown = function (e) {
  1148. var keyNum = window.event ? e.keyCode : e.which;
  1149. let escKey = 27;
  1150. if (keyNum == escKey) {
  1151. if (visible.value) {
  1152. // close();
  1153. }
  1154. }
  1155. };
  1156. window.addEventListener('resize', function () {
  1157. setDialogHeight(true);
  1158. })
  1159. });
  1160. </script>
  1161. <style lang="scss" scoped>
  1162. .overlay {
  1163. position: fixed;
  1164. top: 0;
  1165. right: 0;
  1166. bottom: 0;
  1167. left: 0;
  1168. z-index: 2000;
  1169. height: 100%;
  1170. background-color: rgba(0, 0, 0, 0.5);
  1171. overflow: auto;
  1172. .content {
  1173. height: 620px;
  1174. background: #ffffff;
  1175. border-radius: 20px;
  1176. position: absolute;
  1177. left: 50%;
  1178. top: 50%;
  1179. transform: translate(-50%, -50%);
  1180. box-sizing: border-box;
  1181. z-index: 2000;
  1182. .pop-mask {
  1183. width: 100%;
  1184. height:100%;
  1185. position: absolute;
  1186. z-index:900;
  1187. }
  1188. .head {
  1189. border-bottom: 1px solid #ececec;
  1190. height: 48px;
  1191. box-sizing: border-box;
  1192. display: flex;
  1193. align-items: center;
  1194. justify-content: space-between;
  1195. padding: 0 14px;
  1196. .left {
  1197. display: flex;
  1198. align-items: center;
  1199. .title {
  1200. font-size: 16px;
  1201. font-weight: 500;
  1202. }
  1203. .close-btn {
  1204. display: flex;
  1205. align-items: center;
  1206. width: max-content;
  1207. margin-right: 12px;
  1208. cursor: pointer;
  1209. }
  1210. }
  1211. .right {
  1212. .more {
  1213. cursor: pointer;
  1214. }
  1215. .area-option {
  1216. width: 100%;
  1217. height: 100%;
  1218. position: absolute;
  1219. top: 0;
  1220. left: 0;
  1221. z-index: 111;
  1222. .option {
  1223. position: absolute;
  1224. top: 43px;
  1225. right: 15px;
  1226. background: #fff;
  1227. filter: drop-shadow(0px 3px 20px rgba(0, 0, 0, 0.2));
  1228. width: 240px;
  1229. border-radius: 15px;
  1230. overflow: hidden;
  1231. .item {
  1232. width: 100%;
  1233. height: 50px;
  1234. display: flex;
  1235. align-items: center;
  1236. cursor: pointer;
  1237. border-top: 1px solid #E9E9E9;
  1238. img {
  1239. margin-left: 15px;
  1240. width: 30px;
  1241. height: 30px;
  1242. margin-right: 6px;
  1243. }
  1244. span {
  1245. font-weight: 500;
  1246. font-size: 14px;
  1247. }
  1248. }
  1249. .item:first-child {
  1250. border-top: 0;
  1251. }
  1252. .item:hover {
  1253. background: #F5F5F5;
  1254. }
  1255. }
  1256. }
  1257. }
  1258. }
  1259. .body {
  1260. box-sizing: border-box;
  1261. height: calc(100% - 48px);
  1262. display: flex;
  1263. position: relative;
  1264. .icon-guide-select {
  1265. width: 40px;
  1266. position: absolute;
  1267. top: 78px;
  1268. left: 25px;
  1269. z-index: 1000;
  1270. }
  1271. .body-content {
  1272. display:flex;
  1273. width:100%;
  1274. }
  1275. .currency-pop {
  1276. position: absolute;
  1277. width: 375px;
  1278. height: 480px;
  1279. top: 85px;
  1280. left: 88px;
  1281. z-index: 1000;
  1282. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  1283. background-color: #fff;
  1284. border-radius: 20px;
  1285. overflow-y: scroll;
  1286. }
  1287. .left,
  1288. .right {
  1289. height: 100%;
  1290. }
  1291. .left {
  1292. width: 50px;
  1293. display: flex;
  1294. flex-direction: column;
  1295. justify-content: space-between;
  1296. align-items: center;
  1297. .gift-pack-wrapper {
  1298. width: 100%;
  1299. height: 55px;
  1300. background: #f5f5f5;
  1301. display: flex;
  1302. align-items: center;
  1303. justify-content: center;
  1304. }
  1305. .bottom {
  1306. .icon {
  1307. display: block;
  1308. margin-bottom: 26px;
  1309. }
  1310. }
  1311. }
  1312. .right {
  1313. width: calc(100% - 50px);
  1314. box-sizing: border-box;
  1315. position: relative;
  1316. border-left: 1px solid #ececec;
  1317. .form-wrapper {
  1318. padding: 0px 18px 18px 18px;
  1319. height: calc(100% - 80px);
  1320. overflow-y: scroll;
  1321. overflow-x: hidden;
  1322. box-sizing: border-box;
  1323. .img-mode {
  1324. margin-left: -18px;
  1325. }
  1326. .form-base-help {
  1327. display: flex;
  1328. justify-content: space-between;
  1329. margin-top: 10px;
  1330. .currency-operation:before{
  1331. box-sizing: content-box;
  1332. width: 0px;
  1333. height: 0px;
  1334. position: absolute;
  1335. top: -16px;;
  1336. left:46px;
  1337. padding:0;
  1338. border-bottom:8px solid #FFFFFF;
  1339. border-top:8px solid transparent;
  1340. border-left:8px solid transparent;
  1341. border-right:8px solid transparent;
  1342. display: block;
  1343. content:'';
  1344. z-index: 12;
  1345. }
  1346. .currency-operation:after{
  1347. box-sizing: content-box;
  1348. width: 0px;
  1349. height: 0px;
  1350. position: absolute;
  1351. top: -18px;;
  1352. left:45px;
  1353. padding:0;
  1354. border-bottom:9px solid #EAEAEA;
  1355. border-top:9px solid transparent;
  1356. border-left:9px solid transparent;
  1357. border-right:9px solid transparent;
  1358. display: block;
  1359. content:'';
  1360. z-index:10
  1361. }
  1362. .currency-operation {
  1363. position: relative;
  1364. height: 36px;
  1365. border: 1px solid #EAEAEA;
  1366. box-sizing: border-box;
  1367. padding: 10px;
  1368. display: flex;
  1369. align-items: center;
  1370. border-radius: 100px;
  1371. .balance,
  1372. .amount {
  1373. display: flex;
  1374. align-items: center;
  1375. }
  1376. .balance {
  1377. font-weight: 400;
  1378. font-size: 13px;
  1379. img {
  1380. width: 16px;
  1381. height: 16px;
  1382. margin-right: 3px;
  1383. }
  1384. }
  1385. .amount {
  1386. font-weight: 500;
  1387. font-size: 13px;
  1388. color: #4e4e4e;
  1389. margin-left: 5px;
  1390. img {
  1391. margin-left: 5px;
  1392. cursor: pointer;
  1393. }
  1394. }
  1395. .top-up {
  1396. font-weight: 500;
  1397. font-size: 12px;
  1398. color: #ff9839;
  1399. cursor: pointer;
  1400. margin-left: 8px;
  1401. }
  1402. .icon-refresh-rotate {
  1403. transform: rotate(360deg);
  1404. transition-duration: 1s;
  1405. }
  1406. }
  1407. .msg {
  1408. font-weight: 400;
  1409. font-size: 12px;
  1410. color: #acacac;
  1411. }
  1412. }
  1413. .form-base {
  1414. display: flex;
  1415. justify-content: space-between;
  1416. align-items: center;
  1417. margin-top: 14px;
  1418. .item {
  1419. width: 250px;
  1420. height: 50px;
  1421. box-sizing: border-box;
  1422. border-radius: 14px;
  1423. border: 1px solid #D1D9DD;
  1424. display: flex;
  1425. align-items: center;
  1426. justify-content: space-between;
  1427. padding: 16px 14px;
  1428. input {
  1429. width: 102px;
  1430. text-align: right;
  1431. font-weight: 500;
  1432. font-size: 18px;
  1433. border: none;
  1434. outline: none;
  1435. box-sizing: border-box;
  1436. }
  1437. input::placeholder {
  1438. color: #c5c5c5;
  1439. }
  1440. .label {
  1441. font-weight: 500;
  1442. font-size: 15px;
  1443. display: flex;
  1444. align-items: center;
  1445. .icon {
  1446. width: 20px;
  1447. height: 20px;
  1448. margin-right: 8px;
  1449. }
  1450. }
  1451. }
  1452. .item:first-child {
  1453. margin-right: 14px
  1454. }
  1455. .currency-select-wrapper {
  1456. padding: 0 !important;
  1457. input {
  1458. padding-right: 14px;
  1459. }
  1460. .currency-select {
  1461. max-width: 136px;
  1462. cursor: pointer;
  1463. background: #1D9BF0;
  1464. margin-left: 6px;
  1465. padding: 6px 10px;
  1466. border-radius: 12px;
  1467. color: #fff;
  1468. .text {
  1469. white-space: nowrap;
  1470. zoom: 0.85;
  1471. }
  1472. .arrow {
  1473. margin-left: 5px;
  1474. }
  1475. }
  1476. .selected {
  1477. background: #F4F4F4 !important;
  1478. color: #000 !important;
  1479. }
  1480. }
  1481. }
  1482. .form-label {
  1483. margin-top: 14px;
  1484. margin-bottom: 10px;
  1485. font-weight: 500;
  1486. font-size: 14px;
  1487. }
  1488. .form-require {
  1489. box-sizing: border-box;
  1490. border-radius: 15px;
  1491. margin-top: 12px;
  1492. border: 1px solid #D1D9DD;
  1493. .form-item {
  1494. min-height: 50px;
  1495. display: flex;
  1496. align-items: center;
  1497. justify-content: space-between;
  1498. margin: 0 16px;
  1499. border-bottom: 1px solid #ececec;
  1500. padding: 8px 0;
  1501. box-sizing: border-box;
  1502. .item-left {
  1503. display: flex;
  1504. }
  1505. .label {
  1506. min-width: 76px;
  1507. display: flex;
  1508. align-items: center;
  1509. font-size: 15px;
  1510. font-weight: 500;
  1511. .icon {
  1512. margin-right: 10px;
  1513. }
  1514. }
  1515. .control {
  1516. min-width: 280px;
  1517. margin-left: 18px;
  1518. box-sizing: border-box;
  1519. border-left: 1px solid #ECECEC;
  1520. position: relative;
  1521. .discord-address {
  1522. border: none;
  1523. outline: none;
  1524. color: #1D9BF0;
  1525. font-weight: 500;
  1526. font-size: 14px;
  1527. width: 100%;
  1528. height: 34px;
  1529. padding-left: 15px;
  1530. }
  1531. .discord-address::placeholder {
  1532. color: #c5c5c5;
  1533. }
  1534. .discord-invite-info {
  1535. position: absolute;
  1536. top: 40px;
  1537. left: 0;
  1538. box-shadow: 0px 4px 30px rgba(0, 0, 0, 0.3);
  1539. background: #fff;
  1540. border-radius: 16px;
  1541. padding: 16px;
  1542. box-sizing: border-box;
  1543. display: flex;
  1544. align-items: center;
  1545. cursor: pointer;
  1546. .icon {
  1547. width: 40px;
  1548. height: 40px;
  1549. margin-right: 10px;
  1550. border-radius: 50%;
  1551. }
  1552. .name {
  1553. font-weight: 600;
  1554. font-size: 16px;
  1555. color: #101419;
  1556. width: 193px;
  1557. height: 20px;
  1558. overflow: hidden;
  1559. white-space: nowrap;
  1560. text-overflow: ellipsis;
  1561. display: inline-block;
  1562. }
  1563. }
  1564. }
  1565. }
  1566. .form-item:last-child {
  1567. border-bottom: none !important;
  1568. }
  1569. }
  1570. }
  1571. .anti-bot-wrapper {
  1572. width: 100%;
  1573. height: 50px;
  1574. display: flex;
  1575. align-items: center;
  1576. justify-content: space-between;
  1577. box-sizing: border-box;
  1578. border-radius: 15px;
  1579. padding: 0 18px;
  1580. margin-top: 14px;
  1581. border: 1px solid #D1D9DD;
  1582. .label {
  1583. display: flex;
  1584. align-items: center;
  1585. font-size: 15px;
  1586. font-weight: 500;
  1587. .icon-bot {
  1588. margin-right: 8px;
  1589. }
  1590. .icon-beta {
  1591. margin-left: 5px;
  1592. margin-right: 8px;
  1593. }
  1594. .icon-question {
  1595. cursor: pointer;
  1596. }
  1597. }
  1598. }
  1599. .tips-wrapper {
  1600. margin: 16px 0 0 12px !important;
  1601. padding: 0px !important;
  1602. .title,
  1603. .row {
  1604. font-weight: 400;
  1605. font-size: 12px;
  1606. color: #A39F9F;
  1607. }
  1608. .row {
  1609. box-sizing: border-box;
  1610. line-height: 16px;
  1611. }
  1612. .more {
  1613. color: #1D9BF0;
  1614. font-size: 13px;
  1615. padding-left: 4px;
  1616. cursor: pointer;
  1617. }
  1618. }
  1619. .submit-btn-wrapper {
  1620. width: 100%;
  1621. background: #fff;
  1622. position: absolute;
  1623. bottom: 18px;
  1624. left: 0;
  1625. box-sizing: border-box;
  1626. padding: 16px 18px 0 18px;
  1627. .submit-btn {
  1628. width: 100%;
  1629. height: 46px;
  1630. text-align: center;
  1631. background: #4a99e9;
  1632. border-radius: 100px;
  1633. color: #fff;
  1634. display: flex;
  1635. align-items: center;
  1636. justify-content: center;
  1637. font-size: 16px;
  1638. font-weight: 500;
  1639. cursor: pointer;
  1640. .icon-loading {
  1641. width: 20px;
  1642. height: 20px;
  1643. margin-right: 3px;
  1644. }
  1645. }
  1646. .disabled-submit {
  1647. background-color: #D9D9D9;
  1648. }
  1649. }
  1650. }
  1651. .fill-right {
  1652. width: 100% !important;
  1653. border-bottom-left-radius: 16px;
  1654. }
  1655. }
  1656. }
  1657. }
  1658. </style>