Browse Source

style: 优化网站列表描述信息显示 (#4726)

pull/4730/head
ssongliu 7 months ago committed by GitHub
parent
commit
6e635c691d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      backend/utils/files/file_op.go
  2. 8
      backend/utils/files/utils.go
  3. 1
      backend/utils/http/get.go
  4. 12
      frontend/src/views/website/website/index.vue

3
backend/utils/files/file_op.go

@ -314,6 +314,7 @@ func (f FileOp) DownloadFile(url, dst string) error {
if err != nil {
return err
}
defer resp.Body.Close()
out, err := os.Create(dst)
if err != nil {
@ -324,8 +325,6 @@ func (f FileOp) DownloadFile(url, dst string) error {
if _, err = io.Copy(out, resp.Body); err != nil {
return fmt.Errorf("save download file [%s] error, err %s", dst, err.Error())
}
out.Close()
resp.Body.Close()
return nil
}

8
backend/utils/files/utils.go

@ -3,7 +3,6 @@ package files
import (
"bufio"
"fmt"
"github.com/spf13/afero"
"io"
"net/http"
"os"
@ -12,6 +11,8 @@ import (
"strconv"
"strings"
"sync"
"github.com/spf13/afero"
)
func IsSymlink(mode os.FileMode) bool {
@ -144,8 +145,5 @@ func GetParentMode(path string) (os.FileMode, error) {
}
func IsInvalidChar(name string) bool {
if strings.Contains(name, "&") {
return true
}
return false
return strings.Contains(name, "&")
}

1
backend/utils/http/get.go

@ -43,7 +43,6 @@ func GetHttpRes(url string) (*http.Response, error) {
return nil, buserr.WithMap("ErrHttpReqFailed", map[string]interface{}{"err": err.Error()}, err)
}
}
defer resp.Body.Close()
if resp.StatusCode == 404 {
return nil, buserr.New("ErrHttpReqNotFound")
}

12
frontend/src/views/website/website/index.vue

@ -111,11 +111,12 @@
</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('website.remark')" prop="remark" min-width="120px">
<template #default="{ row }">
<MsgInfo :info="row.remark" />
</template>
</el-table-column>
<el-table-column
:label="$t('website.remark')"
prop="remark"
show-overflow-tooltip
min-width="120px"
></el-table-column>
<el-table-column
:label="$t('commons.table.protocol')"
prop="protocol"
@ -194,7 +195,6 @@ import { dateFormatSimple } from '@/utils/util';
import { MsgSuccess } from '@/utils/message';
import { useI18n } from 'vue-i18n';
import { VideoPlay, VideoPause } from '@element-plus/icons-vue';
import MsgInfo from '@/components/msg-info/index.vue';
import { GetGroupList } from '@/api/modules/group';
import { Group } from '@/api/interface/group';
import { GlobalStore } from '@/store';

Loading…
Cancel
Save