plugin-unavailable.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view v-if="pluginInfo" class="plugin-unavailable flex flex-col flex-center">
  3. <!-- 图标 -->
  4. <image class="plugin-logo" :src="pluginInfo.logo" mode="scaleToFill"></image>
  5. <!-- 名称 -->
  6. <view class="plugin-name">
  7. {{ pluginInfo.name }}
  8. </view>
  9. <view class="plugin-error">
  10. 未安装/启用插件
  11. </view>
  12. <!-- 描述 -->
  13. <view class="plugin-desc">
  14. {{ pluginInfo.desc }}
  15. </view>
  16. <view v-if="errorText" class="plugin-tip">
  17. {{errorText}}
  18. </view>
  19. <!-- 插件地址 -->
  20. <view class="plugin-url">
  21. 插件地址:{{ pluginInfo.url }}
  22. </view>
  23. <!-- 反馈按钮/复制地址 -->
  24. <view class="plugin-btns">
  25. <tm-button theme="light-blue" open-type="contact" plan text>复制地址</tm-button>
  26. <tm-button theme="light-blue">提交反馈</tm-button>
  27. </view>
  28. <view class="plugin-copyright">
  29. 提示:请确保 Halo 博客已安装相关插件
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import {
  35. NeedPluginIds,
  36. NeedPlugins,
  37. CheckNeedPluginAvailable
  38. } from "@/utils/plugin.js"
  39. import utils from '@/utils/index.js'
  40. import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
  41. export default {
  42. name: "plugin-unavailable",
  43. components: {
  44. tmButton
  45. },
  46. props: {
  47. pluginId: {
  48. type: String,
  49. default: ""
  50. },
  51. errorText: {
  52. type: String,
  53. default: ""
  54. }
  55. },
  56. data() {
  57. return {
  58. NeedPluginIds,
  59. NeedPlugins,
  60. pluginInfo: null
  61. };
  62. },
  63. created() {
  64. this.pluginInfo = NeedPlugins.get(this.pluginId)
  65. },
  66. methods: {
  67. copy() {
  68. utils.copyText(this.pluginInfo.url, "插件地址已复制")
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .plugin-unavailable {
  75. box-sizing: border-box;
  76. margin: auto;
  77. width: 80vw;
  78. padding: 100rpx 36rpx;
  79. gap: 24rpx;
  80. border-radius: 24rpx;
  81. border: 2rpx solid #E2E8F0;
  82. background-color: rgba(255, 255, 255, 0.95);
  83. box-shadow: 0 0 12rpx rgba(226, 232, 240, 0.5);
  84. backdrop-filter: blur(6rpx);
  85. font-size: 28rpx;
  86. border-top: 12rpx solid #03A9F4;
  87. }
  88. .plugin-logo {
  89. box-sizing: border-box;
  90. width: 120rpx;
  91. height: 120rpx;
  92. }
  93. .plugin-name {
  94. box-sizing: border-box;
  95. font-weight: bold;
  96. color: #333;
  97. font-size: 32rpx;
  98. }
  99. .plugin-error {
  100. box-sizing: border-box;
  101. padding: 6rpx 16rpx;
  102. border-radius: 36rpx;
  103. background-color: rgba(255, 61, 49, 0.075);
  104. color: rgba(255, 61, 49, 1);
  105. font-size: 24rpx;
  106. font-weight: bold;
  107. }
  108. .plugin-tip {
  109. box-sizing: border-box;
  110. padding: 10rpx 20rpx;
  111. border-radius: 12rpx;
  112. border: 2rpx dashed #f2c97d;
  113. color: #f0a020;
  114. font-size: 24rpx;
  115. }
  116. .plugin-desc {
  117. box-sizing: border-box;
  118. width: 60vw;
  119. font-size: 24rpx;
  120. text-align: center;
  121. color: #64748b;
  122. }
  123. .plugin-url {
  124. width: 100%;
  125. box-sizing: border-box;
  126. padding: 16rpx 24rpx;
  127. border-radius: 12rpx;
  128. background-color: #F1F5F9;
  129. color: #666;
  130. font-size: 24rpx;
  131. white-space: nowrap;
  132. overflow: hidden;
  133. text-overflow: ellipsis;
  134. }
  135. .plugin-btns {
  136. box-sizing: border-box;
  137. }
  138. .plugin-copyright {
  139. font-size: 20rpx;
  140. color: #999;
  141. transform: scale(0.9) translateY(20px);
  142. }
  143. </style>