123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <template>
- <div class="guide-wrapper">
- <div class="top">
- <div class="title">Guided Tutorial</div>
- <div class="content">
- <div class="img-list" v-if="pageData.guideData.guideType == 'image'">
- <div class="img-item" v-for="(item, index) in pageData.guideData.guideData" :key="index">
- <img class="img" :src="item">
- </div>
- </div>
- </div>
- </div>
- <div class="bottom">
- <div class="title">
- Enter Link
- </div>
- <div class="search-input-wrapper">
- <input class="input" v-model="siteUrl" placeholder="Enter link" />
- <div class="btn" @click="confirm">
- <img :src="require('@/assets/svg/icon-tool-box-guide-arrow.svg')" alt="">
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { ref, reactive, onMounted } from "vue";
- import { checkURL } from "@/uilts/help"
- import Report from "@/log-center/log"
- import { setChromeStorage, getChromeStorage } from "@/uilts/chromeExtension"
- import { message } from "ant-design-vue";
- import { checkInputUrlInBlacklist } from "@/http/toolBoxApi";
- let siteUrl = ref('');
- let pageData = reactive({
- guideData: [],
- selectGuideApp: {}
- });
- const confirm = async () => {
- siteUrl.value = siteUrl.value.trim();
- // report
- Report.reportLog({
- pageSource: Report.pageSource.post_editor_guide_page_right,
- businessType: Report.businessType.buttonClick,
- objectType: Report.objectType.enter_url_button,
- });
- if (!checkURL(siteUrl.value)) {
- message.info('Incorrect URL entered');
- return;
- }
- let blackListRes = await checkInputUrlInBlacklist({
- params: {
- url: siteUrl.value
- }
- })
- if(blackListRes.code == 0) {
- if(blackListRes.data) {
- message.info('This site is not supported');
- return;
- }
- }
- let {list: windowList = []} = await getChromeStorage('guideAppWindowList') || {list: []};
- chrome.runtime.sendMessage({
- actionType: "CONTENT_GUIDE_APPLY_APP",
- data: {
- siteUrl: siteUrl.value,
- selectGuideApp: pageData.selectGuideApp
- }
- });
- setTimeout(() => {
- if(windowList && windowList.length) {
- for (let i = 0; i < windowList.length; i++) {
- let item = windowList[i];
- chrome.windows.remove(
- item.id,
- function () { }
- )
- };
- chrome.storage.local.remove("selectGuideApp");
- chrome.storage.local.remove("guideAppWindowList");
- }
- }, 600)
- };
- const setPageData = async () => {
- let selectGuideApp = await getChromeStorage('selectGuideApp') || {};
- pageData.selectGuideApp = selectGuideApp;
- if(selectGuideApp.guideData) {
- if(typeof selectGuideApp.guideData == 'string') {
- pageData.guideData = JSON.parse(selectGuideApp.guideData);
- } else {
- pageData.guideData = selectGuideApp.guideData
- }
- };
- }
- onMounted(() => {
- setPageData();
- })
- </script>
- <style lang="scss">
- html,
- body,
- #app {
- margin: 0 !important;
- width: 100%;
- height: 100%;
- }
- .guide-wrapper {
- width: 100%;
- height: 100%;
- .top {
- height: calc(100% - 158px);
- padding: 30px 43px;
- box-sizing: border-box;
- overflow-y: auto;
- .title {
- font-weight: 500;
- font-size: 30px;
- margin-top: 10px;
- margin-bottom: 30px;
- }
- .img-item {
- margin-bottom: 18px;
- .img {
- width: 100%;
- }
- }
- }
- .bottom {
- height: 158px;
- background: #1D9BF0;
- padding: 20px;
- box-sizing: border-box;
- .title {
- font-weight: 500;
- font-size: 20px;
- color: #fff;
- margin-top: 7px;
- margin-bottom: 18px;
- }
- .search-input-wrapper {
- width: 100%;
- height: 49px;
- background: #fff;
- border-radius: 100px;
- box-sizing: border-box;
- display: flex;
- .input {
- border: none;
- outline: none;
- border-radius: 100px;
- width: calc(100% - 49px);
- height: 100%;
- box-sizing: border-box;
- color: #636363;
- padding: 15px 20px 15px 20px;
- }
- .btn {
- width: 49px;
- height: 100%;
- background: #D2EAFC;
- display: flex;
- align-items: center;
- justify-content: center;
- border-top-right-radius: 100px;
- border-bottom-right-radius: 100px;
- cursor: pointer;
- }
- }
- }
- }
- </style>
|