|
|
|
@ -7,7 +7,7 @@
|
|
|
|
|
<span style="color: #efc54e">仓库管理</span>
|
|
|
|
|
</view>
|
|
|
|
|
<view>使用你的手机号登录</view>
|
|
|
|
|
<view class="login" >
|
|
|
|
|
<view class="login">
|
|
|
|
|
<view class="login-input" v-if="!haveCode">
|
|
|
|
|
<up-input placeholder="请输入手机号" v-model="state.TelNum" clearable>
|
|
|
|
|
<template #prefix>
|
|
|
|
@ -21,11 +21,17 @@
|
|
|
|
|
</up-input>
|
|
|
|
|
</view>
|
|
|
|
|
<span
|
|
|
|
|
style="text-align: right; color: #e3af1c;"
|
|
|
|
|
@click="goToPassword" v-if="isCode&&!haveCode"
|
|
|
|
|
>密码登录</span>
|
|
|
|
|
style="text-align: right; color: #e3af1c"
|
|
|
|
|
@click="goToPassword"
|
|
|
|
|
v-if="isCode && !haveCode"
|
|
|
|
|
>密码登录</span
|
|
|
|
|
>
|
|
|
|
|
<view class="login-input" v-if="!isCode">
|
|
|
|
|
<up-input placeholder="请输入密码" :password="true" v-model="state.Password">
|
|
|
|
|
<up-input
|
|
|
|
|
placeholder="请输入密码"
|
|
|
|
|
:password="true"
|
|
|
|
|
v-model="state.Password"
|
|
|
|
|
>
|
|
|
|
|
<template #prefix>
|
|
|
|
|
<up-text
|
|
|
|
|
text="密码"
|
|
|
|
@ -40,42 +46,50 @@
|
|
|
|
|
<view v-if="haveCode">
|
|
|
|
|
<view class="code-box">
|
|
|
|
|
<span style="color: #888888">已发送验证码至 </span>
|
|
|
|
|
<span>123123123</span>
|
|
|
|
|
<span style="font-weight: bold">{{ state.TelNum }}</span>
|
|
|
|
|
</view>
|
|
|
|
|
<up-code-input v-model="code" :maxlength="6"></up-code-input>
|
|
|
|
|
<view style="display: flex; justify-content: space-between; align-items: center; margin-top: 20rpx;">
|
|
|
|
|
<span
|
|
|
|
|
style="text-align: left; color: #e3af1c;"
|
|
|
|
|
@click=""
|
|
|
|
|
>重新发送</span>
|
|
|
|
|
<view
|
|
|
|
|
style="
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-top: 20rpx;
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<span style="text-align: left; color: #e3af1c" @click=""
|
|
|
|
|
>重新发送</span
|
|
|
|
|
>
|
|
|
|
|
<span
|
|
|
|
|
style="text-align: right; color: #e3af1c;"
|
|
|
|
|
@click="goToPassword"
|
|
|
|
|
>密码登录</span>
|
|
|
|
|
style="text-align: right; color: #e3af1c"
|
|
|
|
|
@click.stop="goToPassword"
|
|
|
|
|
>密码登录</span
|
|
|
|
|
>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view> </view>
|
|
|
|
|
<view
|
|
|
|
|
<text
|
|
|
|
|
style="text-align: right; color: #e3af1c; margin-top: 20rpx"
|
|
|
|
|
@click="toCode" v-if="!isCode"
|
|
|
|
|
>验证码登录</view
|
|
|
|
|
@click="toCode"
|
|
|
|
|
v-if="!isCode"
|
|
|
|
|
>验证码登录</text
|
|
|
|
|
>
|
|
|
|
|
<up-button
|
|
|
|
|
style="width: 626rpx; margin: auto; height: 96rpx;margin-top: 90rpx;"
|
|
|
|
|
style="width: 626rpx; margin: auto; height: 96rpx; margin-top: 90rpx"
|
|
|
|
|
color="#EFC54E"
|
|
|
|
|
throttleTime="5"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
@click="logining"
|
|
|
|
|
v-if="!isCode"
|
|
|
|
|
v-if="!isCode || haveCode"
|
|
|
|
|
>登录</up-button
|
|
|
|
|
>
|
|
|
|
|
<up-button
|
|
|
|
|
style="width: 626rpx; margin: auto; height: 96rpx;margin-top: 90rpx;"
|
|
|
|
|
style="width: 626rpx; margin: auto; height: 96rpx; margin-top: 90rpx"
|
|
|
|
|
color="#EFC54E"
|
|
|
|
|
throttleTime="5"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
@click="obtainCode"
|
|
|
|
|
v-if="isCode&&!haveCode"
|
|
|
|
|
v-if="isCode && !haveCode"
|
|
|
|
|
>获取验证码</up-button
|
|
|
|
|
>
|
|
|
|
|
</view>
|
|
|
|
@ -83,20 +97,92 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { ref,reactive } from "vue";
|
|
|
|
|
import { ref, reactive } from "vue";
|
|
|
|
|
import useToast from "@/hooks/toast/useToast.js";
|
|
|
|
|
import {
|
|
|
|
|
userLogin,userSend
|
|
|
|
|
} from "@/api/login.js";
|
|
|
|
|
import { onLoad } from "@dcloudio/uni-app";
|
|
|
|
|
import { userLogin, userSend, pbDetail } from "@/api/login.js";
|
|
|
|
|
const state = reactive({
|
|
|
|
|
TelNum:'15190039212',
|
|
|
|
|
Password:'',
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
TelNum: "15190039212",
|
|
|
|
|
Password: "Jia011225",
|
|
|
|
|
id: "",
|
|
|
|
|
pid: "",
|
|
|
|
|
});
|
|
|
|
|
const { showMessage } = useToast();
|
|
|
|
|
const loading = ref(false);
|
|
|
|
|
const isCode = ref(false);
|
|
|
|
|
const haveCode = ref(false);
|
|
|
|
|
onLoad((options) => {
|
|
|
|
|
console.log('options',options)
|
|
|
|
|
state.id = options.id;
|
|
|
|
|
state.pid = options.pid;
|
|
|
|
|
console.log("222", state.id);
|
|
|
|
|
const token = uni.getStorageSync("token");
|
|
|
|
|
const userInfo = uni.getStorageSync("userInfo");
|
|
|
|
|
console.log('userInfo',token,userInfo)
|
|
|
|
|
// 已经登录了
|
|
|
|
|
if (token && userInfo) {
|
|
|
|
|
paintingDetail();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1.先调用options的对应接口
|
|
|
|
|
2.判断是是否有没有登录
|
|
|
|
|
3如果登录了判断状态去相应页面
|
|
|
|
|
4.没有登录让他登录,然后根据状态判断去相应页面
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
});
|
|
|
|
|
const paintingDetail = async () => {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
console.log('state',state)
|
|
|
|
|
const res = await pbDetail({
|
|
|
|
|
id: state.id,
|
|
|
|
|
pid: state.pid,
|
|
|
|
|
});
|
|
|
|
|
console.log(1111111111111,res)
|
|
|
|
|
if (res.status === 0) {
|
|
|
|
|
state.boxRelBucketStatus=res.data.boxRelBucketStatus;
|
|
|
|
|
console.log("boxRelBucketStatus",state.boxRelBucketStatus)
|
|
|
|
|
if (res.data.pbStatus == 1) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/pages/index/index?id="+state.id+'&pid='+state.pid,
|
|
|
|
|
success: () => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
},
|
|
|
|
|
fail: () => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
showMessage({ type: "default", message: "跳转失败" });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (res.data.boxRelBucketStatus == 3) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/pages/painting/index?id="+state.id+'&pid='+state.pid,
|
|
|
|
|
success: () => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
},
|
|
|
|
|
fail: () => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
showMessage({ type: "default", message: "跳转失败" });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}else {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/pages/detail/index?id="+state.id+'&pid='+state.pid+'&boxRelBucketStatus='+state.boxRelBucketStatus,
|
|
|
|
|
success: () => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
},
|
|
|
|
|
fail: () => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
showMessage({ type: "default", message: "跳转失败" });
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// const show = () => {
|
|
|
|
|
// showMessage({ type: "default", message: "验证码已发送" });
|
|
|
|
|
// };
|
|
|
|
@ -104,10 +190,10 @@ const toCode = () => {
|
|
|
|
|
isCode.value = true;
|
|
|
|
|
};
|
|
|
|
|
const obtainCode = async () => {
|
|
|
|
|
console.log('获取验证码')
|
|
|
|
|
console.log("获取验证码");
|
|
|
|
|
loading.value = true;
|
|
|
|
|
const res = await userSend({
|
|
|
|
|
TelNum: state.TelNum ?? '',
|
|
|
|
|
TelNum: state.TelNum ?? "",
|
|
|
|
|
});
|
|
|
|
|
if (res.status === 0) {
|
|
|
|
|
haveCode.value = true;
|
|
|
|
@ -117,31 +203,25 @@ const obtainCode = async () => {
|
|
|
|
|
}
|
|
|
|
|
loading.value = false;
|
|
|
|
|
};
|
|
|
|
|
const goToPassword = () =>{
|
|
|
|
|
isCode.value=false;
|
|
|
|
|
const goToPassword = () => {
|
|
|
|
|
isCode.value = false;
|
|
|
|
|
haveCode.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 登录方法
|
|
|
|
|
const logining = async () => {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
const res = await userLogin({
|
|
|
|
|
TelNum:state.TelNum ?? '' ,
|
|
|
|
|
Password:state.Password ?? '',
|
|
|
|
|
TelNum: state.TelNum ?? "",
|
|
|
|
|
Password: state.Password ?? "",
|
|
|
|
|
});
|
|
|
|
|
if(res.status === 0){
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/index/index',
|
|
|
|
|
success: () => {
|
|
|
|
|
loading.value = false;
|
|
|
|
|
},
|
|
|
|
|
fail: () => {
|
|
|
|
|
if (res.status === 0) {
|
|
|
|
|
uni.setStorageSync("token", res.data.Token);
|
|
|
|
|
uni.setStorageSync("userInfo", res.data.AccountInfo);
|
|
|
|
|
await paintingDetail();
|
|
|
|
|
|
|
|
|
|
loading.value = false;
|
|
|
|
|
showMessage({ type: "default", message: "跳转失败" });
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
loading.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|