hwq 4 år sedan
förälder
incheckning
56c2c5fe13
6 ändrade filer med 120 tillägg och 485 borttagningar
  1. 1 18
      pages.json
  2. 0 169
      pages/set/password.vue
  3. 0 164
      pages/set/phone.vue
  4. 0 113
      pages/set/set.vue
  5. 1 1
      pages/user/user.vue
  6. 118 20
      pages/userinfo/userinfo.vue

+ 1 - 18
pages.json

@@ -148,30 +148,13 @@
 				// #endif
 				"navigationBarTitleText": "搜索"
 			}
-		}, {
-			"path": "pages/set/set",
-			"style": {
-				"navigationBarTitleText": "设置"
-			}
-		},
+		}, 
 		{
 			"path": "pages/set/about",
 			"style": {
 				"navigationBarTitleText": "关于我们"
 			}
 		},
-		{
-			"path": "pages/set/password",
-			"style": {
-				"navigationBarTitleText": "修改密码"
-			}
-		},
-		{
-			"path": "pages/set/phone",
-			"style": {
-				"navigationBarTitleText": "绑定手机号"
-			}
-		},
 		{
 			"path": "pages/product/reply",
 			"style": {

+ 0 - 169
pages/set/password.vue

@@ -1,169 +0,0 @@
-<template>
-	<view class="container">
-		<view class="row b-b">
-			<text class="tit">手机号</text>
-			<input class="input" disabled v-model="userInfo.phone" type="text" placeholder="请填写手机号" placeholder-class="placeholder" />
-		</view>
-		<view class="row b-b">
-			<text class="tit">验证码</text>
-			<input class="input" v-model="captcha" type="text" placeholder="请填写验证码" placeholder-class="placeholder" />
-			<view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
-		</view>
-		<view class="row b-b">
-			<text class="tit">新密码</text>
-			<input class="input" v-model="password" type="password" placeholder="请填写新密码" placeholder-class="placeholder" />
-		</view>
-		<button class="add-btn" :class="{ 'bg-gray': loding }" @click="loding ? '' : confirm()">提交</button>
-	</view>
-</template>
-
-<script>
-import { verify } from '@/api/login.js';
-import { registerReset } from '@/api/set.js';
-import { mapState } from 'vuex';
-export default {
-	data() {
-		return {
-			time: '', //保存倒计时对象
-			countDown: 0, //倒计时
-			account: '', //手机号
-			captcha: '', //验证码
-			password: '', //新密码
-			loding: false //是否载入中
-		};
-	},
-	computed:{
-		...mapState('user',['userInfo'])
-	},
-	onLoad() {
-		this.account = this.userInfo.phone
-		if(!this.userInfo.phone){
-			uni.showModal({
-				title: '提示',
-				content: '请先绑定手机号!',
-				showCancel: false,
-				success: res => {
-					uni.navigateTo({
-						url:'./phone'
-					})
-				},
-				fail: () => {},
-			});
-		}
-	},
-	watch: {
-		// 监听倒计时
-		countDown(i) {
-			if (i == 0) {
-				clearInterval(this.time);
-			}
-		}
-	},
-	methods: {
-		//发送验证码
-		verification() {
-			let obj = this;
-			if (this.account == '') {
-				this.$api.msg('请输入电话号码');
-				return;
-			}
-			if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.account)) {
-				this.$api.msg('请输入正确的手机号');
-				return;
-			}
-			// 判断是否在倒计时
-			if (obj.countDown > 0) {
-				return false;
-			} else {
-				obj.countDown = 60;
-				obj.time = setInterval(() => {
-					obj.countDown--;
-				}, 1000);
-				//调用验证码接口
-				verify({
-					phone: obj.account,
-					type: ''
-				})
-					.then(({ data }) => {})
-					.catch(err => {
-						console.log(err);
-					});
-			}
-		},
-		confirm(e) {
-			this.loding = true;
-			registerReset({
-				account: this.account,
-				captcha: this.captcha,
-				password: this.password
-			})
-				.then(({ data }) => {
-					this.loding = false;
-					this.$api.msg('修改成功');
-				})
-				.catch(err => {
-					this.loding = true;
-					console.log(err);
-				});
-		}
-	}
-};
-</script>
-
-<style lang="scss">
-page {
-	background: $page-color-base;
-}
-.container {
-	padding-top: 30rpx;
-}
-.row {
-	display: flex;
-	align-items: center;
-	position: relative;
-	padding: 0 30rpx;
-	height: 110rpx;
-	background: #fff;
-
-	.tit {
-		flex-shrink: 0;
-		width: 120rpx;
-		font-size: 30rpx;
-		color: $font-color-dark;
-	}
-	.input {
-		flex: 1;
-		font-size: 30rpx;
-		color: $font-color-dark;
-	}
-	.iconlocation {
-		font-size: 36rpx;
-		color: $font-color-light;
-	}
-}
-.add-btn {
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	width: 690rpx;
-	height: 80rpx;
-	margin: 60rpx auto;
-	font-size: $font-lg;
-	color: #fff;
-	background-color: $base-color;
-	border-radius: 10rpx;
-	// box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
-}
-
-.bg-gray {
-	background-color: $color-gray;
-}
-.code {
-	color: #5dbc7c;
-	font-size: 23rpx;
-	border-left: 1px solid #eeeeee;
-	width: 150rpx;
-	flex-shrink: 0;
-	text-align: center;
-}
-</style>

+ 0 - 164
pages/set/phone.vue

@@ -1,164 +0,0 @@
-<template>
-	<view class="container">
-		<view class="row b-b">
-			<text class="tit">手机号</text>
-			<input class="input" v-model="account" type="text" placeholder="请填写手机号" placeholder-class="placeholder" />
-		</view>
-		<view v-show="show">
-			<view class="row b-b">
-				<text class="tit">验证码</text>
-				<input class="input" v-model="captcha" type="text" placeholder="请填写验证码" placeholder-class="placeholder" />
-				<view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
-			</view>
-			<button class="add-btn" :class="{'bg-gray':loding}" @click="loding?'':confirm()">提交</button>
-		</view>
-	</view>
-</template>
-
-<script>
-import { verify } from '@/api/login.js';
-import { mapState } from 'vuex';
-import { registerReset,binding } from '@/api/set.js';
-export default {
-	data() {
-		return {
-			time: '', //保存倒计时对象
-			countDown: 0, //倒计时
-			account: '', //手机号
-			captcha: '', //验证码
-			password: '' ,//新密码
-			loding:false,//是否载入中
-			show:true
-		};
-	},
-	watch: {
-		// 监听倒计时
-		countDown(i) {
-			if (i == 0) {
-				clearInterval(this.time);
-			}
-		}
-	},
-	computed: {
-		...mapState('user',['userInfo'])
-	},
-	onLoad() {
-		if(this.userInfo.phone == null){
-			this.account = '';
-		}else{
-			this.account = this.userInfo.phone;
-			this.show = false;
-		}
-	},
-	methods: {
-		//发送验证码
-		verification() {
-			let obj = this;
-			if (this.account == '') {
-				this.$api.msg('请输入电话号码');
-				return;
-			}
-			if (!/(^1[1|2|3|4|5|6|7|8|9][0-9]{9}$)/.test(this.account)) {
-				this.$api.msg('请输入正确的手机号');
-				return;
-			}
-			// 判断是否在倒计时
-			if (obj.countDown > 0) {
-				return false;
-			} else {
-				obj.countDown = 60;
-				obj.time = setInterval(() => {
-					obj.countDown--;
-				}, 1000);
-				//调用验证码接口
-				verify({
-					phone: obj.account,
-					type: 'BDING_CODE'
-				})
-					.then(({ data }) => {})
-					.catch(err => {
-						console.log(err);
-					});
-			}
-		},
-		confirm(e) {
-			this.loding = true;
-			binding({
-				phone: this.account,
-				captcha: this.captcha
-			})
-				.then(({ data }) => {
-					this.loding = false;
-					this.$api.msg('绑定成功!');
-					setTimeout(function() {
-						uni.switchTab({
-							url: '/pages/user/user'
-						})
-					}, 1000);
-				})
-				.catch(err => {
-					this.loding = false;
-					console.log(err);
-				});
-		}
-	}
-};
-</script>
-
-<style lang="scss">
-page {
-	background: $page-color-base;
-}
-.container {
-	padding-top: 30rpx;
-}
-.row {
-	display: flex;
-	align-items: center;
-	position: relative;
-	padding: 0 30rpx;
-	height: 110rpx;
-	background: #fff;
-
-	.tit {
-		flex-shrink: 0;
-		width: 120rpx;
-		font-size: 30rpx;
-		color: $font-color-dark;
-	}
-	.input {
-		flex: 1;
-		font-size: 30rpx;
-		color: $font-color-dark;
-	}
-	.iconlocation {
-		font-size: 36rpx;
-		color: $font-color-light;
-	}
-}
-.add-btn {
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	width: 690rpx;
-	height: 80rpx;
-	margin: 60rpx auto;
-	font-size: $font-lg;
-	color: #fff;
-	background-color: $base-color;
-	border-radius: 10rpx;
-	// box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
-}
-
-.bg-gray{
-	background-color: $color-gray;
-}
-.code {
-	color: #5dbc7c;
-	font-size: 23rpx;
-	border-left: 1px solid #eeeeee;
-	width: 150rpx;
-	flex-shrink: 0;
-	text-align: center;
-}
-</style>

+ 0 - 113
pages/set/set.vue

@@ -1,113 +0,0 @@
-<template>
-	<view class="container">
-		<uni-list>
-		    <uni-list-item title="个人资料" @click="navTo('/pages/userinfo/userinfo')" ></uni-list-item>
-			<uni-list-item title="修改密码" @click="navTo('/pages/set/password')" ></uni-list-item>
-		    <uni-list-item title="绑定手机号" @click="navTo('./phone')" ></uni-list-item>
-		    <uni-list-item title="收货地址" @click="navTo('/pages/address/address')" ></uni-list-item>
-		</uni-list>
-		<!-- <uni-list class="margin-t-20">
-		    <uni-list-item title="消息推送" :switch-checked='true' :show-switch="true" :show-arrow="false" switch-color='#5dbc7c'  @switchChange='switchChange'> 
-			</uni-list-item>
-		</uni-list> -->
-		
-		<!-- <uni-list class="margin-t-20">
-		    <uni-list-item title="清除缓存" ></uni-list-item>
-		    <uni-list-item title="检查更新" >
-				<template slot="right">
-					当前版本 1.0.3
-				</template>
-			</uni-list-item>
-		</uni-list> -->
-		<view class="list-cell log-out-btn" @click="toLogout">
-			<text class="cell-tit">退出登录</text>
-		</view>
-	</view>
-</template>
-
-<script>
-	import uniList from "@/components/uni-list/uni-list.vue"
-	import uniListItem from "@/components/uni-list-item/uni-list-item.vue"
-	import { logout } from '@/api/set.js';
-	import {  
-	    mapMutations  
-	} from 'vuex';
-	export default {
-		components: {
-			uniList,uniListItem
-		},
-		data() {
-			return {
-				
-			};
-		},
-		methods:{
-			...mapMutations('user',['logout']),
-			navTo(url){
-				uni.navigateTo({
-					url:url
-				})
-			},
-			//退出登录
-			toLogout(){
-				let obj = this;
-				uni.showModal({
-				    content: '确定要退出登录么',
-				    success: (e)=>{
-				    	if(e.confirm){
-				    		obj.logout();
-							logout({}).then((e) => {
-								uni.navigateBack();
-							}).catch((e) => {
-								console.log(e);
-							})
-				    	}
-				    }
-				});
-			},
-			//switch切换触发方法
-			switchChange(e){
-				console.log(e);
-				let statusTip = e.value ? '打开': '关闭';
-				this.$api.msg(`${statusTip}消息推送`);
-			},
-
-		}
-	}
-</script>
-
-<style lang='scss'>
-	page{
-		background: $page-color-base;
-	}
-	.list-cell{
-		display:flex;
-		align-items:baseline;
-		padding: 20rpx $page-row-spacing;
-		line-height:60rpx;
-		position:relative;
-		background: #fff;
-		justify-content: center;
-		&.log-out-btn{
-			margin-top: 40rpx;
-			.cell-tit{
-				color: $uni-color-primary;
-				text-align: center;
-				margin-right: 0;
-			}
-		}
-		.cell-tit{
-			flex: 1;
-			font-size: $font-base + 2rpx;
-			color: $font-color-dark;
-			margin-right:10rpx;
-		}
-		.cell-tip{
-			font-size: $font-base;
-			color: $font-color-light;
-		}
-		switch{
-			transform: translateX(16rpx) scale(.84);
-		}
-	}
-</style>

+ 1 - 1
pages/user/user.vue

@@ -19,7 +19,7 @@
 					</view>
 				</view>
 				<view class="config">
-					<text class="setting " @click="navTo('/pages/set/set')">
+					<text class="setting " @click="navTo('/pages/userinfo/userinfo')">
 						<image src="../../static/user/set.png" mode=""></image>
 						</text>
 						设置

+ 118 - 20
pages/userinfo/userinfo.vue

@@ -1,40 +1,82 @@
 <template>
 	<view class="content">
-		<view class="row b-b">
+		<view class="row1">
+			<text class="tit">头像</text>
+			<view class="background-img" @click="upload"><image class="background-img" v-model="avatar" :src="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="button" v-model="name" placeholder-class="placeholder" />
+		</view>
+		<view class="row">
+			<text class="tit">邀请码</text>
+			<input class="input" disabled type="text" v-model="uid" placeholder-class="placeholder" />
 		</view>
-		<button class="add-btn" @click="confirm">提交</button>
+		<view class="row">
+			<text class="tit">账号</text>
+			<input class="input" disabled type="text" v-model="phone" placeholder-class="placeholder" />
+		</view>
+		<button class="add-btn" @click="confirm">修改</button>
+		<button class="loginout" @click="loginout">退出登录</button>
 	</view>
 </template>
 
 <script>
-import { mapState } from 'vuex';
-import { userEdit } from '@/api/set.js';
+import { mapState,mapMutations } from 'vuex';
+import { userEdit,upload,logout } from '@/api/set.js';
 export default {
 	data() {
 		return {
-			name: ''
+			name: '', // 昵称
+			uid: '',
+			phone:'',
+			avatar: '',
 		};
 	},
-
 	computed: {
-		...mapState('user', ['userInfo'])
+		...mapState('user',['userInfo']),
+		startDate() {
+			console.log('start');
+		},
+		endDate() {
+			console.log('end');
+		}
 	},
 	onShow(option) {
+		// 获取生日日期
+		console.log(this.userInfo);
 		this.name = this.userInfo.nickname + '';
+		this.uid = this.userInfo.uid || '';
+		this.avatar = this.userInfo.avatar || '';
+		this.phone = this.userInfo.phone || '';
 	},
 	methods: {
+		...mapMutations('user', ['logout']),
+		// 上传头像
+		upload() {
+			console.log("111111")
+			upload({
+				filename: ''
+			}).then(data => {
+				this.avatar = data[0].url;
+				console.log(this.avatar, 'tup')
+				setTimeout(() => {
+					uni.hideLoading()
+				}, 500)
+			});
+		},
 		switchChange(e) {
 			this.addressData.default = e.value;
 		},
 		confirm() {
-			userEdit({ nickname: this.name, avatar: this.userInfo.avatar })
-				.then(e => {
+			userEdit({ 
+			  nickname: this.name,
+			  avatar: this.avatar, 
+			}).then(e => {
 					this.$api.msg('修改成功');
-					setTimeout(()=> {
+					setTimeout(() => {
 						uni.switchTab({
-							url:'/pages/user/user'
+							url: '/pages/user/user'
 						});
 					}, 1000);
 					console.log(e);
@@ -42,6 +84,19 @@ export default {
 				.catch(e => {
 					console.log(e);
 				});
+		},
+		loginout() {
+			let obj = this;
+			uni.showModal({
+				content: '确定要退出登录么',
+				success: e => {
+					if (e.confirm) {
+						logout({}).then()
+						uni.navigateBack();
+						obj.logout();
+					}
+				}
+			});
 		}
 	}
 };
@@ -50,12 +105,35 @@ export default {
 <style lang="scss">
 page {
 	background: $page-color-base;
-	padding-top: 16upx;
 }
 
+.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;
+	}
+}
 .row {
 	display: flex;
 	align-items: center;
+	justify-content: space-between;
 	position: relative;
 	padding: 0 30upx;
 	height: 110upx;
@@ -64,13 +142,21 @@ page {
 	.tit {
 		flex-shrink: 0;
 		width: 120upx;
-		font-size: 30upx;
+		font-size: $font-lg;
+		color: $font-color-dark;
+	}
+	.tit1 {
+		flex-shrink: 0;
+		width: 150upx;
+		font-size: $font-lg;
 		color: $font-color-dark;
+		
 	}
 	.input {
+		text-align: right;
 		flex: 1;
-		font-size: 30upx;
-		color: $font-color-dark;
+		font-size: $font-base;
+		color: $color-gray;
 	}
 	.iconlocation {
 		font-size: 36upx;
@@ -81,13 +167,25 @@ page {
 	display: flex;
 	align-items: center;
 	justify-content: center;
-	width: 690upx;
+	width: 560upx;
 	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);
+	background: $base-color;
+	border-radius: 40upx;
+}
+.loginout {
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	width: 560upx;
+	height: 80upx;
+	margin: 60upx auto;
+	font-size: $font-lg;
+	color: $base-color;
+	background: #FFFFFF;
+	border: 1px solid $base-color;
+	border-radius: 40upx;
 }
 </style>