Skip to content

Commit

Permalink
configure the beian number (for Chinese mainland users) / 可以配置备案号
Browse files Browse the repository at this point in the history
  • Loading branch information
star7th committed Aug 19, 2021
1 parent 2dd9c2b commit 3f33c71
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ public function saveConfig(){
$home_page = intval(I("home_page")) ;
$home_item = intval(I("home_item")) ;
$oss_setting = I("oss_setting") ;
$beian = I("beian") ;
D("Options")->set("history_version_count" ,$history_version_count) ;
D("Options")->set("register_open" ,$register_open) ;
D("Options")->set("home_page" ,$home_page) ;
D("Options")->set("home_item" ,$home_item) ;
D("Options")->set("beian" ,$beian) ;

if ($oss_open) {
$this->checkComposerPHPVersion();
Expand All @@ -38,6 +40,7 @@ public function loadConfig(){
$oss_setting = D("Options")->get("oss_setting" ) ;
$home_page = D("Options")->get("home_page" ) ;
$home_item = D("Options")->get("home_item" ) ;
$beian = D("Options")->get("beian" ) ;
$ldap_form = json_decode($ldap_form,1);
$oss_setting = json_decode($oss_setting,1);

Expand All @@ -51,6 +54,7 @@ public function loadConfig(){
"history_version_count"=>$history_version_count ,
"home_page"=>$home_page ,
"home_item"=>$home_item ,
"beian"=>$beian ,
"oss_setting"=>$oss_setting ,
);
$this->sendResult($array);
Expand Down
2 changes: 2 additions & 0 deletions server/Application/Api/Controller/CommonController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ public function showCaptcha(){
public function homePageSetting(){
$home_page = D("Options")->get("home_page" ) ;
$home_item = D("Options")->get("home_item" ) ;
$beian = D("Options")->get("beian" ) ;
$array = array(
"home_page"=>$home_page ,
"home_item"=>$home_item ,
"beian"=>$beian ,
);
$this->sendResult($array);
}
Expand Down
7 changes: 5 additions & 2 deletions server/Application/Api/Model/OptionsModel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ public function get($option_name){

//
public function set($option_name,$option_value){
$sql = " replace into options (option_name , option_value ) values ('$option_name' , '$option_value')";
return $this->execute($sql);;
$return = M('options')->add(array(
"option_name"=>$option_name ,
"option_value"=>$option_value ,
),NULL,true);
return $return;
}

}
6 changes: 4 additions & 2 deletions web_src/src/components/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
}}</router-link>
</div>
<div class="copyright">
<a href="http://www.beian.miit.gov.cn/"></a>
<a href="https://beian.miit.gov.cn/">{{ beian }}</a>
</div>
</div>
</div>
Expand All @@ -204,7 +204,8 @@ export default {
height: '',
link: '',
link_text: '',
lang: ''
lang: '',
beian: ''
}
},
methods: {
Expand All @@ -221,6 +222,7 @@ export default {
var url = DocConfig.server + '/api/common/homePageSetting'
this.axios.post(url, this.form).then(response => {
if (response.data.error_code === 0) {
this.beian = response.data.data.beian
if (response.data.data.home_page == 2) {
// 跳转到登录页面
this.$router.replace({
Expand Down
21 changes: 19 additions & 2 deletions web_src/src/components/admin/setting/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
></el-option>
</el-select>
</el-form-item>

<el-form-item v-show="$lang == 'zh-cn'" label="备案号">
<el-input v-model="form.beian" class="form-el"></el-input>
<el-tooltip
class="item"
effect="dark"
content="设置后会展示在网站首页最下方"
placement="top"
>
<i class="el-icon-question"></i>
</el-tooltip>
</el-form-item>

<el-form-item :label="$t('history_version_count')">
<el-input
v-model="form.history_version_count"
Expand Down Expand Up @@ -130,7 +143,7 @@
<br />
<el-form-item>
<el-button type="primary" @click="onSubmit">{{ $t('save') }}</el-button>
<el-button>{{ $t('cancel') }}</el-button>
<el-button @click="loadConfig">{{ $t('cancel') }}</el-button>
</el-form-item>
</el-form>
</div>
Expand Down Expand Up @@ -163,7 +176,8 @@ export default {
secretId: '',
secretKey: ''
},
history_version_count: 20
history_version_count: 20,
beian: ''
},
itemList: []
}
Expand Down Expand Up @@ -208,6 +222,9 @@ export default {
this.form.oss_setting.secretKey = this.form.oss_setting.secretKey
? this.form.oss_setting.secretKey
: ''
this.form.beian = response.data.data.beian
? response.data.data.beian
: ''
} else {
this.$alert(response.data.error_message)
}
Expand Down
2 changes: 2 additions & 0 deletions web_src/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Vue.locale('en', allEnLocale)
Vue.prototype.axios = axios
Vue.prototype.request = request

Vue.prototype.$lang = DocConfig.lang // 把语言放进里面,这样组件中可以this.$lang来读取

/* eslint-disable no-new */

new Vue({
Expand Down

0 comments on commit 3f33c71

Please sign in to comment.