index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <div class="finance">
  3. <img src="../../assets/img/financeBanner.jpg" style="width: 100%" />
  4. <div class="guize" @click="showGuize">投票规则</div>
  5. <div class="guize" style="top: 6em" @click="paiming">查看排名</div>
  6. <van-search
  7. :background="background"
  8. clearable
  9. v-model="search"
  10. shape="round"
  11. placeholder="请输入搜索关键词"
  12. />
  13. <van-tabs :color="theme" :background="background">
  14. <van-tab :title="i" v-for="(v, i) in orilist" :key="i">
  15. <van-row gutter="8">
  16. <van-col
  17. span="12"
  18. :style="{
  19. position: 'relative',
  20. display: item.noShow ? 'none' : 'inline-block',
  21. }"
  22. v-for="item in v"
  23. :key="item.id"
  24. >
  25. <van-image
  26. :width="width"
  27. :height="height"
  28. fit="cover"
  29. @click="() => clickShowVideo(item)"
  30. position="left"
  31. :src="create_url_image(item.workTitle)"
  32. />
  33. <van-row>
  34. <van-col
  35. span="24"
  36. style="text-align: center"
  37. class="van-ellipsis unit"
  38. >{{ item.university }}</van-col
  39. >
  40. <van-col span="24" style="text-align: center">
  41. <div class="van-multi-ellipsis--l2">
  42. {{ item.name }}
  43. </div>
  44. </van-col>
  45. </van-row>
  46. <br />
  47. <van-checkbox
  48. class="act"
  49. v-model="ids[item.phone].select"
  50. :checked-color="theme"
  51. />
  52. </van-col>
  53. </van-row>
  54. </van-tab>
  55. </van-tabs>
  56. <div
  57. class="btn"
  58. :style="{ bottom: config.isShanShiPin ? '5px' : '75px' }"
  59. @click="toupiao"
  60. >
  61. 投票
  62. </div>
  63. <Shanshipin v-if="!config.isShanShiPin" :color="background" />
  64. <!-- 投票框 -->
  65. <van-dialog v-model:show="showPaihang" confirm-button-text="关闭">
  66. <div style="height: 50vh">
  67. <van-tabs :color="theme">
  68. <van-tab :title="key" v-for="(v, key) in rankList" :key="key">
  69. <div class="SilkList">
  70. <van-cell-group inset>
  71. <van-cell title="名称" value="投票量"></van-cell>
  72. <van-row v-for="item in v" :key="item.id + 'team'">
  73. <van-col span="16"
  74. ><p class="text van-ellipsis--l2" v-text="item.name"></p
  75. ></van-col>
  76. <van-col span="8"
  77. ><p
  78. class="text"
  79. style="text-align: right"
  80. v-text="formmate(item.votes)"
  81. ></p
  82. ></van-col>
  83. </van-row>
  84. </van-cell-group>
  85. </div>
  86. </van-tab>
  87. </van-tabs>
  88. </div>
  89. </van-dialog>
  90. <!-- 登录框 -->
  91. <van-dialog
  92. theme="round-button"
  93. v-model:show="showLogin"
  94. confirm-button-text="登录"
  95. :before-close="beforeClose"
  96. >
  97. <van-cell-group inset>
  98. <van-field
  99. v-model="login.phone"
  100. required
  101. type="tel"
  102. label="手机号"
  103. placeholder="请输入手机号"
  104. >
  105. <template #button>
  106. <van-button
  107. v-if="codePhoen === 0"
  108. @click="getCode"
  109. size="small"
  110. type="primary"
  111. :color="theme"
  112. >
  113. 发送验证码
  114. </van-button>
  115. <van-count-down
  116. format="ss 秒"
  117. v-else
  118. :time="codePhoen"
  119. @finish="() => (codePhoen = 0)"
  120. />
  121. </template>
  122. </van-field>
  123. <van-field required v-model="login.code" type="digit" label="验证码" />
  124. </van-cell-group>
  125. </van-dialog>
  126. </div>
  127. </template>
  128. <script setup>
  129. import { ref, reactive, watch } from 'vue';
  130. import { showDialog, showConfirmDialog, showToast } from 'vant';
  131. import {
  132. getEnrollList,
  133. getEnrollRank,
  134. getVote,
  135. getTimes,
  136. getSendVerifyCode,
  137. verifyCode,
  138. } from '@/api/SilkRoadSpringGala.js';
  139. import Shanshipin from '@/components/shanshipin.vue';
  140. const theme = '#38379f';
  141. const background = '#e0f2fa';
  142. const w = window.$originData.orginParames.availWidth || 0;
  143. const operateId = window.$originData.orginParames.operateId;
  144. const width = (w - 16) / 2;
  145. const height = width * 0.57;
  146. const showPaihang = ref(false);
  147. const showLogin = ref(false);
  148. const rankList = ref({});
  149. const orilist = ref({});
  150. const ids = ref({});
  151. const codePhoen = ref(0);
  152. const config = reactive({
  153. times: -1,
  154. isShanShiPin: window.$shanshipin.UserId,
  155. });
  156. const search = ref('');
  157. const t = config.isShanShiPin ? 5 : 1;
  158. const phone =
  159. window.$shanshipin.Phone && window.$shanshipin.Phone != 0
  160. ? window.$shanshipin.Phone
  161. : localStorage.getItem('financePhone') || '18439106376';
  162. const login = reactive({
  163. phone,
  164. code: '',
  165. });
  166. const getList = call => {
  167. getEnrollList({
  168. operateId,
  169. }).then(r => {
  170. const array = r || [];
  171. const obj = {};
  172. const ids_list = [];
  173. for (let i = 0; i < array.length; i++) {
  174. const v = array[i];
  175. v.noShow = false;
  176. if (obj[v.type]) obj[v.type].push(v);
  177. else obj[v.type] = [v];
  178. ids_list[v.phone] = {
  179. select: false,
  180. name: v.name,
  181. phone: v.phone,
  182. };
  183. }
  184. ids.value = ids_list;
  185. orilist.value = obj;
  186. call && call();
  187. });
  188. };
  189. getList();
  190. const getRankList = Call => {
  191. getEnrollRank({
  192. operateId,
  193. }).then(r => {
  194. const l = r || [];
  195. const obj = {};
  196. for (let i = 0; i < l.length; i++) {
  197. const v = l[i];
  198. if (obj[v.type]) obj[v.type].push(v);
  199. else obj[v.type] = [v];
  200. }
  201. rankList.value = obj;
  202. Call && Call();
  203. });
  204. };
  205. let time = null;
  206. watch(search, res => {
  207. if (time) clearTimeout(time);
  208. time = setTimeout(() => {
  209. const rex = res ? new RegExp(res) : /[.\n]*/;
  210. for (const key in orilist.value) {
  211. if (!Object.hasOwnProperty.call(orilist.value, key)) continue;
  212. const v = orilist.value[key];
  213. for (let i = 0; i < v.length; i++) {
  214. const vv = v[i];
  215. vv.noShow = !rex.test(vv.name) && !rex.test(vv.university);
  216. }
  217. }
  218. clearTimeout(time);
  219. time = null;
  220. }, 200);
  221. });
  222. const getCode = () => {
  223. // 获取验证码
  224. if (!/1[0-9]{10}/.test(login.phone)) {
  225. showToast('请输入正确的手机号');
  226. return;
  227. }
  228. getSendVerifyCode({
  229. phone: login.phone,
  230. }).then(() => {
  231. codePhoen.value = 60000;
  232. });
  233. };
  234. const toupiao = function () {
  235. let names = [];
  236. let phones = [];
  237. for (let i = 0; i < ids.value.length; i++) {
  238. const v = ids.value[i] || {};
  239. if (!v.select) continue;
  240. names.push(v.name);
  241. phones.push(v.phone);
  242. }
  243. if (!phones.length) return showToast('请选择您中意的候选人');
  244. if (phones.length > 10) return showToast('最多只能投10人');
  245. if (!login.phone || login.phone.length < 11) return (showLogin.value = true); //如果没有手机号提示登录
  246. showConfirmDialog({
  247. message: '确定投票给' + names.join(',') + '么?',
  248. beforeClose: type => {
  249. if (type !== 'confirm') return true;
  250. return new Promise(resolve => {
  251. getVote({
  252. target: phones.join(','),
  253. source: login.phone,
  254. client: config.isShanShiPin ? '闪视频' : '其他',
  255. operateId,
  256. })
  257. .then(() => {
  258. showToast('投票成功!');
  259. resolve(true);
  260. })
  261. .catch(err => {
  262. showToast(err.message || '投票失败!');
  263. resolve(true);
  264. });
  265. });
  266. },
  267. });
  268. };
  269. const create_url_image = url => {
  270. if (/\.mp4$/.test(url))
  271. url = url + '?x-oss-process=video/snapshot,t_4000,f_jpg';
  272. return url;
  273. };
  274. const beforeClose = () => {
  275. if (!login.phone || !login.code) return false;
  276. getTimes({
  277. phone: login.phone,
  278. }).then(r => {
  279. config.times = r.times - t >= 0;
  280. verifyCode({
  281. phone: login.phone,
  282. code: login.code,
  283. })
  284. .then(r => {
  285. localStorage.setItem('financePhone', login.phone);
  286. localStorage.setItem('financeToken', r.token);
  287. return true;
  288. })
  289. .catch(() => false);
  290. });
  291. return true;
  292. };
  293. const showGuize = () => {
  294. showDialog({
  295. title: '投票规则',
  296. messageAlign: 'left',
  297. confirmButtonText: '关闭',
  298. message: () => (
  299. <div class='art'>
  300. <p>
  301. 1、投票主题:“大美中国·多彩丝路”《2023丝路嘉年华·丝路春晚》之我要上丝路春晚。
  302. </p>
  303. <p>2、投票时间:2022年12月23日12:00至12月26日12:00(共3天)。</p>
  304. <p>
  305. 3、投票范围:凡创作内容符合节目要求,且通过线上报名和导演组第一轮海选的团体、个人。
  306. </p>
  307. <p>
  308. 4、投票形式:通过微信H5或者闪视频APP进行线上投票,可分享拉票,助力你支持的团体、个人上《2023丝路嘉年华·丝路春晚》。
  309. </p>
  310. <p>
  311. 5、投票须知:每个用户每日的票数固定,即可分散投票,也可集中投票。微信H5打开每人每日可投2票,闪视频APP打开每人每日可投10票,欢迎大家下载闪视频APP参与投票,查看排行榜,为你支持的团体、个人助力打call。本次投票活动公开透明,排行榜实时更新,禁止刷票,如有违法一经查实将取消参赛资格,最终解释权归主办方所有。
  312. </p>
  313. <p>
  314. 6、 荣誉:
  315. <p>
  316. 1)网络投票人气第一的团体、个人直通丝路春晚晚会,在丝路春晚晚会中露出(陕西卫视、五大洲电视台播出);网络投票第二、三名的团体、个人将直通丝路嘉年华,在丝路嘉年华露出(陕西卫视)具体呈现形式由导演组与入选作品的团体、个人分别充分沟通,优化包装作品。
  317. </p>
  318. <p>
  319. 2)直通丝路嘉年华和丝路春晚的团体、个人在录制结束后,将获得闪视频独家个人专访和宣传形象照。
  320. </p>
  321. <p>
  322. 3)网络投票人气前五的团体、个人将获得由丝路春晚导演组颁发的荣誉证书。
  323. </p>
  324. </p>
  325. <p>
  326. 7、奖励:
  327. <p>
  328. 网络投票人气第一、二、三名的团体分别获得奖金3000元、2000元、1000元。
  329. </p>
  330. <p>
  331. 网络投票人气第一、二、三的个人分别获得奖金1000元、600元、300元。
  332. </p>
  333. </p>
  334. </div>
  335. ),
  336. });
  337. };
  338. const paiming = () => {
  339. if (!config.isShanShiPin) return showToast('下载闪视频查看投票结果。');
  340. getRankList(() => {
  341. showPaihang.value = true;
  342. });
  343. };
  344. const formmate = num => {
  345. if (num === 0) return num;
  346. let N = num || 0;
  347. switch (true) {
  348. case N >= 10000:
  349. N = (N / 10000).toFixed(2) - 0 + '万';
  350. break;
  351. case N >= 100000000:
  352. N = (N / 100000000).toFixed(2) - 0 + '亿';
  353. break;
  354. }
  355. return N;
  356. };
  357. const clickShowVideo = item => {
  358. location.href = item.file;
  359. };
  360. </script>
  361. <style lang="scss">
  362. .finance {
  363. $color: #38379f;
  364. width: 100vw;
  365. padding-bottom: 120px;
  366. background-color: #e0f2fa;
  367. min-height: 100vh;
  368. .van-cell__value {
  369. color: #000;
  370. }
  371. .act {
  372. position: absolute;
  373. top: 2px;
  374. left: 2px;
  375. z-index: 1;
  376. }
  377. .text {
  378. padding: 10px 16px;
  379. }
  380. .guize {
  381. background-color: $color;
  382. position: fixed;
  383. right: 0;
  384. top: 4em;
  385. color: #fff;
  386. font-weight: 400;
  387. font-size: 16px;
  388. padding: 3px 5px 3px 15px;
  389. border-top-left-radius: 1em;
  390. border-bottom-left-radius: 1em;
  391. z-index: 2;
  392. }
  393. .SilkList {
  394. height: calc(50vh - 60px);
  395. overflow-y: auto;
  396. }
  397. .btn {
  398. text-align: center;
  399. color: #fff;
  400. position: fixed;
  401. line-height: 2.5em;
  402. height: 2.5em;
  403. left: 5%;
  404. width: 90%;
  405. background-color: $color;
  406. z-index: 2;
  407. padding: 3px 0;
  408. border-radius: 5px;
  409. }
  410. .videoEle {
  411. width: 100vw;
  412. position: fixed;
  413. background-color: #000;
  414. top: 50%;
  415. z-index: 21;
  416. transform: translateY(-50%);
  417. }
  418. .van-overlay {
  419. .video {
  420. width: 100vw;
  421. height: 100vh;
  422. top: 0;
  423. position: fixed;
  424. .videoText {
  425. color: #fff;
  426. position: absolute;
  427. bottom: 0;
  428. padding: 0.5em;
  429. text-indent: 2em;
  430. }
  431. }
  432. .close {
  433. position: absolute;
  434. top: 10px;
  435. right: 10px;
  436. z-index: 22;
  437. color: #fff;
  438. font-size: 20px;
  439. }
  440. }
  441. .unit {
  442. font-size: 14px;
  443. color: #646566;
  444. }
  445. }
  446. </style>