ll
liukangdong
2024-09-26 6d3886ba1e4b3630da947a7a046433feb3759d17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<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="item"
                :class="{ active: platform.showConfig }"
                v-for="(platform, i) in item.platformList"
                :key="platform.id"
                    @click="platformClick(platform.id)"
              >
                {{platform.name}}
              </view>
            </view>
        </template>
        <view class="btns">
            <div class="btn" @click="$goBack">取消</div>
            <div class="btn active" @click="updUserPlatform">确定</div>
        </view>
  </view>
</template>
 
<script>
import { getPlatformGroupList, updUserPlatformConfig } from '@/api'
export default {
  data() {
    return {
            platformGroupList: []
    }
  },
  onLoad() {
        this.getPlatformGroup()
  },
  methods: {
        updUserPlatform(){
            const { platformGroupList } = this
            let ids = []
            platformGroupList.forEach(item => {
                item.platformList.forEach(platform => {
                        if(platform.showConfig){
                            ids.push(platform.id)
                        }
                })
            })
            updUserPlatformConfig({ids}).then(res => {
                this.showToast('更新成功')
                this.$goBack()
            })
        },
        platformClick(id) {
            const { platformGroupList } = this
            platformGroupList.forEach(item => {
                item.platformList.forEach(platform => {
                        if(platform.id === id){
                            platform.showConfig = !platform.showConfig
                        }
                })
            })
        },
        getPlatformGroup() {
            getPlatformGroupList({
                queryData: 0,
                queryType: 1
            }).then(res => {
                this.platformGroupList = res.data || []
            })
        },
  }
}
</script>
<style lang="scss">
page {
  background-color: #f5f9f8;
}
.main_app {
  padding: 0rpx;
  .data_list {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 20rpx;
    padding: 30rpx;
     background-color: #fff;
         &:nth-last-child(1){
             margin-bottom: 120rpx;
         }
    .item {
      width: 210rpx;
      height: 80rpx;
      background: #f3f3f3;
      border-radius: 40rpx;
      display: flex;
      justify-content: center;
      align-items: center;
      margin-bottom: 20rpx;
      font-size: 30rpx;
      margin-right: 30rpx;
      &:nth-of-type(3n){
        margin-right: 0;
      }
    }
    .active {
      background: $uni-color-primary;
      color: #fff;
      box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(39, 155, 170, 0.4);
    }
  }
  .title {
    display: flex;
    align-items: center;
    padding: 30rpx 30rpx 0;
     background-color: #fff;
    .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;
    }
  }
}
.btns{
    position: fixed;
    left: 0;
    bottom: 0;
    width: 750rpx;
    height: 120rpx;
    background: #FFFFFF;
    box-shadow: 0rpx -4rpx 12rpx 0rpx rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30rpx;
    .btn{
        width: 336rpx;
        height: 88rpx;
        background: #FFFFFF;
        border-radius: 44rpx;
        border: 1rpx solid #999999;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 32rpx;
        color: #333333;
    }
    .active{
        background: $uni-color-primary;
        color: #fff;
    }
}
</style>