activity.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <view class="container_box">
  3. <view class="header-nav" :style="{height: `calc(88rpx + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
  4. </view>
  5. <view class="conbox">
  6. <image class="activity_yh_right" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_yh_right.png" mode="widthFix"></image>
  7. <image class="activity_yh_left" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_yh_left.png" mode="widthFix"></image>
  8. <image class="activity_title" v-if="collectType!=2&&isExpiry" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_title.png" mode="widthFix"></image>
  9. <view class="activity_title2" v-if="!isExpiry==1&&collectType==2">
  10. 福袋已经失效了~
  11. </view>
  12. <template v-if="collectType==1">
  13. <view class="activity_title3">
  14. 您已经领取过本次福袋啦~
  15. </view>
  16. <view class="activity_title4">
  17. 赶紧前往芳华未来APP,兑换好物吧
  18. </view>
  19. </template>
  20. <view class="ybg_box">
  21. <view class="ybg"></view>
  22. <image class="activity_lucky_bag" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_lucky_bag.png" mode="heightFix"></image>
  23. <image class="activity_ysx" v-show="!isExpiry==1&&collectType==2" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_ysx.png" mode="widthFix"></image>
  24. <image class="activity_ylq" v-show="collectType==1" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_ylq.png" mode="widthFix"></image>
  25. </view>
  26. <view class="activity_btn animation" v-if="collectType!=2&&isExpiry" @click="handleReceive">
  27. <view class="btn">领取福袋</view>
  28. <image src="https://cdn.his.cdwjyyh.com/minapp/course/activity_btn.png" mode="heightFix"></image>
  29. <view class="exsct"></view>
  30. </view>
  31. <view class="activity_btn_down x-c" v-else @click="navTo">
  32. <text>如何下载芳华未来APP</text>
  33. <image src="https://cdn.his.cdwjyyh.com/minapp/course/activity_more.png" mode="aspectFill"></image>
  34. </view>
  35. </view>
  36. <image class="footer_img" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_xy.png" mode="widthFix"></image>
  37. <u-popup :show="show" mode="center" bgColor="transparent" :closeOnClickOverlay="false" overlayOpacity="0.7">
  38. <view class="popup-box">
  39. <image class="activity_jb" src="https://cdn.his.cdwjyyh.com/minapp/course/activity_jb.png" mode="heightFix"></image>
  40. <text class="popup-tit">恭喜您获得</text>
  41. <view class="con">
  42. <view class="numbox color_FB2205"><text class="num">+100</text>芳华币</view>
  43. <view>您的芳华币总额:<text class="color_FB2205" style="font-weight: 600;">+100</text></view>
  44. </view>
  45. <view class="popup-tips">赶紧去芳华未来APP,兑换好物吧~</view>
  46. <view class="popbtn x-c" @click="show=false">我知道啦</view>
  47. </view>
  48. <view class="popup-tips" style="color: #FFFFFF;margin-top: 60rpx;">兑换提示:请前往芳华未来APP兑换</view>
  49. <view class="popup-tips" style="color: #FFC05C;text-decoration-line: underline;" @click="navTo">如何下载芳华未来APP?</view>
  50. </u-popup>
  51. </view>
  52. </template>
  53. <script>
  54. import { mapGetters } from 'vuex';
  55. import { getLuckyBagInfo,receiveLuckyBag } from '@/api/course.js'
  56. export default {
  57. data() {
  58. return {
  59. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  60. show: false,
  61. status: 0,
  62. recordId: '',
  63. urlOption: {},
  64. sortLink: '',
  65. corpId: null,
  66. isLogin: false,
  67. isLoginH5:0, // 1服务号授权
  68. collectType: -1, // 领取状态(0-已发放 1-已领取 2-已失效)
  69. isExpiry: true, // false 失效 true 有效
  70. }
  71. },
  72. computed:{
  73. ...mapGetters(['coureLogin']),
  74. },
  75. watch: {
  76. coureLogin: {
  77. immediate: true, // 页面一进入就检查一次
  78. handler(val) {
  79. if (val == 2&&this.isLogin) {
  80. console.log("注册AppToken失效,请重新登录")
  81. uni.removeStorageSync('web_userInfo');
  82. uni.removeStorageSync('TOKEN_WEXIN');
  83. this.isLogin = false
  84. if(this.isLoginH5==0){
  85. this.goWXLogin()
  86. }else{
  87. this.goLogin()
  88. }
  89. }
  90. }
  91. }
  92. },
  93. onLoad(option) {
  94. this.recordId = option.recordId || ''
  95. this.urlOption = option.link ? JSON.parse(decodeURIComponent(option.link)) : {},
  96. this.sortLink = this.urlOption.link || ''
  97. this.corpId = this.urlOption.corpId
  98. console.log(this.sortLink)
  99. },
  100. methods: {
  101. goBack() {
  102. uni.navigateBack();
  103. },
  104. handleReceive() {
  105. this.show = true
  106. },
  107. navTo() {
  108. this.show = false
  109. uni.navigateTo({
  110. url: '/pages_course/appDownload'
  111. })
  112. // uni.showModal({
  113. // title: '领取失败',
  114. // content: '福袋余额不足,请联系客服',
  115. // showCancel: false,
  116. // success: function (res) {
  117. // if (res.confirm) {
  118. // console.log('用户点击确定');
  119. // } else if (res.cancel) {
  120. // console.log('用户点击取消');
  121. // }
  122. // }
  123. // });
  124. },
  125. getLuckyBagInfo() {
  126. getLuckyBagInfo({recordId:this.recordId}).then(res=>{
  127. if(res.code ==200) {
  128. this.collectType = res.data.collectType; //领取状态(0-已发放 1-已领取 2-已失效)
  129. this.isExpiry = res.data.isExpiry; //false 失效 true 有效
  130. } else {
  131. uni.showToast({
  132. title: res.msg,
  133. icon: 'none'
  134. });
  135. }
  136. })
  137. },
  138. goLogin(data) {
  139. if(this.isLoginH5==0) {
  140. this.goWXLogin()
  141. return
  142. }
  143. },
  144. goWXLogin() {
  145. this.utils.getProvider().then(provider=>{
  146. console.log('当前的环境商',provider)
  147. if (!provider) {
  148. reject()
  149. }
  150. uni.login({
  151. provider: provider,
  152. success: async loginRes => {
  153. console.log(loginRes)
  154. uni.getUserInfo({
  155. provider: provider,
  156. success: (infoRes)=> {
  157. uni.showToast({
  158. title: '报名中...',
  159. icon: 'loading'
  160. });
  161. loginByMp({code: loginRes.code,encryptedData:infoRes.encryptedData,iv:infoRes.iv,appId:getApp().globalData.appId}).then(res=>{
  162. uni.hideLoading();
  163. if (res.code == 200) {
  164. // this.checkUserInfoA()
  165. this.$store.commit('setCoureLogin', 1);
  166. uni.setStorageSync('AppTokenmini_RTCourse', res.token);
  167. uni.setStorageSync('auto_userInfo', JSON.stringify(res.user));
  168. this.isLogin = true
  169. // if(this.chatId!=''||this.chatId){
  170. // this.userlogo=true
  171. // }else{
  172. // this.getLuckyBagInfo()
  173. // }
  174. this.getLuckyBagInfo()
  175. } else {
  176. uni.showToast({
  177. title: res.msg,
  178. icon: 'none'
  179. });
  180. }
  181. }).catch(err=>{
  182. uni.hideLoading();
  183. uni.showToast({
  184. icon:'none',
  185. title: "登录失败,请重新登录",
  186. });
  187. });
  188. }
  189. });
  190. }
  191. })
  192. }).catch(err => {})
  193. }
  194. }
  195. }
  196. </script>
  197. <style scoped lang="scss">
  198. .exsct {
  199. height: 92rpx;
  200. width: 437rpx;
  201. background-color: transparent;
  202. border-radius: 69rpx;
  203. position: absolute;
  204. top: 27rpx;
  205. left: 28rpx;
  206. box-shadow: inset -57rpx 0px 40rpx -26rpx rgba(255, 255, 255, 0.7);
  207. will-change: left, opacity;
  208. animation: leftFade 2s linear infinite;
  209. opacity: 0;
  210. }
  211. .color_FB2205 {
  212. color: #FB2205;
  213. }
  214. .activity_title2,.activity_title3,.activity_title4{
  215. margin-top: 8vh;
  216. margin-bottom: 56rpx;
  217. font-family: PingFang SC, PingFang SC;
  218. font-weight: 600;
  219. font-size: 48rpx;
  220. line-height: 80rpx;
  221. filter: drop-shadow(0px 4rpx 8rpx rgba(174,0,25,0.8));
  222. text-align: center;
  223. font-style: normal;
  224. text-transform: none;
  225. background: linear-gradient(270deg, #FFF5EE 0%, #FFE2B3 100%);
  226. -webkit-background-clip: text;
  227. background-clip: text;
  228. -webkit-text-fill-color: transparent;
  229. text-fill-color: transparent;
  230. display: inline-block
  231. }
  232. .activity_title3 {
  233. font-size: 48rpx;
  234. line-height: 80rpx;
  235. margin-top: 6vh;
  236. margin-bottom: 8rpx;
  237. }
  238. .activity_title4 {
  239. font-size: 32rpx;
  240. line-height: 44rpx;
  241. margin-top: 0;
  242. margin-bottom: 48rpx;
  243. }
  244. .container_box {
  245. min-height: 100vh;
  246. position: relative;
  247. background: linear-gradient( 180deg, #FD2F3C 0%, #FFE7CE 100%);
  248. }
  249. .activity_yh_right {
  250. width: 100rpx;
  251. position: absolute;
  252. top: 25%;
  253. right: 0;
  254. }
  255. .activity_yh_left {
  256. width: 114rpx;
  257. position: absolute;
  258. top: 50%;
  259. left: 0;
  260. }
  261. .header-nav {
  262. height: 88rpx;
  263. display: flex;
  264. align-items: center;
  265. justify-content: center;
  266. overflow: hidden;
  267. box-sizing: border-box;
  268. width: 100%;
  269. }
  270. .conbox {
  271. position: relative;
  272. display: flex;
  273. flex-direction: column;
  274. align-items: center;
  275. justify-content: flex-start;
  276. z-index: 3;
  277. .activity_title {
  278. width: 632rpx;
  279. height: auto;
  280. margin-top: 28rpx;
  281. }
  282. .ybg_box {
  283. width: 566rpx;
  284. height: 580rpx;
  285. position: relative;
  286. .activity_ysx,.activity_ylq {
  287. position: absolute;
  288. left: 242rpx;
  289. top: 215rpx;
  290. width: 300rpx;
  291. height: auto;
  292. }
  293. .ybg {
  294. width: 616rpx;
  295. height: 616rpx;
  296. background: #FFE7CE;
  297. border-radius: 0rpx 0rpx 0rpx 0rpx;
  298. filter: blur(94.30000305175781px);
  299. }
  300. image {
  301. height: 580rpx;
  302. position: absolute;
  303. top: 0;
  304. left: 0;
  305. z-index: 99;
  306. }
  307. }
  308. .activity_btn_down {
  309. width: 416rpx;
  310. height: 88rpx;
  311. margin-top: 94rpx;
  312. background: rgba(0,0,0,0.3);
  313. border-radius: 56rpx 56rpx 56rpx 56rpx;
  314. font-family: PingFang SC, PingFang SC;
  315. font-weight: 600;
  316. font-size: 28rpx;
  317. color: #FFFFFF;
  318. image {
  319. width: 32rpx;
  320. height: 32rpx;
  321. margin-left: 16rpx;
  322. }
  323. }
  324. .activity_btn {
  325. height: 137rpx;
  326. width: 502rpx;
  327. margin-top: 48rpx;
  328. font-family: PingFang SC;
  329. font-weight: 600;
  330. font-size: 44rpx;
  331. color: #FFFFFF;
  332. display: flex;
  333. align-items: center;
  334. justify-content: center;
  335. position: relative;
  336. z-index: 2;
  337. overflow: hidden;
  338. border-radius: 137rpx;
  339. image {
  340. height: 137rpx;
  341. position: absolute;
  342. left: 0;
  343. top: 12rpx;
  344. z-index: -1;
  345. }
  346. }
  347. }
  348. .popup-box {
  349. width: 518rpx;
  350. min-height: 568rpx;
  351. background: linear-gradient( 180deg, #FFE7AC 0%, #FFFFFF 100%);
  352. border-radius: 56rpx 56rpx 56rpx 56rpx;
  353. position: relative;
  354. display: flex;
  355. align-items: center;
  356. flex-direction: column;
  357. box-shadow: 0 0 30px -6px rgba(255, 231, 206, 1);
  358. .activity_jb {
  359. height: 184rpx;
  360. margin-top: -130rpx;
  361. position: relative;
  362. }
  363. .popup-tit {
  364. font-family: PingFang SC;
  365. font-weight: 600;
  366. font-size: 40rpx;
  367. color: #000000;
  368. line-height: 80rpx;
  369. }
  370. .con {
  371. margin-top: 16rpx;
  372. width: 438rpx;
  373. min-height: 170rpx;
  374. padding: 16rpx 0;
  375. background: #FFE8AE;
  376. border-radius: 16rpx 16rpx 16rpx 16rpx;
  377. font-family: PingFang SC;
  378. font-weight: 400;
  379. font-size: 28rpx;
  380. color: #333333;
  381. display: flex;
  382. flex-direction: column;
  383. align-items: center;
  384. justify-content: center;
  385. }
  386. .numbox {
  387. font-weight: 600;
  388. margin-bottom: 12rpx;
  389. }
  390. .num {
  391. font-size: 68rpx;
  392. margin-right: 10rpx;
  393. }
  394. .popbtn {
  395. width: 358rpx;
  396. height: 88rpx;
  397. background: linear-gradient( 90deg, #F82D31 0%, #FD6C05 100%);
  398. box-shadow: 0rpx 8rpx 0rpx 0rpx #FEBC92;
  399. border-radius: 64rpx 64rpx 64rpx 64rpx;
  400. margin-top: 32rpx;
  401. font-family: PingFang SC, PingFang SC;
  402. font-weight: 600;
  403. font-size: 32rpx;
  404. color: #FFFFFF;
  405. }
  406. }
  407. .popup-tips {
  408. margin-top: 20rpx;
  409. font-family: PingFang SC;
  410. font-weight: 400;
  411. font-size: 24rpx;
  412. color: #666666;
  413. text-align: center;
  414. }
  415. .footer_img {
  416. width: 100%;
  417. position: fixed;
  418. bottom: 0;
  419. left: 0;
  420. }
  421. .animation {
  422. will-change: transform;
  423. animation: scaleAnimation 2s ease infinite;
  424. }
  425. @keyframes leftFade {
  426. 0% {
  427. left: -464rpx;
  428. opacity: 0;
  429. }
  430. 25% {
  431. opacity: 1;
  432. left: -249rpx;
  433. }
  434. 50% {
  435. opacity: 0;
  436. left: 16rpx;
  437. }
  438. 100% {
  439. opacity: 0;
  440. left: 490rpx;
  441. }
  442. }
  443. @keyframes scaleAnimation {
  444. 0% {
  445. transform: scale(1);
  446. }
  447. // 30% {
  448. // transform: scale(1.05);
  449. // }
  450. 50% {
  451. transform: scale(1.05);
  452. }
  453. 100% {
  454. transform: scale(1);
  455. }
  456. }
  457. </style>