Skip to content

Commit

Permalink
fix 更新设置
Browse files Browse the repository at this point in the history
  • Loading branch information
lewkamtao committed Aug 27, 2021
1 parent fd20e79 commit dabed42
Show file tree
Hide file tree
Showing 24 changed files with 1,272 additions and 568 deletions.
24 changes: 19 additions & 5 deletions components/Detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class="part"
></article-detail>

<!-- 友情链接 -->
<!-- 朋友 -->
<links-detail
:geek_config="geek_config"
v-if="options.links && options.type == 'links'"
Expand Down Expand Up @@ -44,6 +44,13 @@
:article="about"
class="part"
></about-detail>

<!-- 设置 -->
<setting-detail
v-if="options.type == 'setting'"
:geek_config="geek_config"
class="part"
></setting-detail>
</div>
<div ref="aside" :style="setAsideLeft" class="aside">
<!-- 标签云 -->
Expand All @@ -59,10 +66,10 @@
<record v-if="options.type == 'about'"> </record>

<!-- 社交媒体 -->
<concact
<contact
v-if="options.type == 'about' && geek_config.master_info.concact_switch"
:geek_config="geek_config"
></concact>
></contact>

<!-- 评论板块 -->
<comment
Expand Down Expand Up @@ -96,6 +103,9 @@

<!-- 日记 -->
<diary v-if="['index', 'timeline'].indexOf(options.type) >= 0"></diary>

<!-- 日记 -->
<setting-menu v-if="['setting'].indexOf(options.type) >= 0"></setting-menu>
</div>
</div>
</template>
Expand All @@ -107,17 +117,19 @@ import IndexDetail from "@/components/detail/IndexDetail";
import MsgWallDetail from "@/components/detail/MsgWallDetail";
import TimelineDetail from "@/components/detail/TimelineDetail";
import AboutDetail from "@/components/detail/AboutDetail";
import SettingDetail from "@/components/detail/SettingDetail";
import Catalogue from "@/components/detail/parts/Catalogue";
import Comment from "@/components/detail/parts/Comment";
import TagCloud from "@/components/detail/parts/TagCloud";
import Info from "@/components/detail/parts/Info";
import Lately from "@/components/detail/parts/Lately";
import Concact from "@/components/detail/parts/Concact";
import Contact from "@/components/detail/parts/Contact";
import Record from "@/components/detail/parts/Record";
import CommentRank from "@/components/detail/parts/CommentRank";
import PostTimeLine from "@/components/detail/parts/PostTimeLine";
import Diary from "@/components/detail/parts/Diary";
import SettingMenu from "@/components/detail/parts/SettingMenu";
export default {
components: {
Expand All @@ -127,17 +139,19 @@ export default {
MsgWallDetail,
TimelineDetail,
AboutDetail,
SettingDetail,
Diary,
Catalogue,
Comment,
TagCloud,
Lately,
Info,
Concact,
Contact,
Record,
PostTimeLine,
CommentRank,
SettingMenu,
},
props: {
geek_config: {
Expand Down
5 changes: 4 additions & 1 deletion components/LeftNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
></article-sort>

<!-- 设置 -->
<mode-set></mode-set>
<mode-set
@openMusicBox="openMusicBox"
@closeMusicBox="closeMusicBox"
></mode-set>

<!-- 备案号 -->
<permit-no :geek_config="geek_config"></permit-no>
Expand Down
152 changes: 152 additions & 0 deletions components/detail/SettingDetail.vue
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.
2 changes: 1 addition & 1 deletion components/detail/parts/Record.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="count">
{{ record.links.count }}
</div>
<div class="tag">友情链接</div>
<div class="tag">朋友</div>
</div>
</div>
</div>
Expand Down
99 changes: 99 additions & 0 deletions components/detail/parts/SettingMenu.vue
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>
Loading

0 comments on commit dabed42

Please sign in to comment.