123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- <template>
- <view class="home">
-
- <view class="search-area">
- <u-search
- placeholder="搜索设备"
- v-model="keyword"
- shape="square"
- :clearabled="true"
- :show-action="true"
- action-text="搜索"
- :animation="true"
- search-icon-color="#000"
- color="#000"
- placeholder-color="#5c5b5b"
- @search="search"
- bgColor="#fff"
- height="40"
- @custom="search"></u-search>
- </view>
- <view class="box">
- <view class="rule-area">
- <view class="notice">
- <view >
- <!-- <i class="iconfont icon-a-shezhi2"></i> -->
- <text style="font-size: 40rpx;">通知</text>
- </view>
- <text @click="toMoreNotice" style="font-size: 28rpx;">更多>></text>
- </view>
- <ul v-if="informList.length===0?false:true">
- <li v-for="item in informList" :key="item.noticeId" @click="toNotice(item.noticeId)" style="font-size: 32rpx;line-height: 68rpx;">
- <i class="iconfont icon-tongzhi"></i>
- {{item.noticeTitle}}
- </li>
- </ul>
- <view class="notice-li" v-else>暂无通知</view>
- </view>
- <view class="rule-area" >
- <view class="notice">
- <view >
- <!-- <i class="iconfont icon-a-shezhi2"></i> -->
- <span>最新借用设备</span>
- </view>
-
- </view>
- <ul v-if="borList.length===0?false:true">
- <li v-for="item in borList" :key="item.id" class="notice-li" @click="toDetail(item.assetBarCode)">
- <view style="display: flex;align-items: center;font-size: 32rpx;line-height: 68rpx;">
- <i class="iconfont icon-shebei"></i>
- <text>设备编码:{{item.assetBarCode}}</text>
- </view>
- <text style="font-size: 32rpx;line-height: 68rpx;">{{handleDate(item.borrowDate)}}</text>
- </li>
- </ul>
- <view v-else>
- 暂无最新借用设备
- </view>
- </view>
- </view>
- <view class="scan-area">
- <view class="scan-code" @click="toScan">
- <i class="iconfont icon-saoyisao"></i>
- <text>扫码设备</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- // import { getInfo } from '@/api/user.js'
- // import cache from '@/utils/storage.js'
- import { getNewInform } from '@/api/notice.js'
- import { getBorrowList } from '@/api/asset.js'
- export default {
- data() {
- return {
- keyword:"",
- informList:[],
- borList:[]
- }
- },
- methods: {
- toMoreNotice(){
- uni.navigateTo({
- url:'/pages/notice-list/notice-list'
- })
- },
- search(){
- if(this.keyword===""){
- uni.showToast({
- title:"请输入查询字段",
- icon:'error'
- })
- }else{
- uni.navigateTo({
- url:'/pages/search/search?keyword='+this.keyword,
- })
- }
- },
- initInfo(){
- const that = this
- uni.showLoading({
- title:"正在加载中",
- icon:'none',
- mask:true
- })
- try{
- getNewInform(1,2).then(res=>{
- // console.log(res)
- if(res.data.msg ==="查询成功"){
- that.informList = res.data.rows
- getBorrowList({
- pageNum:1,
- pageSize:1,
- status:0
- }).then(res=>{
- if(res.data.rows){
- that.borList = res.data.rows
- }
- uni.hideLoading()
- })
- }else{
- uni.hideLoading()
- }
- // if(res instanceof Array){
- // that.informList = res
-
- // }else{
- // uni.hideLoading()
- // }
- })
- }catch(err){
- uni.hideLoading()
- }
-
- },
- toMine(){
- uni.switchTab({
- url:'/pages/menus/menu/menu',
- })
- },
- toScan(){
- uni.scanCode({
- scanType:['barCode'],
- success (res) {
- uni.navigateTo({
- url:'/pages/borrow/borrow?number='+res.result
- })
- }
- })
- },
- toNotice(id){
- uni.navigateTo({
- url:'/pages/notice/notice?id='+id,
- })
- },
- toDetail(bar){
- uni.navigateTo({
- url:'/pages/borrow/borrow?number='+bar,
- })
- },
- handleDate(val){
- let date = new Date(val)
- let year = date.getFullYear()
- let month = date.getMonth()+1
- let day = date.getDate()
- return year+"-"+month+"-"+day;
- }
- },
- onShow() {
- // uni.hideHomeButton()
- this.initInfo()
- this.keyword = ""
- }
- }
- </script>
- <style lang="scss">
- page{
- background-color: #f5f6fa;
- }
- .home{
- padding: 20rpx 24rpx;
- display: flex;
- flex-direction: column;
- height: 100vh;
- box-sizing: border-box;
- }
- .search-area{
- margin-bottom: 30rpx ;
- flex-shrink: 0;
- position: relative;
- input{
- height: 80rpx;
- // border: 2rpx solid #252525;
- line-height: 80rpx;
- // padding-left:80rpx ;
- }
- .iconfont{
- position: absolute;
- font-size: 40rpx;
- top: 20rpx;
- left: 16rpx;
- }
- }
- .box {
- border-radius: 18rpx;
- .rule-area{
- background-color: rgba(255, 255, 255, 0.6);
- z-index: 2;
- flex-shrink: 0;
- border-radius: 18rpx;
- // box-shadow: 0 1rpx 8rpx 0 rgba(0, 0, 0, 0.2);
- box-shadow: 0px 0px 21px 0px #ececec;
- padding: 30rpx;
- .notice{
- display: flex;
- flex-direction: row;
- font-size: 38rpx;
- font-weight: 500;
- color: #252525;
- padding-bottom: 10rpx;
- align-items: center;
- justify-content: space-between;
- // border-bottom: 1px solid rgba(0, 0, 0, 0.1);
- border-bottom: 1px solid rgba(134, 134, 134, 0.1);
- i {
- margin-right: 10rpx;
- font-size: 38rpx;
- color: orange;
- display: inline-block;
- }
- }
-
- ul {
- animation-name: ruleArea;
- animation-duration: 0.5s;
- }
-
- li {
- padding: 10rpx 0;
- width: 100%;
- overflow: hidden; /*超出部分隐藏*/
- white-space: nowrap; /*禁止换行*/
- text-overflow: ellipsis; /*省略号*/
- display: flex;
- align-items: center;
- color: #252525;
- i {
- padding-right: 10rpx;
- color: #2979ff;
- }
- }
- }
- .rule-area:nth-child(2) {
- margin-top: 24rpx;
- i {
- color: #19be6b;
- }
- li {
- display: flex;
- justify-content: space-between;
- }
- li:first-child {
- padding-top: 10rpx;
- }
- }
-
- @keyframes ruleArea {
- from {
- max-height: 0;
- }
- to {
- max-height: 400rpx;
- }
- }
- }
- .borrow-area_bck{
- flex-shrink: 0;
- margin-bottom: 20rpx ;
- height: 120rpx;
- .notice-li{
- line-height: 200%;
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- }
- // border: 2rpx solid #000;
- }
- .scan-area{
- flex-shrink: 1;
- height: 100%;
- // max-height: 750rpx;
- position: relative;
- .scan-code{
- width: 280rpx;
- height: 280rpx;
- background-color: rgba(21, 184, 88, 0.9);
- box-shadow: 0 2rpx 8rpx 2rpx rgba(0, 0, 0, 0.4);
- color: $uni-text-color-inverse;
- border-radius: 50%;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%,-50%);
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- flex-direction: column;
- font-size: $uni-title-font-size;
- .iconfont{
- font-size: 80rpx;
- margin: 20rpx 0;
-
- }
- -webkit-box-reflect: below 10rpx -webkit-linear-gradient(transparent, transparent 75%, rgba(255, 255, 255, .3));
- }
- .scan-mine{
- width: 80rpx;
- height: 80rpx;
- color: rgba(80, 80, 80, 1);
- border-radius: 21px;
- // font-size: 14px;
- line-height: 150%;
- box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.5);
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- flex-direction: column;
- font-size: $uni-title-font-size;
- position: absolute;
- bottom: 20rpx;
- left: 20rpx;
- }
- }
- </style>
|