methods.js
1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-23 14:33:37
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-02 13:14:23
* @FilePath: /tswj/src/components/MuiVideo/methods.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { prodActionAPI } from '@/api/C/prod.js'
import { Toast } from 'vant';
export const goToDetail = ({ id, book_id, type, perf_id }, $router) => {
$router.push({
path: '/client/videoDetail',
query: {
prod_id: id,
book_id,
type, // 特殊标识,判断入口 为keepAlive使用
perf_id
}
});
}
export const setComment = ({ id, book_id }, $router) => {
$router.push({
path: '/client/videoDetail/comment',
query: {
prod_id: id,
book_id
}
});
}
export const prodAction = async (action_type, prod_id) => {
const { msg } = await prodActionAPI({ action_type, prod_id });
if (msg === `${action_type}-add-OK`) { // 动作操作成功
if (action_type === 'favor') {
Toast('收藏成功');
}
if (action_type === 'like') {
Toast('点赞成功');
}
} else { // 取消操作
if (action_type !== 'play') {
Toast('取消成功');
}
}
return true;
}