1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <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.login({
- userName: 'root1',
- password: 'root'
- }).then(res => {
- console.log('res', res.data)
- })
- }
- </script>
- <style lang="scss">
- </style>
|