|
@@ -27,13 +27,14 @@
|
|
<el-button v-if="currentStep !== 3" @click="nextStep">下一步</el-button>
|
|
<el-button v-if="currentStep !== 3" @click="nextStep">下一步</el-button>
|
|
<el-button v-if="currentStep === 3" @click="acceptRecod">获取报告</el-button>
|
|
<el-button v-if="currentStep === 3" @click="acceptRecod">获取报告</el-button>
|
|
</div>
|
|
</div>
|
|
- <!-- <div class="head-content-wrap"></div> -->
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import { ref } from 'vue';
|
|
|
|
|
|
+import { ref, computed } from 'vue';
|
|
|
|
+import { useMainStore } from '../store';
|
|
|
|
+import { useRouter } from 'vue-router';
|
|
import CountrySelct from '@/components/CountrySelct.vue';
|
|
import CountrySelct from '@/components/CountrySelct.vue';
|
|
import ProductDescription from '@/components/ProductDescription.vue';
|
|
import ProductDescription from '@/components/ProductDescription.vue';
|
|
import CompetitorWebsite from '@/components/CompetitorWebsite.vue';
|
|
import CompetitorWebsite from '@/components/CompetitorWebsite.vue';
|
|
@@ -44,37 +45,94 @@ import {
|
|
analysisRival,
|
|
analysisRival,
|
|
analysisQualitative
|
|
analysisQualitative
|
|
} from '@/utils/api';
|
|
} from '@/utils/api';
|
|
|
|
+import { showMessage } from '@/utils/common';
|
|
|
|
+const mainStore = useMainStore();
|
|
|
|
+const router = useRouter();
|
|
|
|
+
|
|
|
|
+const currentStep = computed(() => mainStore.getCurrentStep);
|
|
|
|
|
|
-const currentStep = ref<number>(1);
|
|
|
|
const CountrySelctRef = ref();
|
|
const CountrySelctRef = ref();
|
|
const ProductDescriptionRef = ref();
|
|
const ProductDescriptionRef = ref();
|
|
const CompetitorWebsiteRef = ref();
|
|
const CompetitorWebsiteRef = ref();
|
|
|
|
|
|
|
|
+const validate = () => {
|
|
|
|
+ const { locationName, productName, description } = getFormData();
|
|
|
|
+ let message: string = '';
|
|
|
|
+ switch (currentStep.value) {
|
|
|
|
+ case 1:
|
|
|
|
+ if (!productName) {
|
|
|
|
+ message = '请输入产品名称';
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!locationName) {
|
|
|
|
+ message = '请选择目标区域市场';
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ if (!description) {
|
|
|
|
+ message = '请输入产品描述';
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ return message;
|
|
|
|
+};
|
|
|
|
+
|
|
const nextStep = () => {
|
|
const nextStep = () => {
|
|
- currentStep.value++;
|
|
|
|
|
|
+ const message = validate();
|
|
|
|
+ if (message) {
|
|
|
|
+ return showMessage({
|
|
|
|
+ type: 'error',
|
|
|
|
+ message
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ mainStore.setCurrentStep(currentStep.value + 1);
|
|
};
|
|
};
|
|
|
|
|
|
const prevStep = () => {
|
|
const prevStep = () => {
|
|
- currentStep.value--;
|
|
|
|
|
|
+ mainStore.setCurrentStep(currentStep.value - 1);
|
|
};
|
|
};
|
|
|
|
|
|
-const acceptRecod = () => {
|
|
|
|
|
|
+const getFormData = () => {
|
|
const locationName = CountrySelctRef.value.getLocationName();
|
|
const locationName = CountrySelctRef.value.getLocationName();
|
|
const productName = CountrySelctRef.value.getProductName();
|
|
const productName = CountrySelctRef.value.getProductName();
|
|
const description = ProductDescriptionRef.value.getDescription();
|
|
const description = ProductDescriptionRef.value.getDescription();
|
|
const competitorWebsite = CompetitorWebsiteRef.value.getWebsite();
|
|
const competitorWebsite = CompetitorWebsiteRef.value.getWebsite();
|
|
- console.log(locationName, productName, description, competitorWebsite, '-=-=-=-=');
|
|
|
|
- Promise.all([
|
|
|
|
- analysisKeyword({ productName: '自行车', locationName: 'United States' }),
|
|
|
|
- analysisSuggestions({ productName: '自行车', locationName: 'United States' }),
|
|
|
|
- analysisRival({
|
|
|
|
- competitorWebsite: 'https://www.popmart.com,https://us.louisvuitton.com/eng-us/homepage',
|
|
|
|
- locationName: 'United States'
|
|
|
|
- }),
|
|
|
|
- analysisQualitative('自行车')
|
|
|
|
- ]).then((res) => {
|
|
|
|
- console.log(res, '=========');
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
+ return {
|
|
|
|
+ locationName,
|
|
|
|
+ productName,
|
|
|
|
+ description,
|
|
|
|
+ competitorWebsite
|
|
|
|
+ };
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const acceptRecod = () => {
|
|
|
|
+ const { locationName, productName, description, competitorWebsite } = getFormData();
|
|
|
|
+ if (!competitorWebsite) {
|
|
|
|
+ return showMessage({
|
|
|
|
+ type: 'error',
|
|
|
|
+ message: '请输入竞品网站'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ router.push('/record');
|
|
|
|
+
|
|
|
|
+ // console.log(locationName, productName, description, competitorWebsite, '-=-=-=-=');
|
|
|
|
+ // Promise.all([
|
|
|
|
+ // analysisKeyword({ productName: '自行车', locationName: 'United States' }),
|
|
|
|
+ // analysisSuggestions({ productName: '自行车', locationName: 'United States' }),
|
|
|
|
+ // analysisRival({
|
|
|
|
+ // competitorWebsite: 'https://www.popmart.com,https://us.louisvuitton.com/eng-us/homepage',
|
|
|
|
+ // locationName: 'United States'
|
|
|
|
+ // }),
|
|
|
|
+ // analysisQualitative('自行车')
|
|
|
|
+ // ]).then((res) => {
|
|
|
|
+ // console.log(res, '=========');
|
|
|
|
+ // });
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -160,21 +218,6 @@ const acceptRecod = () => {
|
|
border-radius: 0;
|
|
border-radius: 0;
|
|
margin-left: 10px;
|
|
margin-left: 10px;
|
|
}
|
|
}
|
|
-
|
|
|
|
- :deep(.el-input) {
|
|
|
|
- width: 412px !important;
|
|
|
|
- height: 48px !important;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- :deep(.el-input__inner) {
|
|
|
|
- line-height: 48px;
|
|
|
|
- font-size: 16px;
|
|
|
|
- &::placeholder {
|
|
|
|
- font-weight: 400;
|
|
|
|
- font-size: 16px;
|
|
|
|
- color: rgba(40, 46, 48, 0.6);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|