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
| <template>
| <view>
| <page-nav title="环境配置"></page-nav>
|
| <div class="main">
|
| <u-radio-group v-model="radioValue" style="display: flex;flex-direction: column;">
| <div class="block" v-for='(item,index) in contentArr'>
| <div class="title">{{item.title}}</div>
| <div>
| <u--text type="info" :text="item.url"></u--text>
| </div>
| <u-divider></u-divider>
| <div class="opertion">
| <view style="margin-right: 100rpx;width: 60%;">
| <u-radio label="设为默认" :name="item.id" @change="radioChange" :key="item.id"></u-radio>
| </view>
|
| <view style="display: flex;width: 30%;">
| <u--text type="info" @click="edit(item,index)" text="修改"></u--text>
| <u--text type="info" @click="del(item,index)" text="删除"></u--text>
| </view>
| </div>
| </div>
| </u-radio-group>
|
|
| <u-button hairline type="primary" text="确定" @click="confirm"></u-button>
|
| <u-back-top icon="arrow-up" text="11"></u-back-top>
|
|
| </div>
|
|
| </view>
| </template>
|
| <script>
| import Vue from 'vue'
| export default {
| data() {
| return {
| radioValue: 2,
| contentArr: [{
| id: 1,
| title: '我是标题1',
| url: 'http://121.196.36.24:8000',
| },
| {
| id: 2,
| title: '我是标题2',
| url: 'http://121.196.36.24:9090',
| },
| {
| id: 3,
| title: '我是标题3',
| url: 'http://121.196.36.24:8019',
| },
| {
| id: 4,
| title: '我是标题4',
| url: 'http://121.196.36.24:8047',
| }
| ]
|
| }
| },
|
| methods: {
| radioChange(val) {
| uni.$u.http.setConfig((config) => {
| config.baseURL = this.contentArr.find(i => i.id === val).url + '/api'
| return config
| })
| },
| del(item, index) {
| console.log(item)
| this.contentArr.splice(index, 1)
| },
| edit(item) {
|
| },
| // 确定
| confirm() {
| uni.navigateBack()
| },
| }
| }
| </script>
|
| <style>
| ::v-deep .u-icon--right {
| display: none;
| }
|
| .main {
| width: 100vw;
| height: 80vh;
| background-color: #eee;
| display: flex;
| flex-direction: column;
| align-items: center;
| }
|
| .block {
| width: 94vw;
| height: 200rpx;
| background-color: #fff;
| border-radius: 10rpx;
| margin-top: 10rpx;
| padding: 10rpx;
| }
|
| .title {}
|
| .opertion {
| display: flex;
| width: 100%;
| }
| </style>
|
|