123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <template>
- <view>
- <view class="scan_code flexCC">
- <view class="title">扫码签到</view>
- <view class="intr">管理员用微信扫描报名凭证进行签到</view>
- <view class="btn flexC" @click="scanCode">
- <text class="iconfont iconsaoma" style="color:#fff;font-size:50rpx;margin-right:10rpx;"></text>
- <text>扫码签到</text>
- </view>
- </view>
- <view class="manual">
- <view class="title">验证码签到</view>
- <view class="intr">管理员输入报名验证码进行签到</view>
- <view class="inp flexB">
- <input type="text" placeholder="请输入报名验证码" v-model="code" />
- <view class="flexCC" @click="checkout">确认</view>
- </view>
- <view class="info" v-if="showInfo">
- <view>信息确认:</view>
- <view class="flexS">
- <text>报名人:</text>
- <view>{{ signInfo.nickname }}</view>
- </view>
- <view class="flexS">
- <text>手机号:</text>
- <view>{{ signInfo.phone }}</view>
- </view>
- <view class="flexS">
- <text>报名时间:</text>
- <view>{{ signInfo.created_at }}</view>
- </view>
- </view>
- <view class="btn flexC" @click="sureSign">
- <image src="../../static/imgs/signIn.png" mode=""></image>
- <text>确认签到</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { getUser, sureSign } from '../../api/sign_in.js';
- export default {
- data() {
- return {
- showInfo: false, //是否显示报名信息
- code: '', //验证码
- signInfo: '' //报名人信息
- };
- },
- methods: {
- /*扫码签到
- * @params id 扫描小程序码截取的id
- */
- scanCode() {
- uni.scanCode({
- success: res => {
- let str = res.path;
- let id = str.replace(/[^0-9]/gi, '');
- if (id) {
- //判断有没有签到权限
- getUser({ id }).then(res => {
- if (res.code != 200) {
- uni.showModal({
- content: res.message,
- showCancel: false
- });
- return false;
- }
- if (res.code == 200) {
- uni.navigateTo({
- url: '../sign_in_voucher/sign_in_voucher?id=' + id
- });
- }
- });
- }
- }
- });
- },
- /*获取用户信息
- *@params code 输入的签到验证码
- */
- checkout() {
- if (!this.code) {
- uni.showModal({
- content: '请先输入验证码',
- showCancel: false
- });
- return false;
- }
- getUser({ code: this.code }).then(res => {
- if (res.code != 200) {
- uni.showModal({
- content: res.message,
- showCancel: false
- });
- this.code = '';
- return false;
- }
- if (res.code == 200) {
- this.showInfo = true;
- this.signInfo = res.data;
- }
- });
- },
- /*确认签到
- *@params id 输入验证码获取的id
- */
- sureSign() {
- if (!this.code) {
- uni.showModal({
- content: '请先输入验证码',
- showCancel: false
- });
- return false;
- }
- if (!this.signInfo) {
- uni.showModal({
- content: '请先获取报名信息',
- showCancel: false
- });
- return false;
- }
- sureSign({ id: this.signInfo.id }).then(res => {
- if (res.code != 200) {
- uni.showModal({
- content: res.message || '请求失败',
- showCancel: false
- });
- return false;
- }
- if (res.code == 200) {
- let { nickname, created_at, phone, season, type } = this.signInfo;
- uni.showToast({
- title: '签到成功!',
- duration: 2000,
- success: res => {
- uni.navigateTo({
- url:
- '../written_off/written_off?nickname=' +
- nickname +
- '&phone=' +
- phone +
- '&created_at=' +
- created_at +
- '&path=' +
- 2 +
- '&season=' +
- season +
- '&type=' +
- type
- });
- }
- });
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- .manual,
- .scan_code {
- .title {
- font-size: 36rpx;
- color: #333;
- padding-top: 38rpx;
- }
- .intr {
- font-size: 26rpx;
- color: #666666;
- margin: 40rpx 0 23rpx 0;
- }
- .btn {
- width: 580rpx;
- margin: 0 auto;
- background-color: #ea4a41;
- height: 90rpx;
- border-radius: 45rpx;
- color: #fff;
- font-size: 32rpx;
- image {
- height: 42rpx;
- width: 42rpx;
- margin-right: 19rpx;
- }
- text {
- letter-spacing: 5rpx;
- }
- }
- }
- .scan_code {
- height: 300rpx;
- width: 100%;
- background-color: #fff;
- padding-bottom: 30rpx;
- }
- .manual {
- margin: 40rpx auto 0;
- background-color: #fff;
- padding-bottom: 30rpx;
- .title,
- .intr {
- text-align: center;
- }
- .btn {
- margin: 30rpx auto 0;
- }
- .inp {
- width: 690rpx;
- margin: 35rpx auto;
- border-radius: 6rpx;
- background-color: #f2f4f5;
- height: 105rpx;
- box-sizing: border-box;
- view {
- width: 128rpx;
- height: 64rpx;
- background-color: #ea4a41;
- border-radius: 32rpx;
- color: #fff;
- margin-right: 23rpx;
- letter-spacing: 3rpx;
- }
- input {
- width: 75%;
- height: 93%;
- margin-left: 48rpx;
- font-size: 36rpx;
- color: #333;
- }
- }
- .info {
- margin-left: 79rpx;
- font-size: 28rpx;
- > view {
- margin-top: 34rpx;
- }
- view {
- color: #333;
- }
- text {
- color: #666666;
- }
- }
- }
- </style>
|