1.链接更新

v1.0.0
sws 2024-09-28 13:50:55 +08:00
parent 30e4b1e711
commit 05ca8cad94
10 changed files with 223 additions and 29 deletions

View File

@ -16,7 +16,7 @@
</template>
</div>
</div>
<url-value-dialog v-model:modelValue="new_model_value" v-model:dialogVisible="dialogVisible" :type="type" @update:model-value="model_value_call_back"></url-value-dialog>
<url-value-dialog v-model:model-value="new_model_value" v-model:dialog-visible="dialogVisible" :select-is-url="true" :type="type" @update:model-value="model_value_call_back"></url-value-dialog>
</template>
<script lang="ts" setup>
import { is_obj_empty } from '@/utils';

View File

@ -52,6 +52,11 @@ const props = defineProps({
type: Boolean,
default: () => false,
},
//
selectIsUrl: {
type: Boolean,
default: false,
},
});
watch(
() => props.reset,
@ -111,11 +116,32 @@ const row_click = (row: any) => {
if (!props.multiple) {
const new_table_data = JSON.parse(JSON.stringify(tableData.value));
template_selection.value = new_table_data.findIndex((item: pageLinkList) => item.id == row.id).toString();
modelValue.value = [row];
if (props.selectIsUrl) {
const new_row = {
id: row.id,
name: row.name,
page: '/pages/article-detail/article-detail?id=' + row.id,
};
modelValue.value = [new_row];
} else {
modelValue.value = [row];
}
}
};
const handle_select = (selection: any) => {
modelValue.value = selection;
if (props.selectIsUrl) {
// selection
const new_selection = selection.map((item: any) => {
return {
id: item.id,
name: item.name,
page: '/pages/article-detail/article-detail?id=' + item.id,
};
});
modelValue.value = new_selection;
} else {
modelValue.value = selection;
}
};
</script>
<style lang="scss" scoped>

View File

@ -53,6 +53,11 @@ const props = defineProps({
type: Boolean,
default: () => false,
},
//
selectIsUrl: {
type: Boolean,
default: false,
},
});
watch(
() => props.reset,
@ -116,11 +121,32 @@ const row_click = (row: any) => {
if (!props.multiple) {
const new_table_data = JSON.parse(JSON.stringify(tableData.value));
template_selection.value = new_table_data.findIndex((item: pageLinkList) => item.id == row.id).toString();
modelValue.value = [row];
if (props.selectIsUrl) {
const new_row = {
id: row.id,
name: row.name,
page: '/pages/goods-search/goods-search?brand=' + row.id,
};
modelValue.value = [new_row];
} else {
modelValue.value = row;
}
}
};
const handle_select = (selection: any) => {
modelValue.value = selection;
if (props.selectIsUrl) {
// selection
const new_selection = selection.map((item: any) => {
return {
id: item.id,
name: item.name,
page: '/pages/goods-search/goods-search?brand=' + item.id,
};
});
modelValue.value = new_selection;
} else {
modelValue.value = selection;
}
};
</script>
<style lang="scss" scoped>

View File

@ -1,5 +1,5 @@
<template>
<!-- 商城 -->
<!-- 自定义链接 -->
<div class="container">
<div class="tabs flex-row gap-10 mb-30">
<div v-for="item in custom_type" :key="item.id" class="item bg-f5 radius-sm" :class="custom_type_active == item.id ? 'active' : ''" @click="custom_type_event(item)">{{ item.name }}</div>
@ -11,6 +11,30 @@
<el-form-item label="跳转路径" prop="link" :rules="link">
<el-input v-model="form.link" class="link-input" placeholder="请输入跳转路径" clearable />
</el-form-item>
<div class="tips">
<h4>WEB端</h4>
<p>1. 以http开头</p>
<p>2. 如小程序中使用WEB页面需要在小程序后台加入白名单</p>
<h5>内部页面(小程序/APP内部地址)</h5>
<p>1. 小程序以/pages开始</p>
<p>2. 例如/pages/user/user支持带参数 ?x=xx</p>
<p>3. 示例/pages/goods-detail/goods-detail?id=1</p>
<h5>打开外部小程序</h5>
<p>1. 以appid://</p>
<p>2. 例如appid://wx88888888|path</p>
<p>3. 示例appid://wx88888888|/pages/goods-detail/goods-detail?id=1</p>
<h5>打开外部小程序链接</h5>
<p>1. 以shortlink://</p>
<p>2. 例如shortlink://-></p>
<p>3. 示例shortlink://#://ShopXO/WxblCyRUmDqGpcz</p>
<h5>拨打电话</h5>
<p>1. 以tel://</p>
<p>2. 例如tel://wx13222222222</p>
<p>跳转原生地图查看指定位置</p>
<p>1. 以map://</p>
<p>2. 例如map://|||</p>
<p>3. 示例map://ShopXO|XXX|121.626444|31.20843</p>
</div>
</template>
<template v-if="custom_type_active == 1">
<el-form-item label="APPID" prop="app_id" :rules="app_id">
@ -61,6 +85,11 @@ const props = defineProps({
type: Boolean,
default: () => false,
},
//
selectIsUrl: {
type: Boolean,
default: false,
},
});
watch(
() => props.status,
@ -138,29 +167,29 @@ const on_submit = () => {
if (valid) {
let new_value: pageLinkList = {
name: '',
link: '',
page: '',
};
if (custom_type_active.value == 1) {
new_value = {
name: form.app_id,
link: form.app_link,
name: form.app_id + '|' + form.app_link,
page: 'appid://' + form.app_id + '|' + form.app_link,
};
} else if (custom_type_active.value == 2) {
new_value = {
name: form.phone,
link: form.phone,
page: 'tel://' + form.phone,
};
} else if (custom_type_active.value == 3) {
new_value = {
name: form.name,
link: form.address,
page: 'map://' + form.name + '|' + form.address + '|' + form.lng + '|' + form.lat,
lng: form.lng,
lat: form.lat,
};
} else {
new_value = {
name: form.link,
link: form.link,
page: form.link,
};
}
emit('update:link', new_value);
@ -202,4 +231,16 @@ const reset_data = () => {
width: 33.2rem;
}
}
.tips {
h4,
h5 {
margin-bottom: 1rem;
color: #666;
}
p {
padding-left: 2rem;
color: #666;
font-size: 1.2rem;
}
}
</style>

View File

@ -38,6 +38,11 @@ const props = defineProps({
type: Boolean,
default: () => false,
},
//
selectIsUrl: {
type: Boolean,
default: false,
},
});
watch(
() => props.reset,
@ -120,7 +125,16 @@ const row_click = (row: any) => {
};
const new_table_datas = array_conversion(JSON.parse(JSON.stringify(new_table_data.value)));
template_selection.value = new_table_datas.findIndex((item: pageLinkList) => item.id == row.id).toString();
modelValue.value = [row];
if (props.selectIsUrl) {
const new_row = {
id: row.id,
name: row.name,
page: '/pages/goods-search/goods-search?category_id=' + row.id,
};
modelValue.value = [new_row];
} else {
modelValue.value = [row];
}
};
</script>
<style lang="scss" scoped>

View File

@ -74,6 +74,11 @@ const props = defineProps({
type: Boolean,
default: () => false,
},
//
selectIsUrl: {
type: Boolean,
default: false,
},
});
watch(
() => props.status,
@ -164,7 +169,15 @@ const goods_item_click = (item: pageLinkList, level: number, index: number) => {
}
} else {
check_data.value = item;
emit('update:link', item, 0);
if (props.selectIsUrl) {
const new_item = {
page: '/pages/goods-search/goods-search?category_id=' + item.id,
...item,
};
emit('update:link', new_item, 0);
} else {
emit('update:link', item, 0);
}
}
};
//#endregion -----------------------------------------------end
@ -174,7 +187,15 @@ const brand_item_index = ref(0);
const brand_item_click = (item: any, index: number) => {
brand_item_index.value = index + 1;
check_data.value = item;
emit('update:link', item, 1);
if (props.selectIsUrl) {
const new_item = {
page: '/pages/goods-search/goods-search?brand=' + item.id,
...item,
};
emit('update:link', new_item, 1);
} else {
emit('update:link', item, 1);
}
};
//#endregion -----------------------------------------------end
@ -192,7 +213,7 @@ const on_submit = () => {
if (valid) {
let new_value: pageLinkList = {
name: form.key,
link: form.key,
page: '/pages/goods-search/goods-search?keywords=' + form.key,
};
emit('update:link', new_value, 2);
}

View File

@ -55,6 +55,11 @@ const props = defineProps({
type: Boolean,
default: () => false,
},
//
selectIsUrl: {
type: Boolean,
default: false,
},
});
watch(
() => props.reset,
@ -126,11 +131,32 @@ const row_click = (row: any) => {
if (!props.multiple) {
const new_table_data = JSON.parse(JSON.stringify(tableData.value));
template_selection.value = new_table_data.findIndex((item: pageLinkList) => item.id == row.id).toString();
modelValue.value = [row];
if (props.selectIsUrl) {
const new_row = {
id: row.id,
name: row.name,
page: '/pages/goods-detail/goods-detail?id=' + row.id,
};
modelValue.value = [new_row];
} else {
modelValue.value = [row];
}
}
};
const handle_select = (selection: any) => {
modelValue.value = selection;
if (props.selectIsUrl) {
// selection
const new_selection = selection.map((item: any) => {
return {
id: item.id,
name: item.name,
page: '/pages/goods-detail/goods-detail?id=' + item.id,
};
});
modelValue.value = new_selection;
} else {
modelValue.value = selection;
}
};
</script>
<style lang="scss" scoped>

View File

@ -52,6 +52,11 @@ const props = defineProps({
type: Boolean,
default: () => false,
},
//
selectIsUrl: {
type: Boolean,
default: false,
},
});
watch(
() => props.reset,
@ -113,16 +118,46 @@ const get_list = (new_page: number) => {
}
};
//#region -----------------------------------------------end
// diydesigncustom-viewlink
const computer_link = computed(() => {
if (props.type == 'design') {
return '/pages/design/design?id=';
} else if (props.type == 'custom-view') {
return '/pages/customview/customview?id=';
} else {
return '/pages/diy/diy?id=';
}
});
const row_click = (row: any) => {
if (!props.multiple) {
const new_table_data = JSON.parse(JSON.stringify(tableData.value));
template_selection.value = new_table_data.findIndex((item: pageLinkList) => item.id == row.id).toString();
modelValue.value = [row];
if (props.selectIsUrl) {
const new_row = {
id: row.id,
name: row.name,
page: computer_link.value + row.id,
};
modelValue.value = [new_row];
} else {
modelValue.value = row;
}
}
};
const handle_select = (selection: any) => {
modelValue.value = selection;
if (props.selectIsUrl) {
// selection
const new_selection = selection.map((item: any) => {
return {
id: item.id,
name: item.name,
page: computer_link.value + item.id,
};
});
modelValue.value = new_selection;
} else {
modelValue.value = selection;
}
};
</script>
<style lang="scss" scoped>

View File

@ -20,31 +20,31 @@
</template>
<!-- 商品分类 -->
<template v-else-if="link_select == 'goods-category'">
<link-goods-category v-model="link_value" :reset="reset_compontent"></link-goods-category>
<link-goods-category v-model="link_value" :select-is-url="selectIsUrl" :reset="reset_compontent"></link-goods-category>
</template>
<!-- 商品搜索 -->
<template v-else-if="link_select == 'goods-search'">
<link-goods-search :reset="reset_compontent" :status="component_status" @update:link="goods_category_link" @type="goods_category_type_change"></link-goods-search>
<link-goods-search :reset="reset_compontent" :status="component_status" :select-is-url="selectIsUrl" @update:link="goods_category_link" @type="goods_category_type_change"></link-goods-search>
</template>
<!-- 商品页面 -->
<template v-else-if="link_select == 'goods'">
<link-goods v-model="link_value" :multiple="multiple" :reset="reset_compontent"></link-goods>
<link-goods v-model="link_value" :select-is-url="selectIsUrl" :multiple="multiple" :reset="reset_compontent"></link-goods>
</template>
<!-- 文章页面 -->
<template v-else-if="link_select == 'article'">
<link-articles v-model="link_value" :multiple="multiple" :reset="reset_compontent"></link-articles>
<link-articles v-model="link_value" :select-is-url="selectIsUrl" :multiple="multiple" :reset="reset_compontent"></link-articles>
</template>
<!-- diy页面/页面设计/自定义页面 -->
<template v-else-if="link_select == 'diy' || link_select == 'design' || link_select == 'custom-view'">
<link-table :key="link_select" v-model="link_value" :multiple="multiple" :type="link_select" :reset="reset_compontent"></link-table>
<link-table :key="link_select" v-model="link_value" :select-is-url="selectIsUrl" :multiple="multiple" :type="link_select" :reset="reset_compontent"></link-table>
</template>
<!-- 品牌 -->
<template v-else-if="link_select == 'brand'">
<link-brand v-model="link_value" :multiple="multiple" :reset="reset_compontent"></link-brand>
<link-brand v-model="link_value" :select-is-url="selectIsUrl" :multiple="multiple" :reset="reset_compontent"></link-brand>
</template>
<!-- 自定义链接 -->
<template v-else-if="link_select == 'custom-url'">
<link-custom :reset="reset_compontent" :status="component_status" @update:link="custom_link"></link-custom>
<link-custom :reset="reset_compontent" :select-is-url="selectIsUrl" :status="component_status" @update:link="custom_link"></link-custom>
</template>
<!-- 优惠券链接 -->
<template v-else-if="link_select == 'coupon'">
@ -84,6 +84,11 @@ const props = defineProps({
type: Boolean,
default: false,
},
//
selectIsUrl: {
type: Boolean,
default: false,
},
});
const modelValue = defineModel({ type: Array, default: [] });
const dialogVisible = defineModel('dialogVisible', { type: Boolean, default: false });

View File

@ -65,7 +65,7 @@ const defaultFooterNav: DefaultFooterNav = {
title: '新建页面',
link: {},
indicator_location: 'center',
positioning_name: '默认名称',
positioning_name: '未选择位置',
icon_setting: [
{ id: get_math(), img: [], icon: 'applet-me-message-acquiesce', link: {} },
],