实验八智能手机互联网程序设计(微信程序方向)实验报告

  • 请在上一次实验的基础之上完成"手机快速注册"页面、"企业用户注册"页面,并实现点击手机快速注册和企业用户注册后转跳至该页面
  • 在"手机快速注册"页面,输入框内输入内容并失去焦点后,下方的按钮会变化
  • 在企业用户注册页面,用户名输入框输入内容并失去焦点后,注册按钮也会发生变化

、实验步骤与结果(给出对应的代码或运行结果截图)

index.js

Page({

data:{

disabled:true,

btnstate:"default",

account:"",

password:""

},

accountInput:function(e){

var content = e.detail.value;

console.log(content);

if(content != ''){

this.setData({disabled:false,btnstate:"primary",account:content});

}else{

this.setData({disabled:true,btnstate:"default"});

}

},

pwdBlur:function(e){

var password = e.detail.value;

if(password != ''){

this.setData({password:password});

}

}

})

index.wxml

<view class="content">

<view class="account">

<view class="title">账号</view>

<view class="num"><input bindinput="accountInput" placeholder="用户名/邮箱/手机号" placeholder-style="color:#999999;"/></view>

</view>

<view class="hr"></view>

<view class="account">

<view class="title">密码</view>

<view class="num"><input bindblur="pwdBlur" placeholder="请输入密码" password placeholder-style="color:#999999;"/></view>

<view class="see">

<image src="/images/see.jpg" style="width:42px;height:30px;"></image>

</view>

</view>

<view class="hr"></view>

<button class="btn" disabled="{{disabled}}" type="{{btnstate}}" bindtap="login">登录</button>

<view class="operate">

<view><navigator url="../logs/logs">手机快速注册</navigator></view>

<view><navigator url="../company/company">企业用户注册</navigator></view>

<view>找回密码</view>

</view>

<view class="login">

<view><image src="/images/wxlogin.png" style="width:70px;height:98px;"></image></view>

<view><image src="/images/qqlogin.png" style="width:70px;height:98px;"></image></view>

</view>

</view>

Index.wxss

.content{

margin-top: 40px;

}

.account{

display: block;

padding-left: 20px;

padding-top: 20px;

padding-bottom: 10px;

width: 90%;

}

.title{

float: left;

margin-right: 30px;

font-weight: bold;

}

.hr{

border: 1px solid #cccccc;

opacity: 0.2;

width: 90%;

margin: 0 auto;

}

.see{

position: absolute;

right: 20px;

}

.btn{

width: 90%;

margin-top:40px;

color: #999999;

}

.operate{

display: block;

}

.operate view{

display: inline-block;

width: 33%; /* Assuming there are three items, each can take one-third of the container width */

text-align: center;

margin-top: 40px;

font-size: 14px;

color: #333333;

}

.login{

display: block;

margin-top: 150px;

text-align: center;

}

.login view{

display: inline-block;

}

logs.js

Page({

/**

* 页面的初始数据

*/

data: {

mobile:"",

disabled:true,

type:"default"

},

mobileblur:function(e){

var content = e.detail.value;

if(content !=""){

this.setData({

disabled:false,type:"primary",mobile:content

});

}else{

this.setData({

disabled:true,type:"default",mobile:null

});

}

console.log("注册成功,电话为:"+this.data.mobile)

}

})

logs.wxml

<view class="content">

<view class="hr"></view>

<view class="numbg">

<view>+86</view>

<view><input bindblur="mobileblur" placeholder="" maxlength="11" /></view>

</view>

<view>

<view class="xieyi">

<icon type="success" color="red" size="18"></icon>

<text class="agree">同意</text>

<text class="opinion">京东用户注册协议</text>

</view>

</view>

<button class="btn" disabled="{{disabled}}" type="{{type}}">下一步</button>

</view>

logs.wxss

.contene{

width: 100%;

height: 600px;

color: #f2f2f2;

}

.hr{

padding: 20px;

}

.numbg{

border: 1px solid #cccccc;

width: 90%;

margin: 0 auto;

background-color: white;

border-radius: 5px;

display: flex;

flex-direction: row;

height: 50px;

}

.numbg view{

margin-left: 20px;

margin-top: 14px;

}

.xieyi{

margin-left: 15px;

margin-top: 15px;

}

.agree{

font-size: 13px;

margin-left: 5px;

color: #666666;

}

.opinion{

font-size: 13px;

color: black;

font-weight: bold;

}

.btn{

width: 90%;

margin-top: 30px;

}

效果图

相关推荐
To_OC1 天前
我被 useState 坑了两次之后,终于把它的脾气摸透了
前端·javascript·react.js
kyriewen1 天前
我review了一份Vibe Coding写的前端代码——能跑,但5个地方迟早要命
前端·javascript·ai编程
Hilaku1 天前
为什么在 2026 年,MPA(多页面应用)正在悄悄复辟?
前端·javascript·程序员
悟空瞎说1 天前
iOS 高效绘图
javascript
触底反弹1 天前
🔥 从 MySQL 到 Milvus:用 AI 日记本项目搞懂向量数据库和 RAG
javascript·人工智能·面试
妙码生花1 天前
从 PHP 到 AI + Golang,程序员自救转型手记(三十九):前端上传组件实现
javascript·vue.js·ai编程
dota李天王1 天前
简单的 socket 实现
前端·javascript·websocket
寒水馨1 天前
Linux下载、安装 Bun v1.3.14(附安装包bun-linux-x64.zip)
linux·javascript·typescript·node.js·bun·运行时·包管理器
windliang1 天前
Claude Code 源码分析(一):从 claude 命令到 Agent 主循环
javascript·面试·ai编程
申君健24864182772021 天前
WebGPU 内部运行原理:Format、Texture 与 GPU 侧到底在干什么
javascript