give-dialog.vue 61 KB

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