|
@@ -35,14 +35,21 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="card-wrapper" :style="{ 'zoom': reviewCanvasParams.zoom }">
|
|
|
- <img class="cover" :src="previewData.linkImagePath || require('@/assets/svg/img-default-site-cover.svg')" />
|
|
|
- <!-- v-if="previewData.linkImagePath && previewData.appId" <iframe class="iframe"
|
|
|
+ <img class="cover" v-if="previewData.linkImagePath && previewData.appId" :src="previewData.linkImagePath" />
|
|
|
+ <iframe class="iframe"
|
|
|
:src="previewData.convertUrl"
|
|
|
- v-else></iframe> -->
|
|
|
+ v-else></iframe>
|
|
|
|
|
|
<div class="bottom-bar">
|
|
|
<div class="site-url">DeNet.me</div>
|
|
|
- <div class="desc">Install DeNet Plugin to Participate</div>
|
|
|
+ <div class="desc">
|
|
|
+ <template v-if="previewData.appId">
|
|
|
+ {{previewData.currentApp.linkTitle}}
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ {{previewData.currentApp.defaultTit ? defaultLinkTitle : previewData.currentApp.name}}
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -58,10 +65,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, defineEmits, reactive, defineProps, onMounted, nextTick, onUnmounted } from "vue";
|
|
|
-import { postPublish } from "@/http/publishApi";
|
|
|
-import installCard from '@/view/content/tool-box/index.vue'
|
|
|
+import { ref, defineEmits, reactive, defineProps, onMounted, nextTick, onUnmounted, watch } from "vue";
|
|
|
+import { message } from "ant-design-vue";
|
|
|
|
|
|
+import installCard from '@/view/content/tool-box/index.vue'
|
|
|
+import { postPublish } from "@/http/publishApi";
|
|
|
import { getChromeStorage, setChromeStorage } from "@/uilts/chromeExtension"
|
|
|
import { getUser } from "@/http/publishApi"
|
|
|
|
|
@@ -76,17 +84,62 @@ let reviewCanvasParams = reactive({
|
|
|
});
|
|
|
let timer = ref(null);
|
|
|
|
|
|
+let loadingHide = null;
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
previewData: {
|
|
|
type: Object,
|
|
|
- default: {
|
|
|
- convertUrl: '',
|
|
|
- originUrl: '',
|
|
|
- appId: ''
|
|
|
+ default: () => {
|
|
|
+ return {
|
|
|
+ convertUrl: '',
|
|
|
+ originUrl: '',
|
|
|
+ appId: ''
|
|
|
+ }
|
|
|
}
|
|
|
+ },
|
|
|
+ screenshotWebsiteData: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {
|
|
|
+ url: '',
|
|
|
+ status: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ defaultLinkTitle: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ showCom: {
|
|
|
+ type: String,
|
|
|
+ default: 'EDITOR'
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+watch(() => props.screenshotWebsiteData,
|
|
|
+ (newVal) => {
|
|
|
+ let { appId } = props.previewData;
|
|
|
+ if(loadingHide && !appId && (newVal.url || newVal.status)) {
|
|
|
+ loadingHide();
|
|
|
+ loadingHide = null;
|
|
|
+ submitPublish();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true
|
|
|
+})
|
|
|
+
|
|
|
+watch(() => props.showCom,
|
|
|
+ (newVal) => {
|
|
|
+ if(newVal == 'EDITOR' && loadingHide) {
|
|
|
+ loadingHide();
|
|
|
+ loadingHide = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true
|
|
|
+})
|
|
|
+
|
|
|
const emits = defineEmits(["publishFinish"]);
|
|
|
|
|
|
const getUserInfo = (cb) => {
|
|
@@ -139,17 +192,36 @@ const calcPreviewCanvasParams = () => {
|
|
|
}
|
|
|
|
|
|
const publishHandler = () => {
|
|
|
- if(submitIng.value) {
|
|
|
+ let { appId } = props.previewData;
|
|
|
+ if(loadingHide) {
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if(!appId && !props.screenshotWebsiteData.url) {
|
|
|
+ loadingHide = message.loading('loading...', 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ submitPublish();
|
|
|
+}
|
|
|
+
|
|
|
+const submitPublish = () => {
|
|
|
let {convertUrl, originUrl, appId, currentApp} = props.previewData;
|
|
|
|
|
|
+ if(submitIng.value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
setHistoryData(currentApp);
|
|
|
|
|
|
+ let linkTitle = currentApp.defaultTit ? '' : currentApp.name;
|
|
|
+
|
|
|
let postBizData = {
|
|
|
convertUrl,
|
|
|
originUrl,
|
|
|
- appId
|
|
|
+ appId,
|
|
|
+ linkTitle: !appId ? linkTitle : '',
|
|
|
+ linkImagePath: props.screenshotWebsiteData.url
|
|
|
};
|
|
|
let data = {
|
|
|
params: {
|
|
@@ -168,8 +240,7 @@ const publishHandler = () => {
|
|
|
emits("publishFinish", { publishRes });
|
|
|
} else {
|
|
|
}
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
+ }).catch((err) => {
|
|
|
console.log(err);
|
|
|
});
|
|
|
}
|