|
@@ -1,39 +1,33 @@
|
|
|
<script>
|
|
<script>
|
|
|
- import cache from '@/utils/cache';
|
|
|
|
|
- import {
|
|
|
|
|
- userLogin
|
|
|
|
|
- } from '@/api/common.js';
|
|
|
|
|
- import {
|
|
|
|
|
- LOGIN_TOKEN,
|
|
|
|
|
- } from '@/config/cache'
|
|
|
|
|
- export default {
|
|
|
|
|
- // 全局获取token
|
|
|
|
|
- async onLaunch(option) {
|
|
|
|
|
- // c测试数据
|
|
|
|
|
- // cache.set(LOGIN_TOKEN,'XB5TDFmqD/EFLD7Bmsfp11vkfOjrNGqvcGEnWIAIGaE=');
|
|
|
|
|
- // 登录token
|
|
|
|
|
- if (!option.query.token) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- this.$api.loading('登陆中...');
|
|
|
|
|
- const res = await userLogin({
|
|
|
|
|
- pp_token:option.query.token
|
|
|
|
|
- });
|
|
|
|
|
- this.$api.hide();
|
|
|
|
|
- let session_key= res?.session_key ?? ''
|
|
|
|
|
- cache.set(LOGIN_TOKEN,session_key);
|
|
|
|
|
- await this.$isResolve()//调用
|
|
|
|
|
- },
|
|
|
|
|
- onShow() {
|
|
|
|
|
|
|
+import cache from '@/utils/cache';
|
|
|
|
|
+import { userLogin } from '@/api/common.js';
|
|
|
|
|
+import { LOGIN_TOKEN } from '@/config/cache';
|
|
|
|
|
+export default {
|
|
|
|
|
+ // 全局获取token
|
|
|
|
|
+ async onLaunch(option) {
|
|
|
|
|
+ // c测试数据
|
|
|
|
|
+ // cache.set(LOGIN_TOKEN,'XB5TDFmqD/EFLD7Bmsfp11vkfOjrNGqvcGEnWIAIGaE=');
|
|
|
|
|
+ let token = option.query.token;
|
|
|
|
|
+ // 登录token
|
|
|
|
|
+ if (!token) {
|
|
|
|
|
+ token = 'test-token';
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
- onHide() {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.$api.loading('登陆中...');
|
|
|
|
|
+ const res = await userLogin({
|
|
|
|
|
+ pp_token: token,
|
|
|
|
|
+ });
|
|
|
|
|
+ this.$api.hide();
|
|
|
|
|
+ let session_key = res?.session_key ?? '';
|
|
|
|
|
+ cache.set(LOGIN_TOKEN, session_key);
|
|
|
|
|
+ await this.$isResolve(); //调用
|
|
|
|
|
+ },
|
|
|
|
|
+ onShow() {},
|
|
|
|
|
+ onHide() {},
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
|
- /*每个页面公共css */
|
|
|
|
|
- @import '@/styles/common.scss';
|
|
|
|
|
|
|
+/*每个页面公共css */
|
|
|
|
|
+@import '@/styles/common.scss';
|
|
|
</style>
|
|
</style>
|