diff --git a/src/api/Axios.js b/src/api/Axios.js index c362b19..d7617b3 100644 --- a/src/api/Axios.js +++ b/src/api/Axios.js @@ -1,14 +1,16 @@ import axios from 'axios' -import QS from 'qs'; +import { Toast } from 'vant' + + +let url = import.meta.env.VITE_HOST + import.meta.env.VITE_API // 创建axios const service = axios.create({ - baseURL: import.meta.env.VITE_API, + baseURL: url, timeout: 50000, }); - // 添加请求拦截器 service.interceptors.request.use((config) => { // 在发送请求之前做些什么 @@ -22,11 +24,10 @@ service.interceptors.request.use((config) => { // 添加响应拦截器 service.interceptors.response.use( (response) => { - - return response.data; + return response.data || {}; }, (error) => { - - + Toast('网络繁忙') + console.log('请求错误:', error.message); return Promise.reject(error); }); diff --git a/src/api/index.js b/src/api/index.js index daae096..b321e51 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,6 +1,6 @@ import http from './http' -export function addSurveyed(data, authorization) { +export function drawApi(data, authorization) { return http.post("/api/user/addSurveyed", data, true, diff --git a/src/assets/images/prize/cls-btn.png b/src/assets/images/prize/cls-btn.png index 06817f3..ae89033 100644 Binary files a/src/assets/images/prize/cls-btn.png and b/src/assets/images/prize/cls-btn.png differ diff --git a/src/assets/images/prize/draw-box.png b/src/assets/images/prize/draw-box.png new file mode 100644 index 0000000..7f386b6 Binary files /dev/null and b/src/assets/images/prize/draw-box.png differ diff --git a/src/assets/images/prize/draw-text.png b/src/assets/images/prize/draw-text.png new file mode 100644 index 0000000..402ef24 Binary files /dev/null and b/src/assets/images/prize/draw-text.png differ diff --git a/src/assets/images/prize/light.png b/src/assets/images/prize/light.png new file mode 100644 index 0000000..7dae6f3 Binary files /dev/null and b/src/assets/images/prize/light.png differ diff --git a/src/assets/images/prize/no-prize.png b/src/assets/images/prize/no-prize.png new file mode 100644 index 0000000..d1e05cc Binary files /dev/null and b/src/assets/images/prize/no-prize.png differ diff --git a/src/assets/images/prize/star.png b/src/assets/images/prize/star.png new file mode 100644 index 0000000..374598d Binary files /dev/null and b/src/assets/images/prize/star.png differ diff --git a/src/assets/images/prize/tips.png b/src/assets/images/prize/tips.png new file mode 100644 index 0000000..402ef24 Binary files /dev/null and b/src/assets/images/prize/tips.png differ diff --git a/src/assets/images/result/bg-1.jpg b/src/assets/images/result/bg-1.jpg new file mode 100644 index 0000000..a666119 Binary files /dev/null and b/src/assets/images/result/bg-1.jpg differ diff --git a/src/assets/images/result/bg-2.jpg b/src/assets/images/result/bg-2.jpg new file mode 100644 index 0000000..cf1bea2 Binary files /dev/null and b/src/assets/images/result/bg-2.jpg differ diff --git a/src/assets/images/result/bg-3.jpg b/src/assets/images/result/bg-3.jpg new file mode 100644 index 0000000..96b38ea Binary files /dev/null and b/src/assets/images/result/bg-3.jpg differ diff --git a/src/assets/images/result/bg-4.jpg b/src/assets/images/result/bg-4.jpg new file mode 100644 index 0000000..96b38ea Binary files /dev/null and b/src/assets/images/result/bg-4.jpg differ diff --git a/src/components/Draw.vue b/src/components/Draw.vue index 1698b85..728c93b 100644 --- a/src/components/Draw.vue +++ b/src/components/Draw.vue @@ -1,21 +1,200 @@ - - + + + \ No newline at end of file diff --git a/src/components/MyPrize.vue b/src/components/MyPrize.vue index f2d51e2..914511b 100644 --- a/src/components/MyPrize.vue +++ b/src/components/MyPrize.vue @@ -61,7 +61,8 @@ onMounted(() => { .MyPrizePage { @include fixed(); @include flexCen(); - background-color: rgba($color: #000000, $alpha: 0.7); + background-color: rgba($color: #000000, $alpha: 0.8); + .myPrize-container { position: relative; @include box(665px, 731px); @@ -83,6 +84,7 @@ onMounted(() => { display: flex; flex-direction: row; align-items: center; + .code { font-size: 25px; font-weight: 700; @@ -97,7 +99,7 @@ onMounted(() => { } .myPrize-cls-btn { - @include pos(57px, 57px, 517px, 114px); + @include pos(82px, 82px, 517px, 114px); @include bg_pos("prize/cls-btn.png"); } } diff --git a/src/components/Question.vue b/src/components/Question.vue index c925895..dd7f7d1 100644 --- a/src/components/Question.vue +++ b/src/components/Question.vue @@ -1,7 +1,7 @@ + + + \ No newline at end of file diff --git a/src/components/Rule.vue b/src/components/Rule.vue index 106b19a..83c4a82 100644 --- a/src/components/Rule.vue +++ b/src/components/Rule.vue @@ -1,21 +1,21 @@ - - + + \ No newline at end of file diff --git a/src/data/index.js b/src/data/index.js index 07fb430..c5734d1 100644 --- a/src/data/index.js +++ b/src/data/index.js @@ -1,4 +1,4 @@ -export default [ +export const data = [ { id: 1, type: 'mbti', @@ -203,4 +203,67 @@ export default [ }, ], }, +] + +export const mbtiList = [ + { + type: 'INTJ', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'INTP', + spe: '富有创造力的发明家,对知识有着止不住的渴望', + }, + { + type: 'ENTJ', + spe: '大胆,富有想象力且', + }, + { + type: 'ENTP', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'INFJ', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'INFP', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'ENFJ', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'ENFP', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'ISTJ', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'ISFJ', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'ESTJ', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'ISTP', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'ISFP', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'ESTP', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, + { + type: 'ESFP', + spe: '富有想象力和战略性的思想家,一切皆在计划之中', + }, ] \ No newline at end of file diff --git a/src/page/Home/App.vue b/src/page/Home/App.vue index 438f6d7..a36e092 100644 --- a/src/page/Home/App.vue +++ b/src/page/Home/App.vue @@ -2,8 +2,10 @@
- + + +
@@ -13,6 +15,8 @@ import Loading from "@/components/Loading"; import Index from "@/components/Index"; import Question from "@/components/Question"; import MyPrize from "@/components/MyPrize"; +import Draw from "@/components/Draw"; +import Result from "@/components/Result"; import { createBGM } from "@/plugins"; const showLoad = ref(true); @@ -50,6 +54,20 @@ const myPrizeFn = (item) => { } }; +const showDraw = ref(false); +const drawFn = (item) => { + if (item.action == "hide") { + showDraw.value = false; + } +}; + +const showResult = ref(true); +const resultFn = (item) => { + if (item.action == "hide") { + showResult.value = false; + } +}; + onMounted(() => { // createBGM(); }); diff --git a/src/store/index.js b/src/store/index.js index b88812b..2b1bc71 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,17 +1,28 @@ // pinia仓库 import { defineStore } from "pinia" - export const useMainStore = defineStore("counter", { state: () => { return { - name: '超级管理员', - prizeCode: 'DKS18', - prizeMoney: '8.88', + token: '', + MBTI: '', //测试结果 + prizeCode: 'DKS18', //兑换码 + prizeMoney: '8.88', //金额 } }, // 相当于computed属性,对state进行二次加工 getters: {}, // 异步处理方法 - actions: {}, + actions: { + updateToken(token) { + this.token = token + }, + updatePrize(code, money) { + this.prizeCode = code + this.prizeMoney = money + }, + updateMBTI(type) { + this.MBTI = type + } + }, })