张文飞 3 tahun lalu
induk
melakukan
17c8407853

+ 29 - 1
App.vue

@@ -47,6 +47,12 @@
 			let userInfo = uni.getStorageSync('userInfo');//获得保存在本地的用户信息
 		},
 		onShow: function() {
+			let token = this.$cache.get('_token_owner_union');
+			if (!token) {
+				this.regist();
+			} else {
+				this.globalData.token = token;
+			}
 			document.body.style.setProperty("background-color",this.globalData.color4)
 		},
 		onHide: function() {
@@ -55,7 +61,29 @@
 		methods: {
 			getThemeInfo() {
 			
-			}
+			},
+			async regist() {
+				let ret = await this.$myRequest({
+					url: "/regist",
+					data: {
+						"code": "o08gpwOfRgwnhh1WCBYGLbaszur8",
+						"shareToken": ""
+					}
+				});
+				if (ret.data.success) {
+					let userId = ret.data.single.userId;
+					this.$cache.set("_user_id",userId,0);
+					this.globalData.userId = userId;
+					if (ret.data.single.authed == 1) {
+						let token = ret.data.single.token;
+						this.$cache.set('_token_owner_union', token);
+						this.globalData.token = token
+					}
+					uni.$emit('request')
+				}else{
+					uni.$emit('request')
+				}
+			},
 		},
 		globalData: {
 			token: "",

+ 293 - 0
components/subComponents/dmLogin.vue

@@ -0,0 +1,293 @@
+<template>
+	<dmDialog ref='popView' :isShowTitle="true" title="登陆" :isShowClose="true" :isShowConfirm="false" >
+		<view class="content">
+			<view class="user_item">
+				<text class="item_name">手机号</text>
+				<view class="user_line">
+					
+				</view>
+				<view class="item_right">
+					<input placeholder-class="item_right_name_placeholder" type='number' maxlength="11"  class="item_right_name" :value="mobile" placeholder="请输入" @blur='inputMobile' @confirm='inputMobile'/>
+				</view>
+			</view>
+			
+			<view class="user_item">
+				<text class="item_name">验证码</text>
+				<view class="user_line">
+					
+				</view>
+				<view class="item_right">
+					<input placeholder-class="item_right_name_placeholder" class="item_right_name" type="text" :value="verifity" placeholder="请输入" @blur='inputVerifity' @confirm='inputVerifity'/>
+					<view class="veritify" @click="getVeritify">
+						{{veritifyTxt}}
+					</view>
+				</view>
+			</view>
+			<view class="agreement">
+				<image class="icon_agree" v-if="agree" src="../../static/icons/icon_yezhu_selected.png" mode=""></image>
+				<image class="icon_agree" v-else src="../../static/icons/icon_yezhu_unselected.png" mode=""></image>
+				
+				我已阅读并同意
+				<text class="agreement_">《用户使用协议》</text>
+				和
+				<text class="agreement_">《隐私政策》</text>
+			</view>
+			<view class="confirm" @click="toLogin">
+				确认
+			</view>
+		</view>
+	</dmDialog>
+</template>
+
+<script>
+	let app = getApp();
+	import dmDialog from "./dmDialog.vue"
+	export default{
+		
+		data(){
+			return {
+		       mobile:"",
+			   veritifyTxt:"发送验证码",
+			   verifity:"",
+			   timer:null,
+			   countdownTimes:120,
+			   agree:false,
+			   userId:"",
+			}
+		},
+		methods:{
+			show() {
+				this.$refs.popView.show()
+			},
+			knowAction(){
+				if(this.timer){
+					clearInterval(this.timer);
+					this.timer = null;
+				}
+				this.$refs.popView.hide()
+			},
+			inputMobile(e){
+				this.mobile = e.detail.value
+			},
+			inputVerifity(e){
+				this.verifity = e.detail.value
+			},
+			async getVeritify(){
+				if(!this.mobile){
+					uni.showToast({
+						icon:"none",
+						title:"请输入手机号"
+					})
+					return 
+				}
+				var phone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
+				if (!phone.test(this.mobile)) {
+					uni.showToast({
+						icon:"none",
+						title:"请输入正确的手机号"
+					})
+					return 
+				}
+				this.showInputVerifity = true;
+				if(this.timer&&this.countdownTimes>=0){
+					return
+				}
+				let ret = await this.$myRequest({
+					url: "/sms/sendSmsVerifyCode",
+					data: {
+						"phone": this.mobile,
+					},
+					method:"GET"
+				})
+				this.houseList = [];
+				if (ret.data.success) {
+					this.countdown();
+				}
+			},
+			countdown(){
+				this.timer = setInterval(()=>{
+					this.countdownTimes--;
+					this.veritifyTxt = this.countdownTimes+"s"
+					if(this.countdownTimes<=0){
+						clearInterval(this.timer);
+						this.timer = null;
+						this.veritifyTxt = '获取验证码';
+						this.countdownTimes = 120;
+					}
+				},1000)
+			},
+			async toLogin(){
+				if(!this.mobile){
+					uni.showToast({
+						icon:"none",
+						title:"请输入手机号"
+					})
+					return
+				}
+				
+				if(!this.verifity){
+					uni.showToast({
+						icon:"none",
+						title:"请输入验证码"
+					})
+					return
+				}
+				if(!this.agree){
+					uni.showToast({
+						icon:"none",
+						title:"请阅读并同意《入住协议》"
+					})
+					return
+				}
+				let ret = await this.$myRequest({
+					url: "/authorizedPhone",
+					data: {
+						"code": this.verifity,
+						"phone": this.mobile,
+						"userId": this.userId
+					}
+				});
+			    
+				if(ret.data.success){
+					uni.showToast({
+						icon:"none",
+						title:"登录成功"
+					});
+					this.token = ret.data.single;
+					this.$cache.set('_token_owner_union', this.token);
+					app.globalData.token = this.token;
+					uni.$emit('request');
+					this.knowAction();
+				}else{
+					uni.showToast({
+						icon:"none",
+						title:ret.data.message
+					});
+				}
+			}
+		},
+		mounted() {
+			this.userId = this.$cache.get('_user_id')
+			uni.$on('login',()=>{
+				this.show();
+			})
+		},
+		
+		components:{
+			dmDialog
+		}
+		
+	}
+</script>
+
+<style scoped lang="scss">
+	.content{
+		width: 100%;
+		height: 430rpx;
+		margin-top: 30rpx;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		
+		.user_item{
+			width: 630rpx;
+			height: 84rpx;
+			min-height: 84rpx;
+			background: #f5f6f7;
+			border-radius: 16rpx;
+			display: flex;
+		
+			align-items: center;
+			margin-bottom: 12rpx;
+			.item_name{
+				width: 90rpx;
+				min-width: 90rpx;
+				font-size: 28rpx;
+				font-family: Verdana, Verdana-Regular;
+				font-weight: 400;
+				color: #b1b1b1;
+				padding-left: 40rpx;
+			}
+			.item_right{
+				font-size: 28rpx;
+				font-family: Verdana, Verdana-Regular;
+				font-weight: 400;
+				color: #262626;
+				display: flex;
+				align-items: center;
+				
+				.item_right_name{
+					width: 100%;
+				}
+				.item_right_name_placeholder{
+					font-size: 26rpx;
+					font-family: Verdana, Verdana-Regular;
+					font-weight: 400;
+					color: #b1b1b1;
+				}
+				.icon_right{
+					width: 10rpx;
+					height: 22rpx;
+					margin-left: 19rpx;
+				}
+				
+				.veritify{
+					width: 150rpx;
+					min-width: 150rpx;
+					height: 50rpx;
+					margin-left: 10rpx;
+					margin-right: 60rpx;
+					line-height: 50rpx;
+					font-size: 20rpx;
+					font-family: Verdana, Verdana-Regular;
+					font-weight: 400;
+					text-align: center;
+					color: #f07423;
+				}
+			}
+		}
+		
+		.user_line{
+			width: 2rpx;
+			min-width: 2rpx;
+			height: 20rpx;
+			min-height: 20rpx;
+			background: rgba(177,177,177,1);
+			margin-left: 18rpx;
+			margin-right: 20rpx;
+		}
+		.confirm{
+			width: 410rpx;
+			height: 80rpx;
+			line-height: 80rpx;
+			background: #f07423;
+			border-radius: 40rpx;
+			box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(240,116,35,0.37); 
+			font-size: 28rpx;
+			font-family: Verdana, Verdana-Bold;
+			font-weight: 700;
+			text-align: center;
+			color: #ffffff;
+			margin-top: 70rpx;
+		}
+	}
+	.agreement{
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		font-size: 24rpx;
+		font-family: Verdana, Verdana-Regular;
+		font-weight: 400;
+		text-align: left;
+		color: #b1b1b1;
+		margin-top: 30rpx;
+		.icon_agree{
+			width: 24rpx;
+			height: 24rpx;
+			margin-right: 10rpx;
+		}
+		.agreement_{
+			color: rgba(240,116,35,1);
+		}
+	}
+</style>

+ 76 - 0
components/subComponents/dmLoginNotice.vue

@@ -0,0 +1,76 @@
+<template>
+	<dmDialog ref='popView' :isShowTitle="true" title="登陆提醒" :isShowClose="true" :isShowConfirm="false" >
+		<view class="content">
+			<text class="desc">您还未进行登录,无法使用该功能\n点击登录后可以完整查看及使用</text>
+			<view class="confirm" @click="toLogin">
+				去登录
+			</view>
+		</view>
+	</dmDialog>
+</template>
+
+<script>
+	import dmDialog from "./dmDialog.vue"
+	export default{
+		
+		data(){
+			return {
+		
+			}
+		},
+		methods:{
+			show() {
+				this.$refs.popView.show()
+			},
+			knowAction(){
+				this.$refs.popView.hide()
+			},
+			toLogin(){
+				this.$refs.popView.hide()
+				uni.$emit('login');
+			}
+		},
+		mounted() {
+			uni.$on('unLogin',()=>{
+				this.show();
+			})
+		},
+		components:{
+			dmDialog
+		}
+		
+	}
+</script>
+
+<style scoped lang="scss">
+	.content{
+		width: 100%;
+		height: 270rpx;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		
+		.desc{
+			font-size: 28rpx;
+			font-family: Verdana, Verdana-Regular;
+			font-weight: 400;
+			text-align: center;
+			color: #666666;
+			margin-top: 30rpx;
+		}
+		.confirm{
+			width: 410rpx;
+			height: 80rpx;
+			line-height: 80rpx;
+			background: #f07423;
+			border-radius: 40rpx;
+			box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(240,116,35,0.37); 
+			font-size: 28rpx;
+			font-family: Verdana, Verdana-Bold;
+			font-weight: 700;
+			text-align: center;
+			color: #ffffff;
+			margin-top: 50rpx;
+		}
+	}
+</style>

+ 5 - 0
main.js

@@ -3,6 +3,8 @@ import App from './App'
 import { myRequest } from 'util/api.js'
 Vue.config.productionTip = false
 import MinCache from './static/cache.js'
+import dmLoginNotice from './components/subComponents/dmLoginNotice.vue'
+import dmLogin from './components/subComponents/dmLogin.vue'
 //引入vuex
 import store from './store'
 //把vuex定义成全局组件
@@ -10,6 +12,9 @@ Vue.prototype.$store = store
 
 Vue.use(MinCache,{timeout:1800}) //缓存时间30分钟
 
+Vue.component('login-notice',dmLoginNotice)
+Vue.component('login',dmLogin)
+
 App.mpType = 'app'
 Vue.prototype.$myRequest = myRequest
 

+ 95 - 57
pages/homePage/homePage.vue

@@ -6,9 +6,9 @@
 				<view class="backDiv"></view>
 				<view class="title">分享好房 · 躺平赚钱</view>
 				<view class="subTitle" @click="setEnv">新手赚钱帮助 ></view>
-				<view class="levelDiv" v-if="userInfo.ownersUnion"
+				<view class="levelDiv"
 					style="background: url('https://dm.static.elab-plus.com/yezhu/h5/icon_line_back.png') center/100% 100% no-repeat;">
-					<view class="level_top">
+					<view class="level_top" v-if="token">
 						<image class="level_icon" src="https://dm.static.elab-plus.com/yezhu/h5/icon_Level.png" mode="">
 						</image>
 						<view class="level_text">{{userInfo.curlevel}}</view>
@@ -19,19 +19,33 @@
 								src="https://dm.static.elab-plus.com/yezhu/h5/icon_right.png" mode=""></image>
 						</view>
 					</view>
-					<view class="level_bottom">
-						<levelView :currentLevel='userInfo.curIncome' :nextLevel='userInfo.nextIncome' :currentLevelTxt='userInfo.curlevel' nextLevelTxt='userInfo.nextLevel'>
+					<view class="level_top" v-else @click="toLogin">
+						<image class="level_icon" src="https://dm.static.elab-plus.com/yezhu/h5/icon_Level.png" mode="">
+						</image>
+						<view class="level_text_login">登录</view>
+						<view class="level_des"></view>
+						<view class="level_update">
+							<text>立即登录</text>
+							<image class="level_right_icon"
+								src="https://dm.static.elab-plus.com/yezhu/h5/icon_right.png" mode=""></image>
+						</view>
+					</view>
+					<view class="level_bottom" v-if="token">
+						<levelView :currentLevel='userInfo.curIncome' :nextLevel='userInfo.nextIncome' :currentLevelTxt='userInfo.curlevel' :nextLevelTxt='userInfo.nextLevel'>
 						</levelView>
 					</view>
+					<view class="level_bottom_login" v-else >
+						点此进行登录注册,开始赚钱吧
+					</view>
 				</view>
 			</view>
 		</view>
 		<view class="content_body" :style="{background:color4}">
-			<view class="content_beginner_guide">
+			<view class="content_beginner_guide" v-if="showGuide">
 				<view class="title">
 					<text class="title_txt">- 新手引导 -</text>
 					<view class="title_right">
-						<text class="title_right_txt">收起</text>
+						<text class="title_right_txt" @click="upLoadView(false)">收起</text>
 						<image class="title_right_cion" src="https://dm.static.elab-plus.com/yezhu/icon_shouqi.png"
 							mode=""></image>
 					</view>
@@ -63,6 +77,11 @@
 				</view>
 
 			</view>
+			<view class="content_beginner_guide_" v-else @click="upLoadView(true)">
+				<text class="title_txt">展开新手引导</text>
+				<image class="title_right_cion" src="../../static/icons/icon_down_.png"
+					mode=""></image>
+			</view>
 			<view class="content_tab">
 				<view class="tab_item" @click="toYezhu">
 					<image class="icon_tab" src="https://dm.static.elab-plus.com/yezhu/icon_zcyz.png" mode=""></image>
@@ -153,6 +172,8 @@
 
 
 		</view>
+		<login-notice></login-notice>
+		<login></login>
 	</view>
 </template>
 
@@ -179,26 +200,28 @@
 					"totalIncome": null,
 					"taskCount": null,
 					"surplusTaskAmount": null
-				}
+				},
+				showGuide:false,
 			}
 		},
 		mounted() {
+			this.color4 = app.globalData.color4;
 			let token = this.$cache.get('_token_owner_union');
-			let userId = this.$cache.get('_user_id');
-			if(userId){
-				app.globalData.userId = userId;
-			}
-			if (!token) {
-				this.regist();
-			} else {
-				app.globalData.token = token;
-				this.getUserInfo();
+			this.token = token;
+			if(token){
+				this.getData();
 			}
-			this.color4 = app.globalData.color4;
-			this.getHomePage();
-
+			uni.$on("request",()=>{
+				let token2 = this.$cache.get('_token_owner_union');
+				this.token = token2;
+				this.getData();
+			})
 		},
 		methods: {
+			getData(){
+				this.getUserInfo();
+				this.getHomePage();
+			},
 			async getHomePage() {
 				let ret = await this.$myRequest({
 					url: "/project/homePage",
@@ -214,44 +237,6 @@
 					this.houseList = pageModel.resultSet || [];
 				}
 			},
-			async regist() {
-				let ret = await this.$myRequest({
-					url: "/regist",
-					data: {
-						"code": "o08gpwOfRgwnhh1WCBYGLbaszur8",
-						"shareToken": ""
-					}
-				});
-				if (ret.data.success) {
-					this.userId = ret.data.single.userId;
-					this.$cache.set("_user_id",this.userId);
-					app.globalData.userId = this.userId;
-					if (ret.data.single.authed == 1) {
-						this.token = ret.data.single.token;
-						this.$cache.set('_token_owner_union', this.token);
-						app.globalData.token = this.token
-						this.getUserInfo()
-					} else {
-						this.getToken()
-					}
-				}
-			},
-			async getToken() {
-				let ret = await this.$myRequest({
-					url: "/authorizedPhone",
-					data: {
-						"code": (new Date()).getTime(),
-						"phone": "18721775127",
-						"userId": this.userId
-					}
-				});
-				if (ret.data.success) {
-					this.token = ret.data.single;
-					this.$cache.set('_token_owner_union', this.token);
-					app.globalData.token = this.token
-					this.getUserInfo()
-				}
-			},
 			async getUserInfo() {
 				let ret = await this.$myRequest({
 					url: "/user/userInfo",
@@ -311,6 +296,12 @@
 				uni.navigateTo({
 					url:'../shareCardPage/shareCardPage?page='+item.xcxPage+"&projectId="+item.projectId+"&type="+type
 				})
+			},
+			toLogin(){
+				uni.$emit('login')
+			},
+			upLoadView(isShow){
+				this.showGuide = isShow;
 			}
 		},
 		components: {
@@ -399,6 +390,7 @@
 					flex-wrap: nowrap;
 					align-items: center;
 					margin-top: 5rpx;
+					
 
 					.level_icon {
 						width: 37rpx;
@@ -421,6 +413,14 @@
 						margin-right: 8rpx;
 						margin-top: -7rpx;
 					}
+					
+					.level_text_login{
+						font-size: 40rpx;
+						font-family: FontName, FontName-Regular;
+						font-weight: 400;
+						text-align: left;
+						color: #f5c8a8;
+					}
 
 					.level_des {
 						font-size: 22rpx;
@@ -450,6 +450,14 @@
 					}
 				}
 
+                 .level_bottom_login{
+                 	font-size: 22rpx;
+                 	font-family: Verdana, Verdana-Regular;
+                 	font-weight: 400;
+                 	text-align: left;
+                 	color: #f5c8a8;
+                 	margin-top: 20rpx;
+                 }
 			}
 
 		}
@@ -461,6 +469,8 @@
 			z-index: 102;
 			position: relative;
 			padding: 1rpx;
+			
+			
 
 			.content_beginner_guide {
 				height: 354rpx;
@@ -559,6 +569,33 @@
 
 			}
 
+            .content_beginner_guide_{
+				width: 100%;
+				position: relative;
+				margin-left: 30rpx;
+				margin-right: 30rpx;
+				margin-top: 20rpx;
+				margin-bottom: 30rpx;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+			
+				.title_txt {
+					font-size: 24rpx;
+					font-family: FontName, FontName-Regular;
+					font-weight: 400;
+					text-align: left;
+					color: #b1b1b1;
+					font-style: italic;
+				}
+			
+				.title_right_cion {
+					width: 10rpx;
+					height: 6rpx;
+					margin-left: 10rpx;
+				}
+				
+			}
 			.content_tab {
 				display: flex;
 				box-sizing: border-box;
@@ -931,5 +968,6 @@
 				}
 			}
 		}
+		
 	}
 </style>

+ 2 - 0
pages/reportPage/reportPage.vue

@@ -94,6 +94,8 @@
 		<dm-calendar-picker-view ref='calendarPickerView' @confirmSelDate='confirmSelDate'></dm-calendar-picker-view>
 	    <dmWithDrawalRecord ref='withDrawalRecord'></dmWithDrawalRecord>
 		<dmWithDrawal ref='withDrawal' :canCashOut='headerInfo.canCashOut'></dmWithDrawal>
+		<login-notice></login-notice>
+		<login></login>
 	</view>
 
 </template>

+ 3 - 0
pages/revenueRankingPage/revenueRankingPage.vue

@@ -96,6 +96,9 @@
 				color2:"",
 				currentTab:1,
 			};
+		},
+		created() {
+			
 		},
 		mounted() {
 			this.color1 = app.globalData.color1;

TEMPAT SAMPAH
static/icons/icon_down_.png


+ 3 - 0
util/api.js

@@ -34,6 +34,9 @@ export const myRequest = (options) => {
 				uni.hideLoading()
 				uni.hideNavigationBarLoading();
 				uni.stopPullDownRefresh();
+				if(res.data.errorCode=='401'){
+					uni.$emit('unLogin')
+				}
 				resolve(res)
 			},
 			fail: (err) => {