修复部分验证码问题

This commit is contained in:
xiangheng
2024-06-04 01:16:50 +08:00
parent 89eb9ccc72
commit 6471a7ea23
10 changed files with 1820 additions and 1889 deletions

View File

@@ -2,19 +2,17 @@
"version" : "1.0", "version" : "1.0",
"configurations" : [ "configurations" : [
{ {
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
}, },
{ {
"app-plus" : "app-plus" : {
{ "launchtype" : "local"
"launchtype" : "local" },
}, "mp-weixin" : {
"mp-weixin" : "launchtype" : "local"
{ },
"launchtype" : "local" "type" : "uniCloud"
}, }
"type" : "uniCloud"
}
] ]
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -33,33 +33,12 @@
let text = ["Fota", "轻松管理"]; let text = ["Fota", "轻松管理"];
let baseList = [ let baseList = [{
// {
// icon: "/static/index/product.png",
// path: "/pages/product/product",
// title: "产品",
// },
// {
// icon: "/static/index/group.png",
// path: "/pages/group/group",
// title: "分组",
// },
// {
// icon: "/static/index/version.png",
// path: "/pages/version/version",
// title: "版本",
// },
{
icon: "/static/index/equipment.png", icon: "/static/index/equipment.png",
path: "/pages/monitor_project/index", path: "/pages/monitor_project/index",
title: "项目监控", title: "项目监控",
}, },
{
icon: "/static/index/equipment.png",
path: "/pages/equipment/equipment",
title: "设备管理",
},
{ {
icon: "scan", icon: "scan",
@@ -83,26 +62,8 @@
}); });
}, },
}, },
{
icon: "/static/index/equipmentLog.png",
path: "/pages/statistics/statistics",
title: "销量统计",
},
// {
// icon: "/static/index/sysUp.png",
// path: "/pages/log/sysUp/sysUp",
// title: "上行日志",
// },
// {
// icon: "/static/index/sysDown.png",
// path: "/pages/log/sysDown/sysDown",
// title: "下行日志",
// },
// {
// icon: "/static/index/log.png",
// path: "/pages/log/sysLog/sysLog",
// title: "系统日志",
// },
]; ];
function toList(item) { function toList(item) {

View File

@@ -1,176 +1,138 @@
<template> <template>
<view> <view>
<uv-form <uv-form class="form" ref="form" labelWidth="60" labelAlign="right" :model="model" :rules="rules">
class="form" <uv-form-item class="hide">
ref="form" <uv-input class="hide" v-model="model.username" placeholder="请输入账号"
labelWidth="60" :rules="[{ required: true, message: '请填写账号' }]" />
labelAlign="right" </uv-form-item>
:model="model" <uv-form-item class="hide">
:rules="rules" <uv-input type="password" v-model="model.password" placeholder="请输入密码"
> :rules="[{ required: true, message: '请填写密码' }]" />
<uv-form-item class="hide"> </uv-form-item>
<uv-input <uv-form-item label="账号" name="username" prop="username">
class="hide" <uv-input v-model="model.username" placeholder="请输入账号"
v-model="model.username" :rules="[{ required: true, message: '请填写账号' }]" />
placeholder="请输入账号" </uv-form-item>
:rules="[{ required: true, message: '请填写账号' }]" <uv-form-item label="密码" name="password" prop="password">
/> <uv-input type="password" v-model="model.password" placeholder="请输入密码"
</uv-form-item> :rules="[{ required: true, message: '请填写密码' }]" />
<uv-form-item class="hide"> </uv-form-item>
<uv-input
type="password"
v-model="model.password"
placeholder="请输入密码"
:rules="[{ required: true, message: '请填写密码' }]"
/>
</uv-form-item>
<uv-form-item label="账号" name="username" prop="username">
<uv-input
v-model="model.username"
placeholder="请输入账号"
:rules="[{ required: true, message: '请填写账号' }]"
/>
</uv-form-item>
<uv-form-item label="密码" name="password" prop="password">
<uv-input
type="password"
v-model="model.password"
placeholder="请输入密码"
:rules="[{ required: true, message: '请填写密码' }]"
/>
</uv-form-item>
<Verify <Verify :mode="'pop'" :captchaType="'blockPuzzle'" ref="verifyRef"
@success="VerifySuccess" :imgSize="{ width: '310px', height: '155px' }" @success="VerifySuccess"></Verify>
:mode="'pop'"
:captchaType="'blockPuzzle'"
ref="verifyRef"
:imgSize="{ width: '310px', height: '155px' }"
></Verify>
<view class="footer">
<!-- -->
<view class="footer"> <wd-button class="btn" size="large" @click="VerifyShow" block>登录</wd-button>
<!-- --> </view>
</uv-form>
<wd-button class="btn" size="large" @click="VerifyShow" block </view>
>VerifyShow</wd-button
>
<wd-button class="btn" size="large" @click="handleSubmit" block
>登录</wd-button
>
</view>
</uv-form>
</view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive } from "vue"; import { ref, reactive } from "vue";
import { v1 as uuid_v1 } from "uuid";
import Verify from "@/components/verifition/verify"; import Verify from "@/components/verify/verify.vue";
import { login } from "@/api/user.js"; import { login } from "@/api/user.js";
import { setLocalStorage } from "@/utils/storage.js"; import { setLocalStorage } from "@/utils/storage.js";
import { toast } from "@/utils/utils.js"; import { alert } from "@/utils/utils.js";
// import appicon from "@/static/appicon.png"; // import appicon from "@/static/appicon.png";
import { useUserStore } from "@/stores/user"; import { useUserStore } from "@/stores/user";
const userStore = useUserStore(); const userStore = useUserStore();
const model = reactive({
username: "",
password: "",
});
const rules = {
username: [
{
required: true,
message: "请填写账号",
trigger: ["blur", "change"],
},
],
password: [
{
required: true,
message: "请填写密码",
trigger: ["blur", "change"],
},
],
};
const form = ref();
const verifyRef = ref();
function VerifyShow(e) {
verifyRef.value.show();
}
function VerifySuccess(e) {
console.log("VerifySuccess", e);
const model = reactive({ handleSubmit(e);
username: "", }
password: "", function handleSubmit(verify) {
}); form.value
const rules = { .validate()
username: [ .then((res) => {
{ let data = {
required: true, username: model.username,
message: "请填写账号", password: model.password,
trigger: ["blur", "change"],
},
],
password: [
{
required: true,
message: "请填写密码",
trigger: ["blur", "change"],
},
],
}; ...verify,
const form = ref(); };
const verifyRef=ref()
function VerifyShow(e) {
verifyRef.value.show()
}
function VerifySuccess(e) {
console.log('VerifySuccess',e);
handleSubmit(e) // userStore.getUser();
}
function handleSubmit(verify) {
form.value
.validate()
.then((res) => {
let data = {
username: model.username,
password: model.password,
...verify login(data)
}; .then((res) => {
if (res.code === 200) {
setLocalStorage("token", res.data.token);
// userStore.getUser(); userStore.getInfo().then((res) => {
uni.switchTab({
login(data) url: "/pages/index/index",
.then((res) => { });
if (res.code === 200) { });
setLocalStorage("token", res.data.token); } else {
alert(res.message);
userStore.getInfo().then((res) => { }
uni.switchTab({ })
url: "/pages/index/index", .catch((err) => {
}); alert(err.message);
}); });
} else { })
.catch((err) => {
toast(res.message); alert(err.message);
} });
}) }
.catch((err) => {
toast(err.message);
});
})
.catch((err) => {
toast(err.message);
});
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.hide { .hide {
height: 0 !important; height: 0 !important;
padding: 0 !important; padding: 0 !important;
border: 0 !important; border: 0 !important;
overflow: hidden !important; overflow: hidden !important;
} }
.form { .form {
margin: 200rpx 20rpx; margin: 200rpx 20rpx;
.captchaImage { .captchaImage {
padding: 0 10rpx; padding: 0 10rpx;
} }
.footer { .footer {
padding: 60rpx 20rpx 200rpx; padding: 60rpx 20rpx 200rpx;
.btn { .btn {
background-color: #00b294; background-color: #00b294;
} }
} }
} }
</style> </style>