1.个人中心的搭建
成果图片展示
这个部分设计的难点主要在对页面图片格式以及文字格式样式的设计,熟练掌握css和hml可以让开发的过程更加的顺利,这个其中的下半部分的格式一致在开发过程中可以减少开发的过程和时间
1.我的页面的HMl
<div class="container">
<div class="user-info">
<div class="user-info-avatar">
<image url="" alt="common/icon/nologin.png"></image>
</div>
<div class="user-info-detail">
<text on:click="gotoLogin">
点击登录
</text>
<div>
<text>
更多精彩
</text>
<div class="user-info-entery">
<image src="common/icon/qrcode.png" class="ge-icon"></image>
<image src="common/icon/ge.png" class="ge-icon"></image>
</div>
</div>
</div>
</div>
<div class="split-div">
<div class="div-title">
<div class="div-icon">
<image src="common/icon/plan.png">
</image>
</div>
<div class="div-content">
<text>
学习计划
</text>
<image src="common/icon/ge.png" class="ge-icon"></image>
</div>
</div>
<div class="div-title">
<div class="div-icon">
<image src="common/icon/test.png">
</image>
</div>
<div class="div-content">
<text>
评论记录
</text>
<image src="common/icon/ge.png" class="ge-icon"></image>
</div>
</div>
<div class="div-title">
<div class="div-icon">
<image src="common/icon/record.png">
</image>
</div>
<div class="div-content">
<text>
学习记录
</text>
<image src="common/icon/ge.png" class="ge-icon"></image>
</div>
</div>
<div class="div-title">
<div class="div-icon">
<image src="common/icon/certificate.png">
</image>
</div>
<div class="div-content">
<text>
证书
</text>
<image src="common/icon/ge.png" class="ge-icon"></image>
</div>
</div>
</div>
<div class="split-div">
<div class="div-title">
<div class="div-icon">
<image src="common/icon/policy.png">
</image>
</div>
<div class="div-content">
<text>
机构注册与服务协议
</text>
<image src="common/icon/ge.png" class="ge-icon"></image>
</div>
</div>
<div class="div-title">
<div class="div-icon">
<image src="common/icon/policy.png">
</image>
</div>
<div class="div-content">
<text>
违规信息处置
</text>
<image src="common/icon/ge.png" class="ge-icon"></image>
</div>
</div>
<div class="div-title">
<div class="div-icon">
<image src="common/icon/policy.png">
</image>
</div>
<div class="div-content">
<text>
隐私政策
</text>
<image src="common/icon/ge.png" class="ge-icon"></image>
</div>
</div>
</div>
<div class="split-div">
<div class="div-title">
<div class="div-icon">
<image src="common/icon/question.png">
</image>
</div>
<div class="div-content">
<text>
常见问题
</text>
<image src="common/icon/ge.png" class="ge-icon"></image>
</div>
</div>
</div>
</div>
2.我的页面的css
.container {
flex-direction: column;
align-items: center;
background-color: #EDEDED;
width: 100%;
height: 100%;
}
.user-info{
width: 100%;
height: 140px;
background-color: #FFFFFF;
}.user-info-avatar{
width: 20%;
height: 100%;
justify-content: center;
align-items: center;
}
.user-info-avatar>image{
width: 70px;
height: 70px;
border-radius: 5px;
}
.user-info-detail{
width: 725;
height: 100%;
align-items: flex-start;
flex-direction: column;
justify-content: center;
}
.user-info-detail>text{
font-size: 18px;
font-weight: bold;
}
.user-info-detail>div{
width: 100%;
height: 30px;
align-items: center;
justify-content: space-between;
font-size: 14px;
color: #BDBDBD;
}
.user-info-detail>div>text{
font-size: 14px;
color: #BDBDBD;
}
.user-info-entry{
width: 50px;
align-items: center;
justify-content: space-between;
}
.ge-icon{
width: 13px;
height: 13px;
margin-right: 10px;
}
.split-div{
width: 100%;
margin-top: 5px;
flex-direction: column;
background-color: #FFFFFF;
}
.div-title{
height: 45px;
align-items: center;
}
.div-icon{
width: 10%;
height: 100%;
align-items: center;
justify-content: center;
}
.div-icon>image{
width: 15px;
height: 15px;
}
.div-content{
width: 90%;
height: 100%;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #E7E7E7;
}
.div-content>text{
height: 100%;
font-size: 14px;
color: #5B5B5B;
}
3.我的页面的js内容
import router from '@system.router';
export default {
data: {
title: 'World'
},
gotoLogin(){
router.push({
url:"pages/login/login"
})
}
}
这里的gotologin函数是为后面完成用户登录做一个准备
2.用户登录
项目成果展示
这部分的主要内容就是要设计出用户登录的页面,设计验证的拖拽条以及未完成验证无法进行登录的一个安全保证,同时成功登录后会显示一个加载的过程
1.登录页面的HML
<element src="../loadingDialog/loadingDialog.hml" name="loadingDialog"></element>
<div class="container">
<div style="width: 100%;height: 70px;">
<image src="common/images/isoftstone.png" style="width: 160px;height: 30px;object-fit: contain;margin: 20px 0 0 20px;"></image>
</div>
<div style="width: 100%; flex-direction: column;align-items: center;justify-content: center;margin-top: 100px;">
<text style="width: 100%; height: 70px;text-align: center;color: #CD6090;font-size: 28px;font-weight: bold;padding-bottom: 30px;letter-spacing: 5px;" title="title">
通鸿云课堂
</text>
<form onsubmit="login">
<div style="width: 100%;height: 60px;justify-content: center;">
<input type="text" style="width: 80%;border-radius: 5px;" name="username" placeholder="请输入手机号/邮箱/个人账号"></input>
</div>
<div style="width: 100%;height: 60px;justify-content: center;">
<input type="password" style="width: 80%;border-radius: 5px;" name="password" placeholder="请输入登录密码"></input>
</div>
<div style="width: 100%;height: 60px;justify-content: center;">
<stack style="width: 100%;height: 100%;flex-direction: column;justify-content: center;align-items: center;">
<div style="width: 80%;height: 40px;border-radius: 2px;background-color: #F5F5F5;justify-content: center;align-items: center;">
<text style="font-size: 14px;color: #999999;">
向右滑动验证
</text>
</div>
<div style="width: 80%;height: 40px;border-radius: 2px;justify-content: flex-start;align-items: center;">
<div style="width: {{width}};height: 100%;background-color: aquamarine;justify-content: center;align-items: center;">
<block if="{{checked}}">
<text style="font-size: 16px;color: white;">
验证成功
</text>
</block>
</div>
<div on:dragstart="dragstart" on:drag="drag" on:dragend="dragend" style="width: 40px;height: 40px;color: #999999;border-radius: 2px;justify-content: center;align-items: center;">
<image src="common/icon/ge.png" style="width: 10px;height: 10px;object-fit: contain;"></image>
</div>
</div>
</stack>
</div>
<block if="{{ischecked}}">
<div style="width: 100%;height: 22px;align-items: center;justify-content: center;">
<text style="width: 80%;font-size: 14px;color: crimson;text-align: left;">
请完成验证再进行登录
</text>
</div>
</block>
<div style="width: 100%;height: 30px;justify-content: center;">
<div style="width: 80%;height: 30px;justify-content: space-between;align-items: center;">
<text style="font-size: 14px;color: #63B8FF;">忘记密码</text>
<text style="font-size: 14px;color: #63B8FF;" onclick="gotoRegister">快速注册</text>
</div>
</div>
<div style="width: 100%;height: 60px;justify-content: center;align-items: center;">
<input type="submit" class="btlogin">登 录</input>
</div>
</form>
<loadingdialog id="dialogComp"> </loadingdialog>
</div>
<div style="width: 100%;justify-content: center;align-items: center;flex-direction: column;bottom: 50%;">
<text style="font-size: 12px;color: black;">
2022 @ EDU Online Harmony OS.
</text>
<text style="font-size: 12px;color: black;">
Design By ISS.
</text>
</div>
</div>
2.登录页面的css
.container {
flex-direction: column;
align-items: center;
justify-content: space-between;
width: 100%;
height: 100%;
position: relative;
background-image: url('common/images/login-bg.svg');
}
.btlogin{
width: 80%;
height: 40px;
text-align: center;
font-size: 16px;
border-radius: 5px;
background-color: tomato;
}
3.登录页面的js
export default {
data: {
width: 0,
checked: false,
ischecked: false
},
dragstart(e) {
},
drag(e) {
this.width = e.globalx;
},
dragend(e) {
if (this.width < 295) {
this.width = 0;
}
else {
this.width = 300;
this.checked = true;
this.ischecked = false
}
},
gotoRegister(){
},
login(e){
if(!this.checked){
this.ischecked=true;
return;
}
console.log(e.value.username);
console.log(e.value.password);
let loadingDialog = this.$child("dialogComp").$element("loadingDialog");
loadingDialog.show();
}
}
4.加载页面的HML
<dialog id="loadingDialog" style="margin-bottom: 50%;width: 120px;height: 120px;border-radius: 10px;">
<div style="width: 100%;height: 100%;flex-direction: column;justify-content: center;align-items: center;background-color: grey;">
<progress style="width: 50px;height: 50px;"type="ring" percent="10" secondarypercent="50"></progress>
<text style="color: white;font-size: 14px;">
正在加载
</text>
</div>
</dialog>
5.加载页面的css
.container {
display: flex;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 454px;
height: 454px;
}
.title {
font-size: 30px;
text-align: center;
width: 200px;
height: 100px;
}
6.加载页面的js
export default {
data: {
title: 'World'
}
}