MrShi
2025-03-12 69a1b3bf45738f048361ee4ccb6bdc64fce35720
pda/pages/index/control.vue
对比新文件
@@ -0,0 +1,88 @@
<template>
  <view class="main_app">
      <template v-for="item in platformGroupList">
         <view class="title">
           <view class="icon"></view>
           <view class="name">{{item.name}}</view>
         </view>
         <view class="data_list">
           <view class="line" v-for="(platform, i) in item.platformList" :key="platform.id">
             <view class="name">{{platform.name}}</view>
             <u-switch v-model="platform.status" activeColor="#279BAA" inactiveColor="#cccccc" :inactiveValue="1" :activeValue="0" @change="e => changeStatus(platform)" />
           </view>
         </view>
      </template>
  </view>
</template>
<script>
   import { getPlatformGroupList, updPlatformStatus } from '@/api'
export default {
  data() {
    return {
      platformGroupList: []
    }
  },
  onLoad() {
      this.getPlatformGroup()
  },
  methods: {
      changeStatus(item) {
         console.log(item);
         updPlatformStatus({
            id: item.id,
            status: item.status
         })
      },
      getPlatformGroup() {
         getPlatformGroupList({
            queryData: 0,
            queryType: 0
         }).then(res => {
            this.platformGroupList = res.data || []
         })
      },
  }
}
</script>
<style lang="scss">
.main_app {
  padding: 30rpx 0;
  background: #fff;
  .data_list {
    padding: 30rpx;
    .line {
      padding: 0 30rpx;
      background: #F4F9F8;
      margin-bottom: 20rpx;
      display: flex;
      align-items: center;
      height: 84rpx;
      font-size: 32rpx;
      color: #333333;
      border-radius: 8rpx;
      justify-content: space-between;
      &:nth-of-type(2n){
        background: #F7F7F7;
      }
    }
  }
  .title {
    display: flex;
    align-items: center;
    padding: 0 30rpx;
    .icon {
      width: 22rpx;
      height: 22rpx;
      margin-right: 16rpx;
      border: 6rpx solid $uni-color-primary;
      border-radius: 50%;
    }
    .name {
      font-weight: 600;
      font-size: 34rpx;
      color: #111111;
    }
  }
}
</style>