工作任务
This commit is contained in:
87
src/components/AiBack/AiBack.vue
Normal file
87
src/components/AiBack/AiBack.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<div v-if="btn" class="AiBack" @click.stop="back">
|
||||
<img :src="$cdn + 'home/back.png'" alt="">
|
||||
<text>返回</text>
|
||||
</div>
|
||||
<ai-fixed-btn v-else-if="!isTopPage||custom">
|
||||
<div class="AiBack" @click.stop="back">
|
||||
<img :src="$cdn + 'home/back.png'" alt="">
|
||||
<text>返回</text>
|
||||
</div>
|
||||
</ai-fixed-btn>
|
||||
</template>
|
||||
<script>
|
||||
import AiFixedBtn from "./AiFixedBtn";
|
||||
|
||||
export default {
|
||||
name: "AiBack",
|
||||
components: {AiFixedBtn},
|
||||
inject: {root: {}},
|
||||
props: {
|
||||
delta: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
eventName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Object | Boolean,
|
||||
default: () => {
|
||||
}
|
||||
},
|
||||
custom: Boolean,
|
||||
visible: Boolean,
|
||||
btn: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isTopPage: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
if (this.visible) {
|
||||
return this.$parent.$emit(this.eventName, this.data)
|
||||
} else if (this.custom) {
|
||||
this.$emit("back")
|
||||
} else if (this.custom) {
|
||||
} else uni.navigateBack({
|
||||
success: () => {
|
||||
uni.$emit(this.eventName, this.data)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.isTopPage = window.history.length <= 1
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.AiBack {
|
||||
width: 108px;
|
||||
height: 108px;
|
||||
background: #6BA1F9;
|
||||
box-shadow: 0 0 12px 0 rgba(0, 0, 0, 0.12);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
img {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
text {
|
||||
font-size: 26px;
|
||||
font-weight: 800;
|
||||
color: #FFFFFF;
|
||||
line-height: 40px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
209
src/components/pages/selectSysUser.vue
Normal file
209
src/components/pages/selectSysUser.vue
Normal file
@@ -0,0 +1,209 @@
|
||||
<template>
|
||||
<div class="selectResident">
|
||||
<div class="search-top">
|
||||
<u-search placeholder="搜索" v-model="name" :show-action="false" bg-color="#fff" search-icon-color="#E2E8F1"
|
||||
color="#666" height="72" @search="current=1,getList()" @clear="handerClear" @change="current=1,getList()"></u-search>
|
||||
</div>
|
||||
<div class="user-list">
|
||||
<template v-if="list.length>0">
|
||||
<div class="item" v-for="(item, index) in list" :key="index">
|
||||
<div class="select-img" @click="checkClick(index)">
|
||||
<img :src="item.isCheck ? checkIcon : cirIcon" alt="">
|
||||
</div>
|
||||
<div class="user-info">
|
||||
<img :src="item.photo" alt="" v-if="item.photo">
|
||||
<img src="./img/user-img.png" alt="" v-else>
|
||||
{{ item.name }}
|
||||
<span v-if="isShowPhone && item.mobile">({{item.mobile}})</span>
|
||||
<span v-if="isShowPhone && item.phone && !item.mobile">({{item.phone}})</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<AiEmpty/>
|
||||
<div class="pad-b118"/>
|
||||
</template>
|
||||
</div>
|
||||
<div class="pad-b118"/>
|
||||
<div class="footer">
|
||||
<div class="btn" @click="confirm">确定选择</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: "selectResident",
|
||||
appName: "选择人员",
|
||||
data() {
|
||||
return {
|
||||
current: 1,
|
||||
total: 0,
|
||||
name: '',
|
||||
list: [],
|
||||
cirIcon: require('./img/xz.png'),
|
||||
checkIcon: require('./img/xzh.png'),
|
||||
selected: [],
|
||||
query: null,
|
||||
isSingle: false,
|
||||
nodeKey: 'idNumber',
|
||||
isRequire: 1,
|
||||
isShowPhone: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
},
|
||||
onLoad(query) {
|
||||
console.log(query)
|
||||
this.query = query
|
||||
if (query.selected) {
|
||||
this.selected = query.selected?.split(",") || []
|
||||
}
|
||||
this.isSingle = query.single || false
|
||||
this.nodeKey = query.nodeKey || "idNumber"
|
||||
this.isRequire = query.isRequire || 1
|
||||
this.isShowPhone = query.isShowPhone || false
|
||||
this.getList()
|
||||
},
|
||||
onShow() {
|
||||
// document.title = this.nodeKey == 'openId' ? '选择居民' : '选择员工'
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
let {current, total, name: con} = this
|
||||
let url = this.query.axiosUrl ? this.query.axiosUrl : `/admin/user/userIntegralList`
|
||||
if ((!total && current == 1) || current <= total) {
|
||||
url = decodeURIComponent(url)
|
||||
this.$instance.post(url, null, {
|
||||
params: {current, size: 20, con}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.total = res.data.pages || 0
|
||||
res.data.records.forEach(e => {
|
||||
e.isCheck = this.selected.includes(e[this.nodeKey])
|
||||
})
|
||||
this.list = [current == 1 ? [] : this.list, res.data.records || []].flat()
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
checkClick(index) {
|
||||
if (this.isSingle) {
|
||||
this.list.map((e, i) => {
|
||||
e.isCheck = i == index;
|
||||
})
|
||||
} else this.list[index].isCheck = !this.list[index].isCheck
|
||||
|
||||
},
|
||||
confirm() {
|
||||
let checkList = []
|
||||
this.list.map((item) => {
|
||||
if (item.isCheck) {
|
||||
checkList.push(item)
|
||||
}
|
||||
})
|
||||
if (!checkList.length && this.isRequire == 1) {
|
||||
return this.$u.toast('请先选择人员')
|
||||
} else {
|
||||
uni.navigateBack({
|
||||
success: () => {
|
||||
uni.$emit("pagePicker:sysUser", checkList)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.current++
|
||||
this.getList()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selectResident {
|
||||
::v-deep .AiTopFixed .u-search {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.pad-b118 {
|
||||
padding-bottom: 118px;
|
||||
}
|
||||
|
||||
.search-top {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding: 16px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
background-color: #E4E5E6;
|
||||
z-index: 99;
|
||||
}
|
||||
.user-list {
|
||||
padding-top: 100px;
|
||||
background-color: #fff;
|
||||
|
||||
.item {
|
||||
.select-img {
|
||||
display: inline-block;
|
||||
|
||||
img {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
margin: 12px 36px 12px 30px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: inline-block;
|
||||
padding: 20px 0 20px 0;
|
||||
width: calc(100% - 114px);
|
||||
height: 100%;
|
||||
border-bottom: 1px solid #E4E5E6;
|
||||
font-size: 36px;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
line-height: 74px;
|
||||
|
||||
img {
|
||||
width: 74px;
|
||||
height: 74px;
|
||||
border-radius: 8px;
|
||||
margin-right: 34px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
height: 118px;
|
||||
background: #F4F8FB;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
text-align: right;
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
width: 192px;
|
||||
height: 80px;
|
||||
line-height: 80px;
|
||||
background: #1365DD;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
font-size: 32px;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
color: #FFF;
|
||||
margin: 20px 34px 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user