Junjie
2024-11-09 a2019ade7b884799e639150021c3cdeef27eea72
pages/project/ps/home/home.vue
@@ -2,7 +2,7 @@
   <view>
      <scroll-view scroll-y class="page">
         <view class="nav-list">
            <navigator hover-class='none' :url="'/pages/project' + item.url" class="nav-li" navigateTo
            <navigator hover-class='none' :url="'/pages/project/ps' + item.url" class="nav-li" navigateTo
               :class="'bg-'+item.color" :style="[{animation: 'show ' + ((index+1)*0.2+1) + 's 1'}]"
               v-for="(item,index) in elements" :key="index">
               <view class="nav-title">{{item.title}}</view>
@@ -10,7 +10,7 @@
               <text :class="'cuIcon-' + item.cuIcon"></text>
            </navigator>
         </view>
         <view class="cu-tabbar-height"></view>
         <view class="cu-tabbar-height"></view>
      </scroll-view>
   </view>
</template>
@@ -29,7 +29,7 @@
                  name: 'pakin',
                  color: 'cyan',
                  cuIcon: 'pullup',
                  url: '/ps/pakin/pakin'
                  url: '/pakin/pakin'
               },
               {
                  title: '托盘解绑',
@@ -198,7 +198,8 @@
         };
      },
      onShow() {
         this.baseUrl = uni.getStorageSync('baseUrl');
         let network = uni.getStorageSync('Network')
         this.baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
         this.token = uni.getStorageSync('token');
         this.getAuth()
         this.backGroundRepeat()
@@ -216,39 +217,39 @@
            }
         },
         getAuth() {
            let that = this
            let _this = this
            uni.request({
               url: that.baseUrl + '/menu/pda/auth',
               url: `${_this.baseUrl}/menu/pda/auth`,
               data: {},
               header: { 'token': uni.getStorageSync('token') },
               method: 'POST',
               success(res) {
                  console.log(res);
                  if (res.statusCode === 404) {
                     that.elements = that.elements2
                     _this.elements = _this.elements2
                     return 
                  }
                   res = res.data
                  that.elements = []
                  _this.elements = []
                  if (res.code === 200) {
                     if (res.data == undefined || res.data == null || res.data == "") {
                        that.elements = that.elements2
                        _this.elements = _this.elements2
                        return
                     }
                     for (var i = 0; i < res.data.length; i++) {
                        if (res.data.length < 0) {
                           break;
                        }
                        that.getIcon(res.data[i].title)
                        that.elements.unshift({
                        _this.getIcon(res.data[i].title)
                        _this.elements.unshift({
                           title: res.data[i].name,
                           name: res.data[i].title,
                           color: that.colorList[i],
                           cuIcon: that.icon,
                           color: _this.colorList[i],
                           cuIcon: _this.icon,
                           url: res.data[i].action
                        })
                     }
                     that.elements.push({
                     _this.elements.push({
                        title: '退出登录',
                        name: 'logOut',
                        color: 'grey',
@@ -267,7 +268,7 @@
                        });
                     }, 1000);
                  } else if(res.status === 404) {
                     that.elements = that.elements2
                     _this.elements = _this.elements2
                     // uni.showToast({
                     //    title: '默认主页',
                     //    icon: "none",
@@ -283,7 +284,7 @@
               },
               fail(err) {
                  console.log(err);
                  that.elements = that.elements2
                  _this.elements = _this.elements2
               }
            })
         },