266 lines
10 KiB
HTML
266 lines
10 KiB
HTML
<!--#
|
|
layout("/mobile/platform.html"){
|
|
#-->
|
|
<script src="${base!}/assets/platform/js/html5-qrcode.min.js"></script>
|
|
<style>
|
|
.auditTips {
|
|
font-size: 15px;
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
|
|
<div id="app">
|
|
<van-sticky>
|
|
<van-nav-bar title="扫描二维码"
|
|
@click-left="history.back()"
|
|
left-arrow
|
|
></van-nav-bar>
|
|
</van-sticky>
|
|
<div id="reader" width="100%"></div>
|
|
<van-popup v-model="vanShow" round position="bottom" :style="{ height: '70%' } " closeable>
|
|
<van-cell-group>
|
|
<div style="margin-top: 50px;text-align: center;font-size: 20px"></div>
|
|
<van-cell title="工号" :value="user.loginname"></van-cell>
|
|
<van-cell title="姓名" :value="user.username"></van-cell>
|
|
<van-cell title="单位" :value="user.unitname"></van-cell>
|
|
<van-cell title="工会" :value="user.unionname"></van-cell>
|
|
<van-field label="会议名称" v-model="meetingName" input-align="right" readonly required
|
|
:rules="[{ required:true, message: '请选择会议名称' }]"
|
|
@click="openMeeting"
|
|
placeholder="请选择会议名称"></van-field>
|
|
<van-action-sheet
|
|
v-model="meetingShow"
|
|
:actions="meetingActions"
|
|
cancel-text="取消"
|
|
close-on-click-action
|
|
@select="onSelect"
|
|
></van-action-sheet>
|
|
<van-field label="会议时间" v-model="meetingTimePeriodName" input-align="right" readonly
|
|
required
|
|
:rules="[{ required:true, message: '请选择会议时间' }]"
|
|
@click="meetingTimePeriodShow = true"
|
|
placeholder="请选择会议时间"></van-field>
|
|
<van-action-sheet
|
|
v-model="meetingTimePeriodShow"
|
|
:actions="meetingTimePeriodActions"
|
|
cancel-text="取消"
|
|
close-on-click-action
|
|
@select="onSelectMeetingTimePeriod"
|
|
></van-action-sheet>
|
|
<div style="display: flex;justify-content: space-around;padding: 5px 0 20px 0;">
|
|
<!-- <van-button plain style="flex: 1;margin: 0 10px 0 10px" @click="">
|
|
总报名{{action.register_users.length}}
|
|
</van-button>
|
|
<van-button style="flex: 1;margin: 0 10px 0 10px" @click="">
|
|
已扫人数{{action.register_users.filter(v=>v.is_scaned).length}}
|
|
</van-button>
|
|
<van-button style="flex: 1;margin: 0 10px 0 10px" @click="">
|
|
通过人数{{action.register_users.filter(v=>v.is_scaned&&v.is_allowed).length}}
|
|
</van-button>-->
|
|
</div>
|
|
|
|
<div v-if="isJoin!=null">
|
|
<div v-if="isJoin" class="auditTips">
|
|
您已确认无需再同意
|
|
</div>
|
|
<div v-if="!isJoin" class="auditTips">
|
|
该用户已请假无需确认
|
|
</div>
|
|
</div>
|
|
|
|
<div style="display: flex;justify-content: space-around;padding: 5px 0 20px 0;" v-else>
|
|
<van-button type="info" style="flex: 1;margin: 0 10px 0 10px"
|
|
@click="doAudit(true)">确认
|
|
</van-button>
|
|
</div>
|
|
|
|
</van-cell-group>
|
|
</van-popup>
|
|
|
|
</div>
|
|
<script>
|
|
let vm = new Vue({
|
|
el: '#app',
|
|
data() {
|
|
return {
|
|
isJoin: null,
|
|
meetingTimePeriodActions: [],
|
|
meetingTimePeriodShow: false,
|
|
meetingActions: [],
|
|
meetingShow: false,
|
|
meetingName: '',
|
|
meetingId: '',
|
|
meetingTimePeriodId: '',
|
|
meetingTimePeriodName: '',
|
|
user: {},
|
|
action: {},
|
|
meetingList: {},
|
|
vanShow: false,
|
|
userId: null,
|
|
is_allowed: false,
|
|
is_scaned: false,
|
|
}
|
|
},
|
|
methods: {
|
|
//查询用户是否请假或者已确定
|
|
async getMeetingUser(meetingId, meetingTimePeriodId, userId) {
|
|
if (meetingId || this.isJoin == null) {
|
|
const resp = await $.post("/mobile/sm/getMeetingUser", {
|
|
meetingId,
|
|
meetingTimePeriodId,
|
|
userId
|
|
})
|
|
if (resp.code === 0 && resp.data) {
|
|
this.isJoin = resp.data.isJoin
|
|
} else {
|
|
this.isJoin = null
|
|
}
|
|
}
|
|
|
|
},
|
|
onSelectMeetingTimePeriod(val) {
|
|
this.meetingTimePeriodName = val.name
|
|
this.meetingTimePeriodId = val.id
|
|
this.getMeetingUser(this.meetingId, this.meetingTimePeriodId, this.userId)
|
|
},
|
|
onSelect(val) {
|
|
this.meetingName = val.name
|
|
this.meetingId = val.id
|
|
this.meetingTimePeriodName = null
|
|
this.meetingTimePeriodId = null
|
|
this.meetingTimePeriodActions = []
|
|
const meeting = this.meetingList.find(v => v.id === val.id)
|
|
meeting.timePeriods.forEach(v => {
|
|
this.meetingTimePeriodActions.push({name: v.startTime, id: v.id})
|
|
})
|
|
},
|
|
async openMeeting() {
|
|
this.meetingActions = []
|
|
this.meetingList = []
|
|
const refs = await $.post("/platform/meeting/online/pageData", {
|
|
year: moment().format('YYYY'),
|
|
pageNumber: 1,
|
|
pageSize: 10
|
|
})
|
|
if (refs.code === 0) {
|
|
this.meetingList = refs.data.list
|
|
refs.data.list.forEach(v => {
|
|
this.meetingActions.push({name: v.meetingName, id: v.id})
|
|
})
|
|
}
|
|
this.meetingShow = true
|
|
},
|
|
getCameras() {
|
|
Html5Qrcode.getCameras()
|
|
.then((devices) => {
|
|
/**
|
|
* devices would be an array of objects of type:
|
|
* { id: "id", label: "label" }
|
|
*/
|
|
if (devices && devices.length) {
|
|
// 如果有2个摄像头,1为前置的
|
|
if (devices.length > 1) {
|
|
this.cameraId = devices[1].id;
|
|
} else {
|
|
this.cameraId = devices[0].id;
|
|
}
|
|
this.devices = devices;
|
|
this.start();
|
|
// .. use this to start scanning.
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
// handle err
|
|
console.log(err); // 获取设备信息失败
|
|
});
|
|
},
|
|
start() {
|
|
const html5QrCode = new Html5Qrcode("reader");
|
|
html5QrCode
|
|
.start(
|
|
this.cameraId, // retreived in the previous step.
|
|
{
|
|
fps: 100, // sets the framerate to 10 frame per second
|
|
qrbox: {width: 1000, height: 1000}, // sets only 250 X 250 region of viewfinder to
|
|
},
|
|
(decodedText, decodedResult) => {
|
|
this.getFindSmxx(decodedText)
|
|
},
|
|
(errorMessage) => {
|
|
console.log(errorMessage);
|
|
}
|
|
)
|
|
.catch((err) => {
|
|
alert(err)
|
|
console.log(`Unable to start scanning, error: ` + err);
|
|
});
|
|
},
|
|
stop() {
|
|
this.html5QrCode
|
|
.stop()
|
|
.then((ignore) => {
|
|
alert("3")
|
|
console.log("QR Code scanning stopped.");
|
|
})
|
|
.catch((err) => {
|
|
alert("4")
|
|
console.log("Unable to stop scanning.");
|
|
});
|
|
},
|
|
async getFindSmxx(decodedText) {
|
|
const {userId} = JSON.parse(decodedText)
|
|
const refs = await $.post("/mobile/sm/findSmxx", {userId})
|
|
if (refs.code === 0) {
|
|
this.user = refs.data.user
|
|
this.userId = userId
|
|
this.vanShow = true
|
|
await this.getMeetingUser(this.meetingId, this.meetingTimePeriodId, userId)
|
|
} else {
|
|
vant.Toast.fail('查询失败');
|
|
}
|
|
|
|
|
|
},
|
|
doAudit(flag) {
|
|
const res = flag === true ? '同意' : '拒绝'
|
|
vant.Dialog.confirm({
|
|
title: '提示',
|
|
message: '是否确定',
|
|
}).then(async () => {
|
|
const loading = this.$toast({
|
|
duration: 0,
|
|
message: '提交中...',
|
|
forbidClick: true,
|
|
loadingType: 'spinner',
|
|
type: 'loading',
|
|
overlay: true
|
|
});
|
|
const resp = await $.post("/mobile/sm/doAudit", {
|
|
meetingId: this.meetingId,
|
|
meetingTimePeriodId: this.meetingTimePeriodId,
|
|
userId: this.userId,
|
|
flag: flag
|
|
})
|
|
loading.type = 'success'
|
|
loading.message = '提交成功'
|
|
loading.close()
|
|
this.vanShow = false
|
|
if (resp.code == 0) {
|
|
loading.type = 'success'
|
|
loading.message = '提交成功'
|
|
}
|
|
})
|
|
},
|
|
|
|
},
|
|
async created() {
|
|
this.getCameras()
|
|
}
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
<!--#
|
|
}
|
|
#--> |