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
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
// see http://vuejs-templates.github.io/webpack for documentation.
const
path
=
require
(
'
path
'
)
const
path
=
require
(
"
path
"
);
module
.
exports
=
{
module
.
exports
=
{
dev
:
{
dev
:
{
// Paths
// Paths
assetsSubDirectory
:
'
static
'
,
assetsSubDirectory
:
"
static
"
,
assetsPublicPath
:
'
/
'
,
assetsPublicPath
:
"
/
"
,
proxyTable
:
{
proxyTable
:
{
'
/api
'
:
{
"
/api/
"
:
{
target
:
'
http://yongma16.xyz
'
,
//后端接口地址
target
:
"
http://114.116.52.53/
"
,
//后端接口地址
ws
:
true
,
//接受websocket请求
ws
:
true
,
//接受websocket请求
changeOrigin
:
true
,
//是否允许跨越
changeOrigin
:
true
,
//是否允许跨越
chunkOrigins
:
true
,
chunkOrigins
:
true
,
pathRewrite
:
{
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
// 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
port
:
8080
,
// can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser
:
false
,
autoOpenBrowser
:
false
,
errorOverlay
:
true
,
errorOverlay
:
true
,
notifyOnErrors
:
true
,
notifyOnErrors
:
true
,
poll
:
false
,
// https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
poll
:
false
,
// https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
// Use Eslint Loader?
// Use Eslint Loader?
// If true, your code will be linted during bundling and
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
// linting errors and warnings will be shown in the console.
useEslint
:
false
,
useEslint
:
false
,
// If true, eslint errors and warnings will also be shown in the error overlay
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.
// in the browser.
showEslintErrorsInOverlay
:
false
,
showEslintErrorsInOverlay
:
false
,
/**
/**
* Source Maps
* Source Maps
*/
*/
// https://webpack.js.org/configuration/devtool/#development
// 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,
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting
:
true
,
cacheBusting
:
true
,
cssSourceMap
:
true
cssSourceMap
:
true
,
},
},
build
:
{
build
:
{
// Template for index.html
// Template for index.html
index
:
path
.
resolve
(
__dirname
,
'
../dist/index.html
'
),
index
:
path
.
resolve
(
__dirname
,
"
../dist/index.html
"
),
// Paths
// Paths
assetsRoot
:
path
.
resolve
(
__dirname
,
'
../dist
'
),
assetsRoot
:
path
.
resolve
(
__dirname
,
"
../dist
"
),
assetsSubDirectory
:
'
static
'
,
assetsSubDirectory
:
"
static
"
,
assetsPublicPath
:
'
./
'
,
assetsPublicPath
:
"
./
"
,
/**
/**
* Source Maps
* Source Maps
*/
*/
productionSourceMap
:
true
,
productionSourceMap
:
true
,
// https://webpack.js.org/configuration/devtool/#production
// https://webpack.js.org/configuration/devtool/#production
devtool
:
'
#source-map
'
,
devtool
:
"
#source-map
"
,
// Gzip off by default as many popular static hosts such as
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
// npm install --save-dev compression-webpack-plugin
productionGzip
:
false
,
productionGzip
:
false
,
productionGzipExtensions
:
[
'
js
'
,
'
css
'
],
productionGzipExtensions
:
[
"
js
"
,
"
css
"
],
// Run the build command with an extra argument to
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
// 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 {
...
@@ -45,7 +45,7 @@ export default {
return
{
return
{
noneMsg
:
"
还没人评论>_<
"
,
noneMsg
:
"
还没人评论>_<
"
,
msg
:
"
评论区
"
,
msg
:
"
评论区
"
,
baseurl
:
"
http://114.116.52.53/comment/
"
,
baseurl
:
"
api
"
,
// baseurl: "http://yongma16.xyz/comment/",
// baseurl: "http://yongma16.xyz/comment/",
userImg
:
""
,
userImg
:
""
,
username
:
"
匿名
"
,
username
:
"
匿名
"
,
...
@@ -97,7 +97,7 @@ export default {
...
@@ -97,7 +97,7 @@ export default {
};
};
console
.
log
(
"
获取评论id
"
,
params
.
articleId
);
console
.
log
(
"
获取评论id
"
,
params
.
articleId
);
axios
axios
.
post
(
that
.
baseurl
+
"
get/
"
,
params
)
.
post
(
that
.
baseurl
+
"
comment/
get/
"
,
params
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
try
{
try
{
let
resData
=
res
.
data
;
let
resData
=
res
.
data
;
...
@@ -141,7 +141,7 @@ export default {
...
@@ -141,7 +141,7 @@ export default {
content
:
content
,
content
:
content
,
};
};
axios
axios
.
post
(
that
.
baseurl
+
"
post/
"
,
params
)
.
post
(
that
.
baseurl
+
"
comment/
post/
"
,
params
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
that
.
articleCommit
=
null
;
that
.
articleCommit
=
null
;
try
{
try
{
...
...
src/components/Article.vue
浏览文件 @
fa55f3e3
...
@@ -224,7 +224,7 @@ export default {
...
@@ -224,7 +224,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
// baseurl: '/api/',
// baseurl: '/api/',
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
// baseurl: "http://yongma16.xyz/",
// baseurl: "http://yongma16.xyz/",
msg
:
"
内容
"
,
msg
:
"
内容
"
,
commmentSlogan
:
"
评论区
"
,
commmentSlogan
:
"
评论区
"
,
...
...
src/components/Csslearn.vue
浏览文件 @
fa55f3e3
...
@@ -37,7 +37,7 @@ export default {
...
@@ -37,7 +37,7 @@ export default {
msg
:
"
css练习:
"
,
msg
:
"
css练习:
"
,
css_length
:
""
,
css_length
:
""
,
// baseurl: 'http://127.0.0.1:1998',
// baseurl: 'http://127.0.0.1:1998',
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
// baseurl: "http://yongma16.xyz/",
// baseurl: "http://yongma16.xyz/",
css_title
:
[],
css_title
:
[],
css_path
:
[],
css_path
:
[],
...
...
src/components/Login.vue
浏览文件 @
fa55f3e3
...
@@ -43,36 +43,36 @@
...
@@ -43,36 +43,36 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
axios
from
'
axios
'
import
axios
from
"
axios
"
;
import
store
from
'
@/store
'
import
store
from
"
@/store
"
;
export
default
{
export
default
{
name
:
'
Login
'
,
name
:
"
Login
"
,
data
()
{
data
()
{
var
checkName
=
(
rule
,
value
,
callback
)
=>
{
var
checkName
=
(
rule
,
value
,
callback
)
=>
{
if
(
!
value
)
{
if
(
!
value
)
{
return
callback
(
new
Error
(
'
账号不能为空
'
))
return
callback
(
new
Error
(
"
账号不能为空
"
));
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
// if (!Number.isInteger(value)) {
// if (!Number.isInteger(value)) {
// callback(new Error('请输入密码'));
// callback(new Error('请输入密码'));
// } if {
// } if {
if
(
value
.
length
<
2
)
{
if
(
value
.
length
<
2
)
{
callback
(
new
Error
(
'
名字至少两位
'
))
callback
(
new
Error
(
"
名字至少两位
"
));
}
else
{
}
else
{
callback
()
callback
()
;
}
}
},
1000
)
},
1000
)
;
}
}
;
var
validatePass
=
(
rule
,
value
,
callback
)
=>
{
var
validatePass
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
===
''
)
{
if
(
value
===
""
)
{
callback
(
new
Error
(
'
请输入密码
'
))
callback
(
new
Error
(
"
请输入密码
"
));
}
else
{
}
else
{
// if (this.ruleForm.checkPass !== '') {
// if (this.ruleForm.checkPass !== '') {
// this.$refs.ruleForm.validateField('checkPass');
// this.$refs.ruleForm.validateField('checkPass');
// }
// }
callback
()
callback
()
;
}
}
}
}
;
// var validatePass2 = (rule, value, callback) => {
// var validatePass2 = (rule, value, callback) => {
// if (value === '') {
// if (value === '') {
// callback(new Error('请再次输入密码'));
// callback(new Error('请再次输入密码'));
...
@@ -84,68 +84,68 @@ export default {
...
@@ -84,68 +84,68 @@ export default {
// };
// };
return
{
return
{
// baseurl:"http://127.0.0.1/user/login/",
// baseurl:"http://127.0.0.1/user/login/",
baseurl
:
'
http://114.116.52.53/
'
,
baseurl
:
"
/api/
"
,
// baseurl: 'http://yongma16.xyz/user/login/',
// baseurl: 'http://yongma16.xyz/user/login/',
ruleForm
:
{
ruleForm
:
{
pass
:
''
,
pass
:
""
,
// checkPass: '',
// checkPass: '',
name
:
''
name
:
""
,
},
},
rules
:
{
rules
:
{
pass
:
[{
validator
:
validatePass
,
trigger
:
'
blur
'
}],
pass
:
[{
validator
:
validatePass
,
trigger
:
"
blur
"
}],
checkPass
:
[{
validator
:
validatePass
,
trigger
:
'
blur
'
}],
checkPass
:
[{
validator
:
validatePass
,
trigger
:
"
blur
"
}],
name
:
[{
validator
:
checkName
,
trigger
:
'
blur
'
}]
name
:
[{
validator
:
checkName
,
trigger
:
"
blur
"
}],
}
}
,
}
}
;
},
},
methods
:
{
methods
:
{
submitForm
(
formName
)
{
submitForm
(
formName
)
{
const
that
=
this
// this指向
const
that
=
this
;
// this指向
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
// 提交数据
// 提交数据
console
.
log
(
that
.
ruleForm
.
name
,
that
.
ruleForm
.
pass
)
console
.
log
(
that
.
ruleForm
.
name
,
that
.
ruleForm
.
pass
)
;
// axios提交数据 post
// axios提交数据 post
const
loginUrl
=
that
.
baseurl
+
'
user/login/
'
const
loginUrl
=
that
.
baseurl
+
"
user/login/
"
;
const
userInfo
=
{
const
userInfo
=
{
name
:
that
.
ruleForm
.
name
,
name
:
that
.
ruleForm
.
name
,
password
:
that
.
ruleForm
.
pass
password
:
that
.
ruleForm
.
pass
,
}
}
;
axios
axios
.
post
(
loginUrl
,
userInfo
)
.
post
(
loginUrl
,
userInfo
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
// alter('提交中');
// alter('提交中');
console
.
log
(
res
.
data
)
console
.
log
(
res
.
data
)
;
if
(
res
.
data
.
code
==
1
)
{
if
(
res
.
data
.
code
==
1
)
{
localStorage
.
setItem
(
'
yma16siteUserInfoName
'
,
userInfo
.
name
)
localStorage
.
setItem
(
"
yma16siteUserInfoName
"
,
userInfo
.
name
);
localStorage
.
setItem
(
'
yma16siteUserInfoPwd
'
,
userInfo
.
password
)
localStorage
.
setItem
(
"
yma16siteUserInfoPwd
"
,
userInfo
.
password
);
store
.
commit
(
'
setUserInfo
'
,
userInfo
)
// store信息
store
.
commit
(
"
setUserInfo
"
,
userInfo
);
// store信息
console
.
log
(
'
return login success!
'
)
console
.
log
(
"
return login success!
"
);
document
.
cookie
=
`user=
${
that
.
ruleForm
.
name
}
`
document
.
cookie
=
`user=
${
that
.
ruleForm
.
name
}
`
;
that
.
$router
.
push
({
path
:
'
/
'
})
that
.
$router
.
push
({
path
:
"
/
"
});
// 添加cookie
// 添加cookie
}
else
if
(
res
.
data
.
code
==
0
)
{
}
else
if
(
res
.
data
.
code
==
0
)
{
// alter("失败!")
// alter("失败!")
console
.
log
(
'
失败
'
,
res
)
console
.
log
(
"
失败
"
,
res
);
}
}
// that.$cookies.set('')
// that.$cookies.set('')
})
})
.
catch
((
res
)
=>
{
.
catch
((
res
)
=>
{
console
.
log
(
'
post失败
'
)
console
.
log
(
"
post失败
"
);
console
.
log
(
res
)
console
.
log
(
res
)
;
})
})
;
}
else
{
}
else
{
alert
(
'
请输入账号密码
'
)
alert
(
"
请输入账号密码
"
);
console
.
log
(
'
请输入账号密码
'
)
console
.
log
(
"
请输入账号密码
"
);
return
false
return
false
;
}
}
})
})
;
},
},
resetForm
(
formName
)
{
resetForm
(
formName
)
{
this
.
$refs
[
formName
].
resetFields
()
this
.
$refs
[
formName
].
resetFields
()
;
}
}
,
}
}
,
}
}
;
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
...
...
src/components/Mavoneditor.vue
浏览文件 @
fa55f3e3
...
@@ -22,7 +22,7 @@ export default {
...
@@ -22,7 +22,7 @@ export default {
name
:
"
Mavoneditor
"
,
name
:
"
Mavoneditor
"
,
data
()
{
data
()
{
return
{
return
{
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
basePath
:
"
admin/
"
,
basePath
:
"
admin/
"
,
// baseurl: 'http://yongma16.xyz/',
// baseurl: 'http://yongma16.xyz/',
md_data
:
[],
md_data
:
[],
...
...
src/components/Onlinewebsocket.vue
浏览文件 @
fa55f3e3
...
@@ -141,9 +141,9 @@ export default {
...
@@ -141,9 +141,9 @@ export default {
room_name
:
[
"
DjangoVue
"
],
room_name
:
[
"
DjangoVue
"
],
room_select
:
""
,
room_select
:
""
,
// baseUrl: "http://localhost:8006/webchat/index/",
// baseUrl: "http://localhost:8006/webchat/index/",
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
// baseUrl: "http://yongma16.xyz/",
// baseUrl: "http://yongma16.xyz/",
websocketUrl
:
"
ws://114.116.52.53
/
"
,
websocketUrl
:
"
/ws_api
/
"
,
// websocketUrl: "yongma16.xyz/ws/webchat/",
// websocketUrl: "yongma16.xyz/ws/webchat/",
websocket
:
null
,
websocket
:
null
,
// room 存房间名字,content保存聊天信息的数组
// room 存房间名字,content保存聊天信息的数组
...
...
src/components/Register.vue
浏览文件 @
fa55f3e3
...
@@ -116,7 +116,7 @@ export default {
...
@@ -116,7 +116,7 @@ export default {
register_success
:
false
,
register_success
:
false
,
register_error
:
false
,
register_error
:
false
,
// baseurl: "http://127.0.0.1/",
// baseurl: "http://127.0.0.1/",
baseurl
:
"
http://114.116.52.53
/
"
,
baseurl
:
"
/api
/
"
,
// baseurl: 'http://yongma16.xyz/',
// baseurl: 'http://yongma16.xyz/',
ruleForm
:
{
ruleForm
:
{
pass
:
""
,
pass
:
""
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录