1
This commit is contained in:
@@ -5,24 +5,45 @@
|
|||||||
<span>一键转链</span>
|
<span>一键转链</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-form :model="form" label-width="120px">
|
<el-row :gutter="20">
|
||||||
<el-form-item label="输入内容">
|
<el-col :span="12">
|
||||||
<el-input
|
<el-form :model="form" label-width="120px" label-position="top">
|
||||||
v-model="form.inputContent"
|
<el-form-item label="输入内容">
|
||||||
type="textarea"
|
<el-input
|
||||||
:rows="6"
|
v-model="form.inputContent"
|
||||||
placeholder="请输入需要转链的内容,如商品链接、商品名称等"
|
type="textarea"
|
||||||
style="width: 100%"
|
:rows="10"
|
||||||
/>
|
placeholder="请输入需要转链的内容,如商品链接、商品名称等"
|
||||||
</el-form-item>
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="handleGenerate" :loading="loading">
|
<el-button type="primary" @click="handleGenerate" :loading="loading">
|
||||||
生成转链内容
|
生成转链内容
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button @click="handleClear">清空</el-button>
|
<el-button @click="handleClear">清空</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form label-position="top">
|
||||||
|
<el-form-item label="通用文案">
|
||||||
|
<el-input
|
||||||
|
:value="generalCopy"
|
||||||
|
type="textarea"
|
||||||
|
:rows="10"
|
||||||
|
readonly
|
||||||
|
placeholder="暂无通用文案"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<div style="margin-top: 10px;">
|
||||||
|
<el-button type="success" @click="handleCopyText(generalCopy)" :disabled="!generalCopy">复制通用文案</el-button>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
<div v-if="result" style="margin-top: 20px;">
|
<div v-if="result" style="margin-top: 20px;">
|
||||||
<h4>转链结果:</h4>
|
<h4>转链结果:</h4>
|
||||||
@@ -139,7 +160,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
inputContent: "示例 https://u.jd.com/YDy2OHn"
|
inputContent: ""
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
result: "",
|
result: "",
|
||||||
@@ -214,6 +235,28 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
|
computed: {
|
||||||
|
// 提取通用文案:优先取第一个商品中类型包含“通用”的文案;否则取第一个文案
|
||||||
|
generalCopy() {
|
||||||
|
const data = this.parsedResult;
|
||||||
|
try {
|
||||||
|
if (Array.isArray(data) && data.length) {
|
||||||
|
const productIndex = typeof this.activeProductTab === 'number' ? this.activeProductTab : 0;
|
||||||
|
const product = data[productIndex] || data[0];
|
||||||
|
const wenanList = Array.isArray(product && product.wenan) ? product.wenan : [];
|
||||||
|
if (wenanList.length) {
|
||||||
|
const found = wenanList.find(w => (w && (w.type || '').includes('通用')));
|
||||||
|
const chosen = found || wenanList[0];
|
||||||
|
return (chosen && chosen.content) ? chosen.content : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (data && data.generalCopy) {
|
||||||
|
return String(data.generalCopy || '');
|
||||||
|
}
|
||||||
|
} catch (e) { /* 忽略提取异常 */ }
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'publishDialog.form.itemBizType'(val) {
|
'publishDialog.form.itemBizType'(val) {
|
||||||
// 冗余联动,防止@change未触发的情况
|
// 冗余联动,防止@change未触发的情况
|
||||||
|
|||||||
Reference in New Issue
Block a user