xingqu.vue
2.6 KB
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
<template>
<view style="background-color: #F5F5F5; min-height: 100vh; height: 100%;">
<view :style="'height:' + common.statusBarH + 'px; background-color: white; '"></view>
<view style="display: flex; justify-content: space-between;
padding-top: 16rpx;
padding-left: 30rpx ; padding-right: 30rpx; background-color: white;
padding-bottom: 16rpx;">
<image style="width: 56rpx; height: 56rpx;" src="../../static/close_black.webp" @click="back()"></image>
<text style="color: #333333; font-size: 34rpx; height: 56rpx; line-height: 56rpx; ">选择感兴趣的内容</text>
<image style="width: 56rpx; height: 56rpx;"></image>
</view>
<radio-group @change="radioChange">
<view class="grid-container">
<label v-for="(item, index) in dataArray" class="grid-item">
<image style="width: 72rpx; height: 72rpx;" :src="item.pic"></image>
<text style="color: #333333; margin-top: 20rpx; margin-bottom: 20rpx;">{{item.name}}</text>
<radio :checked="item.checked" :value="item.code"> </radio>
</label>
</view>
</radio-group>
<view
style="display: flex; align-items: center; justify-content: center; margin-top: 20rpx; padding-bottom: 20rpx;">
<text style="font-size: 24rpx; color: #999999;">APP将在每次启动后打开您选择的页面</text>
</view>
</view>
</template>
<script>
import common from '@/utils/common.js'
export default {
data() {
return {
common,
dataArray: []
}
},
onLoad() {
var select = uni.getStorageSync("user_option_code")
if (!select) {
select = 'home'
uni.setStorageSync("user_option_code", select)
}
var array = common.info_config.app_open_option
for (var i = 0; i < array.length; i++) {
array[i].checked = (select === array[i].code)
}
this.dataArray = array
},
methods: {
back() {
uni.navigateBack()
},
radioChange(e) {
var select = e.detail.value
for (var i = 0; i < this.dataArray.length; i++) {
this.dataArray[i].checked = (select === this.dataArray.code)
}
uni.setStorageSync("user_option_code", select)
}
}
}
</script>
<style>
.grid-container {
margin: 40rpx;
display: grid;
grid-template-columns: repeat(3, 1fr);
/* 每列占据 1/3 的宽度 */
grid-gap: 28rpx;
/* 设置列间距 */
}
.grid-item {
border-radius: 6rpx;
background-color: white;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding-top: 40rpx;
padding-bottom: 30rpx;
}
</style>