index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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.id }}</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.department[index].position }}</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. console.log('userStore', userStore.user);
  79. })
  80. // 用户信息的响应式对象
  81. const userInfo = reactive({
  82. id: '123321',
  83. name: '张三',
  84. department: [{
  85. text: "研发部",
  86. position: '软件开发工程师'
  87. },
  88. {
  89. text: "业务部",
  90. position: '销售经理'
  91. },
  92. {
  93. text: '法务部',
  94. position: '法律顾问'
  95. }
  96. ],
  97. });
  98. // 部门数组
  99. const array = ref(['研发部', '业务部', '法务部']);
  100. const index = ref(0);
  101. // 部门切换事件
  102. function bindPickerChange(e) {
  103. index.value = e.detail.value; // 更新选择的部门索引
  104. };
  105. // 查看个人信息的函数
  106. function lookMsg() {
  107. $tab.navigateTo('/pages/mine/personal_message/personal_message?id=' + userInfo.id + '&name=' + userInfo.name);
  108. };
  109. // 编辑资料的函数
  110. function editData() {
  111. $tab.navigateTo('/pages/mine/edit/edit')
  112. };
  113. // 待办事项的函数
  114. function waitWork() {
  115. $tab.navigateTo('/pages/mine/waitWork/waitWork')
  116. }
  117. // 我的考勤的函数
  118. function checkIn() {
  119. $tab.navigateTo('/pages/mine/checkIn/checkIn')
  120. }
  121. // 应用设置的函数
  122. function setting() {
  123. $tab.navigateTo('/pages/mine/setting/setting')
  124. };
  125. // 打卡的函数
  126. function clockIn() {
  127. $tab.navigateTo('/pages/mine/clockIn/clockIn')
  128. };
  129. </script>
  130. <style lang="scss">
  131. @import "@/static/font/ygoa/iconfont.css";
  132. .ygoa-icon{
  133. margin-right: 20rpx;
  134. font-size: 50rpx;
  135. }
  136. .content {
  137. display: flex;
  138. flex-direction: column;
  139. }
  140. .user-info {
  141. display: flex;
  142. align-items: center;
  143. padding: 20rpx;
  144. border-bottom: 1rpx solid #ddd;
  145. }
  146. .avatar {
  147. width: 200rpx;
  148. height: 200rpx;
  149. border-radius: 50%;
  150. }
  151. .info-detail {
  152. flex-grow: 1;
  153. font-size: 28rpx;
  154. }
  155. .name {
  156. padding: 15rpx 0;
  157. }
  158. .function-list {
  159. margin-bottom: 60rpx;
  160. }
  161. .function-item {
  162. display: flex;
  163. align-items: center;
  164. justify-content: space-between;
  165. padding: 20rpx;
  166. background-color: #f5f5f5;
  167. border-radius: 10rpx;
  168. margin-bottom: 20rpx;
  169. border-bottom: 1px solid gainsboro;
  170. }
  171. .title {
  172. flex-grow: 1;
  173. font-size: 32rpx;
  174. }
  175. .desc {
  176. color: #999;
  177. margin-right: 20rpx;
  178. }
  179. .select1 {
  180. display: inline-block;
  181. width: 50%;
  182. margin-top: 10rpx;
  183. }
  184. .headImg {
  185. text-align: center;
  186. }
  187. //样式穿透
  188. ::v-deep .uni-list-cell-left {
  189. padding: 0 0;
  190. }
  191. ::v-deep .uni-list-cell::after {
  192. background-color: white;
  193. }
  194. ::v-deep .uni-input {
  195. padding: 15rpx 8rpx;
  196. text-decoration: underline; /* 给文字添加下划线 */
  197. text-decoration-color: blue;
  198. }
  199. ::v-deep .uni-list-cell-db picker{
  200. width: 100px;
  201. }
  202. </style>