From 262a2bed773d7d4e23c02b08dd68318e7c77a527 Mon Sep 17 00:00:00 2001 From: congzc Date: Fri, 7 Apr 2023 14:20:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=B3=A8=E5=86=8C=E5=92=8C?= =?UTF-8?q?=E9=9F=B3=E9=A2=91=E8=AF=95=E5=90=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/editModel.js | 21 + src/api/login.js | 2 +- src/components/CutImg.vue | 259 ++++++ src/utils/request.js | 2 +- src/views/login/login copy 2.vue | 773 ++++++++++++++++++ .../{login copy.vue => login copy-old.vue} | 0 src/views/login/login.vue | 125 ++- src/views/model/editModel.vue | 16 +- 8 files changed, 1168 insertions(+), 30 deletions(-) create mode 100644 src/api/editModel.js create mode 100644 src/components/CutImg.vue create mode 100644 src/views/login/login copy 2.vue rename src/views/login/{login copy.vue => login copy-old.vue} (100%) diff --git a/src/api/editModel.js b/src/api/editModel.js new file mode 100644 index 0000000..14d0cc7 --- /dev/null +++ b/src/api/editModel.js @@ -0,0 +1,21 @@ +import request from '@/utils/request' + + + +// 得到声音试听文件 + export function videoDetial(data) { + return request({ + url: `/api/userVideo/videoDetial?videoId=${data}`, + method: 'get', + }) +} + +// 得到声音试听文件 +export function awsImgUpload(data) { + return request({ + url: `/api/upload/awsImgUpload + file`, + method: 'post', + data:data + }) +} \ No newline at end of file diff --git a/src/api/login.js b/src/api/login.js index c153093..845adcb 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -123,5 +123,5 @@ export function doLoginOut() { * @description 获取图形验证码 * @returns data */ -export const codeImg = +export const doCodeImg = 'https://smapitest.malls.iformall.com/C/api/user/captcha.jpg' \ No newline at end of file diff --git a/src/components/CutImg.vue b/src/components/CutImg.vue new file mode 100644 index 0000000..04b498d --- /dev/null +++ b/src/components/CutImg.vue @@ -0,0 +1,259 @@ + + + diff --git a/src/utils/request.js b/src/utils/request.js index 6738a44..10da45b 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -52,7 +52,7 @@ request.interceptors.response.use( // 其他错误 } else { - Toast.fail(error.message) + return Promise.reject(response.data) } } else { diff --git a/src/views/login/login copy 2.vue b/src/views/login/login copy 2.vue new file mode 100644 index 0000000..5386c24 --- /dev/null +++ b/src/views/login/login copy 2.vue @@ -0,0 +1,773 @@ + + + + + diff --git a/src/views/login/login copy.vue b/src/views/login/login copy-old.vue similarity index 100% rename from src/views/login/login copy.vue rename to src/views/login/login copy-old.vue diff --git a/src/views/login/login.vue b/src/views/login/login.vue index 176b76b..60875f9 100644 --- a/src/views/login/login.vue +++ b/src/views/login/login.vue @@ -37,10 +37,10 @@ - + - + @@ -132,6 +132,13 @@ placeholder="请输入验证码" > + + + + + + +
账户登录 @@ -232,6 +239,28 @@
+ + +
+ + + + + +
+ 账户登录 +
+ + + 确定 + +
+
内容 @@ -255,7 +284,7 @@ import { getCaptcha, doFindInviteCode, doUpdateInviteCode, - codeImg + doCodeImg } from '../../api/login' Vue.use(Toast) @@ -268,7 +297,8 @@ export default { codeInfo: '获取验证码', inPage: false, codeImg: '', //随机验证码图片 - loginType: 1, //显示页面字符 + loginType: 6, //显示页面字符 + showCodeImg: true, // 控制验证码的刷新 // 短信验证码登录 form: { phone: '', // 手机号 @@ -278,7 +308,8 @@ export default { phoneCode: '', // code: '', // 短信验证码 code1: '', // 忘记密码的短信验证码 - yzCode: '' // 随机图片验证码 + yzCode: '', // 随机图片验证码 + inviteCode: '' //邀请码 }, rules: { phone: [ @@ -337,7 +368,22 @@ export default { } } }, - + watch: { + // type值改变,清空除手机号的其他值 + loginType() { + this.form = { + phone: this.form.phone, // 手机号 + password: '', // 密码 + newPassword1: '', // 新密码1 + newPassword2: '', // 新密码2 + phoneCode: '', // + code: '', // 短信验证码 + code1: '', // 忘记密码的短信验证码 + yzCode: '', // 随机图片验证码 + inviteCode: '' + } + } + }, computed: { ...mapState({ characters: (state) => state.publicObj.characters @@ -395,8 +441,15 @@ export default { } }, // 获取随机验证码图片 - getCodeImg() { - this.codeImg = codeImg + async getCodeImg() { + this.showCodeImg = false + await this.$axios({ + method: 'get', + url: doCodeImg + }).then((res) => { + this.codeImg = doCodeImg + }) + this.showCodeImg = true }, // 点击登录 @@ -406,7 +459,7 @@ export default { const data = { phone: this.form.phone, password: this.form.password, - yzCode: this.form.yzCode + code: this.form.yzCode } this.LoginByPhone(data) return @@ -420,6 +473,7 @@ export default { this.LoginByPhone(data) return } + // 忘记密码第一步 if (this.loginType == 3) { const data = { phone: this.form.phone, @@ -428,6 +482,7 @@ export default { this.sendPhoneCode(data) return } + // 忘记密码之新密码 if (this.loginType == 4) { const data = { phone: this.form.phone, @@ -437,16 +492,31 @@ export default { this.updPass(data) return } + // 注册 if (this.loginType == 5) { + if (this.form.newPassword1 != this.form.newPassword2) { + Toast('两次输入密码不一致') + return + } const data = { phone: this.form.phone, - newPassword1: this.form.newPassword1, - newPassword2: this.form.newPassword2 + password: this.form.newPassword1 } - this.LoginByPhone(data) + this.registerByPhone(data) return } }, + // 注册 + async registerByPhone(data) { + try { + const res = await doRegisterByPhone(data) + console.log(res) + this.loginType = 1 + } catch (error) { + console.log(error, 'error') + Toast.fail(error.message) + } + }, // 忘记密码第一步,根据图片验证码和手机号获取短信 async sendPhoneCode(data) { try { @@ -472,7 +542,7 @@ export default { // 提交邀请码 submitInviteCode() { const data = { - inviteCode: this.formIII.inviteCode + inviteCode: this.form.inviteCode } this.updateInviteCode(data) }, @@ -504,17 +574,26 @@ export default { */ async LoginByPhone(loginParams) { try { + //密码登录 if (this.loginType == 1) { const res = await doLogin(loginParams) + console.log(res.data.token, '登录数据') + const token = res.data.token + // 将token置入本地存储 + localStorage.setItem('AccessToken', token) + // 查询有无邀请码 + this.checkInviteCode() } + // 短信登录 if (this.loginType == 2) { const res = await doLoginByPhone(loginParams) + console.log(res, '登录数据') + const token = res.data.token + // 将token置入本地存储 + localStorage.setItem('AccessToken', token) + // 查询有无邀请码 + this.checkInviteCode() } - console.log(res, '登录数据') - const token = res.data.token - // 将token置入本地存储 - localStorage.setItem('AccessToken', token) - this.checkInviteCode() } catch (error) { console.log(error, 'error') Toast.fail(error.message) @@ -527,11 +606,11 @@ export default { async checkInviteCode() { try { const res = await doFindInviteCode() - console.log(res, '查询用户邀请码数据') + // console.log(res, '查询用户邀请码数据') const status = res.data.status // 当没有邀请码时,切换输入验证码页面 if (status == 0) { - this.loginType = 3 + this.loginType = 6 // 有邀请码直接前往我的页面 } else if (status == 1) { Toast.success('登录成功!') @@ -545,9 +624,9 @@ export default { /** * @description:查询用户邀请码状态 */ - async checkInviteCode() { - this.src = '/api/captcha.jpg?t=' + Date() - }, + // async checkInviteCode1() { + // this.src = '/api/captcha.jpg?t=' + Date() + // }, /** * @description:更新邀请码 */ diff --git a/src/views/model/editModel.vue b/src/views/model/editModel.vue index 996129e..2ba19b6 100644 --- a/src/views/model/editModel.vue +++ b/src/views/model/editModel.vue @@ -136,6 +136,7 @@ +
@@ -209,8 +210,8 @@
-
暂无数据
-
+
暂无数据
+
图片
@@ -314,7 +315,7 @@ - +
@@ -337,6 +338,7 @@ import { doFindInviteCode, saveOrUpdateUserVideo } from '@/api/generateVideo' +import { videoDetial } from '@/api/editModel' import { getModelDetailById } from '../../api/getPaper.js' Vue.use(Toast) @@ -346,13 +348,14 @@ export default { }, data() { return { + audioUrl: null, // 声音试听 inPage: false, imgUrl: null, modelId: null, mouldSmId: null, saveID: null, // 作品id inputTitle: '', - textareaContent: 'qweqwe', // 输入框内容 + textareaContent: '', // 输入框内容 bottomTabActive: 2, // 底部导航高亮 showSubtitle: false, // 是否展示字幕 showSynthesisDialog: false, //合成进度条窗口显示隐藏 @@ -415,10 +418,13 @@ export default { } }, // 点击声音列表中的某一项 - clickSoundItem(index, item) { + async clickSoundItem(index, item) { if (this.soundItemListAction != index) { this.soundItemListAction = index this.soundChoose = item + // 得到试听文件 + const res = await videoDetial(item.exampleVideoId) + this.audioUrl = res.data.videoUrl } else { this.soundItemListAction = -1 this.soundChoose = {}