index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view class="content">
  3. <!-- 用户信息部分 -->
  4. <uni-card margin="0" spacing="0">
  5. <view class="headImg">
  6. <image :src="headImg" class="avatar"></image>
  7. </view>
  8. <view class="user-info">
  9. <view class="info-detail">
  10. <view class="name">
  11. <text>姓名: {{ userInfo.name}}</text>
  12. </view>
  13. <view>
  14. <text>ID: {{ userInfo.useId }}</text>
  15. </view>
  16. <!-- 部门切换框 -->
  17. <view class="uni-list-cell">
  18. <view class="uni-list-cell-left">
  19. 部门:
  20. </view>
  21. <view class="uni-list-cell-db">
  22. <picker @change="bindPickerChange" :value="index" :range="array">
  23. <view class="uni-input">{{array[index]}}</view>
  24. </picker>
  25. </view>
  26. </view>
  27. <view>
  28. <text> 职务: {{ userInfo.positionName }}</text>
  29. </view>
  30. </view>
  31. <uni-icons @click="lookMsg()" type="forward" size="50" style="margin-right: 30rpx;"></uni-icons>
  32. </view>
  33. </uni-card>
  34. <uni-card margin="0" spacing="0">
  35. <!-- 功能按钮区 -->
  36. <view class="function-list">
  37. <view class="function-item" @click="editData">
  38. <text class="ygoa-icon icon-edit"></text>
  39. <text class="title">编辑资料</text>
  40. <text class="desc">></text>
  41. </view>
  42. <view class="function-item" @click="waitWork">
  43. <text class="ygoa-icon icon-waitWork"></text>
  44. <text class="title">待办事项</text>
  45. <text class="desc">></text>
  46. </view>
  47. <view class="function-item" @click="checkIn">
  48. <text class="ygoa-icon icon-checkIn"></text>
  49. <text class="title">我的考勤</text>
  50. <text class="desc">></text>
  51. </view>
  52. <view class="function-item" @click="setting">
  53. <text class="ygoa-icon icon-setting"></text>
  54. <text class="title">应用设置</text>
  55. <text class="desc">></text>
  56. </view>
  57. <view class="function-item" @click="clockIn">
  58. <text class="ygoa-icon icon-clockIn"></text>
  59. <text class="title">我的打卡</text>
  60. <text class="desc">></text>
  61. </view>
  62. </view>
  63. </uni-card>
  64. </view>
  65. </template>
  66. <script setup>
  67. import {
  68. ref,
  69. reactive,
  70. onMounted
  71. } from 'vue';
  72. import headImg from "@/static/images/mine/headImg.jpg"
  73. import $tab from "@/plugins/tab.js"
  74. import { useUserStore } from '@/store/user.js'
  75. const userStore = useUserStore()
  76. const userInfo = ref({})
  77. onMounted(() => {
  78. userInfo.value = userStore.user
  79. // console.log('userStore', userStore.user);
  80. })
  81. // 部门数组
  82. const array = ref(['研发部', '业务部', '法务部']);
  83. const index = ref(0);
  84. // 部门切换事件
  85. function bindPickerChange(e) {
  86. index.value = e.detail.value; // 更新选择的部门索引
  87. };
  88. // 查看个人信息的函数
  89. function lookMsg() {
  90. $tab.navigateTo('/pages/mine/personal_message/personal_message?id=' + userInfo.useId + '&name=' + userInfo.name);
  91. };
  92. // 编辑资料的函数
  93. function editData() {
  94. $tab.navigateTo('/pages/mine/edit/edit')
  95. };
  96. // 待办事项的函数
  97. function waitWork() {
  98. $tab.navigateTo('/pages/mine/waitWork/waitWork')
  99. }
  100. // 我的考勤的函数
  101. function checkIn() {
  102. $tab.navigateTo('/pages/mine/checkIn/checkIn')
  103. }
  104. // 应用设置的函数
  105. function setting() {
  106. $tab.navigateTo('/pages/mine/setting/setting')
  107. };
  108. // 打卡的函数
  109. function clockIn() {
  110. $tab.navigateTo('/pages/mine/clockIn/clockIn')
  111. };
  112. </script>
  113. <style lang="scss">
  114. @import "@/static/font/ygoa/iconfont.css";
  115. .ygoa-icon{
  116. margin-right: 20rpx;
  117. font-size: 50rpx;
  118. }
  119. .content {
  120. display: flex;
  121. flex-direction: column;
  122. }
  123. .user-info {
  124. display: flex;
  125. align-items: center;
  126. padding: 20rpx;
  127. border-bottom: 1rpx solid #ddd;
  128. }
  129. .avatar {
  130. width: 200rpx;
  131. height: 200rpx;
  132. border-radius: 50%;
  133. }
  134. .info-detail {
  135. flex-grow: 1;
  136. font-size: 28rpx;
  137. }
  138. .name {
  139. padding: 15rpx 0;
  140. }
  141. .function-list {
  142. margin-bottom: 60rpx;
  143. }
  144. .function-item {
  145. display: flex;
  146. align-items: center;
  147. justify-content: space-between;
  148. padding: 20rpx;
  149. background-color: #f5f5f5;
  150. border-radius: 10rpx;
  151. margin-bottom: 20rpx;
  152. border-bottom: 1px solid gainsboro;
  153. }
  154. .title {
  155. flex-grow: 1;
  156. font-size: 32rpx;
  157. }
  158. .desc {
  159. color: #999;
  160. margin-right: 20rpx;
  161. }
  162. .select1 {
  163. display: inline-block;
  164. width: 50%;
  165. margin-top: 10rpx;
  166. }
  167. .headImg {
  168. text-align: center;
  169. }
  170. //样式穿透
  171. ::v-deep .uni-list-cell-left {
  172. padding: 0 0;
  173. }
  174. ::v-deep .uni-list-cell::after {
  175. background-color: white;
  176. }
  177. ::v-deep .uni-input {
  178. padding: 15rpx 8rpx;
  179. text-decoration: underline; /* 给文字添加下划线 */
  180. text-decoration-color: blue;
  181. }
  182. ::v-deep .uni-list-cell-db picker{
  183. width: 100px;
  184. }
  185. </style>