index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. <template>
  2. <div class="page">
  3. <div class="page-top">
  4. <div class="top-tip-container">
  5. <transition name="fade">
  6. <div class="top-tip" v-show="showMobileStatus && activityState === 1">{{ showMobile }} 已报名参赛!</div>
  7. </transition>
  8. </div>
  9. </div>
  10. <div class="page-content">
  11. <!-- 视频列表 -->
  12. <template v-if="videoListFilter.length > 0">
  13. <div class="section-title">
  14. <div class="title">视频排名</div>
  15. <div class="more" @click="onMoreClick">
  16. <span>更多</span>
  17. <span class="iconfont icon-arrow-right"></span>
  18. </div>
  19. </div>
  20. <SimpleVideoList :list="videoListFilter" @praise="onPraise" />
  21. </template>
  22. <!-- 活动介绍 -->
  23. <div class="section-title">
  24. <!-- <div class="title">活动介绍</div> -->
  25. </div>
  26. <div class="activity-content">
  27. <div class="title">赛事活动介绍</div>
  28. <dl>
  29. <dt><div>活动介绍</div></dt>
  30. <dd>采美平台和云进通在跨境物流领域达成战略合作,为广大采美客户提供轻松无忧的跨境体验!</dd>
  31. <dt><div>活动时间</div></dt>
  32. <dd>2022.10月10日——2022.12月31日</dd>
  33. <dt><div>活动奖励</div></dt>
  34. <dd>a、一等奖1000元;b、二等奖500元;c、三等奖300元</dd>
  35. <dt><div>参与方式</div></dt>
  36. <dd>
  37. 第一步:申请认证和上传相关资料可以登录ROSS官方网站或品牌授权的正品认证通入口申请;第二步:通过手机号码、机构
  38. 名称,注册账号;第三步:通过上传机构门头照片、营业地址等相关信息,进行机构认证;第四步:通过填写设备
  39. 相关名称、图片、相关购买凭证,进行设备认证。完成后登录上传视频且抖音分享成功即可!
  40. </dd>
  41. <dt><div>评奖规则</div></dt>
  42. <dd>用户登录商城注册成功后,按在规定的时间内完成点赞数最高的评定等级</dd>
  43. <dt><div>奖项公布</div></dt>
  44. <dd>用户在规定时间内完成后10个工作日将公布排名以及颁发奖品</dd>
  45. <dt><div>注意事项</div></dt>
  46. <dd>一个抖音账号只能参与一次</dd>
  47. </dl>
  48. </div>
  49. <div class="control">
  50. <div class="btn type1" @click="onToSingUp">点击报名参赛</div>
  51. <div class="btn type2" @click="onToUpload">上传抖音视频</div>
  52. </div>
  53. </div>
  54. <!-- 资质上传框 -->
  55. <GeneralDialog
  56. v-model="showDialog"
  57. title="上传营业执照"
  58. @confirm="onConfirm"
  59. confirmText="提交报名"
  60. @closed="onClosed"
  61. >
  62. <div class="general-content">
  63. <SimpleUploadImage
  64. @success="onImageSuccess"
  65. @remove="onImageRemove"
  66. :imageList="imageList"
  67. :showDetail="false"
  68. />
  69. <div class="tip">提示:请上传您的真实营业执照,以免影响 您的评奖结果!</div>
  70. </div>
  71. </GeneralDialog>
  72. <!-- 提示框 -->
  73. <GeneralDialog
  74. v-model="promptDialog"
  75. title="提示"
  76. :content="promptContent"
  77. :confirmText="promptConfirmText"
  78. @confirm="onPromptConfirm"
  79. ></GeneralDialog>
  80. </div>
  81. </template>
  82. <script>
  83. import { mapGetters } from 'vuex'
  84. export default {
  85. layout: 'app-ross',
  86. data() {
  87. const promptContentMap = {
  88. 0: '恭喜您,报名成功,请去上传您的抖音视频!',
  89. 1: '抱歉!活动还未开始,暂无法报名!',
  90. 2: '抱歉!活动已结束,暂无法报名!',
  91. 3: '抱歉!您已报名,请勿重复操作!',
  92. 4: '抱歉!请完善您的营业执照!',
  93. 5: '抱歉!您还未报名,请先报名后再来上传视频!',
  94. 6: '抱歉!活动还未开始,暂无法上传视频!',
  95. 7: '抱歉!活动已结束,暂无法上传视频!',
  96. }
  97. return {
  98. dialog: true,
  99. activityState: 0,
  100. videoList: [],
  101. // 用户报名状态
  102. signUpStatus: 0, // 0:未报名 1:已报名
  103. // 营业执照
  104. showDialog: false,
  105. imageList: [],
  106. qualificationUrl: '',
  107. // 提示框信息
  108. promptDialog: false,
  109. promptContentMap,
  110. promptStatus: -1,
  111. // 非认证机构报名提交资质报名表单
  112. formData: {
  113. mobile: '',
  114. licenseOssUrl: '',
  115. authUserId: '',
  116. licenseOssName: '',
  117. authId: '',
  118. },
  119. listQuery: {
  120. clubUserId: '',
  121. clubUserName: '',
  122. authUserId: '',
  123. pageNum: 1,
  124. pageSize: 12,
  125. status: 1,
  126. },
  127. // 参赛用户列表
  128. singInClubList: [],
  129. showMobile: '',
  130. showMobileStatus: false,
  131. }
  132. },
  133. computed: {
  134. ...mapGetters(['routePrefix', 'authUserId', 'accessToken', 'userInfo', 'authId', 'isPc']),
  135. // 提示框内容
  136. promptContent() {
  137. return this.promptContentMap[this.promptStatus]
  138. },
  139. // 确定按钮内容
  140. promptConfirmText() {
  141. return this.promptStatus === 2 ? '上传抖音视频' : '确定'
  142. },
  143. // 参赛机构手机号
  144. signInClubMobileList() {
  145. return this.singInClubList.map((item) => item.userName.replace(/^(\w{3})\w+(\w{4})$/, '$1****$2'))
  146. },
  147. videoListFilter() {
  148. return this.videoList.filter((item, index) => {
  149. return index < (this.isPc ? 6 : 4)
  150. })
  151. },
  152. },
  153. created() {
  154. this.fetchActivityStatus()
  155. this.fetchVideoList()
  156. if (this.activityState === 1) {
  157. this.fetchSignInClubList()
  158. }
  159. },
  160. mounted() {
  161. // 分享当前页面
  162. this.initAppMessageShareData()
  163. },
  164. methods: {
  165. // 参赛机构手机号滚动
  166. mobileLoop() {
  167. if (this.signInClubMobileList.length > 0) {
  168. let i = 0
  169. this.showMobile = this.signInClubMobileList[i]
  170. this.showMobileStatus = true
  171. console.log('显示')
  172. setTimeout(() => {
  173. this.showMobileStatus = false
  174. console.log('隐藏')
  175. }, 1500)
  176. const timer = setInterval(() => {
  177. i++
  178. setTimeout(() => {
  179. this.showMobileStatus = false
  180. console.log('隐藏')
  181. }, 1500)
  182. if (i > this.signInClubMobileList.length - 1) {
  183. clearInterval(timer)
  184. console.log('结束')
  185. return
  186. }
  187. console.log('显示')
  188. this.showMobile = this.signInClubMobileList[i]
  189. this.showMobileStatus = true
  190. }, 2000)
  191. }
  192. },
  193. // 查看更多视频
  194. onMoreClick() {
  195. this.$router.push(`${this.routePrefix}/activity/challenge/list`)
  196. },
  197. // 点击报名
  198. onToSingUp() {
  199. // 活动未开启
  200. if (this.activityState === 0) {
  201. this.promptStatus = 1
  202. this.promptDialog = true
  203. return
  204. }
  205. // 活动已结束
  206. if (this.activityState === 2) {
  207. this.promptStatus = 2
  208. this.promptDialog = true
  209. return
  210. }
  211. // 未登录
  212. if (!this.accessToken) {
  213. this.$store.commit('app/SHOW_LOGIN')
  214. return
  215. }
  216. // 已经报名
  217. if (this.signUpStatus === 1) {
  218. this.promptStatus = 3
  219. this.promptDialog = true
  220. return
  221. }
  222. // 未认证机构
  223. if (!this.authId) {
  224. this.promptStatus = 4
  225. this.promptDialog = true
  226. return
  227. }
  228. // 已认证机构
  229. if (this.authId) {
  230. this.clubSignUpActivity()
  231. }
  232. },
  233. // 上传抖音视频
  234. onToUpload() {
  235. // 活动未开启
  236. if (this.activityState === 0) {
  237. this.promptStatus = 6
  238. this.promptDialog = true
  239. return
  240. }
  241. // 活动已结束
  242. if (this.activityState === 2) {
  243. this.promptStatus = 7
  244. this.promptDialog = true
  245. return
  246. }
  247. // 未登录
  248. if (!this.accessToken) {
  249. this.$store.commit('app/SHOW_LOGIN')
  250. return
  251. }
  252. // 未报名
  253. if (this.signUpStatus === 0) {
  254. this.promptDialog = true
  255. this.promptStatus = 5
  256. return
  257. }
  258. this.$router.push(`${this.routePrefix}/activity/challenge/publish`)
  259. },
  260. // 机构用户报名
  261. async clubSignUpActivity() {
  262. try {
  263. this.formData.mobile = this.userInfo.mobile
  264. this.formData.authUserId = this.authUserId
  265. this.formData.authId = this.userInfo.authId
  266. await this.$http.api.clubSignUpActivity(this.formData)
  267. // 报名成功
  268. this.promptStatus = 0
  269. this.signUpStatus = 1
  270. this.promptDialog = true
  271. } catch (error) {
  272. console.log(error)
  273. }
  274. },
  275. // 提示框确定事件
  276. onPromptConfirm() {
  277. this.promptDialog = false
  278. // 上传资质
  279. if (this.promptStatus === 4) {
  280. this.showDialog = true
  281. return
  282. }
  283. // 去上传抖音视频
  284. if (this.promptStatus === 0) {
  285. this.$router.push(`${this.routePrefix}/activity/challenge/publish`)
  286. return
  287. }
  288. },
  289. // 提交资质文件
  290. onConfirm() {
  291. if (!this.formData.licenseOssUrl) {
  292. this.$toast('请上传营业执照')
  293. return
  294. }
  295. this.showDialog = false
  296. this.clubSignUpActivity()
  297. },
  298. onClosed() {
  299. this.imageList = []
  300. },
  301. // 文件上传成功
  302. onImageSuccess({ response, fileList }) {
  303. this.imageList = fileList
  304. this.formData.licenseOssUrl = response.data
  305. },
  306. // 文件移除
  307. onImageRemove() {
  308. this.imageList = []
  309. this.formData.licenseOssUrl = ''
  310. },
  311. // 视频点赞
  312. async onPraise(video) {
  313. try {
  314. if (!this.accessToken) {
  315. this.$toast('请先登录')
  316. this.$store.commit('app/SHOW_LOGIN')
  317. return
  318. }
  319. const status = video.diggStatus === 0 ? 1 : 0
  320. const { clubUserId } = this.userInfo
  321. await this.$http.api.diggcountVideo({
  322. id: video.id,
  323. diggStatus: status,
  324. clubUserId,
  325. clubUserIds: video.clubUserIds,
  326. })
  327. video.diggStatus = status
  328. let tip = ''
  329. if (video.diggStatus === 0) {
  330. tip = '已取消点赞'
  331. video.diggCount--
  332. } else {
  333. tip = '点赞成功'
  334. video.diggCount++
  335. }
  336. this.$toast.success(tip)
  337. } catch (error) {
  338. console.log(error)
  339. }
  340. },
  341. // 获取视频列表
  342. async fetchVideoList() {
  343. try {
  344. this.listQuery.authUserId = this.authUserId
  345. this.listQuery.clubUserId = this.userInfo.clubUserId
  346. const res = await this.$http.api.fetchClubVideoList(this.listQuery)
  347. this.videoList = res.data.list
  348. } catch (error) {
  349. console.log(error)
  350. }
  351. },
  352. // 获取用户活动报名状态
  353. async fetchContestInfo() {
  354. try {
  355. const res = await this.$http.api.checkContestInfo({ mobile: this.userInfo.mobile, authUserId: this.authUserId })
  356. this.signUpStatus = res.data.contestStatus
  357. } catch (error) {
  358. console.log(error)
  359. }
  360. },
  361. // 获取参赛的用户
  362. async fetchSignInClubList() {
  363. try {
  364. const res = await this.$http.api.fetchEnteredClubList({ authUserId: this.authUserId })
  365. this.singInClubList = res.data
  366. this.mobileLoop()
  367. } catch (error) {
  368. console.log(error)
  369. }
  370. },
  371. // 获取活动状态
  372. async fetchActivityStatus() {
  373. try {
  374. const res = await this.$http.api.fetchActivityStatus({
  375. authUserId: this.authUserId,
  376. })
  377. if (!res.data) return
  378. this.activityState = res.data.activityState
  379. if (!this.accessToken) return
  380. this.fetchContestInfo()
  381. } catch (error) {
  382. console.log(error)
  383. }
  384. },
  385. // 分享当前页面
  386. initAppMessageShareData() {
  387. // 重试次数
  388. let retryCount = 1
  389. this.$wxReady((wx) => {
  390. //需在用户可能点击分享按钮前就先调用
  391. wx.updateAppMessageShareData({
  392. title: '认证通', // 分享标题
  393. desc: '您的好友邀请您一起来参与认证通挑战赛,赢大奖,快来参与吧!', // 分享描述
  394. link: window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
  395. imgUrl: window.location.origin + '/activity.png', // 分享图标
  396. fail: () => {
  397. if (retryCount === 0) return
  398. this.initAppMessageShareData()
  399. retryCount--
  400. },
  401. })
  402. })
  403. },
  404. },
  405. }
  406. </script>
  407. <style lang="scss" scoped>
  408. .fade-enter-active,
  409. .fade-leave-active {
  410. transition: opacity 0.5s;
  411. }
  412. .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  413. opacity: 0;
  414. }
  415. @media screen and (min-width: 768px) {
  416. .general-content {
  417. display: flex;
  418. flex-direction: column;
  419. align-items: center;
  420. .tip {
  421. width: 266px;
  422. margin: 0 auto;
  423. margin-top: 36px;
  424. line-height: 24px;
  425. font-size: 14px;
  426. color: #b2b2b2;
  427. text-align: center;
  428. }
  429. }
  430. .page {
  431. padding-bottom: 120px;
  432. background: #fff;
  433. .page-top {
  434. width: 100%;
  435. height: 530px;
  436. background: url(~assets/theme-images/ross/pc-banner-activity.png) no-repeat center;
  437. background-size: auto 530px;
  438. .top-tip-container {
  439. position: relative;
  440. width: 870px;
  441. margin: 0 auto;
  442. .top-tip {
  443. position: absolute;
  444. left: 0;
  445. top: 32px;
  446. width: 200px;
  447. height: 32px;
  448. background: rgba(0, 0, 0, 0.4);
  449. border-radius: 2px;
  450. font-size: 14px;
  451. color: #fff;
  452. text-align: center;
  453. line-height: 32px;
  454. }
  455. }
  456. }
  457. .page-content {
  458. width: 1196px;
  459. margin: 0 auto;
  460. .section-title {
  461. display: flex;
  462. justify-content: space-between;
  463. align-items: center;
  464. padding: 32px 0 16px;
  465. .title {
  466. font-size: 16px;
  467. font-weight: bold;
  468. color: #282828;
  469. }
  470. .more {
  471. font-size: 14px;
  472. color: #999;
  473. cursor: pointer;
  474. &:hover {
  475. color: #f3920d;
  476. }
  477. }
  478. }
  479. .activity-content {
  480. min-height: 1170px;
  481. .title {
  482. font-size: 40px;
  483. color: #333;
  484. height: 80px;
  485. box-sizing: border-box;
  486. text-align: center;
  487. margin-bottom: 70px;
  488. padding-top: 20px;
  489. font-weight: bold;
  490. background: url(~assets/theme-images/ross/pc_activity_title_01.png) no-repeat center;
  491. background-size: auto 80px;
  492. }
  493. dl {
  494. width: 872px;
  495. margin: 0 auto;
  496. dt {
  497. font-size: 30px;
  498. text-align: center;
  499. margin-bottom: 24px;
  500. div {
  501. line-height: 24px;
  502. display: inline-block;
  503. border-bottom: 5px;
  504. border-bottom-color: #ffd7c5;
  505. border-bottom-style: solid;
  506. }
  507. }
  508. dd {
  509. font-size: 16px;
  510. color: #666666;
  511. text-align: center;
  512. line-height: 32px;
  513. margin-bottom: 64px;
  514. }
  515. }
  516. }
  517. .control {
  518. .btn {
  519. width: 295px;
  520. height: 50px;
  521. line-height: 50px;
  522. font-size: 16px;
  523. text-align: center;
  524. margin: 16px auto 0;
  525. cursor: pointer;
  526. border-radius: 4px;
  527. &.type1 {
  528. background: #f3920d;
  529. color: #ffffff;
  530. }
  531. &.type2 {
  532. border: 1px solid #f3920d;
  533. box-sizing: border-box;
  534. line-height: 48px;
  535. color: #f3920d;
  536. }
  537. }
  538. }
  539. }
  540. }
  541. }
  542. @media screen and (max-width: 768px) {
  543. .general-content {
  544. display: flex;
  545. flex-direction: column;
  546. align-items: center;
  547. .tip {
  548. width: 57vw;
  549. margin: 0 auto;
  550. margin-top: 4.8vw;
  551. line-height: 5.6vw;
  552. font-size: 3.2vw;
  553. color: #b2b2b2;
  554. text-align: center;
  555. }
  556. }
  557. .page {
  558. padding-bottom: 10vw;
  559. .page-top {
  560. width: 100%;
  561. height: 100vw;
  562. background: url(~assets/theme-images/ross/h5-banner-activity.png) no-repeat center;
  563. background-size: auto 100vw;
  564. .top-tip-container {
  565. position: relative;
  566. width: 100%;
  567. margin: 0 auto;
  568. .top-tip {
  569. position: absolute;
  570. left: 4vw;
  571. top: 6.4vw;
  572. width: 46vw;
  573. height: 7.2vw;
  574. background: rgba(0, 0, 0, 0.4);
  575. border-radius: 0.2vw;
  576. font-size: 3.2vw;
  577. color: #fff;
  578. text-align: center;
  579. line-height: 7.2vw;
  580. }
  581. }
  582. }
  583. .page-content {
  584. width: 85.6vw;
  585. margin: 0 auto;
  586. margin-top: 3.2vw;
  587. .section-title {
  588. display: flex;
  589. justify-content: space-between;
  590. align-items: center;
  591. padding: 32px 0 16px;
  592. .title {
  593. font-size: 16px;
  594. font-weight: bold;
  595. color: #282828;
  596. }
  597. .more {
  598. font-size: 14px;
  599. color: #999;
  600. cursor: pointer;
  601. &:hover {
  602. color: #f3920d;
  603. }
  604. }
  605. }
  606. .activity-content {
  607. min-height: 116.3vw;
  608. margin-top: 8vw;
  609. .title {
  610. font-size: 5vw;
  611. color: #333;
  612. height: 9vw;
  613. box-sizing: border-box;
  614. text-align: center;
  615. margin-bottom: 8vw;
  616. padding-top: 2.4vw;
  617. font-weight: bold;
  618. background: url(~assets/theme-images/ross/h5_activity_title_01.png) no-repeat center;
  619. background-size: auto 9vw;
  620. }
  621. dl {
  622. dt {
  623. font-size: 4.8vw;
  624. text-align: center;
  625. margin-bottom: 4.8vw;
  626. div {
  627. line-height: 3.2vw;
  628. display: inline-block;
  629. border-bottom: 0.8vw;
  630. border-bottom-color: #ffd7c5;
  631. border-bottom-style: solid;
  632. }
  633. }
  634. dd {
  635. font-size: 3.4vw;
  636. color: #666666;
  637. text-align: center;
  638. line-height: 5.6vw;
  639. margin-bottom: 8.8vw;
  640. }
  641. }
  642. }
  643. .control {
  644. .btn {
  645. width: 85.5vw;
  646. height: 12vw;
  647. line-height: 12vw;
  648. font-size: 3.6vw;
  649. text-align: center;
  650. margin: 2.4vw auto 0;
  651. cursor: pointer;
  652. border-radius: 0.4vw;
  653. &.type1 {
  654. background: #f3920d;
  655. color: #ffffff;
  656. }
  657. &.type2 {
  658. border: 0.1vw solid #f3920d;
  659. box-sizing: border-box;
  660. line-height: 11.8vw;
  661. color: #f3920d;
  662. }
  663. }
  664. }
  665. }
  666. }
  667. }
  668. </style>