| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <template>
- <div></div>
- </template>
- <script>
- import { CheckBookPreviewIdentityCode } from '@/api/app';
- import { setToken } from '@/utils/auth';
- export default {
- name: 'EnterPage',
- data() {
- return {
- identityCode: this.$route.query.identity_code || '',
- data: {
- book_id: null,
- access_token: null,
- gcls_sys_session_info: null,
- },
- };
- },
- created() {
- this.checkIdentityCode();
- },
- methods: {
- checkIdentityCode() {
- if (!this.identityCode) {
- this.$message.error('缺少身份码参数');
- return;
- }
- CheckBookPreviewIdentityCode({ identity_code: this.identityCode })
- .then((response) => {
- this.data = response;
- setToken(response);
- if (this.isMobile()) {
- this.$router.replace({ name: 'MobileBookPreview', query: { book_id: this.data.book_id } });
- } else {
- this.$router.replace({ name: 'BookPreview', query: { book_id: this.data.book_id } });
- }
- })
- .catch(() => {});
- },
- // 判断当前是web端还是手机端
- isMobile() {
- const userAgent = navigator.userAgent || navigator.vendor || window.opera;
- return /android|iphone|ipad|ipod/i.test(userAgent);
- },
- },
- };
- </script>
- <style lang="scss" scoped></style>
|