设计添加页面

一、添加页面

业务代码如下:

<script>
	import menuDraw from '../template/menu_draw.vue';
	export default{
		components:{
			menuDraw
		},
		data(){
			return{
				user:{
					phone:null,
					pwd:'123456',
					nickName:null,
					msg:null//提示的文字
				}
				
			}
		},
		methods:{
			//保存用户
			save(){
				if(this.user.nickName==null&&this.user.phone==null){
					this.user.msg="不能为空";
					this.open();
				}else{
					uni.request({
					    url: 'http://localhost:8070/user/regedit/'+this.user.phone+'/'+this.user.pwd+'/'+this.user.nickName, 
					    success: (res) => {
					         console.log(res.data);
							 
							 if(res.data.code==200){
								 uni.redirectTo({
								 	url: '../user/user_list'
								 });
							 }else{
								 this.user.msg=res.data.msg;
								 this.open();
							 }
					        
					    }
					});
				}
			
			},
			//返回
			doBack(){
				uni.redirectTo({
					url: '../user/user_list'
				});
			},
			//打开弹窗
		open() {
		this.$refs.popup.open()
	   },
	   //关闭弹窗
	   close() {
		this.$refs.popup.close()
	   }
		}
	}
</script>

 页面UI代码如下:

​

<template>
	<view>
	<!--写页面UI-->
	<uni-nav-bar backgroundColor="#d3233b" color="#ffffff" title="睿智法务" leftText="返回" rightText="设置"></uni-nav-bar>
	<view style="width: 350rpx; margin-left: auto; margin-right: auto; margin-top: 80rpx;">
		<uni-forms :modelValue="userData">
			<input v-model="userData.phone" singleline="true" type="number" placeholder="请输入手机号" class="input_str"/>
			<input v-model="userData.pwd" singleline="true" type="password" placeholder="请输入密码" class="input_str"/>
		</uni-forms>
		<button @click="doLogin" type="primary" size="mini" style="margin-right:20rpx;">登录</button>
		
		<uni-popup ref="popup" type="dialog">
		<uni-popup-dialog mode="base" title="通知" content="手机号或密码错误" :duration="2000" :before-close="true" @close="close" @confirm="close">			
		</uni-popup-dialog>
		</uni-popup>
	</view>
</view>
</template>

[点击并拖拽以移动]
​

CSS样式代码如下:

<style>
	.input_str{
		border:1px solid #000000; 
		  border-radius: 5rpx; 
		  height: 30px; 
		  line-height: 30rpx;
		  padding: 10rpx; 
		  margin-bottom: 15rpx;
		  border-radius: 15rpx;
	}
</style>

添加页面要注意的是用v-model和你的数据双向绑定起来

url:'user_update?id='+id   跨页面传值

二、展示页面

 

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值