home.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="contianer">
  3. <view class="">
  4. </view>
  5. <view class="list" v-if="false">
  6. <view @click="clickItem(item,index)" v-for="(item,index) in list" :key="index" class="list-item">
  7. <view class="list-item-img">
  8. <!-- <image v-if="item." style="width:72rpx;height: 72rpx;margin-right: 20rpx;" src="@/static/image/male.png" mode=""></image> -->
  9. <image style="width:72rpx;height: 72rpx;margin-right: 20rpx;" src="@/static/image/female.png"
  10. mode=""></image>
  11. <view class="list-item-name">
  12. 我是 {{item.school.school_name}} {{item.role.title}}
  13. </view>
  14. </view>
  15. <view class="list-item-active">
  16. <uni-icons v-if="active == item.id" style="color:rgba(5,204,161, 1) ;" type="checkmarkempty"
  17. size="24"></uni-icons>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. active: 0,
  28. list: []
  29. }
  30. },
  31. methods: {
  32. clickItem(item, index) {
  33. this.$api.sendRequest({
  34. url: '/mobile/selectRole',
  35. data: {
  36. role_id: item.role_id,
  37. school_id: item.school.id,
  38. },
  39. success: res => {
  40. console.log(res);
  41. this.active = item.id
  42. this.$store.commit('setInfo', item)
  43. this.$store.commit('setRoleInfo', res.data)
  44. let url = item.role.title == '维修人员' ?
  45. '/pages/fixedAssetsProcessed/fixedAssetsProcessed' :
  46. '/pages/homePage/homePage'
  47. uni.navigateTo({
  48. url: url
  49. })
  50. },
  51. })
  52. },
  53. getUserList() {
  54. this.$api.sendRequest({
  55. url: '/mobile/getRole',
  56. success: res => {
  57. this.list = res.data
  58. let info = res.data[0]
  59. this.$store.commit('setInfo', info)
  60. this.active = info.id
  61. }
  62. })
  63. }
  64. },
  65. mounted() {
  66. if(process.env.NODE_ENV === 'development'){
  67. let data={
  68. "id": 16,
  69. "admin_id": 0,
  70. "school_id": 1,
  71. "person_id": 16,
  72. "teacher_number": "",
  73. "teacher_name": "李墨",
  74. "sex": 0,
  75. "teacher_photo": "",
  76. "type": 0,
  77. "education": "大学本科",
  78. "degree": "文学学士学位",
  79. "course_id": 1,
  80. "teacher_phone": "15158468759",
  81. "teacher_email": "",
  82. "address": "",
  83. "batch_id": 7,
  84. "level": 1,
  85. "status": 0,
  86. "is_del": 0,
  87. "upload_total": 0,
  88. "download_total": 0,
  89. "created_at": "2023-09-26 17:22:56",
  90. "updated_at": null,
  91. "access_token": "a58d238956a13b9a818c0f6d9a35d487",
  92. "token": "f26618b059869f0bec57e8f16a3e15e0",
  93. "selfclass": {
  94. "id": 3,
  95. "school_id": 1,
  96. "grade_level": 2,
  97. "class_level": 3,
  98. "grade_id": 2,
  99. "dept_id": 673412163,
  100. "teacher_id": 16,
  101. "class_number": "",
  102. "class_no": "2023_2_3",
  103. "class_num": 3,
  104. "class_name": "二年级3班",
  105. "class_photo": "https://zhxy.obs.cn-hz1.ctyun.cn/zhxy/classroom/112053504953.jpg",
  106. "class_type": 1,
  107. "enrol_year": 2023,
  108. "sessions_year": 2022,
  109. "deduct": 9,
  110. "status": 0,
  111. "is_del": 0,
  112. "batch_id": 1,
  113. "created_at": "2023-09-26 14:48:58",
  114. "updated_at": null
  115. }
  116. }
  117. this.$store.commit("setTeacherInfo",data)
  118. uni.setStorageSync('token', "a1df03154b53637cab5c003e0a9f94c2")
  119. console.log(11111);
  120. uni.navigateTo({
  121. url:'/pages/studentRanked/studentRanked'
  122. })
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .contianer {
  129. padding: 48rpx;
  130. .list {
  131. width: 100%;
  132. }
  133. .list-item {
  134. height: 94rpx;
  135. width: 100%;
  136. border-radius: 10rpx;
  137. background-color: #fff;
  138. display: flex;
  139. align-items: center;
  140. justify-content: space-between;
  141. margin-bottom: 32rpx;
  142. box-shadow: -0.67px 0px 5px 0.67px rgba(46, 46, 46, 0.28);
  143. .list-item-img {
  144. margin-left: 32rpx;
  145. border-radius: 50%;
  146. display: flex;
  147. align-items: center;
  148. }
  149. .list-item-active {
  150. margin-right: 32rpx;
  151. }
  152. }
  153. }
  154. </style>