forked from github/dataease
Merge pull request #2021 from dataease/pr@dev@refactor_panel-auto-http
refactor: 增加的url链接可以自动加上http头
This commit is contained in:
commit
7f9aa976d3
@ -27,6 +27,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||||
|
import { checkAddHttp } from '@/utils/urlUtils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -69,6 +70,7 @@ export default {
|
|||||||
this.linkInfoTemp = deepCopy(this.linkInfo)
|
this.linkInfoTemp = deepCopy(this.linkInfo)
|
||||||
},
|
},
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
this.linkInfoTemp.src = checkAddHttp(this.linkInfoTemp.src)
|
||||||
this.curComponent.frameLinks = this.linkInfoTemp
|
this.curComponent.frameLinks = this.linkInfoTemp
|
||||||
this.$store.state.styleChangeTimes++
|
this.$store.state.styleChangeTimes++
|
||||||
this.popoverClose()
|
this.popoverClose()
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||||
|
import { checkAddHttp } from '@/utils/urlUtils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -60,6 +61,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
this.linkInfo.content = checkAddHttp(this.linkInfo.content)
|
||||||
this.curComponent.hyperlinks = deepCopy(this.linkInfo)
|
this.curComponent.hyperlinks = deepCopy(this.linkInfo)
|
||||||
this.$store.state.styleChangeTimes++
|
this.$store.state.styleChangeTimes++
|
||||||
this.popoverClose()
|
this.popoverClose()
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
<!-- <el-radio :label="'hls'">HLS 直播</el-radio>-->
|
<!-- <el-radio :label="'hls'">HLS 直播</el-radio>-->
|
||||||
<!-- <el-radio :label="'rtmp'">{{$t('panel.streaming_media')}}</el-radio>-->
|
<!-- <el-radio :label="'rtmp'">{{$t('panel.streaming_media')}}</el-radio>-->
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
|
<span style="color: #909399; font-size: 8px;margin-left: 3px">
|
||||||
|
Tips:{{ $t('panel.live_tips') }}
|
||||||
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-row v-if="streamMediaInfoTemp.videoType==='flv'">
|
<el-row v-if="streamMediaInfoTemp.videoType==='flv'">
|
||||||
<el-form-item :label="$t('panel.is_live')">
|
<el-form-item :label="$t('panel.is_live')">
|
||||||
@ -20,9 +23,6 @@
|
|||||||
<el-radio :label="true">{{ $t('panel.yes') }}</el-radio>
|
<el-radio :label="true">{{ $t('panel.yes') }}</el-radio>
|
||||||
<el-radio :label="false">{{ $t('panel.no') }}</el-radio>
|
<el-radio :label="false">{{ $t('panel.no') }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<span style="color: #909399; font-size: 8px;margin-left: 3px">
|
|
||||||
Tips:{{ $t('panel.live_tips') }}
|
|
||||||
</span>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="!streamMediaInfoTemp[streamMediaInfoTemp.videoType].isLive" :label="$t('panel.auto_play')">
|
<el-form-item v-if="!streamMediaInfoTemp[streamMediaInfoTemp.videoType].isLive" :label="$t('panel.auto_play')">
|
||||||
<el-switch v-model="streamMediaInfoTemp[streamMediaInfoTemp.videoType].autoplay" size="mini" />
|
<el-switch v-model="streamMediaInfoTemp[streamMediaInfoTemp.videoType].autoplay" size="mini" />
|
||||||
@ -50,7 +50,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||||
import bus from "@/utils/bus";
|
import bus from '@/utils/bus'
|
||||||
|
import { checkAddHttp } from '@/utils/urlUtils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -93,9 +94,10 @@ export default {
|
|||||||
this.streamMediaInfoTemp = deepCopy(this.linkInfo)
|
this.streamMediaInfoTemp = deepCopy(this.linkInfo)
|
||||||
},
|
},
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
this.streamMediaInfoTemp[this.streamMediaInfoTemp.videoType].url = checkAddHttp(this.streamMediaInfoTemp[this.streamMediaInfoTemp.videoType].url)
|
||||||
this.curComponent.streamMediaLinks = this.streamMediaInfoTemp
|
this.curComponent.streamMediaLinks = this.streamMediaInfoTemp
|
||||||
this.$store.state.styleChangeTimes++
|
this.$store.state.styleChangeTimes++
|
||||||
bus.$emit('streamMediaLinksChange')
|
bus.$emit('streamMediaLinksChange-' + this.curComponent.id)
|
||||||
this.popoverClose()
|
this.popoverClose()
|
||||||
},
|
},
|
||||||
onClose() {
|
onClose() {
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||||
|
import { checkAddHttp } from '@/utils/urlUtils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -84,6 +85,7 @@ export default {
|
|||||||
this.linkInfoTemp = deepCopy(this.linkInfo)
|
this.linkInfoTemp = deepCopy(this.linkInfo)
|
||||||
},
|
},
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
this.linkInfoTemp[this.linkInfoTemp.videoType].sources[0].src = checkAddHttp(this.linkInfoTemp[this.linkInfoTemp.videoType].sources[0].src)
|
||||||
this.curComponent.videoLinks = this.linkInfoTemp
|
this.curComponent.videoLinks = this.linkInfoTemp
|
||||||
this.$store.state.styleChangeTimes++
|
this.$store.state.styleChangeTimes++
|
||||||
this.popoverClose()
|
this.popoverClose()
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<div v-if="editMode==='edit'" class="stream-mask" />
|
<div v-if="editMode==='edit'" class="stream-mask" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="info-stream-class">
|
<div v-else class="info-stream-class">
|
||||||
{{ $t('panel.stream_media_add_tinitOptionips') }}
|
{{ $t('panel.stream_media_add_tips') }}
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
@ -69,7 +69,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initOption()
|
this.initOption()
|
||||||
bus.$on('streamMediaLinksChange', () => {
|
bus.$on('streamMediaLinksChange-' + this.element.id, () => {
|
||||||
this.initOption()
|
this.initOption()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
9
frontend/src/utils/urlUtils.js
Normal file
9
frontend/src/utils/urlUtils.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export function checkAddHttp(url) {
|
||||||
|
if (!url) {
|
||||||
|
return url
|
||||||
|
} else if (/^(http(s)?:\/\/)/.test(url.toLowerCase())) {
|
||||||
|
return url
|
||||||
|
} else {
|
||||||
|
return 'http://' + url
|
||||||
|
}
|
||||||
|
}
|
@ -52,9 +52,9 @@
|
|||||||
:disable-branch-nodes="true"
|
:disable-branch-nodes="true"
|
||||||
:normalizer="normalizer"
|
:normalizer="normalizer"
|
||||||
:placeholder="$t('panel.select_jump_panel')"
|
:placeholder="$t('panel.select_jump_panel')"
|
||||||
:noChildrenText="$t('commons.treeselect.no_children_text')"
|
:no-children-text="$t('commons.treeselect.no_children_text')"
|
||||||
:noOptionsText="$t('commons.treeselect.no_options_text')"
|
:no-options-text="$t('commons.treeselect.no_options_text')"
|
||||||
:noResultsText="$t('commons.treeselect.no_results_text')"
|
:no-results-text="$t('commons.treeselect.no_results_text')"
|
||||||
style="margin-right: 10px"
|
style="margin-right: 10px"
|
||||||
@select="panelNodeClick"
|
@select="panelNodeClick"
|
||||||
@input="inputVal"
|
@input="inputVal"
|
||||||
@ -166,6 +166,7 @@ import { groupTree } from '@/api/panel/panel'
|
|||||||
import { detailList } from '@/api/panel/panelView'
|
import { detailList } from '@/api/panel/panelView'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||||
|
import { checkAddHttp } from '@/utils/urlUtils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { },
|
components: { },
|
||||||
@ -271,6 +272,7 @@ export default {
|
|||||||
this.$emit('closeJumpSetDialog')
|
this.$emit('closeJumpSetDialog')
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
|
this.linkJumpInfo.content = checkAddHttp(this.linkJumpInfo.content)
|
||||||
updateJumpSet(this.linkJump).then(rsp => {
|
updateJumpSet(this.linkJump).then(rsp => {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '保存成功',
|
message: '保存成功',
|
||||||
|
Loading…
Reference in New Issue
Block a user