123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <view class="content">
- <u-card :title="'总数(' + studentList.length + ')人'" title-size="32" margin="0px 0px 10px 0px" :head-style="cardStyle">
- <u-grid :col="3" slot="body" :border="false">
- <u-grid-item v-for="(item, index) in studentList" :key="index" :custom-style="gridCustomStyle">
- <u-avatar :src="item.url" mode="circle" size="128" :show-level="item.state == 1 || item.checked" level-icon="checkbox-mark"
- :level-bg-color="mainColor" v-if="item.hasHead == 1" @click="setSignCheck(item)"></u-avatar>
- <u-upload :custom-btn="true" :max-count="1" @on-success="uploadSuccess" @on-error="uploadError" v-else>
- <view slot="addBtn" class="slot-btn">
- <u-icon name="camera-fill" size="60" color="#999999"></u-icon>
- </view>
- </u-upload>
- <view class="grid-text">{{item.name}}</view>
- </u-grid-item>
- <u-grid-item :custom-style="gridCustomStyle" @click="goToSelectStudent">
- <view class="slot-btn">
- <u-icon name="plus" size="60" color="#999999"></u-icon>
- </view>
- </u-grid-item>
- </u-grid>
- </u-card>
- <view class="handle-fix-box">
- <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" :disabled="status != 0" @click="goToSignForm()">{{status == 1 ? '签到确认' : '今日已签到'}}</u-button>
- </view>
- <u-top-tips ref="uTips"></u-top-tips>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- computed: {
- ...mapGetters([
- 'mainColor',
- 'customStyle',
- ])
- },
- data() {
- return {
- classId: '',
- status: '',
- studentList: [{
- "hasHead": 1,
- "name": "即预约",
- "state": 0,
- "checked": false,
- "url": ""
- }, {
- "hasHead": 1,
- "name": "即预约",
- "state": 0,
- "checked": false,
- "url": ""
- }, {
- "hasHead": 1,
- "name": "即预约",
- "state": 1,
- "checked": false,
- "url": ""
- }, {
- "hasHead": 0,
- "name": "即预约",
- "state": 0,
- "checked": false,
- "url": ""
- }, {
- "hasHead": 1,
- "name": "即预约",
- "state": 1,
- "checked": false,
- "url": ""
- }, ],
- cardStyle: {
- fontWeight: 'bold'
- },
- gridCustomStyle: {
- padding: '0 2px'
- }
- }
- },
- onLoad(options) {
- this.classId = options.id
- this.status = options.status
- },
- onShow() {
- this.initialize()
- },
- methods: {
- // 获取初始化数据
- initialize() {
- NET.request(API.getSignStudentList, {
- id: this.classId
- }, 'POST').then(res => {
- res.data.forEach(site => site.checked = false)
- this.studentList = res.data.concat(uni.getStorageSync('extraLessonsUserList'))
- }).catch(error => {
- this.$refs.uTips.show({
- title: '获取本课程学员列表失败',
- type: 'warning',
- })
- })
- },
- // 文件上传成功回调
- uploadSuccess(res, index, lists, name) {
- this.$refs.uTips.show({
- title: '文件上传成功',
- type: 'success',
- })
- return true
- },
- // 文件上传失败回调
- uploadError(res, index, lists, name) {
- this.$refs.uTips.show({
- title: '文件上传失败',
- type: 'warning',
- })
- },
- // 设置是否签到
- setSignCheck(item) {
- if (this.status == 0) {
- item.checked = item.checked ? false : true
- }
- },
- // 跳转选择学生页面
- goToSelectStudent() {
- uni.navigateTo({
- url: '/pagesClass/signStudentList'
- });
- },
- // 跳转签到表单
- goToSignForm() {
- uni.navigateTo({
- url: '/pagesMember/signForm?id=' + this.classId
- });
- },
- },
- }
- </script>
- <style>
- page {
- width: 100%;
- height: 100%;
- position: relative;
- }
- </style>
- <style lang="scss" scoped>
- @import "@/static/css/themes.scss";
- .content {
- width: 100%;
- float: left;
- padding-bottom: 60px;
- /deep/.u-avatar__level {
- left: 50%;
- transform: translateX(-50%);
- bottom: -6px !important;
- }
- .grid-text {
- line-height: 18px;
- }
- .slot-btn {
- width: 128rpx;
- height: 128rpx;
- border-radius: 50%;
- border: 1px solid #999999;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- </style>
|