Explorar o código

前端小程序 设置完成 sdy

zhongtianhaoyuan %!s(int64=3) %!d(string=hai) anos
pai
achega
70b6fc851e

+ 1 - 0
pageD/warehousings/ex_warehouse.vue

@@ -385,6 +385,7 @@
 				}
 			},
 			getImgUrl(res) {
+				console.log(res)
 				this.imgUrls.push(res);
 			},
 			onRemove(index) {

+ 21 - 0
pages.json

@@ -259,6 +259,27 @@
 			}
 
 		}, {
+			"path": "pages/user/setUp",
+			"style": {
+				"navigationBarTitleText": "设置",
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+			"path": "pages/user/set_picture",
+			"style": {
+				"navigationBarTitleText": "头像",
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+			"path": "pages/user/set_nickname",
+			"style": {
+				"navigationBarTitleText": "昵称",
+				"enablePullDownRefresh": true
+			}
+		},
+		{
 			"path": "pages/sale/port",
 			"style": {
 				"navigationBarTitleText": "港口价格",

+ 40 - 34
pages/release/release.vue

@@ -123,7 +123,6 @@
 						showCancel: true,
 						confirmText: '确定',
 						success: function(res) {
-
 							if (res.confirm) {
 								that.$api.doRequest('post', '/salePlanInfo/api/editStatus', {
 										id: item.id,
@@ -156,7 +155,6 @@
 			},
 			edit(item) {
 				if (item.type == "买粮") {
-
 					uni.navigateTo({
 						url: `/pageD/myRelease/buyEdit?id=${item.id}`
 					})
@@ -173,23 +171,27 @@
 						content: '确定删除该信息?',
 						showCancel: true,
 						confirmText: '确定',
-						success: (e) => {
-							this.$api.doRequest('post', '/procurementPlanInfo/api/deleteProcurementPlan', {
-									id: item.id
-								}).then(res => {
-									if (res.data.message == "Success") {
-										this.$api.msg('删除成功!')
-										this.getList()
-										return
-									}
-								})
-								.catch(res => {
-									uni.showToast({
-										title: res.errmsg,
-										icon: 'none',
-										duration: 2000
+						success: function(res) {
+							if (res.confirm) {
+								this.$api.doRequest('post', '/procurementPlanInfo/api/deleteProcurementPlan', {
+										id: item.id
+									}).then(res => {
+										if (res.data.message == "Success") {
+											this.$api.msg('删除成功!')
+											this.getList()
+											return
+										}
 									})
-								});
+									.catch(res => {
+										uni.showToast({
+											title: res.errmsg,
+											icon: 'none',
+											duration: 2000
+										})
+									});
+							} else if (res.cancel) {
+								// console.log('用户点击取消');
+							}
 						},
 						fail: () => {},
 						complete: () => {}
@@ -200,23 +202,27 @@
 						content: '确定删除该信息?',
 						showCancel: true,
 						confirmText: '确定',
-						success: (e) => {
-							this.$api.doRequest('post', '/salePlanInfo/api/deleteSalePlanInfo', {
-									id: item.id
-								}).then(res => {
-									if (res.data.message == "Success") {
-										this.$api.msg('删除成功!')
-										this.getList()
-										return
-									}
-								})
-								.catch(res => {
-									uni.showToast({
-										title: res.errmsg,
-										icon: 'none',
-										duration: 2000
+						success: function(res) {
+							if (res.confirm) {
+								this.$api.doRequest('post', '/salePlanInfo/api/deleteSalePlanInfo', {
+										id: item.id
+									}).then(res => {
+										if (res.data.message == "Success") {
+											this.$api.msg('删除成功!')
+											this.getList()
+											return
+										}
 									})
-								});
+									.catch(res => {
+										uni.showToast({
+											title: res.errmsg,
+											icon: 'none',
+											duration: 2000
+										})
+									});
+							} else if (res.cancel) {
+								// console.log('用户点击取消');
+							}
 						},
 						fail: () => {},
 						complete: () => {}

+ 113 - 0
pages/user/setUp.vue

@@ -0,0 +1,113 @@
+<template>
+	<view class="container">
+		<view class=" flex headPortrait justify-between">
+			<view class="title">头像</view>
+			<view class="nextStep flex">
+				<view class="pictures">
+					<image :src="headUrl" class="picture"></image>
+				</view>
+				<image src="../../static/img/myimg/gengduo1@3x.png" class="arrow" @click="switchPicture"></image>
+			</view>
+			
+		</view>
+		<view class="flex headPortrait justify-between">
+			<view class="title">昵称</view>
+			<view class="nextStep flex">
+				<view class="username">
+					{{username}}
+					</view>
+				<image src="../../static/img/myimg/gengduo1@3x.png" class="arrow" @click="nickname"></image>
+			</view>
+	
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapState
+	} from 'vuex';
+	export default {
+		data() {
+			return {
+				headUrl:"../../static/img/myimg/YongHu@3x.png",
+				username:"",
+			}
+		},
+		computed: {
+			...mapState(['hasLogin', 'userInfo'])
+		},
+		onLoad() {
+			if(this.userInfo.avatarUrl != null || this.userInfo.avatarUrl != ""){
+				this.headUrl = this.userInfo.avatarUrl
+			}
+			if(this.userInfo.userName != null || this.userInfo.userName != ""){
+				this.username = this.userInfo.userName
+			}
+		},
+		methods:{
+			switchPicture(){	
+				uni.navigateTo({
+					url: `/pages/user/set_picture`
+				})
+			},
+			nickname(){
+				uni.navigateTo({
+					url: `/pages/user/set_nickname`
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.container {
+		padding: 10px 10px 0px;
+		background-color: #F5F6FA;
+	}
+
+	.headPortrait {
+		width: 100%;
+		height: 52px;
+		margin-top: 15px;
+		background-color: #FFFFFF;
+		border-radius: 6px;
+		// justify-content: flex-end;
+	}
+
+	.title {
+		font-size: 16px;
+		line-height: 50px;
+		font-weight: 600;
+		margin-left: 10px;
+	}
+
+	.pictures {
+		justify-content: flex-end;
+		width: 35px;
+		height: 35px;
+		background-color: #E0FAF6;
+		border-radius: 18px;
+		margin-top: 6px;
+	}
+
+	.picture {
+		width: 35px;
+		height: 35px;
+	}
+	.arrow {
+		margin-left: 15px;
+		width: 8px;
+		height: 12px;
+		top: 18px;
+		// justify-content: flex-end
+
+	}
+	.nextStep{
+		margin-right: 20px;
+	}
+	.username{
+		line-height: 50px;
+		color: #6D6D72;
+	}
+</style>

+ 124 - 0
pages/user/set_nickname.vue

@@ -0,0 +1,124 @@
+<template>
+	<view class="container">
+		<view class="explain">
+			昵称长度限制在2-24个字符内
+		</view>
+		<view class="editText">
+			<input placeholder="请输入昵称" name="input" v-model="nickname" class="texts"></input>
+		</view>
+		<view class="btn" @click="commit">
+			保存
+		</view>
+	</view>
+
+</template>
+
+<script>
+	import {
+		mapState
+	} from 'vuex';
+	export default {
+		data() {
+			return {
+				nickname: "",
+				deptListurl: {},
+			}
+		},
+		computed: {
+			...mapState(['hasLogin', 'userInfo'])
+		},
+		methods: {
+			
+			commit() {
+				if (this.nickname == null || this.nickname == "") {
+					this.$api.msg('请输入昵称!')
+					return
+				}
+				if (this.nickname.length < 2 || this.nickname.length > 24) {
+					this.$api.msg('请正确输入昵称!')
+					return
+				}
+				var that = this
+				uni.showModal({
+					content: "您确定要更改昵称?",
+					showCancel: true,
+					confirmText: '确定',
+					success: function(res) {
+						if (res.confirm) {
+							that.deptListurl.userName = that.nickname
+							that.$api.doRequest('post', '/commonUser/editUserInfo', that.deptListurl).then(res => {
+								if (res.data.code == 200) {
+								
+								var _student = wx.getStorageSync('userInfo');
+								_student.userName = that.nickname;
+								wx.setStorageSync('userInfo', _student);
+								
+									uni.navigateTo({
+										url: `/pages/user/setUp`
+									})
+									}
+								})
+								.catch(res => {
+									uni.showToast({
+										title: res.errmsg,
+										icon: 'none',
+										duration: 2000
+									})
+								});
+							
+						} else if (res.cancel) {
+							// console.log('用户点击取消');
+						}
+					},
+				})
+				
+				
+				
+			},
+		}
+	}
+</script>
+
+<style>
+	.container {
+		padding: 10px 0px;
+		background-color: #F5F6FA;
+	}
+
+	.explain {
+		margin-left: 16px;
+		font-size: 16px;
+		color: #6D6D72;
+		margin-top: 20px;
+	}
+
+	.editText {
+		width: 100%;
+		height: 50px;
+		background-color: #FFFFFF;
+		line-height: 50px;
+		padding-left: 20px;
+		margin-top: 10px;
+		padding-top: 12px;
+	}
+
+	.texts {
+		line-height: 50px;
+		color: #C6C6C8;
+		font-size: 16px;
+		/* placeholder-style="font-size:18px" */
+	}
+
+	.btn {
+		width: 100%;
+		height: 50px;
+		background-color: #FFFFFF;
+		text-align: center;
+		color: #22C572;
+		font-size: 20px;
+		margin-top: 16px;
+		border-radius: 20px;
+		line-height: 50px;
+		font-weight: 500;
+	}
+</style>

+ 211 - 0
pages/user/set_picture.vue

@@ -0,0 +1,211 @@
+<template>
+	<view class="container">
+		<view class="headPortrait flex">
+			<view class="pictures">
+				<image src="../../static/img/myimg/YongHu@3x.png" v-bind:class="pictures" @click="oKSelected(1)">
+				</image>
+				<view style="margin: 0 auto;text-align: center;margin-top: -15px;" v-if="pictures == 'picture1'">
+					<image src="../../static/img/login/select@3x.png" class="duihao"></image>
+				</view>
+
+				<view class="title">默认</view>
+			</view>
+			<view class="pictures">
+				<image src="../../static/img/myimg/SiJi@3x.png" v-bind:class="picturesTwo" @click="oKSelected(2)">
+				</image>
+				<view style="margin: 0 auto;text-align: center;margin-top: -15px;" v-if="picturesTwo == 'picture1'">
+					<image src="../../static/img/login/select@3x.png" class="duihao"></image>
+				</view>
+				<view class="title">司机</view>
+			</view>
+			<view class="pictures">
+				<image src="../../static/img/myimg/LiangShang@3x.png" v-bind:class="picturesThree"
+					@click="oKSelected(3)"></image>
+				<view style="margin: 0 auto;text-align: center;margin-top: -15px;" v-if="picturesThree == 'picture1'">
+					<image src="../../static/img/login/select@3x.png" class="duihao"></image>
+				</view>
+				<view class="title">粮商</view>
+			</view>
+			<view class="pictures">
+				<image src="../../static/img/myimg/LiangNong@3x.png" v-bind:class="picturesFour" @click="oKSelected(4)">
+				</image>
+				<view style="margin: 0 auto;text-align: center;margin-top: -15px;" v-if="picturesFour == 'picture1'">
+					<image src="../../static/img/login/select@3x.png" class="duihao"></image>
+				</view>
+				<view class="title">粮农</view>
+			</view>
+		</view>
+		<view class="btn" @click="commit">
+			保存
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapState
+	} from 'vuex';
+	export default {
+		data() {
+			return {
+				pictures: "picture",
+				picturesTwo: "picture",
+				picturesThree: "picture",
+				picturesFour: "picture",
+				identityUrl: "",
+				deptListurl: {},
+
+			}
+		},
+		computed: {
+			...mapState(['hasLogin', 'userInfo'])
+		},
+		methods: {
+			oKSelected(number) {
+				if (number == 1) {
+					if (this.pictures == "picture") {
+						this.pictures = "picture1"
+						this.picturesTwo = "picture"
+						this.picturesThree = "picture"
+						this.picturesFour = "picture"
+						this.identityUrl = "https://taohaoliang.oss-cn-beijing.aliyuncs.com/appData/162874144867649.png"
+					} else {
+						this.pictures = "picture"
+					}
+				} else if (number == 2) {
+					if (this.picturesTwo == "picture") {
+						this.picturesTwo = "picture1"
+						this.pictures = "picture"
+						this.picturesThree = "picture"
+						this.picturesFour = "picture"
+						this.identityUrl = "https://taohaoliang.oss-cn-beijing.aliyuncs.com/appData/162874149682940.png "
+					} else {
+						this.picturesTwo = "picture"
+						this.identityUrl = ""
+					}
+				} else if (number == 3) {
+					if (this.picturesThree == "picture") {
+						this.picturesThree = "picture1"
+						this.pictures = "picture"
+						this.picturesTwo = "picture"
+						this.picturesFour = "picture"
+						this.identityUrl = "https://taohaoliang.oss-cn-beijing.aliyuncs.com/appData/1628741540162138.png"
+					} else {
+						this.picturesThree = "picture"
+						this.identityUrl = ""
+					}
+				} else if (number == 4) {
+					if (this.picturesFour == "picture") {
+						this.picturesFour = "picture1"
+						this.pictures = "picture"
+						this.picturesTwo = "picture"
+						this.picturesThree = "picture"
+						this.identityUrl = "https://taohaoliang.oss-cn-beijing.aliyuncs.com/appData/162874156836497.png"
+					} else {
+						this.picturesFour = "picture"
+						this.identityUrl = ""
+					}
+				}
+			},
+			commit() {
+				if (this.identityUrl == null || this.identityUrl == "") {
+					this.$api.msg('请选择一张图片!')
+					return
+				}
+				var that = this
+				uni.showModal({
+					content: "您确定要更改图像?",
+					showCancel: true,
+					confirmText: '确定',
+					success: function(res) {
+						if (res.confirm) {
+							that.deptListurl.avatarUrl = that.identityUrl
+							that.$api.doRequest('post', '/commonUser/editUserInfo', that.deptListurl).then(
+									res => {
+										if (res.data.code == 200) {
+											that.userInfo.avatarUrl = that.identityUrl
+											var _student = wx.getStorageSync('userInfo');
+											_student.avatarUrl = that.identityUrl;
+											wx.setStorageSync('userInfo', _student);
+											uni.navigateTo({
+												url: `/pages/user/setUp`
+											})
+										}
+
+									})
+								.catch(res => {
+									uni.showToast({
+										title: res.errmsg,
+										icon: 'none',
+										duration: 2000
+									})
+								});
+						} else if (res.cancel) {
+							// console.log('用户点击取消');
+						}
+					},
+				})
+			},
+		}
+	}
+</script>
+
+<style>
+	.container {
+		padding: 10px 10px 0px;
+		background-color: #F5F6FA;
+	}
+
+	.headPortrait {
+		width: 100%;
+		background-color: #FFFFFF;
+		border-radius: 20px;
+	}
+
+	.picture {
+		width: 70px;
+		height: 70px;
+		margin: 0 auto;
+		margin-top: 10px;
+	}
+
+	.picture1 {
+		width: 70px;
+		height: 70px;
+		margin: 0 auto;
+		border-radius: 35px;
+		margin-top: 10px;
+		border: 2px solid #22C572;
+	}
+
+	.title {
+		text-align: center;
+		margin: 16px 0;
+		font-size: 14px;
+		font-weight: 500;
+	}
+
+	.pictures {
+		margin-left: 15px;
+	}
+
+	.duihao {
+		width: 18px;
+		height: 18px;
+		text-align: center;
+		margin: 0 auto;
+	}
+
+	.btn {
+		width: 100%;
+		height: 50px;
+		background-color: #FFFFFF;
+		text-align: center;
+		color: #22C572;
+		font-size: 20px;
+		margin-top: 16px;
+		border-radius: 20px;
+		line-height: 50px;
+		font-weight: 500;
+	}
+</style>

+ 63 - 22
pages/user/user.vue

@@ -16,10 +16,10 @@
 			</view>
 		</view> -->
 		<view class="indexUp flex">
-			<image src="../../static/img/myimg/YongHu@3x.png" class="headPortrait"></image>
+			<image v-bind:src="headUrl" class="headPortrait"></image>
 			<view class="personal">
-				<view class="information">用户名:</view>
-				<view class="information">手机号:</view>
+				<view class="information">{{username}}</view>
+				<view class="information">{{userphone}}</view>
 			</view>
 
 		</view>
@@ -30,7 +30,8 @@
 				<view class="cu-item" v-for="(item, index) in gridList" v-if="item.show" :key="index"
 					@click="gridClick(item, index)" hover-class="common-hover" :hover-stay-time="50">
 					<view>
-						<text :class="item.icon" class="grid_icon icon text-grey"></text>
+					<!-- 	<text :class="item.icon" class="grid_icon icon text-grey"></text> -->
+						<image :src="item.src" class="sign"></image>
 						<text class="text-grey">{{item.name}}</text>
 					</view>
 					<view>
@@ -38,6 +39,7 @@
 						<text v-if='item.num==2&&contractTip' class='badge_user'>{{contractTip}}</text>
 						<text class='tip_text cuIcon-right'></text>
 					</view>
+					<!-- <image src="../../static/img/sign/authentication@3x.png" mode=""></image> -->
 				</view>
 
 				<!-- <view class='cu-item' @click='scanCode'>
@@ -95,6 +97,9 @@
 				userInfoTmp: [],
 				inputStatus: 'none',
 				carInfo: [],
+				headUrl:"../../static/img/myimg/YongHu@3x.png",
+				userphone:"",
+				username:"请更改昵称",
 				gridList: [
 					// {
 					// 	num:0,
@@ -157,7 +162,8 @@
 					{
 						num: 0,
 						name: '身份认证',
-						icon: 'cuIcon-apps',
+						// icon: 'cuIcon-apps',
+						src:'../../static/img/sign/authentication@2x.png',
 						tips: 0,
 						url: '/pages/attestation/index',
 						show: true
@@ -165,7 +171,8 @@
 					{
 						num: 1,
 						name: '我的合同',
-						icon: 'cuIcon-calendar',
+						// icon: 'cuIcon-calendar',
+						src:'../../static/img/sign/myContract@2x.png',
 						tips: 0,
 						url: '/pageB/contract/contract',
 						show: true
@@ -173,7 +180,8 @@
 					{
 						num: 2,
 						name: '我的任务',
-						icon: 'cuIcon-copy',
+						// icon: 'cuIcon-copy',
+						src:'../../static/img/sign/myTask@2x.png',
 						tips: 0,
 						url: '/pages/task/my_task',
 						show: true
@@ -181,7 +189,8 @@
 					{
 						num: 3,
 						name: '我的发布',
-						icon: 'cuIcon-news',
+						// icon: 'cuIcon-news',
+						src:'../../static/img/sign/myRelease@2x.png',
 						tips: 0,
 						url: `/pages/release/release`,
 						show: true
@@ -189,33 +198,54 @@
 					{
 						num: 4,
 						name: '货运收发',
-						icon: 'cuIcon-copy',
+						// icon: 'cuIcon-copy',
+						src:'../../static/img/sign/receiveGoods@2x.png',
 						tips: 0,
 						url: `/pages/user/task`,
 						show: true
 					},
-					
-					// {
-					// 	num:5,
-					// 	name: '退出登录',
-					// 	icon:'cuIcon-exit',
-					// 	tips: 0,
-					// 	url:'',
-					// 	show:true
-					// },
+					{
+						num: 5,
+						name: '设置',
+						// icon: 'cuIcon-edit',
+						src:'../../static/img/sign/shezhi@2x.png',
+						tips: 0,
+						url: `/pages/user/setUp`,
+						show: true
+					},	
+					{
+						num:6,
+						name: '退出登录',
+						// icon:'cuIcon-exit',
+						src:'../../static/img/sign/return@3x.png',
+						tips: 0,
+						url:'',
+						show:true
+					},
 				],
 				showTran: true,
 				companyId: 1,
 				current: 4
 			}
 		},
-
 		onShow() {
 			console.log(uni.getStorageSync('userInfo'))
 			uni.showTabBar()
 			this.loadData()
 		},
-		onLoad() {},
+		onLoad() {
+			if(this.userInfo.avatarUrl == "" || this.userInfo.avatarUrl == null){
+					this.headUrl = "../../static/img/myimg/YongHu@3x.png"
+			}else if(this.userInfo.avatarUrl != "" || this.userInfo.avatarUrl != null){
+				this.headUrl = this.userInfo.avatarUrl
+			}
+			if(this.userInfo.userName != null || this.userInfo.userName != ""){
+				this.username = this.userInfo.userName
+			}
+			if(this.userInfo.phone != null || this.userInfo.phone != ""){
+				this.userphone = this.userInfo.phone
+			}
+		},
 		// #ifndef MP
 		onNavigationBarButtonTap(e) {
 			const index = e.index;
@@ -386,6 +416,11 @@
 							uni.clearStorageSync();
 							that.$store.commit('logout')
 							that.$api.logout()
+							// uni.navigateTo({
+							// 	url: `/pages/public/login`
+							// })
+							console.log(that.$api)
+							console.log("成功没?")
 						}
 					}
 				})
@@ -659,7 +694,7 @@
 		
 	   background-color: #F5F6FA;
 	/* 	border-radius: 20px; */
-		margin-top: 50px;
+		margin-top: 60px;
 
 		.arc {
 			position: absolute;
@@ -811,10 +846,16 @@
 	.information {
 		font-size: 15px;
 		font-weight: 600;
-		height: 20px;
+		height: 36px;
 	}
 	.indexlow{
 		/* margin-top: 30px; */
 		border-radius: 20px;
 	}
+	.sign{
+		width: 18px;
+		height: 18px;
+		top: 4px;
+		margin-right: 6px;
+	}
 </style>

+ 0 - 0
static/img/myimg/LiangNong@2x (1).png → static/img/myimg/LiangNong@2x.png


+ 0 - 0
static/img/myimg/LiangNong@3x (2).png → static/img/myimg/LiangNong@3x.png


BIN=BIN
static/img/myimg/gengduo1.png


BIN=BIN
static/img/myimg/gengduo1@2x.png


BIN=BIN
static/img/myimg/gengduo1@3x.png


BIN=BIN
static/img/sign/authentication.png


BIN=BIN
static/img/sign/authentication@2x.png


BIN=BIN
static/img/sign/authentication@3x.png


BIN=BIN
static/img/sign/myContract.png


BIN=BIN
static/img/sign/myContract@2x.png


BIN=BIN
static/img/sign/myContract@3x.png


BIN=BIN
static/img/sign/myRelease.png


BIN=BIN
static/img/sign/myRelease@2x.png


BIN=BIN
static/img/sign/myRelease@3x.png


BIN=BIN
static/img/sign/myTask.png


BIN=BIN
static/img/sign/myTask@2x.png


BIN=BIN
static/img/sign/myTask@3x.png


BIN=BIN
static/img/sign/receiveGoods.png


BIN=BIN
static/img/sign/receiveGoods@2x.png


BIN=BIN
static/img/sign/receiveGoods@3x.png


BIN=BIN
static/img/sign/return.png


BIN=BIN
static/img/sign/return@2x.png


BIN=BIN
static/img/sign/return@3x.png


BIN=BIN
static/img/sign/shezhi.png


BIN=BIN
static/img/sign/shezhi@2x.png


BIN=BIN
static/img/sign/shezhi@3x.png