Compare commits
2 Commits
1059a1f3b7
...
5def8e859a
Author | SHA1 | Date |
---|---|---|
|
5def8e859a | |
|
1d064738e1 |
42
pages.json
42
pages.json
|
@ -10,6 +10,24 @@
|
|||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/adminHome/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/adminNfc/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "nfc写入"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/adminMy/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "nfc写入"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login/login",
|
||||
"style": {
|
||||
|
@ -229,17 +247,29 @@
|
|||
"selectedIconPath": "static/tab/home_cur.png",
|
||||
"text": "首页"
|
||||
},
|
||||
// {
|
||||
// "pagePath": "pages/my/index",
|
||||
// "iconPath": "static/tab/my.png",
|
||||
// "selectedIconPath": "static/tab/my_cur.png",
|
||||
// "text": "我的"
|
||||
// },
|
||||
{
|
||||
"pagePath": "pages/user/index",
|
||||
"iconPath": "static/tab/my.png",
|
||||
"selectedIconPath": "static/tab/my_cur.png",
|
||||
"text": "设置"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/adminHome/index",
|
||||
"iconPath": "static/tab/my.png",
|
||||
"selectedIconPath": "static/tab/my_cur.png",
|
||||
"text": "首页"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/adminNfc/index",
|
||||
"iconPath": "static/tab/my.png",
|
||||
"selectedIconPath": "static/tab/my_cur.png",
|
||||
"text": "nfc写入"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/adminMy/index",
|
||||
"iconPath": "static/tab/my.png",
|
||||
"selectedIconPath": "static/tab/my_cur.png",
|
||||
"text": "我的"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view>管理员首页</view>
|
||||
<u-tabbar :list="vuex_tabbar"></u-tabbar>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { loginApi } from "@/api/apiList";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
phone: "13800451500",
|
||||
pwd: "123456",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
uni.hideLoading(); // 关闭 Loading
|
||||
},
|
||||
onLoad() {},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
height: 100vh; // 确保容器有明确高度
|
||||
// background-color: skyblue;
|
||||
overflow: hidden;
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,30 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view>管理员--我的</view>
|
||||
<u-tabbar :list="vuex_tabbar"></u-tabbar>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { loginApi } from "@/api/apiList";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
phone: "13800451500",
|
||||
pwd: "123456",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
uni.hideLoading(); // 关闭 Loading
|
||||
},
|
||||
onLoad() {},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
height: 100vh; // 确保容器有明确高度
|
||||
// background-color: skyblue;
|
||||
overflow: hidden;
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,30 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view>管理员--NFC</view>
|
||||
<u-tabbar :list="vuex_tabbar"></u-tabbar>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { loginApi } from "@/api/apiList";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
phone: "13800451500",
|
||||
pwd: "123456",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
uni.hideLoading(); // 关闭 Loading
|
||||
},
|
||||
onLoad() {},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
height: 100vh; // 确保容器有明确高度
|
||||
// background-color: skyblue;
|
||||
overflow: hidden;
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
</style>
|
|
@ -104,6 +104,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-tabbar :list="vuex_tabbar"></u-tabbar>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
|
|
|
@ -105,6 +105,7 @@
|
|||
mode="range"
|
||||
@change="changeDate"
|
||||
></u-calendar>
|
||||
<u-tabbar :list="vuex_tabbar"></u-tabbar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
</view>
|
||||
<u-button type="primary" @click="loginFn" style="margin-top: 50rpx">登陆</u-button>
|
||||
<u-button type="primary" @click="login1Fn" style="margin-top: 50rpx"
|
||||
>登陆13800451500</u-button
|
||||
>登陆13800451500管理员</u-button
|
||||
>
|
||||
<u-button type="primary" @click="login2Fn" style="margin-top: 50rpx"
|
||||
>登陆18174010562</u-button
|
||||
>登陆18174010562清洁工</u-button
|
||||
>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -40,23 +40,69 @@ export default {
|
|||
login1Fn() {
|
||||
this.phone = "13800451500";
|
||||
this.pwd = "123456";
|
||||
this.loginFn();
|
||||
|
||||
const normalTabBar = [
|
||||
{
|
||||
pagePath: "/pages/index/planList",
|
||||
iconPath: "/static/tab/list.png",
|
||||
selectedIconPath: "/static/tab/list_cur.png",
|
||||
text: "计划",
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/index/index",
|
||||
iconPath: "/static/tab/home.png",
|
||||
selectedIconPath: "/static/tab/home_cur.png",
|
||||
text: "首页",
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/user/index",
|
||||
iconPath: "/static/tab/my.png",
|
||||
selectedIconPath: "/static/tab/my_cur.png",
|
||||
text: "设置",
|
||||
},
|
||||
];
|
||||
this.$u.vuex("vuex_tabbar", normalTabBar);
|
||||
this.loginFn(false);
|
||||
},
|
||||
login2Fn() {
|
||||
this.phone = "18174010562";
|
||||
this.pwd = "123456";
|
||||
this.loginFn();
|
||||
|
||||
const adminTabBar = [
|
||||
{
|
||||
pagePath: "/pages/adminHome/index",
|
||||
iconPath: "/static/tab/list.png",
|
||||
selectedIconPath: "/static/tab/list_cur.png",
|
||||
text: "首页",
|
||||
},
|
||||
async loginFn() {
|
||||
{
|
||||
pagePath: "/pages/adminNfc/index",
|
||||
iconPath: "/static/tab/list.png",
|
||||
selectedIconPath: "/static/tab/list_cur.png",
|
||||
text: "nfc写入",
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/adminMy/index",
|
||||
iconPath: "/static/tab/list.png",
|
||||
selectedIconPath: "/static/tab/list_cur.png",
|
||||
text: "我的",
|
||||
},
|
||||
];
|
||||
this.$u.vuex("vuex_tabbar", adminTabBar);
|
||||
this.loginFn(true);
|
||||
},
|
||||
// 路径格式化方法
|
||||
normalizePath(path) {
|
||||
return path.startsWith("/") ? path : `/${path}`;
|
||||
},
|
||||
|
||||
async loginFn(type) {
|
||||
let salt = bcrypt.genSaltSync(12);
|
||||
console.log("666");
|
||||
let req = {
|
||||
phone: this.phone,
|
||||
password: bcrypt.hashSync(this.pwd, salt),
|
||||
};
|
||||
console.log(req, "req--");
|
||||
const res = await loginApi(req);
|
||||
console.log(res, "res--");
|
||||
if (!res.succeed) {
|
||||
uni.showToast({
|
||||
title: res.error || "登录失败",
|
||||
|
@ -66,16 +112,16 @@ export default {
|
|||
}
|
||||
let token = res.data;
|
||||
uni.setStorageSync("token", "Bearer " + token);
|
||||
let userRole = "admin";
|
||||
if (type) {
|
||||
uni.switchTab({
|
||||
url: "/pages/index/index",
|
||||
success() {
|
||||
console.log("跳转成功");
|
||||
window.initFn = null; // 清除全局函数
|
||||
},
|
||||
fail(err) {
|
||||
console.error("跳转失败", err);
|
||||
},
|
||||
url: `/pages/index/planList`,
|
||||
});
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: `/pages/adminHome/index`,
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-tabbar :list="vuex_tabbar"></u-tabbar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ try{
|
|||
}
|
||||
|
||||
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
|
||||
let saveStateKeys = ['vuex_user', 'vuex_token'];
|
||||
let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_tabbar'];
|
||||
|
||||
// 保存变量到本地存储中
|
||||
const saveLifeData = function (key, value) {
|
||||
|
@ -34,6 +34,26 @@ const store = new Vuex.Store({
|
|||
// 加上vuex_前缀,是防止变量名冲突,也让人一目了然
|
||||
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : { name: '明月' },
|
||||
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
|
||||
vuex_tabbar: lifeData.vuex_tabbar ? lifeData.vuex_tabbar : [
|
||||
// {
|
||||
// "pagePath": "/pages/adminHome/index",
|
||||
// "iconPath": "/static/tab/my.png",
|
||||
// "selectedIconPath": "/static/tab/my_cur.png",
|
||||
// "text": "首页"
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "/pages/adminNfc/index",
|
||||
// "iconPath": "/static/tab/my.png",
|
||||
// "selectedIconPath": "/static/tab/my_cur.png",
|
||||
// "text": "nfc写入"
|
||||
// },
|
||||
// {
|
||||
// "pagePath": "/pages/adminMy/index",
|
||||
// "iconPath": "/static/tab/my.png",
|
||||
// "selectedIconPath": "/static/tab/my_cur.png",
|
||||
// "text": "我的"
|
||||
// }
|
||||
],
|
||||
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
|
||||
vuex_version: '1.0.1',
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue