Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yma16
myblogVue_django
提交
fa55f3e3
M
myblogVue_django
项目概览
yma16
/
myblogVue_django
通知
5
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
myblogVue_django
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
fa55f3e3
编写于
4月 17, 2022
作者:
Y
yma16
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:api跨域
上级
b607b035
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
132 addition
and
123 deletion
+132
-123
config/index.js
config/index.js
+76
-67
src/comment/ArticleComment.vue
src/comment/ArticleComment.vue
+3
-3
src/components/Article.vue
src/components/Article.vue
+1
-1
src/components/Csslearn.vue
src/components/Csslearn.vue
+1
-1
src/components/Login.vue
src/components/Login.vue
+47
-47
src/components/Mavoneditor.vue
src/components/Mavoneditor.vue
+1
-1
src/components/Onlinewebsocket.vue
src/components/Onlinewebsocket.vue
+2
-2
src/components/Register.vue
src/components/Register.vue
+1
-1
未找到文件。
config/index.js
浏览文件 @
fa55f3e3
'
use strict
'
"
use strict
"
;
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const
path
=
require
(
'
path
'
)
const
path
=
require
(
"
path
"
);
module
.
exports
=
{
dev
:
{
// Paths
assetsSubDirectory
:
'
static
'
,
assetsPublicPath
:
'
/
'
,
assetsSubDirectory
:
"
static
"
,
assetsPublicPath
:
"
/
"
,
proxyTable
:
{
'
/api
'
:
{
target
:
'
http://yongma16.xyz
'
,
//后端接口地址
"
/api/
"
:
{
target
:
"
http://114.116.52.53/
"
,
//后端接口地址
ws
:
true
,
//接受websocket请求
changeOrigin
:
true
,
//是否允许跨越
chunkOrigins
:
true
,
pathRewrite
:
{
'
^/api
'
:
''
//重写,
}
}
"
^/api
"
:
""
,
//重写,
},
},
"
/ws_api/
"
:
{
target
:
"
ws://114.116.52.53/
"
,
ws
:
true
,
//接受websocket请求
changeOrigin
:
true
,
//是否允许跨越
chunkOrigins
:
true
,
pathRewrite
:
{
"
^/ws_api
"
:
""
,
//重写,
},
},
},
// Various Dev Server settings
host
:
'
localhost
'
,
// can be overwritten by process.env.HOST
host
:
"
localhost
"
,
// can be overwritten by process.env.HOST
port
:
8080
,
// can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser
:
false
,
errorOverlay
:
true
,
...
...
@@ -42,24 +51,24 @@ module.exports = {
*/
// https://webpack.js.org/configuration/devtool/#development
devtool
:
'
cheap-module-eval-source-map
'
,
devtool
:
"
cheap-module-eval-source-map
"
,
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting
:
true
,
cssSourceMap
:
true
cssSourceMap
:
true
,
},
build
:
{
// Template for index.html
index
:
path
.
resolve
(
__dirname
,
'
../dist/index.html
'
),
index
:
path
.
resolve
(
__dirname
,
"
../dist/index.html
"
),
// Paths
assetsRoot
:
path
.
resolve
(
__dirname
,
'
../dist
'
),
assetsSubDirectory
:
'
static
'
,
assetsPublicPath
:
'
./
'
,
assetsRoot
:
path
.
resolve
(
__dirname
,
"
../dist
"
),
assetsSubDirectory
:
"
static
"
,
assetsPublicPath
:
"
./
"
,
/**
* Source Maps
...
...
@@ -67,19 +76,19 @@ module.exports = {
productionSourceMap
:
true
,
// https://webpack.js.org/configuration/devtool/#production
devtool
:
'
#source-map
'
,
devtool
:
"
#source-map
"
,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip
:
false
,
productionGzipExtensions
:
[
'
js
'
,
'
css
'
],
productionGzipExtensions
:
[
"
js
"
,
"
css
"
],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport
:
process
.
env
.
npm_config_report
}
}
bundleAnalyzerReport
:
process
.
env
.
npm_config_report
,
},
}
;
src/comment/ArticleComment.vue
浏览文件 @
fa55f3e3
...
...
@@ -45,7 +45,7 @@ export default {
return
{
noneMsg
:
"
还没人评论>_<
"
,
msg
:
"
评论区
"
,
baseurl
:
"
http://114.116.52.53/comment/
"
,
baseurl
:
"
api
"
,
// baseurl: "http://yongma16.xyz/comment/",
userImg
:
""
,
username
:
"
匿名
"
,
...
...
@@ -97,7 +97,7 @@ export default {
};
console
.
log
(
"
获取评论id
"
,
params
.
articleId
);
axios
.
post
(
that
.
baseurl
+
"
get/
"
,
params
)
.
post
(
that
.
baseurl
+
"
comment/
get/
"
,
params
)
.
then
((
res
)
=>
{
try
{
let
resData
=
res
.
data
;
...
...
@@ -141,7 +141,7 @@ export default {
content
:
content
,
};
axios
.
post
(
that
.
baseurl
+
"
post/
"
,
params
)
.
post
(
that
.
baseurl
+
"
comment/
post/
"
,
params
)
.
then
((
res
)
=>
{
that
.
articleCommit
=
null
;
try
{
...
...
src/components/Article.vue
浏览文件 @
fa55f3e3
...
...
@@ -224,7 +224,7 @@ export default {
data
()
{
return
{
// baseurl: '/api/',
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
// baseurl: "http://yongma16.xyz/",
msg
:
"
内容
"
,
commmentSlogan
:
"
评论区
"
,
...
...
src/components/Csslearn.vue
浏览文件 @
fa55f3e3
...
...
@@ -37,7 +37,7 @@ export default {
msg
:
"
css练习:
"
,
css_length
:
""
,
// baseurl: 'http://127.0.0.1:1998',
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
// baseurl: "http://yongma16.xyz/",
css_title
:
[],
css_path
:
[],
...
...
src/components/Login.vue
浏览文件 @
fa55f3e3
...
...
@@ -43,36 +43,36 @@
</
template
>
<
script
>
import
axios
from
'
axios
'
import
store
from
'
@/store
'
import
axios
from
"
axios
"
;
import
store
from
"
@/store
"
;
export
default
{
name
:
'
Login
'
,
data
()
{
name
:
"
Login
"
,
data
()
{
var
checkName
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
return
callback
(
new
Error
(
'
账号不能为空
'
))
return
callback
(
new
Error
(
"
账号不能为空
"
));
}
setTimeout
(()
=>
{
// if (!Number.isInteger(value)) {
// callback(new Error('请输入密码'));
// } if {
if
(
value
.
length
<
2
)
{
callback
(
new
Error
(
'
名字至少两位
'
))
callback
(
new
Error
(
"
名字至少两位
"
));
}
else
{
callback
()
}
},
1000
)
callback
();
}
},
1000
);
};
var
validatePass
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'
请输入密码
'
))
if
(
value
===
""
)
{
callback
(
new
Error
(
"
请输入密码
"
));
}
else
{
// if (this.ruleForm.checkPass !== '') {
// this.$refs.ruleForm.validateField('checkPass');
// }
callback
()
}
callback
();
}
};
// var validatePass2 = (rule, value, callback) => {
// if (value === '') {
// callback(new Error('请再次输入密码'));
...
...
@@ -84,68 +84,68 @@ export default {
// };
return
{
// baseurl:"http://127.0.0.1/user/login/",
baseurl
:
'
http://114.116.52.53/
'
,
baseurl
:
"
/api/
"
,
// baseurl: 'http://yongma16.xyz/user/login/',
ruleForm
:
{
pass
:
''
,
pass
:
""
,
// checkPass: '',
name
:
''
name
:
""
,
},
rules
:
{
pass
:
[{
validator
:
validatePass
,
trigger
:
'
blur
'
}],
checkPass
:
[{
validator
:
validatePass
,
trigger
:
'
blur
'
}],
name
:
[{
validator
:
checkName
,
trigger
:
'
blur
'
}]
}
}
pass
:
[{
validator
:
validatePass
,
trigger
:
"
blur
"
}],
checkPass
:
[{
validator
:
validatePass
,
trigger
:
"
blur
"
}],
name
:
[{
validator
:
checkName
,
trigger
:
"
blur
"
}],
}
,
}
;
},
methods
:
{
submitForm
(
formName
)
{
const
that
=
this
// this指向
submitForm
(
formName
)
{
const
that
=
this
;
// this指向
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
// 提交数据
console
.
log
(
that
.
ruleForm
.
name
,
that
.
ruleForm
.
pass
)
console
.
log
(
that
.
ruleForm
.
name
,
that
.
ruleForm
.
pass
)
;
// axios提交数据 post
const
loginUrl
=
that
.
baseurl
+
'
user/login/
'
const
loginUrl
=
that
.
baseurl
+
"
user/login/
"
;
const
userInfo
=
{
name
:
that
.
ruleForm
.
name
,
password
:
that
.
ruleForm
.
pass
}
password
:
that
.
ruleForm
.
pass
,
}
;
axios
.
post
(
loginUrl
,
userInfo
)
.
then
((
res
)
=>
{
// alter('提交中');
console
.
log
(
res
.
data
)
console
.
log
(
res
.
data
)
;
if
(
res
.
data
.
code
==
1
)
{
localStorage
.
setItem
(
'
yma16siteUserInfoName
'
,
userInfo
.
name
)
localStorage
.
setItem
(
'
yma16siteUserInfoPwd
'
,
userInfo
.
password
)
store
.
commit
(
'
setUserInfo
'
,
userInfo
)
// store信息
console
.
log
(
'
return login success!
'
)
document
.
cookie
=
`user=
${
that
.
ruleForm
.
name
}
`
that
.
$router
.
push
({
path
:
'
/
'
})
localStorage
.
setItem
(
"
yma16siteUserInfoName
"
,
userInfo
.
name
);
localStorage
.
setItem
(
"
yma16siteUserInfoPwd
"
,
userInfo
.
password
);
store
.
commit
(
"
setUserInfo
"
,
userInfo
);
// store信息
console
.
log
(
"
return login success!
"
);
document
.
cookie
=
`user=
${
that
.
ruleForm
.
name
}
`
;
that
.
$router
.
push
({
path
:
"
/
"
});
// 添加cookie
}
else
if
(
res
.
data
.
code
==
0
)
{
// alter("失败!")
console
.
log
(
'
失败
'
,
res
)
console
.
log
(
"
失败
"
,
res
);
}
// that.$cookies.set('')
})
.
catch
((
res
)
=>
{
console
.
log
(
'
post失败
'
)
console
.
log
(
res
)
})
console
.
log
(
"
post失败
"
);
console
.
log
(
res
)
;
})
;
}
else
{
alert
(
'
请输入账号密码
'
)
console
.
log
(
'
请输入账号密码
'
)
return
false
alert
(
"
请输入账号密码
"
);
console
.
log
(
"
请输入账号密码
"
);
return
false
;
}
})
})
;
},
resetForm
(
formName
)
{
this
.
$refs
[
formName
].
resetFields
()
}
}
}
resetForm
(
formName
)
{
this
.
$refs
[
formName
].
resetFields
()
;
}
,
}
,
}
;
</
script
>
<
style
scoped
>
...
...
src/components/Mavoneditor.vue
浏览文件 @
fa55f3e3
...
...
@@ -22,7 +22,7 @@ export default {
name
:
"
Mavoneditor
"
,
data
()
{
return
{
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
basePath
:
"
admin/
"
,
// baseurl: 'http://yongma16.xyz/',
md_data
:
[],
...
...
src/components/Onlinewebsocket.vue
浏览文件 @
fa55f3e3
...
...
@@ -141,9 +141,9 @@ export default {
room_name
:
[
"
DjangoVue
"
],
room_select
:
""
,
// baseUrl: "http://localhost:8006/webchat/index/",
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
// baseUrl: "http://yongma16.xyz/",
websocketUrl
:
"
ws://114.116.52.53
/
"
,
websocketUrl
:
"
/ws_api
/
"
,
// websocketUrl: "yongma16.xyz/ws/webchat/",
websocket
:
null
,
// room 存房间名字,content保存聊天信息的数组
...
...
src/components/Register.vue
浏览文件 @
fa55f3e3
...
...
@@ -116,7 +116,7 @@ export default {
register_success
:
false
,
register_error
:
false
,
// baseurl: "http://127.0.0.1/",
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
// baseurl: 'http://yongma16.xyz/',
ruleForm
:
{
pass
:
""
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录