<template>
  <a-textarea v-model="exText" disabled :auto-size="true" />
</template>

<script>
import components from './_import-components/sd-access-explanation-import'

export default {
  name: 'SdAccessExplanation',
  components,
  props: {
    code: {
      type: String,
      default: undefined,
    },
    secret: {
      type: String,
      default: undefined,
    },
  },
  data() {
    return {}
  },
  computed: {
    exText() {
      const text = `对接方式说明：

      1 第三方系统申请令牌
      申请token接口：http://ip:port/contextPath/api/we-open/v1/wethirdpartysystemlogin/getToken
      请求方法：POST
      请求参数：{
                         "appId":"${this.code}",
                         "appSecret":"${this.secret}",
                         "userAccount":"配置的系统用户"
                        }
      响应结果：{
                         "expires_refresh":刷新令牌有效期,
                         "expires_in":令牌有效期,
                         "access_token":"令牌",
                         "refresh_token":"刷新令牌"
                        }

      2 第三方系统调用业务接口 请求头中携带token;Authorization: Bearer {access_token}

      3 第三方系统通过刷新令牌更换令牌
      刷新token接口：http://ip:port/contextPath/api/refresh
      请求方法：POST(headers: { 'content-type': 'application/json' })
      请求参数：token={refresh_token}
      响应结果：{
                         "expires_refresh":刷新令牌有效期,
                         "expires_in":令牌有效期,
                         "access_token":"令牌",
                         "refresh_token":"刷新令牌"
                        }`
      return text
    },
  },
  methods: {},
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
