Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
hager
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-10-25 17:58:11 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
90c212aed3724e2763fc02ea4511e91c25196410
90c212ae
1 parent
89fd398f
联调邮件发送接口
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
10 deletions
src/api/hager.js
src/views/product/detail.vue
src/api/hager.js
View file @
90c212a
/*
* @Date: 2024-09-26 13:36:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-10-25 1
6:49:54
* @LastEditTime: 2024-10-25 1
7:48:09
* @FilePath: /hager/src/api/hager.js
* @Description: 文件描述
*/
...
...
@@ -24,6 +24,8 @@ const Api = {
GET_CODE
:
'/srv/?a=user&type=get_code'
,
EDIT_PASSWORD
:
'/srv/?a=user&type=edit_password'
,
SEARCH
:
'/srv/?a=search'
,
DOWN_EMAIL
:
'/srv/?a=down_email'
,
DOWN_ZIP
:
'/srv/?a=down_zip'
,
};
export
const
honorAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
HONOR
,
params
));
...
...
@@ -51,3 +53,6 @@ export const editUserInfoAPI = (params) => fn(fetch.post(Api.EDIT_USER, params))
export
const
getCodeAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
GET_CODE
,
params
));
export
const
editPasswordAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
EDIT_PASSWORD
,
params
));
export
const
searchAPI
=
(
params
)
=>
fn
(
fetch
.
get
(
Api
.
SEARCH
,
params
));
export
const
downEmailAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
DOWN_EMAIL
,
params
));
export
const
downZipAPI
=
(
params
)
=>
fn
(
fetch
.
post
(
Api
.
DOWN_ZIP
,
params
));
...
...
src/views/product/detail.vue
View file @
90c212a
<!--
* @Date: 2024-09-29 14:26:41
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-10-25 1
2:22:18
* @LastEditTime: 2024-10-25 1
7:57:24
* @FilePath: /hager/src/views/product/detail.vue
* @Description: 文件描述
-->
...
...
@@ -129,8 +129,8 @@ import mixin from 'common/mixin';
import hagerBox from '@/components/common/hagerBox';
import hagerCarousel from '@/components/hagerCarousel';
import hagerH1 from '@/components/common/hagerH1.vue';
import { MessageBox, Message } from 'element-ui';
import { getProductInfoAPI } from "@/api/hager.js";
import { MessageBox, Message
, Loading
} from 'element-ui';
import { getProductInfoAPI
, getUserInfoAPI, downEmailAPI, downZipAPI
} from "@/api/hager.js";
export default {
components: { hagerBox, hagerCarousel, hagerH1 },
...
...
@@ -170,6 +170,7 @@ export default {
info_images: [],
product_advantages: [],
checked_items: [],
is_login: false,
}
},
computed: {
...
...
@@ -187,6 +188,7 @@ export default {
},
async mounted () {
this.getInfo();
this.getUserInfo();
},
watch: {
// 监听路由参数变化时,更新输入框的值
...
...
@@ -228,7 +230,24 @@ export default {
this.download_list.forEach(item => item.show = false);
item.show = true;
},
goToDownload () {
async getUserInfo () {
const { code, data } = await getUserInfoAPI();
if (code) {
if (data) {
this.is_login = true; // 已登录
} else {
this.is_login = false; // 未登录
}
}
},
async goToDownload () {
if (!this.is_login) {
Message({
type: 'error',
message: '请先登录'
});
return;
}
if (this.is_download_checked) {
let ids = [];
this.download_list.forEach(item => {
...
...
@@ -238,25 +257,54 @@ export default {
}
})
});
console.warn(ids);
let loadingInstance = Loading.service({ fullscreen: true, background: 'rgba(0, 0, 0, 0.3)' });
const { code, data } = await downEmailAPI();
if (code) {
await downZipAPI({ name: data.name, ids });
// 发送邮箱接口
Message({
type: 'success',
message: '发送成功'
message: '邮件发送成功'
});
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
loadingInstance.close();
});
} else {
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
loadingInstance.close();
});
}
}
},
checkAll (item) { // 全选当前显示的下载列表
item.list.forEach(file => file.checked = true);
item.checked_sum = item.list.filter(item => item.checked).length;
},
sendEmail (item) {
console.warn(item);
async sendEmail (item) {
if (!this.is_login) {
Message({
type: 'error',
message: '请先登录'
});
return;
}
let loadingInstance = Loading.service({ fullscreen: true, background: 'rgba(0, 0, 0, 0.3)' });
const { code, data } = await downEmailAPI();
if (code) {
await downZipAPI({ name: data.name, ids: [item.id] });
// 发送邮箱接口
Message({
type: 'success',
message: '发送成功'
message: '邮件发送成功'
});
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
loadingInstance.close();
});
} else {
this.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
loadingInstance.close();
});
}
},
preview (item) {
window.open(item.value, '_blank');
...
...
Please
register
or
login
to post a comment