b037d91145b14a55d79167735b77fd677922da90.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <template>
  2. <div>
  3. <div class="headerB-top">
  4. <div class="middle row">
  5. <div class="row item-center headerB-top-left">
  6. <h1 class="row headerB-title">
  7. <p style="color:#F76649;">HX</p>
  8. <span style="color:#FFFFFF">669</span>
  9. </h1>
  10. <ul class="row headerB-nav">
  11. <li
  12. v-for="(item,index) in List"
  13. :key="index"
  14. style="margin-left:.3rem"
  15. class="row item-center"
  16. :class="num==index?'active':''"
  17. @click="listActive(index)"
  18. >{{item.title}}</li>
  19. </ul>
  20. </div>
  21. <div class="headerB-login">
  22. <div class="row item-center loginTo" style="height:100%">
  23. <div class="row item-center headerB-userCode">
  24. <p>你好,{{user.userName}}</p>
  25. <span
  26. style="color:#3DB8FF;margin-left:.1rem;cursor: pointer;"
  27. @click="escLogin"
  28. >[退出]</span>
  29. <div style="width:1px;background:#ccc;height:.3rem;margin:0 .23rem;"></div>
  30. <p>
  31. 余额:
  32. <span style="color:#F76649;">{{user.balance}}</span>
  33. </p>
  34. </div>
  35. <div class="row item-center headerB-img">
  36. <div class="row item-center">
  37. <img
  38. @mouseover="imgMT(1)"
  39. @mouseout="imgOUT()"
  40. :src="imgNum==1?img.walletHover:img.wallet"
  41. alt
  42. >
  43. <div class="userIcon row">
  44. <div class="row item-center" style="flex-wrap: wrap;">
  45. <p style="font-sizeP:.14rem;">盈利:</p>
  46. <p style="font-sizeP:.14rem;">亏损:</p>
  47. </div>
  48. <div class="row item-center" style="flex-wrap: wrap;">
  49. <span class="ellipsis" style="color:#02D36A">{{userData.allWin}}</span>
  50. <span class="ellipsis" style="color:#F76649">-{{userData.allLose}}</span>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="row item-center" @click="PersonalCenterTo()">
  55. <img
  56. @mouseover="imgMT(2)"
  57. @mouseout="imgOUT()"
  58. :src="imgNum==2?img.userHover:img.user"
  59. alt
  60. >
  61. <div class="userIcon">点击前往投注页。</div>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="main" style="height:9rem">
  69. <div class="middle row">
  70. <div class="main-left">
  71. <div
  72. class="row item-center"
  73. style="color:#EEE;height:.4rem;padding:0 .2rem;font-size:.16rem;background:linear-gradient(180deg,rgba(153,153,153,1) 0%,rgba(86,86,86,1) 100%);"
  74. >我的账户</div>
  75. <div v-for="(item,index) in leftData" :key="index">
  76. <p v-if="item.title != ''">{{item.title}}</p>
  77. <ul v-for="(items,i) in item.list" :key="i">
  78. <li
  79. :class="items.isTrue?'active':''"
  80. @click="titleClick(index,i,items.code)"
  81. >{{items.title}}</li>
  82. </ul>
  83. </div>
  84. </div>
  85. <div class="main-right">
  86. <!--全部投注-->
  87. <div v-if="switcChcomponents === 'allBetting'">
  88. <all-betting></all-betting>
  89. </div>
  90. <!-- 单式投注 -->
  91. <div v-if="switcChcomponents=='unitary'">
  92. <unitary/>
  93. </div>
  94. <!-- 串式投注 -->
  95. <div v-if="switcChcomponents=='tandem'">
  96. <tandem/>
  97. </div>
  98. <!-- 已结算注单 -->
  99. <div v-if="switcChcomponents=='settlementBetting'">
  100. <settlementBetting/>
  101. </div>
  102. <!-- 未结算注单 -->
  103. <div v-if="switcChcomponents=='noSettlementBetting'">
  104. <noSettlementBetting/>
  105. </div>
  106. <!-- 存款 -->
  107. <div v-if="switcChcomponents=='deposit'">
  108. <deposit/>
  109. </div>
  110. <!-- 取款 -->
  111. <div v-if="switcChcomponents=='withdrawals'">
  112. <withdrawals/>
  113. </div>
  114. <!-- 盈利 -->
  115. <div v-if="switcChcomponents=='profit'">
  116. <profit/>
  117. </div>
  118. <!-- 亏损 -->
  119. <div v-if="switcChcomponents=='loss'">
  120. <loss/>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. <div style="background:linear-gradient(180deg,rgba(153,153,153,1) 0%,rgba(86,86,86,1) 100%);">
  126. <div class="middle bottomB row center">HX669属于HX669有限公司注册 版权所有©2019</div>
  127. </div>
  128. </div>
  129. </template>
  130. <script>
  131. // import abstract from "@/components/abstract";
  132. import AllBetting from "@/bucket/allBetting"
  133. import unitary from "@/components/unitary";
  134. import tandem from "@/components/tandem";
  135. import settlementBetting from "@/components/settlementBetting";
  136. import noSettlementBetting from "@/components/noSettlementBetting";
  137. import deposit from "@/components/deposit";
  138. import withdrawals from "@/components/withdrawals";
  139. import profit from "@/components/profit";
  140. import loss from "@/components/loss";
  141. import "@/css/index.css";
  142. export default {
  143. name: "PersonalCenter",
  144. data() {
  145. return {
  146. user: {
  147. // 用户信息
  148. userName: "",
  149. balance: 0
  150. },
  151. userData: "", //用户信息 (轮询)
  152. img: {
  153. user: require("@/assets/st-imges/user.png"),
  154. userHover: require("@/assets/st-imges/user-hover.png"),
  155. wallet: require("@/assets/st-imges/wallet.png"),
  156. walletHover: require("@/assets/st-imges/wallet-hover.png"),
  157. eaml: require("@/assets/st-imges/emal.png"),
  158. eamlHover: require("@/assets/st-imges/emal-hover.png")
  159. },
  160. timers: true,
  161. List: [
  162. // 头部导航列表
  163. {
  164. title: "体育赛事",
  165. num: 0
  166. },
  167. {
  168. title: "优惠",
  169. num: 1
  170. },
  171. {
  172. title: "手机版",
  173. num: 2
  174. }
  175. ],
  176. imgNum: 0,
  177. num: 0, //头部导航激活样式
  178. switcChcomponents: "unitary", //组件开关
  179. leftData: [
  180. //左侧数据 写死
  181. {
  182. title: "投注记录",
  183. list: [
  184. // {
  185. // title: "全部注单",
  186. // isTrue: false,
  187. // code: "allBetting"
  188. // },
  189. {
  190. title: "单式注单",
  191. isTrue: true,
  192. code: "unitary"
  193. },
  194. {
  195. title: "串式注单",
  196. isTrue: false,
  197. code: "tandem"
  198. },
  199. // {
  200. // title: "已结算注单",
  201. // isTrue: false,
  202. // code: "settlementBetting"
  203. // },
  204. // {
  205. // title: "未结算注单",
  206. // isTrue: false,
  207. // code: "noSettlementBetting"
  208. // },
  209. // {
  210. // title: "无效注单",
  211. // isTrue: false,
  212. // code: 'allBetting'
  213. // }
  214. ]
  215. },
  216. {
  217. title: "交易记录",
  218. list: [
  219. {
  220. title: "存款",
  221. isTrue: false,
  222. code: "deposit"
  223. },
  224. {
  225. title: "取款",
  226. isTrue: false,
  227. code: "withdrawals"
  228. }
  229. ]
  230. },
  231. {
  232. title: "盈亏记录",
  233. list: [
  234. {
  235. title: "盈利",
  236. isTrue: false,
  237. code: "profit"
  238. },
  239. {
  240. title: "亏损",
  241. isTrue: false,
  242. code: "loss"
  243. }
  244. ]
  245. }
  246. ]
  247. };
  248. },
  249. methods: {
  250. //退出登录
  251. escLogin() {
  252. this.$http
  253. .get(this.$ports.login.loginOut, {
  254. token: localStorage.getItem("token")
  255. })
  256. .then(res => {
  257. if (res.data.msg == "成功") {
  258. this.$dialog.toast({ mes: "退出登录成功", timeout: 2000 });
  259. localStorage.setItem("token", "");
  260. localStorage.setItem("name", "");
  261. localStorage.setItem("balance", "");
  262. this.$router.push("/");
  263. } else {
  264. this.$dialog.toast({ mes: "退出登录失败", timeout: 2000 });
  265. }
  266. });
  267. },
  268. // 导航
  269. PersonalCenterTo() {
  270. this.$router.push("/");
  271. },
  272. // 左侧导航开关激活样式
  273. titleClick(index, i, code) {
  274. this.leftData.forEach(e => {
  275. e.list.forEach(a => {
  276. a.isTrue = false;
  277. });
  278. });
  279. this.$set(this.leftData[index].list[i], "isTrue", true);
  280. this.switcChcomponents = code;
  281. },
  282. // 获取个人中心用户信息
  283. getUserData() {
  284. this.$http
  285. .post(this.$ports.login.getAgent, {
  286. token: localStorage.getItem("token")
  287. })
  288. .then(res => {
  289. if (res.data.data) {
  290. this.userData = res.data.data;
  291. this.userIsLogin = true;
  292. this.user.userName = res.data.data.name;
  293. this.user.balance = res.data.data.cash;
  294. } else {
  295. this.timers = false;
  296. this.userIsLogin = false;
  297. this.user.userName = "";
  298. this.user.balance = "";
  299. localStorage.setItem("token", "");
  300. this.$router.push('/')
  301. }
  302. });
  303. },
  304. listActive(index) {
  305. this.num = index;
  306. },
  307. imgMT(index) {
  308. this.imgNum = index;
  309. },
  310. imgOUT() {
  311. this.imgNum = 0;
  312. }
  313. },
  314. computed: {
  315. Switch() {
  316. return this.switcChcomponnets;
  317. }
  318. // getUserIsLogin() {
  319. // if (localStorage.getItem("token")) {
  320. // let userInfo = JSON.parse(localStorage.getItem("user"));
  321. // // this.userIsLogin = true;
  322. // // this.user.userName = userInfo[0].name;
  323. // // this.user.balance = userInfo[0].cash;
  324. // }
  325. // }
  326. },
  327. watch: {
  328. Switch() {}
  329. // getUserIsLogin() {}
  330. },
  331. components: {
  332. // abstract,
  333. unitary,
  334. settlementBetting,
  335. noSettlementBetting,
  336. deposit,
  337. withdrawals,
  338. profit,
  339. loss,
  340. tandem,
  341. AllBetting
  342. },
  343. mounted() {
  344. // 轮询获取用户信息 三分钟一次 用作判断登录失效与用户个人信息展示
  345. this.getUserData();
  346. let _this = this;
  347. this.$public.ajaxTimerFun(timing => {
  348. if (_this.timers) {
  349. _this.getUserData();
  350. } else {
  351. clearInterval(timing);
  352. }
  353. }, 1000 * 180);
  354. },
  355. beforeDestroy() {
  356. this.timers = false;
  357. }
  358. };
  359. </script>
  360. <style scoped>
  361. .headerB-top {
  362. height: 1rem;
  363. background: linear-gradient(
  364. 180deg,
  365. rgba(153, 153, 153, 1) 0%,
  366. rgba(86, 86, 86, 1) 100%
  367. );
  368. }
  369. .headerB-title {
  370. font-size: 0.42rem;
  371. margin-left: 0.3rem;
  372. }
  373. .headerB-nav {
  374. font-size: 0.24rem;
  375. height: 100%;
  376. color: #fff;
  377. }
  378. .headerB-nav li {
  379. height: 100%;
  380. }
  381. .headerB-nav li.active {
  382. font-weight: bold;
  383. position: relative;
  384. }
  385. .headerB-login {
  386. height: 100%;
  387. }
  388. .headerB-login div {
  389. height: 0.4rem;
  390. }
  391. .headerB-login div input {
  392. width: 2rem;
  393. height: 100%;
  394. border: none;
  395. background: #eeeeee;
  396. color: #999;
  397. font-size: 0.16rem;
  398. padding-left: 0.2rem;
  399. }
  400. .headerB-login-pwd {
  401. width: 3rem;
  402. margin-left: 0.1rem;
  403. position: relative;
  404. }
  405. .headerB-login-pwd span {
  406. font-size: 0.16rem;
  407. color: #999;
  408. position: absolute;
  409. left: 1.2rem;
  410. top: 0.1rem;
  411. }
  412. .headerB-login-txt {
  413. width: 1rem;
  414. background: #f76649;
  415. color: #ffffff;
  416. font-size: 0.18rem;
  417. }
  418. .headerB-top-left {
  419. width: 55%;
  420. }
  421. .loginTo div {
  422. height: 100%;
  423. /* font-size: 0.18rem; */
  424. color: #fff;
  425. }
  426. .headerB-userCode {
  427. margin-left: 1.25rem;
  428. }
  429. .headerB-img img {
  430. width: 0.3rem;
  431. height: 0.3rem;
  432. margin-left: 0.2rem;
  433. }
  434. .headerB-img {
  435. margin-left: 0.5rem;
  436. }
  437. .bottomB {
  438. color: #ccc;
  439. height: 1.5rem;
  440. font-size: 0.14rem;
  441. }
  442. .userIcon {
  443. display: none;
  444. }
  445. .userIcon > div {
  446. width: 50%;
  447. }
  448. .headerB-img > div:hover .userIcon {
  449. display: flex;
  450. padding: 0.1rem;
  451. width: 1.3rem;
  452. /* padding: 0.1rem 0.2rem; */
  453. height: 1rem;
  454. line-height: 0.4rem;
  455. font-size: 0.14rem;
  456. position: absolute;
  457. left: -0.3rem;
  458. border-radius: 0.05rem;
  459. z-index: 999;
  460. bottom: -0.8rem;
  461. background: rgba(85, 85, 85, 0.9);
  462. box-shadow: -2px 0px 5px 1px rgba(0, 0, 0, 0.1),
  463. 0px -2px 5px 1px rgba(0, 0, 0, 0.1), 2px 0px 5px 1px rgba(0, 0, 0, 0.1),
  464. 0px 2px 5px 1px rgba(0, 0, 0, 0.1);
  465. }
  466. .headerB-img > div {
  467. position: relative;
  468. }
  469. .main-left {
  470. width: 2.8rem;
  471. background: #ccc;
  472. }
  473. .main-left p,
  474. .main-left li {
  475. line-height: 0.4rem;
  476. font-size: 0.14rem;
  477. color: #555;
  478. }
  479. .main-left p {
  480. background: #fff;
  481. padding: 0 0.2rem;
  482. border-bottom: 0.01rem solid #ccc;
  483. }
  484. .main-left li {
  485. background: #ddd;
  486. border-bottom: 0.01rem solid #ccc;
  487. padding: 0 0.3rem;
  488. }
  489. .main-left li:hover {
  490. background: #bbb;
  491. color: #f76649;
  492. }
  493. .main-left li.active {
  494. color: #fff;
  495. background: #aaa;
  496. border-left: 0.05rem solid #f76649;
  497. }
  498. .main-right {
  499. width: 76%;
  500. margin: 0.2rem 0 0 0.2rem;
  501. }
  502. </style>