auth.vue 1.19 KB
<template>
  <div class=""></div>
</template>

<script setup>
import { onMounted } from 'vue'
import { useRoute } from 'vue-router'

const $route = useRoute();

onMounted(() => {
  // php需要先跳转链接获取openid
  /**
   * encodeURIComponent() 函数可把字符串作为 URI 组件进行编码。
   * 该方法不会对 ASCII 字母和数字进行编码,也不会对这些 ASCII 标点符号进行编码: - _ . ! ~ * ' ( ) 。
   * 其他字符(比如 :;/?:@&=+$,# 这些用于分隔 URI 组件的标点符号),都是由一个或多个十六进制的转义序列替换的。
   */
  let url = encodeURIComponent(location.origin + location.pathname + $route.query.href); // 未授权的地址
  if (import.meta.env.DEV) { // TAG: 开发环境测试数据
    location.href = `/srv/?f=voice&a=openid_${$route.query.userType}&res=${url}&input_openid=${import.meta.env.VITE_OPENID}`
  } else {
    location.href = `/srv/?f=voice&a=openid_${$route.query.userType}&res=${url}`;
  }
})
</script>

<script>
import mixin from 'common/mixin';

export default {
  mixins: [mixin.init],
  data() {
    return {

    }
  },
  mounted() {

  },
  methods: {

  }
}
</script>

<style lang="less" scoped>
</style>