Merge branch 'main' of http://sl.vrgon.com:3000/LuYaShi/InspectionCleaning
This commit is contained in:
commit
6cea5b7602
42
pages.json
42
pages.json
|
@ -10,6 +10,24 @@
|
||||||
"navigationBarTitleText": ""
|
"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",
|
"path": "pages/login/login",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -229,17 +247,29 @@
|
||||||
"selectedIconPath": "static/tab/home_cur.png",
|
"selectedIconPath": "static/tab/home_cur.png",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// "pagePath": "pages/my/index",
|
|
||||||
// "iconPath": "static/tab/my.png",
|
|
||||||
// "selectedIconPath": "static/tab/my_cur.png",
|
|
||||||
// "text": "我的"
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
"pagePath": "pages/user/index",
|
"pagePath": "pages/user/index",
|
||||||
"iconPath": "static/tab/my.png",
|
"iconPath": "static/tab/my.png",
|
||||||
"selectedIconPath": "static/tab/my_cur.png",
|
"selectedIconPath": "static/tab/my_cur.png",
|
||||||
"text": "设置"
|
"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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-tabbar :list="vuex_tabbar"></u-tabbar>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
mode="range"
|
mode="range"
|
||||||
@change="changeDate"
|
@change="changeDate"
|
||||||
></u-calendar>
|
></u-calendar>
|
||||||
|
<u-tabbar :list="vuex_tabbar"></u-tabbar>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
</view>
|
</view>
|
||||||
<u-button type="primary" @click="loginFn" style="margin-top: 50rpx">登陆</u-button>
|
<u-button type="primary" @click="loginFn" style="margin-top: 50rpx">登陆</u-button>
|
||||||
<u-button type="primary" @click="login1Fn" style="margin-top: 50rpx"
|
<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"
|
<u-button type="primary" @click="login2Fn" style="margin-top: 50rpx"
|
||||||
>登陆18174010562</u-button
|
>登陆18174010562清洁工</u-button
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
@ -40,23 +40,69 @@ export default {
|
||||||
login1Fn() {
|
login1Fn() {
|
||||||
this.phone = "13800451500";
|
this.phone = "13800451500";
|
||||||
this.pwd = "123456";
|
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() {
|
login2Fn() {
|
||||||
this.phone = "18174010562";
|
this.phone = "18174010562";
|
||||||
this.pwd = "123456";
|
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);
|
let salt = bcrypt.genSaltSync(12);
|
||||||
console.log("666");
|
|
||||||
let req = {
|
let req = {
|
||||||
phone: this.phone,
|
phone: this.phone,
|
||||||
password: bcrypt.hashSync(this.pwd, salt),
|
password: bcrypt.hashSync(this.pwd, salt),
|
||||||
};
|
};
|
||||||
console.log(req, "req--");
|
|
||||||
const res = await loginApi(req);
|
const res = await loginApi(req);
|
||||||
console.log(res, "res--");
|
|
||||||
if (!res.succeed) {
|
if (!res.succeed) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.error || "登录失败",
|
title: res.error || "登录失败",
|
||||||
|
@ -66,16 +112,16 @@ export default {
|
||||||
}
|
}
|
||||||
let token = res.data;
|
let token = res.data;
|
||||||
uni.setStorageSync("token", "Bearer " + token);
|
uni.setStorageSync("token", "Bearer " + token);
|
||||||
|
let userRole = "admin";
|
||||||
|
if (type) {
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: "/pages/index/index",
|
url: `/pages/index/planList`,
|
||||||
success() {
|
|
||||||
console.log("跳转成功");
|
|
||||||
window.initFn = null; // 清除全局函数
|
|
||||||
},
|
|
||||||
fail(err) {
|
|
||||||
console.error("跳转失败", err);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
uni.switchTab({
|
||||||
|
url: `/pages/adminHome/index`,
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-tabbar :list="vuex_tabbar"></u-tabbar>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ try{
|
||||||
}
|
}
|
||||||
|
|
||||||
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
|
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
|
||||||
let saveStateKeys = ['vuex_user', 'vuex_token'];
|
let saveStateKeys = ['vuex_user', 'vuex_token', 'vuex_tabbar'];
|
||||||
|
|
||||||
// 保存变量到本地存储中
|
// 保存变量到本地存储中
|
||||||
const saveLifeData = function (key, value) {
|
const saveLifeData = function (key, value) {
|
||||||
|
@ -34,6 +34,26 @@ const store = new Vuex.Store({
|
||||||
// 加上vuex_前缀,是防止变量名冲突,也让人一目了然
|
// 加上vuex_前缀,是防止变量名冲突,也让人一目了然
|
||||||
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : { name: '明月' },
|
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : { name: '明月' },
|
||||||
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
|
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无需保存到本地永久存储,无需lifeData.vuex_version方式
|
||||||
vuex_version: '1.0.1',
|
vuex_version: '1.0.1',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue