hwq 3 rokov pred
rodič
commit
072fc8993d

+ 8 - 1
api/user.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request'
+import { upFilse} from '@/utils/request';
 
 // 订单统计信息
 export function orderData(data) {
@@ -101,4 +102,10 @@ export function delcollect(data) {
 	});
 }
 
-
+export function uploads(data){
+	return upFilse({
+		url:'/api/upload/image',
+		method:'post',
+		data
+	});
+}

+ 93 - 88
pages/public/forget.vue

@@ -1,35 +1,41 @@
 <template>
 	<view class="container">
-		<view class="container_text">
-			<image class="banner-img" src="/static/img/img01.png" mode=" scaleToFill"></image>
-		</view>
-		<view class="loginTitle"><text>手机号登录</text></view>
+		<view class="logo-img"></view>
+		<view class="logo">LOGO</view>
 		<view class="login_text">
-			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img03.png"></image></view>
-				<view class="login_name"><input class="uni-input" v-model="phone" focus placeholder="请输入手机号" /></view>
+			<view class="login_input flex_item">
+				<view class="login_img"><image class="phone" src="/static/img/img25.png"></image></view>
+				<view class="login_name"><input class="uni-input" type="number" v-model="phone" focus placeholder="请输入手机号码" /></view>
+			</view>
+			<view class="login_input flex_item">
+				<view class="login_img"><image src="/static/img/img26.png"></image></view>
+				<view class="login_name"><input class="uni-input" type="password" v-model="password" focus placeholder=" 请输入新的不少于6位的密码" /></view>
+			</view>
+			<view class="login_input flex_item">
+				<view class="login_img"><image src="/static/img/img26.png"></image></view>
+				<view class="login_name"><input class="uni-input" type="password" v-model="password2" focus placeholder="请重复输入新密码" /></view>
 			</view>
 			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img06.png"></image></view>
+				<view class="login_img"><image class="codeimg" src="/static/img/img27.png"></image></view>
 				<view class="login_name flex">
-					<input class="uni-input width" v-model="code" focus placeholder="请输入验证码" />
-					<view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
+					<input class="uni-input width" v-model="code" type="number" focus placeholder="请输入验证码" />
+					<view class="code" @click="verification">{{ countDown == 0 ? '发送验证码' : countDown }}</view>
 				</view>
 			</view>
-			<view>
-				<button type="green" @click="register" class="uni-button uni-button-green">登录</button>
-			</view>
 		</view>
+		<view class="login" @click="updatalogin">确认修改</view>
 	</view>
 </template>
 <script>
-import { mapMutations } from 'vuex';
-import { verify, loginMobile, getUserInfo } from '@/api/login.js';
+import { updatalogin } from '@/api/set.js';
+import { verify } from '@/api/login.js';
 export default {
 	data() {
 		return {
 			phone: '', //用户
 			code: '', //验证码
+			password2:'',
+			password:'',
 			time: '', //保存倒计时对象
 			countDown: 0 //倒计时
 		};
@@ -44,36 +50,42 @@ export default {
 		}
 	},
 	methods: {
-		...mapMutations('user', ['setUserInfo', 'login']),
-		// 手机登录
-		register() {
+		updatalogin() {
 			let obj = this;
 			if (obj.phone == '') {
-				obj.$api.msg('请输入电话号码');
+				obj.$api.msg('请输入手机号码');
 				return;
 			}
-			if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.phone)) {
+			if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(obj.phone)) {
 				obj.$api.msg('请输入正确的手机号');
 				return;
 			}
+			if (obj.password == '') {
+				obj.$api.msg('请输入密码');
+				return;
+			}
+			if (obj.password2 == '') {
+				obj.$api.msg('请再次输入密码');
+				return;
+			}
+			if (obj.password2 != obj.password) {
+				obj.$api.msg('两次密码不正确');
+				return;
+			}
 			if (obj.code == '') {
 				obj.$api.msg('请输入验证码');
 				return;
 			}
-
-			loginMobile({
-				phone: obj.phone, //账号
+			updatalogin({
+				account: obj.phone, //账号
+				password:obj.password,
+				password2:obj.password2,
+				type:1,
 				captcha: obj.code
 			}).then(function(e) {
-				uni.setStorageSync('token', e.data.token);
-				getUserInfo({}).then(e => {
-					obj.login();
-					// 保存返回用户数据
-					obj.setUserInfo(e.data);
-					//成功跳转首页
-					uni.switchTab({
-						url: '/pages/index/index'
-					});
+				obj.$api.msg(e.msg);
+				uni.navigateTo({
+					url: '/pages/public/login'
 				});
 			}).catch((e) => {
 				console.log(e);
@@ -109,61 +121,68 @@ export default {
 					});
 			}
 		},
-		login() {
-			//返回登录
-			uni.navigateTo({
-				url: '/pages/public/login'
-			});
-		}
 	}
 };
 </script>
 
 <style lang="scss">
 page {
-	height: 100%;
-}
-.container {
-	width: 100%;
-	height: 100%;
-	background-size: 100%;
-}
-.container_text {
-	width: 100%;
-	height: 500rpx;
-	top: 0rpx;
-	.banner-img {
-		width: 100%;
-		height: 100%;
+		min-height: 100%;
+		background-color: #ffffff;
+		.container {
+			width: 100%;
+			padding: 60rpx 70rpx;
+		}
+	}
+	.logo-img{
+		width: 161rpx;
+		height: 161rpx;
+		margin: auto;
+		margin-bottom: 15rpx !important;
+		// background: #5771DF;
+		// box-shadow: 0px 12rpx 13rpx 0px rgba(51, 145, 255, 0.47);
+		border-radius: 50%;
+		image{
+			width: 161rpx;
+			height: 161rpx;	
+			border-radius: 50%;
+		}
+	}
+	.logo{
+		font-size: 36rpx;
+		font-weight: 400;
+		color: #5771DF;
+		text-align: center;
+	}
+	.phone{
+		height: 43rpx !important;
+		width: 27rpx !important;
+	}
+	.codeimg{
+		height: 39rpx !important;
+		width: 31rpx !important;
 	}
-}
 .login_text {
-	margin: auto 30rpx;
-	position: relative;
-	padding: 100rpx 102rpx;
-	background-color: #ffffff;
-	margin-top: -180rpx;
 	border-radius: 20rpx;
+	margin-top: 80rpx;
 	.login_input {
-		border-bottom: 1px solid #f0f0f0;
-		margin-bottom: 65rpx;
+		// border-bottom: 1px solid #C5CEE0;
+		margin-bottom:35rpx;
+		padding-bottom: 60rpx;
 		.login_img image {
 			height: 35rpx;
-			width: 29rpx;
+			width: 31rpx;
 			margin-right: 20rpx;
 		}
 		.uni-input {
 			text-align: left;
-			width: 470rpx;
-			font-size: 28rpx !important;
+			width: 400rpx;
+			font-size:32rpx !important;
 		}
 		.login_name {
 			color: #333333;
-			.width {
-				width: 325rpx !important;
-			}
 			.code {
-				color: #5dbc7c;
+				color: #5771DF;
 				font-size: 23rpx;
 				border-left: 1px solid #eeeeee;
 				width: 150rpx;
@@ -172,29 +191,15 @@ page {
 			}
 		}
 	}
-	.uni-button-green {
-		color: #ffffff;
-		background-color: #5dbc7c;
-		margin: 40rpx 10rpx;
-		border-radius: 50rpx;
-	}
-	.uni-button {
-		height: 85rpx;
-		line-height: 85rpx;
-	}
-}
-.loginTitle {
-	position: absolute;
-	top: 250rpx;
-	width: 100%;
-	text-align: center;
-	color: white;
-	font-size: 40rpx;
 }
 
-uni-button {
-	height: 80rpx !important;
-	line-height: 80rpx !important;
+.login{
+	background-color: #5771DF;
+	margin-top: 96rpx;
+	color: #FFFFFF;
+	text-align: center;
+	padding: 26rpx 0rpx;
+	border-radius: 20rpx;
 }
 
 </style>

+ 108 - 325
pages/public/login.vue

@@ -1,386 +1,169 @@
 <template>
 	<view class="container">
-		<view class="container_text">
-			<image class="banner-img" src="/static/img/img01.png" mode="scaleToFill"></image>
+		<view class="loginTitle">WelcomeLALA</view>
+		<view class="loginText">请使用您的账号登录</view>
+		<view class="login-box">
+			<view class="username">账号</view>
+			<input class="input-box" type="number" v-model="phone" placeholder="请输入账号" />
 		</view>
-		<view class="loginTitle"><text>登录</text></view>
-		<view class="login_text">
-			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img03.png"></image></view>
-				<view class="login_name"><input class="uni-input" v-model="username" focus placeholder="请输入手机号" /></view>
-			</view>
-			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img04.png"></image></view>
-				<view class="login_name"><input class="uni-input" type="password" v-model="passward" focus placeholder="请输入密码" /></view>
-			</view>
-			<view><button type="green" class="uni-button uni-button-green" @click="toLogin">登录</button></view>
-			<view><button type="green" class="uni-button uni-button-green uni-button-green-plain" plain="true" hover-class="none" @click="register">注册</button></view>
-			<navigator url="./forget"><view class="forget">忘记密码</view></navigator>
-			<view class="flex other">
-				<view class="fenge"></view>
-				<view class="qita">其他方式登录</view>
-				<view class="fenge"></view>
-			</view>
-			<!-- #ifndef APP-PLUS -->
-					<view class="weixin" @click="wecahtLogin"><image src="/static/img/img05.png"></image></view>
-					<view class="weixin_text" @click="wecahtLogin">微信登录</view>
-					<!-- #endif -->
-					<!-- #ifdef APP-PLUS -->
-					<block v-if="!is_ios">
-						<view class="weixin" @click="wecahtLogin"><image src="/static/img/img05.png" mode="scaleToFill"></image></view>
-						<view class="weixin_text" @click="wecahtLogin">微信登录</view>
-					</block>
-					<block v-else>
-						<view class="ios_login flex" @click="wecahtLogin('weixin')">
-							<text class="iconfont iconweixin"></text>
-							<text class="weixin_text">微信登录</text>
-						</view>
-						<view v-if='is_apple_login' class="ios_login flex" @click="wecahtLogin('apple')">
-							<image class="loginIcon" src="/static/icon/appleIcon.png" mode=" scaleToFill"></image>
-							<text class="weixin_text">通过Apple登录</text>
-						</view>
-					</block>
-					<!-- #endif -->
-				</view>
-			</view>
+		<view class="login-box">
+			<view class="username">密码</view>
+			<input class="input-box" type="password" v-model="password" placeholder="请输入密码" />
+		</view>
+
+		<view class="forget flex">
+			
+			<text @click="navTo('/pages/public/forget')">忘记密码</text>
+		</view>
+		<view class="login" @click="toLogin">登录</view>
+		<view class="login-tip">
+			还没有账号?
+			<text class="register" @click="navTo('/pages/public/register')">立即注册</text>
+		</view>
+	</view>
 </template>
 
 <script>
 import { mapMutations } from 'vuex';
-import { login} from '@/api/login.js';
-import { getUserInfo} from '@/api/user.js';
-// #ifdef APP-PLUS
-// applelogin接口需要开发编写,基础项目中可能没有
-import { applelogin } from '@/api/set.js';
-// loginWx接口需要开发编写,基础项目中可能没有
-import { loginWx } from '@/api/login.js';
-// #endif
-// #ifdef H5
-import { loginWinxin } from '@/utils/wxAuthorized';
-// #endif
+import { login } from '@/api/login.js';
+import { getUserInfo } from '@/api/user.js';
 export default {
 	data() {
 		return {
-			username: '',
-			passward: '',
-			// #ifdef APP-PLUS
-			is_ios: false ,//判断是否为ios手机
-			is_apple_login:false,//是否有ios授权登录功能
-			// #endif
+			phone: '',
+			password: '',
 		};
 	},
-	onLoad() {
-		let obj = this;
-		// #ifdef APP-PLUS
-		let system = uni.getStorageSync('platform');
-		// 判断是否为ios
-		if (system == 'ios') {
-			obj.is_ios = true;
-		}
-		uni.getSystemInfo({
-			success(e) {
-				if(+e.system.split('.')[0]>=13){
-					obj.is_apple_login=true;
-				}
-			}
-		})
-		// #endif
-	},
+	onLoad() {},
+	
 	methods: {
 		...mapMutations('user', ['setUserInfo', 'login']),
-		// 微信登录
-		wecahtLogin(type) {
-			let obj = this;
-			// #ifdef H5
-			let weichatBrowser = uni.getStorageSync('weichatBrowser');
-			if (weichatBrowser) {
-				loginWinxin();
-			}
-			// #endif
-			// #ifdef APP-PLUS
-			uni.login({
-				provider: type,
-				success(e) {
-					uni.getUserInfo({
-						provider: type,
-						success(es) {
-							if(type==='weixin'){
-								loginWx(es.userInfo)
-									.then(e => {
-										uni.setStorageSync('token', e.data.token);
-										getUserInfo({}).then(e => {
-											obj.login();
-											// 保存返回用户数据
-											obj.setUserInfo(e.data);
-											//成功跳转首页
-											uni.switchTab({
-												url: '/pages/index/index'
-											});
-										});
-									})
-									.catch(e => {
-										console.log(e);
-										uni.showModal({
-											content: JSON.stringify(e),
-											success() {},
-											fail() {}
-										});
-									});
-							}
-							if(type==='apple'){
-								console.log(es.userInfo);
-								applelogin({
-									account: es.userInfo.openId,
-								})
-									.then(function(e) {
-										console.log(e,'token')
-										uni.setStorageSync('token', e.data.token);
-										getUserInfo({}).then(e => {
-											obj.login();
-											// 保存返回用户数据
-											obj.setUserInfo(e.data);
-											//成功跳转首页
-											uni.switchTab({
-												url: '/pages/index/index'
-											});
-										});
-										
-									})
-									.catch(function(e) {
-										console.log(e);
-									});
-							}
-							
-						},
-						fail(es) {
-							uni.showModal({
-								content: JSON.stringify(es),
-								success() {
-									// obj.login();
-									// // 保存返回用户数据
-									// obj.setUserInfo(e.data);
-									// //成功跳转首页
-									// uni.switchTab({
-									// 	url: '/pages/index/index'
-									// });
-								}
-							});
-						}
-					});
-				},
-				fail(e) {
-					uni.showModal({
-						title: '提示',
-						content: JSON.stringify(e),
-						showCancel: false
-					});
-				}
-			});
-			// #endif
-		},
 		//登录
 		async toLogin() {
+			uni.showLoading({
+				title:'正在登陆中'
+			});
 			let obj = this;
 			obj.logining = true;
-			if (obj.username == '') {
+			if (obj.phone == '') {
 				obj.$api.msg('请输入手机号');
 				return;
 			}
-			if (obj.passward == '') {
+			if (obj.password == '') {
 				obj.$api.msg('请输入密码');
 				return;
 			}
 			login({
-				account: obj.username,
-				password: obj.passward
+				account: obj.phone,
+				password: obj.password
 			})
 				.then(function(e) {
+					if (obj.rememberPsw) {
+						uni.setStorageSync('HCuname', obj.phone);
+						uni.setStorageSync('HCpassw', obj.password);
+					} else {
+						uni.removeStorageSync('HCuname');
+						uni.removeStorageSync('HCpassw');
+						obj.phone = '';
+						obj.password = '';
+					}
 					uni.setStorageSync('token', e.data.token);
-					obj.$store.commit('hasLogin', true);
 					getUserInfo({}).then(e => {
 						obj.login();
 						// 保存返回用户数据
 						obj.setUserInfo(e.data);
-						let ur = uni.getStorageSync('present')|| '/pages/index/index';
-						//成功跳转首页
+
 						uni.switchTab({
-							url: ur,
-							fail(e) {
-								uni.navigateTo({
-									url: ur,
-									fail(e) {
-										uni.navigateTo({
-											url: '/pages/index/index',
-										});
-									}
-								});
-							}
+							url: '/pages/index/index'
 						});
 					});
+					uni.hideLoading();
 				})
 				.catch(function(e) {
 					console.log(e);
 				});
 		},
-		//跳转注册页
-		register() {
+		navTo(url) {
 			uni.navigateTo({
-				url: `/pages/public/register`
+				url
 			});
 		},
 		// 后退
 		navBack() {
 			uni.navigateBack();
-		}
+		},
+		
 	}
 };
 </script>
 
 <style lang="scss">
-	/* #ifdef APP-PLUS */
-	
-	.ios_login {
-		width: 260rpx;
-		border-radius: 12rpx;
-		justify-content: center;
-		border: 1px solid #212121;
-		margin: 24rpx auto;
-		padding: 10rpx;
-		background-color: #212121;
-		color: #ffffff;
-		.loginIcon {
-			width: 50rpx;
-			height: 50rpx;
-		}
-		.weixin_text {
-			line-height: 1;
-			margin-left: 20rpx;
-			color: #ffffff !important;
-		}
-	}
-	
-	/* #endif */
-	.ios_login {
-		width: 350rpx;
-		border-radius: 12rpx;
-		justify-content: center;
-		border: 1px solid #212121;
-		margin: 24rpx auto;
-		padding: 15rpx;
-		background-color: #212121;
-		color: #ffffff;
-		font-size: 32rpx;
-		.loginIcon {
-			font-size: 35rpx;
-			width: 35rpx;
-			height: 35rpx;
-		}
-		.weixin_text {
-			line-height: 1;
-			margin-left: 20rpx;
-			color: #ffffff !important;
-		}
-	}
-	
 page {
-	height: 100%;
-}
-.container {
-	width: 100%;
-	height: 100%;
-	background-size: 100%;
-}
-.container_text {
-	width: 100%;
-	height: 500rpx;
-	top: 0rpx;
-	.banner-img {
-		width: 100%;
-		height: 100%;
-	}
-}
-.login_text {
-	margin: auto 30rpx;
-	position: relative;
-	padding: 100rpx 102rpx;
+	min-height: 100%;
 	background-color: #ffffff;
-	margin-top: -180rpx;
-	border-radius: 20rpx;
-	.login_input {
-		border-bottom: 1px solid #f0f0f0;
-		margin-bottom: 65rpx;
-		.login_img image {
-			height: 35rpx;
-			width: 29rpx;
-			margin-right: 20rpx;
-		}
-		.uni-input {
-			text-align: left;
-			width: 470rpx;
-			font-size: 28rpx !important;
-		}
-		.login_name {
-			color: #333333;
-		}
-	}
-
-	.other {
-		margin-top: 60rpx;
-		.fenge {
-			width: 30%;
-			height: 2rpx;
-			background-color: #eeeeee;
-		}
-		.qita {
-			font-size: 28rpx;
-			color: #999999;
-		}
-	}
-	.weixin {
-		width: 75rpx;
-		height: 75rpx;
-		margin: 25rpx auto;
-	}
-	.weixin image {
-		width: 100%;
-		height: 100%;
-	}
-	.weixin_text {
-		text-align: center;
-		font-size: 28rpx;
-		color: #999999;
-	}
-	.forget {
-		font-size: 28rpx;
+	.container {
 		width: 100%;
-		text-align: right;
-		color: #999999;
-	}
-
-	.uni-button-green {
-		color: #ffffff;
-		background-color: #5dbc7c;
-		margin: 40rpx 10rpx;
-		border-radius: 50rpx;
+		padding: 30% 60rpx;
 	}
-	.uni-button-green-plain {
-		border: 1px solid #5dbc7c;
-		margin: 40rpx 10rpx;
-		border-radius: 50rpx;
-		color: #5dbc7c;
-		background-color: #ffffff;
+}
+.loginTitle {
+	font-weight: bold;
+	color: #333333;
+	font-size: 58rpx;
+	padding-bottom: 34rpx;
+}
+.loginText {
+	font-weight: 500;
+	color: #333333;
+	font-size: 34rpx;
+	padding-bottom: 34rpx;
+}
+.login-box {
+	padding-top: 90rpx;
+	.username {
+		padding-bottom: 30rpx;
+		font-weight: 500;
+		color: #333333;
+		font-size: 32rpx;
 	}
-	.uni-button {
-		height: 85rpx;
-		line-height: 85rpx;
+}
+.forget {
+	justify-content: flex-end;
+	text-align: right;
+	margin: 70rpx 0rpx;
+	font-weight: 500;
+	color: #333333;
+	font-size: 28rpx;
+	.mui-checkbox{
+		font-weight: 500;
+		color: #333333;
+		font-size: 35rpx;
 	}
 }
-.loginTitle {
-	position: absolute;
-	top: 250rpx;
-	width: 100%;
+.login {
+	background: linear-gradient(90deg, #60BAB0, #60BAB0, #45969B);
+	margin-top: 20rpx;
+	color: #ffffff;
 	text-align: center;
-	color: white;
-	font-size: 40rpx;
+	padding: 26rpx 0rpx;
+	border-radius: 50rpx;
 }
+.login-tip {
+	padding: 60rpx 0rpx;
+	text-align: center;
+	font-weight: 500;
+	color: #333333;
+	font-size: 28rpx;
+	.register {
+		color: #5771df;
+	}
+}
+// /* input 样式 */
+// .input-placeholder {
+// 	color: #ffffff;
+// }
+
+// .placeholder {
+// 	color: #ffffff;
+// }
 </style>

+ 177 - 254
pages/public/register.vue

@@ -1,281 +1,204 @@
 <template>
 	<view class="container">
-		<view class="container_text" >
-			<image class="banner-img" src="/static/img/img01.png" mode="scaleToFill"></image>
+		<view class="loginTitle">欢迎注册LALA</view>
+		<view class="loginText">请认真填写个人信息</view>
+		<view class="login-box">
+			<view class="username">账号</view>
+			<input class="input-box" type="number" v-model="phone" placeholder="请输入手机号" />
 		</view>
-		<view class="loginTitle"><text>注册</text></view>
-		<view class="login_text">
-			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img03.png"></image></view>
-				<view class="login_name"><input class="uni-input" v-model="phone" focus placeholder="请输入手机号" /></view>
+		<view class="login-box">
+			<view class="username">验证码</view>
+			<view class="flex">
+				<input class="input-box" type="number" v-model="code" placeholder="请输入验证码" />
+				<view class="code" @click="verification">{{ countDown == 0 ? '获取验证码' : countDown }}</view>
 			</view>
-			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img04.png"></image></view>
-				<view class="login_name"><input class="uni-input" type="password" v-model="password" focus placeholder="请输入密码" /></view>
-			</view>
-			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img04.png"></image></view>
-				<view class="login_name"><input class="uni-input" type="password" v-model="repassword" focus placeholder="请重复输入密码" /></view>
-			</view>
-			<view class="login_input flex" style="display: none;">
-				<view class="login_img"><image src="/static/icon/img07.png"></image></view>
-				<view class="login_name"><input class="uni-input" type="text" v-model="invitation" focus placeholder="请输入邀请码" /></view>
-			</view>
-			<!-- <view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img06.png"></image></view>
-				<view class="login_name flex">
-					<input class="uni-input width" v-model="code" focus placeholder="请输入验证码" />
-					<view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
-				</view>
-			</view> -->
-			<view><button type="green" @click="register" class="uni-button uni-button-green">注册账号</button></view>
-			<view><button class="uni-button uni-button-green uni-button-green-plain" type="green" plain="true" hover-class="none" @click="login">返回登录</button></view>
 		</view>
+		<view class="login-box">
+			<view class="username">登录密码</view>
+			<input class="input-box" type="password" v-model="loginPass"  placeholder="请输入登录密码" />
+		</view>
+		<view class="login-box">
+			<view class="username">支付密码</view>
+			<input class="input-box" type="password" v-model="payPass" placeholder="请输入支付密码" />
+		</view>
+		<view class="login-box">
+			<view class="username">邀请码</view>
+			<input class="input-box" type="password" v-model="invitation"  placeholder="请输入邀请码" />
+		</view>
+		<view class="login" @click="register">注册</view>
 	</view>
 </template>
+
 <script>
-import { register, verify } from '@/api/login.js';
-export default {
-	data() {
-		return {
-			phone: '', //用户
-			password: '', //密码
-			repassword: '',
-			invitation: '', //邀请码
-			code: '', //验证码
-			time: '', //保存倒计时对象
-			countDown: 0 ,//倒计时
-		};
-	},
-	onLoad() {
-		// 获取扫码邀请人id
-		this.invitation = uni.getStorageSync('spread')||'';
-	},
-	watch: {
-		// 监听倒计时
-		countDown(i) {
-			if (i == 0) {
-				clearInterval(this.time);
-			}
-		}
-	},
-	methods: {
-		// 注册
-		register() {
-			let obj = this;
-			if (obj.phone == '') {
-				obj.$api.msg('请输入电话号码');
-				return;
-			}
-			if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.phone)) {
-				obj.$api.msg('请输入正确的手机号');
-				return;
-			}
-			if (obj.password == '') {
-				obj.$api.msg('请输入密码');
-				return;
-			}
-			if (obj.repassword == '') {
-				obj.$api.msg('请再次输入密码');
-				return;
-			}
-			if (obj.repassword != obj.password) {
-				obj.$api.msg('两次密码不正确');
-				return;
-			}
-			// if ((obj.invitation = '')) {
-			// 	obj.$api.msg('请输入邀请码');
-			// 	return;
-			// }
-			// if (obj.code == '') {
-			// 	obj.$api.msg('请输入验证码');
-			// 	return;
-			// }
-			register({
-				account: obj.phone, //账号
-				// captcha: obj.code, //验证码
-				password: obj.password ,//密码
-				spread:this.invitation//上级推广人
-			}).then(function(e) {
-				uni.showToast({
-					title:'注册成功',
-					duration:2000,
-					position:'top'
-				});
-				setTimeout(function () {
-					uni.navigateTo({
-						url: '/pages/public/login'
-					});
-				},1000)
-				
-			});
-			//调用注册接口,成功跳转登录页
+	import { register, verify } from '@/api/login.js';
+	export default {
+		data() {
+			return {
+				phone: '', //用户
+				loginPass: '', //密码
+				payPass: '',
+				invitation: '', //邀请码
+				code: '', //验证码
+				time: '', //保存倒计时对象
+				countDown: 0, //倒计时
+			};
 		},
-		//发送验证码
-		verification() {
-			let obj = this;
-			if (this.phone == '') {
-				this.$api.msg('请输入电话号码');
-				return;
-			}
-			if (this.phone.length < 11) {
-				this.$api.msg('请输入正确的手机号');
-				return;
-			}
-			// 判断是否在倒计时
-			if (obj.countDown > 0) {
-				return false;
-			} else {
-				obj.countDown = 60;
-				obj.time = setInterval(() => {
-					obj.countDown--;
-				}, 1000);
-				//调用验证码接口
-				verify({
-					phone: obj.phone,
-					type: 'register'
-				})
-					.then(({ data }) => {})
-					.catch(err => {
-						console.log(err);
-					});
+		onLoad() {
+			// 获取扫码邀请人id
+			this.invitation = uni.getStorageSync('spread') || '';
+		},
+		watch: {
+			// 监听倒计时
+			countDown(i) {
+				if (i == 0) {
+					clearInterval(this.time);
+				}
 			}
 		},
-		login() {
-			//返回登录
-			uni.navigateTo({
-				url: '/pages/public/login'
-			});
+		methods: {
+			// 注册
+			register() {
+				let obj = this;
+				if (obj.phone == '') {
+					obj.$api.msg('请输入电话号码');
+					return;
+				}
+				if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(obj.phone)) {
+					obj.$api.msg('请输入正确的手机号');
+					return;
+				}
+				if (obj.loginPass == '') {
+					obj.$api.msg('请输入登录密码');
+					return;
+				}
+				if (obj.payPass == '') {
+					obj.$api.msg('请输入支付密码');
+					return;
+				}
+				if (obj.code == '') {
+					obj.$api.msg('请输入验证码');
+					return;
+				}
+				if (obj.invitation == '') {
+					obj.$api.msg('请输入邀请码');
+					return;
+				}
+				register({
+					phone: obj.phone, //账号
+					captcha: obj.code, //验证码
+					password:obj.loginPass,
+					trade_password:obj.payPass,
+					invite_code:obj.invitation
+				}).then(function(e) {
+					uni.showToast({
+						title: '注册成功',
+						duration: 2000,
+						position: 'top',
+						icon: 'none'
+					});
+					setTimeout(function() {
+						uni.navigateTo({
+							url: '/pages/public/login'
+						});
+					}, 1000)
+
+				});
+				//调用注册接口,成功跳转登录页
+			},
+			//发送验证码
+			verification() {
+				let obj = this;
+				if (this.phone == '') {
+					this.$api.msg('请输入电话号码');
+					return;
+				}
+				if (this.phone.length < 11) {
+					this.$api.msg('请输入正确的手机号');
+					return;
+				}
+				// 判断是否在倒计时
+				if (obj.countDown > 0) {
+					return false;
+				} else {
+					obj.countDown = 60;
+					obj.time = setInterval(() => {
+						obj.countDown--;
+					}, 1000);
+					//调用验证码接口
+					verify({
+							phone: obj.phone,
+							type: 'register'
+						})
+						.then(({
+							data
+						}) => {})
+						.catch(err => {
+							console.log(err);
+						});
+				}
+			},
 		}
-	}
-};
+	};
 </script>
 
 <style lang="scss">
-page {
-	height: 100%;
-}
-.container {
-	width: 100%;
-	height: 100%;
-	background-size: 100%;
-}
-.container_text {
-	width: 100%;
-	height: 500rpx;
-	top: 0rpx;
-	.banner-img {
-		width: 100%;
-		height: 100%;
-	}
-}
-.login_text {
-	margin: auto 30rpx;
-	position: relative;
-	padding: 100rpx 102rpx;
-	background-color: #ffffff;
-	margin-top: -180rpx;
-	border-radius: 20rpx;
-	.login_input {
-		border-bottom: 1px solid #f0f0f0;
-		margin-bottom: 65rpx;
-		.login_img image {
-			height: 35rpx;
-			width: 29rpx;
-			margin-right: 20rpx;
-		}
-		.uni-input {
-			text-align: left;
-			width: 470rpx;
-			font-size: 28rpx !important;
-		}
-		.login_name {
-			color: #333333;
-		}
-	}
+	page {
+		min-height: 100%;
+		background-color: #ffffff;
 
-	.other {
-		margin-top: 60rpx;
-		.fenge {
-			width: 30%;
-			height: 2rpx;
-			background-color: #eeeeee;
-		}
-		.qita {
-			font-size: 28rpx;
-			color: #999999;
+		.container {
+			width: 100%;
+			padding: 10% 60rpx 0rpx 60rpx;
 		}
 	}
-	.weixin {
-		width: 75rpx;
-		height: 75rpx;
-		margin: 25rpx auto;
-	}
-	.weixin image {
-		width: 100%;
-		height: 100%;
-	}
-	.weixin_text {
-		text-align: center;
-		font-size: 28rpx;
-		color: #999999;
+
+	.loginTitle {
+		font-weight: bold;
+		color: #333333;
+		font-size: 58rpx;
+		padding-bottom: 25rpx;
 	}
-	.forget {
-		font-size: 28rpx;
-		width: 100%;
-		text-align: right;
-		color: #999999;
+
+	.loginText {
+		font-weight: 500;
+		color: #333333;
+		font-size: 34rpx;
 	}
 
-	.uni-button-green {
-		color: #ffffff;
-		background-color: #5dbc7c;
-		margin: 40rpx 10rpx;
-		border-radius: 50rpx;
+	.login-box {
+		padding-top: 70rpx;
+		.username {
+			padding-bottom: 25rpx;
+			font-weight: 500;
+			color: #333333;
+			font-size: 32rpx;
+		}
 	}
-	.uni-button-green-plain {
-		border: 1px solid #5dbc7c;
-		margin: 40rpx 10rpx;
+
+	.login {
+		background: linear-gradient(90deg, #60BAB0, #60BAB0, #45969B);
+		margin-top: 20rpx;
+		color: #FFFFFF;
+		text-align: center;
+		padding: 26rpx 0rpx;
 		border-radius: 50rpx;
-		color: #5dbc7c;
-		background-color: #ffffff;
+		margin-top: 60rpx;
 	}
-	.uni-button {
-		height: 85rpx;
-		line-height: 85rpx;
+    .code{
+		background: linear-gradient(90deg, #60BAB0, #60BAB0, #45969B);
+		color: #FFFFFF;
+		border-radius: 10rpx;
+		font-weight: 500;
+		color: #FFFFFF;
+		font-size: 26rpx;
+		padding: 12rpx 19rpx;
 	}
-}
-.loginTitle {
-	position: absolute;
-	top: 250rpx;
-	width: 100%;
-	text-align: center;
-	color: white;
-	font-size: 40rpx;
-}
-
-.forget {
-	width: 100rpx;
-	font-size: 24rpx;
-	color: #ffffff;
-	margin: 0px auto;
-	border-bottom: 1px solid #ffffff;
-}
-.width {
-	width: 325rpx !important;
-}
-.code {
-	color: #5dbc7c;
-	font-size: 23rpx;
-	border-left: 1px solid #eeeeee;
-	width: 150rpx;
-	flex-shrink: 0;
-	text-align: center;
-}
-uni-button {
-	height: 80rpx !important;
-	line-height: 80rpx !important;
-}
+	// /* input 样式 */
+	// .input-placeholder {
+	// 	color: #ffffff;
+	// }
 
+	// .placeholder {
+	// 	color: #ffffff;
+	// }
 </style>
-

+ 120 - 59
pages/set/userinfo.vue

@@ -1,35 +1,56 @@
 <template>
 	<view class="content">
-		<view class="row b-b">
+		<view class="row1">
+			<text class="tit">头像</text>
+			<view class="background-img" @click.stop="imgsub"><image class="background-img" v-model="userInfo.avatar" :src="userInfo.avatar" mode="aspectFill"></image></view>
+		</view>
+		<view class="row">
 			<text class="tit">昵称</text>
-			<input class="input" type="text" v-model="name" placeholder="修改昵称" placeholder-class="placeholder" />
+			<input class="input" type="text" v-model="userInfo.nickname" placeholder-class="placeholder" />
+		</view>
+		<view class="row">
+			<text class="tit">ID</text>
+			<input class="input" type="text"  disabled="true" v-model="student" placeholder-class="placeholder" />
+		</view>
+		<view class="row">
+			<text class="tit">账户</text>
+			<input class="input" type="text"  disabled="true" v-model="userInfo.phone" placeholder-class="placeholder" />
 		</view>
-		<button class="add-btn" @click="confirm">提交</button>
+		<view class="add-btn" @click="confirm">提交</view>
+		<view class="out" @click="toLogout">退出登录</view>
 	</view>
 </template>
 
 <script>
-import { mapState } from 'vuex';
-import { userEdit } from '@/api/set.js';
-export default {
-	data() {
-		return {
-			name: ''
-		};
-	},
+import { mapState,mapMutations } from 'vuex';
+import { uploads } from '@/api/user.js';
+import {userEdit,logout} from '@/api/set.js';
 
-	computed: {
-		...mapState('user', ['userInfo'])
+export default{
+	data(){
+		return{
+			student:''
+		}
 	},
-	onShow(option) {
-		this.name = this.userInfo.nickname + '';
+	onLoad() {
+		console.log(this.userInfo)
+	},
+	computed: {
+		...mapState('user',['userInfo'])
 	},
 	methods: {
-		switchChange(e) {
-			this.addressData.default = e.value;
+		...mapMutations('user',['logout']),
+		imgsub() {
+			console.log('上传头像')
+			uploads({
+				filename: ''
+			}).then(data => {
+				console.log("data",data);
+				this.userInfo.avatar = data[0].url;
+			})
 		},
 		confirm() {
-			userEdit({ nickname: this.name, avatar: this.userInfo.avatar })
+			userEdit({ avatar: this.userInfo.avatar })
 				.then(e => {
 					this.$api.msg('修改成功');
 					setTimeout(()=> {
@@ -42,52 +63,92 @@ export default {
 				.catch(e => {
 					console.log(e);
 				});
-		}
+		},
+		toLogout(){
+			let obj = this;
+			uni.showModal({
+			    content: '确定要退出登录么',
+			    success: (e)=>{
+			    	if(e.confirm){
+						logout({}).then((e) => {
+							uni.navigateBack();
+						}).catch((e) => {
+							console.log(e);
+						})
+			    		obj.logout();
+			    	}
+			    }
+			});
+		},
 	}
-};
+}
 </script>
 
 <style lang="scss">
-page {
-	background: $page-color-base;
-	padding-top: 16upx;
-}
-
-.row {
-	display: flex;
-	align-items: center;
-	position: relative;
-	padding: 0 30upx;
-	height: 110upx;
-	background: #fff;
-
-	.tit {
-		flex-shrink: 0;
-		width: 120upx;
-		font-size: 30upx;
-		color: $font-color-dark;
+	.row1 {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		position: relative;
+		padding: 0 30upx;
+		height: 110upx;
+		background: #fff;
+		margin-bottom: 20upx;
+		.tit {
+			flex-shrink: 0;
+			width: 120upx;
+			font-size: $font-lg;
+			color: $font-color-dark;
+		}
+		
+		.background-img {
+			width: 80rpx;
+			height: 80rpx;
+			border-radius: 50%;
+			background: #f2f2f2;
+		}
 	}
-	.input {
-		flex: 1;
-		font-size: 30upx;
-		color: $font-color-dark;
+	.row {
+		display: flex;
+		align-items: center;
+		padding: 0 30upx;
+		height: 110upx;
+		background: #fff;
+	
+		.tit {
+			flex-shrink: 0;
+			width: 120upx;
+			font-size: $font-lg;
+			color: $font-color-dark;
+		}
+		.input {
+			flex: 1;
+			text-align: right;
+			font-size: $font-base;
+			color: $color-gray;
+		}
 	}
-	.iconlocation {
-		font-size: 36upx;
-		color: $font-color-light;
+	.add-btn {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		margin: 158rpx auto 30rpx;
+		width: 560rpx;
+		height: 80rpx;
+		background: linear-gradient(90deg, #58BAB0, #60BAB0, #45969B);
+		border-radius: 40px;
+		color: #FFFFFF;
+	}
+	.out {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		margin: 0 auto 30rpx;
+		width: 560rpx;
+		height: 80rpx;
+		border: 1px solid #58BAB0;
+		background: #FFFFFF;
+		border-radius: 40px;
+		color: #58BAB0;
 	}
-}
-.add-btn {
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	width: 690upx;
-	height: 80upx;
-	margin: 60upx auto;
-	font-size: $font-lg;
-	color: #fff;
-	background-color: $base-color;
-	border-radius: 10upx;
-	// box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
-}
 </style>

+ 208 - 19
pages/user/user.vue

@@ -1,25 +1,59 @@
 <template>
 	<view class="container">
 		<view class="top">
-			<view class="bg">
-				<image class="imgBg" src="../../static/img/user-bg.png" mode=""></image>
-			</view> 
+			<view class="bg"><image class="imgBg" src="../../static/img/user-bg.png" mode=""></image></view>
+			<view class="user">
+				<view class="avtor"><image class="portrait" :src="userInfo.avatar || '/static/img/missing-face.png'"></image></view>
+				<view class="name">{{ userInfo.nickname || '游客' }}</view>
+			</view>
+		</view>
+		<view class="main">
+			<view class="title">我的工具</view>
+			<view class="tt">
+				<view class="tt-box">
+					<image src="../../static/img/pinggou.png" class="tt-icon1" mode=""></image>
+					<view class="tt-txt">我的拼购</view>
+					<image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
+				</view>
+				<view class="tt-box">
+					<image src="../../static/img/myTeam.png" class="tt-icon2" mode=""></image>
+					<view class="tt-txt">我的团队</view>
+					<image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
+				</view>
+				<view class="tt-box">
+					<image src="../../static/img/share.png" class="tt-icon3" mode=""></image>
+					<view class="tt-txt">团队邀请</view>
+					<image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
+				</view>
+				<view class="tt-box">
+					<image src="../../static/img/zfpwd.png" class="tt-icon4" mode=""></image>
+					<view class="tt-txt">支付密码</view>
+					<image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
+				</view>
+				<view class="tt-box">
+					<image src="../../static/img/pwd.png" class="tt-icon1" mode=""></image>
+					<view class="tt-txt">登录密码</view>
+					<image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
+				</view>
+				<view class="tt-box">
+					<image src="../../static/img/kefu.png" class="tt-icon1" mode=""></image>
+					<view class="tt-txt">联系客服</view>
+					<image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
+				</view>
+				<view class="tt-box" @click="nav('/pages/set/userinfo')">
+					<image src="../../static/img/set.png" class="tt-icon5" mode=""></image>
+					<view class="tt-txt">设置</view>
+					<image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
+				</view>
+			</view>
 		</view>
-		<uni-list>
-			<uni-list-item title="我的钱包" @click="navTo('/pages/money/wallet')" thumb="/static/icon/img11.png"></uni-list-item>
-			<uni-list-item title="我的卡卷" @click="navTo('/pages/user/coupon')" thumb="/static/icon/img12.png"></uni-list-item>
-			<uni-list-item title="我的收藏" @click="navTo('/pages/user/favorites')" thumb="/static/icon/img02.png"></uni-list-item>
-			<uni-list-item title="商户入驻" @click="navTo('/pages/set/address')" thumb="/static/icon/img05.png"></uni-list-item>
-			<uni-list-item title="邀请好友" @click="navTo('/pages/user/shareQrCode')" thumb="/static/icon/img10.png"></uni-list-item>
-			<uni-list-item title="关于我们" @click="navTo('/pages/shareQrCode/index')" thumb="/static/icon/img09.png"></uni-list-item>
-		</uni-list>
 	</view>
 </template>
 <script>
 import { mapState, mapMutations } from 'vuex';
 import uniList from '@/components/uni-list/uni-list.vue';
 import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
-import { orderData, userinfo } from '@/api/user.js';
+import { orderData, getUserInfo } from '@/api/user.js';
 import { saveUrl, interceptor } from '@/utils/loginUtils.js';
 let startY = 0,
 	moveY = 0,
@@ -30,14 +64,25 @@ export default {
 		uniListItem
 	},
 	data() {
-		return {
-			
-		};
+		return {};
 	},
 	onShow() {
-		// 判断是否已经登录
+		//判断是否已经登录
 		if (this.hasLogin) {
 			this.loadBaseData();
+		}else{
+			uni.showModal({
+				title: '登录',
+				content: '您未登录,是否马上登陆?',
+				success: e => {
+					if (e.confirm) {
+						interceptor();
+					}
+				},
+				fail: e => {
+					console.log(e);
+				}
+			});
 		}
 	},
 	computed: {
@@ -45,20 +90,164 @@ export default {
 	},
 	methods: {
 		...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
-		
+		loadBaseData() {
+			getUserInfo({}).then(({
+				data
+			}) => {
+				this.setUserInfo(data);
+			});
+		},
+		nav(url) {
+			// 判断是否已经登录
+			// if (this.hasLogin) {
+				console.log(url)
+				uni.navigateTo({
+					url: url,
+					fail() {
+						uni.switchTab({
+							url:url
+						})
+					}
+				})
+			// }else {
+			// 	uni.showModal({
+			// 		title: '登录',
+			// 		content: '您未登录,是否马上登陆?',
+			// 		success: e => {
+			// 			if (e.confirm) {
+			// 				interceptor();
+			// 			}
+			// 		},
+			// 		fail: e => {
+			// 			console.log(e);
+			// 		}
+			// 	});
+			// }
+
+		}
 	}
 };
 </script>
 <style lang="scss">
 page {
 	height: 100%;
+	background: #ffffff;
 }
 .container {
 	height: 100%;
-	background-color: $page-color-base;
+	background: #ffffff;
 }
 .top {
 	width: 100%;
-	height: 319px;
+	height: 320rpx;
+	position: relative;
+	.bg {
+		position: absolute;
+		width: 100%;
+		height: 320rpx;
+		left: 0;
+		top: 0;
+		right: 0;
+		image {
+			width: 100%;
+			height: 100%;
+		}
+	}
+	.user {
+		position: relative;
+		padding-top: 98rpx;
+		padding-left: 34rpx;
+		display: flex;
+		justify-content: flex-start;
+		align-items: center;
+		z-index: 10;
+		.avtor {
+			width: 102rpx;
+			height: 102rpx;
+			border-radius: 50%;
+			.portrait {
+				width: 100%;
+				height: 100%;
+				border-radius: 50%;
+			}
+		}
+		.name {
+			margin-left: 30rpx;
+			font-size: 36rpx;
+			font-family: PingFang SC;
+			font-weight: 500;
+			color: #ffffff;
+		}
+	}
+}
+.main {
+	position: relative;
+	z-index: 11;
+	width: 100%;
+	height: 100%;
+	background: #ffffff;
+	margin-top: -70rpx;
+	border-top-left-radius: 60rpx;
+	border-top-right-radius: 60rpx;
+	.title {
+		padding-top: 65rpx;
+		padding-left: 36rpx;
+		font-size: 36rpx;
+		font-family: PingFang SC;
+		font-weight: bold;
+		color: #333333;
+	}
+	.tt {
+		margin: 0 auto;
+		width: 750rpx;
+		padding: 40rpx 70rpx;
+		border-radius: 10rpx;
+		background-color: #ffffff;
+
+		.tt-box {
+			height: 100rpx;
+			display: flex;
+			align-items: center;
+			border-bottom: 1px solid #f0f0f0;
+			.tt-icon1 {
+				width: 42rpx;
+				height: 42rpx;
+			}
+			.tt-icon2 {
+				width: 49rpx;
+				height: 38rpx;
+			}
+			.tt-icon3 {
+				width: 46rpx;
+				height: 40rpx;
+			}
+			.tt-icon4 {
+				width: 40rpx;
+				height: 42rpx;
+			}
+			.tt-icon5 {
+				width: 44rpx;
+				height: 40rpx;
+			}
+
+			.tt-txt {
+				margin-left: 36rpx;
+				font-size: 32rpx;
+				font-family: PingFang SC;
+				font-weight: 500;
+				color: #333333;
+				flex: 1;
+			}
+
+			.next-icon {
+				width: 16rpx;
+				height: 25rpx;
+			}
+		}
+
+		.border-b {
+			border-bottom: 1px solid #f1f1f1;
+		}
+	}
 }
 </style>

BIN
static/img/Close.png


BIN
static/img/lianxi.png


BIN
static/img/weixin.png