|
@@ -6,20 +6,30 @@
|
|
|
:style="
|
|
|
step === 2
|
|
|
? 'opacity: 1'
|
|
|
- : step === 3
|
|
|
+ : step === 3 || step === 4
|
|
|
? 'width: 25%;transform: translate(0, 0);opacity: 1; top: 1em; left: 1em'
|
|
|
: 'opacity: 0'
|
|
|
"
|
|
|
class="firstImg"
|
|
|
/>
|
|
|
- <img
|
|
|
- :src="textimg"
|
|
|
- :style="step === 1 ? 'opacity: 1' : ''"
|
|
|
- class="sImg"
|
|
|
- />
|
|
|
+ <transition name="fade">
|
|
|
+ <div class="sImg img" v-if="step === 1" :style="'width:' + width + 'px;'">
|
|
|
+ <template v-for="(item, i) in text.texts" :key="i">
|
|
|
+ <p
|
|
|
+ v-text="item"
|
|
|
+ :style="
|
|
|
+ stepBody >= i
|
|
|
+ ? 'opacity: 1;color: ' + text.color
|
|
|
+ : 'color: ' + text.color
|
|
|
+ "
|
|
|
+ ></p>
|
|
|
+ <br />
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </transition>
|
|
|
<img
|
|
|
:src="text2img"
|
|
|
- :style="step === 3 ? 'opacity: 1' : ''"
|
|
|
+ :style="step === 4 ? 'opacity: 1' : ''"
|
|
|
class="tImg"
|
|
|
/>
|
|
|
|
|
@@ -30,13 +40,20 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="model" v-show="showImg !== undefined" @click="close">
|
|
|
- <van-icon color="#fff" size="26" name="close" class="close" @click="close" />
|
|
|
+ <van-icon
|
|
|
+ color="#fff"
|
|
|
+ size="26"
|
|
|
+ name="close"
|
|
|
+ class="close"
|
|
|
+ @click="close"
|
|
|
+ />
|
|
|
<img :src="showImg" class="modelImg" alt="" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
-import { ref } from "vue";
|
|
|
+import { ref, reactive } from "vue";
|
|
|
+import data from "../data/data.json";
|
|
|
// import { onMounted, reactive } from "vue";
|
|
|
// import { isIpad, isIpod, isIphone } from "../../utils/isTerminal";
|
|
|
/**
|
|
@@ -45,29 +62,47 @@ import { ref } from "vue";
|
|
|
* window.$originData.urlParames url参数
|
|
|
*/
|
|
|
const showImg = ref(undefined);
|
|
|
+let width = window.$originData.orginParames.availWidth * 0.7;
|
|
|
const type = Math.floor(Math.random() * 12 + 1);
|
|
|
+let ori = data[type - 1] || { texts: [] };
|
|
|
+let max = 0;
|
|
|
+for (let i = 0; i < ori.texts.length; i++) {
|
|
|
+ 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"),
|
|
|
kuang: require("@/assets/img/12/" + type + ".kuang.png"),
|
|
|
text: require("@/assets/img/12/" + type + ".text.png"),
|
|
|
text2: require("@/assets/img/12/" + type + ".text2.png"),
|
|
|
};
|
|
|
+
|
|
|
const bgimg = ref(url.bg);
|
|
|
const kuangimg = ref(url.kuang);
|
|
|
-const textimg = ref(url.text);
|
|
|
+// const textimg = ref(url.text);
|
|
|
const text2img = ref(url.text2);
|
|
|
const step = ref(0);
|
|
|
+const stepBody = ref(0);
|
|
|
let t = setTimeout(() => {
|
|
|
clearTimeout(t);
|
|
|
step.value += 1;
|
|
|
- console.log("---");
|
|
|
- return autoStep();
|
|
|
+ t = setInterval(() => {
|
|
|
+ stepBody.value += 1;
|
|
|
+ if (stepBody.value === text.texts.length) {
|
|
|
+ clearInterval(t);
|
|
|
+ autoStep();
|
|
|
+ }
|
|
|
+ }, 2000);
|
|
|
}, 200);
|
|
|
|
|
|
function autoStep() {
|
|
|
t = setInterval(() => {
|
|
|
step.value += 1;
|
|
|
- if (step.value === 3) clearInterval(t);
|
|
|
+ if (step.value === 4) clearInterval(t);
|
|
|
}, 3000);
|
|
|
}
|
|
|
|
|
@@ -80,11 +115,16 @@ function close() {
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.sex {
|
|
|
+ @font-face {
|
|
|
+ font-family: OPPOSans;
|
|
|
+ src: url(../../../assets/css/OPPOSans-R.ttf);
|
|
|
+ }
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
background-size: 100% 100%;
|
|
|
position: relative;
|
|
|
- img {
|
|
|
+ img,
|
|
|
+ .img {
|
|
|
width: 50%;
|
|
|
transition-property: all;
|
|
|
transition-duration: 2s;
|
|
@@ -102,9 +142,21 @@ function close() {
|
|
|
}
|
|
|
.sImg {
|
|
|
width: 70%;
|
|
|
+ color: #ffffff;
|
|
|
+ font-family: OPPOSans;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 2em;
|
|
|
+ opacity: 1;
|
|
|
+ p {
|
|
|
+ display: inline-block;
|
|
|
+ white-space: nowrap;
|
|
|
+ transition-property: all;
|
|
|
+ transition-duration: 2s;
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
}
|
|
|
.tImg {
|
|
|
- width: 90%;
|
|
|
+ width: 80%;
|
|
|
transition-delay: 1s;
|
|
|
-moz-transition-delay: 1s; /* Firefox 4 */
|
|
|
-webkit-transition-delay: 1s; /* Safari 和 Chrome */
|
|
@@ -126,6 +178,19 @@ function close() {
|
|
|
margin-left: 2em;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .fade-enter-from,
|
|
|
+ .fade-leave-to {
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
+ .fade-enter-active,
|
|
|
+ .fade-leave-active {
|
|
|
+ transition: opacity 1s ease;
|
|
|
+ }
|
|
|
+ .fade-enter-to,
|
|
|
+ .fade-leave-from {
|
|
|
+ opacity: 1;
|
|
|
+ }
|
|
|
}
|
|
|
.model {
|
|
|
position: fixed;
|
|
@@ -143,7 +208,7 @@ function close() {
|
|
|
transform: translate(-50%, -50%);
|
|
|
width: 80%;
|
|
|
}
|
|
|
- .close{
|
|
|
+ .close {
|
|
|
position: absolute;
|
|
|
top: 1em;
|
|
|
right: 1em;
|