zhang пре 1 година
родитељ
комит
3b82e07de4
10 измењених фајлова са 274 додато и 16 уклоњено
  1. 1 1
      api/set.js
  2. 2 1
      libs/i18n/lang/cn.json
  3. 2 1
      libs/i18n/lang/en.json
  4. 2 1
      libs/i18n/lang/tw.json
  5. 7 1
      pages.json
  6. 15 10
      pages/index/index.vue
  7. 8 0
      pages/index/user.vue
  8. 235 0
      pages/user/set.vue
  9. BIN
      static/shouye/shezhi.png
  10. 2 1
      uni.scss

+ 1 - 1
api/set.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 // 修改用户信息
 export function userEdit(data) {
 	return request({
-		url: '/api/user/edit',
+		url: '/api/password/reset/trade_password',
 		method: 'post',
 		data
 	});

+ 2 - 1
libs/i18n/lang/cn.json

@@ -67,7 +67,8 @@
 		"b5":"分享链接",
 		"b6":"在线留言",
 		"b7":"交易密码",
-		"b8":"退出登录"
+		"b8":"退出登录",
+		"b9":"设置"
 	},
 	"myple": {
 		"u1": "质押数",

+ 2 - 1
libs/i18n/lang/en.json

@@ -153,7 +153,8 @@
 		"b5":"Share Link",
 		"b6":"Online Message",
 		"b7":"Transaction password",
-		"b8":"Exit"
+		"b8":"Exit",
+		"b9":"Set"
 	},
 	"introduce": {
 		"a1": "Five minute installment",

+ 2 - 1
libs/i18n/lang/tw.json

@@ -67,7 +67,8 @@
 		"b6":"在線留言",
 		"b7":"交易密碼",
 		"b8":"退出登錄",
-		"ck": "存款"
+		"ck": "存款",
+		"b9": "设置"
 	},
 	"myple": {
 		"u1": "質押數",

+ 7 - 1
pages.json

@@ -281,7 +281,13 @@
                 "enablePullDownRefresh": false
             }
             
-        }
+        },
+		{
+			"path": "pages/user/set",
+			"style": {
+				"navigationBarTitleText": "设置"
+			}
+		}
     ],
 	"tabBar": {
 		"color": "#C0C4CC",

+ 15 - 10
pages/index/index.vue

@@ -134,13 +134,19 @@
 			}
 		},
 		onLoad() {
-			// this.prices()
+			this.prices()
 		},
 		
 		methods: {
 			...mapActions({
 				setLang: "setLang",
 			}), 
+			
+			async prices() {
+				const res = await prices();
+				console.log('123', res);
+			},
+			
 			getCurrent() {
 				let pages = getCurrentPages();
 				let curPage = pages[pages.length - 1];
@@ -164,18 +170,20 @@
 				}
 				// 修改当前对象状态为加载中
 				navItem.loadingType = 'loading';
-				// getCertList({
-				// 		page: navItem.page,
-				// 		limit: navItem.limit
-				// 	})
-				prices({
+				getCertList({
 						page: navItem.page,
 						limit: navItem.limit
 					})
+				// prices({
+				// 		page: navItem.page,
+				// 		limit: navItem.limit
+				// 	})
 					.then(({
 						data
 					}) => {
 						console.log(data, '111');
+						
+						
 						// TODO
 						let list = data.list.data;
 						navItem.orderList = navItem.orderList.concat(list);
@@ -210,10 +218,7 @@
 						console.log(e);
 					});
 			},
-			// async prices() {
-			// 	const res = await prices();
-			// 	console.log('123', res);
-			// },
+			
 		},
 	}
 </script>

+ 8 - 0
pages/index/user.vue

@@ -109,6 +109,14 @@
 				</view>
 				<image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
 			</view>
+			<!-- todo -->
+			<view class="user-list flex" @click="navTo('/pages/user/set')">
+				<image src="../../static/shouye/shezhi.png" mode="scaleToFill" class="left-img"></image>
+				<view class="item-name">
+					{{$t('user.b9')}}
+				</view>
+				<image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
+			</view>
 		</view>
 		<taber tab='user'></taber>
 	</view>

+ 235 - 0
pages/user/set.vue

@@ -0,0 +1,235 @@
+<template>
+	<view class="content">
+		<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="button" v-model="name" placeholder-class="placeholder" />
+		</view>
+		<view class="row">
+			<text class="tit">修改密码</text>
+			<input class="input" type="text" v-model="password" placeholder-class="placeholder" />
+		</view>
+		<view class="row">
+			<text class="tit">请输入手机号</text>
+			<input class="input" type="text" v-model="account" placeholder-class="placeholder" />
+		</view>
+		<view class="row">
+			<text class="tit">验证码</text>
+			<input class="input" type="text" v-model="captcha" placeholder-class="placeholder" />
+			<view class="code" @click="verification">{{ countDown == 0 ? $t('password.a7') : countDown }}</view>
+		</view>
+		<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>
+	</view>
+</template>
+
+<script>
+import { mapState,mapMutations } from 'vuex';
+import { userEdit,logout } from '@/api/set.js';
+import { upload } from '@/api/order.js'
+export default {
+	data() {
+		return {
+			name: '', // 昵称
+			password:'', //修改密码
+			captcha:'', //验证码
+			account:'', //请输入手机号
+			phone:'',
+			avatar: '',
+		};
+	},
+	computed: {
+		...mapState('user',['userInfo']),
+		startDate() {
+			console.log('start');
+		},
+		endDate() {
+			console.log('end');
+		}
+	},
+	onShow(option) {
+		console.log('111',this.userInfo);
+		this.name = this.userInfo.nickname + '';
+		this.password = '',
+		this.captcha = '',
+		this.account = '',
+		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)
+			});
+		},
+		
+		confirm() {
+			userEdit({ 
+			  nickname: this.name,
+			  avatar: this.avatar, 
+			  password: this.password,
+			  captcha: this.captcha,
+			  account: this.account
+			}).then(e => {
+					this.$api.msg('修改成功');
+					// 清空输入框
+					this.password = '',
+					setTimeout(() => {
+						uni.switchTab({
+							url: '/pages/user/user'
+						});
+					}, 1000);
+					console.log(e);
+				})
+				.catch(e => {
+					console.log(e);
+				});
+		},
+		//发送验证码
+		verification() {
+			let obj = this;
+			if (this.account == '') {
+				this.$api.msg('请输入电话号码');
+				return;
+			}
+			if (this.account.length < 11) {
+				this.$api.msg('请输入正确的手机号');
+				return;
+			}
+			// 判断是否在倒计时
+			if (obj.countDown > 0) {
+				return false;
+			} else {
+				obj.countDown = 60;
+				obj.time = setInterval(() => {
+					obj.countDown--;
+				}, 1000);
+				//调用验证码接口
+				verify({
+					account: obj.account,
+					type: 'login'
+				})
+					.then(({ data }) => {})
+					.catch(err => {
+						console.log(err);
+					});
+			}
+		},
+		// loginout() {
+		// 	let obj = this;
+		// 	uni.showModal({
+		// 		content: '确定要退出登录么',
+		// 		success: e => {
+		// 			if (e.confirm) {
+		// 				uni.removeStorageSync('canChange')
+		// 				logout({}).then()
+		// 				uni.navigateBack();
+		// 				obj.logout();
+		// 			}
+		// 		}
+		// 	});
+		// }
+		loginout() {
+			uni.navigateTo({
+				url: '/pages/switch/switch'
+			})
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+.content {
+	background-color: #fff;
+}
+
+.row1 {
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+	position: relative;
+	padding: 0 30upx;
+	height: 110upx;
+	background: #fff;
+	.tit {
+		flex-shrink: 0;
+		width: 120upx;
+		font-size: $font-lg;
+	}
+	.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;
+	background: #fff;
+
+	.tit {
+		flex-shrink: 0;
+		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: $font-base;
+		color: $color-gray;
+	}
+	.iconlocation {
+		font-size: 36upx;
+		color: $font-color-light;
+	}
+}
+.add-btn {
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	width: 560upx;
+	height: 80upx;
+	margin: 60upx auto;
+	font-size: $font-lg;
+	color: #fff;
+	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: #fff;
+}
+</style>

BIN
static/shouye/shezhi.png


+ 2 - 1
uni.scss

@@ -2,9 +2,10 @@
 $page-row-spacing: 30rpx;
 //页面基础颜色
 $page-color-base: #000; //页面背景颜色
+$page-color-base: #fff; //页面背景颜色
 $page-color-light: #f8f6fc;
 // 主题颜色
-$base-color: #902020; //项目颜色
+$base-color: #fd5b23; //项目颜色
 $box-shadow-color: #5dbc7c; //阴影颜色
 $font-color: #5dbc7c; //字体颜色
 $font-color-spec: #5dbc7c; //可操作文字颜色