From 27b1eab2ceb427ad4dac078423c45cfdf947ff23 Mon Sep 17 00:00:00 2001 From: "XGL-THINKPAD-X1\\rucky" Date: Tue, 16 Jan 2024 17:43:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=83=A8=E5=88=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 6 ++- src/api/http.js | 2 + src/api/index.js | 30 ++++++++++- src/components/Draw.vue | 35 ++++++++++--- src/components/Index.vue | 7 ++- src/components/Loading.vue | 14 +++++ src/page/Home/App.vue | 103 +++++++++++++++++++++++++++++++++++-- src/page/Home/main.js | 4 +- 8 files changed, 182 insertions(+), 19 deletions(-) diff --git a/.env.development b/.env.development index 2ee1b39..b3e7665 100644 --- a/.env.development +++ b/.env.development @@ -1 +1,5 @@ -VITE_MODE = dev \ No newline at end of file +VITE_MODE = dev +VITE_HOST = https://wmm-stg.pingan.com.cn +VITE_CDN = https://cdn.xglpa.com +VITE_FOLDER = /vite-4 +VITE_API = /intfgw/data/mmoactivity \ No newline at end of file diff --git a/src/api/http.js b/src/api/http.js index efa51c5..656cb55 100644 --- a/src/api/http.js +++ b/src/api/http.js @@ -5,10 +5,12 @@ import qs from "qs"; // json格式请求头 const headerJSON = { "Content-Type": "application/json;charset=UTF-8", + 'internetGatewaySource':'internetGwSourceExt' }; // FormData格式请求头 const headerFormData = { "Content-Type": "application/x-www-form-urlencoded", + 'internetGatewaySource':'internetGwSourceExt' }; diff --git a/src/api/index.js b/src/api/index.js index b321e51..74d08a6 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,7 +1,33 @@ import http from './http' -export function drawApi(data, authorization) { - return http.post("/api/user/addSurveyed", +// 获取code +export function authorize(data, authorization) { + return http.post("/h5/Oauth/authorize", + data, + true, + ); +} + +// 获取用户信息 +export function getUserInfo(data, authorization) { + return http.post("/h5/Oauth/getUserInfo", + data, + true, + ); +} + +// 我的奖品 +export function getMyPrize(data, authorization) { + return http.post("/h5/activity/getMyPrize", + data, + true, + authorization + ); +} + +// 抽奖 +export function draw(data, authorization) { + return http.post("/h5/activity/draw", data, true, authorization diff --git a/src/components/Draw.vue b/src/components/Draw.vue index 728c93b..bde8ac9 100644 --- a/src/components/Draw.vue +++ b/src/components/Draw.vue @@ -4,7 +4,7 @@ import { addPoint, debounceTap } from '@/plugins' import { Toast } from "vant"; import { Clipboard } from "v-clipboard"; import { useMainStore } from "@/store"; -import { drawApi } from '@/api' +// import { drawApi } from '@/api' // 页面配置初始化 @@ -29,16 +29,35 @@ const drawFn = (event) => { gsap.fromTo(e, { rotation: '-30' }, { rotation: '+30', repeat: -1, yoyo: true, ease: 'none', duration: 0.3 }) // const res = await drawApi({}) + const res = await draw({},userStore.token) + if(res.code == 0){ + // isDrawn后端判断有没有中将 + hasPrize.value = res.data.isDrawn == 1 ? true : false // true 中奖 || false 未中奖 + + if(res.data.isDrawn == 1){ + hasPrize.value = true + }else{ - setTimeout(() => { + } + }else{ hasPrize.value = false // true 中奖 || false 未中奖 - showResult.value = true - console.log("showResult:", showResult.value); - Toast.clear() - gsap.from('.result-container', { duration: 0.5, scale: 0.7, autoAlpha: 0 }) - gsap.killTweensOf('.draw-light,.draw') - }, 3000) + } + + showResult.value = true + console.log("showResult:", showResult.value); + Toast.clear() + gsap.from('.result-container', { duration: 0.5, scale: 0.7, autoAlpha: 0 }) + gsap.killTweensOf('.draw-light,.draw') + + // setTimeout(() => { + // hasPrize.value = false // true 中奖 || false 未中奖 + // showResult.value = true + // console.log("showResult:", showResult.value); + // Toast.clear() + // gsap.from('.result-container', { duration: 0.5, scale: 0.7, autoAlpha: 0 }) + // gsap.killTweensOf('.draw-light,.draw') + // }, 3000) }) } diff --git a/src/components/Index.vue b/src/components/Index.vue index b4fd0ed..b17f826 100644 --- a/src/components/Index.vue +++ b/src/components/Index.vue @@ -1,11 +1,14 @@