Commit 5ea15350 by Lin

perf:列表/新增页代码优化

1 parent 7a1aa88c
// tabWorkOrder/pages/mentorshipManage/components/saleTypeSelectPopup/saleTypeSelectPopup.js
import { saleTypeList } from '../../constantData'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
/**
* 组件的属性列表
*/
properties: {
selected: {
type: String,
observer: function(n) {
let { saleTypeList } = this.data
saleTypeList.map(i => {
i.active = false
if (n?.includes(i.confId)) {
i.active = true
}
return i
})
this.setData({
saleTypeList
})
}
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
saleTypeList,
show: true
},
/**
* 组件的方法列表
*/
methods: {
changeItem(e) {
let { target } = e.currentTarget.dataset
let { saleTypeList } = this.data
saleTypeList.forEach(i => {
if (i.confId == target?.confId) i.active = !i.active
})
this.setData({
saleTypeList
})
},
confirm() {
let { saleTypeList } = this.data
if (!saleTypeList?.filter(v => v.active)?.length) return wx.$util.showToast('请选择')
this.triggerEvent('confirm', this.data.saleTypeList)
},
hidePopup() {
this.triggerEvent('cancel')
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* tabWorkOrder/pages/mentorshipManage/components/businessSelectPopup/businessSelectPopup.wxss */
.saleTypeList {
width: calc(100% - var(--fontSize50));
display: flex;
align-items: center;
font-size: var(--fontSize28);
padding: 0 var(--fontSize25);
transition: all .5s;
.checked_img{
width: var(--fontSize32);
height: var(--fontSize32);
flex-shrink: 0;
margin-right: var(--fontSize20);
}
.text_box{
flex: 1;
border-bottom: var(--fontSize2) solid #F9F9F9;
height: 100%;
line-height: var(--fontSize98);
}
}
.artificerList.active {
color: #347BFF;
font-weight: 700;
position: relative;
}
\ No newline at end of file
<!--tabWorkOrder/pages/mentorshipManage/components/businessSelectPopup/businessSelectPopup.wxml-->
<popup title="选择" show="{{ show }}" bindconfirm="confirm" height="var(--fontSize500)" bindcancel="hidePopup">
<view class="business-select-popup-box" >
<view class="box">
<block wx:for="{{saleTypeList}}" wx:key="index">
<view class="saleTypeList {{item.active?'active':''}}" bindtap="changeItem" data-target="{{item}}" data-index="{{index}}">
<view class="checked_img">
<image wx:if="{{item.active}}" src="{{IMG_URL}}checked.png"></image>
</view>
<view class="text_box"><view class="text-hide">{{item.confName}}</view></view>
</view>
</block>
</view>
</view>
</popup>
\ No newline at end of file
......@@ -34,10 +34,6 @@ Page({
inputValue: '',
keyWord: '', // 搜索关键词
searchTimer: null, // 防抖定时器
motto: 'Hello World',
hasUserInfo: false,
canIUseGetUserProfile: wx.canIUse('getUserProfile'),
canIUseNicknameComp: wx.canIUse('input.type.nickname'),
},
// 显示popup
async showPopup(e) {
......
// tabWorkOrder/pages/mentorshipManage/mentorshipManage.js
import { mentorshipFormData, getStatusName, getStatusTipText } from './constantData'
import { getRecruitList, waitstaffstateAPI, confiremStaffFlagAPI } from '../api'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
......@@ -30,7 +29,6 @@ Page({
let userInfo = wx.$util.getUserInfo()
// 非区域运营登录,打回到首页
//ll if (userInfo?.loginRole != 3) wx.reLaunch({ url: "/pages/loading/loading" })
// 超管显示指派人字段
if (userInfo?.isSuper) {
let index = mentorshipFormData?.findIndex(v => v.name == 'flightSupervisorName')
this.setData({
......@@ -52,11 +50,9 @@ Page({
onShow() {
},
onBottomRefresh() {
this.getList()
},
// 获取招聘任务统计数据
getWaitstaffstate() {
waitstaffstateAPI({}).then(res => {
......@@ -101,11 +97,11 @@ Page({
getRecruitList({
pageSize,
pageNum: currentPage,
onlyWaiting: !!!tabIndex
onlyWaiting: !!!tabIndex // boolean类型转换
}).then(res => {
wx.hideLoading()
if (res.code == "0") {
let { list, pages, pageNum, condition } = res.data;
let { list, pages } = res.data;
// 为列表数据添加状态名称和提示文本
list = list.map(item => {
const tipText = getStatusTipText(item)
......@@ -195,32 +191,25 @@ Page({
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
......@@ -68,7 +68,6 @@ page {
height: calc(100vh - var(--fontSize120));
box-sizing: border-box;
.list {
// height: calc(100vh - var(--fontSize280));
height: 100%;
.item {
margin: 0 var(--fontSize20) var(--fontSize24) var(--fontSize20);
......@@ -91,25 +90,21 @@ page {
border-radius: var(--fontSize4);
padding: var(--fontSize4) var(--fontSize8);
font-weight: 400;
// 待人事确认 status = 0
&.status-0 {
color: #347bff;
background: #eaf1ff;
}
// 招聘中 status = 1
&.status-1 {
color: #ff9d0a;
background: #fff5e6;
}
// 已完成 status = 2
&.status-2 {
color: #35c376;
background: #eaf9f1;
}
// 已驳回 status = 3
&.status-3 {
color: #f24724;
......@@ -138,15 +133,6 @@ page {
word-break: break-all;
font-size: var(--fontSize28);
}
.operation {
font-size: var(--fontSize28);
margin-right: var(--fontSize8);
color: #999EA8;
flex-shrink: 0;
}
}
.wrap_content {
flex-wrap: wrap;
}
.item_footer {
display: flex;
......@@ -172,33 +158,6 @@ page {
height: var(--fontSize21);
}
}
.btn_box_class{
display: flex;
align-items: center;
.order_btn {
box-sizing: border-box;
height: var(--fontSize56);
display: flex;
align-items: center;
justify-content: center;
font-size: var(--fontSize28);
color: #FFFFFF;
background: #347BFF;
border-radius: var(--fontSize32);
padding: 0 var(--fontSize28);
}
.default_btn{
background: #FFFFFF;
border: var(--fontSize2) solid #DEE0E3;
border-radius: var(--fontSize32);
color: #347BFF;
margin-right: var(--fontSize16);
.phone-icon{
width: var(--fontSize48);
height: var(--fontSize48);
}
}
}
}
}
.super_item {
......@@ -210,27 +169,24 @@ page {
}
}
.insert_btn {
display: flex;
flex-wrap: wrap;
text-align: center;
align-items: center;
justify-content: center;
display: grid;
place-items: center;
color: #347bff;
width: var(--fontSize136);
height: var(--fontSize136);
font-size: var(--fontSize24);
border-radius: var(--fontSize15);
opacity: 1;
position: fixed;
-webkit-tap-highlight-color: transparent; //元素默认高亮背景设置
right: var(--fontSize40);
bottom: var(--fontSize468);
background: #ffffffcc;
box-shadow: 0 1.88px 9.41px 0 #0000001a;
transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
text-align: center;
box-shadow: 0 var(--fontSize4) var(--fontSize18) 0 #0000001a;
transition: all 0.3s ease-in-out;
.label {
width: var(--fontSize114);
line-height: 1;
margin-top:-12%;
margin-top: -8px;
line-height: var(--fontSize34);
}
.insert_icon {
......@@ -257,29 +213,3 @@ page {
padding:0 0 var(--fontSize60) 0;
}
}
.popup_content{
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
.title{
width: 100%;
text-align: center;
padding: var(--fontSize26) 0 var(--fontSize30);
font-size: var(--fontSize32);
font-weight: 600;
color: #292D33;
border-bottom: var(--fontSize2) solid transparent;
box-shadow: 0 var(--fontSize2) 0 var(--fontSize1) rgba(239, 240, 242, 0.5);
}
.popup_item{
font-size: var(--fontSize32);
color: #000000;
width: 100%;
height: var(--fontSize112);
text-align: center;
line-height: var(--fontSize112);
border-bottom: var(--fontSize2) solid transparent;
box-shadow: 0 var(--fontSize2) 0 var(--fontSize1) rgba(239, 240, 242, 0.5);
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!