Browse Source

完善

master
nelson 3 years ago
parent
commit
907eb84d61
  1. 22
      static/css/common.css
  2. 2
      views/T.header.tpl
  3. 123
      views/iframe/user.html
  4. 1
      views/login.html
  5. 77
      views/regist.html

22
static/css/common.css

@ -232,27 +232,21 @@ a{
}
.comms-root{
width: 68%;
margin: 0 auto;
.comms-right-root{
position: fixed;
right: 0px;
top: 10%;
}
.comms-root a{
text-decoration: none;
.comms-left-root{
position: fixed;
left: 0px;
top: 10%;
}
img {
max-width: 100% !important;
}
.blog-referral{
width: 100%;
margin: 40px auto;
}
.blog-referral p{
padding: 3px 0;
}
.layui-code-view .layui-code-ol li{
margin-left: 0px !important;
}

2
views/T.header.tpl

@ -18,4 +18,6 @@
<script src="https://cdn.bootcdn.net/ajax/libs/element-ui/2.15.3/index.min.js"></script>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.4.0/jquery.min.js"></script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5305532197406602" crossorigin="anonymous"></script>
<script type="text/javascript" src="//cpro.baidustatic.com/cpro/ui/cm.js" async="async" defer="defer" ></script>
<script type="text/javascript" src="/static/js/seo.js"></script>
{{end}}

123
views/iframe/user.html

@ -1,123 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="码农随笔,个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
<meta name="keywords"
content="码农随笔,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,www.aiprose.com,aiprose.com,aiprose">
<link rel="stylesheet" href="//oss.aiprose.com/ali/sui/css/sui.min.css">
<script type="text/javascript" src="//oss.aiprose.com/ali/jquery/jquery.min.js"></script>
<script type="text/javascript" src="//oss.aiprose.com/ali/sui/js/sui.min.js"></script>
<title>首页 - 码农随笔</title>
<style>
.common {
margin: 0 0 3px 0;
}
.common label {
width: 42px;
}
.common input {
width: 150px;
height: 26px;
border-radius: 5px;
border: 1px solid #ddd;
}
</style>
</head>
<body>
<div style="margin: 20px 35px;">
<div class="common">
<label>生日:</label>
<input type="text" id="birthday" class="form-control" style="display: inline-block" placeholder="输入日期"
data-toggle="datepicker" value='{{.User.Birthday.Format "2006-01-02"}}'
data-date-start-date='1969-12-12'/>
</div>
<div class="common">
<label>昵称:</label>
<input id="nickName" value="{{.User.NickName}}">
</div>
<div class="common">
<label>邮箱:</label>
<input type="email" id="email" value="{{.User.Email}}">
</div>
<div class="common">
<label>手机:</label>
<input type="number" id="mobile" value="{{.User.Mobile}}">
</div>
<div class="common">
<label>Q Q:</label>
<input type="number" id="qqnum" value="{{.User.QQ}}">
</div>
<div class="common">
<label>性别:</label>
<select class="form-control " style="width: 150px;display: inline-block;height: 26px" id="catory">
<option value="1"></option>
<option value="0"></option>
</select>
</div>
<div class="common">
<label>简介:</label>
<textarea class="form-control" id="mdesc" rows="3"></textarea>
</div>
<div class="common" style="text-align: end;margin-top: 20px">
<button type="button" class="btn btn-xl" id="cancelBtn">取消</button>
<button type="button" class="btn btn-primary btn-xl" id="saveBtn">保存</button>
</div>
</div>
</body>
<script>
$(function () {
$("#mdesc").val("{{.User.DescInfo}}")
if(!{{.IsLogin}}){
parent.location.href = "/login"
}
$("#saveBtn").click(function () {
var obj = {}
obj.birthday = $("#birthday").val()
obj.nickName = $("#nickName").val()
obj.email = $("#email").val()
if (obj.email && obj.email.trim().length != 0) {
reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!reg.test(obj.email)) {
layer.msg('邮箱格式不正确', function () {
});
return
}
}
obj.mobile = $("#mobile").val()
if (obj.mobile && obj.mobile.trim() != "") {
if (obj.mobile.trim().length != 11) {
layer.msg('手机号格式不对', function () {
});
return
}
}
obj.qqnum = $("#qqnum").val()
obj.catory = $("#catory").val()
obj.mdesc = $("#mdesc").val()
$.post('/api/user/edit', obj,
function (data) {
if (data.Status == 0) {
parent.layer.msg("保存成功", {icon: 6});
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
parent.refresh()
} else if (data.Status == 401) {
parent.location.href = "/login"
parent.layer.close(index);
} else {
layer.msg("服务器异常", {icon: 5});
}
}, 'json')
})
$("#cancelBtn").click(function () {
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
})
})
</script>
</html>

1
views/login.html

@ -283,5 +283,4 @@
}
})
</script>
<script type="text/javascript" src="/static/js/seo.js"></script>
</html>

77
views/regist.html

@ -1,77 +0,0 @@
{{template "header" .}}
<meta name="keywords" content="码农随笔,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>注册 - 码农随笔</title>
</head>
<body>
<div class="root-container">
{{template "nav" .}}
<div class="login-root">
<div class="input-container">
<div class="input-root">
<div class="inputs-class regist">
<i-form>
<form-item prop="user">
<i-input type="text" v-model="user.username" placeholder="请输入用户名">
<Icon type="ios-person-outline" slot="prepend"></Icon>
</i-input>
</form-item>
<form-item prop="password">
<i-input type="password" v-model="user.userpwd" placeholder="请输入密码">
<Icon type="ios-lock-outline" slot="prepend"></Icon>
</i-input>
</form-item>
<form-item prop="password">
<i-input type="password" v-model="user.userpwdrepeat" placeholder="请重复密码">
<Icon type="ios-lock-outline" slot="prepend"></Icon>
</i-input>
</form-item>
<i-button type="info" long @click="regist">快速注册</i-button>
</i-form>
<div class="login-bottom">
<a href="/login">快速登录</a>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script>
var app = new Vue({
el: ".root-container",
delimiters: ['${', '}'],
data: {
user: {}
},
methods: {
regist (){
var _this= this
if (this.user.username.trim().length < 4) {
this.$Message.warning('用户名最低4位');
return
}
if (this.user.userpwd.trim().length < 6) {
this.$Message.warning('密码最低6位');
return
}
if (!this.user.userpwdrepeat || (this.user.userpwdrepeat.trim() != this.user.userpwd.trim())) {
this.$Message.warning('两次密码输入不一致');
return
}
$.post('/api/regist', this.user,
function (data) {
if (data.Status == 1) {
_this.$Message.warning(data.Msg);
} else {
_this.$Message.success("注册成功,现在去登陆哦");
setTimeout(function () {
window.location.href = "/login"
}, 800)
}
}, 'json')
}
}
})
</script>
<script type="text/javascript" src="/static/js/seo.js"></script>
</html>
Loading…
Cancel
Save