瀏覽代碼

新闻中心调试

kindring 2 年之前
父節點
當前提交
c7f62cfbdb

+ 1 - 0
assets/icons/svg/company.svg

@@ -0,0 +1 @@
+<svg t="1682047999712" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2748" width="200" height="200"><path d="M597.479619 154.063238V852.358095h52.150857v-1.024l120.295619 0.024381V441.051429l-120.295619-41.862096v-78.506666l169.252572 58.855619a56.32 56.32 0 0 1 25.795047 42.959238l0.170667 4.388571V852.358095H902.095238V926.47619H121.904762v-74.093714h56.953905v-566.613333c0-19.456 10.166857-37.546667 26.843428-47.85981l304.444953-131.705904c38.034286-23.503238 87.332571 3.510857 87.332571 47.859809z m-74.922667 27.623619L253.805714 297.959619v553.447619h268.751238V542.183619l-0.487619 0.195048V508.099048l0.487619 1.170285v-142.555428l-0.487619 0.195047v-34.133333l0.487619 1.097143V181.686857zM471.771429 482.816v80.14019l-167.107048 68.217905v-80.14019l167.107048-68.217905z m0-175.225905v80.481524l-167.107048 70.314667V377.904762l167.107048-70.290286z" p-id="2749"></path></svg>

+ 1 - 0
assets/icons/svg/information.svg

@@ -0,0 +1 @@
+<svg t="1682048125210" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5299" width="200" height="200"><path d="M273.066667 347.2384l477.866667 0 0 34.133333-477.866667 0 0-34.133333Z" p-id="5300"></path><path d="M273.066667 498.926933l477.866667 0 0 34.133333-477.866667 0 0-34.133333Z" p-id="5301"></path><path d="M273.066667 650.683733l477.866667 0 0 34.133333-477.866667 0 0-34.133333Z" p-id="5302"></path><path d="M273.066667 802.372267l477.866667 0 0 34.133333-477.866667 0 0-34.133333Z" p-id="5303"></path><path d="M819.2 102.4l-125.166933 0L694.033067 0l-34.133333 0 0 102.4-292.6592 0L367.240533 0l-34.133333 0 0 102.4L204.8 102.4C167.1168 102.4 136.533333 132.983467 136.533333 170.666667l0 785.066667c0 37.6832 30.583467 68.266667 68.266667 68.266667l614.4 0c37.6832 0 68.266667-30.583467 68.266667-68.266667L887.466667 170.666667C887.466667 132.983467 856.8832 102.4 819.2 102.4zM853.333333 955.733333c0 18.875733-15.2576 34.133333-34.133333 34.133333L204.8 989.866667c-18.875733 0-34.133333-15.2576-34.133333-34.133333L170.666667 170.666667c0-18.875733 15.2576-34.133333 34.133333-34.133333l128.3072 0 0 79.6672 34.133333 0L367.240533 136.533333l292.6592 0 0 79.6672 34.133333 0L694.033067 136.533333 819.2 136.533333c18.875733 0 34.133333 15.2576 34.133333 34.133333L853.333333 955.733333z" p-id="5304"></path></svg>

文件差異過大導致無法顯示
+ 0 - 0
assets/icons/svg/product.svg


+ 108 - 0
components/newsTypes.vue

@@ -0,0 +1,108 @@
+<template>
+  <div class="content">
+    <div class="conBox big-title">
+      <span>
+        {{lang===langType.cn?"新闻中心":getAbbrText("新闻中心")}}
+      </span>
+      <div class="hr"></div>
+    </div>
+    <div class="conBox product-type">
+      <p
+        v-for="(item,i) in types"
+        :key="item.key"
+        :class="`type-item ${item.key===type?'type-selected':''}`"
+        @click="selectType(item.key)"
+      >
+        <span class="icon-box">
+          <svg-icon :icon-class="item.icon"/>
+        </span>
+        <span class="type-name">{{lang===langType.cn?item.title:getAbbrText(item.title)}}</span>
+      </p>
+    </div>
+  </div>
+</template>
+
+<script>
+import langMap from "@/map/langMap";
+import {sTypes} from "~/map/newMap";
+
+export default {
+  name: "newsTypes",
+  props: {
+    lang:{
+      default: langMap.lang.cn
+    },
+    type:{
+      default: 'all'
+    }
+  },
+  data(){
+    return {
+      langType: langMap.lang,
+      types: sTypes
+    }
+  },
+  methods:{
+    getLangText(str) {
+      return langMap.getText(this.lang, str);
+    },
+    getAbbrText(str) {
+      return langMap.getAbbrText(this.lang, str);
+    },
+    selectType(nextType){
+      console.log(nextType)
+      if (this.type === nextType){
+        return 0;
+      }
+      this.$root.$emit('changeNewsType',nextType);
+    }
+  }
+}
+</script>
+
+<style scoped>
+.content{
+  cursor: default;
+}
+.content .big-title{
+  margin-top: 10px;
+  margin-bottom: 30px;
+}
+.product-type{
+  height: 120px;
+  display: grid;
+  grid-template-columns: repeat(4,1fr);
+}
+
+.product-type .type-item{
+  width: auto;
+  height: 100%;
+  cursor: pointer;
+}
+.product-type .type-item:hover{
+  color: orangered;
+}
+.content .product-type .type-selected{
+  color: #f88330;
+}
+.product-type .type-item .icon-box{
+  width: 100%;
+  height: 50px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 4rem;
+  padding-bottom: 20px;
+}
+.content .product-type .type-selected .icon-box{
+  border-bottom: 1px solid deepskyblue;
+}
+.product-type .type-item .type-name{
+  width: 100%;
+  height: 60px;
+  font-size: 1.3rem;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+</style>

+ 4 - 1
components/solutionList.vue

@@ -39,6 +39,9 @@ export default {
       default(){
       default(){
         return []
         return []
       }
       }
+    },
+    parentType: {
+      default: 'solution'
     }
     }
   },
   },
   data(){
   data(){
@@ -59,7 +62,7 @@ export default {
       if(solution.sourceType === "1"){
       if(solution.sourceType === "1"){
         url = solution.source;
         url = solution.source;
       }else{
       }else{
-        url = `/solution/item/${solution.type_key}?id=${solution.id}`
+        url = `/${this.parentType}/item/${solution.type_key}?id=${solution.id}`
       }
       }
       window.location.href = url;
       window.location.href = url;
     }
     }

+ 33 - 5
map/newMap.js

@@ -1,22 +1,50 @@
 export const newsType = {
 export const newsType = {
   solution: {
   solution: {
     val: 1,
     val: 1,
-    title: '解决方案'
+    title: '解决方案',
+    icon: 'solution',
+    subText: '专业化的解决方案,成熟,稳定'
   },
   },
   companyNews: {
   companyNews: {
     val: 2,
     val: 2,
-    title: '公司动态'
+    title: '公司动态',
+    icon: 'company',
+    subText: '公司动态,关于公司的特殊公告'
   },
   },
   caseShow: {
   caseShow: {
     val: 3,
     val: 3,
-    title: '案例展示'
+    title: '产品应用',
+    icon: 'product',
+    subText: '合方圆产品使用案例'
   },
   },
   industryNews: {
   industryNews: {
     val: 4,
     val: 4,
-    title: '行业资讯'
+    title: '行业资讯',
+    icon: 'information',
+    subText: '相关行业资讯,'
   },
   },
 }
 }
-
+export const sTypes = [
+  {
+    key: 'all',
+    icon: 'all',
+    title: '全部资讯'
+  },
+  {
+    key: 'com',
+    ...newsType.companyNews
+  },
+  {
+    key: 'pa',
+    ...newsType.caseShow
+  },
+  {
+    key: 'in',
+    ...newsType.industryNews
+  },
+]
+// Product Applications (PA)
+// 英文名称:Company News 缩写:CN
 export function getNewsTypeStr(val){
 export function getNewsTypeStr(val){
   let keys = Object.keys(newsType);
   let keys = Object.keys(newsType);
   let itemKey = keys.find(key=>newsType[key].val === val);
   let itemKey = keys.find(key=>newsType[key].val === val);

+ 3 - 3
pages/news/index.vue

@@ -2,8 +2,8 @@
   <div class="content">
   <div class="content">
     <lucency-header :lang="lang" page-key="news" />
     <lucency-header :lang="lang" page-key="news" />
     <item-banner :lang="lang" :title="`新闻中心`" :sub-title="`行业资讯,高新技术一应俱全`"/>
     <item-banner :lang="lang" :title="`新闻中心`" :sub-title="`行业资讯,高新技术一应俱全`"/>
-    <solution-types :lang="lang" :type="type"></solution-types>
-    <solution-list :lang="lang" :solution-list="news"></solution-list>
+    <news-types :lang="lang" :type="type"></news-types>
+    <solution-list :lang="lang" :solution-list="news" :parent-type="'news'"></solution-list>
     <page-select :page="page" :count="nowCount" :total="nowTotal"></page-select>
     <page-select :page="page" :count="nowCount" :total="nowTotal"></page-select>
 
 
     <default-footer :lang="lang"/>
     <default-footer :lang="lang"/>
@@ -65,7 +65,7 @@ export default {
   },
   },
   mounted() {
   mounted() {
     this.$root.$on('changeLang',this.switchLang);
     this.$root.$on('changeLang',this.switchLang);
-    this.$root.$on('changeNewType',this.selectType);
+    this.$root.$on('changeNewsType',this.selectType);
     this.$root.$on('changePage',this.changePageHandle);
     this.$root.$on('changePage',this.changePageHandle);
     // this.$root.$on('changeProductType',this.selectType);
     // this.$root.$on('changeProductType',this.selectType);
     const queryData = {};
     const queryData = {};

+ 3 - 3
phpAPi/getSolutionPage.php

@@ -11,7 +11,7 @@ $offset = ($page - 1) * $limit;
 
 
 header('Content-Type:text/json;charset=utf-8;');
 header('Content-Type:text/json;charset=utf-8;');
 //echo "param:" . $key . "-" . $type . "-" . $limit . "-" . $offset . "   ";
 //echo "param:" . $key . "-" . $type . "-" . $limit . "-" . $offset . "   ";
-
+$parent_type = isset($p_parent_type) ? $p_parent_type : 1;
 try {
 try {
   $resObj = array(
   $resObj = array(
     'rcode' => Rcode_OK,
     'rcode' => Rcode_OK,
@@ -27,13 +27,13 @@ try {
     // 无条件全选
     // 无条件全选
     if (!empty($key)) {
     if (!empty($key)) {
 //      echo " \n php is low \n";
 //      echo " \n php is low \n";
-      $sql = "SELECT count(*) as total  FROM mysql85931094_db.hfy_news as news  where news.title like '".$key."'";
+      $sql = "SELECT count(*) as total  FROM mysql85931094_db.hfy_news as news , mysql85931094_db.hfy_news_type as n_type where news.type_id = n_type.type_id and n_type.parent_type = '.$parent_type.' and news.title like '".$key."'";
       $stmt = mysqli_prepare($conn, $sql);
       $stmt = mysqli_prepare($conn, $sql);
       mysqli_stmt_bind_param($stmt, "s", $key);
       mysqli_stmt_bind_param($stmt, "s", $key);
     } else {
     } else {
 //      echo " \n fuck php  \n";
 //      echo " \n fuck php  \n";
       $sql = 'SELECT count(*) as total
       $sql = 'SELECT count(*) as total
-FROM mysql85931094_db.hfy_news as news  ';
+FROM mysql85931094_db.hfy_news as news , mysql85931094_db.hfy_news_type as n_type where news.type_id = n_type.type_id and n_type.parent_type = '.$parent_type.' ';
       $stmt = mysqli_prepare($conn, $sql);
       $stmt = mysqli_prepare($conn, $sql);
 //      mysqli_stmt_bind_param($stmt, "");
 //      mysqli_stmt_bind_param($stmt, "");
     }
     }

+ 5 - 0
phpAPi/searchNews.php

@@ -0,0 +1,5 @@
+<?php
+global $p_parent_type;
+$p_parent_type = 2;
+include "searchSolution.php"
+?>

+ 4 - 2
phpAPi/searchSolution.php

@@ -15,6 +15,8 @@ $resObj = array(
   'data' => "",
   'data' => "",
   'msg' => 'ok'
   'msg' => 'ok'
 );
 );
+$parent_type = isset($p_parent_type) ? $p_parent_type : 1;
+//echo $parent_type;
 try {
 try {
 
 
   set_time_limit(50);
   set_time_limit(50);
@@ -28,12 +30,12 @@ try {
 //      echo " \n php is low \n";
 //      echo " \n php is low \n";
       $sql = 'SELECT news.id,news.remark,news.title as name,news.image,news.source,news.sourceType,n_type.type_key
       $sql = 'SELECT news.id,news.remark,news.title as name,news.image,news.source,news.sourceType,n_type.type_key
 FROM mysql85931094_db.hfy_news as news  , mysql85931094_db.hfy_news_type as n_type
 FROM mysql85931094_db.hfy_news as news  , mysql85931094_db.hfy_news_type as n_type
-where news.type_id = n_type.type_id and news.title like \''.$key.'\' order by news.id desc limit ?,?';
+where news.type_id = n_type.type_id and n_type.parent_type = '.$parent_type.' and news.title like \''.$key.'\' order by news.id desc limit ?,?';
     } else {
     } else {
 //      echo " \n fuck php  \n";
 //      echo " \n fuck php  \n";
       $sql = 'SELECT news.id,news.remark,news.title as name,news.image,news.source,news.sourceType,n_type.type_key
       $sql = 'SELECT news.id,news.remark,news.title as name,news.image,news.source,news.sourceType,n_type.type_key
 FROM mysql85931094_db.hfy_news as news , mysql85931094_db.hfy_news_type as n_type
 FROM mysql85931094_db.hfy_news as news , mysql85931094_db.hfy_news_type as n_type
-where news.type_id = n_type.type_id order by news.id desc  limit ?,?';
+where news.type_id = n_type.type_id and n_type.parent_type = '.$parent_type.' order by news.id desc  limit ?,?';
 
 
     }
     }
     $stmt = mysqli_prepare($conn, $sql);
     $stmt = mysqli_prepare($conn, $sql);

部分文件因文件數量過多而無法顯示