Browse Source

修改登录和增加懒加载

master
liaoxinyu 2 years ago
parent
commit
c049e975b7
  1. 4
      common/js/api.js
  2. 13
      pages/home/home.vue
  3. 149
      pages/login/login.vue

4
common/js/api.js

@ -1,10 +1,10 @@
// let baseUrl = 'http://192.168.66.221:8000' // let baseUrl = 'http://192.168.66.221:8000'
// let baseUrl = 'http://192.168.66.16:8084' let baseUrl = 'http://192.168.66.16:8084'
// baseUrl = 'https://ggl.xingtongworld.com' // baseUrl = 'https://ggl.xingtongworld.com'
// baseUrl = 'https://ggl.dingguagua.vip' // baseUrl = 'https://ggl.dingguagua.vip'
// baseUrl = 'https://apps.dingguagua.vip' // baseUrl = 'https://apps.dingguagua.vip'
let baseUrl = 'https://apps.dingguagua.vip' // let baseUrl = 'https://apps.dingguagua.vip'
let API = { let API = {
baseUrl: baseUrl, baseUrl: baseUrl,

13
pages/home/home.vue

@ -14,10 +14,7 @@
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000"> <swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
<swiper-item v-for="(item, index) in bannerList" :key="index"> <swiper-item v-for="(item, index) in bannerList" :key="index">
<!-- <image :src="item.image" mode=""></image> --> <!-- <image :src="item.image" mode=""></image> -->
<!-- <image v-lazy="item.image" mode=""></image> -->
<img v-lazy="item.image" /> <img v-lazy="item.image" />
<!-- <img class="lazy" :src="item.image" alt=""> -->
<!-- <img class="lozad" data-src="'@/static/home/300.jpg'"> -->
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
@ -449,7 +446,6 @@
} }
] ]
}; };
this.pieChart.setOption(option); this.pieChart.setOption(option);
}, },
@ -460,6 +456,7 @@
page:1, limit: 10 page:1, limit: 10
}, res=>{ }, res=>{
this.bannerList = res.data.list; this.bannerList = res.data.list;
// console.log(res.data,11111);
}) })
}, },
/*专区*/ /*专区*/
@ -712,7 +709,13 @@
border-radius: 10px; border-radius: 10px;
overflow: hidden; overflow: hidden;
} }
image{ // image{
// width: 700rpx;
// height: 300rpx;
// border-radius: 10px;
// overflow: hidden;
// }
img{
width: 700rpx; width: 700rpx;
height: 300rpx; height: 300rpx;
border-radius: 10px; border-radius: 10px;

149
pages/login/login.vue

@ -1,16 +1,13 @@
<!-- 账号密码登录页 --> <!-- 账号密码登录页 -->
<template> <template>
<view class="" style="position: relative;"> <view class="logins">
<view class="nav_area"></view> <view class="nav_area"></view>
<view class="logo_area"> <view class="logo_area">
<image src="../../static/home/logo.png" mode=""></image> <image src="../../static/home/logo.png" mode=""></image>
<!-- <view class="close" @click="backPrev()"></view> --> <!-- <view class="close" @click="backPrev()"></view> -->
<view class="selece_box" v-if="0"> <view class="selece_box" v-if="0">
<uni-data-select :clear="false" <uni-data-select :clear="false" v-model="value" :localdata="range"
v-model="value" @change="changeType"></uni-data-select>
:localdata="range"
@change="changeType"
></uni-data-select>
</view> </view>
</view> </view>
<text class="title-box">欢迎登陆顶呱刮</text> <text class="title-box">欢迎登陆顶呱刮</text>
@ -18,11 +15,11 @@
<uni-forms> <uni-forms>
<uni-forms-item name="username"> <uni-forms-item name="username">
<uni-easyinput :focus="focusUsername" @blur="focusUsername = false" class="input-box" <uni-easyinput :focus="focusUsername" @blur="focusUsername = false" class="input-box"
:inputBorder="false" v-model="username" placeholder="请输入手机号/账号" /> :inputBorder="false" v-model="username" placeholder="请输入手机号/账号"/>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="password"> <uni-forms-item name="password">
<uni-easyinput :focus="focusPassword" @blur="focusPassword = false" class="input-box" clearable <uni-easyinput :focus="focusPassword" @blur="focusPassword = false" class="input-box" clearable
type="password" :inputBorder="false" v-model="password" placeholder="请输入密码" /> type="password" :inputBorder="false" v-model="password" placeholder="请输入密码"/>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
<uni-captcha v-if="needCaptcha" focus ref="captcha" scene="login-by-pwd" v-model="captcha" /> <uni-captcha v-if="needCaptcha" focus ref="captcha" scene="login-by-pwd" v-model="captcha" />
@ -45,11 +42,12 @@
温馨提示<br/> 温馨提示<br/>
忘记密码请联系平台 忘记密码请联系平台
</view> --> </view> -->
<view v-if="this.userType=='user'"
style="width: 100vw;text-align: center;color: #dcdcdc;font-size: 14px; line-height: 28px;position: absolute;bottom: -34vh;"> <view v-if="this.userType=='user'"
温馨提示<br/> class="bottom_t">
忘记密码请联系平台 温馨提示<br />
</view> 忘记密码请联系平台
</view>
</view> </view>
</template> </template>
@ -68,36 +66,44 @@
"focusUsername": false, "focusUsername": false,
"focusPassword": false, "focusPassword": false,
"logo": "/static/logo.png", "logo": "/static/logo.png",
userType: 'user',//user|agent|background userType: 'user', //user|agent|background
value: 0, value: 0,
range: [ range: [{
{ value: 0, text: "用户登录" }, value: 0,
{ value: 1, text: "代理登录" }, text: "用户登录"
{ value: 2, text: "后台登录" }, },
], {
value: 1,
text: "代理登录"
},
{
value: 2,
text: "后台登录"
},
]
} }
}, },
onLoad(e) { onLoad(e) {
if(e.phone){ if (e.phone) {
this.username = e.phone; this.username = e.phone;
} }
// //
// token // token
if(uni.getStorageSync('user_token')){ if (uni.getStorageSync('user_token')) {
let newUrl = ''; let newUrl = '';
switch (uni.getStorageSync('userType')){ switch (uni.getStorageSync('userType')) {
case 'user': case 'user':
newUrl = '/pages/home/home'; newUrl = '/pages/home/home';
break; break;
case 'agent': case 'agent':
newUrl = '/pages/list/team'; newUrl = '/pages/list/team';
break; break;
case 'background': case 'background':
newUrl = '/pages/home/home'; newUrl = '/pages/home/home';
break; break;
} }
uni.switchTab({ uni.switchTab({
url:newUrl url: newUrl
}) })
} }
}, },
@ -132,45 +138,50 @@
duration: 3000 duration: 3000
}); });
} }
let url = '/passport/mixedLogin', newUrl = ''; let url = '/passport/mixedLogin',
let data = {account_number: this.username, password: this.password, captcha: ''}; newUrl = '';
let data = {
API.request(url, data, res=>{ account_number: this.username,
password: this.password,
captcha: ''
};
API.request(url, data, res => {
uni.showToast({ uni.showToast({
title: res.msg title: res.msg
}) })
let accounts = uni.getStorageSync('accounts') || []; let accounts = uni.getStorageSync('accounts') || [];
accounts.push(this.username); accounts.push(this.username);
accounts = Array.from(new Set(accounts)); accounts = Array.from(new Set(accounts));
uni.setStorageSync('accounts', accounts); uni.setStorageSync('accounts', accounts);
uni.setStorageSync('user_token', res.data.token); uni.setStorageSync('user_token', res.data.token);
switch (res.data.type){ switch (res.data.type) {
case 3: case 3:
newUrl = '/pages/home/home'; newUrl = '/pages/home/home';
this.userType = 'user'; this.userType = 'user';
break; break;
case 2: case 2:
newUrl = '/pages/home/home'; newUrl = '/pages/home/home';
// newUrl = '/pages/list/team'; // newUrl = '/pages/list/team';
this.userType = 'agent'; this.userType = 'agent';
break; break;
case 1: case 1:
newUrl = '/pages/home/home'; newUrl = '/pages/home/home';
this.userType = 'background'; this.userType = 'background';
break; break;
} }
uni.setStorageSync('userType', this.userType); uni.setStorageSync('userType', this.userType);
setTimeout(()=>{ setTimeout(() => {
uni.switchTab({ uni.switchTab({
url:newUrl url: newUrl
}) })
}, 1500) }, 1500)
}, fail=>{}, false) }, fail => {}, false)
}, },
/* 前往注册 */ /* 前往注册 */
toRegister() { toRegister() {
@ -181,13 +192,27 @@
console.error(e); console.error(e);
} }
}) })
}, }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.nav_area{ uni-page-body{
display: block;
box-sizing: border-box;
width: 100%;
height: 100%;
}
.logins{
height: 100%;
// position: relative;
}
.bottom_t{
width: 100vw;text-align: center;color: #dcdcdc;font-size: 14px;
line-height: 28px;height: 56px;position: relative;bottom: -25%;
}
.nav_area {
background-color: #fff; background-color: #fff;
width: 750rpx; width: 750rpx;
/* #ifdef H5 */ /* #ifdef H5 */
@ -198,18 +223,20 @@
/* #endif */ /* #endif */
padding-top: var(--status-bar-height); padding-top: var(--status-bar-height);
} }
.logo_area{
.logo_area {
width: 270px; width: 270px;
height: 50px; height: 50px;
margin: 4px auto; margin: 4px auto;
position: relative; // position: relative;
image{ image {
width: 50px; width: 50px;
height: 47px; height: 47px;
} }
} }
.title-box{
.title-box {
font-size: 26px; font-size: 26px;
color: #444; color: #444;
margin: 0px auto 20px; margin: 0px auto 20px;
@ -220,34 +247,40 @@
flex-direction: column; flex-direction: column;
} }
.content-A{ .content-A {
width: 270px; width: 270px;
margin: 0px auto; margin: 0px auto;
} }
/deep/ .uni-easyinput__content{
/deep/ .uni-easyinput__content {
background-color: #fff !important; background-color: #fff !important;
border-bottom: 1px solid #ebebeb; border-bottom: 1px solid #ebebeb;
font-size: 16px !important; font-size: 16px !important;
} }
.uni-easyinput__placeholder-class{
.uni-easyinput__placeholder-class {
font-size: 16px; font-size: 16px;
color: #cecece; color: #cecece;
} }
/deep/ .uni-easyinput__content-input{
/deep/ .uni-easyinput__content-input {
padding-left: 0px !important; padding-left: 0px !important;
// flex: 0.45; // flex: 0.45;
} }
/deep/ .content-clear-icon{
/deep/ .content-clear-icon {
// flex: 1; // flex: 1;
} }
.login-btn{
.login-btn {
border-radius: 10px; border-radius: 10px;
} }
.forget { .forget {
font-size: 14px; font-size: 14px;
color: #999; color: #999;
} }
.link-box { .link-box {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
@ -256,9 +289,9 @@
justify-content: space-between; justify-content: space-between;
margin-top: 20px; margin-top: 20px;
} }
.link { .link {
font-size: 14px; font-size: 14px;
color: #444; color: #444;
} }
</style> </style>
Loading…
Cancel
Save