-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,272 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<template> | ||
<div class="setting-wrapper part"> | ||
<h1>设置</h1> | ||
<menu-set></menu-set> | ||
<site-info></site-info> | ||
<master> </master> | ||
<contact></contact> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import first_geek_config from "@/util/geek.config.js"; | ||
import Contact from "../../components/setting/Contact.vue"; | ||
import MenuSet from "../../components/setting/MenuSet.vue"; | ||
import Master from "../../components/setting/Master.vue"; | ||
import SiteInfo from "../../components/setting/SiteInfo.vue"; | ||
export default { | ||
components: { Contact, MenuSet, Master, SiteInfo }, | ||
props: {}, | ||
data() { | ||
return { | ||
geek_config_form: false, | ||
checkSubmit: 0, | ||
concact_options: [ | ||
{ | ||
label: "手机", | ||
value: "Phone", | ||
}, | ||
{ | ||
label: "QQ", | ||
value: "QQ", | ||
}, | ||
{ | ||
label: "微信", | ||
value: "Wechat", | ||
}, | ||
{ | ||
label: "微博", | ||
value: "Weibo", | ||
}, | ||
{ | ||
label: "邮箱", | ||
value: "Mail", | ||
}, | ||
{ | ||
label: "Github", | ||
value: "Github", | ||
}, | ||
{ | ||
label: "Instagram", | ||
value: "Instagram", | ||
}, | ||
{ | ||
label: "Twitter", | ||
value: "Twitter", | ||
}, | ||
{ | ||
label: "Wordpress", | ||
value: "Wordpress", | ||
}, | ||
{ | ||
label: "Youtube", | ||
value: "Youtube", | ||
}, | ||
], | ||
}; | ||
}, | ||
watch: {}, | ||
computed: {}, | ||
methods: { | ||
addConcactItem() { | ||
this.geek_config_form.master_info.concact_array.push({ | ||
key: "", | ||
value: "", | ||
}); | ||
}, | ||
async getOption() { | ||
const res_geek_config = await this.$axios.get( | ||
"/options?key=geek_config&cache=false" | ||
); | ||
if (res_geek_config.code == 200 && res_geek_config.data.opt) { | ||
this.geek_config_form = res_geek_config.data.opt; | ||
if (this.geek_config_form.master_info.concact_array.length == 0) { | ||
this.geek_config_form.master_info.concact_array[0] = { | ||
key: "", | ||
value: "", | ||
}; | ||
} | ||
} else { | ||
this.geek_config_form = first_geek_config.geek_config; | ||
} | ||
}, | ||
submit() { | ||
if (this.$cookies.get("token")) { | ||
var form = JSON.parse(JSON.stringify(this.geek_config_form)); | ||
form.master_info.concact_array = form.master_info.concact_array.filter( | ||
(item) => { | ||
return item.key != "" && item.value != ""; | ||
} | ||
); | ||
var data = { | ||
"login-token": this.$cookies.get("token"), | ||
keys: "geek_config", | ||
opt: form, | ||
}; | ||
this.$axios.post("/options", data).then((res) => { | ||
if (res.code == 200) { | ||
this.checkSubmit += 1; | ||
this.reload(); | ||
} | ||
}); | ||
var userdata = { | ||
"login-token": this.$cookies.get("token"), | ||
id: this.$cookies.get("user").id, | ||
nickname: this.geek_config_form.master_info.nickname, | ||
description: this.geek_config_form.master_info.description, | ||
email: this.geek_config_form.master_info.email, | ||
phone: this.geek_config_form.master_info.phone, | ||
head_img: this.geek_config_form.master_info.head_img, | ||
}; | ||
this.$axios.post("/users", userdata).then((res) => { | ||
if (res.code == 200) { | ||
this.checkSubmit += 1; | ||
this.reload(); | ||
} | ||
}); | ||
} | ||
}, | ||
reload() { | ||
if (this.checkSubmit == 2) { | ||
location.reload(); | ||
} | ||
}, | ||
}, | ||
created() { | ||
this.getOption(); | ||
}, | ||
mounted() {}, | ||
}; | ||
</script> | ||
<style lang="scss" scoped> | ||
.setting-wrapper { | ||
padding: 30px; | ||
} | ||
</style> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<template> | ||
<div class="part setting-menu"> | ||
<ul> | ||
<a | ||
:href="'#' + item.id" | ||
v-for="(item, index) in setting_menu" | ||
:key="index" | ||
> | ||
{{ item.name }} | ||
</a> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
components: {}, | ||
props: {}, | ||
data() { | ||
return { | ||
setting_menu: [ | ||
{ | ||
id: "setting_menu", | ||
name: "菜单", | ||
}, | ||
{ | ||
id: "setting_contact", | ||
name: "联系方式板块", | ||
}, | ||
{ | ||
id: "setting_master", | ||
name: "个人信息", | ||
}, | ||
{ | ||
id: "setting_siteinfo", | ||
name: "站点信息", | ||
}, | ||
], | ||
}; | ||
}, | ||
watch: {}, | ||
computed: {}, | ||
methods: {}, | ||
created() {}, | ||
mounted() {}, | ||
}; | ||
</script> | ||
<style lang="scss" scoped> | ||
.setting-menu { | ||
width: 100%; | ||
} | ||
ul { | ||
display: flex; | ||
flex-direction: column; | ||
a { | ||
position: relative; | ||
width: 100%; | ||
background-image: none; | ||
border-radius: 7px; | ||
line-height: 28px; | ||
min-height: 36px; | ||
padding: 4px 15px; | ||
color: #999; | ||
display: inline-block; | ||
box-sizing: border-box; | ||
font-size: 14px; | ||
cursor: pointer; | ||
.label { | ||
position: absolute; | ||
right: 15px; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
} | ||
} | ||
a::before { | ||
position: absolute; | ||
top: 0px; | ||
left: 0px; | ||
content: ""; | ||
width: 100%; | ||
height: 1px; | ||
background: rgba($color: #000000, $alpha: 0.05); | ||
} | ||
a:first-child::before { | ||
display: none; | ||
} | ||
a:hover { | ||
color: #000; | ||
background: rgba($color: #000, $alpha: 0.05); | ||
} | ||
a:hover::before { | ||
display: none; | ||
} | ||
a:hover + a::before { | ||
display: none; | ||
} | ||
} | ||
</style> |
Oops, something went wrong.