Ver Fonte

2022-8-17

cmy há 2 anos atrás
pai
commit
31b6bd5ac2
4 ficheiros alterados com 482 adições e 141 exclusões
  1. 2 2
      manifest.json
  2. 6 1
      pages/product/product.vue
  3. 257 138
      pages/set/userinfo.vue
  4. 217 0
      pages/shoping/userinfo.vue

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "艺绘",
     "appid" : "__UNI__E01ACD1",
     "description" : "",
-    "versionName" : "1.0.6",
-    "versionCode" : 106,
+    "versionName" : "1.0.7",
+    "versionCode" : 107,
     "transformPx" : false,
     "app-plus" : {
         /* 5+App特有相关 */

+ 6 - 1
pages/product/product.vue

@@ -324,6 +324,11 @@
 								obj.paySuccessTo();
 							},
 							fail: e => {
+								uni.showModal({
+									title: '错误',
+									content: '未成功支付',
+									showCancel: false,
+								});
 								console.log(e);
 							},
 							complete: () => {}
@@ -416,7 +421,7 @@
 						}
 					}
 					if (obj.type == 'ali') {
-						const url = res.data.result.payConfig;
+						const url = res.data.result.jsConfig;
 						console.log(url, 'url');
 						uni.requestPayment({
 							provider: 'alipay',

+ 257 - 138
pages/set/userinfo.vue

@@ -10,120 +10,161 @@
 		</view>
 		<view class="row b-b flex">
 			<text class="tit">邀请码</text>
-			<input class="input" :value="userInfo.uid" type="text" disabled="true" placeholder-class="placeholder" style="color: #999;" />
+			<input class="input" :value="userInfo.uid" type="text" disabled="true" placeholder-class="placeholder"
+				style="color: #999;" />
 		</view>
 
 		<view class="row b-b flex" v-if="userInfo.account || userInfo.phone">
 			<text class="tit">用户账号</text>
-			<input class="input" :value="userInfo.account || userInfo.phone" type="number" disabled="true" style="color: #999;" placeholder-class="placeholder" />
-		</view>
-		<view class="submit-box flex">
-			<view class="submit" @click="edit">确认修改</view>
-			<view class="submit dl" @click="toLogout">退出登录</view>
+			<input class="input" :value="userInfo.account || userInfo.phone" type="number" disabled="true"
+				style="color: #999;" placeholder-class="placeholder" />
 		</view>
+		<view class="list-cell log-out-btn out" @click="cancel"><text class="cell-tit">注销账户</text></view>
+		<view class="list-cell log-out-btn" @click="edit"><text class="cell-tit">确认修改</text></view>
+
+		<uni-popup ref="popup" type="center">
+			<view class="psw-wrapper">
+				<view class="psw-title">请输入自己的账户</view>
+				<input type="text" v-model="password" class="psw-ipt" />
+				<view class="psw-btn">
+					<text @click.stop="qx">取消</text>
+					<text class="psw-qd" @click.stop="pswQd">确定</text>
+				</view>
+			</view>
+		</uni-popup>
 	</view>
 </template>
 
 <script>
-import uniList from '@/components/uni-list/uni-list.vue';
-import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
-import { mapState, mapMutations } from 'vuex';
-import { logout } from '@/api/set.js';
-
-import { edit } from '@/api/user.js';
-import { upload } from '@/api/order.js';
-export default {
-	components: {
-		uniList,
-		uniListItem
-	},
-	data() {
-		return {
-			userInfo: {},
-			pics: []
-		};
-	},
-	onLoad() {
-		this.userInfo = uni.getStorageSync('userInfo') || '';
-		console.log(this.userInfo);
-	},
-	methods: {
-		...mapMutations('user', ['logout']),
-		//退出登录
-		toLogout() {
-			let obj = this;
-			uni.showModal({
-				content: '确定要退出登录么',
-				success: e => {
-					if (e.confirm) {
-						logout({})
-							.then(e => {
-								obj.logout();
-								uni.switchTab({
-									url: '/pages/index/index'
-								});
-							})
-							.catch(e => {
-								console.log(e);
-							});
-					}
-				}
-			});
+	import uniList from '@/components/uni-list/uni-list.vue';
+	import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+	import {
+		logout
+	} from '@/api/set.js';
+
+	import {
+		edit
+	} from '@/api/user.js';
+	import {
+		upload
+	} from '@/api/order.js';
+	export default {
+		components: {
+			uniList,
+			uniListItem
+		},
+		data() {
+			return {
+				userInfo: {},
+				pics: [],
+				show: false,
+				password: '',
+
+			};
 		},
-		imgsub() {
-			let obj = this;
-			console.log('上传头像');
-			// this.$util.uploadImageOne('upload/image', function(res) {
-			// 	console.log('------',res);
-			// 	this.pics.push(res.data.pathreplace(/http:\/\/mer.crmeb.net/,'https://hy.liuniu946.com'));
-			// 	// obj.userInfo.avatar = res.data.path.replace(/http:\/\/mer.crmeb.net/,'http://zccy.frp.liuniu946.com')
-			// 	obj.$set(this, 'pics', this.pics);
-			// 	obj.$set(this, 'extract_pic', this.pics[0])
-			// });
-			// uploads({
-			// 	filename: ''
-			// }).then(data => {
-			// 	console.log("data",data);
-			// 	this.userInfo.avatar = data[0].url;
-			// })
-			upload({
-				filename: ''
-			}).then(res => {
-				console.log(res[0].url);
-				obj.userInfo.avatar = res[0].url;
-				// console.log(obj.userInfo.avatar)
-			});
+		onLoad() {
+			this.userInfo = uni.getStorageSync('userInfo') || '';
+			console.log(this.userInfo);
 		},
-		edit() {
-			const that = this;
-			uni.showLoading({
-				title: '提交中...',
-				mask: true
-			});
-			edit({
-				avatar: this.userInfo.avatar,
-				nickname: this.userInfo.nickname
-			})
-				.then(e => {
-					uni.hideLoading();
-					that.$api.msg('修改成功');
-					setTimeout(() => {
-						uni.switchTab({
-							url: '/pages/user/user'
-						});
-					}, 1000);
-				})
-				.catch(e => {
-					console.log(e);
-					that.$api.msg('修改失败');
+		methods: {
+			...mapMutations('user', ['logout']),
+			cancel() {
+				this.$refs.popup.open();
+			},
+			pswQd() {
+				if (this.password != this.userInfo.phone) {
+					this.$refs.popup.close();
+					this.password = '';
+					this.$api.msg("请输入自己的账户")
+					return
+				}
+				this.$refs.popup.close();
+				this.password = '';
+				this.$api.msg("申请注销成功,请耐心等待审核")
+			},
+			qx() {
+				this.password = '';
+				this.$refs.popup.close();
+			},
+			//退出登录
+			toLogout() {
+				let obj = this;
+				uni.showModal({
+					content: '确定要退出登录么',
+					success: e => {
+						if (e.confirm) {
+							logout({})
+								.then(e => {
+									obj.logout();
+									uni.switchTab({
+										url: '/pages/index/index'
+									});
+								})
+								.catch(e => {
+									console.log(e);
+								});
+						}
+					}
 				});
+			},
+			imgsub() {
+				let obj = this;
+				console.log('上传头像');
+				// this.$util.uploadImageOne('upload/image', function(res) {
+				// 	console.log('------',res);
+				// 	this.pics.push(res.data.pathreplace(/http:\/\/mer.crmeb.net/,'https://hy.liuniu946.com'));
+				// 	// obj.userInfo.avatar = res.data.path.replace(/http:\/\/mer.crmeb.net/,'http://zccy.frp.liuniu946.com')
+				// 	obj.$set(this, 'pics', this.pics);
+				// 	obj.$set(this, 'extract_pic', this.pics[0])
+				// });
+				// uploads({
+				// 	filename: ''
+				// }).then(data => {
+				// 	console.log("data",data);
+				// 	this.userInfo.avatar = data[0].url;
+				// })
+				upload({
+					filename: ''
+				}).then(res => {
+					console.log(res[0].url);
+					obj.userInfo.avatar = res[0].url;
+					// console.log(obj.userInfo.avatar)
+				});
+			},
+			edit() {
+				const that = this;
+				uni.showLoading({
+					title: '提交中...',
+					mask: true
+				});
+				edit({
+						avatar: this.userInfo.avatar,
+						nickname: this.userInfo.nickname
+					})
+					.then(e => {
+						uni.hideLoading();
+						that.$api.msg('修改成功');
+						setTimeout(() => {
+							uni.switchTab({
+								url: '/pages/user/user'
+							});
+						}, 1000);
+					})
+					.catch(e => {
+						console.log(e);
+						that.$api.msg('修改失败');
+					});
+			}
 		}
-	}
-};
+	};
 </script>
 
 <style lang="scss">
-/* page{
+	/* page{
 		background: $page-color-base;
 	}
 	.list-cell{
@@ -156,55 +197,133 @@ export default {
 			transform: translateX(16rpx) scale(.84);
 		}
 	} */
-page {
-	background-color: #f3f3f3;
-	min-height: 100%;
+	page {
+		background-color: #f3f3f3;
+		min-height: 100%;
 
-	.container {
-		height: 100%;
+		.container {
+			height: 100%;
+		}
 	}
-}
 
-.row {
-	background-color: #fff;
-	padding: 42rpx 25rpx;
-	font-size: 30rpx;
-	color: #333333;
+	.row {
+		background-color: #fff;
+		padding: 42rpx 25rpx;
+		font-size: 30rpx;
+		color: #333333;
 
-	image {
-		width: 80rpx;
-		height: 80rpx;
-		border-radius: 50%;
+		image {
+			width: 80rpx;
+			height: 80rpx;
+			border-radius: 50%;
+		}
+
+		.input {
+			text-align: right;
+			color: #333333;
+		}
 	}
 
-	.input {
-		text-align: right;
-		color: #333333;
+	.submit-box {
+		display: flex;
+		flex-direction: column;
+		padding-top: 157rpx;
+
+		.submit {
+			margin: 40rpx auto;
+			width: 560rpx;
+			background-color: #08d29b;
+			color: #ffffff;
+			text-align: center;
+			padding: 26rpx 0rpx;
+			border-radius: 50rpx;
+		}
+
+		.dl {
+			background-color: #ffffff;
+			color: #08d29b;
+		}
 	}
-}
-
-.submit-box {
-	display: flex;
-	flex-direction: column;
-	padding-top: 157rpx;
-
-	.submit {
-		margin: 40rpx auto;
-		width: 560rpx;
-		background-color: #08d29b;
-		color: #ffffff;
-		text-align: center;
-		padding: 26rpx 0rpx;
-		border-radius: 50rpx;
+
+	.jg {
+		margin-bottom: 20rpx;
 	}
 
-	.dl {
-		background-color: #ffffff;
-		color: #08d29b;
+	.list-cell {
+		display: flex;
+		align-items: baseline;
+		margin: 100rpx 30rpx 0 30rpx;
+		line-height: 80rpx;
+		height: 80rpx;
+		position: relative;
+		background: linear-gradient(270deg, #6E8DF7, #9977F6);
+		border-radius: 10rpx;
+		justify-content: center;
+
+		&.out {
+			background: #999999
+		}
+
+		&.log-out-btn {
+			margin-top: 40rpx;
+
+			.cell-tit {
+				color: #fff;
+				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(0.84);
+		}
 	}
-}
 
-.jg {
-	margin-bottom: 20rpx;
-}
+	.psw-wrapper {
+		width: 548rpx;
+		height: 344rpx;
+		background-color: #ffffff;
+
+		.psw-title {
+			width: 100%;
+			font-size: 35rpx;
+			padding: 43rpx 0 49rpx;
+			text-align: center;
+			font-weight: 800;
+		}
+
+		.psw-ipt {
+			display: block;
+			background-color: #dce3ed;
+			height: 90rpx;
+			width: 464rpx;
+			padding-left: 30rpx;
+			margin: 0 auto;
+			font-size: 80rpx;
+		}
+
+		.psw-btn text {
+			display: inline-block;
+			text-align: center;
+			width: 50%;
+			padding-top: 29rpx;
+			font-size: 35rpx;
+		}
+
+		.psw-qd {
+			color: #32C6FF;
+		}
+	}
 </style>

+ 217 - 0
pages/shoping/userinfo.vue

@@ -0,0 +1,217 @@
+<template>
+	<view class="content">
+		<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="userInfo.nickname" placeholder-class="placeholder" />
+		</view>
+		<view class="row">
+			<text class="tit">ID</text>
+			<input class="input" type="text"  disabled="true" v-model="userInfo.uid" 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>
+		<view class="out ooo" @click="cancel">注销账户</view>
+		<view class="out" @click="toLogout">退出登录</view>
+		<view class="add-btn" @click="confirm">提交</view>
+		<uni-popup ref="popup" type="center">
+			<view class="psw-wrapper">
+				<view class="psw-title">请输入自己的账户</view>
+				<input type="text" v-model="password" class="psw-ipt" />
+				<view class="psw-btn">
+					<text @click.stop="qx">取消</text>
+					<text class="psw-qd" @click.stop="pswQd">确定</text>
+				</view>
+			</view>
+		</uni-popup>
+	</view>
+</template>
+
+<script>
+import { mapState,mapMutations } from 'vuex';
+import { upload } from '@/api/order.js';
+import {userEdit,logout} from '@/api/set.js';
+export default {
+	data(){
+		return{
+			show:false,
+			password: '',
+		}
+	},
+	onLoad() {
+		console.log(this.userInfo)
+	},
+	computed: {
+		...mapState('user',['userInfo'])
+	},
+	methods: {
+		...mapMutations('user',['logout']),
+		imgsub() {
+			console.log('上传头像')
+			upload({
+				filename: ''
+			}).then(data => {
+				console.log("data",data);
+				this.userInfo.avatar = data[0].url;
+			})
+		},
+		confirm() {
+			userEdit({ avatar: this.userInfo.avatar ,nickname: this.userInfo.nickname})
+				.then(e => {
+					this.$api.msg('修改成功');
+					setTimeout(()=> {
+						uni.switchTab({
+							url:'/pages/user/user'
+						});
+					}, 1000);
+					console.log(e);
+				})
+				.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();
+			    	}
+			    }
+			});
+		},
+		cancel(){
+			this.$refs.popup.open();
+		},
+		qx() {
+			this.password = '';
+			this.$refs.popup.close();
+		},
+		pswQd() {
+			if(this.password != this.userInfo.phone){
+				this.$refs.popup.close();
+				this.password = '';
+				this.$api.msg("请输入自己的账户")
+				return
+			}
+			this.$refs.popup.close();
+			this.password = '';
+			this.$api.msg("申请注销成功,请耐心等待审核")
+		}
+	}
+}
+</script>
+
+<style lang="scss">
+	.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;
+		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;
+		}
+	}
+	.add-btn {
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		margin: 58rpx auto 30rpx;
+		width: 560rpx;
+		height: 80rpx;
+		background: linear-gradient(0deg, #2E58FF, #32C6FF);
+		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 #32C6FF;
+		background: #FFFFFF;
+		border-radius: 40px;
+		color: #32C6FF;
+	}
+	.ooo{
+		margin-top: 100rpx;
+	}
+	.psw-wrapper {
+		width: 548rpx;
+		height: 344rpx;
+		background-color: #ffffff;
+		.psw-title {
+			width: 100%;
+			font-size: 35rpx;
+			padding: 43rpx 0 49rpx;
+			text-align: center;
+			font-weight: 800;
+		}
+		.psw-ipt {
+			display: block;
+			background-color: #dce3ed;
+			height: 90rpx;
+			width: 464rpx;
+			padding-left: 30rpx;
+			margin: 0 auto;
+			font-size: 80rpx;
+		}
+		.psw-btn text {
+			display: inline-block;
+			text-align: center;
+			width: 50%;
+			padding-top: 29rpx;
+			font-size: 35rpx;
+		}
+		.psw-qd {
+			color: #32C6FF;
+		}
+	}
+</style>