wenhongquan 1 year ago
parent
commit
ce86f34bcf
2 changed files with 19 additions and 5 deletions
  1. 17 3
      src/views/project/list/index.vue
  2. 2 2
      vite.config.ts

+ 17 - 3
src/views/project/list/index.vue

@@ -215,6 +215,7 @@
           layout="prev, pager, next"
           :total="totalnum"
           class="mt-4"
+          v-model:current-page="currentpage"
           @current-change="getnextdata"
         />
       </div>
@@ -434,6 +435,7 @@ import {
 import _ from "lodash";
 import {useRoute} from "vue-router";
 import useUserStore from "@/store/modules/user";
+import moment from "moment";
 
 
 const userroles = useUserStore().roles;
@@ -481,8 +483,11 @@ const totalnum = ref(0);
 
 const status = ref("0");
 
+
+
 const getnextdata = (page: number) => {
   currentpage.value = page;
+  localStorage.setItem("currentpage", page+"_"+moment().unix())
   if(route.query.status){
     searchForm.value["status"]=route.query.status;
   }else{
@@ -504,7 +509,16 @@ const getnextdata = (page: number) => {
   });
 };
 onMounted(() => {
-  getnextdata(1);
+  var tt = localStorage.getItem("currentpage")
+  if(tt!=undefined){
+    if(moment().unix()-parseInt(tt.split("_")[1])>3600){
+      currentpage.value=1;
+    }else{
+      currentpage.value = parseInt(tt.split("_")[0]);
+    }
+  }
+  console.log(currentpage.value)
+  getnextdata(currentpage.value);
 
   if(route.query.status!=undefined){
     status.value = route.query.status+""
@@ -560,7 +574,7 @@ const savecurrent = () => {
       .then((res) => {
         dialogVisible.value = false;
         ElMessage.success("新增成功");
-        getnextdata(1);
+        getnextdata(currentpage.value);
       })
       .catch((e) => {
         // dialogVisible.value = false;
@@ -572,7 +586,7 @@ const savecurrent = () => {
       .then((res) => {
         dialogVisible.value = false;
         ElMessage.success("编辑成功");
-        getnextdata(1);
+        getnextdata(currentpage.value);
       })
       .catch((e) => {
         dialogVisible.value = false;

+ 2 - 2
vite.config.ts

@@ -26,8 +26,8 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
       open: true,
       proxy: {
         [env.VITE_APP_BASE_API]: {
-          target: 'http://localhost:8080',
-          // target: 'https://filesystem.njdnyjs.com/api',
+          // target: 'http://localhost:8080',
+          target: 'https://filesystem.njdnyjs.com/api',
           changeOrigin: true,
           ws: true,
           rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), '')