管理员界面对接中

This commit is contained in:
李彪 2025-04-24 15:03:07 +08:00
parent 8bfa454681
commit 3f9d75d597
8 changed files with 207 additions and 304 deletions

12
api/apiAdmin.js Normal file
View File

@ -0,0 +1,12 @@
import request from "@/utils/request";
// 首页数据
export const GetHomeDataApi = (data) =>
request.get("/api/AdminApp/GetHomeData", data);
// 区域列表
export const GetRegionDataListApi = (data) =>
request.get("/api/AdminApp/GetRegionDataList", data);
// 用户数据
export const GetUserDataApi = (data) =>
request.get("/api/AdminApp/GetUserData", data);

View File

@ -2,55 +2,31 @@
<view class="content"> <view class="content">
<view class="bg-box"> <view class="bg-box">
<view class="homo-title">首页</view> <view class="homo-title">首页</view>
<image <image class="bg-logo" style="width: 200rpx; height: 170rpx" src="/static/adminImg/bg-logo.png"></image>
class="bg-logo" <image class="bg-hi" style="width: 130rpx; height: 50rpx" src="/static/adminImg/logo-hi.png"></image>
style="width: 200rpx; height: 170rpx"
src="/static/adminImg/bg-logo.png"
></image>
<image
class="bg-hi"
style="width: 130rpx; height: 50rpx"
src="/static/adminImg/logo-hi.png"
></image>
<view style="height: 150rpx"></view> <view style="height: 150rpx"></view>
<view class="tip">欢迎使用,张三</view> <view class="tip">欢迎使用,张三</view>
<view class="desc">欢迎使用巡检管理员端</view> <view class="desc">欢迎使用巡检管理员端</view>
<view class="card"> <view class="card">
<view class="card-item"> <view class="card-item">
<view class="item-title">区域数量 </view> <view class="item-title">区域数量 </view>
<view class="item-totel">10 </view> <view class="item-totel">{{ form.areaCount }} </view>
<image <image class="card-img" style="width: 130rpx; height: 130rpx" src="/static/adminImg/card1.png"></image>
class="card-img"
style="width: 130rpx; height: 130rpx"
src="/static/adminImg/card1.png"
></image>
</view> </view>
<view class="card-item"> <view class="card-item">
<view class="item-title">子区域数量 </view> <view class="item-title">子区域数量 </view>
<view class="item-totel">20 </view> <view class="item-totel">{{ form.regionCount }} </view>
<image <image class="card-img" style="width: 130rpx; height: 130rpx" src="/static/adminImg/card2.png"></image>
class="card-img"
style="width: 130rpx; height: 130rpx"
src="/static/adminImg/card2.png"
></image>
</view> </view>
<view class="card-item"> <view class="card-item">
<view class="item-title">已绑定子区域数 </view> <view class="item-title">已绑定子区域数 </view>
<view class="item-totel">30 </view> <view class="item-totel">{{ form.bindnfc }} </view>
<image <image class="card-img" style="width: 130rpx; height: 130rpx" src="/static/adminImg/card3.png"></image>
class="card-img"
style="width: 130rpx; height: 130rpx"
src="/static/adminImg/card3.png"
></image>
</view> </view>
<view class="card-item"> <view class="card-item">
<view class="item-title">未绑定子区域数 </view> <view class="item-title">未绑定子区域数 </view>
<view class="item-totel">40 </view> <view class="item-totel">{{ form.noBindnfc }} </view>
<image <image class="card-img" style="width: 130rpx; height: 130rpx" src="/static/adminImg/card4.png"></image>
class="card-img"
style="width: 130rpx; height: 130rpx"
src="/static/adminImg/card4.png"
></image>
</view> </view>
</view> </view>
<view v-if="true" style="display: flex"> <view v-if="true" style="display: flex">
@ -61,19 +37,31 @@
</view> </view>
</template> </template>
<script> <script>
import { loginApi } from "@/api/apiList"; import { GetHomeDataApi } from "@/api/apiAdmin";
export default { export default {
data() { data() {
return { return {
phone: "13800451500", form: {
pwd: "123456", "regionCount": 0,
"areaCount": 0,
"bindnfc": 0,
"noBindnfc": 0
}
}; };
}, },
mounted() { mounted() {
uni.hideLoading(); // Loading uni.hideLoading(); // Loading
}, },
onLoad() {}, onLoad() { },
onShow() {
this.getDataFn()
},
methods: { methods: {
async getDataFn() {
const res = await GetHomeDataApi();
console.log(res, "首页数据");
Object.assign(this.form, res.data);
},
testFn() { testFn() {
let u = navigator.userAgent; let u = navigator.userAgent;
let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
@ -107,23 +95,27 @@ export default {
// background-color: skyblue; // background-color: skyblue;
overflow: hidden; overflow: hidden;
// padding-bottom: 100rpx; // padding-bottom: 100rpx;
.bg-box { .bg-box {
position: relative; position: relative;
// background-color: #528dfe; // background-color: #528dfe;
background: linear-gradient(to bottom, #3179fb, white); background: linear-gradient(to bottom, #3179fb, white);
height: 650rpx; height: 650rpx;
.homo-title { .homo-title {
color: white; color: white;
transform: translateY(30rpx); transform: translateY(30rpx);
font-size: 35rpx; font-size: 35rpx;
text-align: center; text-align: center;
} }
.bg-logo { .bg-logo {
position: absolute; position: absolute;
right: 50rpx; right: 50rpx;
top: 160rpx; top: 160rpx;
} }
.bg-hi { .bg-hi {
position: absolute; position: absolute;
left: 30rpx; left: 30rpx;
@ -135,11 +127,13 @@ export default {
color: white; color: white;
font-size: 40rpx; font-size: 40rpx;
} }
.desc { .desc {
margin-top: 20rpx; margin-top: 20rpx;
padding-left: 30rpx; padding-left: 30rpx;
color: #ffffff99; color: #ffffff99;
} }
.card { .card {
// border: 1px solid red; // border: 1px solid red;
display: grid; display: grid;
@ -147,6 +141,7 @@ export default {
grid-template-rows: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr);
gap: 30rpx; gap: 30rpx;
padding: 50rpx; padding: 50rpx;
.card-item { .card-item {
position: relative; position: relative;
// border: 1px solid blue; // border: 1px solid blue;
@ -155,12 +150,15 @@ export default {
background: linear-gradient(to bottom, white, #e1e9ff); background: linear-gradient(to bottom, white, #e1e9ff);
height: 280rpx; height: 280rpx;
padding: 30rpx; padding: 30rpx;
.item-title { .item-title {
font-size: 30rpx; font-size: 30rpx;
} }
.item-totel { .item-totel {
font-size: 50rpx; font-size: 50rpx;
} }
.card-img { .card-img {
position: absolute; position: absolute;
right: 20rpx; right: 20rpx;

View File

@ -3,27 +3,14 @@
<view class="content-title">我的</view> <view class="content-title">我的</view>
<view class="head"> <view class="head">
<view class="avatar-box"> <view class="avatar-box">
<u-avatar <u-avatar :src="'/static/images/avatar.png'" size="140" mode="circle" class="avatar"></u-avatar>
:src="baseInfo.avatar || '/static/images/avatar.png'"
size="140"
mode="circle"
class="avatar"
></u-avatar>
</view> </view>
<view class="content-name">JuLia James</view> <view class="content-name">{{ userName }}</view>
</view> </view>
<view class="cell-list-box"> <view class="cell-list-box">
<view <view class="cell-list-item" v-for="item in cellList" @click="toPage(item.path, item)">
class="cell-list-item"
v-for="item in cellList"
@click="toPage(item.path, item)"
>
<view class="cell-list-item-left"> <view class="cell-list-item-left">
<image <image style="width: 60rpx; height: 60rpx" mode="aspectFit" :src="item.icon"></image>
style="width: 60rpx; height: 60rpx"
mode="aspectFit"
:src="item.icon"
></image>
<text>{{ item.title }}</text> <text>{{ item.title }}</text>
</view> </view>
@ -35,17 +22,9 @@
</view> </view>
<view class="empty-box"></view> <view class="empty-box"></view>
<view class="cell-list-box2"> <view class="cell-list-box2">
<view <view class="cell-list-item" v-for="item in cellList2" @click="toPage(item.path, item)">
class="cell-list-item"
v-for="item in cellList2"
@click="toPage(item.path, item)"
>
<view class="cell-list-item-left"> <view class="cell-list-item-left">
<image <image style="width: 60rpx; height: 60rpx" mode="aspectFit" :src="item.icon"></image>
style="width: 60rpx; height: 60rpx"
mode="aspectFit"
:src="item.icon"
></image>
<text>{{ item.title }}</text> <text>{{ item.title }}</text>
</view> </view>
@ -59,8 +38,7 @@
</template> </template>
<script> <script>
import { GetCompanyInformation } from "@/api/apiList.js"; import { GetUserDataApi } from "@/api/apiAdmin.js";
import { import {
toast, toast,
clearStorageSync, clearStorageSync,
@ -72,14 +50,22 @@ import {
export default { export default {
data() { data() {
return { return {
baseInfo: { form: {
avatar: "", "id": "08dd80a7-f2fa-46df-8374-4e132418512e",
companyName: "南昌理工", "name": "计算机学院教学大楼12栋",
name: "保洁", "description": "12栋",
sex: 0, // 0 1 "companyId": "4b2d9662-a768-08f2-a0c8-762b8c76da2a",
time: "2025/4/2-2026/4/2", "departmentId": "08dd6dcf-ffc9-4000-89b2-b53ea1d5acfb",
personType: "保洁员", "department": null,
"userId": "21645b80-8aff-3cf2-b1f3-2ba9d485fecd",
"areas": [],
"createTime": "2025-04-21T15:41:36.897423",
"isDeleted": false
}, },
//
userName: '',
//
userType: '',
clickCount: 0, // clickCount: 0, //
version: "", version: "",
@ -118,31 +104,23 @@ export default {
}; };
}, },
onLoad() { onLoad() {
// this.getUserInfo();
// const that = this;
// uni.getSystemInfo({
// success: function (res) {
// console.log("res", res);
// that.version = res.appVersion;
// },
// });
}, },
onShow() { onShow() {
// this.getCompanyInformation(); this.getDataFn();
// uni.$on("refresh", (e) => {
// this.getUserInfo();
// uni.$off("refresh");
// });
}, },
//
onPullDownRefresh() {
//console.log('refresh');
// this.getUserInfo();
// uni.stopPullDownRefresh(); //
},
methods: { methods: {
async getDataFn() {
const res = await GetUserDataApi();
console.log(res, "用户数据");
Object.assign(this.form, res.data.userRegion);
//
this.userName = res.data.userName
//
this.userType = res.data.userType
this.cellList[1].content = res.data.userType
//
this.cellList[2].content = res.data.userRegion.name
},
handleClick() { handleClick() {
this.clickCount++; // this.clickCount++; //
if (this.clickCount === 6) { if (this.clickCount === 6) {
@ -152,50 +130,6 @@ export default {
}); });
} }
}, },
upload_avatar() {
const _this = this;
uni.chooseImage({
count: 1,
sizeType: ["original", "compressed"], //
sourceType: ["album", "camera"], //
success: function (res) {
uni.uploadFile({
url: _this.$api_url + "/api/index/upload_cos",
filePath: res.tempFilePaths[0],
name: "file",
formData: {
floder: "avatar",
},
success: (uploadFileRes) => {
//let retData = JSON.parse(uploadFileRes)
let retData = JSON.parse(uploadFileRes.data);
console.log("up:", retData);
const _data = {
avatar: retData.data.file,
};
_this.$api.baseInfoSave(_data).then((ret) => {
if (ret.code == 1) {
_this.baseInfo.avatar = retData.data.file;
} else {
toast(res.msg);
}
});
},
});
},
});
},
//
async getCompanyInformation() {
const res = await GetCompanyInformation();
if (res.succeed) {
this.baseInfo = res.data;
this.cellList[0].content = this.baseInfo.time;
}
},
toPage(path, item) { toPage(path, item) {
if (item.title === "注销") { if (item.title === "注销") {
uni.showModal({ uni.showModal({
@ -203,12 +137,12 @@ export default {
content: "确定注销吗?", content: "确定注销吗?",
showCancel: true, showCancel: true,
success: function (res) { success: function (res) {
if(!res.confirm){return} if (!res.confirm) { return }
console.log(res,'res--') console.log(res, 'res--')
// 退 // 退
let u = navigator.userAgent; let u = navigator.userAgent;
let isAndroid = let isAndroid =
u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios // let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
try { try {
if (isAndroid && AndroidJs) { if (isAndroid && AndroidJs) {
@ -246,6 +180,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.content { .content {
height: calc(100vh - 100rpx); height: calc(100vh - 100rpx);
// background: #f6f8fc; // background: #f6f8fc;
.content-title { .content-title {
background: #fff; background: #fff;
@ -254,6 +189,7 @@ export default {
font-size: 30rpx; font-size: 30rpx;
font-weight: bold; font-weight: bold;
} }
.head { .head {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -269,6 +205,7 @@ export default {
height: 140rpx; height: 140rpx;
border-radius: 50%; border-radius: 50%;
position: relative; position: relative;
.avatar { .avatar {
width: 100%; width: 100%;
} }
@ -306,6 +243,7 @@ export default {
align-self: center; align-self: center;
} }
} }
&-right { &-right {
color: #999; color: #999;
} }

View File

@ -4,40 +4,26 @@
<view class="card"> <view class="card">
<view class="card-item card-left"> <view class="card-item card-left">
<view class="card-title">已绑定子区域数</view> <view class="card-title">已绑定子区域数</view>
<view class="card-totel">10</view> <view class="card-totel">{{ form.bindnfc }}</view>
</view> </view>
<view class="card-item card-right"> <view class="card-item card-right">
<view class="card-title">未绑定子区域数</view> <view class="card-title">未绑定子区域数</view>
<view class="card-totel">10</view> <view class="card-totel">{{ form.noBindnfc }}</view>
</view> </view>
</view> </view>
<!-- 搜索 --> <!-- 搜索 -->
<view class="search-box"> <view class="search-box">
<u-input <u-input class="search-input" v-model="keyword" border placeholder="搜索名称"></u-input>
class="search-input"
v-model="keyword"
border
placeholder="搜索名称"
></u-input>
<view class="select-box" @click="selectFn"> <view class="select-box" @click="selectFn">
<view> <view>
{{ selectVal }} {{ selectVal }}
</view> </view>
<image <image src="/static/svg/down.svg" style="width: 30rpx; height: 30rpx; margin-left: 10rpx"></image>
src="/static/svg/down.svg"
style="width: 30rpx; height: 30rpx; margin-left: 10rpx"
></image>
</view> </view>
</view> </view>
<!-- tabs --> <!-- tabs -->
<u-tabs <u-tabs class="tabs-box" bg-color="#F6F8FC" :list="tabsList" :is-scroll="true" :current="tabCurrent"
class="tabs-box" @change="tabChangeFn"></u-tabs>
bg-color="#F6F8FC"
:list="tabsList"
:is-scroll="true"
:current="tabCurrent"
@change="tabChangeFn"
></u-tabs>
<!-- tip --> <!-- tip -->
<view class="tip-box">共10个子区域其中5个未绑定</view> <view class="tip-box">共10个子区域其中5个未绑定</view>
<!-- 列表 --> <!-- 列表 -->
@ -46,33 +32,19 @@
<view v-for="i in 80" class="item-box"> <view v-for="i in 80" class="item-box">
<view class="item-title">子区域{{ i }}</view> <view class="item-title">子区域{{ i }}</view>
<view v-if="i % 2 === 0" class="btn-have btn">已绑定</view> <view v-if="i % 2 === 0" class="btn-have btn">已绑定</view>
<view <view v-if="i % 2 !== 0" class="btn-none btn" @click="showDialog = true">去绑定</view>
v-if="i % 2 !== 0"
class="btn-none btn"
@click="showDialog = true"
>去绑定</view
>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<!-- 筛选的下拉 --> <!-- 筛选的下拉 -->
<u-action-sheet <u-action-sheet :list="options" title="请选择" @click="changeFn" v-model:value="selectShow"></u-action-sheet>
:list="options" <bind-dialog :visible="showDialog" @close="showDialog = false" @changeBinding="onChangeBinding"
title="请选择" @confirm="onConfirm"></bind-dialog>
@click="changeFn"
v-model:value="selectShow"
></u-action-sheet>
<bind-dialog
:visible="showDialog"
@close="showDialog = false"
@changeBinding="onChangeBinding"
@confirm="onConfirm"
></bind-dialog>
<u-tabbar :list="vuex_tabbar"></u-tabbar> <u-tabbar :list="vuex_tabbar"></u-tabbar>
</view> </view>
</template> </template>
<script> <script>
import { loginApi } from "@/api/apiList"; import { GetRegionDataListApi, GetHomeDataApi } from "@/api/apiAdmin.js";
import BindDialog from "@/pages/adminNfc/components/bindDialog.vue"; // import BindDialog from "@/pages/adminNfc/components/bindDialog.vue"; //
export default { export default {
components: { components: {
@ -80,6 +52,12 @@ export default {
}, },
data() { data() {
return { return {
form: {
"regionCount": 0,
"areaCount": 0,
"bindnfc": 0,
"noBindnfc": 0
},
keyword: "", keyword: "",
selectShow: false, selectShow: false,
showDialog: false, showDialog: false,
@ -128,8 +106,23 @@ export default {
mounted() { mounted() {
uni.hideLoading(); // Loading uni.hideLoading(); // Loading
}, },
onLoad() {}, onLoad() {
this.getAreaFn();
},
onShow() {
this.getDataFn();
},
methods: { methods: {
async getDataFn() {
const res = await GetHomeDataApi();
console.log(res, "首页数据");
Object.assign(this.form, res.data);
},
async getAreaFn() {
const res = await GetRegionDataListApi()
console.log(res, "区域数据");
this.tabsList = res.data.areaList
},
selectFn() { selectFn() {
this.selectShow = true; this.selectShow = true;
}, },
@ -141,7 +134,6 @@ export default {
console.log(val, "val--"); console.log(val, "val--");
this.tabCurrent = val; this.tabCurrent = val;
}, },
onChangeBinding() { onChangeBinding() {
console.log("点击了更换绑定"); console.log("点击了更换绑定");
// //
@ -159,11 +151,13 @@ export default {
// overflow: hidden; // overflow: hidden;
background-color: #f6f8fc; background-color: #f6f8fc;
padding-bottom: 100rpx; padding-bottom: 100rpx;
.card { .card {
display: flex; display: flex;
// margin-top: 30rpx; // margin-top: 30rpx;
padding-left: 30rpx; padding-left: 30rpx;
padding-right: 30rpx; padding-right: 30rpx;
.card-item { .card-item {
position: relative; position: relative;
flex: 1; flex: 1;
@ -172,36 +166,41 @@ export default {
color: white; color: white;
padding: 20rpx; padding: 20rpx;
font-size: 30rpx; font-size: 30rpx;
.card-title { .card-title {
font-size: 30rpx; font-size: 30rpx;
} }
.card-totel { .card-totel {
padding-left: 20rpx; padding-left: 20rpx;
font-size: 40rpx; font-size: 40rpx;
} }
} }
.card-left { .card-left {
background: url("/static/adminImg/icon-bg1.png") no-repeat right 32rpx background: url("/static/adminImg/icon-bg1.png") no-repeat right 32rpx bottom 20rpx / 60rpx 60rpx;
bottom 20rpx / 60rpx 60rpx;
background-color: #4974f3; background-color: #4974f3;
} }
.card-right { .card-right {
margin-left: 20rpx; margin-left: 20rpx;
background: url("/static/adminImg/icon-bg2.png") no-repeat right 32rpx background: url("/static/adminImg/icon-bg2.png") no-repeat right 32rpx bottom 20rpx / 60rpx 60rpx;
bottom 20rpx / 60rpx 60rpx;
background-color: #53d5a9; background-color: #53d5a9;
} }
} }
.search-box { .search-box {
display: flex; display: flex;
align-items: center; align-items: center;
// border: 1px solid red; // border: 1px solid red;
margin-top: 20rpx; margin-top: 20rpx;
padding: 20rpx; padding: 20rpx;
.search-input { .search-input {
background-color: white; background-color: white;
border-radius: 50rpx; border-radius: 50rpx;
} }
.select-box { .select-box {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -216,13 +215,16 @@ export default {
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
} }
.tip-box { .tip-box {
color: grey; color: grey;
padding-left: 30rpx; padding-left: 30rpx;
} }
.list-box { .list-box {
padding-left: 30rpx; padding-left: 30rpx;
padding-right: 30rpx; padding-right: 30rpx;
.item-box { .item-box {
background-color: white; background-color: white;
margin-top: 20rpx; margin-top: 20rpx;
@ -233,11 +235,13 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.item-title { .item-title {
font-size: 30rpx; font-size: 30rpx;
color: #333; color: #333;
// font-weight: bold; // font-weight: bold;
} }
.btn { .btn {
padding-left: 20rpx; padding-left: 20rpx;
padding-right: 20rpx; padding-right: 20rpx;
@ -245,10 +249,12 @@ export default {
padding-top: 5rpx; padding-top: 5rpx;
padding-bottom: 5rpx; padding-bottom: 5rpx;
} }
.btn-have { .btn-have {
background-color: #f5f5f5; background-color: #f5f5f5;
color: black; color: black;
} }
.btn-none { .btn-none {
background-color: #4274dc; background-color: #4274dc;
color: white; color: white;

View File

@ -114,6 +114,7 @@ export default {
form: { form: {
note: "", // note: "", //
url: "", // url: "", //
// url: "http://sl.vrgon.com:8005/uploads/20250418/13800451500/3e6bd20b50d34555b5737db851acd71e.png", //
}, },
areaOptions: [ areaOptions: [
{ label: "东大门操场", value: "east_gate" }, { label: "东大门操场", value: "east_gate" },

View File

@ -1,30 +1,19 @@
<template> <template>
<view class="content"> <view class="content">
<view <view style="margin-top: 50rpx; display: flex; align-items: center; padding-right: 50rpx">
style="margin-top: 50rpx; display: flex; align-items: center; padding-right: 50rpx"
>
<view style="margin-right: 50rpx">账号</view> <view style="margin-right: 50rpx">账号</view>
<u-input v-model="phone" border placeholder="账号"></u-input> <u-input v-model="phone" border placeholder="账号"></u-input>
</view> </view>
<view <view style="margin-top: 50rpx; display: flex; align-items: center; padding-right: 50rpx">
style="margin-top: 50rpx; display: flex; align-items: center; padding-right: 50rpx"
>
<view style="margin-right: 50rpx">账号</view> <view style="margin-right: 50rpx">账号</view>
<u-input v-model="pwd" border placeholder="密码"></u-input> <u-input v-model="pwd" border placeholder="密码"></u-input>
</view> </view>
<u-button type="primary" @click="loginFn" style="margin-top: 50rpx">登陆</u-button> <u-button type="primary" @click="loginFn('admin')" 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">登陆18174010562-管理员</u-button>
> <u-button type="primary" @click="login4Fn" style="margin-top: 50rpx">登陆18174010562-清洁工</u-button>
<u-button type="primary" @click="login2Fn" style="margin-top: 50rpx" <u-button type="primary" @click="login3Fn" style="margin-top: 50rpx">登陆18174010561-清洁工</u-button>
>登陆18174010562-管理员</u-button <u-button type="primary" @click="login5Fn" style="margin-top: 50rpx">登陆18174010561-管理员</u-button>
>
<u-button type="primary" @click="login4Fn" style="margin-top: 50rpx"
>登陆18174010562-清洁工</u-button
>
<u-button type="primary" @click="login3Fn" style="margin-top: 50rpx"
>登陆18174010561-清洁工</u-button
>
</view> </view>
</template> </template>
<script> <script>
@ -33,7 +22,7 @@ import { loginApi } from "@/api/apiList";
export default { export default {
data() { data() {
return { return {
phone: "13800451500", phone: "18174010566",
pwd: "123456", pwd: "123456",
}; };
}, },
@ -41,117 +30,34 @@ export default {
// console.log("%c%s", "color:red", "mounted--"); // console.log("%c%s", "color:red", "mounted--");
uni.hideLoading(); // Loading uni.hideLoading(); // Loading
}, },
onLoad() {}, onLoad() { },
methods: { methods: {
login1Fn() { login1Fn() {
this.phone = "13800451500"; this.phone = "13800451500";
// this.phone = "18174010561"; // this.phone = "18174010561";
this.pwd = "123456"; this.pwd = "123456";
const normalTabBar = [
{
pagePath: "/pages/index/planList",
iconPath: "/static/tab/planList.png",
selectedIconPath: "/static/tab/planList-active.png",
text: "计划",
},
{
pagePath: "/pages/index/index",
iconPath: "/static/tab/admin-home.png",
selectedIconPath: "/static/tab/admin-home-acitve.png",
text: "首页",
},
{
pagePath: "/pages/user/index",
iconPath: "/static/tab/admin-my.png",
selectedIconPath: "/static/tab/admin-my-active.png",
text: "设置",
},
];
this.$u.vuex("vuex_tabbar", normalTabBar);
this.loginFn("user"); this.loginFn("user");
}, },
login2Fn() { login2Fn() {
this.phone = "18174010562"; this.phone = "18174010562";
this.pwd = "123456"; this.pwd = "123456";
const adminTabBar = [
{
pagePath: "/pages/adminHome/index",
iconPath: "/static/tab/admin-home.png",
selectedIconPath: "/static/tab/admin-home-acitve.png",
text: "首页",
},
{
pagePath: "/pages/adminNfc/index",
iconPath: "/static/tab/nfc.png",
selectedIconPath: "/static/tab/nfc-active.png",
text: "nfc写入",
},
{
pagePath: "/pages/adminMy/index",
iconPath: "/static/tab/admin-my.png",
selectedIconPath: "/static/tab/admin-my-active.png",
text: "我的",
},
];
this.$u.vuex("vuex_tabbar", adminTabBar);
this.loginFn("admin"); this.loginFn("admin");
}, },
login4Fn() {
this.phone = "18174010562";
this.pwd = "123456";
const normalTabBar = [
{
pagePath: "/pages/index/planList",
iconPath: "/static/tab/planList.png",
selectedIconPath: "/static/tab/planList-active.png",
text: "计划",
},
{
pagePath: "/pages/index/index",
iconPath: "/static/tab/admin-home.png",
selectedIconPath: "/static/tab/admin-home-acitve.png",
text: "首页",
},
{
pagePath: "/pages/user/index",
iconPath: "/static/tab/admin-my.png",
selectedIconPath: "/static/tab/admin-my-active.png",
text: "设置",
},
];
this.$u.vuex("vuex_tabbar", normalTabBar);
this.loginFn("user");
},
login3Fn() { login3Fn() {
this.phone = "18174010561"; this.phone = "18174010561";
this.pwd = "123456"; this.pwd = "123456";
const normalTabBar = [
{
pagePath: "/pages/index/planList",
iconPath: "/static/tab/planList.png",
selectedIconPath: "/static/tab/planList-active.png",
text: "计划",
},
{
pagePath: "/pages/index/index",
iconPath: "/static/tab/admin-home.png",
selectedIconPath: "/static/tab/admin-home-acitve.png",
text: "首页",
},
{
pagePath: "/pages/user/index",
iconPath: "/static/tab/admin-my.png",
selectedIconPath: "/static/tab/admin-my-active.png",
text: "设置",
},
];
this.$u.vuex("vuex_tabbar", normalTabBar);
this.loginFn("user"); this.loginFn("user");
}, },
login4Fn() {
this.phone = "18174010562";
this.pwd = "123456";
this.loginFn("user");
},
login5Fn() {
this.phone = "18174010561";
this.pwd = "123456";
this.loginFn("admin");
},
async loginFn(type) { async loginFn(type) {
let salt = bcrypt.genSaltSync(12); let salt = bcrypt.genSaltSync(12);
let req = { let req = {
@ -170,11 +76,54 @@ export default {
uni.setStorageSync("token", "Bearer " + token); uni.setStorageSync("token", "Bearer " + token);
console.log(type, "type--"); console.log(type, "type--");
if (type === "user") { if (type === "user") {
const normalTabBar = [
{
pagePath: "/pages/index/planList",
iconPath: "/static/tab/planList.png",
selectedIconPath: "/static/tab/planList-active.png",
text: "计划",
},
{
pagePath: "/pages/index/index",
iconPath: "/static/tab/admin-home.png",
selectedIconPath: "/static/tab/admin-home-acitve.png",
text: "首页",
},
{
pagePath: "/pages/user/index",
iconPath: "/static/tab/admin-my.png",
selectedIconPath: "/static/tab/admin-my-active.png",
text: "设置",
},
];
this.$u.vuex("vuex_tabbar", normalTabBar);
uni.switchTab({ uni.switchTab({
url: `/pages/index/planList`, url: `/pages/index/planList`,
}); });
} }
if (type === "admin") { if (type === "admin") {
const adminTabBar = [
{
pagePath: "/pages/adminHome/index",
iconPath: "/static/tab/admin-home.png",
selectedIconPath: "/static/tab/admin-home-acitve.png",
text: "首页",
},
{
pagePath: "/pages/adminNfc/index",
iconPath: "/static/tab/nfc.png",
selectedIconPath: "/static/tab/nfc-active.png",
text: "nfc写入",
},
{
pagePath: "/pages/adminMy/index",
iconPath: "/static/tab/admin-my.png",
selectedIconPath: "/static/tab/admin-my-active.png",
text: "我的",
},
];
this.$u.vuex("vuex_tabbar", adminTabBar);
uni.switchTab({ uni.switchTab({
url: `/pages/adminHome/index`, url: `/pages/adminHome/index`,
}); });

View File

@ -195,7 +195,7 @@ export default {
content: "确定注销吗?", content: "确定注销吗?",
showCancel: true, showCancel: true,
success: function (res) { success: function (res) {
if(res.confirm){ if(res.confirm){return}
// 退 // 退
let u = navigator.userAgent; let u = navigator.userAgent;
let isAndroid = let isAndroid =
@ -223,7 +223,6 @@ export default {
console.log(e, "e-----判断安卓苹果类型出错"); console.log(e, "e-----判断安卓苹果类型出错");
} }
return return
}
}, },
}); });
return; return;

View File

@ -45,7 +45,7 @@ const baseRequest = async (url, method, data = {}, loading = true) => {
reslove(res); reslove(res);
} }
} else { } else {
if (successData.statusCode === 401) { if ([401,403].includes(successData.statusCode)) {
console.log(successData, "successData--"); console.log(successData, "successData--");
console.log("%c%s", "color:red", "登录过期"); console.log("%c%s", "color:red", "登录过期");
uni.showModal({ uni.showModal({