Commit ccfc4dc2 authored by lijin's avatar lijin

commit

parent 7ce75464
......@@ -11,7 +11,7 @@ module.exports = merge(prodEnv, {
// CLOND_API: '"http://api.nms.huolea.com"',
CLOND_API: '"http://apitest.nms.huolea.com"',
// BXDD_API: '"http://localhost:9311"',
BXDD_API: '"http://data-api.zhangxinhulian.com"',
BXDD_API: '"https://data-api.zhangxinhulian.com"',
PACK_API: '"http://packing.zhangxindiet.com"',
// PUTIN_API: '"http://putinapi.zhangxindiet.com"',
PUTIN_API: '"http://localhost:8567"',
......
......@@ -17,7 +17,7 @@ if (idx > 0) {
ZX_NMS_BASE_API = '"http://api.nms.huolea.com"';
BASE_API = '"http://cms.huolea.com"';
CLOND_API = '"http://api.nms.huolea.com"';
BXDD_API = '"http://data-api.zhangxinhulian.com"';
BXDD_API = '"https://data-api.zhangxinhulian.com"';
PUTIN_API = '"http://putinapi.zhangxindiet.com"';
AD_API = '"http://adsp.zhangxindiet.com"';
}
......
......@@ -89,6 +89,24 @@ export const constantRouterMap = [
]
},
{
path: "/tools", // 资产管理
name: "tools",
component: Layout,
meta: {
title: "工具",
icon: "chart"
},
children: [
{
path: "/tools/Youtube",
name: "tools.Youtube",
component: () => import("@/views/tools/YouTubeAuth"),
meta: { title: "Youtube管理", icon: "chart" }
}
]
},
{
path: '/redirect', // 重定向路由
component: Layout,
......
......@@ -548,21 +548,48 @@
<div class="drawer-item-con">
<el-form ref="form">
<el-select
v-model="putinTask.zhuanhuamubiao"
placeholder=""
default-first-option
style="width: 200px"
>
<el-option
v-for="item in [{'name': '安装量', 'value': 1, 'disabled': false}, {'name': '应用内操作次数', 'value': 2, 'disabled': true}, {'name': '应用内操作价值', 'value': 3, 'disabled': false}]"
:key="item.value"
:label="item.name"
:value="item.value"
:disabled="item.disabled"
<el-form-item label="转化目标">
<el-select
v-model="putinTask.biddingStrategyGoalType"
placeholder=""
default-first-option
style="width: 200px"
>
</el-option>
</el-select>
<el-option
v-for="item in [{'name': '安装量', 'value': 2, 'disabled': false}, {'name': '应用内操作次数', 'value': 3, 'disabled': true}, {'name': '应用内操作价值', 'value': 5, 'disabled': false}]"
:key="item.value"
:label="item.name"
:value="item.value"
:disabled="item.disabled"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item v-if="putinTask.biddingStrategyGoalType == 2">
<el-checkbox v-model="putinTask.isSetTargetCpa" label="设置目标每次安装费用"/>
</el-form-item>
<el-form-item label="目标每次安装费用" v-if="putinTask.biddingStrategyGoalType == 2 && putinTask.isSetTargetCpa">
<el-input v-model="putinTask.targetCpa" style="width: 30%"/>
<template slot="prepend">$</template>
</el-form-item>
<el-form-item label="事件列表">
<div>123123</div>
<div>123123</div>
</el-form-item>
<el-form-item label="目标广告支出回报率">
<el-input v-model="putinTask.targetRoas" style="width: 30%"/>
<template slot="prepend">$</template>
</el-form-item>
</el-form>
</div>
</div>
......@@ -719,6 +746,7 @@ export default {
}, // 分页信息
loading: false,
isTargetCpaShow: true, // 是否展示设置安装单价的表单
tryItOut: 0, //试玩搭配,默认不启用
tryMaterialList: [], //试玩素材列表
submitBtnState: false, //防止重复提交控制
......@@ -750,7 +778,6 @@ export default {
startDate: '',
endDate: '',
dailyBudget: '1.00',
zhuanhuamubiao: '',
crowdValue: "不限", // 自定义人群的值
crowdAdvertiserId: "",
/* 测试假数据 使用 */
......@@ -821,9 +848,11 @@ export default {
putinAccounts: [],
campaignName: '',
campaignType: 1,
zhuanhuamubiao: 1,
biddingStrategyGoalType: 2,
dailyBudget: 0.0,
isSetTargetCpa: true,
targetCpa: 0.0,
targetRoas: 0,
appInfo: "",
appStore: 3,
startDate: '',
......
<template>
<div class="youtube-auth-container">
<!-- 未授权状态 -->
<div v-if="!isAuthorized" class="auth-section">
<el-alert
title="请先完成 YouTube 频道授权"
type="info"
:closable="false">
</el-alert>
<div class="auth-content">
<el-checkbox v-model="agreementChecked">
我已阅读并同意 Google、YouTube 隐私与服务协议
</el-checkbox>
<el-button
type="primary"
@click="handleAuth"
:disabled="!agreementChecked">
添加频道
</el-button>
</div>
</div>
<!-- 已授权状态 -->
<div v-else>
<el-form :model="uploadForm" label-width="120px">
<!-- 频道选择 -->
<el-form-item label="选择频道">
<el-select
v-model="uploadForm.channelId"
placeholder="请选择上传频道">
<el-option
v-for="channel in authorizedChannels"
:key="channel.id"
:label="channel.name"
:value="channel.id">
</el-option>
</el-select>
</el-form-item>
<!-- 视频上传 -->
<el-form-item label="上传视频">
<el-upload
class="video-uploader"
drag
action=""
:http-request="handleVideoUpload"
:before-upload="beforeVideoUpload"
:show-file-list="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将视频拖到此处,或<em>点击上传</em>
</div>
</el-upload>
</el-form-item>
<!-- 视频信息 -->
<el-form-item label="视频标题">
<el-input v-model="uploadForm.title"></el-input>
</el-form-item>
<el-form-item label="视频描述">
<el-input
type="textarea"
v-model="uploadForm.description"
:rows="4">
</el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
@click="handlePublish"
:loading="publishing">
发布到 YouTube
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
export default {
name: 'YouTubeAuth',
data() {
return {
isAuthorized: false,
agreementChecked: false,
authorizedChannels: [],
uploadForm: {
channelId: '',
title: '',
description: '',
videoFile: null
},
publishing: false
}
},
created() {
// 检查是否已授权
this.checkAuthStatus()
},
methods: {
// 检查授权状态
async checkAuthStatus() {
try {
// 这里需要调用后端 API 检查授权状态
const response = await this.$http.get('/api/youtube/auth-status')
this.isAuthorized = response.data.isAuthorized
if (this.isAuthorized) {
this.fetchAuthorizedChannels()
}
} catch (error) {
this.$message.error('检查授权状态失败')
console.error(error)
}
},
// 处理授权
async handleAuth() {
if (!this.agreementChecked) {
this.$message.warning('请先同意服务协议')
return
}
try {
// 调用后端 API 获取授权 URL
const response = await this.$http.get('/api/youtube/auth-url')
// 打开 Google 授权页面
window.location.href = response.data.authUrl
} catch (error) {
this.$message.error('获取授权链接失败')
console.error(error)
}
},
// 获取已授权频道列表
async fetchAuthorizedChannels() {
try {
const response = await this.$http.get('/api/youtube/channels')
this.authorizedChannels = response.data.channels
} catch (error) {
this.$message.error('获取频道列表失败')
console.error(error)
}
},
// 上传前验证
beforeVideoUpload(file) {
const isVideo = file.type.startsWith('video/')
const isLt2GB = file.size / 1024 / 1024 / 1024 < 2
if (!isVideo) {
this.$message.error('只能上传视频文件!')
return false
}
if (!isLt2GB) {
this.$message.error('视频大小不能超过 2GB!')
return false
}
return true
},
// 处理视频上传
handleVideoUpload({ file }) {
this.uploadForm.videoFile = file
},
// 发布视频
async handlePublish() {
if (!this.uploadForm.channelId) {
this.$message.warning('请选择上传频道')
return
}
if (!this.uploadForm.videoFile) {
this.$message.warning('请选择要上传的视频')
return
}
if (!this.uploadForm.title) {
this.$message.warning('请输入视频标题')
return
}
this.publishing = true
try {
const formData = new FormData()
formData.append('channelId', this.uploadForm.channelId)
formData.append('title', this.uploadForm.title)
formData.append('description', this.uploadForm.description)
formData.append('video', this.uploadForm.videoFile)
await this.$http.post('/api/youtube/upload', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
})
this.$message.success('视频上传成功')
this.resetForm()
} catch (error) {
this.$message.error('视频上传失败')
console.error(error)
} finally {
this.publishing = false
}
},
// 重置表单
resetForm() {
this.uploadForm = {
channelId: '',
title: '',
description: '',
videoFile: null
}
}
}
}
</script>
<style scoped>
.youtube-auth-container {
padding: 20px;
}
.auth-section {
max-width: 600px;
margin: 0 auto;
}
.auth-content {
margin-top: 20px;
display: flex;
flex-direction: column;
gap: 20px;
align-items: center;
}
.video-uploader {
width: 100%;
}
.el-upload {
width: 100%;
}
.el-upload-dragger {
width: 100%;
height: 200px;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment