添加一个调试登陆界面
This commit is contained in:
parent
6af89f9f75
commit
ba7cf7562e
|
@ -1,2 +1,3 @@
|
|||
.history
|
||||
unpackage/dist
|
||||
node_modules
|
|
@ -52,3 +52,7 @@ export const UploadFiles = (fileList, params) =>
|
|||
request.get("/api/App/GetAwaitUploadArea", data);
|
||||
// 修改上传接口定义
|
||||
export const UploadArea = (data) => request.post("/api/App/UploadArea", data);
|
||||
|
||||
// 登录
|
||||
export const loginApi = (data) =>
|
||||
request.post("/api/Login/Login", data);
|
|
@ -10,6 +10,12 @@
|
|||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "调试登陆"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view
|
||||
style="margin-top: 50rpx; display: flex; align-items: center; padding-right: 50rpx"
|
||||
>
|
||||
<view style="margin-right: 50rpx">账号</view>
|
||||
<u-input v-model="phone" border placeholder="账号"></u-input>
|
||||
</view>
|
||||
<view
|
||||
style="margin-top: 50rpx; display: flex; align-items: center; padding-right: 50rpx"
|
||||
>
|
||||
<view style="margin-right: 50rpx">账号</view>
|
||||
<u-input v-model="pwd" border placeholder="密码"></u-input>
|
||||
</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
|
||||
>
|
||||
<u-button type="primary" @click="login2Fn" style="margin-top: 50rpx"
|
||||
>登陆18174010562</u-button
|
||||
>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import bcrypt from "bcryptjs";
|
||||
import { loginApi } from "@/api/apiList";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
phone: "13800451500",
|
||||
pwd: "123456",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// console.log("%c%s", "color:red", "mounted--");
|
||||
uni.hideLoading(); // 关闭 Loading
|
||||
},
|
||||
onLoad() {},
|
||||
methods: {
|
||||
login1Fn() {
|
||||
this.phone = "13800451500";
|
||||
this.pwd = "123456";
|
||||
this.loginFn();
|
||||
},
|
||||
login2Fn() {
|
||||
this.phone = "18174010562";
|
||||
this.pwd = "123456";
|
||||
this.loginFn();
|
||||
},
|
||||
async loginFn() {
|
||||
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 || "登录失败",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
let token = res.data;
|
||||
uni.setStorageSync("token", "Bearer " + token);
|
||||
uni.switchTab({
|
||||
url: "/pages/index/index",
|
||||
success() {
|
||||
console.log("跳转成功");
|
||||
window.initFn = null; // 清除全局函数
|
||||
},
|
||||
fail(err) {
|
||||
console.error("跳转失败", err);
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
height: 100vh; // 确保容器有明确高度
|
||||
// background-color: skyblue;
|
||||
overflow: hidden;
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
</style>
|
|
@ -3,7 +3,7 @@
|
|||
<!-- 设置 -->
|
||||
<view class="head">
|
||||
<view class="personInfo">
|
||||
<view>{{ baseInfo.name }}</view>
|
||||
<view @click="handleClick">{{ baseInfo.name }}</view>
|
||||
<view class="account">{{ baseInfo.personType }}</view>
|
||||
</view>
|
||||
<view class="avatar-box">
|
||||
|
@ -84,7 +84,7 @@ export default {
|
|||
time: "2025/4/2-2026/4/2",
|
||||
personType: "保洁员",
|
||||
},
|
||||
|
||||
clickCount: 0, // 用于记录点击次数
|
||||
version: "",
|
||||
|
||||
cellList: [
|
||||
|
@ -133,6 +133,15 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
handleClick() {
|
||||
this.clickCount++; // 每次点击增加点击次数
|
||||
if (this.clickCount === 6) {
|
||||
this.clickCount = 0; // 执行完函数后重置点击次数
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
});
|
||||
}
|
||||
},
|
||||
upload_avatar() {
|
||||
const _this = this;
|
||||
uni.chooseImage({
|
||||
|
|
Loading…
Reference in New Issue