| xqd
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
<view class="loginPage">
|
|
|
|
|
|
- <image src="https://zhengda.oss-cn-chengdu.aliyuncs.com/riyuexia/login_bg.png" mode="aspectFill"
|
|
|
- class="image"></image>
|
|
|
+ <image src="https://zhengda.oss-cn-chengdu.aliyuncs.com/riyuexia/login_bg.png" mode="aspectFill" class="image">
|
|
|
+ </image>
|
|
|
<view class="titleflex" style="margin: 60rpx 0 140rpx 0; ">
|
|
|
<text class="iconfont icon-back pdas" @click="$back"></text>
|
|
|
<text class="pdas">日月峡康养旅行</text>
|
| xqd
@@ -61,17 +61,18 @@
|
|
|
},
|
|
|
onLoad() {
|
|
|
this.initLogin()
|
|
|
+ // this.checkTime()
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取微信登录的code以及发送请求
|
|
|
initLogin() {
|
|
|
+ this.getLoginTime()
|
|
|
uni.login({
|
|
|
success: (res) => {
|
|
|
// console.log(res)
|
|
|
- if (res.code) { //微信登录成功 已拿到code
|
|
|
+ if (res.code) { //微信登录成功 已拿到code
|
|
|
this.wxCode = res.code //保存获取到的code
|
|
|
- console.log(res.code, "WXcode");
|
|
|
- uni.setStorageSync("code",this.wxCode)
|
|
|
+ uni.setStorageSync("code", this.wxCode)
|
|
|
} else {
|
|
|
this.$toast(res.errMsg)
|
|
|
console.log('登录失败!' + res.errMsg)
|
| xqd
@@ -101,16 +102,16 @@
|
|
|
//code:this.wxCode,
|
|
|
phone: res.user.phone,
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
uni.showToast({
|
|
|
title: '登录成功',
|
|
|
icon: "success",
|
|
|
duration: 1000
|
|
|
})
|
|
|
- setTimeout(()=>{
|
|
|
+ setTimeout(() => {
|
|
|
this.$back()
|
|
|
- },500)
|
|
|
-
|
|
|
+ }, 500)
|
|
|
+
|
|
|
}).catch(err => {
|
|
|
console.log(err)
|
|
|
uni.showToast({
|
| xqd
@@ -125,6 +126,32 @@
|
|
|
console.log('用户点击了拒绝');
|
|
|
}
|
|
|
},
|
|
|
+ getLoginTime() {
|
|
|
+ const date = new Date();
|
|
|
+ let year = date.getFullYear();
|
|
|
+ let month = date.getMonth() + 1;
|
|
|
+ let nowDate = year + '-' + month
|
|
|
+ uni.setStorageSync('loginTime', nowDate)
|
|
|
+ },
|
|
|
+ checkTime() {
|
|
|
+ const date = new Date();
|
|
|
+ let year = date.getFullYear();
|
|
|
+ let month = date.getMonth() + 1;
|
|
|
+ let oldTime=uni.getStorageSync('loginTime')
|
|
|
+ let arr=oldTime.split('-')
|
|
|
+ console.log(arr,778)
|
|
|
+ if(year-arr[0]==0||year-arr[0]==1){
|
|
|
+ if(month-arr[1]==7){
|
|
|
+ this.$toast("登录已过期,请重新登陆")
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.reLaunch({
|
|
|
+ url:'/pages/login'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
// getUserInfo(e){
|
|
|
// uni.getUserInfo({
|
|
|
// success:(res)=>{
|
| xqd
@@ -160,14 +187,17 @@
|
|
|
page {
|
|
|
color: #ffffff;
|
|
|
}
|
|
|
- .titleflex{
|
|
|
+
|
|
|
+ .titleflex {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
}
|
|
|
- .pdas{
|
|
|
- padding:0 20rpx;
|
|
|
+
|
|
|
+ .pdas {
|
|
|
+ padding: 0 20rpx;
|
|
|
}
|
|
|
+
|
|
|
.image {
|
|
|
position: fixed;
|
|
|
width: 100%;
|