1234567891011121314151617181920212223242526272829303132333435 |
- import { title } from 'radash'
- import { cancelCircleReviewUpvote, cancelCircleUpvote, createCircleUpvote } from './requests'
- const toast = (title: string) => uni.showToast({ title, icon: 'none' })
- export const handleUpvoteClick = async (
- {
- upvote,
- circleId,
- userId,
- userName,
- }: {
- upvote: boolean
- circleId: number
- userId: number
- userName: string
- },
- callback?: () => void,
- ) => {
- if (!upvote) {
- const { code, msg } = await createCircleUpvote({ circleId, userId, userName })
- code === 0 && toast('点赞成功')
- } else {
- const { code } = await cancelCircleUpvote({ id: circleId.toString() })
- code === 0 && toast('取消点赞成功')
- }
- callback && callback()
- }
- export const toHomePage = (id: string) => {
- uni.navigateToMiniProgram({
- appId: 'wx4d95c9addba81089',
- envVersion: 'trial',
- path: '/pages/mine/homepage/index' + '?id=' + id,
- })
- }
|