Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
hager
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-12-11 14:18:02 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1cff7b0a5419732fdc250714747b1ff5ba2d1d14
1cff7b0a
1 parent
ee32e9c8
✨ feat: 新增隐私政策联调
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
17 deletions
src/api/hager.js
src/components/privacy.vue
src/views/user/info.vue
src/views/user/register.vue
src/api/hager.js
View file @
1cff7b0
...
...
@@ -30,6 +30,7 @@ const Api = {
DOWN_EMAIL
:
'/srv/?a=down_email'
,
DOWN_ZIP
:
'/srv/?a=down_zip'
,
CONCAT
:
'/srv/?a=contact'
,
ARTICLE
:
'/srv/?a=article'
,
};
export
const
honorAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
HONOR
,
params
));
...
...
@@ -67,3 +68,4 @@ export const downEmailAPI = (params) => fn(fetch.post(Api.DOWN_EMAIL, params));
export
const
downZipAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
DOWN_ZIP
,
params
));
export
const
concatAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
CONCAT
,
params
));
export
const
getArticleAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
ARTICLE
,
params
));
...
...
src/components/privacy.vue
View file @
1cff7b0
<!--
* @Date: 2024-10-25 12:46:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-1
0-25 12:46:26
* @LastEditTime: 2024-1
2-11 14:09:28
* @FilePath: /hager/src/components/privacy.vue
* @Description: 文件描述
-->
<template>
<div class="privacy-page">
Privacy
<div v-html="content"></div>
</div>
</template>
...
...
@@ -16,6 +16,12 @@ import mixin from 'common/mixin';
export default {
mixins: [mixin.init],
props: {
content: {
type: String,
default: ''
}
},
data () {
return {
...
...
@@ -31,5 +37,7 @@ export default {
</script>
<style lang="less" scoped>
.privacy-page {
}
</style>
...
...
src/views/user/info.vue
View file @
1cff7b0
<!--
* @Date: 2024-10-18 18:00:47
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-1
0-25 13:52:46
* @LastEditTime: 2024-1
2-11 14:16:50
* @FilePath: /hager/src/views/user/info.vue
* @Description: 文件描述
-->
...
...
@@ -26,16 +26,16 @@
<div class="privacy" @click="openPrivacy"><span>隐私政策</span></div>
</div>
</div>
<el-dialog
title="隐私政策" :visible.sync="dialogVisible
">
<privacy></privacy>
<el-dialog
:title="privacyInfo.post_title" :visible.sync="dialogVisible" top="10vh" width="60%
">
<privacy
:content="privacyInfo.post_content" style="overflow: overlay; max-height: 70vh;"
></privacy>
</el-dialog>
<el-drawer
title="隐私政策
"
:title="privacyInfo.post_title
"
size="100%"
:visible.sync="drawer"
:direction="direction">
<privacy></privacy>
<privacy
:content="privacyInfo.post_content" style="padding: 1rem;"
></privacy>
</el-drawer>
</div>
</template>
...
...
@@ -45,7 +45,7 @@ import mixin from 'common/mixin';
import hagerInput from '@/components/common/hagerInput.vue';
import $ from 'jquery';
import privacy from '@/components/privacy.vue';
import { getUserInfoAPI, editUserInfoAPI } from "@/api/hager.js";
import { getUserInfoAPI, editUserInfoAPI
, getArticleAPI
} from "@/api/hager.js";
import { MessageBox, Message } from 'element-ui';
export default {
...
...
@@ -62,6 +62,10 @@ export default {
dialogVisible: false,
drawer: false,
direction: 'rtl',
privacyInfo: {
post_title: '',
content: '',
}
}
},
async mounted () {
...
...
@@ -70,8 +74,16 @@ export default {
}
// 获取用户信息
this.getUserInfo();
// 获取隐私信息
this.getPrivacyInfo();
},
methods: {
async getPrivacyInfo () {
const { code, data } = await getArticleAPI({ id: '84775' });
if (code === 1) {
this.privacyInfo = data;
}
},
async getUserInfo () {
const { code, data } = await getUserInfoAPI();
if (code === 1) { // 已登录
...
...
src/views/user/register.vue
View file @
1cff7b0
<!--
* @Date: 2024-10-18 18:00:47
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-1
0-25 13:37:44
* @LastEditTime: 2024-1
2-11 14:15:20
* @FilePath: /hager/src/views/user/register.vue
* @Description: 文件描述
-->
...
...
@@ -19,20 +19,20 @@
<div class="register-footer">
<div class="submit-btn" @click="onSubmit">提交</div>
<div class="register-subsidiary">
<div class="privacy"
@click="openPrivacy"><span
>隐私政策</span></div>
<div class="login">已有账号,<span @click="goToLogin">立即登录</span></div>
<div class="privacy"
><span @click="checkPrivacy" :class="[is_check ? 'is-check' : '']"><i class="el-icon-circle-check" style="font-size: 1rem;"></i> 我已同意</span> <span class="text" @click="openPrivacy"
>隐私政策</span></div>
<div class="login">已有账号,<span
class="text"
@click="goToLogin">立即登录</span></div>
</div>
</div>
<el-dialog
title="隐私政策" :visible.sync="dialogVisible
">
<privacy></privacy>
<el-dialog
:title="privacyInfo.post_title" :visible.sync="dialogVisible" top="10vh" width="60%
">
<privacy
:content="privacyInfo.post_content" style="overflow: overlay; max-height: 70vh;"
></privacy>
</el-dialog>
<el-drawer
title="隐私政策
"
:title="privacyInfo.post_title
"
size="100%"
:visible.sync="drawer"
:direction="direction">
<privacy></privacy>
<privacy
:content="privacyInfo.post_content" style="padding: 1rem;"
></privacy>
</el-drawer>
</div>
</template>
...
...
@@ -41,7 +41,7 @@
import mixin from 'common/mixin';
import hagerInput from '@/components/common/hagerInput.vue';
import $ from 'jquery';
import { registerAPI } from '@/api/hager';
import { registerAPI
, getArticleAPI
} from '@/api/hager';
import { MessageBox, Message } from 'element-ui';
import privacy from '@/components/privacy.vue';
...
...
@@ -58,15 +58,35 @@ export default {
dialogVisible: false,
drawer: false,
direction: 'rtl',
is_check: false,
privacyInfo: {
post_title: '',
post_content: '',
}
}
},
mounted () {
if ($('#router-view').outerHeight() < $('.user-box').height()) {
$('#router-view').height($('.user-box').outerHeight())
}
// 获取隐私信息
this.getPrivacyInfo();
},
methods: {
async getPrivacyInfo () {
const { code, data } = await getArticleAPI({ id: '84775' });
if (code === 1) {
this.privacyInfo = data;
}
},
async onSubmit () {
if (!this.is_check) {
Message({
type: 'error',
message: '请勾选同意隐私政策'
});
return;
}
if (!this.email) {
Message({
type: 'error',
...
...
@@ -107,6 +127,9 @@ export default {
} else {
this.dialogVisible = true;
}
},
checkPrivacy () {
this.is_check = !this.is_check;
}
}
}
...
...
@@ -148,15 +171,22 @@ export default {
font-size: 0.85rem;
margin-top: 1rem;
span {
&.text {
color: @primary-color;
text-decoration: underline;
font-weight: bold;
}
&.is-check {
color: @primary-color;
font-weight: bold;
}
&:hover {
cursor: pointer;
}
}
.privacy {
display: flex;
align-items: center;
}
.login {
...
...
Please
register
or
login
to post a comment