From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- pages/daily/workstation/index.vue | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 166 insertions(+), 0 deletions(-) diff --git a/pages/daily/workstation/index.vue b/pages/daily/workstation/index.vue new file mode 100644 index 0000000..9fee238 --- /dev/null +++ b/pages/daily/workstation/index.vue @@ -0,0 +1,166 @@ +<template> + <view class="workstation"> + <view class="search"> + <u-search placeholder="璇疯緭鍏ュ伐浣滅珯鍚嶇О鎼滅储" v-model="keyword" bgColor="#fff" + placeholderColor="#999999" :showAction="false" + searchIconColor="#6A6A6A" height="74" @search="search" @change="search"></u-search> + </view> + <scroll-view :scroll-top="20" scroll-y="true" class="scroll-Y"> + <view v-for="(item,index) in list" :key="'item'+index" class="list-item" @click="choose(item,index)" :class="{active:current==index}"> + <span> + {{ '(' + item.workCenter + ')' + item.name }} + </span><u-icon class="icon_choose" size="20rpx" v-if="current==index"/> + </view> + <u-loading mode="circle" :show="loadingList" class="loading"></u-loading> + <p v-if="list.length==0" style="text-align: center;margin-top: 100rpx;color: rgb(96, 98, 102);font-size: 28rpx;">鏆傛棤鏁版嵁</p> + </scroll-view> + <view class="bottom"> + <u-button type="primary" :loading="loading" @click="submit" class="btn">纭畾</u-button> + </view> + </view> +</template> + +<script> +import UIcon from "../../../uview-ui/components/u-icon/u-icon.vue"; + +export default { + components: {UIcon}, + data() { + return { + scrollTop: 200, + keyword:'', + list:[], + current:0, + currentChoose: {}, + loadingList:false, + loading:false, + } + }, + onLoad() { + this.loadList(); + }, + methods: { + // 鍦ㄦ鍔犺浇鍒楄〃 + loadList(){ + // this.loadingList = true; + this.$u.api.dailyPaper.getWorkstation().then(res => { + if (res.code === 0) { + this.list = res.data + this.currentChoose = this.list[0] + } else { + this.$u.toast(res.msg) + } + }) + }, + // 鎼滅储 + search(e){ + let params =null + if(this.isEnglish(e)){ + params = { + workstationNo: e + } + + }else{ + params = { + name: e + } + } + + this.$u.api.dailyPaper.getWorkstation(params).then(res => { + if (res.code === 0) { + this.list = res.data + this.currentChoose = this.list[0] + } else { + this.$u.toast(res.msg) + } + }) + }, + choose(item,index){ + this.current = index; + this.currentChoose = item + }, + submit(){ + this.loading = true; + uni.$emit('returnData',this.currentChoose) + uni.navigateBack({ + //鍏抽棴褰撳墠椤甸潰锛岃繑鍥炰笂涓�椤甸潰鎴栧绾ч〉闈€�� + delta:1 + }); + this.loading = false; + }, + isEnglish(str) { + // 鑻辨枃瀛楃姝e垯琛ㄨ揪寮� + const englishPattern = /^[A-Za-z ]*$/; + return englishPattern.test(str); + } + } +} +</script> + +<style lang="scss" scoped> +.workstation{ + width: 100%; + height: 100vh; + background: #E6EFFF; + padding: 0 30rpx; + display: flex; + flex-direction: column; + position: fixed; + .search{ + width: 100%; + margin: 24rpx 0; + } + .scroll-Y { + width: 100%; + height: calc(100vh - 340rpx); + overflow-y: auto; + box-sizing: border-box; + .loading{ + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%,-50%); + } + .list-item{ + background: #FFFFFF; + border-radius: 10rpx; + box-sizing: border-box; + padding: 22rpx 43rpx; + margin-bottom: 20rpx; + font-weight: 500; + font-size: 30rpx; + color: #333333; + display: flex; + align-items: center; + justify-content: space-between; + &.active{ + background: #F4F9FF; + border: 1px solid #ACBDF8; + color: #214DED; + } + } + .icon_choose { + background-image: url('~@/static/custom/daily/icon_choose.png'); + background-repeat: no-repeat; + background-size: cover; + height: 20rpx; + width: 20rpx; + position: relative; + } + } + .bottom { + box-sizing: border-box; + margin-top: 40rpx; + //height: 100rpx; + .btn { + height: 80rpx; + background: #214DED; + border-radius: 8rpx; + font-weight: 500; + font-size: 34rpx; + color: #FFFFFF; + z-index: 99; + } + } +} +</style> -- Gitblit v1.9.3