diff --git a/src/components/card/index.component.ts b/src/components/card/index.component.ts index 08e1e157fb1a8235cbef09068f87426908787031..390bb73289790e351390c1b45442b62376cf175e 100644 --- a/src/components/card/index.component.ts +++ b/src/components/card/index.component.ts @@ -1,7 +1,7 @@ // Copyright @ 2018-2021 xiejiahe. All rights reserved. MIT license. // See https://github.com/xjh22222228/nav -import { Component, OnInit, Input, ChangeDetectionStrategy } from '@angular/core' +import { Component, OnInit, Input } from '@angular/core' import { NzMessageService } from 'ng-zorro-antd/message' import { getToken } from '../../utils/user' import { setWebsiteList, copyText, deleteByWeb, getTextContent, updateByWeb } from '../../utils' @@ -15,7 +15,6 @@ const tagMap: ITagProp = (__tag as any).default selector: 'app-card', templateUrl: './index.component.html', styleUrls: ['./index.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, }) export class CardComponent implements OnInit { @Input() dataSource: INavFourProp diff --git a/src/utils/http.ts b/src/utils/http.ts index 9b6c14d7277e641de8669520c7ecb278bf4a0351..c09d844e61d6ed8b8641d2db7ad1e8c5cf6ee33a 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -1,13 +1,10 @@ // Copyright @ 2018-2021 xiejiahe. All rights reserved. MIT license. -import axios, { AxiosError } from 'axios' +import axios from 'axios' import { getToken } from '../utils/user' -function handleError(error: AxiosError) { -} - const httpInstance = axios.create({ - timeout: 60000, + timeout: 60000 * 3, baseURL: 'https://api.github.com' }) const token = getToken() @@ -22,7 +19,6 @@ httpInstance.interceptors.request.use(function (config) { return config }, function (error) { - handleError(error) return Promise.reject(error) }) @@ -31,7 +27,6 @@ httpInstance.interceptors.response.use(function (res) { return res }, function (error) { - handleError(error) return Promise.reject(error) }) diff --git a/src/utils/index.ts b/src/utils/index.ts index 44cac2000f865adff6caf87e2d866aec1f32e954..9e1a630f717bd00d5ba12618966bdd89d5cae9db 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -320,9 +320,9 @@ export async function getLogoUrl(url: string): Promise { } } -export function copyText(el: any, text: string): Promise { - const target = el.target - const ranId = 'copy-' + randomInt(99999999) +export function copyText(el: Event, text: string): Promise { + const target = el.target as Element + const ranId = `copy-${Date.now()}` target.id = ranId target.setAttribute('data-clipboard-text', text) @@ -330,13 +330,11 @@ export function copyText(el: any, text: string): Promise { const clipboard = new Clipboard(`#${ranId}`) clipboard.on('success', function() { clipboard?.destroy?.() - target.removeAttribute('id') resolve(true) }); clipboard.on('error', function() { clipboard?.destroy?.() - target.removeAttribute('id') resolve(false) }); })