add
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="page">
|
||||
<el-card>
|
||||
<el-button type="text" @click="$router.push('/orders')">返回订单</el-button>
|
||||
@@ -14,7 +14,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="AI 生成">
|
||||
<div class="ai-row">
|
||||
<el-input v-model="aiPrompt" placeholder="例如:生成3条简短表白祝福语" />
|
||||
<el-input v-model="aiPrompt" placeholder="例如:生成一条简短表白祝福语" />
|
||||
<el-button type="primary" :loading="aiLoading" @click="generateWithAi">AI 生成</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -59,7 +59,7 @@ export default {
|
||||
imageUrl: ''
|
||||
},
|
||||
confession: null,
|
||||
aiPrompt: ' 约50字,文艺但不晦涩,避免过度肉麻,表达温柔与坚定。仅输出文案本身,不要加标题或解释。',
|
||||
aiPrompt: '50字左右,文艺但不晦涩,避免过度肉麻,表达温柔与坚定。仅输出文案本身,不要加标题或解释。',
|
||||
aiLoading: false
|
||||
};
|
||||
},
|
||||
@@ -85,6 +85,9 @@ export default {
|
||||
loadExisting() {
|
||||
const orderId = this.$route.params.orderId;
|
||||
getConfessionByOrder(orderId).then((res) => {
|
||||
if (!res || !res.data || res.data.code !== 0) {
|
||||
return;
|
||||
}
|
||||
const data = res.data.data;
|
||||
if (data) {
|
||||
this.confession = data;
|
||||
@@ -110,7 +113,7 @@ export default {
|
||||
model: 'gpt-4o',
|
||||
messages: [
|
||||
{ role: 'system', content: '你是文艺风格的祝福文案写手,语言自然、真诚、不过度夸张。' },
|
||||
{ role: 'user', content: '请生成一条表白文案,要求如下:'+this.aiPrompt }
|
||||
{ role: 'user', content: '请生成一条表白文案,要求如下:' + this.aiPrompt }
|
||||
],
|
||||
stream: false,
|
||||
temperature: 1
|
||||
@@ -145,6 +148,9 @@ export default {
|
||||
? updateConfession(this.confession.id, payload)
|
||||
: createConfession(payload);
|
||||
action.then((res) => {
|
||||
if (!res || !res.data || res.data.code !== 0) {
|
||||
return;
|
||||
}
|
||||
this.confession = res.data.data;
|
||||
this.$message.success('保存成功');
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="auth-page">
|
||||
<el-card class="card">
|
||||
<h3>登录</h3>
|
||||
@@ -28,7 +28,13 @@ export default {
|
||||
methods: {
|
||||
submit() {
|
||||
login(this.form).then((res) => {
|
||||
if (!res || !res.data || res.data.code !== 0) {
|
||||
return;
|
||||
}
|
||||
const data = res.data.data;
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
localStorage.setItem('token', data.token);
|
||||
localStorage.setItem('user', JSON.stringify(data.user));
|
||||
this.$message.success('登录成功');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="page">
|
||||
<el-card>
|
||||
<el-button type="text" @click="$router.push('/')">返回首页</el-button>
|
||||
@@ -101,6 +101,9 @@ export default {
|
||||
addressId: this.addressId,
|
||||
items: [{ productId: this.product.id, quantity: this.quantity }]
|
||||
}).then((res) => {
|
||||
if (!res || !res.data || res.data.code !== 0 || !res.data.data) {
|
||||
return;
|
||||
}
|
||||
this.$message.success('下单成功');
|
||||
const order = res.data.data.order;
|
||||
this.$router.push(`/orders?highlight=${order.id}`);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="auth-page">
|
||||
<el-card class="card">
|
||||
<h3>注册</h3>
|
||||
@@ -31,7 +31,13 @@ export default {
|
||||
methods: {
|
||||
submit() {
|
||||
register(this.form).then((res) => {
|
||||
if (!res || !res.data || res.data.code !== 0) {
|
||||
return;
|
||||
}
|
||||
const data = res.data.data;
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
localStorage.setItem('token', data.token);
|
||||
localStorage.setItem('user', JSON.stringify(data.user));
|
||||
this.$message.success('注册成功');
|
||||
|
||||
Reference in New Issue
Block a user