|
@@ -2,7 +2,8 @@
|
|
|
<div>
|
|
<div>
|
|
|
<div class="headTitle">
|
|
<div class="headTitle">
|
|
|
<van-row>
|
|
<van-row>
|
|
|
- <van-col span="1.5" style="text-align: center;" @click="backHome"><van-icon name="wap-home-o"
|
|
|
|
|
|
|
+ <van-col span="1.5" style="text-align: center;" @click="backHome"><van-icon
|
|
|
|
|
+name="wap-home-o"
|
|
|
size="16px" /></van-col>
|
|
size="16px" /></van-col>
|
|
|
<van-col span="2.5" style="font-size: 16px;" @click="backHome">首页</van-col>
|
|
<van-col span="2.5" style="font-size: 16px;" @click="backHome">首页</van-col>
|
|
|
<van-col span="13" offset="7" style="font-size: 18px;">签到</van-col>
|
|
<van-col span="13" offset="7" style="font-size: 18px;">签到</van-col>
|
|
@@ -10,124 +11,126 @@
|
|
|
</div>
|
|
</div>
|
|
|
<!-- 签到信息 -->
|
|
<!-- 签到信息 -->
|
|
|
<div class="content">
|
|
<div class="content">
|
|
|
- <div class="contentNo" v-if="this.statusCode!==2">
|
|
|
|
|
|
|
+ <div v-if="statusCode!==2" class="contentNo">
|
|
|
{{statusCode==0?"已签到,请勿重复操作":statusCode==1?"未获取到相关签到信息":statusCode==3?"二维码已失效":statusCode==4?"错误二维码":""}}</div>
|
|
{{statusCode==0?"已签到,请勿重复操作":statusCode==1?"未获取到相关签到信息":statusCode==3?"二维码已失效":statusCode==4?"错误二维码":""}}</div>
|
|
|
- <div class="contentTitle" v-if="this.statusCode==2">签到信息</div>
|
|
|
|
|
- <div class="contentShow" v-if="this.statusCode==2">
|
|
|
|
|
- <van-row style="padding: 4% 5%;" v-for="(item,index) in qdInfo" :key="index">
|
|
|
|
|
|
|
+ <div v-if="statusCode==2" class="contentTitle">签到信息</div>
|
|
|
|
|
+ <div v-if="statusCode==2" class="contentShow">
|
|
|
|
|
+ <van-row v-for="(item,index) in qdInfo" :key="index" style="padding: 4% 5%;">
|
|
|
<van-col span="10" class="contentLeft">{{item.label}}</van-col>
|
|
<van-col span="10" class="contentLeft">{{item.label}}</van-col>
|
|
|
<van-col span="14" class="contentRight">{{item.value}}</van-col>
|
|
<van-col span="14" class="contentRight">{{item.value}}</van-col>
|
|
|
</van-row>
|
|
</van-row>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="footBtn"><van-button type="info" @click="interpositionQD()" :disabled="statusCode!==2">点击签到</van-button>
|
|
|
|
|
|
|
+ <div class="footBtn"><van-button type="info" :disabled="statusCode!==2" @click="interpositionQD()">点击签到</van-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
- import { mapState } from 'vuex'
|
|
|
|
|
- import Vue from 'vue';
|
|
|
|
|
- import { Toast } from 'vant'
|
|
|
|
|
- Vue.use(Toast)
|
|
|
|
|
- export default {
|
|
|
|
|
- data() {
|
|
|
|
|
- return {
|
|
|
|
|
- qdInfo: [],
|
|
|
|
|
- scanList: [],
|
|
|
|
|
- statusCode: 1,
|
|
|
|
|
- guanlianID: '',
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- created() {
|
|
|
|
|
- this.getQdInfo()
|
|
|
|
|
- },
|
|
|
|
|
- computed: {
|
|
|
|
|
- ...mapState('ibps/user', [
|
|
|
|
|
- 'info'
|
|
|
|
|
- ]),
|
|
|
|
|
- },
|
|
|
|
|
- methods: {
|
|
|
|
|
- getQdInfo() {
|
|
|
|
|
- // 扫描二维码传递过来的codeId
|
|
|
|
|
- // this.$route.query.codeId = '1244662627406184448'
|
|
|
|
|
- let sql = `select * from t_qrcodeb where id_='${this.$route.query.codeId}'`
|
|
|
|
|
- if (this.$route.query.codeId) {
|
|
|
|
|
- this.$common.request('sql', sql).then(res => {
|
|
|
|
|
- console.log("根据id查询得到的数据", res);
|
|
|
|
|
- let data = res.variables.data || []
|
|
|
|
|
- if (data.length > 0) {
|
|
|
|
|
- this.qdInfo = data[0].xiang_xi_xin_xi_ != '' ? JSON.parse(data[0].xiang_xi_xin_xi_) : 0
|
|
|
|
|
- this.scanList = data[0]
|
|
|
|
|
- if (data[0].zhuang_tai_ == '失效') {
|
|
|
|
|
- // 二维码失效
|
|
|
|
|
- this.statusCode = 3
|
|
|
|
|
- } else {
|
|
|
|
|
- this.getAlreadyQD()
|
|
|
|
|
- this.guanlianID = data[0].guan_lian_id_
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+import { mapState } from 'vuex'
|
|
|
|
|
+import Vue from 'vue'
|
|
|
|
|
+import { Toast } from 'vant'
|
|
|
|
|
+Vue.use(Toast)
|
|
|
|
|
+export default {
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ qdInfo: [],
|
|
|
|
|
+ scanList: [],
|
|
|
|
|
+ statusCode: 1,
|
|
|
|
|
+ guanlianID: '',
|
|
|
|
|
+ yeWuBiaoMing: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ ...mapState('ibps/user', [
|
|
|
|
|
+ 'info'
|
|
|
|
|
+ ])
|
|
|
|
|
+ },
|
|
|
|
|
+ created() {
|
|
|
|
|
+ this.getQdInfo()
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- // 错误二维码
|
|
|
|
|
- this.statusCode = 4
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- getAlreadyQD() {
|
|
|
|
|
- // t_qdxxb签到信息表
|
|
|
|
|
- let sql = `select * from t_qdxxb where er_wei_ma_id_='${this.$route.query.codeId}' and ren_yuan_id_ = '${this.info.employee.id}'`
|
|
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ getQdInfo() {
|
|
|
|
|
+ // 扫描二维码传递过来的codeId
|
|
|
|
|
+ // this.$route.query.codeId = '1244662627406184448'
|
|
|
|
|
+ const sql = `select * from t_qrcodeb where id_='${this.$route.query.codeId}'`
|
|
|
|
|
+ if (this.$route.query.codeId) {
|
|
|
this.$common.request('sql', sql).then(res => {
|
|
this.$common.request('sql', sql).then(res => {
|
|
|
- // console.log("根据this.$route.query.codeId和用户id查询数据库", res);
|
|
|
|
|
- let data = res.variables.data || []
|
|
|
|
|
|
|
+ console.log('根据id查询得到的数据', res)
|
|
|
|
|
+ const data = res.variables.data || []
|
|
|
if (data.length > 0) {
|
|
if (data.length > 0) {
|
|
|
- this.statusCode = 0
|
|
|
|
|
- } else {
|
|
|
|
|
- // 1.未获取到相关签到信息2.正常
|
|
|
|
|
- this.statusCode = this.qdInfo.length > 0 ? 2 : 1
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- // 点击签到相当于往数据库添加一条数据
|
|
|
|
|
- interpositionQD() {
|
|
|
|
|
- let ids = []
|
|
|
|
|
- let duixian = {}
|
|
|
|
|
- duixian["parent_id_"] = this.$route.query.codeId
|
|
|
|
|
- duixian["er_wei_ma_id_"] = this.$route.query.codeId
|
|
|
|
|
- duixian["qian_dao_shi_jian"] = this.getNow()
|
|
|
|
|
- duixian["ren_yuan_id_"] = this.info.employee.id
|
|
|
|
|
- duixian["guan_lian_id_"] = this.guanlianID
|
|
|
|
|
- ids.push(duixian)
|
|
|
|
|
- console.log("duixian", duixian);
|
|
|
|
|
- console.log("ids", ids);
|
|
|
|
|
- this.$common.request('add', '{"tableName":"t_qdxxb","paramWhere":' + JSON.stringify(ids) + '}').then(res => {
|
|
|
|
|
- // console.log("res点击签到往数据库添加一条数据", res);
|
|
|
|
|
- if (res.state == 200) {
|
|
|
|
|
- Toast.success('签到成功');
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.statusCode = 0
|
|
|
|
|
- }, 1500)
|
|
|
|
|
|
|
+ this.qdInfo = data[0].xiang_xi_xin_xi_ !== '' ? JSON.parse(data[0].xiang_xi_xin_xi_) : 0
|
|
|
|
|
+ this.scanList = data[0]
|
|
|
|
|
+ if (data[0].zhuang_tai_ === '失效') {
|
|
|
|
|
+ // 二维码失效
|
|
|
|
|
+ this.statusCode = 3
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.getAlreadyQD()
|
|
|
|
|
+ this.guanlianID = data[0].guan_lian_id_
|
|
|
|
|
+ this.yeWuBiaoMing = data[0].biao_ming_
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
})
|
|
})
|
|
|
- },
|
|
|
|
|
- // 获取当前时间
|
|
|
|
|
- getNow() {
|
|
|
|
|
- const now = new Date();
|
|
|
|
|
- const year = now.getFullYear();
|
|
|
|
|
- const month = ('0' + (now.getMonth() + 1)).slice(-2);
|
|
|
|
|
- const day = ('0' + now.getDate()).slice(-2);
|
|
|
|
|
- const hours = ('0' + now.getHours()).slice(-2);
|
|
|
|
|
- const minutes = ('0' + now.getMinutes()).slice(-2);
|
|
|
|
|
- const seconds = ('0' + now.getSeconds()).slice(-2);
|
|
|
|
|
- const formattedTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
|
|
|
|
|
- return formattedTime
|
|
|
|
|
- },
|
|
|
|
|
- // 返回首页
|
|
|
|
|
- backHome() {
|
|
|
|
|
- this.$router.push({ name: 'dashboard' });
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 错误二维码
|
|
|
|
|
+ this.statusCode = 4
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ getAlreadyQD() {
|
|
|
|
|
+ // t_qdxxb签到信息表
|
|
|
|
|
+ const sql = `select * from t_qdxxb where er_wei_ma_id_='${this.$route.query.codeId}' and ren_yuan_id_ = '${this.info.employee.id}'`
|
|
|
|
|
+ this.$common.request('sql', sql).then(res => {
|
|
|
|
|
+ // console.log("根据this.$route.query.codeId和用户id查询数据库", res);
|
|
|
|
|
+ const data = res.variables.data || []
|
|
|
|
|
+ if (data.length > 0) {
|
|
|
|
|
+ this.statusCode = 0
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 1.未获取到相关签到信息2.正常
|
|
|
|
|
+ this.statusCode = this.qdInfo.length > 0 ? 2 : 1
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ // 点击签到相当于往数据库添加一条数据
|
|
|
|
|
+ interpositionQD() {
|
|
|
|
|
+ const ids = []
|
|
|
|
|
+ const duixian = {}
|
|
|
|
|
+ duixian['parent_id_'] = this.$route.query.codeId
|
|
|
|
|
+ duixian['er_wei_ma_id_'] = this.$route.query.codeId
|
|
|
|
|
+ duixian['qian_dao_shi_jian'] = this.getNow()
|
|
|
|
|
+ duixian['ren_yuan_id_'] = this.info.employee.id
|
|
|
|
|
+ duixian['guan_lian_id_'] = this.guanlianID
|
|
|
|
|
+ duixian['ye_wu_biao_ming_'] = this.yeWuBiaoMing
|
|
|
|
|
+ ids.push(duixian)
|
|
|
|
|
+ console.log('duixian', duixian)
|
|
|
|
|
+ console.log('ids', ids)
|
|
|
|
|
+ this.$common.request('add', '{"tableName":"t_qdxxb","paramWhere":' + JSON.stringify(ids) + '}').then(res => {
|
|
|
|
|
+ // console.log("res点击签到往数据库添加一条数据", res);
|
|
|
|
|
+ if (res.state == 200) {
|
|
|
|
|
+ Toast.success('签到成功')
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.statusCode = 0
|
|
|
|
|
+ }, 1500)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取当前时间
|
|
|
|
|
+ getNow() {
|
|
|
|
|
+ const now = new Date()
|
|
|
|
|
+ const year = now.getFullYear()
|
|
|
|
|
+ const month = ('0' + (now.getMonth() + 1)).slice(-2)
|
|
|
|
|
+ const day = ('0' + now.getDate()).slice(-2)
|
|
|
|
|
+ const hours = ('0' + now.getHours()).slice(-2)
|
|
|
|
|
+ const minutes = ('0' + now.getMinutes()).slice(-2)
|
|
|
|
|
+ const seconds = ('0' + now.getSeconds()).slice(-2)
|
|
|
|
|
+ const formattedTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
|
|
|
|
|
+ return formattedTime
|
|
|
|
|
+ },
|
|
|
|
|
+ // 返回首页
|
|
|
|
|
+ backHome() {
|
|
|
|
|
+ this.$router.push({ name: 'dashboard' })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
.headTitle {
|
|
.headTitle {
|
|
@@ -180,4 +183,4 @@
|
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|