Browse Source

fix: 修改首页查询问题

mnisting 8 months ago
parent
commit
ca0dc53945
5 changed files with 22 additions and 96 deletions
  1. 2 1
      .env.development
  2. 1 30
      src/views/DetailView.vue
  3. 10 13
      src/views/HomeView.vue
  4. 0 51
      src/views/mock.js
  5. 9 1
      vite.config.js

+ 2 - 1
.env.development

@@ -5,4 +5,5 @@ VITE_APP_TITLE = xxx
 VITE_APP_ENV = 'development'
 
 # 若依管理系统/开发环境
-VITE_APP_BASE_API = 'http://172.16.10.65:8080'
+# VITE_APP_BASE_API = 'http://172.16.10.61:8080'
+VITE_APP_BASE_API = '/dev-api'

+ 1 - 30
src/views/DetailView.vue

@@ -60,36 +60,6 @@
             >
               {{ breadTitle }}
             </div>
-            <!-- <template v-if="wlList.length > 0">
-              <div class="font-['PingFang-SC'] text-sm font-normal mt-10 flex">
-                <div>物料名称:</div>
-                <div class="font-['PingFang-SC'] text-sm font-normal">{{ selectMaterialName }}</div>
-              </div>
-              <div class="font-['PingFang-SC'] text-sm font-normal mt-10 flex">
-                <div class="min-w-20">物料规格:</div>
-                <div>
-                  <van-tag
-                    v-for="i in wlList"
-                    :key="i.id"
-                    :color="i.id === wlSelectId ? '#004EA2' : '#F0F0F0'"
-                    :text-color="i.id === wlSelectId ? '#FFFFFF' : '#000000'"
-                    class="m-1 h-[35px] leading-[35px] cursor-pointer"
-                    @click="changeWlCode(i)"
-                    >{{ i.specifications }}</van-tag
-                  >
-                </div>
-              </div>
-              <div class="font-['PingFang-SC'] text-sm font-normal mt-10 flex items-center">
-                <div>物料编码:</div>
-                <div>{{ selectWlCode }}</div>
-                <van-icon
-                  v-show="selectWlCode"
-                  name="description-o"
-                  class="text-[#004EA2] description-o ml-1 cursor-pointer"
-                  @click="codeCopy"
-                />
-              </div>
-            </template> -->
 
             <div class="my-8">
               <!-- 搜索表单 -->
@@ -143,6 +113,7 @@
                   class="float-right"
                   v-if="total > 0"
                   background
+                  hide-on-single-page
                   :current-page="pageNum"
                   :page-size="20"
                   :pager-count="5"

+ 10 - 13
src/views/HomeView.vue

@@ -149,7 +149,6 @@
 import { ref, computed } from 'vue'
 import useAppStore from '@/stores/app.js'
 import { getFillNums } from '@/utils'
-// import { hotToolsList } from './mock'
 import { listTools, setCommonTool, getCommonTool } from '@/api/index.js'
 import { useRoute, useRouter } from 'vue-router'
 
@@ -165,7 +164,7 @@ const device = computed(() => {
 // 搜索内容
 const searchValueRef = ref('')
 const pageNum = ref(1)
-const pageSize = ref(20)
+const pageSize = ref(2)
 // 热门工具列表
 const hotToolsRef = ref([])
 
@@ -230,14 +229,11 @@ const init = () => {
 }
 init()
 
-const resetList = () => {
-  toolsListRef.value = []
-  noneCardNum.value = 0
-}
-
 // 搜索
-const handleSearch = () => {
-  onLoad()
+const handleSearch = (pId) => {
+  toolsListRef.value = []
+  pageNum.value = 1
+  onLoad(pId)
   // 每次搜索时存一下搜索内容的次数,方便后台统计常用工具
   searchValueRef.value && setCommonTool({ toolName: searchValueRef.value })
 }
@@ -249,7 +245,7 @@ const handleKeySearch = (toolName) => {
 
 // 点击一级菜单
 const handleChangeDropdownOfType1 = (value) => {
-  resetList()
+  // resetList()
   type1ValueRef.value = value
   listTools({
     level: '2',
@@ -258,13 +254,14 @@ const handleChangeDropdownOfType1 = (value) => {
   }).then((res) => {
     typeOptions2Ref.value = res.rows
   })
-  onLoad(value)
+
+  handleSearch(value)
   type2ValueRef.value = ''
 }
 // 点击二级菜单
 const handleChangeDropdownOfType2 = (value) => {
-  resetList()
-  onLoad(value)
+  // resetList()
+  handleSearch(value)
   type2ValueRef.value = value
 }
 

+ 0 - 51
src/views/mock.js

@@ -1,51 +0,0 @@
-export const hotToolsList = [
-  {
-    id: '1',
-    name: '开口扳手头'
-  },
-  {
-    id: '2',
-    name: '气动压铆机'
-  },
-  {
-    id: '3',
-    name: '油管扳手头'
-  },
-  {
-    id: '4',
-    name: '梅开扳手'
-  },
-  {
-    id: '5',
-    name: 'L型内六角扳手'
-  }
-]
-
-export const menuList1 = [
-  { text: '手动工具', value: '1' },
-  { text: '铆接工具及配件', value: '2' },
-]
-
-export const menuList2 = [
-  { text: '全部', value: '' },
-  { text: '开口扳手头套件', value: '1_1' },
-  { text: '油管扳手头', value: '1_2' },
-  { text: '油管扳手头套件', value: '1_3' },
-  { text: '梅开扳手', value: '1_4' },
-  { text: '棘轮扳手', value: '1_5' },
-  { text: '旋转头快速脱落棘轮扳手', value: '1_6' },
-  { text: '活头棘轮扳手', value: '1_7' },
-  { text: 'T形棘轮扳手', value: '1_8' },
-]
-
-export const menuList3 = [
-  { text: '全部', value: '' },
-  { text: '铆枪', value: '2_1' },
-  { text: '气动压铆机', value: '2_2' },
-  { text: '气动拉枪', value: '2_3' },
-  { text: '手动压铆钳', value: '2_4' },
-  { text: '铆钉剪', value: '2_5' },
-  { text: '铆克', value: '2_6' },
-  { text: '顶铁', value: '2_7' },
-  { text: '环槽钉拆卸钳', value: '2_8' },
-]

+ 9 - 1
vite.config.js

@@ -34,7 +34,15 @@ export default defineConfig({
     }
   },
   server: {
-    host: true
+    host: true,
+    proxy: {
+      '/dev-api': {
+        target: 'http://172.16.10.61:8080',
+        // target: 'https://vue.ruoyi.vip/prod-api',
+        changeOrigin: true,
+        rewrite: (p) => p.replace(/^\/dev-api/, '')
+      }
+    }
   },
   //配置sass
   css: {