Roebin 3 年之前
父節點
當前提交
d291454737
共有 3 個文件被更改,包括 46 次插入16 次删除
  1. 3 3
      http/baseUrl.js
  2. 42 12
      pages/login.vue
  3. 1 1
      pages/otherNumlogin.vue

+ 3 - 3
http/baseUrl.js

xqd
@@ -1,10 +1,10 @@
 
-export const imageUrl = 'http://o2o.cn/'
+export const imageUrl = 'https://www.riyuexiasmc.com'
 // export const baseUrl = 'http://o2o.cn/api/'
-export const baseUrl = 'http://o2o.cn/api/'
+export const baseUrl = 'https://www.riyuexiasmc.com'
 //export const mainUrl = 'http://o2o.cn'
 
 //export const imageUrl = 'http://t28.9026.com/'
 //export const baseUrl = 'http://t28.9026.com/api/'
 // export const mainUrl = 'http://t7.9026.com'
-export const mainUrl = 'https://ryx.scxxq.cn'
+export const mainUrl = 'https://www.riyuexiasmc.com'

+ 42 - 12
pages/login.vue

xqd xqd xqd xqd 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>
@@ -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)
@@ -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({
@@ -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)=>{
@@ -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%;

+ 1 - 1
pages/otherNumlogin.vue

xqd
@@ -87,7 +87,7 @@
 			
 				uni.login({
 					success: (res) => {
-						// console.log(res)
+						console.log(res,7789)
 					    if (res.code) { //微信登录成功 已拿到code  
 							uni.$u.http.post("/api/login/code",{verify_key:this.verify_key,verify_code:this.codetxt,code:res.code}).then((res) => {
 								console.log(res)