Browse Source

iviewelementui ,登录界面修改

master
nelson 3 years ago
parent
commit
b6642ce1b8
  1. 13
      conf/app.conf
  2. 28
      controllers/UserController.go
  3. 3
      go.mod
  4. 2
      routers/UserRouter.go
  5. 76
      static/css/common.css
  6. 2
      static/css/common.min.css
  7. BIN
      static/img/alipay.png
  8. BIN
      static/img/login.png
  9. 3
      utils/EsUtil.go
  10. 49
      utils/redis.go
  11. 66
      utils/redisStore.go
  12. 2
      views/T.footer.tpl
  13. 10
      views/T.header.tpl
  14. 2
      views/T.me.tpl
  15. 11
      views/T.nav.tpl
  16. 299
      views/login.html
  17. 65
      views/newblog.html
  18. 64
      views/us.html

13
conf/app.conf

@ -1,6 +1,6 @@
appname = beeblog
runmode = "prod"
runmode = "dev"
sessionon = true
sessiongcmaxlifetime = 36000
@ -13,10 +13,17 @@ host = aiprose.com
httpport = 8082
uploadDir = "static/upload/"
imgUrlPrefix = "http://localhost:8082/static/upload/"
dburl = "yasaka@tcp(localhost:3306)"
dburl = "Yasaka.00@tcp(192.168.0.105:3308)"
eshost = http://192.168.0.105:9200/
redisHost = 192.168.0.105
redisPort = 6379
[prod]
httpport = 8082
uploadDir = "/root/oss/aiprose/"
imgUrlPrefix = "https://oss.aiprose.com/aiprose/"
dburl = "Yasaka.00@tcp(localhost:3308)"
dburl = "Yasaka.00@tcp(localhost:3308)"
eshost = http://127.0.0.1:9200/
redisHost = 127.0.0.1
redisPort = 9379
redisPwd = aiprose

28
controllers/UserController.go

@ -3,9 +3,12 @@ package controllers
import (
"beeblog/models"
"beeblog/service"
"beeblog/utils"
"crypto/md5"
"encoding/hex"
"fmt"
beego "github.com/beego/beego/v2/server/web"
"github.com/mojocn/base64Captcha"
"strconv"
"strings"
"time"
@ -318,3 +321,28 @@ func (this *UserController) Logout() {
this.Redirect("/", 302)
return
}
var store = utils.RedisStore{}
func (u *UserController) Captcha() {
type CaptchaResult struct {
Id string `json:"captchaId"`
Base64Blob string `json:"img"`
}
driver := base64Captcha.NewDriverMath(40, 150, 0, 0, nil, nil, nil)
//driver := base64Captcha.DefaultDriverDigit
c := base64Captcha.NewCaptcha(driver, store)
id, b64s, err := c.Generate()
if err != nil {
fmt.Println(err)
u.Data["json"] = models.ReurnError(500, "验证码获取异常")
u.ServeJSON()
return
}
detail := make(map[string]string, 2)
detail["captchaId"] = id
detail["img"] = b64s
u.Data["json"] = models.ReurnData("ok", detail)
u.ServeJSON()
return
}

3
go.mod

@ -3,10 +3,13 @@ module beeblog
require (
github.com/beego/beego/v2 v2.0.1
github.com/fortytw2/leaktest v1.3.0 // indirect
github.com/go-redis/redis v6.15.9+incompatible
github.com/go-sql-driver/mysql v1.5.0
github.com/lib/pq v1.7.0 // indirect
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e // indirect
github.com/mojocn/base64Captcha v1.3.5
github.com/olivere/elastic v6.2.22+incompatible
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
)

2
routers/UserRouter.go

@ -11,6 +11,8 @@ func init() {
beego.Router("/regist", &controllers.UserController{}, "get:RegistPage")
beego.Router("/u/:id([0-9]+)", &controllers.UserController{}, "get:UserInfo")
beego.Router("/api/authc/captcha", &controllers.UserController{}, "get:Captcha")
beego.Router("/api/user/edit", &controllers.UserController{}, "post:Edit")
beego.Router("/api/login", &controllers.UserController{}, "post:Login")
beego.Router("/api/regist", &controllers.UserController{}, "post:Regist")

76
static/css/common.css

@ -342,7 +342,6 @@ img {
}
.login-root {
background: #f0e7db url("/static/img/login.png") no-repeat;
position: absolute;
min-height: 100%;
width: 100%;
@ -403,81 +402,6 @@ img {
border-right: none;
}
.login-footer{
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 110px;
}
.login-root {
background: #f0e7db url("/static/img/login.png") no-repeat;
position: absolute;
min-height: 100%;
width: 100%;
overflow: hidden;
}
.login-root .input-container{
position: fixed;
left: 65%;
top: 33px;
background: url("/static/img/loginbg.png") no-repeat center top;
}
.login-root .input-container .input-root{
width: 370px;
height: 500px;
}
.login-root .input-container .input-root p {
font-size: 21px;
text-align: center;
padding-top: 195px;
}
.login-root .input-container .input-root .inputs-class{
padding: 0 50px;
}
.login-root .input-container .input-root .input-group{
display: table;
border-collapse: separate;
}
.login-root .input-container .input-root .inputs-class .input-class{
height: 32px;
margin: 18px 0;
display: flex;
}
.login-root .input-container .input-root .inputs-class .input-class input{
flex: 1;
height: 26px !important;
padding: 2px 14px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
display: table-cell;
border: 1px solid #ccc;
}
.login-root .input-container .input-root .inputs-class .input-class .input-group-addon{
color: #555;
line-height: 26px !important;
font-size: 12px;
padding: 2px 14px;
line-height: 1.5;
border-radius: 3px;
display: table-cell;
border: 1px solid #ccc;
border-right: none;
}
.login-footer{
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 110px;
}
.me-menu {
position: fixed;
top: 60px;

2
static/css/common.min.css

File diff suppressed because one or more lines are too long

BIN
static/img/alipay.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

BIN
static/img/login.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 KiB

3
utils/EsUtil.go

@ -4,6 +4,7 @@ import (
"beeblog/models"
"context"
"fmt"
beego "github.com/beego/beego/v2/server/web"
"github.com/olivere/elastic"
"log"
"os"
@ -13,7 +14,6 @@ import (
)
var client *elastic.Client
var host = "http://127.0.0.1:9200/"
const mapping = `
{
@ -49,6 +49,7 @@ const mapping = `
}`
func init() {
host, _ := beego.AppConfig.String("eshost")
var err error
client, err = elastic.NewClient(
elastic.SetURL(host),

49
utils/redis.go

@ -0,0 +1,49 @@
package utils
import (
"fmt"
"github.com/beego/beego/v2/server/web"
"github.com/go-redis/redis"
)
const (
REDIS_NETWORK = "tcp"
REDIS_DB = 7
)
type RedisClient struct {
}
func (r RedisClient) GetClient() *redis.Client {
REDIS_HOST, _ := web.AppConfig.String("redisHost")
REDIS_PORT, _ := web.AppConfig.String("redisPort")
REDIS_PASSWORD, _ := web.AppConfig.String("redisPwd")
options := redis.Options{
Network: REDIS_NETWORK,
Addr: fmt.Sprintf("%s:%s", REDIS_HOST, REDIS_PORT),
Dialer: nil,
OnConnect: nil,
Password: REDIS_PASSWORD,
DB: REDIS_DB,
MaxRetries: 0,
MinRetryBackoff: 0,
MaxRetryBackoff: 0,
DialTimeout: 0,
ReadTimeout: 0,
WriteTimeout: 0,
PoolSize: 0,
MinIdleConns: 0,
MaxConnAge: 0,
PoolTimeout: 0,
IdleTimeout: 0,
IdleCheckFrequency: 0,
TLSConfig: nil,
}
// 新建一个client
clientRedis := redis.NewClient(&options)
return clientRedis
}
func (r RedisClient) CloseClient(client *redis.Client) {
defer client.Close()
}

66
utils/redisStore.go

@ -0,0 +1,66 @@
package utils
import (
"fmt"
"github.com/mojocn/base64Captcha"
"time"
)
const CAPTCHA = "captcha:"
type RedisStore struct {
base64Captcha.Store
}
var redisObj = new(RedisClient)
//set a capt
func (r RedisStore) Set(id string, value string) error {
key := CAPTCHA + id
client := redisObj.GetClient()
_, err := client.Set(key, value, time.Minute*2).Result()
if err != nil {
return err
}
redisObj.CloseClient(client)
return nil
}
//get a capt
func (r RedisStore) Get(id string, clear bool) string {
key := CAPTCHA + id
client := redisObj.GetClient()
val, err := client.Get(key).Result()
if err != nil {
fmt.Println(err)
return ""
}
if clear {
client.Del(key)
}
redisObj.CloseClient(client)
return val
}
//verify a capt
func (r RedisStore) Verify(id, answer string, clear bool) bool {
v := RedisStore{}.Get(id, clear)
fmt.Println("key:" + id + ";value:" + v + ";answer:" + answer)
return v == answer
}
//get a capt
func (r RedisStore) Has(id string) int {
key := CAPTCHA + id
client := redisObj.GetClient()
val, err := client.Get(key).Result()
redisObj.CloseClient(client)
if err != nil {
fmt.Println(err)
return 0
}
if val == "" {
return 0
}
return 1
}

2
views/T.footer.tpl

@ -12,7 +12,7 @@
<span>© 2018 - © 2020
<a href="https://www.aiprose.com/">码农随笔</a> </span>
<span>版权所有&nbsp;&nbsp;&nbsp; ICP证:</span>
<a href="http://www.beian.miit.gov.cn" target="_blank">陕ICP备18016846号</a>
<a href="http://www.beian.miit.gov.cn" target="_blank">陕ICP备18016846号-1</a>
</div>
<div class="footer-friend">
<span>前端QQ群: 128806068</span>

10
views/T.header.tpl

@ -8,14 +8,14 @@
{{else}}
<meta name="description" content="码农随笔,个人随笔是一个面向IT技术人员,提供个人平时工作总结和在线记录学习笔记,个人技术博客,在线云笔记,码农笔录,最新的技术博客,www.aiprose.com">
{{end}}
<link type="text/css" rel="styleSheet" href="/static/css/common.min.css"/>
<link type="text/css" rel="styleSheet" href="/static/css/common.css"/>
<script type="text/javascript" src="/static/js/vue.min.js"></script>
<link rel="stylesheet" href="/static/css/iview.css">
<script src="/static/js/iview.min.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.4.0/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/layer.js"></script>
<link rel="stylesheet" href="/static/layui/css/layui.css">
<script type="text/javascript" src="/static/js/checkm.js"></script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5305532197406602" crossorigin="anonymous"></script>
{{end}}

2
views/T.me.tpl

@ -27,8 +27,6 @@
</div>
<hr style="height:1px;border:none;border-top:1px solid #EEE;margin: 6px;"/>
<p {{if .IsMeBlog}}class="active"{{end}}><span></span><a href="/me/blog">我的博客</a></p>
<p {{if .IsMeNote}}class="active"{{end}}><span></span><a href="/me/note">笔记文件夹</a></p>
<p {{if .IsMeLike}}class="active"{{end}}><span></span><a href="/me/like">我的收藏</a></p>
<p {{if .IsMeInfo}}class="active"{{end}}><span></span><a href="/me/info">我的资料</a></p>
</div>
{{end}}

11
views/T.nav.tpl

@ -16,13 +16,7 @@
<a href="/blogs">博客 </a>
</li>
<li class="layui-nav-item">
<a href="/note" target="_blank">笔记</a>
</li>
<li class="layui-nav-item">
<a href="https://note.aiprose.com" target="_blank">新版笔记</a>
</li>
<li class="layui-nav-item">
<a href="/us">福利</a>
<a href="https://note.aiprose.com" target="_blank">免费笔记</a>
</li>
<li class="layui-nav-item">
<a href="/me/info">个人中心</span></a>
@ -40,9 +34,6 @@
<li class="layui-nav-item">
<a href="/login">登录 <span class="layui-badge-dot"></span></a>
</li>
<li class="layui-nav-item">
<a href="/regist">注册</a>
</li>
{{end}}
</ul>
</nav>

299
views/login.html

@ -1,67 +1,304 @@
{{template "header" .}}
<meta name="keywords" content="码农随笔,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<script src="https://cdn.bootcdn.net/ajax/libs/three.js/r128/three.min.js"></script>
<title>登录 - 码农随笔</title>
<style>
.login-form {
background: #55555555;
padding: 18px;
border-radius: 8px;
position: fixed;
left: 25%;
top: 20%;
width: 350px;
margin: auto;
}
</style>
</head>
<body>
<div class="root-container">
{{template "nav" .}}
{{template "nav" .}}
<div class="login-root">
<div class="input-container">
<div class="input-root">
<div class="inputs-class">
<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>
<i-button type="info" long @click="login">快速登录</i-button>
</i-form>
<div class="login-bottom">
<a href="/regist">快速注册</a>
<script type="x-shader/x-vertex" id="vertexshader">
attribute float scale;
void main() {
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
gl_PointSize = scale * ( 300.0 / - mvPosition.z );
gl_Position = projectionMatrix * mvPosition;
}
</script>
<script type="x-shader/x-fragment" id="fragmentshader">
uniform vec3 color;
void main() {
if ( length( gl_PointCoord - vec2( 0.5, 0.5 ) ) > 0.475 ) discard;
gl_FragColor = vec4( color, 1.0 );
}
</script>
<div id="threeContainer" class="threeContainer" ref="threeContainer"></div>
<div class="login-form" :style="mstyle">
<el-form :model="loginForm" :rules="rules" ref="loginForm" label-width="0px" class="loginForm">
<el-form-item prop="username">
<el-input v-model="loginForm.username" placeholder="请输入用户名">
<i slot="prefix" class="el-input__icon el-icon-user-solid"></i>
</el-input>
</el-form-item>
<el-form-item prop="userpwd">
<el-input type="password" v-model="loginForm.userpwd" placeholder="请输入密码" show-password>
<i slot="prefix" class="el-input__icon el-icon-user-solid"></i>
</el-input>
</el-form-item>
<el-form-item prop="captcha">
<div style="display: flex">
<el-input v-model="loginForm.captcha" placeholder="请输入验证码">
<i slot="prefix" class="el-input__icon el-icon-user-solid"></i>
</el-input>
<img :src="captcha" width="150px" @click="getCaptcha"/>
</div>
</el-form-item>
<div>
<el-button type="primary" @click="loginHandler" :loading="loading" style="width: 48%">登陆</el-button>
<el-button type="primary" @click="registHandler" :loading="loading" style="width: 48%">注册
</el-button>
</div>
</div>
</el-form>
</div>
</div>
</div>
</body>
<script>
var windowHalfX = 0
var windowHalfY = 0
var camera = null
var renderer = null
var scene = null
var count = 0
var mouseX = 145
var mouseY = -322
var particles = null
var AMOUNTX = 50
var AMOUNTY = 50
var app = new Vue({
el: ".root-container",
delimiters: ['${', '}'],
data: {
user: {}
captcha: '',
loading: false,
loginForm: {
username: '',
userpwd: '',
captchaId: ''
},
rules: {
username: [
{
required: true,
message: '请输入用户名',
trigger: 'blur'
},
{
min: 5,
message: '长度最少5个字符',
trigger: 'blur'
}
],
userpwd: [
{
required: true,
message: '请输入密码',
trigger: 'blur'
},
{
min: 6,
message: '长度最少6个字符',
trigger: 'blur'
}
],
captcha: [
{
required: true,
message: '请输入验证码',
trigger: 'blur'
}
]
},
mstyle: {
left: window.innerWidth / 2 - 175 + 'px'
}
},
created() {
this.getCaptcha()
},
mounted() {
const SEPARATION = 100
windowHalfX = window.innerWidth / 2
windowHalfY = window.innerHeight / 2
const container = this.$refs.threeContainer
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000)
camera.position.z = 1000
scene = new THREE.Scene()
const numParticles = AMOUNTX * AMOUNTY
const positions = new Float32Array(numParticles * 3)
const scales = new Float32Array(numParticles)
let i = 0;
let j = 0
for (let ix = 0; ix < AMOUNTX; ix++) {
for (let iy = 0; iy < AMOUNTY; iy++) {
positions[i] = ix * SEPARATION - ((AMOUNTX * SEPARATION) / 2) // x
positions[i + 1] = 0 // y
positions[i + 2] = iy * SEPARATION - ((AMOUNTY * SEPARATION) / 2) // z
scales[j] = 1
i += 3
j++
}
}
const geometry = new THREE.BufferGeometry()
geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3))
geometry.setAttribute('scale', new THREE.BufferAttribute(scales, 1))
const material = new THREE.ShaderMaterial({
uniforms: {
color: {value: new THREE.Color(0.0, 1.0, 1.0, 1.0)}
},
vertexShader: document.getElementById('vertexshader').textContent,
fragmentShader: document.getElementById('fragmentshader').textContent
})
particles = new THREE.Points(geometry, material)
scene.add(particles)
renderer = new THREE.WebGLRenderer({antialias: true})
renderer.setPixelRatio(window.devicePixelRatio)
renderer.setSize(window.innerWidth, window.innerHeight)
container.appendChild(renderer.domElement)
// containerParent.append(container)
container.style.touchAction = 'none'
container.addEventListener('pointermove', this.onPointerMove)
window.addEventListener('resize', this.onWindowResize)
this.animate()
},
methods: {
login (){
var _this= this
animate() {
requestAnimationFrame(this.animate)
this.render()
},
getCaptcha() {
const _this = this
$.get('/api/authc/captcha',
function (resp) {
if (resp.Status === 0) {
_this.loginForm.captchaId = resp.Data.captchaId
_this.captcha = resp.Data.img
}
}, 'json')
},
render() {
camera.position.x += (mouseX - camera.position.x) * 0.05
camera.position.y += (-mouseY - camera.position.y) * 0.05
camera.lookAt(scene.position)
const positions = particles.geometry.attributes.position.array
const scales = particles.geometry.attributes.scale.array
let i = 0;
let j = 0
for (let ix = 0; ix < AMOUNTX; ix++) {
for (let iy = 0; iy < AMOUNTY; iy++) {
positions[i + 1] = (Math.sin((ix + count) * 0.3) * 50) +
(Math.sin((iy + count) * 0.5) * 50)
scales[j] = (Math.sin((ix + count) * 0.3) + 1) * 5 +
(Math.sin((iy + count) * 0.5) + 1) * 5
i += 3
j++
}
}
particles.geometry.attributes.position.needsUpdate = true
particles.geometry.attributes.scale.needsUpdate = true
renderer.render(scene, camera)
count += 0.08
},
onWindowResize() {
this.mstyle.left = window.innerWidth / 2 - 175 + 'px'
windowHalfX = window.innerWidth / 2
windowHalfY = window.innerHeight / 2
camera.aspect = window.innerWidth / window.innerHeight
camera.updateProjectionMatrix()
renderer.setSize(window.innerWidth, window.innerHeight)
},
onPointerMove(event) {
if (event.isPrimary === false) return
mouseX = event.clientX - windowHalfX
// mouseY = event.clientY - windowHalfY
},
login() {
var _this = this
if (this.user.username.trim().length < 4) {
this.$Message.warning('用户名最低4位');
// this.$Notice.warning({
// title: '用户名最低4位',
// desc: ''
// });
this.$message.warning('用户名最低4位');
return
}
if (this.user.userpwd.trim().length < 6) {
this.$Message.warning('密码最低6位');
this.$message.warning('密码最低6位');
return
}
$.post('/api/login', this.user,
function (data) {
if (data.Status == 1) {
_this.$Message.warning(data.Msg);
_this.$message.warning(data.Msg);
} else {
_this.$Message.success("登录成功");
_this.$message.success("登录成功");
window.location.href = "/"
}
}, 'json')
},
loginHandler() {
const _this = this
this.loading = true
this.$refs.loginForm.validate(valid => {
if (valid) {
$.post('/api/login', this.loginForm,
function (data) {
this.loading = false
if (data.Status == 1) {
_this.getCaptcha()
_this.message.warning(data.Msg);
} else {
_this.$message.success("登录成功");
window.location.href = "/"
}
}, 'json')
} else {
this.loading = false
}
})
},
registHandler() {
const _this = this
this.loading = true
this.$refs.loginForm.validate(valid => {
if (valid) {
$.post('/api/regist', this.loginForm,
function (data) {
this.loading = false
_this.getCaptcha()
if (data.Status == 1) {
_this.$message.warning(data.Msg);
} else {
_this.$message.success("注册成功,请登陆");
}
}, 'json')
} else {
this.loading = false
}
})
}
}
})

65
views/newblog.html

@ -8,38 +8,35 @@
<body>
<div class="root-container" id="vue-app">
<div class="blog-title">
<i-input type="text" v-model="blog.Title" placeholder="请输入文章标题"/>
<el-input v-model="blog.Title" placeholder="请输入文章标题"></el-input>
</div>
<mavon-editor :externalLink="externalLink" :toolbars="toolbars" v-model="blog.BlogValue" @imgAdd="$imgAdd"
@save="saveHandler" @change="changeHandler" ref=md></mavon-editor>
<Modal
v-model="showModal"
title="发布文章"
:mask-closable="false">
<el-dialog title="提示" :visible.sync="showModal" width="500px">
<div class="modal_form">
<span class="span-lable">文章分类:</span>
<i-select v-model="blog.CategoryId" style="width:300px">
<i-option v-for="item in cats" :value="item.Id" :key="item.Id">${ item.Title }</i-option>
</i-select>
<el-select v-model="blog.CategoryId" placeholder="请选择文章分类" style="width: 310px">
<el-option v-for="item in cats" :key="item.Id" :label="item.Title" :value="item.Id"/>
</el-select>
</div>
<div class="modal_form">
<span class="span-lable">文章标签:</span>
<i-button type="primary" ghost size="small" v-for="item,index in lables" :key="index" style="margin-left: 5px">${item.Title}
<Icon type="ios-close-circle-outline" @click="delLabel(index)"/>
</i-button>
<el-tag v-for="item,index in lables" :key="index" closable @close="delLabel(index)" style="margin-right: 3px">
${item.Title}
</el-tag>
</div>
<div class="modal_form">
<span class="span-lable">添加标签:</span>
<div style="display: inline-block;width: 241px">
<i-input type="text" v-model="lableTitle" placeholder="请输入标签名称"/>
<el-input v-model="lableTitle" placeholder="请输入标签名称"/>
</div>
<i-button type="primary" ghost @click="addLable">添加</i-button>
<el-button type="primary" plain @click="addLable">添加</el-button>
</div>
<div slot="footer">
<i-button type="error" size="large" long :loading="loading" @click="okHandler">保存</i-button>
</div>
</Modal>
<span slot="footer" class="dialog-footer">
<el-button @click="showModal = false">取 消</el-button>
<el-button type="primary" :loading="loading" @click="okHandler">确 定</el-button>
</span>
</el-dialog>
</div>
</body>
<script>
@ -59,7 +56,7 @@
Title: '',
BlogValue: '',
BlogHtml: '',
CategoryId: 0
CategoryId: ''
},
toolbars: {
bold: true, // 粗体
@ -98,16 +95,11 @@
menu: true, // 预览
},
externalLink: {
// markdown_css: function() {
// // 这是你的markdown css文件路径
// return '/markdown/github-markdown.min.css';
// },
katex_css: function () {
// 这是你的katex配色方案路径路径
return '/katex/katex.min.css';
},
katex_js: function () {
// 这是你的katex.js路径
return '/katex/katex.min.js';
},
},
@ -132,13 +124,11 @@
},
methods: {
okHandler (){
const _this =this
if(!this.blog.CategoryId || this.blog.CategoryId==0){
this.$Notice.warning({
title: '文章分类必须选择',
})
this.$message.error('文章分类必须选择')
return
}
var _this = this
this.loading = true
var tobj = {}
tobj.title = this.blog.Title
@ -158,20 +148,18 @@
if (data.Status == 0) {
window.localStorage.removeItem("blogValue");
window.localStorage.removeItem("blogTilte");
layer.msg("保存成功", {icon: 6});
_this.$message.success('保存成功')
window.location.href = "/blog/"+ data.Data
} else if (data.Status == 401) {
window.location.href = "/login"
} else if (data.Status == 500) {
layer.msg("保存失败", {icon: 6});
_this.$message.error('保存失败')
}
}, 'json')
},
addLable(){
if(!this.lableTitle){
this.$Notice.warning({
title: '请先输入标签名称',
})
this.$message.error('请先输入标签名称')
return
}
var tobj = {}
@ -187,7 +175,8 @@
$.get('/api/cats',
function (data) {
if (data.Status == 0) {
_this.cats = data.Data
const tdata = data.Data.map(x=>{x.Id = x.Id+""; return x})
_this.cats = tdata
} else if (data.Status == 401) {
window.location.href = "/login"
} else if (data.Status == 500) {
@ -215,15 +204,11 @@
},
saveHandler(value, render) {
if (this.blog.Title.trim().length < 3) {
this.$Notice.warning({
title: '文章标题最少三个字',
})
this.$message.error('文章标题最少三个字')
return
}
if (this.blog.BlogValue.trim().length == 0) {
this.$Notice.warning({
title: '文章内容不能为空哦',
})
this.$message.error('文章内容不能为空哦')
return
}
this.showModal = true

64
views/us.html

@ -1,64 +0,0 @@
{{template "header" .}}
<meta name="keywords" content="福利,源码下载,程序部署步骤,码农随笔,个人随笔,博客,个人博客,个人笔记,技术博客,免费云笔记,云笔记,随笔,IT博客,谷歌地图,码农笔录,aiprose">
<title>福利 - 码农随笔</title>
</head>
<body>
{{template "nav" .}}
<div class="us-root">
<div style="width: 450px;">
<p>·项目源码: <a href="https://gitea.aiprose.com/nelson/beeblog" target="_blank">点击查看</a></p>
<p>·项目框架: </p>
<div style="margin-left: 15px">
<p><span>golang@1.11</span></p>
<p><span>beego@1.7.2 <a href="https://beego.me/" target="_blank">beego官网</a></span></p>
<p><span>vue@2.6.10</span></p>
<p>iviewui@4.20: <a href="https://iviewui.com/" target="_blank">iviewui官网</a></p>
<p>富文本编辑器: <a href="http://www.wangeditor.com/" target="_blank">wangeditor官网</a></p>
<p>数据库: mysql(5.5.60-MariaDB)</p>
</div>
<p>·项目搭建步骤: </p>
<div style="margin-left: 15px">
<p>1.安装配置golang 最新版本 (开发最好安装一下bee)</p>
<p>2.go get github.com/astaxie/beego</p>
<p>3.go get github.com/go-sql-driver/mysql</p>
<p>4.windows环境需要安装gcc <a href="http://tdm-gcc.tdragon.net/download">gcc下载地址</a></p>
</div>
</div>
<div style="flex: 1">
<img src="/static/img/alipay.png" alt="" width="320" height="361">
<img src="/static/img/weixin.png" alt="" width="320" height="361">
<img src="/static/img/redalipay.png" alt="" height="360">
</div>
</div>
<div class="footer-container">
{{template "footer"}}
</div>
</body>
<script>
$(function () {
/*百度收录*/
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
/*360收录*/
var qihuo = document.createElement('script');
if (curProtocol === 'https') {
qihuo.src = 'https://jspassport.ssl.qhimg.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c';
}
else {
qihuo.src = 'http://js.passport.qihucdn.com/11.0.1.js?d33b14200fa89b7ecd3780341cd234c4';
}
qihuo.id = "sozz"
var s = document.getElementsByTagName("script")[1];
s.parentNode.insertBefore(qihuo, s);
})
</script>
</html>
Loading…
Cancel
Save