123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- <template>
- <view>
-
-
- <view class="welcome">
-
- <view class="welcome-state1" >
- <view class="welcome-next" style="z-index: 999;" @click="gotoIndex()">{{step?step+'|':''}}跳过</view>
-
- </view>
-
- <u-image id="imgw" v-if="imgmode" @load="imgsload" ref="imgw" mode="widthFix">
- <view slot="loading"></view>
- <view slot="error"></view>
- </u-image>
-
- <u-image v-if="!imgmode" :height="imgH" ref="imgw2" mode="aspectFill">
- <view slot="loading"></view>
- <view slot="error"></view>
- </u-image>
-
- <view class="welcome-foot">
- <u-image width="185px" height="48px" src="../../static/img/logo.png"></u-image>
- </view>
- <!-- <view class="welcome-state2">
- <view class="welcome-logo">
- <u-image width="200px" height="50px" src="../../static/img/logo2.png"></u-image>
- </view>
- <view class="welcome-btn">
- <u-button class="welcomeBtn" shape="circle">用户登录</u-button>
- <p>随便逛逛</p>
- </view>
- </view> -->
- </view>
- </view>
- </template>
- <script>
- import * as loginApi from '@/apis/login.js'
- import * as API from '@/apis/index.js'
-
- export default {
- data() {
- return {
- isReady:true,
- step:2,
- imgH:'',
- imgmode:true
- }
- },
- methods: {
- imgsload(e){
-
-
- uni.getSystemInfo({
- success: (res) => {
- console.log(res)
-
- const query = uni.createSelectorQuery().in(this);
- query.select('#imgw').boundingClientRect(data => {
- console.log("得到布局位置信息" + JSON.stringify(data));
- console.log("节点离页面顶部的距离为" + data.height);
- var windowH=res.windowHeight;
- var imgH= data.height;
- var value=windowH-imgH;
- console.log(value)
- if(value>=100){
- this.imgmode=true
- document.getElementsByClassName("welcome-foot")[0].style="height:"+value+"px"
- }else{
- this.imgmode=false
-
- }
- }).exec();
-
- }
- })
- },
- findNoLTextConfigure(){
- loginApi.findNoLTextConfigure().then((response) => {
-
- this.carhelp.setConfig(response.data.configure)
- this.setBackImg()
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- findByOpenId(){
- var openId=this.carhelp.getOpenId()
- if(openId==""){
- console.log("--------findByOpenId----------")
- setTimeout(()=>{
- this.findByOpenId()
- },1000)
- return
- }
- uni.request({
- method:'get',
- url: process.car.BASE_URL + "/mobile/regUser/findByOpenId",
- data: {
- openId:openId,
- },
- header: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'X-Requested-With': 'XMLHttpRequest',
- }
- }).then((response) => {
- let [error, res] = response;
-
- if (res.data.code == 200&&res.data.result) {
- var token = res ? res.data.data.token : '';
- this.carhelp.setPersonInfo(res.data.data.regUser );
- this.carhelp.setToken(token);
- this.carhelp.setPersonInfoPlus(res.data.data);
-
-
-
- } else{
- this.carhelp.logoff()
-
- }
- }).catch(error => {
-
-
- })
- },
- setBackImg(){
- var img=this.carhelp.getConfig().homepageLogo
-
- if(img){
- this.$refs.imgw.src=img
- //document.body.style="background:url("+img+") no-repeat;background-size: 100%;"
- }else{
- this.$refs.imgw.src="../../static/img/welcome_bg.png"
- }
-
- },
- gotoIndex(){
- if(this.isReady){
- this.isReady=false
- uni.redirectTo({
- url: '/pages/index/index'
- });
- }
-
- },
- indexstep(){
- setTimeout(()=>{
- this.step--;
- if(this.step<0){
- this.gotoIndex()
- }else{
- this.indexstep()
- }
-
- },1000)
- },
- onReadyIng(){
- //let state = {};
- uni.getSystemInfo({
- success: (res) => {
- var windowH=res.windowHeight;
- this.imgH=(windowH-100)+"px";
-
- }
- })
-
- this.indexstep()
- this.setBackImg( )
- },
-
- },
- onLoad(op) {
-
- this.findNoLTextConfigure()
- this.findByOpenId()
- if(op.friends){
-
- this.carhelp.set("friends_invitation",{
- op:op,
- date:new Date().getTime()
- })
-
- }else if(op.gunId){
- var k=API.codeOperation("jp_team51_charge_id:A_"+op.gunId);
- if(k){
- uni.redirectTo({
- url:k
- })
- }
-
- }else if(op.jpcode){
-
- var k=API.codeOperation(op.jpcode);
- if(k){
- uni.redirectTo({
- url:k
- })
- }
-
- }else{
-
- this.onReadyIng()
- }
-
-
- },
- onUnload(){
- document.body.style=""
- },
- onReady() {
-
- }
- }
- </script>
- <style>
- page{
- /* background:url(../../static/img/welcome_bg.png) no-repeat;
- background-size:100%; */
- background-color: #ffffff;
- }
- </style>
- <style lang="scss" scoped>
- .welcome{
- position: relative;
- }
- .welcome-next{
- position: absolute;
- padding: 4px 15px;
- color:#fff;
- border-radius: 14px;
- background:rgba(0,0,0,0.5);
- right: 15px;
- top: 15px;
- }
- .welcome-foot{
- position:fixed;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #fff;
- height: 100px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .welcome-logo{
- position: absolute;
- left: 50%;
- margin-left: -100px;
- top: 120px;
- }
- .welcome-btn{
- position: fixed;
- left: 48px;
- right: 48px;
- bottom:48px;
- text-align: center;
- .welcomeBtn{
- color:#009143;
- border-color:#fff;
- }
- p{
- color:#fff;
- margin-top: 12px;
- font-size: 16px;
- }
- }
- </style>
|