1010 >
1111 <div
1212 class =" view-title"
13- @click =" handleNameClick"
1413 >
15- {{ picBedName }} {{ $T('SETTINGS') }}
14+ <span
15+ class =" view-title-text"
16+ @click =" handleNameClick"
17+ >
18+ {{ picBedName }} {{ $T('SETTINGS') }}</span >
1619 <el-icon
1720 v-if =" linkToLogInList.includes(picBedName)"
1821 >
1922 <Link />
2023 </el-icon >
24+ <el-button
25+ type =" primary"
26+ round
27+ size =" small"
28+ style =" margin-left : 6px "
29+ @click =" handleCopyApi"
30+ >
31+ {{ $T('UPLOAD_PAGE_COPY_UPLOAD_API') }}
32+ </el-button >
2133 </div >
2234 <config-form
2335 v-if =" config.length > 0"
@@ -95,7 +107,7 @@ import { ref, onBeforeUnmount, onBeforeMount } from 'vue'
95107import { T as $T } from ' @/i18n/index'
96108
97109// 数据发送工具函数
98- import { sendToMain , triggerRPC } from ' @/utils/dataSender'
110+ import { getConfig , sendToMain , triggerRPC } from ' @/utils/dataSender'
99111
100112// Vue Router 相关
101113import { useRoute , useRouter } from ' vue-router'
@@ -105,6 +117,7 @@ import ConfigForm from '@/components/ConfigForm.vue'
105117
106118// Electron 相关
107119import {
120+ clipboard ,
108121 ipcRenderer ,
109122 IpcRendererEvent
110123} from ' electron'
@@ -119,7 +132,7 @@ import { Link } from '@element-plus/icons-vue'
119132import dayjs from ' dayjs'
120133
121134// Element Plus 下拉菜单组件
122- import { ElDropdown } from ' element-plus'
135+ import { ElDropdown , ElMessage } from ' element-plus'
123136
124137const type = ref (' ' )
125138const config = ref <IPicGoPluginConfig []>([])
@@ -187,7 +200,7 @@ const handleReset = async () => {
187200 $router .back ()
188201}
189202
190- const linkToLogInList = [' github ' , ' tcyun ' , ' aliyun ' , ' smms ' , ' qiniu ' , ' imgur ' , ' upyun ' , ' githubPlus' ]
203+ const linkToLogInList = [' GitHub ' , ' 腾讯云COS ' , ' 阿里云OSS ' , ' SM.MS ' , ' 七牛云 ' , ' Imgur ' , ' 又拍云 ' , ' githubPlus' ]
191204
192205function handleNameClick () {
193206 switch ($route .params .type ) {
@@ -218,7 +231,26 @@ function handleNameClick () {
218231 }
219232}
220233
221- function getPicBeds (event : IpcRendererEvent , _config : IPicGoPluginConfig [], name : string ) {
234+ async function handleCopyApi () {
235+ try {
236+ const serverConfig = await getConfig <IStringKeyMap >(' settings.server' ) || {
237+ port: 36677 ,
238+ host: ' 127.0.0.1'
239+ }
240+ const { port, host } = serverConfig
241+ const uploader = await getConfig (' uploader' ) as IStringKeyMap || {}
242+ const picBedConfigList = uploader [$route .params .type as string ].configList || []
243+ const picBedConfig = picBedConfigList .find ((item : IUploaderConfigListItem ) => item ._id === $route .params .configId )
244+ const apiUrl = ` http://${host }:${port }/upload?picbed=${$route .params .type }&configName=${picBedConfig ?._configName } `
245+ clipboard .writeText (apiUrl )
246+ ElMessage .success ($T (' MANAGE_BUCKET_COPY_SUCCESS' ) + ' ' + apiUrl )
247+ } catch (error ) {
248+ console .log (error )
249+ ElMessage .error (' Copy failed' )
250+ }
251+ }
252+
253+ function getPicBeds (_event : IpcRendererEvent , _config : IPicGoPluginConfig [], name : string ) {
222254 config .value = _config
223255 picBedName .value = name
224256}
@@ -245,7 +277,7 @@ export default {
245277 height 100%
246278 overflow-y auto
247279 overflow-x hidden
248- .view-title
280+ .view-title-text
249281 & :hover
250282 cursor pointer
251283 color #40 9E FF
0 commit comments