YY преди 2 години
родител
ревизия
1a89060248
променени са 8 файла, в които са добавени 713 реда и са изтрити 7 реда
  1. 120 0
      components/upload/index.vue
  2. 15 0
      pages.json
  3. 4 5
      pages/my/index.vue
  4. 146 0
      pagesMy/account/bindEmail.vue
  5. 107 2
      pagesMy/account/index.vue
  6. 193 0
      pagesMy/account/upBasic.vue
  7. 127 0
      pagesMy/account/upPassword.vue
  8. 1 0
      pagesMy/address/add.vue

+ 120 - 0
components/upload/index.vue

@@ -0,0 +1,120 @@
+<template>
+	<view class="main">
+		<view class="one">
+			<view class="list" v-for="(item,index) in list" :key="index">
+				<image class="image" :src="item.url" @click="toView(index,item)"></image>
+				<uni-icons class="del" type="close" size="30" color="#ff0000" @click="uplDel(index,item)"></uni-icons>
+			</view>
+			<view class="list" v-if="list&&list.length<count" @tap="uplSuc()">
+				<uni-icons class="add" type="plusempty" size="55" color="#ff0000"></uni-icons>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			list: {
+				type: Array,
+			},
+			name: {
+				type: String,
+			},
+			count: {
+				type: Number,
+				default: 1
+			}
+		},
+		data() {
+			return {
+
+			};
+		},
+		methods: {
+			uplSuc() {
+				const that = this;
+				let serverUrl = that.$config.serverUrl;
+				uni.chooseImage({
+					count: 1,
+					sizeType: ['original', 'compressed'],
+					sourceType: ['album', 'camera'],
+					success: async function(res) {
+						let tempFile = JSON.parse(JSON.stringify(res.tempFilePaths));
+						const arr = await that.$apifile(`/live/upload`, 'file', tempFile[0], 'file');
+						that.$emit('uplSuc', {
+							data: {
+								name: arr.name,
+								uri: arr.uri,
+								url: serverUrl + arr.uri
+							},
+							name: that.name
+						})
+					}
+				});
+			},
+			// 删除图片
+			uplDel(index, e) {
+				const that = this;
+				that.$emit('uplDel', {
+					data: {
+						file: e,
+						index: index
+					},
+					name: that.name
+				})
+			},
+			// 图片预览
+			toView(index, e) {
+				const that = this;
+				uni.previewImage({
+					current: index,
+					urls: [e.url]
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		padding: 0 2vw;
+
+		.one {
+			display: flex;
+			flex-direction: row;
+			flex-wrap: wrap;
+
+			.list {
+				position: relative;
+				width: 30vw;
+				height: 28vw;
+				text-align: center;
+				margin: 0 3vw 2vw 0;
+				border-radius: 5px;
+				box-shadow: 0 0 2px #858585;
+
+				.image {
+					width: 100%;
+					height: 100%;
+					border-radius: 5px;
+				}
+
+				.add {
+					position: relative;
+					top: 20px;
+				}
+
+				.del {
+					position: absolute;
+					right: 0;
+					top: 0;
+				}
+			}
+
+			.list:nth-child(3n) {
+				margin: 0 0 2vw 0;
+			}
+		}
+	}
+</style>

+ 15 - 0
pages.json

@@ -118,6 +118,21 @@
 					"style": {
 						"navigationBarTitleText": "账号管理"
 					}
+				}, {
+					"path": "account/upPassword",
+					"style": {
+						"navigationBarTitleText": "登录密码"
+					}
+				}, {
+					"path": "account/bindEmail",
+					"style": {
+						"navigationBarTitleText": "绑定邮箱"
+					}
+				}, {
+					"path": "account/upBasic",
+					"style": {
+						"navigationBarTitleText": "个人信息"
+					}
 				}
 			]
 		},

+ 4 - 5
pages/my/index.vue

@@ -34,7 +34,8 @@
 					</view>
 				</view>
 				<view class="two_2">
-					<view class="orderList" v-for="(item, index) in orderList" :key="index" @click="toOrrder(item.type)">
+					<view class="orderList" v-for="(item, index) in orderList" :key="index"
+						@click="toOrrder(item.type)">
 						<view class="icon">
 							<text class="iconfont" :class="[item.icon]"></text>
 						</view>
@@ -138,13 +139,11 @@
 					},
 					fail: function(err) {
 						uni.navigateTo({
-							url: `/pages/login/index`
+							url: `/${e}`
 						})
 					}
 				});
-				// uni.navigateTo({
-				// 	url: `/${e}`
-				// })
+
 			},
 			// 跳转页面
 			toOrrder(e) {

+ 146 - 0
pagesMy/account/bindEmail.vue

@@ -0,0 +1,146 @@
+<template>
+	<mobile-frame :frameStyle="frameStyle" @toPath="toPath">
+		<view class="main">
+			<view class="one">
+				<uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
+					<uni-forms-item label="电子邮箱" name="email" class="local">
+						<uni-easyinput type="text" v-model="form.email" placeholder="请输入电子邮箱" />
+						<button class="localicon" type="primary" size="mini">发送验证码</button>
+					</uni-forms-item>
+					<uni-forms-item label="邮箱验证码" name="num">
+						<uni-easyinput type="text" v-model="form.num" placeholder="请输入邮箱验证码" />
+					</uni-forms-item>
+				</uni-forms>
+				<view class="btn">
+					<button type="primary" @click="onSubmit('form')" size="small">立即绑定</button>
+					<view class="name">提示:为了您的账户安全,建议定期修改密码</view>
+				</view>
+			</view>
+		</view>
+
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				frameStyle: {
+					useBar: false
+				},
+				form: {},
+				rules: {
+					email: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入邮箱',
+						}]
+					},
+					num: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入邮箱验证码',
+						}]
+					},
+				},
+			};
+		},
+		onLoad: function(e) {
+			console.log(e);
+		},
+		onShow: function() {},
+		methods: {
+			toPath(e) {
+				if (e && e.route) uni.redirectTo({
+					url: `/${e.route}`
+				})
+			},
+			// 提交保存
+			onSubmit() {
+				const that = this;
+				let data = that.form;
+				data = {
+					...data,
+				}
+				console.log(data);
+				// this.$refs.form.validate().then(async (res) => {
+				// let arr;
+				// if (data._id) {
+				// 	arr = await that.$api(``, 'POST', data)
+				// } else {
+				// 	arr = await that.$api(``, 'POST', data)
+				// }
+				// if (arr.errcode == '0') {
+				// 	uni.showToast({
+				// 		title: `维护信息成功`,
+				// 		icon: 'success',
+				// 		duration: 2000
+				// 	});
+				// 	that.back()
+				// } else {
+				// 	uni.showToast({
+				// 		title: arr.errmsg,
+				// 		icon: 'error',
+				// 		duration: 2000
+				// 	})
+				// }
+				// })
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			padding: 2vw;
+
+			.uni-input {
+				border: #f1f1ff 1px solid;
+				padding: 2vw 2vw;
+				border-radius: 1vw;
+			}
+
+
+			.btn {
+				text-align: center;
+
+				button {
+					margin: 0 2vw 2vw 2vw;
+					background-color: var(--ff0Color);
+					color: var(--fffColor);
+				}
+
+				.name {
+					color: var(--f85Color);
+					font-size: var(--font14Size);
+				}
+			}
+		}
+	}
+
+	.uni-forms-item {
+		margin-bottom: 6vw !important;
+		display: flex;
+		flex-direction: row;
+	}
+
+
+	.uni-forms-item:first-child {
+		.uni-easyinput__content {
+			width: 50vw;
+		}
+	}
+
+
+	.localicon {
+		position: absolute;
+		right: 0;
+		top: 5px;
+	}
+</style>

+ 107 - 2
pagesMy/account/index.vue

@@ -1,6 +1,37 @@
 <template>
 	<mobile-frame>
-		1
+		<view class="main">
+			<view class="one" @click="toCommon('/pagesMy/account/upPassword')">
+				<view class="other">
+					<view class="title">{{passLogin.name}}</view>
+					<view class="titles">{{passLogin.content}}</view>
+				</view>
+				<view class="btn">
+					<text class="iconfont icon-dayufuhao"></text>
+				</view>
+			</view>
+			<view class="one" @click="toCommon('/pagesMy/account/bindEmail')">
+				<view class="other">
+					<view class="title">{{email.name}}</view>
+					<view class="titles">{{email.content}}</view>
+				</view>
+				<view class="btn">
+					<text class="iconfont icon-dayufuhao"></text>
+				</view>
+			</view>
+			<view class="one" @click="toCommon('/pagesMy/account/upBasic')">
+				<view class="other">
+					<view class="title">{{info.name}}</view>
+					<view class="titles">{{info.content}}</view>
+				</view>
+				<view class="btn">
+					<text class="iconfont icon-dayufuhao"></text>
+				</view>
+			</view>
+			<view class="two">
+				<button type="default" @click="toOut()">退出当前登录</button>
+			</view>
+		</view>
 	</mobile-frame>
 </template>
 
@@ -8,16 +39,90 @@
 	export default {
 		data() {
 			return {
+				passLogin: {
+					name: '登录密码',
+					content: '建议定期修改密码以保护账号安全'
+				},
+				phone: {
+					name: '绑定手机',
+					content: '如若您已更换手机号,请及时绑定',
+					phone: '137****0000'
+				},
+				email: {
+					name: '绑定邮箱',
+					content: '未绑定邮箱,请及时绑定'
+				},
+				info: {
+					name: '修改个人信息',
+					content: '修改个人信息'
+				},
 
 			};
 		},
 		onShow: function() {},
 		methods: {
-
+			// 跳转
+			toCommon(route, e) {
+				uni.navigateTo({
+					url: `${route}`
+				})
+			},
+			// 退出登录
+			toOut(e) {
+				try {
+					uni.clearStorage();
+					uni.redirectTo({
+						url: '/pages/index/index'
+					})
+				} catch (e) {}
+			}
 		}
 	}
 </script>
 
 <style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			border-bottom: 1px var(--fcColor) solid;
+			margin: 1vw 3vw;
+			display: flex;
+			flex-direction: row;
+			padding: 1vw 0;
+
+			.other {
+				flex-grow: 1;
+
+				.title {
+					margin: 2vw 0;
+					font-size: var(--font16Size);
+				}
+
+				.titles {
+					font-size: var(--font14Size);
+					color: var(--f85Color);
+					margin: 2vw 0;
+				}
+			}
 
+			.btn {
+				text-align: right;
+				font-size: 20px;
+			}
+		}
+
+		.two {
+			margin: 1vw 3vw;
+
+			button {
+				border-radius: 20px;
+				border: 2px solid var(--ff0Color);
+				color: var(--ff0Color);
+			}
+		}
+	}
 </style>

+ 193 - 0
pagesMy/account/upBasic.vue

@@ -0,0 +1,193 @@
+<template>
+	<mobile-frame>
+		<view class="info">
+			<view class="one">
+				<uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
+					<uni-forms-item label="头像" name="logo">
+						<upload :list="logo" name="logo" :count="1" @uplSuc="uplSuc" @uplDel="uplDel"></upload>
+					</uni-forms-item>
+					<uni-forms-item label="真实姓名" name="name">
+						<uni-easyinput type="text" v-model="form.name" placeholder="请输入真实姓名" />
+					</uni-forms-item>
+					<uni-forms-item label="性别" name="gender">
+						<picker @change="genderChange" name="gender" :value="form.gender" :range="genderList"
+							range-key="label">
+							<view class="uni-input">{{form.zhGender||'请选择性别'}}</view>
+						</picker>
+					</uni-forms-item>
+					<uni-forms-item label="生日" name="date">
+						<picker mode="date" :value="form.date" name="date" :start="startDate" :end="endDate"
+							@change="bindDateChange">
+							<view class="uni-input">{{form.date||'请选择日期'}}</view>
+						</picker>
+					</uni-forms-item>
+					<uni-forms-item label="QQ号" name="QQ">
+						<uni-easyinput type="text" v-model="form.qq" placeholder="请输入QQ号" />
+					</uni-forms-item>
+					<uni-forms-item label="昵称" name="Nname">
+						<uni-easyinput type="text" v-model="form.Nname" placeholder="请输入昵称" />
+					</uni-forms-item>
+				</uni-forms>
+				<view class="btn">
+					<button type="primary" @click="onSubmit('form')" size="small">提交</button>
+					<view class="name">提示:为了您的账户安全,建议定期修改密码</view>
+				</view>
+			</view>
+		</view>
+
+	</mobile-frame>
+</template>
+
+<script>
+	import upload from '@/components/upload/index.vue';
+	export default {
+		components: {
+			upload
+		},
+		data() {
+			return {
+				frameStyle: {
+					useBar: false
+				},
+				form: {},
+				rules: {
+					name: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入真实姓名',
+						}]
+					},
+					num: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入邮箱验证码',
+						}]
+					},
+				},
+				genderList: [{
+						label: '保密',
+						value: '0'
+					},
+					{
+						label: '男',
+						value: '1'
+					},
+					{
+						label: '女',
+						value: '2'
+					},
+				],
+				logo: []
+			};
+		},
+		onLoad: function(e) {
+
+		},
+		onShow: function() {},
+		methods: {
+			toPath(e) {
+				if (e && e.route) uni.redirectTo({
+					url: `/${e.route}`
+				})
+			},
+			// 图片上传
+			uplSuc(e) {
+				const that = this;
+				console.log(e);
+				that.$set(that, `${e.name}`, [...that[e.name], e.data]);
+			},
+			// 图片删除
+			uplDel(e) {
+				const that = this;
+				console.log(e);
+				let data = that[e.name];
+				let arr = data.filter((i, index) => index != e.data.index);
+				that.$set(that, `${e.name}`, arr)
+			},
+			// 选择性别
+			genderChange(e) {
+				const that = this;
+				let data = that.genderList[e.detail.value];
+				if (data) {
+					that.$set(that.form, `gender`, data.value);
+					that.$set(that.form, `zhGender`, data.label);
+				}
+			},
+			// 选择日期
+			bindDateChange(e) {
+				// this.date = e.detail.value
+				const that = this;
+				that.$set(that.form, `date`, e.detail.value);
+			},
+			// 提交保存
+			onSubmit() {
+				const that = this;
+				let data = that.form;
+				data.logo = that.logo;
+				console.log(data);
+				// this.$refs.form.validate().then(async (res) => {
+				// let arr;
+				// if (data._id) {
+				// 	arr = await that.$api(``, 'POST', data)
+				// } else {
+				// 	arr = await that.$api(``, 'POST', data)
+				// }
+				// if (arr.errcode == '0') {
+				// 	uni.showToast({
+				// 		title: `维护信息成功`,
+				// 		icon: 'success',
+				// 		duration: 2000
+				// 	});
+				// 	that.back()
+				// } else {
+				// 	uni.showToast({
+				// 		title: arr.errmsg,
+				// 		icon: 'error',
+				// 		duration: 2000
+				// 	})
+				// }
+				// })
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.info {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			padding: 2vw;
+
+			.uni-input {
+				border: #f1f1ff 1px solid;
+				padding: 2vw 2vw;
+				border-radius: 1vw;
+			}
+
+			.btn {
+				text-align: center;
+
+				button {
+					margin: 0 2vw 2vw 2vw;
+					background-color: var(--ff0Color);
+					color: var(--fffColor);
+				}
+
+				.name {
+					color: var(--f85Color);
+					font-size: var(--font14Size);
+				}
+			}
+		}
+	}
+
+	.uni-forms-item {
+		margin-bottom: 6vw !important;
+		display: flex;
+		flex-direction: row;
+	}
+</style>

+ 127 - 0
pagesMy/account/upPassword.vue

@@ -0,0 +1,127 @@
+<template>
+	<mobile-frame :frameStyle="frameStyle" @toPath="toPath">
+		<view class="main">
+			<view class="one">
+				<uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
+					<uni-forms-item label="用户账号" name="name">
+						<uni-easyinput type="text" v-model="form.name" placeholder="请输入用户账号" disabled />
+					</uni-forms-item>
+					<uni-forms-item label="新密码" name="password">
+						<uni-easyinput type="password" v-model="form.password" placeholder="请输入新密码" />
+					</uni-forms-item>
+					<uni-forms-item label="确认密码" name="password">
+						<uni-easyinput type="password" v-model="form.password" placeholder="请输入确认密码" />
+					</uni-forms-item>
+				</uni-forms>
+				<view class="btn">
+					<button type="primary" @click="onSubmit('form')" size="small">提交</button>
+					<view class="name">提示:为了您的账户安全,建议定期修改密码</view>
+				</view>
+			</view>
+		</view>
+
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				frameStyle: {
+					useBar: false
+				},
+				form: {},
+				rules: {
+					password: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入密码',
+						}]
+					},
+				},
+			};
+		},
+		onLoad: function(e) {
+			console.log(e);
+		},
+		onShow: function() {},
+		methods: {
+			toPath(e) {
+				if (e && e.route) uni.redirectTo({
+					url: `/${e.route}`
+				})
+			},
+			// 提交保存
+			onSubmit() {
+				const that = this;
+				let data = that.form;
+				data = {
+					...data,
+				}
+				console.log(data);
+				// this.$refs.form.validate().then(async (res) => {
+				// let arr;
+				// if (data._id) {
+				// 	arr = await that.$api(``, 'POST', data)
+				// } else {
+				// 	arr = await that.$api(``, 'POST', data)
+				// }
+				// if (arr.errcode == '0') {
+				// 	uni.showToast({
+				// 		title: `维护信息成功`,
+				// 		icon: 'success',
+				// 		duration: 2000
+				// 	});
+				// 	that.back()
+				// } else {
+				// 	uni.showToast({
+				// 		title: arr.errmsg,
+				// 		icon: 'error',
+				// 		duration: 2000
+				// 	})
+				// }
+				// })
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			padding: 2vw;
+
+			.uni-input {
+				border: #f1f1ff 1px solid;
+				padding: 2vw 2vw;
+				border-radius: 1vw;
+			}
+
+			.btn {
+				text-align: center;
+
+				button {
+					margin: 0 2vw 2vw 2vw;
+					background-color: var(--ff0Color);
+					color: var(--fffColor);
+				}
+
+				.name {
+					color: var(--f85Color);
+					font-size: var(--font14Size);
+				}
+			}
+		}
+	}
+
+	.uni-forms-item {
+		margin-bottom: 6vw !important;
+		display: flex;
+		flex-direction: row;
+	}
+</style>

+ 1 - 0
pagesMy/address/add.vue

@@ -84,6 +84,7 @@
 					url: `/${e.route}`
 				})
 			},
+			
 			// 是否设为默认地址
 			switchChange(e) {
 				const that = this;