135 lines
3.1 KiB
Vue
135 lines
3.1 KiB
Vue
<template>
|
|
<view>
|
|
<image src="@/static/image/home/new_line.png" mode="" class="line"></image>
|
|
<image
|
|
src="@/static/image/home/new_flower.png"
|
|
mode=""
|
|
class="flower"
|
|
></image>
|
|
<view class="text">{{ $t("welcome.toHome") }}</view>
|
|
<!-- <view class="title-one">- - -{{$t('welcome.title')}}- - -</view> -->
|
|
<!-- <image class="img" src="@/static/image/home/fonchain.png"></image> -->
|
|
<image class="logo" src="@/static/image/home/fontree-white.png"></image>
|
|
<u-loading-page
|
|
loading-text="请在微信浏览器中打开"
|
|
:loading="loading"
|
|
></u-loading-page>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
};
|
|
},
|
|
onShow() {
|
|
// if (this.loading) return;
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
url: uni.getStorageSync("login-redirect") || "/pages/index/index",
|
|
success: () => {
|
|
uni.setStorageSync("collectionsDetail", true);
|
|
if (uni.getStorageSync("login-redirect")) {
|
|
uni.removeStorageSync("login-redirect");
|
|
}
|
|
},
|
|
});
|
|
}, 3000);
|
|
},
|
|
onLoad(params) {
|
|
// 获取openid
|
|
if (params) {
|
|
uni.setStorageSync("openid_code", params.code);
|
|
uni.setStorageSync("openid_state", params.state);
|
|
}
|
|
let ua = navigator.userAgent.toLowerCase();
|
|
if (ua.match(/MicroMessenger/i) == "micromessenger") {
|
|
let openid_code = uni.getStorageSync("openid_code");
|
|
if (!openid_code) {
|
|
const apiUrl = "https://appointteam.szjixun.cn/";
|
|
window.location.href = `${apiUrl}api/appointment/auth/wx?time=${Math.random()}¬ifyUrl=${encodeURIComponent(
|
|
window.location.href
|
|
)}`;
|
|
} else {
|
|
this.handleOpenId();
|
|
}
|
|
} else {
|
|
this.loading = true;
|
|
}
|
|
},
|
|
methods: {
|
|
async handleOpenId() {
|
|
let params = {
|
|
code: uni.getStorageSync("openid_code"),
|
|
state: uni.getStorageSync("openid_state"),
|
|
};
|
|
await this.$api.login
|
|
.getOpenId(params)
|
|
.then((res) => {
|
|
if (res.status === 0) {
|
|
uni.setStorageSync("openId", res.data.openId);
|
|
}
|
|
})
|
|
.catch((err) => {});
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background: url("@/static/image/home/welcome-bg.png") no-repeat;
|
|
background-size: 100% 100%;
|
|
background-attachment: fixed;
|
|
height: 100vh;
|
|
// border: 1px solid red;
|
|
}
|
|
.line {
|
|
width: 2rpx;
|
|
height: 164rpx;
|
|
position: absolute;
|
|
left: 50%;
|
|
top: 0;
|
|
transform: translateX(-50%);
|
|
}
|
|
.flower {
|
|
width: 43rpx;
|
|
height: 43rpx;
|
|
position: absolute;
|
|
left: 47%;
|
|
top: 167rpx;
|
|
// transform: translateX(-50%);
|
|
animation: fadenum 1s infinite;
|
|
}
|
|
@keyframes fadenum {
|
|
100% {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
.text {
|
|
position: absolute;
|
|
// left: 37%;
|
|
top: 227rpx;
|
|
width: 100%;
|
|
text-align: center;
|
|
}
|
|
.title-one {
|
|
color: #558bf2;
|
|
position: absolute;
|
|
font-size: 33upx;
|
|
// left: 26%;
|
|
top: 600rpx;
|
|
width: 100%;
|
|
text-align: center;
|
|
}
|
|
.logo {
|
|
width: 202rpx;
|
|
height: 56rpx;
|
|
position: absolute;
|
|
top: 92rpx;
|
|
left: 46rpx;
|
|
}
|
|
</style>
|