viewConfig.vue 6.01 KB
<!--
 * @Author: your name
 * @Date: 2022-02-16 18:11:11
 * @LastEditTime: 2022-04-15 14:24:00
 * @LastEditors: huyue
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \scrm-micro-wechat\src\views\appConfig\viewConfit.vue
-->

<template>
  <div class="config-container">
    <div class="container-header">
      <span>企微自建应用配置管理</span>
      <el-popover placement="bottom" width="270" trigger="hover" content="提供企微自建应用的配置管理。">
        <img src="@/assets/question.png" slot="reference" class="count-item-question" />
      </el-popover>
    </div>
    <div class="config-content">
      <div class="config-list">
        <div class="config-title">使用配置</div>
        <div class="config-item">
          <div class="item-name">应用主页:</div>
          <div class="item-url">
            <el-input type="text" id="appHome" readonly class="url-input" v-model="configUrl.appHome"></el-input>
            <span class="item-copy" @click="copyUrl('appHome')">
              复制
              <img src="@/assets/copy.png" alt="" />
            </span>
          </div>
        </div>
      </div>
      <div class="config-list">
        <div class="config-title">消息回调</div>
        <div class="config-item">
          <div class="item-name">消息回调URL:</div>
          <div class="item-url">
            <el-input type="text" id="callbackUrl" readonly class="url-input" v-model="configUrl.callbackUrl"></el-input>
            <span class="item-copy" @click="copyUrl('callbackUrl')">
              复制
              <img src="@/assets/copy.png" alt="" />
            </span>
          </div>
        </div>
        <div class="config-item">
          <div class="item-name">消息回调Token:</div>
          <div class="item-url">
            <el-input type="text" id="token" readonly class="url-input" v-model="configUrl.token"></el-input>
            <span class="item-copy" @click="copyUrl('token')">
              复制
              <img src="@/assets/copy.png" alt="" />
            </span>
          </div>
        </div>
        <div class="config-item">
          <div class="item-name">消息回调EncodingAESKey:</div>
          <div class="item-url">
            <el-input type="text" id="encodingAesKey" readonly class="url-input" v-model="configUrl.encodingAesKey"></el-input>
            <span class="item-copy" @click="copyUrl('encodingAesKey')">
              复制
              <img src="@/assets/copy.png" alt="" />
            </span>
          </div>
        </div>
      </div>
      <div class="config-list">
        <div class="config-title">应用菜单</div>
        <div class="config-item" v-for="(item, index) in configUrl.agentMenuList" :key="index">
          <div class="item-name">{{ item.name }}:</div>
          <div class="item-url">
            <el-input type="text" :id="item.name" readonly class="url-input" v-model="item.url"></el-input>
            <span class="item-copy" @click="copyUrl(item.name)">
              复制
              <img src="@/assets/copy.png" alt="" />
            </span>
          </div>
        </div>
        <!-- <div class="config-item">
          <div class="item-name">工作台:</div>
          <div class="item-url">
            <el-input type="text" readonly class="url-input" v-model="configUrl.callbackUrl"></el-input>
            http://scrm.test.glsx.com.cn/settings/account/index
            <span class="item-copy">
              复制
              <img src="@/assets/copy.png" alt="" />
            </span>
          </div>
        </div> -->
      </div>
    </div>
    <GLFooter>
      <el-button type="primary" @click="handleCancel">返回</el-button>
    </GLFooter>
  </div>
</template>

<script>
export default {
  name: 'ViewConfig',
  data() {
    return {
      appId: this.$route.params.appId,
      configUrl: {
        agentMenuList: []
      }
    }
  },
  created() {
    this.getConfig(this.appId)
  },
  methods: {
    async getConfig(appId) {
      let configData = await this.$apis.appConfig.getAgentInfo({ appId })
      this.$set(this, 'configUrl', configData)
    },
    copyUrl(id) {
      var idVal = document.getElementById(id)
      idVal.select()
      document.execCommand('copy')
      this.$message({
        message: '复制成功',
        type: 'success'
      })
    },
    handleCancel() {
      this.$router.go(-1)
    }
  }
}
</script>

<style lang="scss" scoped>
.config {
  &-container {
    margin-bottom: 64px;
  }
  &-content {
    margin-top: 20px;
    padding: 20px;
    background-color: #fff;
  }
  &-title {
    position: relative;
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    line-height: 28px;
    margin-left: 16px;
    &::before {
      content: '';
      display: inline-block;
      position: absolute;
      left: -16px;
      top: 50%;
      transform: translateY(-50%);
      width: 4px;
      height: 4px;
      background-color: #5850ff;
      border-radius: 50%;
    }
  }
  &-list {
    margin-bottom: 20px;
  }
  &-item {
    margin-top: 20px;
    margin-left: 16px;
    font-weight: 400;
    .item-name {
      line-height: 20px;
      color: #333333;
      font-size: 14px;
      margin-bottom: 10px;
    }
    .item-url {
      position: relative;
      width: 552px;
      // overflow-x: auto;
      // height: 36px;
      // border: 1px solid #dce5ed;
      font-size: 14px;
      color: #999999;
      // line-height: 36px;
      // padding: 0 8px;
    }
    .url-input {
      /deep/ {
        .el-input__inner {
          padding-right: 66px !important;
        }
      }
    }
    .item-copy {
      position: absolute;
      height: calc(100% - 2px);
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
      color: #5850ff;
      line-height: 20px;
      display: inline-flex;
      align-items: center;
      background-color: #fff;
      padding-left: 5px;
      cursor: pointer;
      img {
        margin-left: 4px;
      }
    }
  }
}
</style>

<style lang="scss">
</style>