You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

740 lines
15 KiB

  1. <script setup>
  2. import CanApi from '@/api/CanApi';
  3. import { defaultInitialZIndex, ElMessage } from 'element-plus';
  4. import { ref } from 'vue';
  5. //地址
  6. var url = "https://wwww.voted?token=9H0l5gBX0kPIbYe1rBrnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w"
  7. var token = null;
  8. function getToken() {
  9. var url = "https://wwww.voted?token=9H0l5gBX0kPIbYe1rBrnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w"
  10. // 使用 URL 对象解析 URL
  11. var parsedUrl = new URL(url);
  12. // 使用 URLSearchParams 获取 token 参数
  13. // token = parsedUrl.searchParams.get("token");
  14. token = "9H0l5gBX0kPIbYe1rBrnbZi0+fEeMx8pywnIlrmTxo5EOPR/wjWDV7w7+ZUseiBtf9kFa/atmNx6QfSpv5w";
  15. console.log("token字符串:",token); // 输出 token 的值
  16. // token = JSON.parse(tokenStr);
  17. // console.log("token json格式:",token);
  18. }
  19. getToken();
  20. //候选人
  21. const candidates = ref([])
  22. const first = ref();
  23. first.value = {
  24. id: 1,
  25. name: "tom",
  26. avatar: "../assets/头像框.png",
  27. votes: 100,
  28. voted: false
  29. }
  30. const second = ref();
  31. second.value = {
  32. id: 2,
  33. name: "tom",
  34. avatar: "../assets/头像框.png",
  35. votes: 100,
  36. voted: false
  37. }
  38. const third = ref();
  39. third.value = {
  40. id: 3,
  41. name: "tom",
  42. avatar: "../assets/头像框.png",
  43. votes: 100,
  44. voted: false
  45. }
  46. //后七名
  47. const backCandidates = ref([
  48. {
  49. id: 4,
  50. name: "tom",
  51. avatar: "../assets/头像框.png",
  52. votes: 100,
  53. voted: true
  54. },
  55. {
  56. id: 5,
  57. name: "tom",
  58. avatar: "../assets/头像框.png",
  59. votes: 100,
  60. voted: true
  61. },
  62. {
  63. id: 6,
  64. name: "tom",
  65. avatar: "../assets/头像框.png",
  66. votes: 100,
  67. voted: true
  68. }
  69. ,
  70. {
  71. id: 7,
  72. name: "tom",
  73. avatar: "../assets/头像框.png",
  74. votes: 100,
  75. voted: false
  76. },
  77. {
  78. id: 8,
  79. name: "tom",
  80. avatar: "../assets/头像框.png",
  81. votes: 100,
  82. voted: true
  83. },
  84. {
  85. id: 9,
  86. name: "tom",
  87. avatar: "../assets/头像框.png",
  88. votes: 100,
  89. voted: true
  90. },
  91. {
  92. id: 10,
  93. name: "tom",
  94. avatar: "../assets/头像框.png",
  95. votes: 100,
  96. voted: false
  97. }
  98. ])
  99. let key = 10017;
  100. //加载候选人
  101. function loadCandidates(token) {
  102. CanApi.getCandidates(token).then(result => {
  103. candidates.value = result.data;
  104. candidates.value = result.data;
  105. first.value = candidates.value[0]; // 假设第一个候选人
  106. second.value = candidates.value[1]; // 假设第二个候选人
  107. third.value = candidates.value[2]; // 假设第三个候选人
  108. // 将除了前三个之外的所有候选人推入backCandidates.value数组
  109. backCandidates.value = candidates.value.slice(3);
  110. console.log("第一个候选人:", first.value);
  111. console.log("第二个候选人:", second.value);
  112. console.log("第三个候选人:", third.value);
  113. console.log("后七名候选人:", backCandidates.value);
  114. console.log("候选人:", backCandidates.value);
  115. })
  116. }
  117. loadCandidates(token);
  118. //投票
  119. function vote(code) {
  120. console.log("code:", code)
  121. // voter.value.voterJwcode,voter.value.candidateJwcode,voter.value.voterName
  122. CanApi.Vote(token,code).then(result => {
  123. if (result.code == 10000) {
  124. ElMessage.success(result.msg);
  125. loadCandidates(token);
  126. } else {
  127. ElMessage.error(result.msg)
  128. loadCandidates(token);
  129. }
  130. })
  131. }
  132. </script>
  133. <template>
  134. <div class="container">
  135. <!-- 上半部分内容 -->
  136. <div class="header">
  137. <div class="channle">
  138. <span class="channle-write">Homily Chart 第一频道</span>
  139. </div>
  140. <div class="title">
  141. <img class="duiyi" src="../assets/寻找队医.png">
  142. </div>
  143. <!-- 投票规则 -->
  144. <div class="rules">
  145. <img class="rule-title" src="../assets/投票规则.png">
  146. <div class="rules-content">
  147. 每人每天最多可以投三票<br>
  148. 当天不可重复投一个人<br>
  149. 统计累计票数最多的三个人
  150. </div>
  151. </div>
  152. </div>
  153. <!-- 排名信息 -->
  154. <div class="content">
  155. <!-- 一二三 -->
  156. <div class="yes">
  157. <img class="yiersan" src="../assets/前三.png">
  158. </div>
  159. <!-- 第二名 -->
  160. <div class="second" :second="second">
  161. <!-- 头像框 -->
  162. <div class="avatar-box2"></div>
  163. <!-- 头像图片 -->
  164. <img class="cover2" src="../assets/image.png">
  165. <!-- 投票按钮 -->
  166. <div class="one-button2" v-if="second.voted == false" @click="vote(second.jwCode)">投票</div>
  167. <div class="buttoned2" v-else @click="vote(second.jwCode)">已投票</div>
  168. <!-- 有多少人投票 -->
  169. <div class="votes2">已有{{ second.votes }}人投票</div>
  170. <!-- 排名2 -->
  171. <div class="num2"></div>
  172. </div>
  173. <!-- 第一名 -->
  174. <div class="first" :first="first">
  175. <!-- 头像框 -->
  176. <div class="avatar-box1"></div>
  177. <!-- 头像图片 -->
  178. <img class="cover1" src="../assets/image.png">
  179. <!-- 投票按钮 -->
  180. <div class="one-button1" v-if="first.voted == false" @click="vote(first.jwCode)">投票</div>
  181. <div class="buttoned1" v-else @click="vote(first.jwCode)">已投票</div>
  182. <!-- 有多少人投票 -->
  183. <div class="votes1">已有{{ first.votes }}人投票</div>
  184. <!-- 排名1 -->
  185. <div class="num1"></div>
  186. </div>
  187. <!-- 第三名 -->
  188. <div class="third" :third="third">
  189. <!-- 头像框 -->
  190. <div class="avatar-box3"></div>
  191. <!-- 头像图片 -->
  192. <img class="cover3" src="../assets/image.png">
  193. <!-- 投票按钮 -->
  194. <div class="one-button3" v-if="third.voted == false" @click="vote(third.jwCode)">投票</div>
  195. <div class="buttoned3" v-else @click="vote(third.jwCode)">已投票</div>
  196. <!-- 有多少人投票 -->
  197. <div class="votes3">已有{{ third.votes }}人投票</div>
  198. <!-- 排名1 -->
  199. <div class="num3"></div>
  200. </div>
  201. <!-- 后七名循环列表 -->
  202. <div class="rand-box">
  203. <div class="list" v-for="(backCandidate, index) in backCandidates" :key="index">
  204. <!-- 排名 -->
  205. <div class="num">{{ index + 4 }}</div>
  206. <!-- 头像 -->
  207. <img class="list-avatar" src="../assets/image.png">
  208. <!-- 投票数 -->
  209. <div class="votes">已有{{ backCandidate.votes }}人投票</div>
  210. <!-- 投票按钮 -->
  211. <div class="list-button1" v-if="backCandidate.voted == false" @click="vote(backCandidate.jwCode)">投票</div>
  212. <div class="list-button2" v-else @click="vote(backCandidate.jwCode)">已投票</div>
  213. </div>
  214. </div>
  215. <div class="footer">-以上数据截至至2024.12.28-</div>
  216. </div>
  217. </div>
  218. </template>
  219. <style scoped>
  220. /* 平板 */
  221. @media (min-width: 750px) and (max-width:1280px) {
  222. .container {
  223. background-image: url('../assets/bg.png');
  224. background-repeat: no-repeat;
  225. width: 100%;
  226. height: 100%;
  227. background-size: 100% 100%;
  228. margin-left: auto;
  229. margin-right: auto;
  230. position: relative;
  231. }
  232. }
  233. /* 电脑 */
  234. @media (min-width:1280px) {
  235. .container {
  236. background-image: url('../assets/bg.png');
  237. background-repeat: no-repeat;
  238. width: 38%;
  239. height: 100%;
  240. background-size: 100% 100%;
  241. /* background-attachment:fixed; */
  242. margin-left: auto;
  243. margin-right: auto;
  244. position: relative;
  245. }
  246. }
  247. @media (max-width:750px) {
  248. .container {
  249. background-image: url('../assets/bg.png');
  250. background-repeat: no-repeat;
  251. width: 100%;
  252. height: 100%;
  253. background-size: 100% 100%;
  254. /* background-attachment:fixed; */
  255. margin-left: auto;
  256. margin-right: auto;
  257. position: relative;
  258. }
  259. }
  260. .header {
  261. position: relative;
  262. height: 28%;
  263. }
  264. .content {
  265. position: relative;
  266. height: 65%;
  267. width: 100%;
  268. }
  269. .channle {
  270. background-image: url(/src/assets/top.png);
  271. background-repeat: no-repeat;
  272. background-size: 100% 100%;
  273. width: 65%;
  274. margin-left: auto;
  275. margin-right: auto;
  276. color: #FFFFFF;
  277. font-weight: 1000;
  278. font-size: 1.5rem;
  279. text-shadow: 2px 2px 2px #F14509, -2px -1px 2px #F14509, 1px -1px 2px #F14509, -2px 3px 2px #F14509;
  280. display: flex;
  281. justify-content: center;
  282. align-items: center;
  283. }
  284. .title {
  285. width: 90%;
  286. background-size: contain;
  287. background-repeat: no-repeat;
  288. margin: auto;
  289. }
  290. .duiyi {
  291. width: 100%;
  292. margin-top: 5%;
  293. }
  294. .rules {
  295. height: 30%;
  296. }
  297. .rule-title {
  298. width: 40%;
  299. margin-left: 30%;
  300. }
  301. .rules-content {
  302. width: 45%;
  303. height: 20%;
  304. color: #FFFFFF;
  305. font-size: 1.3rem;
  306. font-weight: 700;
  307. font-family: Alibaba PuHuiTi;
  308. margin: auto;
  309. text-align: center;
  310. text-shadow: 1px 0px 0 #F14509, -1px 0px 0 #F14509, 0px -1px 0 #F14509, 0px 0px 0 #F14509;
  311. }
  312. .yes {
  313. width: 90%;
  314. height: 30%;
  315. margin-left: auto;
  316. margin-right: auto;
  317. margin-top: 25%;
  318. }
  319. .yiersan {
  320. margin-top: 9%;
  321. width: 100%;
  322. }
  323. .avatar-box2 {
  324. background-image: url(../assets/头像框.png);
  325. position: absolute;
  326. background-size: contain;
  327. background-repeat: no-repeat;
  328. left: 9%;
  329. top: -8%;
  330. width: 25%;
  331. height: 20%;
  332. }
  333. .cover2 {
  334. position: absolute;
  335. left: 11.7%;
  336. top: -5.9%;
  337. width: 19.1%;
  338. height: 9%;
  339. border-radius: 50%;
  340. }
  341. .one-button2 {
  342. position: absolute;
  343. left: 9%;
  344. top: 2%;
  345. width: 22%;
  346. height: 3.5%;
  347. border-radius: 20px 20px 20px 20px;
  348. background: linear-gradient(81deg, #FFE89C, #FFC040);
  349. border: #FA765D solid 2px;
  350. /* 文字 */
  351. font-weight: 700;
  352. font-size: 1.4rem;
  353. color: #E8160C;
  354. display: flex;
  355. justify-content: center;
  356. align-items: center;
  357. cursor: pointer;
  358. }
  359. .buttoned2 {
  360. position: absolute;
  361. left: 9%;
  362. top: 2%;
  363. width: 22%;
  364. height: 3.5%;
  365. border-radius: 20px 20px 20px 20px;
  366. border: #FA765D solid 2px;
  367. /* 文字 */
  368. font-weight: 700;
  369. font-size: 1.4rem;
  370. display: flex;
  371. justify-content: center;
  372. align-items: center;
  373. cursor: pointer;
  374. background: #EEEEEE;
  375. color: #999999;
  376. }
  377. .votes2 {
  378. position: absolute;
  379. left: 11%;
  380. top: 6%;
  381. width: 25%;
  382. height: 3%;
  383. font-family: Alibaba PuHuiTi;
  384. font-size: 1rem;
  385. font-weight: 700;
  386. color: #E84E07;
  387. z-index: 999;
  388. }
  389. .num2 {
  390. background-image: url(../assets/2.png);
  391. background-size: contain;
  392. background-repeat: no-repeat;
  393. width: 7%;
  394. height: 15%;
  395. position: absolute;
  396. left: 14%;
  397. top: 10.5%;
  398. /* z-index: 999; */
  399. }
  400. .avatar-box1 {
  401. background-image: url(../assets/头像框.png);
  402. background-size: contain;
  403. background-repeat: no-repeat;
  404. position: absolute;
  405. left: 38%;
  406. top: -10%;
  407. width: 25%;
  408. height: 20%;
  409. }
  410. .cover1 {
  411. position: absolute;
  412. left: 40.9%;
  413. top: -8%;
  414. width: 19.1%;
  415. height: 9%;
  416. border-radius: 50%;
  417. }
  418. .one-button1 {
  419. position: absolute;
  420. left: 39%;
  421. top: 0%;
  422. width: 22%;
  423. height: 3.5%;
  424. border-radius: 20px 20px 20px 20px;
  425. background: linear-gradient(81deg, #FFE89C, #FFC040);
  426. border: #FA765D solid 2px;
  427. display: flex;
  428. justify-content: center;
  429. align-items: center;
  430. /* 文字 */
  431. font-weight: 700;
  432. font-size: 1.4rem;
  433. color: #E8160C;
  434. cursor: pointer;
  435. }
  436. .buttoned1 {
  437. position: absolute;
  438. left: 39%;
  439. top: 0%;
  440. width: 22%;
  441. height: 3.5%;
  442. border-radius: 20px 20px 20px 20px;
  443. border: #FA765D solid 2px;
  444. /* 文字 */
  445. font-weight: 700;
  446. font-size: 1.4rem;
  447. display: flex;
  448. justify-content: center;
  449. align-items: center;
  450. cursor: pointer;
  451. background: #EEEEEE;
  452. color: #999999;
  453. }
  454. .votes1 {
  455. position: absolute;
  456. left: 43%;
  457. top: 4%;
  458. width: 25;
  459. height: 3;
  460. font-family: Alibaba PuHuiTi;
  461. font-size: 1rem;
  462. font-weight: 700;
  463. color: #E84E07;
  464. z-index: 999;
  465. }
  466. .num1 {
  467. background-image: url(../assets/1.png);
  468. background-size: contain;
  469. background-repeat: no-repeat;
  470. position: absolute;
  471. left: 47%;
  472. top: 8.5%;
  473. width: 5%;
  474. height: 15%;
  475. /* z-index: 999; */
  476. }
  477. .avatar-box3 {
  478. background-image: url(../assets/头像框.png);
  479. background-size: contain;
  480. background-repeat: no-repeat;
  481. position: absolute;
  482. left: 68%;
  483. top: -8%;
  484. width: 25%;
  485. height: 20%;
  486. }
  487. .cover3 {
  488. position: absolute;
  489. left: 70.8%;
  490. top: -6%;
  491. width: 19.1%;
  492. height: 9%;
  493. border-radius: 50%;
  494. }
  495. .one-button3 {
  496. position: absolute;
  497. left: 69%;
  498. top: 2%;
  499. width: 22%;
  500. height: 3.5%;
  501. border-radius: 20px 20px 20px 20px;
  502. background: linear-gradient(81deg, #FFE89C, #FFC040);
  503. border: #FA765D solid 2px;
  504. /* 文字 */
  505. font-weight: 700;
  506. font-size: 1.4rem;
  507. color: #E8160C;
  508. display: flex;
  509. justify-content: center;
  510. align-items: center;
  511. cursor: pointer;
  512. }
  513. .buttoned3 {
  514. position: absolute;
  515. left: 69%;
  516. top: 2%;
  517. width: 22%;
  518. height: 3.5%;
  519. border-radius: 20px 20px 20px 20px;
  520. border: #FA765D solid 2px;
  521. /* 文字 */
  522. font-weight: 700;
  523. font-size: 1.4rem;
  524. display: flex;
  525. justify-content: center;
  526. align-items: center;
  527. cursor: pointer;
  528. background: #EEEEEE;
  529. color: #999999;
  530. }
  531. .votes3 {
  532. position: absolute;
  533. left: 72%;
  534. top: 6%;
  535. width: 25%;
  536. height: 3%;
  537. font-family: Alibaba PuHuiTi;
  538. font-size: 1rem;
  539. font-weight: 700;
  540. color: #E84E07;
  541. z-index: 999;
  542. }
  543. .num3 {
  544. background-image: url(../assets/3.png);
  545. background-size: contain;
  546. background-repeat: no-repeat;
  547. position: absolute;
  548. left: 75%;
  549. top: 10.5%;
  550. width: 7%;
  551. height: 15%;
  552. /* z-index: 999; */
  553. }
  554. .rand-box {
  555. background-color: #FFFFFF;
  556. border: #F14509 solid 2px;
  557. border-radius: 27.78px 27.78px 27.78px 27.78px;
  558. width: 90%;
  559. height: auto;
  560. margin: auto;
  561. /* height: 70%; */
  562. /* box-shadow: 3px 8px 19px 0 #66f1291f; */
  563. box-shadow: 9px 9px 19px -9px #F1291F40;
  564. }
  565. .list {
  566. display: flex;
  567. /* display: inline-block; */
  568. align-items: center;
  569. justify-content: center;
  570. margin-top: 5%;
  571. margin-bottom: 5%;
  572. margin-left: 4%;
  573. padding: 2%;
  574. border-bottom: 1px dashed #B24300;
  575. }
  576. .rand-box>.list:not(:last-child) {
  577. border-bottom: 1px dashed #B24300;
  578. }
  579. .rand-box>.list:last-child {
  580. border-bottom: none;
  581. margin-bottom: 3%;
  582. }
  583. .num {
  584. font-family: zihunxingmouhei_trial;
  585. font-size: 1.625rem;
  586. /* 排名字体大小 */
  587. font-weight: 800;
  588. /* 排名字体加粗 */
  589. color: #F4850D;
  590. margin-right: 8%;
  591. /* 与头像之间的间距 */
  592. margin-left: 20px;
  593. }
  594. .list-avatar {
  595. width: 20%;
  596. height: 18%;
  597. border-radius: 50%;
  598. /* 圆形头像 */
  599. margin-right: 2%;
  600. }
  601. .votes {
  602. font-size: 1.2rem;
  603. /* 投票数字体大小 */
  604. font-weight: 400;
  605. width: 190px;
  606. height: 27px;
  607. flex-grow: 1;
  608. /* 填充剩余空间 */
  609. color: #F4850D;
  610. /* 投票数字体颜色 */
  611. /* margin-right: 2%; */
  612. }
  613. .list-button1 {
  614. background: linear-gradient(81deg, #FFE89C, #FFC040);
  615. border: #FA765D solid 2px;
  616. width: 22%;
  617. height: 18%;
  618. border-radius: 24.15px 24.15px 24.15px 24.15px;
  619. cursor: pointer;
  620. /* 鼠标悬停时的指针样式 */
  621. transition: background-color 0.3s;
  622. /* 背景颜色变化的过渡效果 */
  623. /* 文字 */
  624. font-weight: 700;
  625. font-size: 1.3rem;
  626. color: #E8160C;
  627. display: flex;
  628. justify-content: center;
  629. align-items: center;
  630. letter-spacing: 1%;
  631. margin-right: 4%;
  632. }
  633. .list-button2 {
  634. background: #EEEEEE;
  635. color: #999999;
  636. border: #FA765D solid 2px;
  637. width: 22%;
  638. height: 18%;
  639. border-radius: 24.15px 24.15px 24.15px 24.15px;
  640. cursor: pointer;
  641. /* 鼠标悬停时的指针样式 */
  642. transition: background-color 0.3s;
  643. /* 背景颜色变化的过渡效果 */
  644. /* 文字 */
  645. font-weight: 700;
  646. font-size: 1.3rem;
  647. text-align: center;
  648. letter-spacing: 1%;
  649. margin-right: 4%;
  650. }
  651. .list-button:hover {
  652. background-color: #e6b800;
  653. /* 鼠标悬停时的背景颜色 */
  654. }
  655. .footer {
  656. width: 60%;
  657. height: 10%;
  658. font-weight: 500;
  659. text-align: center;
  660. color: #B24300;
  661. margin-left: auto;
  662. margin-right: auto;
  663. padding-top: 5%;
  664. padding-bottom: 5%;
  665. }
  666. </style>