| | |
| | | })
|
| | | })
|
| | | },
|
| | | TideLogin({ commit }, code) {
|
| | | TideLogin(code) {
|
| | | return new Promise((resolve, reject) => {
|
| | | tideLogin(code)
|
| | | .then((res) => {
|
| | | setToken(res.token);
|
| | | commit("SET_TOKEN", res.token);
|
| | | this.token = res.token
|
| | | Vue.prototype.uploadHeader = {
|
| | | Authorization: "Bearer " + res.token,
|
| | | };
|
| | |
| | | <template> |
| | | <div></div> |
| | | </template> |
| | | <script> |
| | | import store from "@/store"; |
| | | export default { |
| | | data() { |
| | | return {} |
| | | }, |
| | | created() { |
| | | this.goLogin() |
| | | }, |
| | | computed: {}, |
| | | methods: { |
| | | goLogin() { |
| | | store.dispatch('TideLogin', {code : this.$route.query.code}).then(() => { |
| | | this.$router.push({ path: this.redirect || "/" }).catch(() => { }); |
| | | }) |
| | | } |
| | | } |
| | | <script setup> |
| | | import useUserStore from '@/store/modules/user' |
| | | const userStore = useUserStore() |
| | | let { proxy } = getCurrentInstance() |
| | | function goLogin() { |
| | | userStore.TideLogin({code : proxy.$route.query.code}).then(() => { |
| | | proxy.$router.push({ path: redirect || "/" }).catch(() => { }); |
| | | }) |
| | | } |
| | | goLogin() |
| | | </script> |
| | | <style scoped></style> |