index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. <template>
  2. <view class="container">
  3. <view class="top flex">
  4. <view class="icon1 flex" @click="openurl('/pages/user/set/set')">
  5. <image src="/static/image/img01.png" style="width: 139rpx;height: 55rpx;" mode="widthFix"></image>
  6. <view class="myName">我的</view>
  7. </view>
  8. <!-- #ifdef APP -->
  9. <view class="flex" @click="saoma">
  10. <image src="/static/image/img03.png" style="width: 39rpx;height: 36rpx;" mode="widthFix"></image>
  11. <!-- <image src="/static/image/img02.png" style="width: 39rpx;height: 40rpx;" mode="widthFix"></image> -->
  12. </view>
  13. <!-- #endif -->
  14. </view>
  15. <view class="swiper-box">
  16. <u-swiper :list="swiperList" indicator indicatorMode="line" height="280rpx" circular></u-swiper>
  17. </view>
  18. <view class="flex noteBox" @click="openurl('/pages/index/notice')">
  19. <view class="flex_item noteTpl">
  20. <image src="/static/image/img04.png" style="width: 42rpx;height: 34rpx;" mode="widthFix"></image>
  21. <view class="clamp textTpl">{{noticeList.title}}</view>
  22. </view>
  23. <!-- <view class="tip"></view> -->
  24. </view>
  25. <view class="flex navList">
  26. <view class="navTpl" @click="openurl('/pages/index/recharge')">
  27. <image src="/static/image/img06.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  28. <view class="navName">充值</view>
  29. </view>
  30. <!-- <view class="navTpl" @click="openurl('/pages/index/personal')">
  31. <image src="/static/image/img07.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  32. <view class="navName">实名认证</view>
  33. </view> -->
  34. <view class="navTpl" @click="openurl('/pages/user/set/transaction')">
  35. <image src="/static/image/img08.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  36. <view class="navName">交易密码</view>
  37. </view>
  38. <view class="navTpl" @click="openurl('/pages/user/set/bindBank')">
  39. <image src="/static/image/img09.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  40. <view class="navName">收款信息</view>
  41. </view>
  42. <view class="navTpl" @click="openKf">
  43. <image src="/static/image/img10.png" style="width: 123rpx;height: 73rpx;" mode="widthFix"></image>
  44. <view class="navName">联系客服</view>
  45. </view>
  46. </view>
  47. <view class="starBox flex">
  48. <view class="starTpl flex_item">
  49. <image src="/static/image/img12.png" style="width: 75rpx;height: 75rpx;" mode="widthFix"></image>
  50. <view class="starText">
  51. <view class="name">okx(欧易)</view>
  52. <view class="num">{{baseData.ok_price}}</view>
  53. </view>
  54. </view>
  55. <view class="starTpl flex_item">
  56. <image src="/static/image/img13.png" style="width: 75rpx;height: 75rpx;" mode="widthFix"></image>
  57. <view class="starText">
  58. <view class="name">STAR(星空)</view>
  59. <view class="num">{{baseData.us_price}}</view>
  60. </view>
  61. </view>
  62. </view>
  63. <navigator open-type='switchTab' url="/pages/index/pledge">
  64. <image src="/static/image/img11.png" style="width: 692rpx;padding-top: 31rpx;height: 179rpx;" mode="widthFix"></image>
  65. </navigator>
  66. <!-- <view class="titleBox">
  67. <view class="titleTip">累计成交量</view>
  68. </view> -->
  69. <view class="flex totalBox">
  70. <view class="totalTpl">
  71. <view class="totalNum">{{baseData.success_num||0}}</view>
  72. <view class="totalName">24小时成交量(U)</view>
  73. </view>
  74. <view class="totalTpl">
  75. <view class="totalNum">{{baseData.success_order||0}}</view>
  76. <view class="totalName">24小时成单量</view>
  77. </view>
  78. <view class="totalTpl">
  79. <view class="totalNum">{{baseData.success_ratio||0}}</view>
  80. <view class="totalName">交易成功率</view>
  81. </view>
  82. </view>
  83. <view class="titleBox">
  84. <view class="titleTip">平台优势</view>
  85. </view>
  86. <view class="advantageBox flex">
  87. <view class="advantageTpl">
  88. <image src="/static/image/img16.png" style="width:149rpx;height: 127rpx;" mode="widthFix"></image>
  89. <view class="advantageName">简单</view>
  90. </view>
  91. <view class="advantageTpl">
  92. <image src="/static/image/img15.png" style="width:149rpx;height: 127rpx;" mode="widthFix"></image>
  93. <view class="advantageName">安全</view>
  94. </view>
  95. <view class="advantageTpl">
  96. <image src="/static/image/img14.png" style="width:149rpx;height: 127rpx;" mode="widthFix"></image>
  97. <view class="advantageName">省心</view>
  98. </view>
  99. <view class="advantageTpl">
  100. <image src="/static/image/img17.png" style="width:149rpx;height: 127rpx;" mode="widthFix"></image>
  101. <view class="advantageName">极速</view>
  102. </view>
  103. </view>
  104. <!-- <uni-popup
  105. ref="popupkf"
  106. type="center">
  107. <view class="popup-box">
  108. <view class="img">
  109. <image
  110. src="/static/image/img24.png"
  111. mode=""></image>
  112. </view>
  113. <view class="mian">
  114. <view class="delivery">
  115. <view class="title">已经为您定制专属客服</view>
  116. <image
  117. src="/static/image/img25.png"
  118. mode=""></image>
  119. </view>
  120. <view class="nocancel">客服VX:{{ kefu }}</view>
  121. <view class="comfirm-box">
  122. <view
  123. class="cancel"
  124. @click="cancel"
  125. >取消</view
  126. >
  127. <view
  128. class="comfirm"
  129. @click="comfirm(kefu)"
  130. >复制微信</view
  131. >
  132. </view>
  133. </view>
  134. </view>
  135. </uni-popup> -->
  136. </view>
  137. </template>
  138. <script>
  139. import {
  140. getIndex
  141. } from '@/api/index.js';
  142. import {
  143. saveUrl,
  144. interceptor
  145. } from '@/utils/loginUtils.js';
  146. import { getArtList} from '@/api/notice.js';
  147. import {
  148. mapState,
  149. mapActions,
  150. mapMutations
  151. } from "vuex";
  152. export default {
  153. data() {
  154. return {
  155. gameList: [],
  156. active_user: '0',
  157. swiperList:['/static/image/img05.png'],
  158. kefu:'ch125221',
  159. baseData:{
  160. ok_price:0,
  161. us_price:0
  162. },
  163. noticeList:''
  164. }
  165. },
  166. computed: {
  167. ...mapState({
  168. langList: "langList",
  169. lang: "lang",
  170. }),
  171. ...mapState('user', ['userInfo','hasLogin']),
  172. label() {
  173. const label = this.langList.find((item) => {
  174. console.log(this.lang, item.value);
  175. return item.value == this.lang
  176. }).label;
  177. return label
  178. }
  179. },
  180. onLoad(option) {
  181. // #ifndef MP
  182. if (option.spread) {
  183. // 存储其他邀请人
  184. uni.setStorageSync('spread', option.spread);
  185. }
  186. // #endif
  187. // #ifdef MP
  188. if (option.scene) {
  189. // 存储小程序邀请人
  190. uni.setStorage({
  191. key: 'spread_code',
  192. data: option.scene
  193. });
  194. }
  195. // #endif
  196. },
  197. onShow() {
  198. this.loadData();
  199. this.getNotice()
  200. },
  201. methods: {
  202. ...mapActions({
  203. setLang: "setLang",
  204. }),
  205. getNotice(){
  206. let obj = this;
  207. getArtList('1').then(function(e) {
  208. obj.noticeList = e.data[0]
  209. console.log(obj.noticeList,'obj.noticeList');
  210. })
  211. },
  212. openurl(url){
  213. if(!this.hasLogin){
  214. saveUrl();
  215. interceptor();
  216. return
  217. }
  218. uni.navigateTo({
  219. url: url,
  220. fail: (err) => {
  221. uni.showModal({
  222. title: '错误',
  223. content: err,
  224. showCancel: false,
  225. });
  226. }
  227. });
  228. },
  229. saoma(){
  230. uni.scanCode({
  231. success(data) {
  232. let res = data.result
  233. // uni.navigateTo({
  234. // url: res
  235. // })
  236. window.location.href = res;
  237. },
  238. fail(e) {
  239. console.log(JSON.stringify(e));
  240. console.log("扫码失败");
  241. },
  242. });
  243. },
  244. // 打开客服
  245. openKf() {
  246. // this.$refs.popupkf.open();
  247. uni.previewImage({
  248. urls:['/static/image/shareImage.jpg']
  249. })
  250. },
  251. // 关闭客服
  252. cancel() {
  253. this.$refs.popupkf.close();
  254. },
  255. // 请求载入数据
  256. async loadData() {
  257. getIndex({})
  258. .then(({
  259. data
  260. }) => {
  261. this.active_user = data.active_user
  262. this.baseData = data;
  263. console.log(data);
  264. })
  265. .catch(e => {});
  266. },
  267. comfirm(text) {
  268. console.log(text);
  269. const result = this.uniCopy(text);
  270. if (result === false) {
  271. uni.showToast({
  272. title: "不支持",
  273. });
  274. } else {
  275. uni.showToast({
  276. title: "复制成功",
  277. icon: "none",
  278. });
  279. }
  280. this.$refs.popupkf.close();
  281. },
  282. uniCopy(content) {
  283. /**
  284. * 小程序端 和 app端的复制逻辑
  285. */
  286. //#ifndef H5
  287. uni.setClipboardData({
  288. data: content,
  289. success: function () {
  290. console.log("success");
  291. return true;
  292. },
  293. });
  294. //#endif
  295. /**
  296. * H5端的复制逻辑
  297. */
  298. // #ifdef H5
  299. if (!document.queryCommandSupported("copy")) {
  300. //为了兼容有些浏览器 queryCommandSupported 的判断
  301. // 不支持
  302. return false;
  303. }
  304. let textarea = document.createElement("textarea");
  305. textarea.value = content;
  306. textarea.readOnly = "readOnly";
  307. document.body.appendChild(textarea);
  308. textarea.select(); // 选择对象
  309. textarea.setSelectionRange(0, content.length); //核心
  310. let result = document.execCommand("copy"); // 执行浏览器复制命令
  311. textarea.remove();
  312. return result;
  313. // #endif
  314. },
  315. },
  316. }
  317. </script>
  318. <style lang="scss">
  319. .container {
  320. width: 100%;
  321. background-color: #051137;
  322. padding: 0rpx 30rpx;
  323. padding-top: calc(60px + var(--status-bar-height));
  324. padding-bottom: 50rpx;
  325. }
  326. .top {
  327. font-weight: 500;
  328. padding: 40rpx 30rpx 24rpx 30rpx;
  329. line-height: 1;
  330. position: fixed;
  331. top: var(--status-bar-height);
  332. left: 0;
  333. width: 100%;
  334. background: #051137;
  335. z-index: 99;
  336. .icon1 {
  337. line-height: 0;
  338. position: relative;
  339. .myName{
  340. position: absolute;
  341. right: 22rpx;
  342. font-weight: 500;
  343. font-size: 24rpx;
  344. color: #2884FF;
  345. }
  346. }
  347. }
  348. .noteBox{
  349. padding: 46rpx 0rpx;
  350. .noteTpl{
  351. color: #fff;
  352. width: 85%;
  353. .textTpl{
  354. width: calc(100% - 42rpx);
  355. font-family: PingFang SC;
  356. font-weight: 500;
  357. font-size: 26rpx;
  358. color: #FFFFFF;
  359. padding-left: 30rpx;
  360. }
  361. }
  362. .tip{
  363. width: 12rpx;
  364. height: 12rpx;
  365. background: #F7453D;
  366. border-radius: 100%;
  367. }
  368. }
  369. .navList{
  370. text-align: center;
  371. padding:15rpx 0rpx;
  372. .navTpl{
  373. .navName{
  374. padding-top: 23rpx;
  375. font-family: PingFang SC;
  376. font-weight: 500;
  377. font-size: 26rpx;
  378. color: #FFFFFF;
  379. }
  380. }
  381. }
  382. .starBox{
  383. padding-top: 43rpx;
  384. .starTpl{
  385. width: 48%;
  386. background: #1F2A4A;
  387. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50,50,52,0.06);
  388. border-radius: 20rpx;
  389. padding: 20rpx 18rpx;
  390. .starText{
  391. padding-left: 25rpx;
  392. .name{
  393. font-family: PingFang SC;
  394. font-weight: 500;
  395. font-size: 22rpx;
  396. color: #FFFFFF;
  397. line-height: 24rpx;
  398. }
  399. .num{
  400. padding-top: 15rpx;
  401. font-family: PingFang SC;
  402. font-weight: bold;
  403. font-size: 30rpx;
  404. color: #FFA235;
  405. line-height: 24rpx;
  406. }
  407. }
  408. }
  409. }
  410. .titleBox{
  411. text-align: center;
  412. padding: 45rpx 0rpx;
  413. .titleTip{
  414. flex: 1;
  415. display: flex;
  416. justify-content: center;
  417. align-items: center;
  418. height: 100%;
  419. position: relative;
  420. font-weight: bold;
  421. font-size: 42rpx;
  422. color: #FFFFFF;
  423. line-height: 110rpx;
  424. &:after {
  425. content: '';
  426. position: absolute;
  427. left: 50%;
  428. bottom: 0;
  429. transform: translateX(-50%);
  430. width: 44px;
  431. height: 0;
  432. border-bottom: 3px solid #FFFFFF;
  433. border-radius: 25rpx;
  434. }
  435. }
  436. }
  437. .totalBox{
  438. padding-top: 30rpx;
  439. .totalTpl{
  440. width: 45%;
  441. text-align: center;
  442. padding: 45rpx 0rpx;
  443. .totalNum{
  444. font-family: FZCuHeiSongS-B-GB;
  445. font-weight: 400;
  446. font-size: 39rpx;
  447. color: #66FFFF;
  448. text{
  449. font-family: PingFang SC;
  450. font-weight: 500;
  451. font-size: 22rpx;
  452. color: #66FFFF;
  453. }
  454. }
  455. .totalName{
  456. padding-top: 20rpx;
  457. font-family: Source Han Sans CN;
  458. font-weight: bold;
  459. font-size: 26rpx;
  460. color: #FFFFFF;
  461. }
  462. }
  463. }
  464. .advantageBox{
  465. padding-top: 50rpx;
  466. .advantageTpl{
  467. text-align: center;
  468. .advantageName{
  469. padding-top: 25rpx;
  470. font-family: PingFang SC;
  471. font-weight: 500;
  472. font-size: 28rpx;
  473. color: #FFFFFF;
  474. }
  475. }
  476. }
  477. .popup-box {
  478. width: 522rpx;
  479. height: 605rpx;
  480. background-color: #ffffff;
  481. border-radius: 20rpx;
  482. position: relative;
  483. .img {
  484. position: relative;
  485. top: -56rpx;
  486. left: 0;
  487. width: 522rpx;
  488. height: 132rpx;
  489. display: flex;
  490. justify-content: center;
  491. image {
  492. border-radius: 20rpx 20rpx 0 0;
  493. width: 450rpx;
  494. height: 132rpx;
  495. }
  496. }
  497. .mian {
  498. margin-top: -44rpx;
  499. display: flex;
  500. flex-direction: column;
  501. align-items: center;
  502. // padding: 32rpx 32rpx;
  503. background-color: #ffffff;
  504. border-radius: 0 0 20rpx 20rpx;
  505. text-align: center;
  506. .delivery {
  507. font-size: 40rpx;
  508. color: #333333;
  509. display: flex;
  510. align-items: center;
  511. flex-direction: column;
  512. .title {
  513. }
  514. image {
  515. margin-top: 48rpx;
  516. width: 172rpx;
  517. height: 160rpx;
  518. }
  519. }
  520. .nocancel {
  521. font-size: 32rpx;
  522. color: #333333;
  523. margin-top: 14rpx;
  524. }
  525. .comfirm-box {
  526. margin-top: 52rpx;
  527. display: flex;
  528. // margin-bottom: 32rpx;
  529. // justify-content: space-around;
  530. .cancel {
  531. display: flex;
  532. align-items: center;
  533. justify-content: center;
  534. width: 197rpx;
  535. height: 74rpx;
  536. border: 1px solid #dcc786;
  537. border-radius: 38rpx;
  538. font-size: 32rpx;
  539. color: #605128;
  540. }
  541. .comfirm {
  542. margin-left: 32rpx;
  543. display: flex;
  544. align-items: center;
  545. justify-content: center;
  546. width: 197rpx;
  547. height: 74rpx;
  548. background: linear-gradient(
  549. -90deg,
  550. #d1ba77 0%,
  551. #f7e8ad 100%
  552. );
  553. border-radius: 38px;
  554. font-size: 32rpx;
  555. color: #605128;
  556. }
  557. }
  558. }
  559. }
  560. </style>