This commit is contained in:
AceDataCloud committed 2022-04-05 17:27:57 +08:00
1 parent 6fa6e68dd8
commit 91a5420a76
8 files changed
+88 -9

No files matched your search

+15
View File
@@ -1,3 +1,18 @@
<template>
<router-view />
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import UserService from '@/services/user/service';
import { IUserDetailResponse } from './services/user/types';
export default defineComponent({
mounted() {
UserService.getMe().then(({ data: data }: { data: IUserDetailResponse }) => {
console.log('data', data);
this.$store.dispatch('setUser', data);
});
}
});
</script>
@@ -0,0 +1,27 @@
<template></template>
<script lang="ts">
import { defineComponent } from 'vue';
import { ElMessageBox } from 'element-plus';
export default defineComponent({
name: 'VerificationAlert',
mounted() {
ElMessageBox.alert(this.$t('auth.message.needVerification'), this.$t('common.message.info'), {
confirmButtonText: this.$t('common.button.verify'),
// cancelButtonText: this.$t('common.button.cancel'),
type: 'warning',
center: true,
showClose: false,
'show-cancel-button': false,
'close-on-click-modal': false,
'close-on-press-escape': false,
'close-on-hash-change': false
})
.then(() => {
window.open('https://auth.test.zhishuyun.com/user/verify');
})
.catch(() => {});
}
});
</script>
+3 -1
View File
@@ -1,3 +1,5 @@
export default {
scanToLogin: '使用微信扫码关注公众号「知数云」即可登录/注册'
scanToLogin: '使用微信扫码关注公众号「知数云」即可登录/注册',
needVerification: '由于您尚未完成实名认证,所以无法查看课程。',
goVerification: '去实名认证'
};
+2 -1
View File
@@ -10,5 +10,6 @@ export default {
alert: '警告',
info: '提示',
publish: '发布',
watch: '观看'
watch: '观看',
verify: '去实名认证'
};
+3 -1
View File
@@ -1,4 +1,6 @@
export default {
copied: '复制成功',
confirmDelete: '确认删除吗?'
confirmDelete: '确认删除吗?',
alert: '警告',
info: '温馨提示'
};
+21 -3
View File
@@ -1,4 +1,5 @@
<template>
<verification-alert v-if="!verified" />
<el-row>
<el-col :span="24">
<div class="wrapper">
@@ -27,7 +28,7 @@
<div class="banner"></div>
</el-col>
</el-row>
<el-row class="episodes">
<el-row :class="{ episodes: true, disabled: !verified }">
<el-col :span="14" :offset="5">
<el-card
v-for="(episode, episodeIndex) in episodes"
@@ -79,6 +80,7 @@ import { episodeService } from '@/services/episode/service';
import { IEpisode, IEpisodeListResponse } from '@/services/episode/types';
import { defineComponent } from 'vue';
import { Clock } from '@element-plus/icons-vue';
import VerificationAlert from '@/components/common/VerificationAlert.vue';
interface IData {
course: ICourse | undefined;
@@ -89,7 +91,8 @@ interface IData {
export default defineComponent({
name: 'CourseDetail',
components: {
Clock
Clock,
VerificationAlert
},
data(): IData {
return {
@@ -99,12 +102,16 @@ export default defineComponent({
};
},
computed: {
verified() {
return this.$store.getters.user.isVerified;
},
id() {
return parseInt(this.$route.params.id.toString());
}
},
async mounted() {
this.loading = true;
courseService.get(this.id).then(({ data: data }: { data: ICourseDetailResponse }) => {
this.loading = false;
this.course = data;
@@ -163,8 +170,19 @@ export default defineComponent({
height: 55px;
}
.verification-alert {
padding-top: 50px;
.go {
font-weight: bold;
}
}
.episodes {
padding: 50px;
padding: 50px 0;
&.disabled {
opacity: 0.2;
pointer-events: none;
}
.episode {
cursor: pointer;
margin-bottom: 2rem;
+13 -3
View File
@@ -3,10 +3,20 @@ import httpClient from '../instance';
import { IUserDetailResponse, IUser } from './types';
class UserService {
key = 'users';
async getMe(): Promise<AxiosResponse<IUserDetailResponse>> {
return httpClient.get('/me');
}
async get(id: string | string[]): Promise<AxiosResponse<IUserDetailResponse>> {
return httpClient.get(`/${this.key}/${id}`);
async updateMe(data: IUser): Promise<AxiosResponse<IUserDetailResponse>> {
return httpClient.put('/me', data);
}
async getVerify(): Promise<AxiosResponse<IUserDetailResponse>> {
return httpClient.get('/verify');
}
async updateVerify(data: IUser): Promise<AxiosResponse<IUserDetailResponse>> {
return httpClient.put('/verify', data);
}
}
+4
View File
@@ -15,6 +15,10 @@ export default defineConfig({
cert: fs.readFileSync('certs/academy.local.zhishuyun.com.cert.crt')
},
proxy: {
'/api/v1/me': {
target: 'https://auth.test.zhishuyun.com',
changeOrigin: true
},
'/api': {
target: 'http://localhost:8000',
changeOrigin: true