wangxy 3 months ago
parent
commit
5771ee0101
1 changed files with 59 additions and 0 deletions
  1. 59 0
      pages/Login/index.vue

+ 59 - 0
pages/Login/index.vue

@@ -0,0 +1,59 @@
+<template>
+	<view>
+		这是登录页面 {{counter.count}}
+		<view>
+			<button type="primary" @click="setLocalData">设置缓存</button>
+			<button type="primary" @click="setPinia">设置状态</button>
+			<button type="primary" @click="goAdminShouye">去管理首页</button>
+			<button type="warn" @click="goJiaZhengShouye">去家政首页</button>
+			<button type="warn" @click="handleLogin">登录</button>
+		</view>
+	</view>
+</template>
+
+<script setup>
+import {setAuth} from "@/utils/auth.js"
+import { useCounterStore } from "@/store/counter.js"
+import * as httpApi from "@/api/login.js"
+
+const counter = useCounterStore();
+
+function goAdminShouye() {
+	uni.navigateTo({
+		url: "/pages/ShouYe/shouyeOne"
+	})
+}
+function goJiaZhengShouye() {
+	uni.navigateTo({
+		url: "/pages/ShouYe/shouyeTwo"
+	})
+}
+function setLocalData() {
+	setAuth({
+		a:1,
+		b:2,
+		c:3
+	})
+}
+
+function setPinia() {
+	counter.increment();
+	
+}
+
+function handleLogin() {
+	httpApi.getConfig().then(res => {
+		console.log('res',res.data)
+	})
+	/* httpApi.login({ 
+		userName: 'root1',
+		password: 'root'
+	}).then(res => {
+		console.log('res', res.data)
+	}) */
+}
+</script>
+
+<style lang="scss">
+
+</style>