后台管理系统接口怎么填?

<script>

import { Storage } from '@/app/storage';

import moment from 'moment';

import isBase64 from '@/app/utils/base64';

import ByPassword from './ByPassword.vue';

import ByPhone from './ByPhone.vue';

 

export default {

  components: {

    ByPassword,

    ByPhone,

  },

  data() {

    return {

      activeTabKey: 'by-password',

      btnDisabled: true,

      redirectUrl: '',

    };

  },

 

  created() {

    let redirectUrl = window.decodeURIComponent(this.$route.query.from);

    if (isBase64(redirectUrl)) {

      redirectUrl = window.atob(redirectUrl);

    }

    this.redirectUrl = redirectUrl.indexOf('http') === 0 ? redirectUrl : 'http://xx.com/login';

  },

 

  mounted() {

    // const storage = Storage.getInstance();

    const now = moment();

    console.log(now.add(12).format('x'));

    console.log(moment().format('x'));

    // Storage.getInstance().setItem(Storage.keys.TOKEN, '123456', [10, 'seconds']);

    console.log(Storage.getInstance().getItem(Storage.keys.TOKEN));

  },

 

  methods: {

    handleTabClick(key) {

      this.activeTabKey = key;

    },

    handleLoginClick() {

      if (this.activeTabKey === 'by-password') {

        const formVal = this.$refs.passwordPane.getValue();

        if (formVal && formVal.validated.value) {

          this.loginByPassword().then(() => {

            window.location.href = this.redirectUrl || '/';

          }).catch(() => {

            this.$message.error(err);

          });

          return true;

        }

        this.$message.error(formVal.validated.message);

      } else if (this.activeTabKey === 'by-phone') {

        console.log('phone');

      }

      return false;

    },

 

    loginByPassword() {

      return new Promise((resolve, reject) => {

        const result = parseInt(Math.random() * 100, 10);

 

        if (result % 2 === 1) {

          resolve();

        } else {

          reject();

        }

      });

    },

 

    handlePaneChange(val) {

      this.btnDisabled = !val.validated.value;

    },

  },

};

</script>

参考如下:

import {  logout,  getTestInfo } from "@/api/login";

login.js是接口文件

logout,getTestInfo是接口函数。

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632

非常感谢您使用有问必答服务,为了后续更快速的帮您解决问题,现诚邀您参与有问必答体验反馈。您的建议将会运用到我们的产品优化中,希望能得到您的支持与协助!

速戳参与调研>>>https://t.csdnimg.cn/Kf0y