Commit adecf50f authored by 何毅恒's avatar 何毅恒

同上

parent ec36f4f8
...@@ -85,6 +85,7 @@ import { ...@@ -85,6 +85,7 @@ import {
onMounted, onMounted,
getCurrentInstance, getCurrentInstance,
ComponentInternalInstance, ComponentInternalInstance,
nextTick,
} from "vue"; } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { post } from "@/api/index"; import { post } from "@/api/index";
...@@ -99,6 +100,7 @@ onMounted(() => { ...@@ -99,6 +100,7 @@ onMounted(() => {
getBanner(); getBanner();
getInformationCategory(); getInformationCategory();
}); });
const router = useRouter(); const router = useRouter();
const imgUrl = globalProperties.$img; const imgUrl = globalProperties.$img;
...@@ -118,27 +120,20 @@ const getInformationCategory = async () => { ...@@ -118,27 +120,20 @@ const getInformationCategory = async () => {
let res = await post("information/getInformationCategory"); let res = await post("information/getInformationCategory");
if (res.code == 0) { if (res.code == 0) {
categoryList.value = res.data; categoryList.value = res.data;
getSecondInformationCategory(res.data[0].id, 0);
} }
}; };
// 获取二级分类 // 获取二级分类
let firstJump = true;
const getSecondInformationCategory = async (parent_id, key) => { const getSecondInformationCategory = async (parent_id, key) => {
let res = await post("information/getInformationCategory", { parent_id }); let res = await post("information/getInformationCategory", { parent_id });
if (res.code == 0) { if (res.code == 0) {
categoryList.value[key].secondCategoryList = res.data; categoryList.value[key].secondCategoryList = res.data;
if (firstJump) {
jump(parent_id, res.data[0].id, res.data[0].cat_name);
firstJump = false;
}
} }
}; };
const toIndex = (): void => { const toIndex = (): void => {
window.location.href = "https://gelifood.com/"; window.location.href = "https://www.gelifood.com/";
}; };
const jump = (category_id_1, category_id_2, cat_name): void => { const jump = (category_id_1, category_id_2, cat_name): void => {
// console.log(111111, category_id_1, category_id_2, cat_name);
router.push( router.push(
"/pc/pcArticleList?category_id_1=" + "/pc/pcArticleList?category_id_1=" +
category_id_1 + category_id_1 +
......
...@@ -38,10 +38,10 @@ const getInformationDetail = async (id) => { ...@@ -38,10 +38,10 @@ const getInformationDetail = async (id) => {
let res = await post("Information/informationDetail", { id }); let res = await post("Information/informationDetail", { id });
if (res.code == 0) { if (res.code == 0) {
informationDetail.value = res.data; informationDetail.value = res.data;
// informationDetail.value.content = informationDetail.value.content.replace( informationDetail.value.content = informationDetail.value.content.replace(
// /\<img/gi, /\<img/gi,
// '<img style="width:100%"' '<img style="max-width:100%"'
// ); );
} }
}; };
</script> </script>
......
<template> <template>
<div id="pcArticleList"> <div id="pcArticleList">
<h6 class="rightTitle">{{ cat_name_2 }}</h6> <h6 class="rightTitle">{{ cat_name_2 || "帮助中心" }}</h6>
<ul class="rightList"> <ul class="rightList">
<li <li
class="rightItem" class="rightItem"
......
...@@ -15,6 +15,7 @@ const routes: Array<RouteRecordRaw> = [ ...@@ -15,6 +15,7 @@ const routes: Array<RouteRecordRaw> = [
component: () => component: () =>
import(/* webpackChunkName: "pcIndex" */ "@/pages/pc/index.vue"), import(/* webpackChunkName: "pcIndex" */ "@/pages/pc/index.vue"),
meta:{keepAlive: false}, meta:{keepAlive: false},
redirect:{name: 'pcArticleList'},
children:[ children:[
{ {
path: '/pc/pcArticleList', path: '/pc/pcArticleList',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment