Browse Source

页面调整

shuhao 1 tuần trước cách đây
mục cha
commit
fb222b020e
2 tập tin đã thay đổi với 25 bổ sung5 xóa
  1. 4 2
      src/components/fnHeader.vue
  2. 21 3
      src/views/Login.vue

+ 4 - 2
src/components/fnHeader.vue

@@ -107,11 +107,13 @@ const getGardenList = () => {
     };
     console.log('userInfo', userInfo);
     if(userInfo.userName === "游客"){
-      options.value = [{name: "从化凤二基地",organId:90264, wkt: "POINT(113.67884027228604 23.511176408307904)"}]
+      options.value = [{name: "汕尾妙荔果园",organId:43318, wkt: "POINT(115.455766 22.883073)"}]
     }else{
       VE_API.home.userGarden(params).then((res) => {
         options.value = res.data;
-        options.value.push({name: "从化凤二基地",organId:90264, wkt: "POINT(113.67884027228604 23.511176408307904)"},
+        options.value.push(
+            {name: "汕尾妙荔果园",organId:43318, wkt: "POINT(115.455766 22.883073)"},
+            {name: "从化凤二基地",organId:90264, wkt: "POINT(113.67884027228604 23.511176408307904)"},
             {name: "从化井岗基地",organId:90263, wkt: "POINT(113.5081595 23.5320866)"},
             {name: "创业果园",organId:26196, wkt: "POINT(110.4909544 21.4152538)"},
         );

+ 21 - 3
src/views/Login.vue

@@ -89,14 +89,16 @@ const rules = {
 
 const store = useStore();
 const router = useRouter();
+// 定义两个账号
+const guestAccount = { "pwd": "游客", "userName": "游客" };
+const regularAccount = { "pwd": "", "userName": "13797066447" };
 // const form = reactive({
 //   "pwd": "",
-//   // "phone": "13797066447"
 //   "userName": "13797066447"
 // });
 const form = reactive({
-  "pwd": "游客",
-  "userName": "游客"
+  "pwd": "",
+  "userName": ""
 });
 const { userName, pwd } = toRefs(form);
 const ref_form = ref(null);
@@ -105,6 +107,22 @@ sessionStorage.clear();
 store.commit(`app/${SET_TOKEN}`, "");
 router.options.isAddDynamicMenuRoutes = false;
 
+// 根据时间设置账号
+const setAccountByTime = () => {
+  const now = new Date();
+  const currentHour = now.getHours();
+
+  if (currentHour >= 18 && currentHour < 24) {
+    form.pwd = guestAccount.pwd;
+    form.userName = guestAccount.userName;
+  } else {
+    form.pwd = regularAccount.pwd;
+    form.userName = regularAccount.userName;
+  }
+};
+
+// 初始化账号
+setAccountByTime();
 
 const onSubmit = () => {
   ref_form.value.validate(async (valid) => {