liyongli 2 rokov pred
rodič
commit
6742b3b957

+ 63 - 0
src/api/SilkRoadSpringGala.js

@@ -0,0 +1,63 @@
+import ajax from "@/utils/request.js";
+
+// export function getBannerAndVideo(data) {
+//   return ajax({
+//     url: "https://cxzx.smcic.net/operate/worldCup.json?" + Date.now(),
+//     method: "get",
+//     urlType: "default",
+//     data,
+//   });
+// }
+
+// 用户地址存储
+export function getStore(data) {
+  return ajax({
+    url: "users/store",
+    method: "POST",
+	urlType: "slikRoad",
+    data,
+  });
+}
+
+// 抽奖次数增加
+export function getDrawPlus(data) {
+  return ajax({
+    url: "users/draw-plus",
+    method: "GET",
+	urlType: "slikRoad",
+    data,
+  });
+}
+
+// 用户信息
+export function getInfo(data) {
+  return ajax({
+    url: "users/info",
+    method: "GET",
+	urlType: "slikRoad",
+	noToast: true, // 是否提示
+    data,
+  });
+}
+
+// 发送验证码
+export function getSendVerifyCode(data) {
+  return ajax({
+    url: "users/sendVerifyCode",
+    method: "GET",
+	urlType: "slikRoad",
+    data,
+  });
+}
+
+// 抽奖
+export function getDrawOri(data) {
+  return ajax({
+    url: "prize/draw",
+    method: "GET",
+	urlType: "slikRoad",
+    data,
+  });
+}
+
+

+ 1 - 0
src/config/index.js

@@ -1,6 +1,7 @@
 export default {
   base: {
     ajax: "https://topic.smcic.net/operate/world-cup/",
+	slikRoad: "https://topic.smcic.net/operate/",
     default: ""
   },
 };

+ 64 - 64
src/utils/request.js

@@ -1,71 +1,71 @@
 import config from "../config/index.js";
-import { showLoadingToast } from "vant";
+import {
+	showLoadingToast,
+	showToast,
+	closeToast
+} from "vant";
 import "vant/lib/toast/style/index";
 
 function getdata(data) {
-  let text = "";
-  for (const key in data) {
-    text += key + "=" + data[key] + "&";
-  }
-  text ? (text = "?" + text) : "";
-  text = text.replace(/&$/, "");
-  return text;
+	let text = "";
+	for (const key in data) {
+		text += key + "=" + data[key] + "&";
+	}
+	text ? (text = "?" + text) : "";
+	text = text.replace(/&$/, "");
+	return text;
 }
 
-export default function (ori) {
-  let baseurl = config.base[ori.urlType || "ajax"];
-  let url = baseurl + ori.url;
-  !ori.noLoad && showLoadingToast({
-    message: '加载中...',
-    forbidClick: true,
-    duration: 0
-  });
-  return new Promise((resolve, reject) => {
-    var xhttp;
-    if (window.XMLHttpRequest) xhttp = new XMLHttpRequest();
-    else if (window.ActiveXObject)
-      xhttp = new window.ActiveXObject("Microsoft.XMLHTTP");
-    let method = ori.method.toUpperCase();
-    if (method === "GET") url += getdata(ori.data || {});
-    xhttp.open(method, url, true);
-    xhttp.setRequestHeader(
-      "Content-type",
-      ori.header
-        ? ori.header.contentType || "application/json"
-        : "application/json"
-    );
-    method === "GET" ? xhttp.send() : xhttp.send(JSON.stringify(ori.data));
-    xhttp.onreadystatechange = function () {
-      if (this.readyState != 4) return;
-      showLoadingToast.clear()
-      if (this.status === 404) {
-        showLoadingToast("请求失败 " + this.status);
-        reject(this.status);
-        return;
-      }
-      if (this.status != 200) {
-        let t = JSON.parse(this.responseText || "{}");
-        showLoadingToast(t.message || "请求失败 " + this.status);
-        reject(t.message);
-        return;
-      }
-    //   console.log(this.responseText)
-      let data = {};
-      try {
-        data =
-          this.responseText !== "null"
-            ? JSON.parse(this.responseText || "{}")
-            : {};
-      } catch (err) {
-        showLoadingToast("请求失败");
-        console.error(err);
-        reject(err);
-      }
-      if (data.code === 0) resolve(data.data);
-      else {
-        showLoadingToast(data.message || "请求失败");
-        reject(data);
-      }
-    };
-  });
+export default function(ori) {
+	let baseurl = config.base[ori.urlType || "ajax"];
+	let url = baseurl + ori.url;
+	let isEnd = false;
+	let noToast = ori.noToast;
+	let time = setTimeout(() => {
+		clearTimeout(time);
+		!isEnd && !ori.noLoad && showLoadingToast({
+			message: '加载中...',
+			forbidClick: true,
+			duration: 0
+		});
+	}, 300);
+	return new Promise((resolve, reject) => {
+		var xhttp;
+		if (window.XMLHttpRequest) xhttp = new XMLHttpRequest();
+		else if (window.ActiveXObject)
+			xhttp = new window.ActiveXObject("Microsoft.XMLHTTP");
+		let method = ori.method.toUpperCase();
+		if (method === "GET") url += getdata(ori.data || {});
+		xhttp.open(method, url, true);
+		xhttp.setRequestHeader(
+			"Content-type",
+			ori.header ?
+			ori.header.contentType || "application/json" :
+			"application/json"
+		);
+		method === "GET" ? xhttp.send() : xhttp.send(JSON.stringify(ori.data));
+		xhttp.onreadystatechange = function() {
+			if (this.readyState != 4) return;
+			isEnd = true;
+			closeToast();
+			if (this.status != 200) {
+				let t = JSON.parse(this.responseText || "{}");
+				!noToast && showToast(t.message || "请求失败 " + this.status);
+				reject(t);
+				return;
+			}
+			let data = {};
+			try {
+				data =
+					this.responseText !== "null" ?
+					JSON.parse(this.responseText || "{}") : {};
+			} catch (err) {
+				!noToast && showToast("请求失败");
+				console.error(err);
+				reject(err);
+			}
+			if (data.code === 0) resolve(data.data);
+			else reject(data);
+		};
+	});
 }

+ 1 - 1
src/view/SilkRoadSpringFestivalGala/index.vue

@@ -87,7 +87,7 @@ document.title = "多彩丝路中国年 | 2023新年开运色";
  * window.$originData.orginParames.parameters 固定参数值
  * window.$originData.urlParames url参数
  */
-const page = ref("six");
+const page = ref("first");
 // let first_text = ['"大美中国·多彩丝路"', "2023丝路春晚 联名限定"];
 // for (let i = 0; i < first_text.length; i++) {
 //   first_text[i] = first_text[i].split("");

+ 229 - 230
src/view/SilkRoadSpringFestivalGala/pages/eight.vue

@@ -1,239 +1,238 @@
 <template>
-  <div class="eight">
-    <van-row class="luckDraw">
-      <van-col
-        span="8"
-        v-for="i in 12"
-        :key="i + 'll'"
-        :class="{ shakeSlow: show[i - 1] }"
-      >
-        <div v-if="show[i - 1]" class="click">点我</div>
-        <van-image
-          @click="draw"
-          :width="img.width"
-          :height="img.height"
-          :class="{ img: true }"
-          fit="contain"
-          :src="'https://cxzx.smcic.net/topic/tool/img/silugift/' + i + '.png'"
-        >
-          <template v-slot:loading>
-            <van-loading type="spinner" size="20" />
-          </template>
-        </van-image>
-      </van-col>
-    </van-row>
-
-    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
-      <van-swipe-item>
-        <div class="vieoPlay">
-          <van-icon
-            name="play-circle-o"
-            @click="
+	<div class="eight">
+		<van-row class="luckDraw">
+			<van-col span="8" v-for="i in 12" :key="i + 'll'" :class="{ shakeSlow: show[i - 1] }">
+				<div v-if="show[i - 1]" class="click">点我</div>
+				<van-image @click="draw" :width="img.width" :height="img.height" :class="{ img: true }" fit="contain"
+					:src="'https://cxzx.smcic.net/topic/tool/img/silugift/' + i + '.png'">
+					<template v-slot:loading>
+						<van-loading type="spinner" size="20" />
+					</template>
+				</van-image>
+			</van-col>
+		</van-row>
+		<van-notice-bar color="#000000" background="#ffffff" wrapable :scrollable="false"
+			text="点击下方小视频,给手气充能,增加一次抽奖机会!" />
+		<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
+			<van-swipe-item>
+				<div class="vieoPlay">
+					<van-icon name="play-circle-o" @click="
               () => playVideo('https://cxzx.smcic.net/topic/tool/media/ad.mp4')
-            "
-            color="#ffffff"
-            class="play"
-            size="40"
-          />
-          <img
-            style="width: 100%"
-            src="https://cxzx.smcic.net/topic/tool/media/ad.mp4?x-oss-process=video/snapshot,t_100,f_jpg,m_fast"
-          />
-        </div>
-      </van-swipe-item>
-    </van-swipe>
-
-  </div>
+            " color="#ffffff" class="play" size="40" />
+					<img style="width: 100%"
+						src="https://cxzx.smcic.net/topic/tool/media/ad.mp4?x-oss-process=video/snapshot,t_100,f_jpg,m_fast" />
+				</div>
+			</van-swipe-item>
+		</van-swipe>
+
+	</div>
 </template>
 <script setup>
-import { reactive, ref, defineEmits } from "vue";
-import { showDialog } from "vant";
-// import { onMounted, reactive } from "vue";
-// import { isIpad, isIpod, isIphone } from "../../utils/isTerminal";
-/**
- * window.$originData.orginParames.title 页面标题
- * window.$originData.orginParames.parameters 固定参数值
- * window.$originData.urlParames url参数
- */
-let w = window.$originData.orginParames.availWidth || 0;
-const show = ref(Array(12).fill(false));
-const address = ref(localStorage.getItem("silkRoadAddress") || "");
-// const gift = require("@/assets/img/")
-const next = false;
-const emits = defineEmits(["showVideo","showTitleFunc"]);
-
-let t = setInterval(() => {
-  let index = Math.ceil(Math.random() * 12) - 1;
-  if (index < 0) index = 0;
-  for (let i = 0; i < show.value.length; i++) {
-    show.value[i] = i == index;
-  }
-  if (next) clearInterval(t);
-}, 5000);
-
-w = (w / 3) * 0.8;
-const img = reactive({
-  width: w,
-  height: w,
-});
-
-function draw() {
-  if (!localStorage.getItem("silkRoadPhone")) return toLogin();
-  drawDialog();
-}
-
-function drawDialog() {
-  let isdraw = Math.random() >= 0.95; // 非中将概率,后期接入接口后直接由接口提供是否中将
-  showDialog({
-    title: "抽奖提示",
-    message: () => {
-      if (isdraw) return drawIsTrue();
-      if (!isdraw) return drawIsFalse();
-    },
-  }).then(() => {
-    // on close
-    address.value && localStorage.setItem("silkRoadAddress", address.value);
-  });
-}
-
-function drawIsTrue() {
-  const gift = {
-    url: "",
-    name: "",
-  };
-  if (Math.random() > 0.5) {
-    gift.url = "https://cxzx.smcic.net/topic/tool/img/gift1.png";
-    gift.name = "果娃果妹玩偶";
-  } else {
-    gift.url = "https://cxzx.smcic.net/topic/tool/img/gift.jpg";
-    gift.name = "长武苹果";
-  }
-  // {address.value ? addressField : ''}
-  // const addressField = (<van-field required v-model={address} label="地址" type="text" placeholder="请输入地址" ></van-field>);
-  let ele = (
-    <div>
-      <img class="dialogImg" src={gift.url} />
-      <br />
-      <p>
-        恭喜您获得
-        <span style="color: red">{gift.name}</span>!
-      </p>
-    </div>
-  );
-  return ele;
-}
-
-function toLogin() {
-	emits("showTitleFunc");
-}
-
-function drawIsFalse() {
-  let ele = (
-    <div>
-      很遗憾哟,新年礼物擦肩而过啦!点击下方刷个小视频吧,给手气充能,获取额外抽奖机会!
-    </div>
-  );
-  return ele;
-}
-
-function playVideo(url) {
-  emits("showVideo", url);
-}
+	import {
+		reactive,
+		ref,
+		defineEmits,
+		defineExpose
+	} from "vue";
+	import {
+		showDialog
+	} from "vant";
+	import {
+		getDrawOri,
+	} from "@/api/SilkRoadSpringGala.js";
+	// import { onMounted, reactive } from "vue";
+	// import { isIpad, isIpod, isIphone } from "../../utils/isTerminal";
+	/**
+	 * window.$originData.orginParames.title 页面标题
+	 * window.$originData.orginParames.parameters 固定参数值
+	 * window.$originData.urlParames url参数
+	 */
+	let w = window.$originData.orginParames.availWidth || 0;
+	const show = ref(Array(12).fill(false));
+	const address = ref(localStorage.getItem("silkRoadAddress") || "");
+	// const gift = require("@/assets/img/")
+	const next = false;
+	const emits = defineEmits(["showVideo", "showTitleFunc"]);
+
+	let t = setInterval(() => {
+		let index = Math.ceil(Math.random() * 12) - 1;
+		if (index < 0) index = 0;
+		for (let i = 0; i < show.value.length; i++) {
+			show.value[i] = i == index;
+		}
+		if (next) clearInterval(t);
+	}, 5000);
+
+	w = (w / 3) * 0.8;
+	const img = reactive({
+		width: w,
+		height: w,
+	});
+
+	function draw() {
+		const phone = localStorage.getItem("silkRoadPhone");
+		if (!phone) return emits("showTitleFunc");
+		getDrawOri({
+			phone
+		}).then(r => {
+			console.log("---->", r);
+			let isdraw = r.prizeId !== 1; // 非中将概率,后期接入接口后直接由接口提供是否中将
+			showDialog({
+				title: r.name,
+				message: () => {
+					if (isdraw) return drawIsTrue(r);
+					if (!isdraw) return drawIsFalse();
+				},
+			}).then(() => {
+				// on close
+				address.value && localStorage.setItem("silkRoadAddress", address.value);
+			});
+		})
+	}
+
+	function drawIsTrue(data) {
+		const gift = {
+			url: data.url,
+			name: data.name,
+		};
+		let ele = ( < div >
+			<
+			img class = "dialogImg"
+			src = {
+				gift.url
+			}
+			/> <br / >
+			<
+			p > 恭喜您获得 < span style = "color: red" > {
+				gift.name
+			} < /span>!</p >
+			<
+			/div>);
+			return ele;
+		}
+
+		function drawIsFalse() {
+			let ele = ( <
+				div >
+				很遗憾哟, 新年礼物擦肩而过啦! 点击下方刷个小视频吧, 给手气充能, 获取额外抽奖机会! <
+				/div>
+			);
+			return ele;
+		}
+
+		function playVideo(url) {
+			emits("showVideo", url);
+		}
+
+		defineExpose({
+			draw
+		})
 </script>
 <style lang="scss" scoped>
-.eight {
-  width: 100%;
-  height: 100%;
-  padding: 0.5em 0;
-  background-color: #fff;
-  position: relative;
-  .luckDraw {
-    $background: #00000040;
-    background-color: #eeeeee80;
-    border-radius: 5px;
-    padding: 0.5em;
-    margin: 0.5em auto;
-    width: 96%;
-    .img {
-      border-radius: 5px;
-      display: block;
-      margin: auto;
-      border: 3px solid #ffffff;
-    }
-    .click {
-      background-color: $background;
-      position: absolute;
-      border-radius: 3px;
-      text-align: center;
-      padding: 2px 3px;
-      color: #fff;
-      font-size: 14px;
-      right: -0.5em;
-      top: -0.5em;
-      width: 4em;
-      z-index: 1;
-    }
-    .click:before {
-      position: absolute;
-      display: block;
-      content: " ";
-      height: 0px;
-      width: 0px;
-      border: 3px solid $background;
-      border-top-color: rgba($color: #000000, $alpha: 0);
-      border-left-color: rgba($color: #000000, $alpha: 0);
-      bottom: -3px;
-      left: 9px;
-      transform: rotate(45deg);
-    }
-  }
-}
-
-.shakeSlow {
-  animation: shake-slow 1s ease-in-out;
-}
-
-@keyframes shake-slow {
-  0% {
-    transform: rotate(0) scale(1);
-  }
-  20% {
-    transform: rotate(2.5deg);
-  }
-  40% {
-    transform: rotate(-2.5deg);
-  }
-  60% {
-    transform: rotate(2.5deg) scale(1.1);
-  }
-  80% {
-    transform: rotate(-2.5deg);
-  }
-  100% {
-    transform: rotate(0);
-  }
-}
+	.eight {
+		width: 100%;
+		height: 100%;
+		padding: 0.5em 0;
+		background-color: #fff;
+		position: relative;
+
+		.luckDraw {
+			$background: #00000040;
+			background-color: #eeeeee80;
+			border-radius: 5px;
+			padding: 0.5em;
+			margin: 0.5em auto;
+			width: 96%;
+
+			.img {
+				border-radius: 5px;
+				display: block;
+				margin: auto;
+				border: 3px solid #ffffff;
+			}
+
+			.click {
+				background-color: $background;
+				position: absolute;
+				border-radius: 3px;
+				text-align: center;
+				padding: 2px 3px;
+				color: #fff;
+				font-size: 14px;
+				right: -0.5em;
+				top: -0.5em;
+				width: 4em;
+				z-index: 1;
+			}
+
+			.click:before {
+				position: absolute;
+				display: block;
+				content: " ";
+				height: 0px;
+				width: 0px;
+				border: 3px solid $background;
+				border-top-color: rgba($color: #000000, $alpha: 0);
+				border-left-color: rgba($color: #000000, $alpha: 0);
+				bottom: -3px;
+				left: 9px;
+				transform: rotate(45deg);
+			}
+		}
+	}
+
+	.shakeSlow {
+		animation: shake-slow 1s ease-in-out;
+	}
+
+	@keyframes shake-slow {
+		0% {
+			transform: rotate(0) scale(1);
+		}
+
+		20% {
+			transform: rotate(2.5deg);
+		}
+
+		40% {
+			transform: rotate(-2.5deg);
+		}
+
+		60% {
+			transform: rotate(2.5deg) scale(1.1);
+		}
+
+		80% {
+			transform: rotate(-2.5deg);
+		}
+
+		100% {
+			transform: rotate(0);
+		}
+	}
 </style>
 <style lang="scss">
-.eight {
-  .van-col {
-    padding: 0.2em 0;
-    position: relative;
-  }
-
-  .vieoPlay {
-    position: relative;
-    .play {
-      position: absolute;
-      top: 50%;
-      left: 50%;
-      transform: translate(-50%, -50%);
-    }
-  }
-}
-.dialogImg {
-  width: 5em;
-  display: block;
-  margin: auto;
-}
+	.eight {
+		.van-col {
+			padding: 0.2em 0;
+			position: relative;
+		}
+
+		.vieoPlay {
+			position: relative;
+
+			.play {
+				position: absolute;
+				top: 50%;
+				left: 50%;
+				transform: translate(-50%, -50%);
+			}
+		}
+	}
+
+	.dialogImg {
+		width: 5em;
+		display: block;
+		margin: auto;
+	}
 </style>

+ 71 - 47
src/view/SilkRoadSpringFestivalGala/pages/six.vue

@@ -1,7 +1,6 @@
 <template>
 	<div>
-		<van-swipe ref="swipe" :touchable="false" :show-indicators="false" vertical @change="swiperPageFunc"
-			indicator-color="white">
+		<van-swipe ref="swipe" :touchable="false" :show-indicators="false" vertical indicator-color="white">
 			<van-swipe-item>
 				<div style="width: 100%; overflow: hidden; position: relative">
 					<transition name="fade">
@@ -71,7 +70,7 @@
         </div>
       </van-swipe-item> -->
 			<van-swipe-item style="overflow: auto">
-				<eight v-if="showSheet == 1" @showTitleFunc="showTitleFunc" @showVideo="showVideo" />
+				<eight ref="eightRef" @showTitleFunc="showTitleFunc" @showVideo="showVideo" />
 			</van-swipe-item>
 		</van-swipe>
 
@@ -87,6 +86,7 @@
 				</div>
 			</div>
 		</transition>
+
 		<transition name="fade">
 			<div v-if="showOverlay" class="model">
 				<van-icon color="#fff" size="26" name="close" class="close" @click="closeSeven" />
@@ -94,9 +94,7 @@
 			</div>
 		</transition>
 
-
-
-		<van-dialog v-model:show="showTitle" title="登录" show-cancel-button @confirm="confirm" :before-close="closeTitle">
+		<van-dialog v-model:show="showTitle" title="登录" show-cancel-button :before-close="closeTitle">
 			<van-field required v-model="from.name" label="昵称" type="text" placeholder="请输入昵称" />
 			<van-field required v-model="from.phone" label="联系方式" type="tel" placeholder="请输入手机号">
 				<template #button>
@@ -123,7 +121,7 @@
 
 	const from = reactive({
 		name: "",
-		phone: "",
+		phone: localStorage.getItem("silkRoadPhone"),
 		code: ""
 	})
 
@@ -134,6 +132,14 @@
 	 * window.$originData.orginParames.parameters 固定参数值
 	 * window.$originData.urlParames url参数
 	 */
+
+	import {
+		getStore,
+		getSendVerifyCode,
+		getInfo,
+		getDrawPlus
+	} from "@/api/SilkRoadSpringGala.js";
+
 	const showImg = ref(undefined);
 	const swipe = ref(null);
 	let width = window.$originData.orginParames.availWidth * 0.7;
@@ -147,23 +153,34 @@
 		max < ori.texts[i].length && (max = ori.texts[i].length);
 	}
 	width = 14 * max;
-	const text = reactive({
-		...data[type - 1],
-		width,
-	});
 	const url = {
 		bg: require("@/assets/img/12/" + type + "-1.png"),
 		bg2: require("@/assets/img/12/" + type + "-2.png"),
 		kuang: require("@/assets/img/12/" + type + ".kuang.png"),
 		text2: require("@/assets/img/12/" + type + ".text2.png"),
 	};
-
+	const text = reactive({
+		...data[type - 1],
+		width,
+	});
+	const isCode = ref(0); // 验证码
 	const bgimg = ref(url.bg);
 	const kuangimg = ref(url.kuang);
 	const text2img = ref(url.text2);
-	const step = ref(5); // 动画步骤
-	const stepBody = ref(text.texts.length); // 首页文字显示动画
+	const step = ref(5); // 动画步骤 默认0
+	const stepBody = ref(text.texts.length); // 首页文字显示动画 默认0
 	const nextStep = ref(2);
+	const eightRef = ref(null);
+
+	// 如果有手机号获取用户信息
+	if (from.phone) {
+		getInfo({
+			phone: from.phone
+		}).then(r => {
+			r.addr && localStorage.setItem("silkRoadAddress", r.addr);
+			r.userName && localStorage.setItem("silkRoadName", r.userName);
+		});
+	}
 	// let t = setTimeout(() => {
 	//   clearTimeout(t);
 	//   step.value += 1;
@@ -172,22 +189,19 @@
 	//     if (stepBody.value === text.texts.length) {
 	//       nextStep.value = 1;
 	//       clearInterval(t);
-	//   autoStep();
+	// 	  t = setInterval(() => {
+	// 	    nextStep.value === 2 && (step.value += 1);
+	// 	    if (step.value === 5) clearInterval(t);
+	// 	  }, 3000);
 	//     }
 	//   }, 2000);
 	// }, 200);
 
-	const showSheet = ref(0);
-
 	function nextPage() {
 		if (step.value !== 5) return;
 		swipe.value.next();
 	}
 
-	function swiperPageFunc(index) {
-		showSheet.value = index;
-	}
-
 	function changeNextStep() {
 		nextStep.value += 1;
 	}
@@ -199,14 +213,6 @@
 		from.code = "";
 	}
 
-	// function autoStep() {
-	//   t = setInterval(() => {
-	//     nextStep.value === 2 && (step.value += 1);
-	//     if (step.value === 5) clearInterval(t);
-	//   }, 3000);
-	// }
-
-	const isCode = ref(0);
 
 	function getCode() {
 		// 获取验证码
@@ -214,22 +220,37 @@
 			showToast("请输入正确的手机号");
 			return;
 		}
-		console.log("获取验证码-", from.phone);
-		isCode.value = 60000;
+		getSendVerifyCode({
+			phone: from.phone
+		}).then(() => {
+			isCode.value = 60000;
+		})
 	}
 
-	function confirm() {
-		console.log('保存登录信息:', from);
-		localStorage.setItem("silkRoadPhone", from.phone);
-		localStorage.setItem("silkRoadCode", from.code);
-		localStorage.setItem("silkRoadAddress", from.address);
-		localStorage.setItem("silkRoadName", from.name);
-	}
-	
-	function closeTitle(type){
-		if (type === 'confirm' && !from.code) return false;
-		isCode.value = 0;
-		return true
+	function closeTitle(type) {
+		if (type !== 'confirm') return true;
+		const v = !from.code || !from.phone || !from.name;
+		if (v) {
+			showToast("请输入完整信息。");
+			return false;
+		}
+		getStore({
+			"userName": from.name,
+			"phone": from.phone,
+			"verifyCode": from.code
+		}).then(() => {
+			localStorage.setItem("silkRoadPhone", from.phone);
+			localStorage.setItem("silkRoadCode", from.code);
+			localStorage.setItem("silkRoadName", from.name);
+			isCode.value = 0;
+			showTitle.value = false;
+			// 调用子组件抽奖
+			eightRef.value.draw();
+			return true
+		}).catch(() => {
+
+			return false
+		})
 	}
 
 	function showDown(type) {
@@ -247,7 +268,6 @@
 		showImg.value = undefined;
 	}
 
-	
 	// 视频播放
 	const showOverlay = ref(false);
 	let time = -1;
@@ -293,11 +313,15 @@
 
 	function endVideo() {
 		if (time == -1) return;
+		const phone = localStorage.getItem("silkRoadPhone");
 		autoTime = Date.now() - time;
-		console.log(autoTime);
-		if (autoTime / current <= 0.95 || !localStorage.getItem("silkRoadPhone"))
+		if (autoTime / current <= 0.95 || !phone)
 			return;
-		showToast("已增加一次抽奖机会!");
+		getDrawPlus({
+			phone
+		}).then(() => {
+			showToast("已增加一次抽奖机会!");
+		})
 	}
 </script>
 <style lang="scss" scoped>