Merge branch 'main' of http://sl.vrgon.com:3000/LuYaShi/InspectionCleaning
This commit is contained in:
commit
077aaabb14
|
@ -1,2 +1,3 @@
|
|||
.history
|
||||
unpackage/dist
|
||||
node_modules
|
3
App.vue
3
App.vue
|
@ -6,7 +6,7 @@ import appUpdate from "@/components/appUpdate/appUpdate.js";
|
|||
export default {
|
||||
onLaunch: function () {
|
||||
console.log("%c%s", "color:red", "onLaunch---");
|
||||
// uni.showLoading({ title: "等待参数传入" });
|
||||
uni.showLoading({ title: "加载中" });
|
||||
// uni.setStorageSync("token", "");
|
||||
window.initFn = this.initFn;
|
||||
// this.initFn();
|
||||
|
@ -63,6 +63,7 @@ export default {
|
|||
onHide: function () {},
|
||||
methods: {
|
||||
initFn(data) {
|
||||
uni.hideLoading(); // 关闭 Loading
|
||||
if (!data) {
|
||||
return uni.showToast({ title: "未传入参数 initFn", icon: "none" });
|
||||
}
|
||||
|
|
|
@ -47,5 +47,12 @@ export const ReportingNFCDanger = (data) =>
|
|||
export const UploadFiles = (fileList, params) =>
|
||||
request.upload("/api/App/UploadFiles", fileList, params);
|
||||
|
||||
// 获取待上传区域
|
||||
export const GetAwaitUploadAreaApi = (data) =>
|
||||
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": {
|
||||
|
|
|
@ -78,8 +78,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button @click="nfcResFn(true)">刷卡成功</button>
|
||||
<button @click="nfcResFn(false)">刷卡失败</button>
|
||||
<!-- <button @click="nfcResFn(true)">刷卡成功</button> -->
|
||||
<!-- <button @click="nfcResFn(false)">刷卡失败</button> -->
|
||||
<!-- nfc刷卡成功弹窗 -->
|
||||
<u-popup v-model="successShow" mode="center" :round="30">
|
||||
<view class="success-box">
|
||||
|
@ -111,7 +111,7 @@
|
|||
/>
|
||||
</view>
|
||||
<view class="content-title">
|
||||
NFC卡异常或丢失,可尝试重新刷卡或提交卡片异常信息
|
||||
{{errorMsg}}
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<view class="btn-cancel" @click="errorShow = false">暂不</view>
|
||||
|
@ -124,7 +124,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { GetPlanInfoAreaList, GetTodayPlanList } from "@/api/apiList";
|
||||
import { GetPlanInfoAreaList, GetTodayPlanList,GetAwaitUploadAreaApi } from "@/api/apiList";
|
||||
|
||||
import { minutesToTime } from "@/utils/utils";
|
||||
|
||||
|
@ -168,6 +168,7 @@ export default {
|
|||
successShow: false,
|
||||
// 刷卡失败弹窗
|
||||
errorShow: false,
|
||||
errorMsg:'NFC卡异常或丢失,可尝试重新刷卡或提交卡片异常信息',
|
||||
dataInfo: {
|
||||
planName: "",
|
||||
areas: [],
|
||||
|
@ -200,13 +201,49 @@ export default {
|
|||
methods: {
|
||||
minutesToTime,
|
||||
|
||||
nfcResFn(data) {
|
||||
async nfcResFn(data) {
|
||||
if (!data) {
|
||||
return uni.showToast({ title: "未传入参数 initFn", icon: "none" });
|
||||
}
|
||||
// uni.showModal({
|
||||
// title: "查看initFn",
|
||||
// content: JSON.stringify(data) || "未传入参数 initFn",
|
||||
// showCancel: true,
|
||||
// success: function (res) {},
|
||||
// });
|
||||
let cardID = data.cardID;
|
||||
let nimei = data.nimei;
|
||||
const req = {
|
||||
Nimei:nimei
|
||||
// Nimei:'"78F04BC3E9A6DE4782C11A2346F39C68'
|
||||
}
|
||||
const res = await GetAwaitUploadAreaApi(req)
|
||||
console.log(res,'res---')
|
||||
// 刷卡失败
|
||||
if(!res.succeed){
|
||||
console.log("%c%s", "color:red", "刷卡失败");
|
||||
// 提示信息
|
||||
this.errorMsg = res.error || "NFC卡异常或丢失,可尝试重新刷卡或提交卡片异常信息";
|
||||
this.errorShow = true;
|
||||
// 同时关闭成功弹窗
|
||||
this.successShow = false;
|
||||
return
|
||||
}
|
||||
// 刷卡成功
|
||||
this.successShow = true;
|
||||
// 同时关闭失败弹窗
|
||||
this.errorShow = false;
|
||||
return
|
||||
if (data) {
|
||||
console.log("%c%s", "color:red", "nfc刷卡成功");
|
||||
this.successShow = true;
|
||||
// 同时关闭失败弹窗
|
||||
this.errorShow = false;
|
||||
} else {
|
||||
console.log("%c%s", "color:red", "刷卡失败");
|
||||
this.errorShow = true;
|
||||
// 同时关闭成功弹窗
|
||||
this.successShow = false;
|
||||
}
|
||||
},
|
||||
// 上传图片
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<view v-if="true" style="display:flex">
|
||||
<u-button type="error" @click="testFn">调试录入卡片</u-button>
|
||||
<u-button type="error" @click="test1Fn">调试token过期</u-button>
|
||||
</view>
|
||||
<daySelect @dateChange="onDateChange" />
|
||||
<view v-if="isToday" class="task-info">
|
||||
<view class="title">今日任务</view>
|
||||
|
@ -133,9 +137,38 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
testFn(){
|
||||
let u = navigator.userAgent;
|
||||
let isAndroid =
|
||||
u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
|
||||
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
|
||||
try {
|
||||
if (isAndroid && AndroidJs) {
|
||||
console.log("%c%s", "color:red", "安卓--调用方法");
|
||||
const reqRow = {
|
||||
name: "input",
|
||||
data: "",
|
||||
};
|
||||
AndroidJs.func(JSON.stringify(reqRow)); // 给安卓传参
|
||||
} else {
|
||||
console.log("%c%s", "color:red", "苹果--调用方法");
|
||||
const reqRow = {
|
||||
name: "back-iphone",
|
||||
data: "",
|
||||
};
|
||||
window.webkit.messageHandlers.func.postMessage(
|
||||
JSON.stringify(reqRow)
|
||||
); // 给ios 传参
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e, "e-----判断安卓苹果类型出错");
|
||||
}
|
||||
},
|
||||
test1Fn(){
|
||||
uni.setStorageSync("token", "Bearer ");
|
||||
this.getPlanByDate();
|
||||
},
|
||||
onDateChange({ date, isToday }) {
|
||||
// 对接完登陆后解开
|
||||
// return
|
||||
this.isToday = isToday;
|
||||
this.currentDate = date;
|
||||
this.getPlanByDate();
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -61,7 +61,7 @@ const baseRequest = async (url, method, data = {}, loading = true) => {
|
|||
if (isAndroid && AndroidJs) {
|
||||
console.log("%c%s", "color:red", "安卓--调用返回方法");
|
||||
const reqRow = {
|
||||
name: "back-android",
|
||||
name: "logout",
|
||||
data: "",
|
||||
};
|
||||
AndroidJs.func(JSON.stringify(reqRow)); // 给安卓传参
|
||||
|
|
Loading…
Reference in New Issue