index.vue 14 KB

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