#
whycq
2023-10-24 723f7fe013231d17c273d0cb021941ee420b7fbf
pages/business/cstmr/csmtr.vue
@@ -1,5 +1,8 @@
<template>
   <view>
      <view class="status_bar">
               <!-- 这里是状态栏 -->
            </view>
      <uni-nav-bar left-icon="left" title="甲方单位" @clickLeft="back" @clickRight="scan">
         <block slot="right">
            <view class="city">
@@ -51,12 +54,14 @@
            last_id: '',
            user: {
               username: '',
               id: 0
               id: 0,
               type: ''
            },
            userid: 0,
            reload: false,
            status: 'more',
            curr:2,
            curr: 2,
            falg: true,
            contentText: {
               contentdown: '上拉加载更多',
               contentrefresh: '加载中',
@@ -64,24 +69,21 @@
            },
         }
      },
      // 新建按钮事件
      onNavigationBarButtonTap(e) {
         uni.navigateTo({
            url:'/pages/business/cstmr/addCsmtr',
         })
      },
      onShow() {
         setTimeout(()=> {
            this.getCsmtr1()
         },500)
         let that = this
         uni.$on('isRefresh',function(data){
            console.log('监听到事件来自返回的参数:' + data);
            // TODO 下面执行刷新的方法
            that.user.username = data.title
            that.user.id = data.id
            that.user.type = data.key
            that.falg = false
         })
         this.getDetail()
         if (this.falg) {
            this.getDetail()
         }
         setTimeout(()=> {
            this.getCsmtr1()
         },50)
         
      },
      onReachBottom() {
@@ -110,7 +112,7 @@
         getUserTree() {
            let _this = this
            uni.request({
               url: 'http://192.168.4.188:9528/dept/user/tree/auth',
               url: `${that.baseUrl}/dept/user/tree/auth`,
               method: 'POST',
               header: {'token' : uni.getStorageSync('token'),},
            }).then((res)=>{
@@ -129,12 +131,20 @@
         getCsmtr1(e) {
            let that = this
            that.csmtrList = []
            console.log(this.user);
            let param = {curr:1,limit:4,dept_id: 0,user_id: 67}
            if (this.user.type == 'user_id') {
               param = {curr:1,limit:4,user_id: that.user.id}
            } else {
               param = {curr:1,limit:4,dept_id: that.user.id}
            }
            uni.request({
               url: that.baseUrl + '/cstmr/page/auth',
               header: {'token' : uni.getStorageSync('token'),},
               data: {curr:1,limit:4},
               data: param,
               method:'GET',
               success(result) {
                  console.log(result);
                  if (result.statusCode ===  404) {
                     uni.showToast({title: '请重新登录', icon: "none", position: 'top'})
                     return
@@ -230,6 +240,11 @@
</script>
<style>
   .status_bar {
      height: var(--status-bar-height);
      width: 100%;
      background-color: #FFF;
   }
   .city {
      display: flex;
      align-items: center;