<template> <view class="contianer"> <view class=""> </view> <view class="list" v-if="false"> <view @click="clickItem(item,index)" v-for="(item,index) in list" :key="index" class="list-item"> <view class="list-item-img"> <!-- <image v-if="item." style="width:72rpx;height: 72rpx;margin-right: 20rpx;" src="@/static/image/male.png" mode=""></image> --> <image style="width:72rpx;height: 72rpx;margin-right: 20rpx;" src="@/static/image/female.png" mode=""></image> <view class="list-item-name"> 我是 {{item.school.school_name}} {{item.role.title}} </view> </view> <view class="list-item-active"> <uni-icons v-if="active == item.id" style="color:rgba(5,204,161, 1) ;" type="checkmarkempty" size="24"></uni-icons> </view> </view> </view> </view> </template> <script> export default { data() { return { active: 0, list: [] } }, methods: { clickItem(item, index) { this.$api.sendRequest({ url: '/mobile/selectRole', data: { role_id: item.role_id, school_id: item.school.id, }, success: res => { console.log(res); this.active = item.id this.$store.commit('setInfo', item) this.$store.commit('setRoleInfo', res.data) let url = item.role.title == '维修人员' ? '/pages/fixedAssetsProcessed/fixedAssetsProcessed' : '/pages/homePage/homePage' uni.navigateTo({ url: url }) }, }) }, getUserList() { this.$api.sendRequest({ url: '/mobile/getRole', success: res => { this.list = res.data let info = res.data[0] this.$store.commit('setInfo', info) this.active = info.id } }) } }, mounted() { if(process.env.NODE_ENV === 'development'){ let data={ "id": 16, "admin_id": 0, "school_id": 1, "person_id": 16, "teacher_number": "", "teacher_name": "李墨", "sex": 0, "teacher_photo": "", "type": 0, "education": "大学本科", "degree": "文学学士学位", "course_id": 1, "teacher_phone": "15158468759", "teacher_email": "", "address": "", "batch_id": 7, "level": 1, "status": 0, "is_del": 0, "upload_total": 0, "download_total": 0, "created_at": "2023-09-26 17:22:56", "updated_at": null, "access_token": "a58d238956a13b9a818c0f6d9a35d487", "token": "f26618b059869f0bec57e8f16a3e15e0", "selfclass": { "id": 3, "school_id": 1, "grade_level": 2, "class_level": 3, "grade_id": 2, "dept_id": 673412163, "teacher_id": 16, "class_number": "", "class_no": "2023_2_3", "class_num": 3, "class_name": "二年级3班", "class_photo": "https://zhxy.obs.cn-hz1.ctyun.cn/zhxy/classroom/112053504953.jpg", "class_type": 1, "enrol_year": 2023, "sessions_year": 2022, "deduct": 9, "status": 0, "is_del": 0, "batch_id": 1, "created_at": "2023-09-26 14:48:58", "updated_at": null } } this.$store.commit("setTeacherInfo",data) uni.setStorageSync('token', "a1df03154b53637cab5c003e0a9f94c2") console.log(11111); uni.navigateTo({ url:'/pages/studentRanked/studentRanked' }) } } } </script> <style lang="scss" scoped> .contianer { padding: 48rpx; .list { width: 100%; } .list-item { height: 94rpx; width: 100%; border-radius: 10rpx; background-color: #fff; display: flex; align-items: center; justify-content: space-between; margin-bottom: 32rpx; box-shadow: -0.67px 0px 5px 0.67px rgba(46, 46, 46, 0.28); .list-item-img { margin-left: 32rpx; border-radius: 50%; display: flex; align-items: center; } .list-item-active { margin-right: 32rpx; } } } </style>