1
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<div class="mobile-bottom-nav" :class="{ 'scrollable': navItems.length > 5 }" v-if="isMobile && show">
|
<div class="mobile-bottom-nav" :class="{ 'scrollable': navItems.length > 5 }" v-if="isMobile && show">
|
||||||
<div
|
<div
|
||||||
v-for="item in navItems"
|
v-for="item in navItems"
|
||||||
:key="item.path"
|
:key="item.path || item.label || item.icon"
|
||||||
class="nav-item"
|
class="nav-item"
|
||||||
:class="{ 'active': isActive(item.path) }"
|
:class="{ 'active': isActive(item.path) }"
|
||||||
@click="handleNavClick(item)"
|
@click="handleNavClick(item)"
|
||||||
@@ -148,7 +148,7 @@ export default {
|
|||||||
background: #fff;
|
background: #fff;
|
||||||
border-top: 1px solid #e4e7ed;
|
border-top: 1px solid #e4e7ed;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
|
||||||
@@ -165,6 +165,10 @@ export default {
|
|||||||
-ms-overflow-style: none;
|
-ms-overflow-style: none;
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
|
|
||||||
|
&.scrollable {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
min-width: 70px;
|
min-width: 70px;
|
||||||
|
|||||||
@@ -55,8 +55,13 @@ export default {
|
|||||||
return `${len}-${firstPath}`
|
return `${len}-${firstPath}`
|
||||||
},
|
},
|
||||||
mobileNavItems() {
|
mobileNavItems() {
|
||||||
// 如果返回空数组,组件会使用默认逻辑从路由中自动获取所有可用路由
|
return [
|
||||||
return []
|
{ path: '/sloworder/index', label: '慢单', icon: 'el-icon-tickets' },
|
||||||
|
{ path: '/jd-instruction/index', label: '中控', icon: 'el-icon-s-operation' },
|
||||||
|
{ path: '/mobile/fadan', label: '发单', icon: 'el-icon-edit-outline' },
|
||||||
|
{ path: '/mobile/xianyu-publish', label: '发品', icon: 'el-icon-goods' },
|
||||||
|
{ path: '/mobile/zhongcao', label: '种草', icon: 'el-icon-chat-dot-round' }
|
||||||
|
]
|
||||||
},
|
},
|
||||||
classObj() {
|
classObj() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -118,6 +118,32 @@ export const constantRoutes = [
|
|||||||
meta: { title: '下好的慢单', icon: 'list' }
|
meta: { title: '下好的慢单', icon: 'list' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
// 移动端专用入口(隐藏菜单,底部导航直达)
|
||||||
|
{
|
||||||
|
path: '/mobile',
|
||||||
|
component: Layout,
|
||||||
|
hidden: true,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'fadan',
|
||||||
|
component: () => import('@/views/mobile/fadan/index'),
|
||||||
|
name: 'MobileFadan',
|
||||||
|
meta: { title: '发单' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'xianyu-publish',
|
||||||
|
component: () => import('@/views/system/social-media/xianyu-wenan'),
|
||||||
|
name: 'MobileXianyuPublish',
|
||||||
|
meta: { title: '发品' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'zhongcao',
|
||||||
|
component: () => import('@/views/mobile/zhongcao/index'),
|
||||||
|
name: 'MobileZhongcao',
|
||||||
|
meta: { title: '种草' }
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
313
src/views/mobile/fadan/index.vue
Normal file
313
src/views/mobile/fadan/index.vue
Normal file
@@ -0,0 +1,313 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container mobile-fadan">
|
||||||
|
|
||||||
|
<el-card class="box-card">
|
||||||
|
<el-form :model="form" label-position="top" class="fadan-form">
|
||||||
|
<el-form-item label="分销标记(默认 F)">
|
||||||
|
<el-input v-model="form.mark" placeholder="一般为 F" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="型号" required>
|
||||||
|
<el-input v-model="form.model" placeholder="必填" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="下单地址" required>
|
||||||
|
<el-input v-model="form.address" type="textarea" :rows="3" placeholder="必填,与中控「生」指令第 6 行一致" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="转链链接(可空)">
|
||||||
|
<el-input v-model="form.link" type="textarea" :rows="2" placeholder="可空;留空则后台按型号尝试自动填充京粉链接" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数量">
|
||||||
|
<el-input-number v-model="form.qty" :min="1" :max="99" controls-position="right" style="width: 100%;" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-divider content-position="left">选填:已下单时一并写入录单表</el-divider>
|
||||||
|
<el-form-item label="下单人">
|
||||||
|
<el-input v-model="form.buyer" placeholder="选填" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="下单付款(元)">
|
||||||
|
<el-input v-model="form.paymentText" placeholder="选填,如 2999.00" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="后返金额(元)">
|
||||||
|
<el-input v-model="form.rebateText" placeholder="选填" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物流链接">
|
||||||
|
<el-input v-model="form.logisticsLink" type="textarea" :rows="2" placeholder="选填" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<div class="btn-row">
|
||||||
|
<el-button type="primary" size="medium" :loading="loading" @click="generate">录单</el-button>
|
||||||
|
<el-button size="medium" @click="resetForm">重置表单</el-button>
|
||||||
|
<el-button v-if="resultText" size="medium" @click="copyResult">复制录单</el-button>
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<template v-if="resultText">
|
||||||
|
<el-divider content-position="left">录单结果</el-divider>
|
||||||
|
<el-input v-model="resultText" type="textarea" :rows="16" readonly class="result-area" />
|
||||||
|
</template>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="地址/单号重复验证"
|
||||||
|
:visible.sync="verifyDialogVisible"
|
||||||
|
width="92%"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<div class="verify-body">
|
||||||
|
<el-alert :title="verifyMessage" type="warning" :closable="false" />
|
||||||
|
<div class="verify-code">{{ verifyCode }}</div>
|
||||||
|
<el-input v-model="verifyInput" placeholder="请输入上方四位验证码" maxlength="4" @keyup.enter.native="handleVerify" />
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="verifyDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="verifyLoading" @click="handleVerify">确认录单</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { executeInstruction, executeInstructionWithForce } from '@/api/system/instruction'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'MobileFadan',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
mark: 'F',
|
||||||
|
model: '',
|
||||||
|
address: '',
|
||||||
|
link: '',
|
||||||
|
qty: 1,
|
||||||
|
buyer: '',
|
||||||
|
paymentText: '',
|
||||||
|
rebateText: '',
|
||||||
|
logisticsLink: ''
|
||||||
|
},
|
||||||
|
loading: false,
|
||||||
|
resultText: '',
|
||||||
|
resultListFromLast: [],
|
||||||
|
verifyDialogVisible: false,
|
||||||
|
verifyCode: '',
|
||||||
|
verifyInput: '',
|
||||||
|
verifyMessage: '',
|
||||||
|
verifyLoading: false,
|
||||||
|
pendingCommand: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
buildCommand() {
|
||||||
|
const mark = (this.form.mark || 'F').trim()
|
||||||
|
const model = (this.form.model || '').trim()
|
||||||
|
const address = (this.form.address || '').trim()
|
||||||
|
if (!model) {
|
||||||
|
this.$modal.msgError('请填写型号')
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (!address) {
|
||||||
|
this.$modal.msgError('请填写地址')
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
const link = (this.form.link || '').trim()
|
||||||
|
const qty = Number(this.form.qty) > 0 ? Number(this.form.qty) : 1
|
||||||
|
const lines = ['生', mark, model, link, String(qty), address]
|
||||||
|
return lines.join('\n')
|
||||||
|
},
|
||||||
|
injectOptional(raw) {
|
||||||
|
if (!raw) return raw
|
||||||
|
let t = String(raw).replace(/\r\n/g, '\n')
|
||||||
|
const buyer = (this.form.buyer || '').trim()
|
||||||
|
const pay = (this.form.paymentText || '').trim()
|
||||||
|
const rebate = (this.form.rebateText || '').trim()
|
||||||
|
const logistics = (this.form.logisticsLink || '').trim()
|
||||||
|
if (buyer) {
|
||||||
|
t = t.replace(/(下单人(需填):)\n\n/, `$1\n${buyer}\n\n`)
|
||||||
|
}
|
||||||
|
if (pay) {
|
||||||
|
t = t.replace(/(下单付款(注意核对):)\n\n/, `$1\n${pay}\n\n`)
|
||||||
|
}
|
||||||
|
if (rebate) {
|
||||||
|
t = t.replace(/(后返金额(注意核对):)\n\n/, `$1\n${rebate}\n\n`)
|
||||||
|
}
|
||||||
|
if (logistics) {
|
||||||
|
t = t.replace(/(物流链接(需填):)\n\n/, `$1\n${logistics}\n\n`)
|
||||||
|
}
|
||||||
|
return t
|
||||||
|
},
|
||||||
|
extractFirstResponse(data) {
|
||||||
|
if (Array.isArray(data)) {
|
||||||
|
return data.length ? data.join('\n\n\n') : ''
|
||||||
|
}
|
||||||
|
if (typeof data === 'string') {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
},
|
||||||
|
checkDuplicateError(resultList) {
|
||||||
|
if (!resultList || !resultList.length) return false
|
||||||
|
for (let i = 0; i < resultList.length; i++) {
|
||||||
|
const s = resultList[i]
|
||||||
|
if (typeof s === 'string' && (
|
||||||
|
s.includes('ERROR_CODE:ADDRESS_DUPLICATE') ||
|
||||||
|
s.includes('ERROR_CODE:ORDER_NUMBER_DUPLICATE')
|
||||||
|
)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
showVerifyDialog(cmd) {
|
||||||
|
this.pendingCommand = cmd
|
||||||
|
this.verifyCode = String(Math.floor(1000 + Math.random() * 9000))
|
||||||
|
this.verifyInput = ''
|
||||||
|
let hasOrder = false
|
||||||
|
let hasAddr = false
|
||||||
|
const list = this.resultListFromLast || []
|
||||||
|
list.forEach(s => {
|
||||||
|
if (typeof s !== 'string') return
|
||||||
|
if (s.includes('ERROR_CODE:ORDER_NUMBER_DUPLICATE')) hasOrder = true
|
||||||
|
if (s.includes('ERROR_CODE:ADDRESS_DUPLICATE')) hasAddr = true
|
||||||
|
})
|
||||||
|
if (hasOrder && hasAddr) {
|
||||||
|
this.verifyMessage = '检测到订单编号与地址可能重复,输入验证码后可强制录单'
|
||||||
|
} else if (hasOrder) {
|
||||||
|
this.verifyMessage = '检测到订单编号可能重复,输入验证码后可强制录单'
|
||||||
|
} else {
|
||||||
|
this.verifyMessage = '检测到地址可能重复,输入验证码后可强制录单'
|
||||||
|
}
|
||||||
|
this.verifyDialogVisible = true
|
||||||
|
},
|
||||||
|
generate() {
|
||||||
|
const cmd = this.buildCommand()
|
||||||
|
if (!cmd) return
|
||||||
|
this.loading = true
|
||||||
|
this.resultText = ''
|
||||||
|
executeInstruction({ command: cmd }).then(res => {
|
||||||
|
this.loading = false
|
||||||
|
if (res && (res.code === 200 || res.msg === '操作成功')) {
|
||||||
|
const list = Array.isArray(res.data) ? res.data : (res.data ? [String(res.data)] : [])
|
||||||
|
if (this.checkDuplicateError(list)) {
|
||||||
|
this.resultListFromLast = list
|
||||||
|
this.showVerifyDialog(cmd)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const merged = this.injectOptional(this.extractFirstResponse(res.data))
|
||||||
|
this.resultText = merged
|
||||||
|
this.$modal.msgSuccess('已录单')
|
||||||
|
} else {
|
||||||
|
this.$modal.msgError((res && res.msg) || '录单失败')
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
this.$modal.msgError('请求失败')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleVerify() {
|
||||||
|
if (!this.verifyInput || this.verifyInput.length !== 4) {
|
||||||
|
this.$modal.msgError('请输入四位验证码')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.verifyInput !== this.verifyCode) {
|
||||||
|
this.$modal.msgError('验证码不正确')
|
||||||
|
this.verifyInput = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.verifyLoading = true
|
||||||
|
executeInstructionWithForce({ command: this.pendingCommand }).then(res => {
|
||||||
|
this.verifyLoading = false
|
||||||
|
this.verifyDialogVisible = false
|
||||||
|
if (res && (res.code === 200 || res.msg === '操作成功')) {
|
||||||
|
const merged = this.injectOptional(this.extractFirstResponse(res.data))
|
||||||
|
this.resultText = merged
|
||||||
|
this.$modal.msgSuccess('已强制录单')
|
||||||
|
} else {
|
||||||
|
this.$modal.msgError((res && res.msg) || '执行失败')
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.verifyLoading = false
|
||||||
|
this.$modal.msgError('请求失败')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
resetForm() {
|
||||||
|
this.form = {
|
||||||
|
mark: 'F',
|
||||||
|
model: '',
|
||||||
|
address: '',
|
||||||
|
link: '',
|
||||||
|
qty: 1,
|
||||||
|
buyer: '',
|
||||||
|
paymentText: '',
|
||||||
|
rebateText: '',
|
||||||
|
logisticsLink: ''
|
||||||
|
}
|
||||||
|
this.resultText = ''
|
||||||
|
},
|
||||||
|
copyResult() {
|
||||||
|
const t = this.resultText || ''
|
||||||
|
if (!t) return
|
||||||
|
if (navigator.clipboard) {
|
||||||
|
navigator.clipboard.writeText(t).then(() => {
|
||||||
|
this.$modal.msgSuccess('已复制')
|
||||||
|
}).catch(() => this.fallbackCopy(t))
|
||||||
|
} else {
|
||||||
|
this.fallbackCopy(t)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fallbackCopy(text) {
|
||||||
|
const ta = document.createElement('textarea')
|
||||||
|
ta.value = text
|
||||||
|
document.body.appendChild(ta)
|
||||||
|
ta.focus()
|
||||||
|
ta.select()
|
||||||
|
try {
|
||||||
|
document.execCommand('copy')
|
||||||
|
this.$modal.msgSuccess('已复制')
|
||||||
|
} catch (e) {
|
||||||
|
this.$modal.msgError('复制失败')
|
||||||
|
}
|
||||||
|
document.body.removeChild(ta)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.mobile-fadan {
|
||||||
|
padding-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-card {
|
||||||
|
margin: 0 12px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fadan-form ::v-deep .el-form-item {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-area ::v-deep .el-textarea__inner {
|
||||||
|
font-family: Consolas, 'Courier New', monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.verify-body .verify-code {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #409eff;
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.box-card {
|
||||||
|
margin: 0 8px 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
267
src/views/mobile/zhongcao/index.vue
Normal file
267
src/views/mobile/zhongcao/index.vue
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container mobile-zhongcao">
|
||||||
|
<el-card class="box-card">
|
||||||
|
<el-form :model="form" label-position="top" class="main-form">
|
||||||
|
<el-form-item label="商品标题" required>
|
||||||
|
<el-input
|
||||||
|
v-model="form.title"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
placeholder="必填"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="型号" required>
|
||||||
|
<el-input v-model="form.model" placeholder="必填" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品类型" required>
|
||||||
|
<el-input
|
||||||
|
v-model="form.goodsType"
|
||||||
|
placeholder="必填,如:冰箱、空调、洗衣机"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" class="btn-main" :loading="loading" @click="handleGenerate">
|
||||||
|
生成种草文案
|
||||||
|
</el-button>
|
||||||
|
<el-button :disabled="!hasInput" @click="clearAll">清空</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-alert
|
||||||
|
v-if="seedNoteError"
|
||||||
|
:title="seedNoteError"
|
||||||
|
type="warning"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
class="warn-alert"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div v-if="result.seedNote || result.daixiadan" class="result-wrap">
|
||||||
|
<template v-if="result.seedNote">
|
||||||
|
<el-divider content-position="left">种草文案(AI)</el-divider>
|
||||||
|
<div class="card-bar">
|
||||||
|
<span class="card-t">高转化种草</span>
|
||||||
|
<el-button type="primary" size="small" @click="copyText(result.seedNote)">复制</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="result-body">{{ result.seedNote }}</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-collapse v-if="result.daixiadan" class="extra-collapse">
|
||||||
|
<el-collapse-item title="同步生成的闲鱼代下单 / 教你下单(模板拼接)" name="1">
|
||||||
|
<div v-if="result.daixiadan" class="sub-block">
|
||||||
|
<div class="card-bar">
|
||||||
|
<span class="card-t">代下单</span>
|
||||||
|
<el-button type="text" size="small" @click="copyText(result.daixiadan)">复制</el-button>
|
||||||
|
</div>
|
||||||
|
<pre class="pre-text">{{ result.daixiadan }}</pre>
|
||||||
|
</div>
|
||||||
|
<div v-if="result.jiaonixiadan" class="sub-block">
|
||||||
|
<div class="card-bar">
|
||||||
|
<span class="card-t">教你下单</span>
|
||||||
|
<el-button type="text" size="small" @click="copyText(result.jiaonixiadan)">复制</el-button>
|
||||||
|
</div>
|
||||||
|
<pre class="pre-text">{{ result.jiaonixiadan }}</pre>
|
||||||
|
</div>
|
||||||
|
</el-collapse-item>
|
||||||
|
</el-collapse>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { generateXianyuWenan } from '@/api/jarvis/socialMedia'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'MobileZhongcao',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
title: '',
|
||||||
|
model: '',
|
||||||
|
goodsType: ''
|
||||||
|
},
|
||||||
|
loading: false,
|
||||||
|
seedNoteError: '',
|
||||||
|
result: {
|
||||||
|
seedNote: '',
|
||||||
|
daixiadan: '',
|
||||||
|
jiaonixiadan: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
hasInput() {
|
||||||
|
return !!(this.form.title || this.form.model || this.form.goodsType)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
clearAll() {
|
||||||
|
this.form = { title: '', model: '', goodsType: '' }
|
||||||
|
this.seedNoteError = ''
|
||||||
|
this.result = { seedNote: '', daixiadan: '', jiaonixiadan: '' }
|
||||||
|
},
|
||||||
|
async handleGenerate() {
|
||||||
|
const title = (this.form.title || '').trim()
|
||||||
|
const model = (this.form.model || '').trim()
|
||||||
|
const goodsType = (this.form.goodsType || '').trim()
|
||||||
|
if (!title) {
|
||||||
|
this.$message.warning('请填写商品标题')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!model) {
|
||||||
|
this.$message.warning('请填写型号')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!goodsType) {
|
||||||
|
this.$message.warning('请填写商品类型')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
this.seedNoteError = ''
|
||||||
|
this.result = { seedNote: '', daixiadan: '', jiaonixiadan: '' }
|
||||||
|
try {
|
||||||
|
const res = await generateXianyuWenan({
|
||||||
|
title,
|
||||||
|
remark: model,
|
||||||
|
goods_title: title,
|
||||||
|
goods_model: model,
|
||||||
|
goods_type: goodsType,
|
||||||
|
generateSeedNote: true
|
||||||
|
})
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
const data = res.data
|
||||||
|
if (data.success) {
|
||||||
|
this.result.daixiadan = data.daixiadan || ''
|
||||||
|
this.result.jiaonixiadan = data.jiaonixiadan || ''
|
||||||
|
this.result.seedNote = (data.seedNote || '').trim()
|
||||||
|
if (data.seedNoteError) {
|
||||||
|
this.seedNoteError = data.seedNoteError
|
||||||
|
}
|
||||||
|
if (this.result.seedNote) {
|
||||||
|
this.$message.success('种草文案已生成')
|
||||||
|
} else if (this.seedNoteError) {
|
||||||
|
this.$message.warning('种草失败,已保留闲鱼基础文案')
|
||||||
|
} else {
|
||||||
|
this.$message.success('已生成')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.error || '生成失败')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg || '请求失败')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
this.$message.error('请求异常:' + (e.message || ''))
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
copyText(text) {
|
||||||
|
if (!text) {
|
||||||
|
this.$message.warning('无可复制内容')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||||
|
navigator.clipboard.writeText(text).then(() => {
|
||||||
|
this.$message.success('已复制')
|
||||||
|
}).catch(() => this.fallbackCopy(text))
|
||||||
|
} else {
|
||||||
|
this.fallbackCopy(text)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fallbackCopy(text) {
|
||||||
|
const ta = document.createElement('textarea')
|
||||||
|
ta.value = text
|
||||||
|
ta.style.position = 'fixed'
|
||||||
|
ta.style.left = '-9999px'
|
||||||
|
document.body.appendChild(ta)
|
||||||
|
ta.select()
|
||||||
|
try {
|
||||||
|
document.execCommand('copy')
|
||||||
|
this.$message.success('已复制')
|
||||||
|
} catch (err) {
|
||||||
|
this.$message.error('复制失败')
|
||||||
|
}
|
||||||
|
document.body.removeChild(ta)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.mobile-zhongcao {
|
||||||
|
padding-bottom: 16px;
|
||||||
|
}
|
||||||
|
.box-card {
|
||||||
|
margin: 0 12px;
|
||||||
|
max-width: 720px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
.main-form ::v-deep .el-form-item {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
.btn-main {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
.warn-alert {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.result-wrap {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.card-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.card-t {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.result-body {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.6;
|
||||||
|
padding: 12px;
|
||||||
|
background: #f9fafc;
|
||||||
|
border-radius: 4px;
|
||||||
|
max-height: 420px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.extra-collapse {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
|
.sub-block {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.pre-text {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
font-size: 12px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 8px;
|
||||||
|
background: #fafafa;
|
||||||
|
border-radius: 4px;
|
||||||
|
max-height: 240px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.box-card {
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
.btn-main {
|
||||||
|
width: 100%;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -5,13 +5,15 @@
|
|||||||
<el-form-item label="输入指令">
|
<el-form-item label="输入指令">
|
||||||
<el-input v-model="form.command" type="textarea" :rows="8" placeholder="💰💰💰💰💰💰💰💰" />
|
<el-input v-model="form.command" type="textarea" :rows="8" placeholder="💰💰💰💰💰💰💰💰" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="button-group button-group-primary">
|
<div class="button-group button-group-primary" :class="{ 'is-mobile-compact': isMobile }">
|
||||||
<el-button type="success" size="medium" @click="run" :loading="loading">执行</el-button>
|
<el-button type="success" size="medium" @click="run" :loading="loading">执行</el-button>
|
||||||
<el-button type="danger" size="medium" @click="clearAll">清空</el-button>
|
<el-button type="danger" size="medium" @click="clearAll">清空</el-button>
|
||||||
|
<template v-if="!isMobile">
|
||||||
<el-button size="warning" @click="fillMan">慢单</el-button>
|
<el-button size="warning" @click="fillMan">慢单</el-button>
|
||||||
<el-button size="success" @click="fillSheng">通用格式</el-button>
|
<el-button size="success" @click="fillSheng">通用格式</el-button>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-group button-group-secondary">
|
<div v-if="!isMobile" class="button-group button-group-secondary">
|
||||||
<el-button type="primary" size="medium" @click="fillTF">腾峰</el-button>
|
<el-button type="primary" size="medium" @click="fillTF">腾峰</el-button>
|
||||||
<el-button type="primary" size="medium" @click="fillFan">凡</el-button>
|
<el-button type="primary" size="medium" @click="fillFan">凡</el-button>
|
||||||
<!-- <el-button type="primary" size="medium" @click="fillWen">纹</el-button> -->
|
<!-- <el-button type="primary" size="medium" @click="fillWen">纹</el-button> -->
|
||||||
@@ -60,8 +62,9 @@
|
|||||||
<el-divider>历史消息记录</el-divider>
|
<el-divider>历史消息记录</el-divider>
|
||||||
|
|
||||||
<div class="history-controls">
|
<div class="history-controls">
|
||||||
<span class="history-label">显示条数:</span>
|
<div class="history-field history-field-limit">
|
||||||
<el-select v-model="historyLimit" size="small" style="width: 120px;" @change="loadHistory">
|
<span class="history-label">显示条数</span>
|
||||||
|
<el-select v-model="historyLimit" size="small" class="history-limit-select" @change="loadHistory">
|
||||||
<el-option label="10条" :value="10"></el-option>
|
<el-option label="10条" :value="10"></el-option>
|
||||||
<el-option label="20条" :value="20"></el-option>
|
<el-option label="20条" :value="20"></el-option>
|
||||||
<el-option label="50条" :value="50"></el-option>
|
<el-option label="50条" :value="50"></el-option>
|
||||||
@@ -70,17 +73,22 @@
|
|||||||
<el-option label="500条" :value="500"></el-option>
|
<el-option label="500条" :value="500"></el-option>
|
||||||
<el-option label="1000条" :value="1000"></el-option>
|
<el-option label="1000条" :value="1000"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<span class="history-label history-search-label">搜索匹配:</span>
|
</div>
|
||||||
|
<div class="history-field history-field-search">
|
||||||
|
<span class="history-label">搜索匹配</span>
|
||||||
|
<div class="history-search-input-wrap">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="historySearchKeyword"
|
v-model="historySearchKeyword"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="输入关键词,在全部历史数据中搜索"
|
placeholder="关键词,搜索全部历史"
|
||||||
clearable
|
clearable
|
||||||
style="width: 240px;"
|
class="history-search-input"
|
||||||
prefix-icon="el-icon-search"
|
prefix-icon="el-icon-search"
|
||||||
@input="onHistorySearchInput"
|
@input="onHistorySearchInput"
|
||||||
/>
|
/>
|
||||||
<span v-if="historySearchKeyword.trim()" class="history-search-tip">(在全部数据中匹配)</span>
|
</div>
|
||||||
|
<span v-if="historySearchKeyword.trim()" class="history-search-tip">全部数据中匹配</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="history-container">
|
<div class="history-container">
|
||||||
@@ -847,6 +855,10 @@ export default {
|
|||||||
max-width: 100% !important;
|
max-width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-group-primary.is-mobile-compact {
|
||||||
|
grid-template-columns: repeat(2, 1fr) !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* 次要按钮组:腾峰、凡、纹、鸿、拼多多、拼多多-纹 - 每行4个 */
|
/* 次要按钮组:腾峰、凡、纹、鸿、拼多多、拼多多-纹 - 每行4个 */
|
||||||
.button-group-secondary {
|
.button-group-secondary {
|
||||||
display: grid !important;
|
display: grid !important;
|
||||||
@@ -872,7 +884,9 @@ export default {
|
|||||||
/* 历史记录控制条 */
|
/* 历史记录控制条 */
|
||||||
.history-controls {
|
.history-controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
flex-wrap: wrap;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 12px 20px;
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
@@ -881,21 +895,56 @@ export default {
|
|||||||
border: 1px solid #DCDFE6;
|
border: 1px solid #DCDFE6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.history-field {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-field-limit .history-limit-select {
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-field-search {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 220px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-search-input-wrap {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 160px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-search-input-wrap ::v-deep .el-input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.history-label {
|
.history-label {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
margin-right: 12px;
|
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-search-label {
|
.history-label::after {
|
||||||
margin-left: 16px;
|
content: ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-search-tip {
|
.history-search-tip {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
margin-left: 8px;
|
flex-basis: 100%;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 桌面:搜索提示与输入同一行时不占满宽 */
|
||||||
|
.history-field-search .history-search-tip {
|
||||||
|
flex-basis: auto;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 历史消息容器 */
|
/* 历史消息容器 */
|
||||||
@@ -922,14 +971,42 @@ export default {
|
|||||||
|
|
||||||
.history-controls {
|
.history-controls {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: stretch;
|
||||||
gap: 10px;
|
gap: 14px;
|
||||||
padding: 10px 12px;
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-field {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: 6px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-field-limit .history-limit-select {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-field-search {
|
||||||
|
min-width: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-search-input-wrap {
|
||||||
|
min-width: 0;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.history-label {
|
.history-label {
|
||||||
margin-right: 0;
|
font-size: 13px;
|
||||||
margin-bottom: 0;
|
}
|
||||||
|
|
||||||
|
.history-field-search .history-search-tip {
|
||||||
|
flex-basis: auto;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-top: 4px;
|
||||||
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
</mobile-search-form>
|
</mobile-search-form>
|
||||||
|
|
||||||
<!-- 操作按钮区域(移动端单独显示) -->
|
<!-- 操作按钮区域(移动端单独显示) -->
|
||||||
<div class="action-buttons-section mobile-only">
|
<div v-if="actionButtons.length" class="action-buttons-section mobile-only">
|
||||||
<mobile-button-group
|
<mobile-button-group
|
||||||
:buttons="actionButtons"
|
:buttons="actionButtons"
|
||||||
:primary-count="2"
|
:primary-count="2"
|
||||||
@@ -1190,11 +1190,9 @@ export default {
|
|||||||
return has ? t : ''
|
return has ? t : ''
|
||||||
},
|
},
|
||||||
actionButtons() {
|
actionButtons() {
|
||||||
// 移动端只保留推送监控按钮
|
// 移动端不展示顶部工具按钮(统一用底部导航与各页内操作)
|
||||||
if (this.isMobile) {
|
if (this.isMobile) {
|
||||||
return [
|
return []
|
||||||
{ key: 'monitor', label: '推送监控', type: 'success', icon: 'el-icon-monitor', handler: () => { this.showPushMonitor = true } }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
// 桌面端显示所有按钮
|
// 桌面端显示所有按钮
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -1,39 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="xianyu-wenan-container">
|
<div class="xianyu-wenan-container">
|
||||||
<el-card class="box-card">
|
<el-card class="box-card">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header">
|
||||||
<span class="card-title">
|
<span class="card-title">
|
||||||
<i class="el-icon-edit-outline"></i>
|
<i class="el-icon-edit-outline"></i>
|
||||||
闲鱼文案(手动)
|
闲鱼文案(手动)
|
||||||
</span>
|
</span>
|
||||||
<el-button
|
|
||||||
style="float: right; padding: 3px 0"
|
|
||||||
type="text"
|
|
||||||
@click="showHelp = !showHelp">
|
|
||||||
{{ showHelp ? '隐藏帮助' : '显示帮助' }}
|
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-collapse-transition>
|
|
||||||
<div v-show="showHelp" class="help-section">
|
|
||||||
<el-alert
|
|
||||||
title="使用说明"
|
|
||||||
type="info"
|
|
||||||
:closable="false"
|
|
||||||
show-icon>
|
|
||||||
<div slot="default">
|
|
||||||
<p><strong>功能说明:</strong></p>
|
|
||||||
<ul>
|
|
||||||
<li>不依赖 JD 接口,手动输入标题即可生成闲鱼文案,用于接口限流时的应急</li>
|
|
||||||
<li>一键生成「代下单」和「教你下单」两种文案</li>
|
|
||||||
<li>标题和型号会自动清洗敏感词(以旧、政府、换新等)</li>
|
|
||||||
<li>支持可选备注(型号),会拼在标题后参与生成</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</el-alert>
|
|
||||||
</div>
|
|
||||||
</el-collapse-transition>
|
|
||||||
|
|
||||||
<div class="input-section">
|
<div class="input-section">
|
||||||
<el-form
|
<el-form
|
||||||
:model="form"
|
:model="form"
|
||||||
@@ -51,9 +25,19 @@
|
|||||||
<el-form-item label="型号/备注">
|
<el-form-item label="型号/备注">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.remark"
|
v-model="form.remark"
|
||||||
placeholder="选填,如型号、规格等,会拼在标题后"
|
placeholder="选填,如型号、规格等,会拼在标题后(生成种草时必填)"
|
||||||
clearable />
|
clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-checkbox v-model="form.generateSeedNote">同时生成种草文案(AI)</el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="form.generateSeedNote" label="商品类型" required>
|
||||||
|
<el-input
|
||||||
|
v-model="form.goodsType"
|
||||||
|
placeholder="种草必填,如:冰箱、空调、洗衣机"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -72,7 +56,33 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="result.daixiadan || result.jiaonixiadan" class="result-section">
|
<el-alert
|
||||||
|
v-if="result.seedNoteError"
|
||||||
|
:title="result.seedNoteError"
|
||||||
|
type="warning"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
class="seed-error-alert"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div v-if="result.daixiadan || result.jiaonixiadan || result.seedNote" class="result-section">
|
||||||
|
<el-row v-if="result.seedNote" :gutter="gutter" class="seed-row">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-card shadow="hover" class="result-card">
|
||||||
|
<div slot="header" class="result-card-header">
|
||||||
|
<span class="result-card-title">种草文案(AI)</span>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
class="btn-copy"
|
||||||
|
@click="copyResult('seedNote')">
|
||||||
|
<i class="el-icon-document-copy"></i> 复制
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="result-content">{{ result.seedNote }}</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-row :gutter="gutter">
|
<el-row :gutter="gutter">
|
||||||
<el-col :xs="24" :sm="24" :md="12">
|
<el-col :xs="24" :sm="24" :md="12">
|
||||||
<el-card shadow="hover" class="result-card">
|
<el-card shadow="hover" class="result-card">
|
||||||
@@ -117,14 +127,17 @@ export default {
|
|||||||
name: 'XianyuWenan',
|
name: 'XianyuWenan',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showHelp: false,
|
|
||||||
form: {
|
form: {
|
||||||
title: '',
|
title: '',
|
||||||
remark: ''
|
remark: '',
|
||||||
|
generateSeedNote: false,
|
||||||
|
goodsType: ''
|
||||||
},
|
},
|
||||||
result: {
|
result: {
|
||||||
daixiadan: '',
|
daixiadan: '',
|
||||||
jiaonixiadan: ''
|
jiaonixiadan: '',
|
||||||
|
seedNote: '',
|
||||||
|
seedNoteError: ''
|
||||||
},
|
},
|
||||||
generating: false,
|
generating: false,
|
||||||
mobile: false,
|
mobile: false,
|
||||||
@@ -161,6 +174,8 @@ export default {
|
|||||||
handleClearInput() {
|
handleClearInput() {
|
||||||
this.form.title = ''
|
this.form.title = ''
|
||||||
this.form.remark = ''
|
this.form.remark = ''
|
||||||
|
this.form.generateSeedNote = false
|
||||||
|
this.form.goodsType = ''
|
||||||
this.$message.success('已清空输入')
|
this.$message.success('已清空输入')
|
||||||
},
|
},
|
||||||
async handleGenerate() {
|
async handleGenerate() {
|
||||||
@@ -169,18 +184,47 @@ export default {
|
|||||||
this.$message.warning('请输入商品标题')
|
this.$message.warning('请输入商品标题')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (this.form.generateSeedNote) {
|
||||||
|
const remark = (this.form.remark || '').trim()
|
||||||
|
const goodsType = (this.form.goodsType || '').trim()
|
||||||
|
if (!remark) {
|
||||||
|
this.$message.warning('生成种草时需要填写型号/备注')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!goodsType) {
|
||||||
|
this.$message.warning('请填写商品类型')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
this.generating = true
|
this.generating = true
|
||||||
|
this.result.seedNote = ''
|
||||||
|
this.result.seedNoteError = ''
|
||||||
try {
|
try {
|
||||||
const res = await generateXianyuWenan({
|
const payload = {
|
||||||
title: title,
|
title: title,
|
||||||
remark: (this.form.remark || '').trim() || undefined
|
remark: (this.form.remark || '').trim() || undefined
|
||||||
})
|
}
|
||||||
|
if (this.form.generateSeedNote) {
|
||||||
|
payload.goods_title = title
|
||||||
|
payload.goods_model = (this.form.remark || '').trim()
|
||||||
|
payload.goods_type = (this.form.goodsType || '').trim()
|
||||||
|
payload.generateSeedNote = true
|
||||||
|
}
|
||||||
|
const res = await generateXianyuWenan(payload)
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
this.result.daixiadan = data.daixiadan || ''
|
this.result.daixiadan = data.daixiadan || ''
|
||||||
this.result.jiaonixiadan = data.jiaonixiadan || ''
|
this.result.jiaonixiadan = data.jiaonixiadan || ''
|
||||||
|
this.result.seedNote = (data.seedNote || '').trim()
|
||||||
|
this.result.seedNoteError = data.seedNoteError || ''
|
||||||
|
if (this.result.seedNote) {
|
||||||
this.$message.success('生成成功')
|
this.$message.success('生成成功')
|
||||||
|
} else if (this.result.seedNoteError) {
|
||||||
|
this.$message.warning('种草未生成:' + this.result.seedNoteError)
|
||||||
|
} else {
|
||||||
|
this.$message.success('生成成功')
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(data.error || '生成失败')
|
this.$message.error(data.error || '生成失败')
|
||||||
}
|
}
|
||||||
@@ -242,9 +286,6 @@ export default {
|
|||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
.help-section {
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
.input-section {
|
.input-section {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
@@ -281,6 +322,12 @@ export default {
|
|||||||
.btn-clear {
|
.btn-clear {
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
.seed-error-alert {
|
||||||
|
margin: 0 0 16px;
|
||||||
|
}
|
||||||
|
.seed-row {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
/* 移动端适配 */
|
/* 移动端适配 */
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
@@ -301,12 +348,6 @@ export default {
|
|||||||
.card-title {
|
.card-title {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
.help-section {
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
.help-section ::v-deep .el-alert__content {
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
.input-section {
|
.input-section {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|||||||
15
tsconfig.json
Normal file
15
tsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"target": "ES2022",
|
||||||
|
"jsx": "react",
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"strictFunctionTypes": true,
|
||||||
|
"sourceMap": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"**/node_modules/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user