#5363 fix-5270

Merged
chenshihai merged 4 commits from fix-5270 into V20240402 1 month ago
  1. +6
    -0
      templates/repo/header.tmpl
  2. +9
    -0
      web_src/js/index.js
  3. +16
    -4
      web_src/vuepages/pages/modelmanage/components/ModelHeader.vue

+ 6
- 0
templates/repo/header.tmpl View File

@@ -25,6 +25,12 @@
<a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
<div class="divider"> / </div>
<a href="{{$.RepoLink}}">{{.DisplayName}}</a>
<i class="ri-file-copy-line clipboard poping up" id="clipboard-btn"
data-content="{{$.i18n.Tr "repo.copy"}}" data-success="{{$.i18n.Tr "repo.copied"}}"
data-variation="inverted tiny" data-clipboard-text="{{$.RepoLink}}"
data-error="{{$.i18n.Tr "repo.copied_error"}}"
style="color: #919191;font-size: 14px;vertical-align: text-bottom;display:none;cursor:pointer">
</i>
{{if .RelAvatarLink}}
{{if .IsTemplate}}
{{if .IsPrivate}}


+ 9
- 0
web_src/js/index.js View File

@@ -1479,6 +1479,15 @@ async function initRepository() {
}

// Quick start and repository home
$('.ui.huge.breadcrumb.repo-title').hover(
function () {
$(this).find('.ri-file-copy-line').show()
},
function () {
$(this).find('.ri-file-copy-line').hide()
}
)

$("#repo-clone-ssh").on("click", function () {
$(".clone-url").text($(this).data("link"));
$("#repo-clone-url").val($(this).data("link"));


+ 16
- 4
web_src/vuepages/pages/modelmanage/components/ModelHeader.vue View File

@@ -2,8 +2,15 @@
<div class="bg">
<div class="ui container">
<div class="title">
<div class="title-l">
<div class="title-l" @mouseover="hover = true" @mouseleave="hover = false">
<span>{{ modelName }}</span>
<div class="copy-btn" v-show="hover" style="margin-bottom: 5px;margin-left: 5px;">
<a href="javascript:;" class="ui poping up clipboard" id="clipboard-btn"
data-position="top center" data-variation="inverted tiny" :data-success="$t('copySuccess')"
:data-content="$t('copy')" :data-clipboard-text="modelName">
<i style="font-size:14px;color: #919191;" class="ri-file-copy-line"></i>
</a>
</div>
<img src="/img/jian.svg" v-if="model.recommend == 1">
</div>
<div class="title-r">
@@ -84,6 +91,7 @@
import CommonTipsDialog from '~/components/CommonTipsDialog.vue';
import { setModelFav, createModelNotebook } from '~/apis/modules/modelsquare';
import { lang } from '~/langs';
import { initClipboard } from '~/utils';

export default {
name: "ModelHeader",
@@ -104,7 +112,8 @@ export default {
fullscreenLoading: false,
isCanDebug: false,
loginName: 'zhoupzh',
promotePath: `tips/model/sdkcode${lang == 'zh-CN' ? '' : '_en'}.md`
promotePath: `tips/model/sdkcode${lang == 'zh-CN' ? '' : '_en'}.md`,
hover:false
};
},
methods: {
@@ -173,11 +182,14 @@ export default {
}
this.fullscreenLoading = false;
})
}
},
},
watch: {
model: {
handler(newVal) {
this.$nextTick(()=>{
initClipboard('.copy-btn .clipboard');
})
this.isCollected = newVal.isCollected;
this.collectedCount = newVal.collectedCount;
if (newVal.userName === this.loginName) {
@@ -190,7 +202,7 @@ export default {
deep: true,
},
},
mounted() { },
mounted() {},
beforeMount() {
const isLogin = !!document.querySelector('meta[name="_uid"]');
if (isLogin) {


Loading…
Cancel
Save