安全设置增加允许访问的国家地区、省份、是否局域网访问

This commit is contained in:
刘祥超
2020-11-20 21:59:12 +08:00
parent 8d8460c3fe
commit 3ec89a432c
25 changed files with 609 additions and 49 deletions

View File

@@ -0,0 +1,51 @@
Vue.component("provinces-selector", {
props: ["v-provinces"],
data: function () {
let provinces = this.vProvinces
if (provinces == null) {
provinces = []
}
let provinceIds = provinces.$map(function (k, v) {
return v.id
})
return {
provinces: provinces,
provinceIds: provinceIds
}
},
methods: {
add: function () {
let provinceStringIds = this.provinceIds.map(function (v) {
return v.toString()
})
let that = this
teaweb.popup("/ui/selectProvincesPopup?provinceIds=" + provinceStringIds.join(","), {
width: "48em",
height: "23em",
callback: function (resp) {
that.provinces = resp.data.provinces
that.change()
}
})
},
remove: function (index) {
this.provinces.$remove(index)
this.change()
},
change: function () {
this.provinceIds = this.provinces.$map(function (k, v) {
return v.id
})
}
},
template: `<div>
<input type="hidden" name="provinceIdsJSON" :value="JSON.stringify(provinceIds)"/>
<div v-if="provinces.length > 0" style="margin-bottom: 0.5em">
<div v-for="(province, index) in provinces" class="ui label tiny">{{province.name}} <a href="" title="删除" @click.prevent="remove(index)"><i class="icon remove"></i></a></div>
<div class="ui divider"></div>
</div>
<div>
<button class="ui button small" type="button" @click.prevent="add">+</button>
</div>
</div>`
})