fix:bug修复

This commit is contained in:
hhui 2024-04-28 14:52:35 +08:00
parent 53f405070d
commit dc7a15f3e8
3 changed files with 835 additions and 838 deletions

View File

@ -80,122 +80,63 @@
</template> </template>
<script> <script>
import QS from "qs" import QS from "qs"
export default { export default {
data() { data() {
return { return {
fetchList: [ fetchList: [
], ],
codeVal: '', codeVal: '',
manageType: '', manageType: '',
infoList: '', infoList: '',
multiNum: 1, multiNum: 1,
subList: {}, subList: {},
fixVal: '', fixVal: '',
fixRange: [{ fixRange: [{
text: '合格', text: '合格',
value: '0' value: '0'
}, },
{ {
text: '待修', text: '待修',
value: '1' value: '1'
}, },
{ {
text: '待报废', text: '待报废',
value: '2' value: '2'
}
],
passedNum: '',
waitRepairNum: '',
waitCrashNum: '',
detailsId: '',
taskId: '',
submitFlag:false,
taskStatus:'',
transMaCode: '',
rfidNum: '',
sendTypeId: '',
parentId: ''
} }
}, ],
methods: { passedNum: '',
openPopup(list) { waitRepairNum: '',
console.log(list); waitCrashNum: '',
this.infoList = list detailsId: '',
this.rfidNum = list.num taskId: '',
this.transMaCode = list.code submitFlag: false,
this.sendTypeId = list.typeId taskStatus: '',
this.parentId = list.id transMaCode: '',
if(Number(list.num)==0){ rfidNum: '',
uni.showToast({ sendTypeId: '',
icon: 'none', parentId: ''
title: '待退料数据为0请勿再点击' }
}) },
return methods: {
} openPopup(list) {
if (this.infoList.manageType == '0') { console.log(list);
this.$refs.popup1.open() this.infoList = list
} else { this.rfidNum = list.num
const userInfo = uni.getStorageSync('userInfo'); this.transMaCode = list.code
console.log("userInfo", userInfo) this.sendTypeId = list.typeId
const userId = userInfo.userid this.parentId = list.id
if (Number(list.num) == 0) {
const { uni.showToast({
taskId, icon: 'none',
id, title: '待退料数据为0请勿再点击'
typeId,
modelId,
manageType,
typeName,
typeCode,
num
} = this.infoList
const params = {
taskId,
id,
typeId,
modelId,
manageType,
userId,
typeName,
typeCode,
num
}
const urlStr = QS.stringify(params)
console.log("urlSTR", urlStr)
uni.navigateTo({
url: `/pages/numReceive/numReceive?${urlStr}`
})
}
},
closePopup1() {
this.$refs.popup1.close()
},
closePopup2() {
this.$refs.popup2.close()
},
scanCode() {
const that = this
that.closePopup1()
/* uni.scanCode({
success: (res) => {
console.log("beforeScan", res);
const userInfo = uni.getStorageSync('userInfo');
console.log("beforeScan11111", userInfo,that.taskId)
const userId = userInfo.userid
uni.navigateTo({
url: `/pages/scanReceive/scanReceive?code=${res.result}&typeId=${that.infoList.typeId}&num=${that.infoList.num}&parentId=${that.infoList.id}&manageType=${that.infoList.manageType}&taskId=${that.taskId}&createBy=${userId}&scanType="back"`
})
}
}) */
const userId = uni.getStorageSync('userInfo').userid
uni.navigateTo({
url: `/pages/QRIn/QRIn?typeId=${that.infoList.modelId}&num=${that.infoList.num}&parentId=${that.infoList.id}&manageType=${that.infoList.manageType}&taskId=${that.taskId}&createBy=${userId}&scanType="back"`
}) })
}, return
codeOut() { }
this.closePopup1() if (this.infoList.manageType == '0') {
this.$refs.popup1.open()
} else {
const userInfo = uni.getStorageSync('userInfo'); const userInfo = uni.getStorageSync('userInfo');
console.log("userInfo", userInfo) console.log("userInfo", userInfo)
const userId = userInfo.userid const userId = userInfo.userid
@ -224,285 +165,345 @@
const urlStr = QS.stringify(params) const urlStr = QS.stringify(params)
console.log("urlSTR", urlStr) console.log("urlSTR", urlStr)
uni.navigateTo({ uni.navigateTo({
url: `/pages/codeReceive/codeReceive?${urlStr}&maCode=${this.transMaCode}` url: `/pages/numReceive/numReceive?${urlStr}`
}) })
},
rfidOut () {
this.closePopup1()
uni.navigateTo({
url: `/pages/rfidReceive/rfidReceive?waitOut=${this.rfidNum}&typeId=${this.sendTypeId}&parentId=${this.parentId}&taskId=${this.taskId}`
})
},
multiOut() {
let that = this
this.closePopup2()
that.subList = {
parentId: that.infoList.parenntId,
typeId: that.infoList.typeId,
outNum: that.multiNum,
companyId: uni.getStorageSync('userInfo').sysUser.companyId
}
console.log(that.subList);
that.$api.fetchMaterialOutStore.subOutStore(that.subList, null).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: '退料接收成功!',
success: () => {
uni.navigateBack()
}
})
} else {
uni.showToast({
icon: 'none',
title: '退料接收失败!'
})
}
}).catch(err => {
console.log(err);
})
},
initListData() {
let that = this
console.log(that.detailsId);
that.$api.backMaterialReceive.backMaterialReceiveDetail({
id: that.detailsId
}).then(res => {
console.log(res);
if (res.data.code == 200) {
/* for (let i = 0; i < res.data.data.length; i++) {
res.data.data[i].num = res.data.data[i].num.split('.')[0]
} */
that.fetchList = res.data.data
console.log(that.fetchList);
}
}).catch(err => {
console.log(err);
})
},
backReceiveEndBackFn() {
const that = this
let total = that.reduceNumTotal()
console.log("total==",total)
if (total > 0) {
uni.showToast({
icon: 'none',
title: '请完成退料接收后才能结束任务'
})
return
}
// submitFlag false
if(that.submitFlag==true){
return
}
that.submitFlag = true
console.log(that.taskId, that.detailsId);
that.$api.backMaterialReceive.backReceiveEndBack({
createBy: uni.getStorageSync('userInfo').userid,
taskId: that.taskId,
parentId: that.detailsId
}).then(res => {
console.log(res)
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: '结束任务成功'
})
console.log("退料结束",res)
that.submitFlag = false
uni.navigateBack()
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err=>{
that.submitFlag = false
}).finally(result=>{
that.submitFlag = false
})
},
reduceNumTotal() {
const that = this
let sum = that.fetchList.reduce((accumulator, currentValue) => {
return accumulator + Number(currentValue.num);
}, 0);
console.log("numaccumulator", sum)
return sum
} }
}, },
onLoad(params) { closePopup1() {
console.log(params); this.$refs.popup1.close()
this.taskId = params.taskId
this.detailsId = params.id
this.taskStatus = params.taskStatus
}, },
onShow() { closePopup2() {
this.initListData() this.$refs.popup2.close()
}, },
onNavigationBarButtonTap(ev) { scanCode() {
console.log("点击了自定义按钮", ev);
const that = this const that = this
if (ev.text == '结束任务') { that.closePopup1()
if(this.taskStatus=="40"){ /* uni.scanCode({
success: (res) => {
console.log("beforeScan", res);
const userInfo = uni.getStorageSync('userInfo');
console.log("beforeScan11111", userInfo,that.taskId)
const userId = userInfo.userid
uni.navigateTo({
url: `/pages/scanReceive/scanReceive?code=${res.result}&typeId=${that.infoList.typeId}&num=${that.infoList.num}&parentId=${that.infoList.id}&manageType=${that.infoList.manageType}&taskId=${that.taskId}&createBy=${userId}&scanType="back"`
})
}
}) */
const userId = uni.getStorageSync('userInfo').userid
uni.navigateTo({
url: `/pages/QRIn/QRIn?typeId=${that.infoList.modelId}&num=${that.infoList.num}&parentId=${that.infoList.id}&manageType=${that.infoList.manageType}&taskId=${that.taskId}&createBy=${userId}&scanType="back"`
})
},
codeOut() {
this.closePopup1()
const userInfo = uni.getStorageSync('userInfo');
console.log("userInfo", userInfo)
const userId = userInfo.userid
const {
taskId,
id,
typeId,
modelId,
manageType,
typeName,
typeCode,
num
} = this.infoList
const params = {
taskId,
id,
typeId,
modelId,
manageType,
userId,
typeName,
typeCode,
num
}
const urlStr = QS.stringify(params)
console.log("urlSTR", urlStr)
uni.navigateTo({
url: `/pages/codeReceive/codeReceive?${urlStr}&maCode=${this.transMaCode}`
})
},
rfidOut() {
this.closePopup1()
uni.navigateTo({
url: `/pages/rfidReceive/rfidReceive?waitOut=${this.rfidNum}&typeId=${this.sendTypeId}&parentId=${this.parentId}&taskId=${this.taskId}`
})
},
multiOut() {
let that = this
this.closePopup2()
that.subList = {
parentId: that.infoList.parenntId,
typeId: that.infoList.typeId,
outNum: that.multiNum,
companyId: uni.getStorageSync('userInfo').sysUser.companyId
}
console.log(that.subList);
that.$api.fetchMaterialOutStore.subOutStore(that.subList, null).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '请勿再点击' title: '退料接收成功!',
success: () => {
uni.navigateBack()
}
})
} else {
uni.showToast({
icon: 'none',
title: '退料接收失败!'
}) })
return
} }
that.backReceiveEndBackFn() }).catch(err => {
console.log(err);
})
},
initListData() {
let that = this
console.log(that.detailsId);
that.$api.backMaterialReceive.backMaterialReceiveDetail({
id: that.detailsId
}).then(res => {
console.log(res);
if (res.data.code == 200) {
/* for (let i = 0; i < res.data.data.length; i++) {
res.data.data[i].num = res.data.data[i].num.split('.')[0]
} */
that.fetchList = res.data.data
console.log(that.fetchList);
}
}).catch(err => {
console.log(err);
})
},
backReceiveEndBackFn() {
const that = this
let total = that.reduceNumTotal()
console.log("total==", total)
if (total > 0) {
uni.showToast({
icon: 'none',
title: '请完成退料接收后才能结束任务'
})
return
} }
// submitFlag false
if (that.submitFlag == true) {
return
}
that.submitFlag = true
console.log(that.taskId, that.detailsId);
that.$api.backMaterialReceive.backReceiveEndBack({
createBy: uni.getStorageSync('userInfo').userid,
taskId: that.taskId,
parentId: that.detailsId
}).then(res => {
console.log(res)
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: '结束任务成功'
})
console.log("退料结束", res)
that.submitFlag = false
uni.navigateBack()
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err, 'sss');
that.submitFlag = false
}).finally(result => {
that.submitFlag = false
})
},
reduceNumTotal() {
const that = this
let sum = that.fetchList.reduce((accumulator, currentValue) => {
return accumulator + Number(currentValue.num);
}, 0);
console.log("numaccumulator", sum)
return sum
}
},
onLoad(params) {
console.log(params);
this.taskId = params.taskId
this.detailsId = params.id
this.taskStatus = params.taskStatus
},
onShow() {
this.initListData()
},
onNavigationBarButtonTap(ev) {
console.log("点击了自定义按钮", ev);
const that = this
if (ev.text == '结束任务') {
if (this.taskStatus == "40") {
uni.showToast({
icon: 'none',
title: '请勿再点击'
})
return
}
that.backReceiveEndBackFn()
} }
} }
}
</script> </script>
<style lang="scss"> <style lang="scss">
.single-fetch { .single-fetch {
width: 100%; width: 100%;
box-sizing: border-box;
padding: 20rpx 35rpx;
border-bottom: 1px solid #DDDDDD;
view {
display: flex;
align-items: center;
margin-bottom: 25rpx;
span {
color: #A7A7A7;
padding-right: 20rpx;
}
h4 {
font-size: 14px;
font-weight: normal;
}
}
view:last-child {
margin-bottom: 0;
}
}
.btm-exam {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
box-sizing: border-box;
padding: 20rpx 40rpx;
display: flex;
justify-content: flex-end;
border-top: 2px solid #F6F8FF;
.exam {
box-sizing: border-box; box-sizing: border-box;
padding: 20rpx 35rpx; padding: 10rpx 50rpx;
border-bottom: 1px solid #DDDDDD; border-radius: 30rpx;
background-color: #3788FF;
font-size: 14px;
color: #fff;
}
}
.popup1 {
width: 80vw;
height: 20vh;
background-color: #fff;
border-radius: 15rpx;
overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
.pop-top {
width: 100%;
height: 5vh;
box-sizing: border-box;
padding: 0 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.select-area {
width: 85%;
margin: 40rpx auto;
display: flex;
justify-content: space-around;
align-items: center;
view { view {
box-sizing: border-box;
font-size: 14px;
padding: 10rpx 20rpx;
border: 1px solid #D5D5D4;
border-radius: 20rpx;
}
}
.ipt-area {
width: 85%;
margin: 40rpx auto;
}
}
.popup2 {
width: 80vw;
height: 60vh;
background-color: #fff;
border-radius: 15rpx;
overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
.pop-top {
width: 100%;
height: 5vh;
box-sizing: border-box;
padding: 0 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.info-area {
width: 85%;
margin: 30rpx auto;
display: flex;
flex-direction: column;
view {
margin-bottom: 15rpx;
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 25rpx;
span {
color: #A7A7A7;
padding-right: 20rpx;
}
h4 { h4 {
font-size: 14px;
font-weight: normal; font-weight: normal;
} color: #989898;
}
view:last-child {
margin-bottom: 0;
}
}
.btm-exam {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
box-sizing: border-box;
padding: 20rpx 40rpx;
display: flex;
justify-content: flex-end;
border-top: 2px solid #F6F8FF;
.exam {
box-sizing: border-box;
padding: 10rpx 50rpx;
border-radius: 30rpx;
background-color: #3788FF;
font-size: 14px;
color: #fff;
}
}
.popup1 {
width: 80vw;
height: 20vh;
background-color: #fff;
border-radius: 15rpx;
overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
.pop-top {
width: 100%;
height: 5vh;
box-sizing: border-box;
padding: 0 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.select-area {
width: 85%;
margin: 40rpx auto;
display: flex;
justify-content: space-around;
align-items: center;
view {
box-sizing: border-box;
font-size: 14px; font-size: 14px;
padding: 10rpx 20rpx; width: 35%;
border: 1px solid #D5D5D4;
border-radius: 20rpx;
} }
}
.ipt-area { span {
width: 85%; font-size: 14px;
margin: 40rpx auto; }
} }
} }
.popup2 { .sub-btn {
width: 80vw; width: 85%;
height: 60vh; margin: 30rpx auto;
background-color: #fff; background-color: #3788FF;
border-radius: 15rpx; color: #fff;
overflow: hidden; box-sizing: border-box;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff); padding: 15rpx 0;
display: flex;
.pop-top { justify-content: center;
width: 100%; align-items: center;
height: 5vh; border-radius: 40rpx;
box-sizing: border-box; font-size: 14px;
padding: 0 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.info-area {
width: 85%;
margin: 30rpx auto;
display: flex;
flex-direction: column;
view {
margin-bottom: 15rpx;
display: flex;
align-items: center;
h4 {
font-weight: normal;
color: #989898;
font-size: 14px;
width: 35%;
}
span {
font-size: 14px;
}
}
}
.sub-btn {
width: 85%;
margin: 30rpx auto;
background-color: #3788FF;
color: #fff;
box-sizing: border-box;
padding: 15rpx 0;
display: flex;
justify-content: center;
align-items: center;
border-radius: 40rpx;
font-size: 14px;
}
} }
}
</style> </style>

View File

@ -1,18 +1,10 @@
<template> <template>
<view> <view>
<view class="ipt-area"> <view class="ipt-area">
<uni-easyinput <uni-easyinput suffixIcon="search" v-model="keywordVal" placeholder="请输入领料单号"
suffixIcon="search" @iconClick="searchKeyword"></uni-easyinput>
v-model="keywordVal"
placeholder="请输入关键字"
@iconClick="searchKeyword"
></uni-easyinput>
</view> </view>
<view <view class="single-fetch" v-for="(fetch, index) in fetchMaterialList" :key="index">
class="single-fetch"
v-for="(fetch, index) in fetchMaterialList"
:key="index"
>
<view class="fetch-upper"> <view class="fetch-upper">
<!-- {{ fetch.taskStatus }} --> <!-- {{ fetch.taskStatus }} -->
<!-- <checkbox-group <!-- <checkbox-group
@ -30,10 +22,7 @@
<h4 style="color: #989898;">{{ fetch.phoneNumber }}</h4> <h4 style="color: #989898;">{{ fetch.phoneNumber }}</h4>
</view> </view>
</view> </view>
<view <view class="fetch-lower" @click="seeDetail(fetch.taskId, fetch.taskStatus, fetch.id)">
class="fetch-lower"
@click="seeDetail(fetch.taskId, fetch.taskStatus, fetch.id)"
>
<view> <view>
<span>领料申请单位</span> <span>领料申请单位</span>
<h4>{{ fetch.unitName }}</h4> <h4>{{ fetch.unitName }}</h4>
@ -82,38 +71,22 @@
</view> </view>
</view> --> </view> -->
<view class="sticky-area"> <view class="sticky-area">
<h4 <h4 v-show="fetch.taskStatus == '33'">
v-show="fetch.taskStatus == '33'"
>
待出库 待出库
</h4> </h4>
<h4 <h4 v-show="fetch.taskStatus == '34'">
v-show="fetch.taskStatus == '34'"
>
出库进行中 出库进行中
</h4> </h4>
<h4 <h4 v-show="fetch.taskStatus == '35'" style="border: 1px solid #27D870; color: #27D870;">
v-show="fetch.taskStatus == '35'"
style="border: 1px solid #27D870; color: #27D870;"
>
出库完成 出库完成
</h4> </h4>
<h4 <h4 v-show="fetch.taskStatus == '98'" style="border: 1px solid #EE603D; color: #EE603D;">
v-show="fetch.taskStatus == '98'"
style="border: 1px solid #EE603D; color: #EE603D;"
>
分公司审核驳回 分公司审核驳回
</h4> </h4>
<h4 <h4 v-show="fetch.taskStatus == '99'" style="border: 1px solid #EE603D; color: #EE603D;">
v-show="fetch.taskStatus == '99'"
style="border: 1px solid #EE603D; color: #EE603D;"
>
分管审核驳回 分管审核驳回
</h4> </h4>
<h4 <h4 v-show="fetch.taskStatus == '100'" style="border: 1px solid #EE603D; color: #EE603D;">
v-show="fetch.taskStatus == '100'"
style="border: 1px solid #EE603D; color: #EE603D;"
>
内部审核驳回 内部审核驳回
</h4> </h4>
</view> </view>
@ -138,232 +111,248 @@
<script> <script>
import { basePath } from '../../public' import { basePath } from '../../public'
export default { export default {
data() { data() {
return { return {
keywordVal: '', keywordVal: '',
showLoading: false, showLoading: false,
allChecked: false, allChecked: false,
fetchMaterialList: [ fetchMaterialList: [
], ],
examList: [] examList: []
}
},
methods: {
seeDetail(taskId, taskStatus, id) {
// if (taskStatus == 33) {
uni.navigateTo({
url: `/pages/fetchMaterialOutStoreDetail/fetchMaterialOutStoreDetail?taskId=${taskId}&taskStatus=${taskStatus}&id=${id}`
})
// }
},
/* checkAll() {
this.allChecked = !this.allChecked
if (this.allChecked) {
this.fetchMaterialList.map(item => {
if (item.checked == false) {
item.checked = true
}
})
} else {
this.fetchMaterialList.map(item => {
if (item.checked == true) {
item.checked = false
}
})
} }
}, },
methods: { checkClick(item) {
seeDetail (taskId, taskStatus, id) { item.checked = !item.checked
// if (taskStatus == 33) { if (!item.checked) {
uni.navigateTo({ this.allChecked = false
url: `/pages/fetchMaterialOutStoreDetail/fetchMaterialOutStoreDetail?taskId=${taskId}&taskStatus=${taskStatus}&id=${id}` } else {
}) const goods = this.fetchMaterialList.every(item => {
// } return item.checked === true
}, })
/* checkAll() { if (goods) {
this.allChecked = !this.allChecked this.allChecked = true
if (this.allChecked) {
this.fetchMaterialList.map(item => {
if (item.checked == false) {
item.checked = true
}
})
} else { } else {
this.fetchMaterialList.map(item => {
if (item.checked == true) {
item.checked = false
}
})
}
},
checkClick(item) {
item.checked = !item.checked
if (!item.checked) {
this.allChecked = false this.allChecked = false
} else {
const goods = this.fetchMaterialList.every(item => {
return item.checked === true
})
if (goods) {
this.allChecked = true
} else {
this.allChecked = false
}
} }
}, */ }
toggleExam () { }, */
let that = this toggleExam() {
that.examList = that.fetchMaterialList.filter((item) => { let that = this
return item.checked == true that.examList = that.fetchMaterialList.filter((item) => {
}).map((subItem) => { return item.checked == true
return { }).map((subItem) => {
name: subItem['name'], return {
number: subItem['fetchNum'] name: subItem['name'],
} number: subItem['fetchNum']
}) }
console.log(that.examList); })
}, console.log(that.examList);
closePopup () { },
this.$refs.popup.close() closePopup() {
}, this.$refs.popup.close()
seeExam (name) { },
console.log(name); seeExam(name) {
this.$refs.popup.open() console.log(name);
}, this.$refs.popup.open()
formSubmit () { },
let that = this formSubmit() {
that.$refs.examForm.validate().then(formData => { let that = this
console.log(formData); that.$refs.examForm.validate().then(formData => {
that.$refs.popup.close() console.log(formData);
}) that.$refs.popup.close()
}, })
initFetch (code) { },
let that = this initFetch(code) {
that.showLoading = true let that = this
// that.showLoading = true
that.$api.fetchExam.fetchExamList({ //
code, that.$api.fetchExam.fetchExamList({
role: uni.getStorageSync('roles').join(','), code,
flag: 0 role: uni.getStorageSync('roles').join(','),
}).then(res => { flag: 0
console.log(res); }).then(res => {
if (res.data.code == 200) { console.log(code);
if (res.data.data.rows.length == 0) { if (res.data.code == 200) {
that.showLoading = false if (res.data.data.rows.length == 0) {
uni.showToast({
icon: 'none',
title: '未查询到相关数据!'
})
} else {
that.showLoading = false
that.fetchMaterialList = res.data.data.rows
}
} else {
that.showLoading = false that.showLoading = false
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: res.data.msg title: '未查询到相关数据!'
}) })
} else {
that.showLoading = false
that.fetchMaterialList = res.data.data.rows
} }
}).catch(err => { } else {
console.log(err); that.showLoading = false
}) uni.showToast({
}, icon: 'none',
searchKeyword () { title: res.data.msg
this.initFetch(this.keywordVal) })
} }
}).catch(err => {
console.log(err);
})
}, },
onShow() { searchKeyword() {
let that = this this.initFetch(this.keywordVal)
console.log(uni.getStorageSync('roles').join(','));
that.initFetch('')
} }
},
onShow() {
let that = this
console.log(uni.getStorageSync('roles').join(','));
that.initFetch('')
} }
}
</script> </script>
<style lang="scss"> <style lang="scss">
body{ body {
background-color: #f8f8f8; background-color: #f8f8f8;
box-sizing: border-box; box-sizing: border-box;
padding-bottom: 10vh; padding-bottom: 10vh;
} }
.ipt-area{
width: 95%; .ipt-area {
margin: 20rpx auto; width: 95%;
} margin: 20rpx auto;
.single-fetch{ }
width: 95%;
margin: 20rpx auto; .single-fetch {
background-color: #fff; width: 95%;
border-radius: 15rpx; margin: 20rpx auto;
background-color: #fff;
border-radius: 15rpx;
box-sizing: border-box;
padding: 15rpx;
position: relative;
.fetch-upper {
width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 15rpx; padding: 15rpx;
position: relative; border-bottom: 1px solid #D7D7D7;
.fetch-upper{ display: flex;
width: 100%; align-items: center;
box-sizing: border-box;
padding: 15rpx; .upper-lef {
border-bottom: 1px solid #D7D7D7; width: 12%;
height: 5vh;
border-radius: 15rpx;
display: flex; display: flex;
justify-content: center;
align-items: center; align-items: center;
.upper-lef{ background-color: #3789FD;
width: 12%; color: #fff;
height: 5vh; font-size: 24px;
border-radius: 15rpx;
display: flex;
justify-content: center;
align-items: center;
background-color: #3789FD;
color: #fff;
font-size: 24px;
}
.upper-rig{
flex: 1;
box-sizing: border-box;
padding: 10rpx 20rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
h4{
font-weight: normal;
font-size: 14px;
}
}
} }
.fetch-lower{
width: 100%; .upper-rig {
flex: 1;
box-sizing: border-box; box-sizing: border-box;
padding: 15rpx; padding: 10rpx 20rpx;
view{
width: 100%;
display: flex;
align-items: center;
margin-bottom: 15rpx;
font-size: 14px;
span{
color: #9D9D9D;
padding-right: 20rpx;
}
h4{
color: #000;
font-size: 14px;
font-weight: normal;
}
}
view:last-child{
margin-bottom: 0;
}
}
.fetch-btns{
width: 100%;
box-sizing: border-box;
padding: 15rpx;
display: flex; display: flex;
justify-content: flex-end; flex-direction: column;
view{ justify-content: space-around;
box-sizing: border-box;
padding: 8rpx 25rpx; h4 {
border-radius: 15rpx;
color: #fff;
margin-right: 15rpx;
font-size: 14px;
}
view:last-child{
margin-right: 0;
}
}
.sticky-area{
position: absolute;
top: 20rpx;
right: 20rpx;
h4{
box-sizing: border-box;
padding: 8rpx 20rpx;
border-radius: 15rpx;
font-size: 14px;
font-weight: normal; font-weight: normal;
background-color: #fff; font-size: 14px;
border: 1px solid #3788FF;
color: #3788FF;
} }
} }
} }
.fetch-lower {
width: 100%;
box-sizing: border-box;
padding: 15rpx;
view {
width: 100%;
display: flex;
align-items: center;
margin-bottom: 15rpx;
font-size: 14px;
span {
color: #9D9D9D;
padding-right: 20rpx;
}
h4 {
color: #000;
font-size: 14px;
font-weight: normal;
}
}
view:last-child {
margin-bottom: 0;
}
}
.fetch-btns {
width: 100%;
box-sizing: border-box;
padding: 15rpx;
display: flex;
justify-content: flex-end;
view {
box-sizing: border-box;
padding: 8rpx 25rpx;
border-radius: 15rpx;
color: #fff;
margin-right: 15rpx;
font-size: 14px;
}
view:last-child {
margin-right: 0;
}
}
.sticky-area {
position: absolute;
top: 20rpx;
right: 20rpx;
h4 {
box-sizing: border-box;
padding: 8rpx 20rpx;
border-radius: 15rpx;
font-size: 14px;
font-weight: normal;
background-color: #fff;
border: 1px solid #3788FF;
color: #3788FF;
}
}
}
</style> </style>

View File

@ -9,46 +9,44 @@
</view> </view>
</view> </view>
<view class="switch-log"> <view class="switch-log">
<view <view :class="[{ active: switchStatus == 1 }]" @click="switchUpper(1)">
:class="[{ active: switchStatus == 1 }]"
@click="switchUpper(1)"
>
账号登录 账号登录
</view> </view>
<view <view :class="[{ active: switchStatus == 2 }]" @click="switchUpper(2)">
:class="[{ active: switchStatus == 2 }]"
@click="switchUpper(2)"
>
手机登录 手机登录
</view> </view>
</view> </view>
<view class="login-area"> <view class="login-area">
<uni-forms v-show="switchStatus == 1" ref="accountForm" :modelValue="accountFormData" :rules="accountRules" class="form-area" label-position="top"> <uni-forms v-show="switchStatus == 1" ref="accountForm" :modelValue="accountFormData" :rules="accountRules"
class="form-area" label-position="top">
<uni-forms-item name="username" required label="用户名" label-width="100"> <uni-forms-item name="username" required label="用户名" label-width="100">
<uni-easyinput placeholder="请输入用户名称" maxlength="60" v-model="accountFormData.username"></uni-easyinput> <uni-easyinput placeholder="请输入用户名称" maxlength="60"
v-model="accountFormData.username"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="password" required label="密码" label-width="100"> <uni-forms-item name="password" required label="密码" label-width="100">
<uni-easyinput type="password" placeholder="请输入密码" maxlength="60" v-model="accountFormData.password"></uni-easyinput> <uni-easyinput type="password" placeholder="请输入密码" maxlength="60"
v-model="accountFormData.password"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<text <text style="
style="
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
color: #3689FF; color: #3689FF;
font-size: 14px; font-size: 14px;
" ">
>
忘记密码 忘记密码
</text> </text>
<button class="submit-btn" @click="accountSubmit">登录</button> <button class="submit-btn" @click="accountSubmit">登录</button>
</uni-forms> </uni-forms>
<uni-forms v-show="switchStatus == 2" ref="veriForm" :modelValue="veriFormData" :rules="veriRules" class="form-area" label-position="top"> <uni-forms v-show="switchStatus == 2" ref="veriForm" :modelValue="veriFormData" :rules="veriRules"
class="form-area" label-position="top">
<uni-forms-item name="phone" required label="手机号码" label-width="100"> <uni-forms-item name="phone" required label="手机号码" label-width="100">
<uni-easyinput placeholder="请输入手机号码" type="number" v-model="veriFormData.phone" maxlength="11"></uni-easyinput> <uni-easyinput placeholder="请输入手机号码" type="number" v-model="veriFormData.phone"
maxlength="11"></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item name="code" required label="验证码" label-width="100"> <uni-forms-item name="code" required label="验证码" label-width="100">
<uni-easyinput type="number" maxlength="6" placeholder="请输入验证码" v-model="veriFormData.code"></uni-easyinput> <uni-easyinput type="number" maxlength="6" placeholder="请输入验证码"
v-model="veriFormData.code"></uni-easyinput>
<button class="count-down" :disabled="sendDisabled" @click="sendVeriCode" style="font-size: 14px;"> <button class="count-down" :disabled="sendDisabled" @click="sendVeriCode" style="font-size: 14px;">
<span v-if="countDownStatus == 0">发送验证码</span> <span v-if="countDownStatus == 0">发送验证码</span>
<span v-if="countDownStatus == 1"> <span v-if="countDownStatus == 1">
@ -65,236 +63,245 @@
<script> <script>
import { authPath, publicPath, systemPath } from '../../public' import { authPath, publicPath, systemPath } from '../../public'
export default { export default {
data() { data() {
return { return {
showLoading: false, showLoading: false,
accountFormData: { accountFormData: {
username: '', username: '',
password: '' password: ''
},
veriFormData: {
phone: '',
code: ''
},
switchStatus: 1,
countDown: 60,
countDownStatus: 0,
sendDisabled: false,
givenCode: '',
accountRules: {
username: {
rules: [
{
required: true,
errorMessage: '请输入用户名称!'
}
]
},
password: {
rules: [
{
required: true,
errorMessage: '请输入密码!'
}
]
}
},
veriRules: {
phone: {
rules: [
{
required: true,
errorMessage: '请输入手机号码!'
}
]
},
code: {
rules: [
{
required: true,
errorMessage: '请输入验证码!'
}
]
}
}
}
},
methods: {
switchUpper (count) {
this.switchStatus = count
}, },
sendVeriCode () { veriFormData: {
let that = this phone: '',
let phoneReg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/ code: ''
if (!phoneReg.test(that.veriFormData.phone)) { },
uni.showToast({ switchStatus: 1,
icon: 'none', countDown: 60,
title: '请输入正确格式的手机号!' countDownStatus: 0,
}) sendDisabled: false,
} else { givenCode: '',
that.$api.login.codeLogin({ accountRules: {
phone: String(that.veriFormData.phone) username: {
}).then(res => { rules: [
console.log(res); {
}).catch(err => { required: true,
console.log(err); errorMessage: '请输入用户名称!'
}) }
that.countDownStatus = 1 ]
that.sendDisabled = true },
let timeInterval = setInterval(() => { password: {
that.countDown -= 1 rules: [
}, 1000) {
let timeOut = setTimeout(() => { required: true,
that.countDownStatus = 0 errorMessage: '请输入密码!'
that.countDown = 60 }
that.sendDisabled = false ]
clearInterval(timeInterval)
clearTimeout(timeOut)
}, 1000 * 60)
} }
}, },
veriSubmit () { veriRules: {
let that = this phone: {
that.$refs.veriForm.validate().then(formRes => { rules: [
that.showLoading = true {
console.log(formRes); required: true,
that.$api.login.checkCode(formRes).then(res => { errorMessage: '请输入手机号码!'
console.log(res);
if (res.data.code == 200) {
uni.setStorageSync('userInfo', res.data.data)
uni.setStorageSync('token', res.data.data.token)
uni.setStorageSync('roles', res.data.data.login_user.roles)
uni.setStorageSync('deptId', res.data.data.login_user.sysUser.dept.deptId)
uni.showToast({
icon: 'none',
title: '登录成功!',
success: () => {
that.showLoading = false
uni.switchTab({
url: '/pages/index/index'
})
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
that.showLoading = false
}
})
} }
}).catch(err => { ]
console.log(err); },
}) code: {
}) rules: [
}, {
accountSubmit () { required: true,
let that = this errorMessage: '请输入验证码!'
that.$refs.accountForm.validate().then(formData => {
that.showLoading = true
console.log(formData);
that.$api.login.log(formData).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.setStorageSync('userInfo', res.data.data.login_user)
uni.setStorageSync('token', res.data.data.access_token)
uni.setStorageSync('roles', res.data.data.login_user.roles)
uni.setStorageSync('deptId', res.data.data.login_user.sysUser.dept.deptId)
uni.showToast({
icon: 'none',
title: '登录成功!',
success: () => {
that.showLoading = false
uni.switchTab({
url: '/pages/index/index'
})
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
that.showLoading = false
}
})
} }
}).catch(err => { ]
console.log(err); }
})
})
} }
} }
},
methods: {
switchUpper(count) {
this.switchStatus = count
},
sendVeriCode() {
let that = this
let phoneReg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/
if (!phoneReg.test(that.veriFormData.phone)) {
uni.showToast({
icon: 'none',
title: '请输入正确格式的手机号!'
})
} else {
that.$api.login.codeLogin({
phone: String(that.veriFormData.phone)
}).then(res => {
console.log(res);
}).catch(err => {
console.log(err);
})
that.countDownStatus = 1
that.sendDisabled = true
let timeInterval = setInterval(() => {
that.countDown -= 1
}, 1000)
let timeOut = setTimeout(() => {
that.countDownStatus = 0
that.countDown = 60
that.sendDisabled = false
clearInterval(timeInterval)
clearTimeout(timeOut)
}, 1000 * 60)
}
},
veriSubmit() {
let that = this
that.$refs.veriForm.validate().then(formRes => {
that.showLoading = true
console.log(formRes);
that.$api.login.checkCode(formRes).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.setStorageSync('userInfo', res.data.data.login_user)
uni.setStorageSync('token', res.data.data.access_token)
uni.setStorageSync('roles', res.data.data.login_user.roles)
uni.setStorageSync('deptId', res.data.data.login_user.sysUser.dept.deptId)
uni.showToast({
icon: 'none',
title: '登录成功!',
success: () => {
that.showLoading = false
uni.switchTab({
url: '/pages/index/index'
})
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
that.showLoading = false
}
})
}
}).catch(err => {
console.log(err);
})
})
},
accountSubmit() {
let that = this
that.$refs.accountForm.validate().then(formData => {
that.showLoading = true
console.log(formData);
that.$api.login.log(formData).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.setStorageSync('userInfo', res.data.data.login_user)
uni.setStorageSync('token', res.data.data.access_token)
uni.setStorageSync('roles', res.data.data.login_user.roles)
uni.setStorageSync('deptId', res.data.data.login_user.sysUser.dept.deptId)
uni.showToast({
icon: 'none',
title: '登录成功!',
success: () => {
that.showLoading = false
uni.switchTab({
url: '/pages/index/index'
})
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
that.showLoading = false
}
})
}
}).catch(err => {
console.log(err);
})
})
}
} }
}
</script> </script>
<style lang="scss"> <style lang="scss">
body{ body {
background: url('/static/log-bgd.png'); background: url('/static/log-bgd.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
} }
.upper-bgd{
width: 100%; .upper-bgd {
height: 25vh; width: 100%;
box-sizing: border-box; height: 25vh;
padding-top: 10vh; box-sizing: border-box;
.logo{ padding-top: 10vh;
width: 20%;
height: 10vh; .logo {
margin: 0 auto; width: 20%;
margin-bottom: 2vh; height: 10vh;
image{
width: 100%;
height: 100%;
}
}
.tit{
width: 100%;
font-size: 20px;
font-weight: bold;
display: flex;
justify-content: center;
color: #3C87F3;
}
}
.switch-log{
width: 80%;
height: 100rpx;
margin: 6vh auto;
margin-bottom: 1vh;
display: flex;
justify-content: space-around;
align-items: center;
font-size: 26rpx;
.active{
font-size: 14px;
font-weight: bold;
border-bottom: 4px solid #B4D0FF;
border-bottom-left-radius: 15rpx;
border-bottom-right-radius: 15rpx;
}
}
.login-area{
width: 80%;
box-sizing: border-box;
padding: 3vh;
margin: 0 auto; margin: 0 auto;
background-color: #fff; margin-bottom: 2vh;
border-radius: 20rpx;
box-shadow: 0 3px 5px #E6EEFE; image {
.uni-forms-item__content[data-v-61dfc0d0]{ width: 100%;
display: flex; height: 100%;
}
.submit-btn{
background-color: #3888FF;
margin: 10vh auto;
margin-bottom: 0;
border-radius: 50rpx;
color: #fff;
font-size: 26rpx;
} }
} }
.tit {
width: 100%;
font-size: 20px;
font-weight: bold;
display: flex;
justify-content: center;
color: #3C87F3;
}
}
.switch-log {
width: 80%;
height: 100rpx;
margin: 6vh auto;
margin-bottom: 1vh;
display: flex;
justify-content: space-around;
align-items: center;
font-size: 26rpx;
.active {
font-size: 14px;
font-weight: bold;
border-bottom: 4px solid #B4D0FF;
border-bottom-left-radius: 15rpx;
border-bottom-right-radius: 15rpx;
}
}
.login-area {
width: 80%;
box-sizing: border-box;
padding: 3vh;
margin: 0 auto;
background-color: #fff;
border-radius: 20rpx;
box-shadow: 0 3px 5px #E6EEFE;
.uni-forms-item__content[data-v-61dfc0d0] {
display: flex;
}
.submit-btn {
background-color: #3888FF;
margin: 10vh auto;
margin-bottom: 0;
border-radius: 50rpx;
color: #fff;
font-size: 26rpx;
}
}
</style> </style>