Browse Source

修改bug

dev
岳鹏龙 12 months ago
parent
commit
04520c1869
  1. 8
      src/api/login.ts
  2. 11
      src/api/votingElection.ts
  3. 26
      src/pages/login/login.vue
  4. 48
      src/pages/votingElection/index.vue

8
src/api/login.ts

@ -20,3 +20,11 @@ export function getAdminPhone() {
method: 'GET'
})
}
//用户签到
export function getSign(data: { meetId: string; openid: string }) {
return request.http({
url: '/api/sign',
method: 'GET',
data
})
}

11
src/api/votingElection.ts

@ -1,7 +1,7 @@
import { request } from '@/utils/http'
// 获取投票选举(正在进行)
export function getVoteprogress(id: number) {
export function getVoteprogress(id: string) {
return request.http({
url: '/api/vote_progress?meetId='+ id,
method: 'GET'
@ -33,3 +33,12 @@ export function getMember_mobile(data: any) {
data
})
}
// 判断用户是否签到
export function getIs_sign(data: any) {
return request.http({
url: '/api/is_sign',
method: 'GET',
data
})
}

26
src/pages/login/login.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { debounce } from 'feng-uniapp-exploit/utils/index'
import { getMobile } from '@/api/login'
import { getMobile, getSign } from '@/api/login'
import useUserStore from '@/store/user'
const userStore = useUserStore()
@ -57,19 +57,21 @@ const onGetPhoneNumber = debounce(async (e: phoneEvent) => {
}
})
const meetid = ref(0)
const meetid = ref('')
const onLoginSuccess = () => {
uni.showToast({
title: '登录成功',
icon: 'none',
success: () => {
setTimeout(() => {
userStore.showtoast = false
uni.reLaunch({ url: '/pages/votingElection/index?meetId='+ meetid.value })
}, 1000)
}
})
uni.showToast({
title: '登录成功',
icon: 'none',
success: () => {
setTimeout(() => {
userStore.showtoast = false
uni.reLaunch({ url: '/pages/votingElection/index?meetId='+ meetid.value })
}, 1000)
}
})
getSign({openid: userStore.openId, meetId: meetid.value})
}
onLoad((options: any) => {
console.log('扫码参数1:', options);

48
src/pages/votingElection/index.vue

@ -1,5 +1,5 @@
<script setup lang="ts">
import { getVoteprogress, voteMember, getMember_mobile } from '../../api/votingElection'
import { getVoteprogress, voteMember, getMember_mobile, getIs_sign } from '../../api/votingElection'
import useUserStore from '@/store/user'
import { isEmptyObject } from '@/utils/common'
@ -11,7 +11,7 @@ const reListRef = ref()
const xjList = ref<any>({})
const meetid = ref(0)
const meetid = ref('')
@ -19,28 +19,42 @@ onLoad((options: any) => {
console.log('扫码2:', options);
if(options.meetId){
meetid.value = options.meetId
let params = {
mobile: userStore.mobile,
openid: userStore.openId,
meetId: options.meetId
}
getMember_mobile(params)
// let params = {
// mobile: userStore.mobile,
// openid: userStore.openId,
// meetId: options.meetId
// }
// getMember_mobile(params)
}
})
const doSearch = (_formData: { page: number; limit: number }, onSuccess: Function) => {
setTimeout(()=> {
getVoteprogress(meetid.value).then((res) => {
const { data } = res as { data: { candidate: any[] } }
xjList.value = data || {}
onSuccess({
data: {
data: data.candidate || [],
total: (data.candidate || []).length
}
getVoteprogress(meetid.value).then((res) => {
const { data } = res as { data: { candidate: any[] } }
xjList.value = data || {}
onSuccess({
data: {
data: data.candidate || [],
total: (data.candidate || []).length
}
})
})
})
// getIs_sign({openid: userStore.openId, meetId: meetid.value}).then((res: any)=> {
// if(res.code === 0) {
// uni.showToast({
// title: '',
// icon: 'none',
// success: () => {
// setTimeout(() => {
// uni.reLaunch({ url: '/pages/login/login' })
// }, 500)
// }
// })
// } else {
// }
// })
},1000)
}

Loading…
Cancel
Save