1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <template>
- <div>
- </div>
- </template>
- <script>
- import { doAuthUser } from "@/api/accounts/ttAdapi";
- export default {
- created () {
- this.handleSubmit()
- },
- methods: {
- handleSubmit() {
- if (window.location.hash.indexOf('?') !== -1) {
- const loading = this.$loading({
- lock: true,
- text: '正在授权,请稍后。。。',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.8)'
- });
- let query = {
- auth_code: this.$route.query.auth_code,
- state: this.$route.query.state
- }
- this.loading = true
- doAuthUser(query).then(response => {
- loading.close();
- let data = response.data
- if (data) {
- this.$message({
- message: '授权成功',
- type: 'success'
- });
- localStorage.setItem("ttAdMp", "ok");
- } else {
- this.$message({
- message: '授权失败',
- type: 'error'
- });
- localStorage.setItem("ttAdMp", "false");
- return
- }
- setTimeout(()=>{
- window.close()
- }, 200)
- }).catch(() => loading.close())
- }
- }
- }
- }
- </script>
|