feat: 首页启动设置

This commit is contained in:
韦荣超 2022-02-24 17:11:05 +08:00
parent 320f183b49
commit 0928ba71f2
3 changed files with 70 additions and 22 deletions

View File

@ -41,7 +41,7 @@ class SystemController extends AbstractController
User::auth('admin');
$all = Request::input();
foreach ($all AS $key => $value) {
if (!in_array($key, ['reg', 'reg_invite', 'login_code', 'password_policy', 'project_invite', 'chat_nickname'])) {
if (!in_array($key, ['reg', 'reg_invite', 'login_code', 'password_policy', 'project_invite', 'chat_nickname','start_home','home_footer'])) {
unset($all[$key]);
}
}
@ -62,6 +62,7 @@ class SystemController extends AbstractController
$setting['password_policy'] = $setting['password_policy'] ?: 'simple';
$setting['project_invite'] = $setting['project_invite'] ?: 'open';
$setting['chat_nickname'] = $setting['chat_nickname'] ?: 'optional';
$setting['start_home'] = $setting['start_home'] ?: 'close';
//
return Base::retSuccess('success', $setting ?: json_decode('{}'));
}
@ -417,4 +418,26 @@ class SystemController extends AbstractController
//
return $data;
}
/**
* @api {get} api/system/get/starthome 12. 获取是都开启首页信息
*
* @apiDescription 用于判断首页跳转页面
* @apiVersion 1.0.0
* @apiGroup system
* @apiName get__starthome
*
* @apiSuccess {Number} ret 返回状态码1正确、0错误
* @apiSuccess {String} msg 返回信息(错误描述)
* @apiSuccess {Object} data 返回数据
*/
public function get__starthome()
{
return Base::retSuccess('success', [
'need_start' => Base::settingFind('system', 'start_home') == 'open',
'home_footer' => Base::settingFind('system', 'home_footer')
]);
}
}

View File

@ -65,7 +65,7 @@
<img class="box-img" :src="$store.state.method.apiUrl('../images/index/box-pic1.png')" />
</div>
<div class="box-one-pic1" v-else>
</div>
<div class="box-one-tips">
<div class="box-square"></div>
@ -108,10 +108,10 @@
$L("汇集文档、电子表格、思维笔记等多种在线工具,汇聚企业知识资源于一处,支持多人实时协同编辑,让团队协作更便捷。")
}}
</div>
</div>
</div>
<div class="main-box-one">
<div class="box-one-square"></div>
@ -119,8 +119,8 @@
<img class="box-img" :src="$store.state.method.apiUrl('../images/index/box-pic3.png')" />
</div>
<div class="box-one-pic3" v-else >
</div>
</div>
<div class="box-one-tips">
<div class="box-square"></div>
<div class="box-title">
@ -162,12 +162,12 @@
$L("通过灵活的任务日历,轻松安排每一天的日程,把任务拆解到每天,让工作目标更清晰,时间分配更合理。")
}}
</div>
</div>
</div>
</div>
<div class="page-footer">
<div class="footer-service">
@ -183,9 +183,7 @@
</div>
</div>
</div>
<div class="footer-opyright">
{{ $L("桂公网安备 31011002000058号 桂ICP备12020087号-3") }}
</div>
<div class="footer-opyright" v-html="this.homeFooter"></div>
</div>
</div>
</div>
@ -196,7 +194,8 @@ export default {
data() {
return {
screenWidth: document.body.clientWidth,
needStartHome: false,
homeFooter: '',
};
},
watch: {
@ -210,17 +209,13 @@ export default {
},
},
mounted() {
// if (this.$store.state.userId > 0) {
// this.goForward({path: '/manage/dashboard'}, true);
// } else {
// this.goForward({path: '/login'}, true);
// }
this.getNeedStartHome();
const that = this;
window.onresize=()=>{
window.screenWidth=document.body.clientWidth
that.screenWidth=window.screenWidth
}
},
methods: {
@ -232,7 +227,7 @@ export default {
false
);
},
register() {
this.goForward(
{
@ -244,6 +239,24 @@ export default {
false
);
},
getNeedStartHome() {
this.$store
.dispatch("call", {
url: "system/get/starthome",
})
.then(({data}) => {
this.needStartHome = !!data.need_start;
this.homeFooter = data.home_footer;
if (this.$store.state.userId > 0) {
this.goForward({path: '/manage/dashboard'}, true);
} else if (this.needStartHome === false) {
this.goForward({path: '/login'}, true);
}
})
.catch(() => {
this.needStartHome = false;
});
},
},
deactivated() {
// this.$destroy()

View File

@ -45,6 +45,18 @@
</RadioGroup>
<div v-if="formDatum.chat_nickname == 'required'" class="form-tip">{{$L('必填发送聊天内容前必须设置昵称')}}</div>
</FormItem>
<FormItem :label="$L('是否启动首页')" prop="startHome">
<RadioGroup v-model="formDatum.start_home">
<Radio label="open">{{$L('开启')}}</Radio>
<Radio label="close">{{$L('关闭')}}</Radio>
</RadioGroup>
<template v-if="formDatum.start_home == 'open'">
<div class="form-tip">{{ $L('首页底部:首页底部网站备案号等信息') }}</div>
<Input v-model="formDatum.home_footer" style="width:100%;margin-top:6px">
<span slot="prepend">{{ $L('首页底部') }}</span>
</Input>
</template>
</FormItem>
</Form>
<div class="setting-footer">
<Button :loading="loadIng > 0" type="primary" @click="submitForm">{{$L('提交')}}</Button>