Browse Source

接口整合与对齐

release
HolyKnightIX 2 years ago
parent
commit
649764bb20
16 changed files with 177 additions and 115 deletions
  1. +1
    -0
      .gitignore
  2. +14
    -1
      src/api/generateVideo.js
  3. +11
    -0
      src/api/login.js
  4. BIN
      src/assets/img/loginOut.png
  5. +0
    -0
      src/components/aboutUs/aboutUs.vue
  6. +31
    -27
      src/components/common/tail.vue
  7. +2
    -2
      src/components/common/top.vue
  8. +6
    -6
      src/components/home/home.vue
  9. +3
    -3
      src/router/index.js
  10. +8
    -0
      src/utils/deepCopy.js
  11. +9
    -6
      src/utils/request.js
  12. +4
    -4
      src/views/login/login.vue
  13. +3
    -3
      src/views/model/chooseModel.vue
  14. +81
    -60
      src/views/model/generateVideo.vue
  15. +3
    -2
      src/views/model/getPaper.vue
  16. +1
    -1
      src/views/myPage/myPage.vue

+ 1
- 0
.gitignore View File

@@ -16,6 +16,7 @@ pnpm-debug.log*
# Editor directories and files
.idea
.vscode
.zip
*.suo
*.ntvs*
*.njsproj


+ 14
- 1
src/api/generateVideo.js View File

@@ -43,7 +43,7 @@ export function doFindInviteCode() {
*/
export function getVoiceList(data) {
return request({
url: `/api/mouldPatch/voiceList?pageNum=1&pageSize=10`,
url: `/api/mouldPatch/voiceList?pageNum=1&pageSize=20`,
method: 'post',
data
})
@@ -58,4 +58,17 @@ export function getBackGroundList() {
url: `/api/mouldPatch/list?type=4&pageNum=1&pageSize=10`,
method: 'get',
})
}

/**
* @description:保存或修改用户作品
* @param {object} data
* @return data
*/
export function saveOrUpdateUserVideo(data) {
return request({
url: `/api/userVideo/saveOrUpdate`,
method: 'post',
data: data
})
}

+ 11
- 0
src/api/login.js View File

@@ -47,4 +47,15 @@ export function doUpdateInviteCode(inviteCodeData) {
method: 'post',
data: inviteCodeData
})
}

/**
* @description 退出登录
* @returns data
*/
export function doLoginOut() {
return request({
url: `/api/user/loginOut`,
method: 'get',
})
}

BIN
src/assets/img/loginOut.png View File

Before After
Width: 128  |  Height: 128  |  Size: 1.1 KiB

src/components/aboutUe/aboutUe.vue → src/components/aboutUs/aboutUs.vue View File


+ 31
- 27
src/components/common/tail.vue View File

@@ -1,14 +1,13 @@
<template>
<div class="tailBox">
<div class="title">联系我们</div>
<!-- <div class="title">联系我们</div> -->
<!-- <div class="taillong">
<img src="../../assets/img/LOGO1.png" alt>
</div> -->

<div class="tiemBox">
<!-- <div class="tiemBox">

<div class="contentBox">
<!-- <div class="taolIconText">{{characters ==1?'联系我们':'Contact us'}}</div> -->
<div class="contentInput">
<input type="text" :placeholder="characters ==1?'姓名':'Name'" v-model="userName">
</div>
@@ -22,11 +21,19 @@
<div class="subBtn" @click="submit()">{{characters ==1?'提交':'Submit'}}</div>
</div>
</div>
<div class="tailText"> <img src="../../assets/img/logoh.png" alt=""></div>
</div> -->
<div class="tailText"><img src="../../assets/img/logoh.png" alt="" /></div>
<div class="tailText">TEL:86 152 1093 7300</div>
<div class="tailText">{{characters ==1?'北京市海淀区中关村南大街12号农业科学院信息楼311室':'311, Information Building, Academy of Agricultural Sciences, No. 12 Zhongguancun South Street, Haidian District, Beijing'}}</div>
<div class="tailText">© 2021 Copyright 北京邃芒科技有限公司 版权所有 京ICP备2021007416号</div>
<div class="tailText">
{{
characters == 1
? "北京市海淀区中关村南大街12号农业科学院信息楼311室"
: "311, Information Building, Academy of Agricultural Sciences, No. 12 Zhongguancun South Street, Haidian District, Beijing"
}}
</div>
<div class="tailText">
© 2021 Copyright 北京邃芒科技有限公司 版权所有 京ICP备2021007416号
</div>
</div>
</template>
<script>
@@ -36,26 +43,26 @@ export default {
return {
userName: "",
phone: "",
email: ""
email: "",
};
},
methods: {
submit() {
let phone = /^1[35789]\d{9}$/;
if (this.userName == "") {
Toast.fail (
Toast.fail(
this.characters == 1 ? "请输入姓名" : "Please enter your name"
);
return;
} else if (!phone.test(this.phone)) {
Toast.fail (
Toast.fail(
this.characters == 1
? "请输入手机号"
: "Please enter your mobile phone number"
);
return;
} else if (this.email == "") {
Toast.fail (
Toast.fail(
this.characters == 1 ? "请输入邮箱" : "Please enter email address"
);
return;
@@ -63,17 +70,17 @@ export default {
let params = {
mallName: this.email, //邮箱
applicant: this.userName, //姓名
phone: this.phone //电话
phone: this.phone, //电话
};
this.$axios({
method: "post",
url: "/api/callback/wxMallApply/add",
headers: {
"Content-Type": "application/json;charset=UTF-8"
"Content-Type": "application/json;charset=UTF-8",
},
data: params
data: params,
})
.then(res => {
.then((res) => {
this.email = "";
this.userName = "";
this.phone = "";
@@ -81,24 +88,23 @@ export default {
this.characters == 1 ? "提交成功" : "submit successfully"
);
})
.catch(err => {
Toast.fail (err.message);
.catch((err) => {
Toast.fail(err.message);
});
}
},
},
computed: {
...mapState({
characters: state => state.publicObj.characters
})
}
characters: (state) => state.publicObj.characters,
}),
},
};
</script>


<style lang="scss" scoped>
.tailBox {
overflow: hidden;
.title{
.title {
text-align: center;
font-size: 18px;
line-height: 30px;
@@ -119,7 +125,7 @@ export default {
height: 50px;
}
}
.tiemBox{
.tiemBox {
overflow: hidden;
margin-top: 20px;
}
@@ -144,7 +150,6 @@ export default {
}
}
.contentBox {

margin: 10px auto;
.contentInput {
width: 220px;
@@ -254,7 +259,7 @@ export default {
font-weight: 400;
color: #191919;
margin-bottom: 4px;
img{
img {
width: 110px;
height: 30px;
}
@@ -281,4 +286,3 @@ export default {
font-size: 12px;
}
</style>


+ 2
- 2
src/components/common/top.vue View File

@@ -9,7 +9,7 @@
<div class="categoryitem">{{characters==1?'创新技术':'technology'}}</div>
<div class="categoryitem">{{characters==1?'解决方案':'Solutions'}}</div>
<div class="categoryitem">{{characters==1?'精选案例':'Cases'}}</div>
<div class="categoryitem" @click="go('/aboutUe')">{{characters==1?'关于我们':'About us'}}</div>
<div class="categoryitem" @click="go('/aboutUs')">{{characters==1?'关于我们':'About us'}}</div>
</div>-->
<div class="cutBox">
<div class="en">
@@ -59,7 +59,7 @@
</div>
<div class="goItem">{{ characters == 1 ? "解决方案" : "Solutions" }}</div>
<!-- <div class="goItem">{{characters==1?'精选案例':'Cases'}}</div> -->
<div class="goItem" @click="go('/aboutUe')">
<div class="goItem" @click="go('/aboutUs')">
{{ characters == 1 ? "关于我们" : "About us" }}
</div>
<div class="languageImgBox" @click="change(1)">


+ 6
- 6
src/components/home/home.vue View File

@@ -23,7 +23,7 @@
muted="muted"
loop="loop"
/>
<div class="titleBox" @click="showBox">
<div class="titleBox" @click="goLogin">
<div class="title_item1" v-if="characters == 1">打造自主数字人IP</div>
<div class="title_item2" v-if="characters == 1">沉淀数字资产</div>
<!-- <div class="title_item3" v-if="characters==1">自动化实时创作过程 帮助您快速定义形象 多种类型</div> -->
@@ -67,7 +67,7 @@
: "supporting multiple languages and inputs, generating digital content, bring new intelligence experience far more exciting than before ."
}}
</div>
<div class="title_btn" @click="showBox">
<div class="title_btn" @click="goLogin">
{{ characters == 1 ? "立刻体验" : "Try it now" }}
</div>
</div>
@@ -99,7 +99,7 @@
: "Provide extremely expenses saving & extendable user experience in digital content producing process."
}}
</div>
<div class="title_btn" @click="showBox">
<div class="title_btn" @click="goLogin">
{{ characters == 1 ? "立刻体验" : "Try it now" }}
</div>
</div>
@@ -149,7 +149,7 @@
: "MetaGene provides digital human with the interactive ability, the character will have intelligent interactive functions, help to deal with real world problems in the business and assistance in completing tasks."
}}
</div>
<div class="read_btn" @click="showBox">
<div class="read_btn" @click="goLogin">
{{ characters == 1 ? "了解详情" : "Read more" }}
</div>
</div>
@@ -231,7 +231,7 @@
}}
</div>
</div>
<div class="bnt_look" @click="showBox">
<div class="bnt_look" @click="goLogin">
{{ characters == 1 ? "立刻体验" : "Try it now" }}
</div>
</div>
@@ -379,7 +379,7 @@
{{ characters == 1 ? "解决方案" : "Solutions" }}
</div>
<!-- <div class="goItem">{{characters==1?'精选案例':'Cases'}}</div> -->
<!-- @click="go('/aboutUe')" -->
<!-- @click="go('/aboutUs')" -->
<div class="goItem" @click="goView('module_9')">
{{ characters == 1 ? "关于我们" : "About us" }}
</div>


+ 3
- 3
src/router/index.js View File

@@ -17,9 +17,9 @@ const routes = [
component: () => import("../components/home/home"),
},
{
path: '/aboutUe',
name: 'aboutUe',
component: () => import("../components/aboutUe/aboutUe"),
path: '/aboutUs',
name: 'aboutUs',
component: () => import("../components/aboutUs/aboutUs"),
},
{
path: '/styleAdd',


+ 8
- 0
src/utils/deepCopy.js View File

@@ -0,0 +1,8 @@
/**
* @description:使用JSON进行深度拷贝
*/
const deepCopy = data => {
const copyData = JSON.stringify(data)
return JSON.parse(copyData)
}
export default deepCopy

+ 9
- 6
src/utils/request.js View File

@@ -37,19 +37,22 @@ request.interceptors.response.use(
router.push("/login");
Toast.fail("登录过期,请重新登录!");
return
// 其他错误

} else if (response.data.code == 404) {
Toast.fail("网络异常,请稍后再试");
return Promise.reject(response.data)

} else if (response.data.code == 500) {
Toast.fail("系统异常,请稍后再试");
return Promise.reject()
return Promise.reject(response.data)

// 其他错误
} else {
Toast.fail(response.data.message);
return Promise.reject()
return Promise.reject(response.data)
}
} else {
// 正常返回
return response.data
// 抛出错误
// return Promise.reject()
}
},
function (error) {


+ 4
- 4
src/views/login/login.vue View File

@@ -247,7 +247,7 @@ export default {
}
}, 1000);
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -264,7 +264,7 @@ export default {
localStorage.setItem("AccessToken", token);
this.checkInviteCode();
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -286,7 +286,7 @@ export default {
this.$router.push("/myPage");
}
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -301,7 +301,7 @@ export default {
Toast.success("登录成功!");
this.$router.push("/myPage");
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},


+ 3
- 3
src/views/model/chooseModel.vue View File

@@ -110,7 +110,7 @@ export default {
console.log(res, "获取模板列表");
this.modeList = res.data.list;
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -122,7 +122,7 @@ export default {
const modelDetail = res.data;
this.goSetPaperWork(modelDetail);
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -138,7 +138,7 @@ export default {
},
});
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},


+ 81
- 60
src/views/model/generateVideo.vue View File

@@ -14,18 +14,16 @@
v-if="soundList.length"
v-for="(item, index) in soundList"
:key="index"
@click="setIn('sound', item.id)"
@click="setParams('sound', item)"
:class="soundIndex == item.id ? 'active' : ''"
>
<div
class="preview"
:class="soundIndex == item.id ? 'active' : ''"
:style="'background-color:' + item.color"
></div>
<div class="preview" :class="soundIndex == item.id ? 'active' : ''">
<img :src="item.coverImg" alt="" />
</div>
<div class="tag">{{ item.title }}</div>
</div>

<div class="instead" v-if="!soundList.length">暂无可用声音</div>
<div class="instead" v-if="!soundList.length">{{ voiceAlert }}</div>
</div>
</div>

@@ -37,14 +35,15 @@
v-if="backGroundList.length"
v-for="(item, index) in backGroundList"
:key="index"
@click="setIn('backGround', item.id)"
@click="setParams('backGround', item.id)"
:class="backGroundIndex == item.id ? 'active' : ''"
>
<div
class="preview"
:class="backGroundIndex == item.id ? 'active' : ''"
:style="'background-color:' + item.color"
></div>
>
<img :src="item.coverImg" alt="" />
</div>
<div class="tag">{{ item.title }}</div>
</div>

@@ -86,10 +85,10 @@
<script>
import Vue from "vue";
import { Toast } from "vant";
import baseUrl from "../../api/baseUrl";
import { mapState, mapActions } from "vuex";
import HeadTop from "./../../components/common/head.vue";
import scrollToID from "../../utils/scrollToID";
import deepCopy from "../../utils/deepCopy";

import {
doCreateVideo,
@@ -97,6 +96,7 @@ import {
getVoiceList,
getBackGroundList,
doFindInviteCode,
saveOrUpdateUserVideo,
} from "../../api/generateVideo";

Vue.use(Toast);
@@ -109,50 +109,27 @@ export default {
isShowCover: false,
isShowMessageCover: false,
show: false,
voiceAlert: "暂无可用声音",
soundIndex: "",
backGroundIndex: "",
coverImg: "",
id: "",
paperwork: "",
saveData: {}, // 来自填写文案页面保存的数据
timerOver: false,
soundList: [
{
id: 1,
color: "red",
title: "红色",
},
{
id: 2,
color: "orange",
title: "橙色",
},
{
id: 3,
color: "yellow",
title: "黄色",
},
{
id: 4,
color: "green",
title: "绿色",
},
{
id: 5,
color: "aqua",
title: "青色",
},
{
id: 6,
color: "blue",
title: "蓝色",
},
{
id: 7,
color: "purple",
title: "紫色",
},
],
soundList: [],
backGroundList: [],

// 声音参数
soundParams: {
voiceMouldId: "",
voiceMouldSmId: "",
},
// 背景参数
backGroundParams: {
backgroundMouldId: "",
backgroundMouldSmId: "",
},
};
},
computed: {
@@ -168,30 +145,40 @@ export default {
this.$router.push(url);
},

setIn(type, num) {
setParams(type, item) {
const num = item.id;
// 更换声音
if (type == "sound") {
// 第一次选中
if (this.soundIndex == "") {
this.soundIndex = num;
this.soundParams.voiceMouldId = item.id;
this.soundParams.voiceMouldSmId = item.mouldSmId;
// 取消选中
} else if (num == this.soundIndex) {
this.soundIndex = "";
// 有选中的情况下选择其他项
} else {
this.soundIndex = num;
this.soundParams.voiceMouldId = item.id;
this.soundParams.voiceMouldSmId = item.mouldSmId;
}
console.log(this.soundParams, "选择声音参数");
// 更换背景
} else if (type == "backGround") {
// 第一次选中
if (this.backGroundIndex == "") {
this.backGroundIndex = num;
this.backGroundParams.voiceMouldId = item.id;
this.backGroundParams.voiceMouldSmId = item.mouldSmId;
// 取消选中
} else if (num == this.backGroundIndex) {
this.backGroundIndex = "";
// 有选中的情况下选择其他项
} else {
this.backGroundIndex = num;
this.backGroundParams.voiceMouldId = item.id;
this.backGroundParams.voiceMouldSmId = item.mouldSmId;
}
}
},
@@ -217,7 +204,7 @@ export default {
/**
* @description:生成视频
*/
async createVideo() {
async createVideo(data) {
try {
const res = await doCreateVideo(data);
console.log(res, "生成视频");
@@ -233,7 +220,7 @@ export default {
}
}, 1000);
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -248,8 +235,9 @@ export default {
try {
const res = await getVoiceList(data);
console.log(res, "获取声音列表");
this.soundList = res.data.list;
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -261,8 +249,9 @@ export default {
try {
const res = await getBackGroundList();
console.log(res, "获取背景列表");
this.backGroundList = res.data.list;
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -292,7 +281,7 @@ export default {
return;
}
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -307,13 +296,34 @@ export default {
const status = res.data.status;
// 当没有邀请码时
if (status == 1) {
this.createVideo();
// 组装参数
const data = {
...this.saveData,
...this.soundParams,
...this.backGroundParams,
};
console.log(data, "最终提交的参数");
this.saveOrUpdate(data);
} else if (status == 0) {
this.isShowMessageCover = true;
return;
}
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},

/**
* @description:保存或修改用户作品
*/
async saveOrUpdate(data) {
try {
const res = await saveOrUpdateUserVideo(data);
console.log(res, "保存或修改用户作品");
this.createVideo({ id: this.id });
} catch (error) {
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -323,11 +333,14 @@ export default {
this.coverImg = this.$route.query.coverImg;
this.id = this.$route.query.id;
this.paperwork = this.$route.query.paperwork;
this.loadVoice();
this.loadBackGrounnd();
this.saveData = deepCopy(this.$route.query.saveData);
console.log(this.saveData, "this.saveData");
},

mounted() {
scrollToID("top");
this.loadVoice();
this.loadBackGrounnd();
},
};
</script>
@@ -388,9 +401,13 @@ export default {
flex-shrink: 0;
border: 1px solid #00000036;
border-radius: 50% 50%;
overflow: hidden;
transition: all 0.5s;
opacity: 0.9;

img {
width: 100%;
height: 100%;
}
&.active {
border: 1px solid #000;
width: 35px;
@@ -453,9 +470,13 @@ export default {
flex-shrink: 0;
border: 1px solid #00000036;
border-radius: 50% 50%;
overflow: hidden;
transition: all 0.5s;
opacity: 0.9;

img {
width: 100%;
height: 100%;
}
&.active {
border: 1px solid #000;
width: 35px;


+ 3
- 2
src/views/model/getPaper.vue View File

@@ -89,7 +89,7 @@ export default {
const res = await getModelDetailById(id);
this.modelDetail = res.data.personMould;
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},
@@ -107,10 +107,11 @@ export default {
id: res.data.id,
coverImg: this.modelDetail.coverImg,
paperwork: this.paperwork,
saveData: data,
},
});
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},


+ 1
- 1
src/views/myPage/myPage.vue View File

@@ -121,7 +121,7 @@ export default {
this.videoList = res.data.list;
this.total = res.data.total;
} catch (error) {
console.log(error);
console.log(error, "error");
Toast.fail(error.message);
}
},


Loading…
Cancel
Save