Просмотр исходного кода

fix: 修复功能问题
1. 修复功能使用上的异常情况
2. 上传文件异常url的问题

kindring 1 год назад
Родитель
Сommit
5e72e47c7c

+ 12 - 7
README.md

@@ -33,20 +33,23 @@ yarn build
 3. 服务器安装`pm2`与`nodejs`
 4. 启动项目
 ```shell
-pm2 start npm --name "hfy" -- run start
+pm2 start npm --name "hfyWebsite" -- run start
 ```
 5. 管理项目
+查看项目列表
 ```shell
 pm2 list
 ```
 
+重启项目
+```shell
+pm2 restart hfyWebsite
+```
 
-## 注意事项
-1. 服务器`php`版本为`5.3`,请不要使用`php7`以上的版本
-2. tailwindcss 可以移除
-3. nuxt.config.js 中的 `server` 配置项可以移除
-4. 静态打包动态路由页面需要在`nuxt.config.js`中配置`generate.routes`'
+移除项目
 
+
+## 注意事项
 ## 功能新增设计
 ### 文件库功能 file_lab
 > id , 图片名称 , 图片路径 , 图片tag , 上传日期
@@ -77,7 +80,9 @@ pm2 list
 | createTime    | varchar | ''                                    | '' | 创建时间   |
 | updateTime    | varchar | ''                                    | '' | 更新时间   |
 
-
+### 类型表
+> [!tip] 该项目使用的类型因为某些历史原因分的比较散,  
+> 多个程序都使用该表单
 
 
 

+ 2 - 1
components/public/imageTable.vue

@@ -270,7 +270,8 @@ export default {
       file.showInfo_type = 'info';
       let form = new FormData();
       form.append('file',file.file);
-      this.uploadUrl += `?type=${this.fileType}`;
+      let uploadUrl = this.uploadUrl;
+      uploadUrl += `?type=${this.fileType}`;
       let [err,res] = await handle(this.$axios.post(this.uploadUrl,form,{
         onUploadProgress: (progressEvent) => {
           file.percent = Math.round((progressEvent.loaded * 100) / progressEvent.total) || 0;

+ 30 - 4
components/public/pop.vue

@@ -1,14 +1,14 @@
 <template>
 <div
-    class=" w-screen h-screen fixed left-0 top-0 z-50 flex overflow-hidden justify-center items-center"
+    class="pop-box"
     v-if="show"
 >
   <div
-      class="mask absolute left-0 top-0 w-full h-full"
+      class="pop-mask"
       v-if="mask"
   ></div>
 
-  <div class="w-full h-full flex justify-center items-center">
+  <div class="pop-content">
     <slot/>
   </div>
 
@@ -37,8 +37,34 @@ export default {
 </script>
 
 <style scoped>
-  .mask{
+  .pop-box{
+    position: fixed;
+    left: 0;
+    top: 0;
+    width: 100vw;
+    height: 100vh;
+    z-index: 50;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    overflow: hidden;
+
+  }
+  .pop-mask{
     background-color: #000;
     opacity: 0.3;
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 100%;
+    height: 100%;
+  }
+  .pop-content{
+    width: 100%;
+    height: 100%;
+    position: relative;
+    display: flex;
+    justify-content: center;
+    align-items: center;
   }
 </style>

+ 15 - 1
components/public/popCard.vue

@@ -3,7 +3,7 @@
 </script>
 
 <template>
-  <div class="w-8/12 h-5/6 p-2 rounded flex flex-col justify-center border bg-white">
+  <div class="p-card">
     <div class="p-header mx-1.5 h-16  text-2xl flex border-b items-center py-1.5">
       <div class="icon-btn-group">
         <slot name="close-group"></slot>
@@ -36,4 +36,18 @@
   display: flex;
   align-content: center;
 }
+
+.p-card{
+  position: relative;
+  width: 66%;
+  height: 83%;
+  border-radius: 0.5rem;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  background-color: #fff;
+  box-sizing: border-box;
+  padding: 0.5rem;
+}
+
 </style>

+ 1 - 0
components/search/searchBox.vue

@@ -99,6 +99,7 @@ export default {
           // 时间字段转换
           // info.subTitle = time.dateFormat(time.timeStamp_to_Date(info.loginTime),'YY-MM-DD H:m:s');
           // 展示字段转换
+          item['showText'] = item.name || item.title;
           item['innerText'] = item.showText.replace(key,`<span style="color:red;">${key}</span>`);
         }
         this.$set(this.domPlaceholder,i,{

+ 0 - 10
map/adminSideBar.js

@@ -13,16 +13,6 @@ export const adminMenus = [
         title: '展示块',
         path: '/manger/showing'
       },
-      {
-        key: 'indexProduct',
-        title: '展品管理',
-        path: '/manger/index/product'
-      },
-      {
-        key: 'indexNews',
-        title: '新闻中心管理',
-        path: '/manger/index/news'
-      },
     ]
   },
   {

+ 45 - 23
nuxt.config.js

@@ -15,7 +15,7 @@ const env = {
     },
     pro: {
       MODE: 'production',
-      ENV_API: `http://szhfy.com.cn:${serverPort}`  // 正式服务器地址
+      ENV_API: `http://127.0.0.1:${serverPort}`  // 正式服务器地址
     }
 }
 
@@ -100,48 +100,58 @@ async function seoDataLoad(){
       newsData = newsRes.data;
     if(productData.code === 1){
       let productArr = productData.data;
+      let productTypes = {}
+
       productArr.forEach(item=>{
+        productTypes[item.type_key] = item.type_key
         routes.push(
           {
-            url: `/product/info?id=${item.id}`,
+            url: `/product/info/${item.type_key}?id=${item.id}`,
             changefreq: 'daily',
-            priority: 0.9,
-          },
+            priority: 0.8,
+          }
+        );
+      })
+      for (let type_key in productTypes) {
+        routes.push(
           {
-            url: `/product/info/${item.type_key}?id=${item.id}`,
+            url: `/product/${type_key}`,
             changefreq: 'daily',
             priority: 0.9,
           }
         );
-      })
+      }
+
     }
     if(solutionData.code === 1){
       let solutionArr = solutionData.data;
+      let solutionTypes = {}
       solutionArr.forEach(item=>{
+        solutionTypes[item.type_key] = item.type_key
         routes.push(
-          {
-            url: `/solution/info?id=${item.id}`,
-            changefreq: 'daily',
-            priority: 0.8,
-          },
           {
             url: `/solution/info/${item.type_key}?id=${item.id}`,
             changefreq: 'daily',
             priority: 0.8,
           }
         );
-
       })
+      for (let type_key in solutionTypes) {
+        routes.push(
+          {
+            url: `/solution/${type_key}`,
+            changefreq: 'daily',
+            priority: 0.9,
+          }
+        );
+      }
     }
     if(newsData.code === 1){
       let newsArr = newsData.data;
+      let newsTypes = {}
       newsArr.forEach(item=>{
+        newsTypes[item.type_key] = item.type_key
         routes.push(
-          {
-            url: `/news/info?id=${item.id}`,
-            changefreq: 'daily',
-            priority: 0.7,
-          },
           {
             url: `/news/info/${item.type_key}?id=${item.id}`,
             changefreq: 'daily',
@@ -149,6 +159,15 @@ async function seoDataLoad(){
           }
         );
       })
+      for (let type_key in newsTypes) {
+        routes.push(
+          {
+            url: `/news/${type_key}`,
+            changefreq: 'daily',
+            priority: 0.9,
+          }
+        );
+      }
     }
   }
   console.log(routes);
@@ -213,12 +232,15 @@ export default {
     ],
     sitemap: [
       {
-        path: "/sitemap.xml", //生成的文件路径
-        ...seoOption,
-        routes: seoDataLoad,
-      },
-      {
-        path: "/sitemap.html", //生成的文件路径
+        hostname: "hofuniot.cn",
+        path: '/sitemap.xml',
+        exclude:[
+          "/news/info",
+          "/solution/info",
+          "/product/info"
+        ],
+        cacheTime: 1000 * 60 * 60 * 24,
+        gzip: true,
         ...seoOption,
         routes: seoDataLoad,
       }

+ 17 - 18
pages/manger/index/carousel.vue

@@ -212,7 +212,7 @@ export default defineComponent({
         this.productSearch.type.oldVal = this.productSearch.type.val;
         // data 转换
         result.data = result.data.map(item=>{
-          item.showText=item.name;
+          item.showText = item.name;
           return item;
         });
         return [null,result];
@@ -245,7 +245,7 @@ export default defineComponent({
         this.newsSearch.type.oldVal = this.newsSearch.type.val;
         // data 转换
         result.data = result.data.map(item=>{
-          item.showText=item.name;
+          item.showText = item.name;
           return item;
         });
         return [null,result];
@@ -724,24 +724,16 @@ export default defineComponent({
 <!--        选择图片 -->
         <input-row label="轮播图片"
                    :msg="form.fileData.msg">
-          <a-popover  v-model="imageSelectVisible"
-                      class="w-full"
-                     trigger="click">
-              <image-table slot="content"
-                           class="w-full h-full"
-                           @cancel="imageSelectVisible = false"
-                           @ok="okHandle"></image-table>
-
-            <div class="w-full h-60 rounded relative">
-              <image-viewer class="" :src="form.fileData.showText"></image-viewer>
-              <div class="absolute w-full h-full left-0 top-0
-              justify-center text-white bg-gray-400
-              items-center text-2xl flex opacity-0 hover:opacity-70">
-                点击选择图片
-              </div>
+
+          <div class="w-full h-60 rounded relative" @click="imageSelectVisible = true">
+            <image-viewer class="" :src="form.fileData.showText"></image-viewer>
+            <div class="absolute w-full h-full left-0 top-0
+            justify-center text-white bg-gray-400
+            items-center text-2xl flex opacity-0 hover:opacity-70">
+              点击选择图片
             </div>
+          </div>
 
-          </a-popover>
         </input-row>
       </div>
       <template class="w-full" slot="footer">
@@ -749,6 +741,13 @@ export default defineComponent({
       </template>
     </pop-card>
   </pop>
+
+  <pop :show="imageSelectVisible">
+
+    <image-table class="w-5/12 h-1/2"
+                 @cancel="imageSelectVisible = false"
+                 @ok="okHandle"></image-table>
+  </pop>
 </div>
 </template>
 

+ 1 - 1
server/control/c_news.js

@@ -223,7 +223,7 @@ async function deleteType(id) {
         eMsg: `该类型下存在文章,无法删除, 请先移除对应文章`
       }, null];
   }
-  [err, res] = await handle(d_product.deleteProductType(id));
+  [err, res] = await handle(d_news.deleteArticleType(id));
   if (err) {
     log.error('删除失败' + err.message);
     return [err, null];

+ 1 - 1
server/database/d_news.js

@@ -156,7 +156,7 @@ function editArticleType(id, typeChange) {
 
 // 删除产品类型
 function deleteArticleType(id) {
-  let sql = `DELETE FROM hfy_news_type WHERE type_id = ?`;
+  let sql = `DELETE FROM hfy_news_type WHERE type_id = ? limit 1`;
   return mysql.pq(sql, [id]);
 }
 

+ 1 - 1
server/router/r_base.js

@@ -139,7 +139,7 @@ router.post('/fileUp',checkLogin(progressField.session_hfy) ,upload({
     if(!type){
       type = req.query.type;
     }
-    // console.log(type);
+    console.log(type);
     type = typeTool.toNumber(type);
     // console.log(type);
     [err, data] = await c.uploadFile(type, files);