index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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: 4em" @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="
  32. item.workTitle +
  33. '?x-oss-process=video/snapshot,t_4000,f_jpg,m_fast'
  34. "
  35. />
  36. <van-row>
  37. <van-col
  38. span="24"
  39. style="text-align: center"
  40. class="van-ellipsis unit"
  41. >{{ item.university }}</van-col
  42. >
  43. <van-col
  44. span="24"
  45. style="text-align: center"
  46. class="van-ellipsis--l2"
  47. >{{ item.name }}</van-col
  48. >
  49. </van-row>
  50. <br />
  51. <van-checkbox
  52. class="act"
  53. v-model="ids[item.phone].select"
  54. :checked-color="theme"
  55. />
  56. </van-col>
  57. </van-row>
  58. </van-tab>
  59. </van-tabs>
  60. <div
  61. class="btn"
  62. :style="{ bottom: config.isShanShiPin ? '5px' : '75px' }"
  63. @click="toupiao"
  64. >
  65. 投票
  66. </div>
  67. <Shanshipin v-if="!config.isShanShiPin" :color="background" />
  68. <!-- 投票框 -->
  69. <van-dialog v-model:show="showPaihang" confirm-button-text="关闭">
  70. <div style="height: 50vh">
  71. <van-tabs :color="theme">
  72. <van-tab :title="key" v-for="(v, key) in rankList" :key="key">
  73. <div class="SilkList">
  74. <van-cell-group inset>
  75. <van-cell title="名称" value="投票量"></van-cell>
  76. <van-row v-for="item in v" :key="item.id + 'team'">
  77. <van-col span="16"
  78. ><p class="text van-ellipsis--l2" v-text="item.name"></p
  79. ></van-col>
  80. <van-col span="8"
  81. ><p
  82. class="text"
  83. style="text-align: right"
  84. v-text="formmate(item.votes)"
  85. ></p
  86. ></van-col>
  87. </van-row>
  88. </van-cell-group>
  89. </div>
  90. </van-tab>
  91. </van-tabs>
  92. </div>
  93. </van-dialog>
  94. <!-- 登录框 -->
  95. <van-dialog
  96. theme="round-button"
  97. v-model:show="showLogin"
  98. confirm-button-text="登录"
  99. :before-close="beforeClose"
  100. >
  101. <van-cell-group inset>
  102. <van-field
  103. v-model="login.phone"
  104. required
  105. type="tel"
  106. label="手机号"
  107. placeholder="请输入手机号"
  108. >
  109. <template #button>
  110. <van-button
  111. v-if="codePhoen === 0"
  112. @click="getCode"
  113. size="small"
  114. type="primary"
  115. :color="theme"
  116. >
  117. 发送验证码
  118. </van-button>
  119. <van-count-down
  120. format="ss 秒"
  121. v-else
  122. :time="codePhoen"
  123. @finish="() => (codePhoen = 0)"
  124. />
  125. </template>
  126. </van-field>
  127. <van-field required v-model="login.code" type="digit" label="验证码" />
  128. </van-cell-group>
  129. </van-dialog>
  130. </div>
  131. </template>
  132. <script setup>
  133. import { ref, reactive, watch } from 'vue';
  134. import { showDialog, showConfirmDialog, showToast } from 'vant';
  135. import {
  136. getEnrollList,
  137. getEnrollRank,
  138. getVote,
  139. getTimes,
  140. getSendVerifyCode,
  141. verifyCode,
  142. } from '@/api/SilkRoadSpringGala.js';
  143. import Shanshipin from '@/components/shanshipin.vue';
  144. const theme = '#38379f';
  145. const background = '#e0f2fa';
  146. const w = window.$originData.orginParames.availWidth || 0;
  147. const operateId = window.$originData.orginParames.operateId;
  148. const width = (w - 16) / 2;
  149. const height = width * 0.57;
  150. const showPaihang = ref(false);
  151. const showLogin = ref(false);
  152. const rankList = ref({});
  153. const orilist = ref({});
  154. const ids = ref({});
  155. const codePhoen = ref(0);
  156. const config = reactive({
  157. times: -1,
  158. isShanShiPin: window.$shanshipin.UserId,
  159. });
  160. const search = ref('');
  161. const t = config.isShanShiPin ? 5 : 1;
  162. const phone =
  163. window.$shanshipin.Phone && window.$shanshipin.Phone != 0
  164. ? window.$shanshipin.Phone
  165. : localStorage.getItem('financePhone') || '18439106376';
  166. const login = reactive({
  167. phone,
  168. code: '',
  169. });
  170. const getList = call => {
  171. getEnrollList({
  172. type: '网络短视频',
  173. operateId,
  174. }).then(r => {
  175. const array = r || [];
  176. const obj = {};
  177. const ids_list = [];
  178. for (let i = 0; i < array.length; i++) {
  179. const v = array[i];
  180. v.noShow = false;
  181. if (obj[v.type]) obj[v.type].push(v);
  182. else obj[v.type] = [v];
  183. ids_list[v.phone] = {
  184. select: false,
  185. name: v.name,
  186. phone: v.phone,
  187. };
  188. }
  189. ids.value = ids_list;
  190. orilist.value = obj;
  191. call && call();
  192. });
  193. };
  194. getList();
  195. const getRankList = Call => {
  196. getEnrollRank({
  197. operateId,
  198. }).then(r => {
  199. const l = r || [];
  200. const obj = {};
  201. for (let i = 0; i < l.length; i++) {
  202. const v = l[i];
  203. if (obj[v.type]) obj[v.type].push(v);
  204. else obj[v.type] = [v];
  205. }
  206. rankList.value = obj;
  207. Call && Call();
  208. });
  209. };
  210. let time = null;
  211. watch(search, res => {
  212. if (time) clearTimeout(time);
  213. time = setTimeout(() => {
  214. const rex = res ? new RegExp(res) : /[.\n]*/;
  215. for (const key in orilist.value) {
  216. if (!Object.hasOwnProperty.call(orilist.value, key)) continue;
  217. const v = orilist.value[key];
  218. for (let i = 0; i < v.length; i++) {
  219. const vv = v[i];
  220. vv.noShow = !rex.test(vv.name);
  221. }
  222. }
  223. clearTimeout(time);
  224. time = null;
  225. }, 200);
  226. });
  227. const getCode = () => {
  228. // 获取验证码
  229. if (!/1[0-9]{10}/.test(login.phone)) {
  230. showToast('请输入正确的手机号');
  231. return;
  232. }
  233. getSendVerifyCode({
  234. phone: login.phone,
  235. }).then(() => {
  236. codePhoen.value = 60000;
  237. });
  238. };
  239. const toupiao = function () {
  240. let names = [];
  241. let phones = [];
  242. for (let i = 0; i < ids.value.length; i++) {
  243. const v = ids.value[i] || {};
  244. if (!v.select) continue;
  245. names.push(v.name);
  246. phones.push(v.phone);
  247. }
  248. if (!phones.length) return showToast('请选择您中意的候选人');
  249. if (phones.length > 10) return showToast('最多只能投10人');
  250. if (!login.phone || login.phone.length < 11) return (showLogin.value = true); //如果没有手机号提示登录
  251. showConfirmDialog({
  252. message: '确定投票给' + names.join(',') + '么?',
  253. beforeClose: type => {
  254. if (type !== 'confirm') return true;
  255. return new Promise(resolve => {
  256. getVote({
  257. target: phones.join(','),
  258. source: login.phone,
  259. client: config.isShanShiPin ? '闪视频' : '其他',
  260. operateId,
  261. })
  262. .then(() => {
  263. showToast('投票成功!');
  264. resolve(true);
  265. })
  266. .catch(err => {
  267. showToast(err.message || '投票失败!');
  268. resolve(true);
  269. });
  270. });
  271. },
  272. });
  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: 2em;
  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>