index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="content">
  3. <!-- 用户信息部分 -->
  4. <uni-card margin="0" spacing="0">
  5. <view class="headImg">
  6. <image
  7. :src="userStore.user.photo==''?config.baseUrlPre+config.defaultAvatarPath:config.baseUrlPre+userStore.user.photo"
  8. class="avatar" @click="toEditAvatar"></image>
  9. </view>
  10. <view class="user-info">
  11. <view class="info-detail">
  12. <view class="name">
  13. <text>姓名: {{ userStore.user.name}}</text>
  14. </view>
  15. <view>
  16. <text>ID: {{ userStore.user.useId }}</text>
  17. </view>
  18. <!-- 部门切换框 -->
  19. <view class="uni-list-cell">
  20. <view class="uni-list-cell-left">
  21. 部门:
  22. </view>
  23. <view class="uni-list-cell-db">
  24. <picker @change="bindPickerChange" :value="index" :range="deptNameArray">
  25. <view class="uni-input">{{deptNameArray[index]}}</view>
  26. </picker>
  27. </view>
  28. </view>
  29. <view>
  30. <text> 职务: {{ userStore.user.groupXUsers[index].posName ||'暂无'}}</text>
  31. </view>
  32. </view>
  33. <uni-icons @click="lookMsg()" type="forward" size="16" margin-left="10px"></uni-icons>
  34. </view>
  35. </uni-card>
  36. <uni-card margin="0" spacing="0" is-shadow="false">
  37. <!-- 功能按钮区 -->
  38. <view class="function-list">
  39. <view class="function-item" @click="editData">
  40. <text class="ygoa-icon icon-edit"></text>
  41. <text class="title">编辑资料</text>
  42. <text class="desc">></text>
  43. </view>
  44. <view class="function-item" @click="checkIn">
  45. <text class="ygoa-icon icon-checkIn"></text>
  46. <text class="title">我的考勤</text>
  47. <text class="desc">></text>
  48. </view>
  49. <view class="function-item" @click="clockIn">
  50. <text class="ygoa-icon icon-clockIn"></text>
  51. <text class="title">我的打卡</text>
  52. <text class="desc">></text>
  53. </view>
  54. <view class="function-item" @click="setting">
  55. <text class="ygoa-icon icon-setting"></text>
  56. <text class="title">应用设置</text>
  57. <text class="desc">></text>
  58. </view>
  59. </view>
  60. </uni-card>
  61. </view>
  62. </template>
  63. <script setup lang="ts">
  64. import { onMounted, ref } from 'vue';
  65. import $tab from "@/plugins/tab.js"
  66. import { useUserStore } from '@/store/user.js'
  67. import config from '@/config';
  68. import { onShow } from '@dcloudio/uni-app'
  69. const userStore = useUserStore()
  70. onShow(() => {
  71. uni.$emit('showTabBarBadge')
  72. })
  73. // 部门数组
  74. const deptNameArray = ref(['研发部', '业务部', '法务部']);
  75. const index = ref(0);
  76. onMounted(() => {
  77. initDeptArray();
  78. })
  79. //部门初始化
  80. function initDeptArray() {
  81. const groupXUsers = userStore.user.groupXUsers;
  82. // 使用map方法提取groupName
  83. deptNameArray.value = groupXUsers.map(groupXUser => groupXUser.groupName);
  84. }
  85. // 部门切换事件
  86. function bindPickerChange(e) {
  87. index.value = e.detail.value; // 更新选择的部门索引
  88. };
  89. // 查看个人信息的函数
  90. function lookMsg() {
  91. $tab.navigateTo('/pages/mine/personal_message/personal_message?id=' + userStore.user.useId + '&name=' + userStore.user.name);
  92. };
  93. // 编辑资料的函数
  94. function editData() {
  95. $tab.navigateTo('/pages/mine/edit/edit')
  96. };
  97. // 我的考勤的函数
  98. function checkIn() {
  99. $tab.navigateTo('/pages/mine/checkIn/checkIn')
  100. }
  101. // 应用设置的函数
  102. function setting() {
  103. $tab.navigateTo('/pages/mine/setting/setting')
  104. };
  105. // 打卡的函数
  106. function clockIn() {
  107. $tab.navigateTo('/pages/mine/clockIn/clockIn')
  108. };
  109. //头像修改页
  110. function toEditAvatar() {
  111. // $tab.navigateTo('/pages/mine/avatar/avatarTest/avatarTest')
  112. $tab.navigateTo('/pages/mine/avatar/avatar')
  113. }
  114. </script>
  115. <style lang="scss">
  116. @import "@/static/font/ygoa/iconfont.css";
  117. .ygoa-icon {
  118. margin-right: 0.625rem;
  119. font-size: 1.6rem;
  120. }
  121. .content {
  122. display: flex;
  123. flex-direction: column;
  124. }
  125. .user-info {
  126. display: flex;
  127. align-items: center;
  128. padding: 1rem 3rem;
  129. border-bottom: 1rpx solid #666;
  130. color: #777;
  131. }
  132. .avatar {
  133. width: 6.25rem;
  134. height: 6.25rem;
  135. border-radius: 50%;
  136. }
  137. .info-detail {
  138. flex-grow: 1;
  139. // text-align: center;
  140. }
  141. .name {
  142. padding: 0.5rem 0;
  143. color: #333;
  144. font-size: 1.1rem;
  145. }
  146. .function-list {
  147. margin-bottom: 2rem;
  148. }
  149. .function-item {
  150. display: flex;
  151. align-items: center;
  152. justify-content: space-between;
  153. padding: 0.75rem;
  154. background-color: #ffffff;
  155. border-radius: 10rpx;
  156. margin-bottom: 0.75rem;
  157. border-bottom: 1px solid gainsboro;
  158. }
  159. .title {
  160. flex-grow: 1;
  161. font-size: 1rem;
  162. }
  163. .desc {
  164. color: #777;
  165. margin-right: 0.5rem;
  166. }
  167. .select1 {
  168. display: inline-block;
  169. width: 50%;
  170. margin-top: 0.3rem;
  171. }
  172. .headImg {
  173. text-align: center;
  174. }
  175. //样式穿透
  176. ::v-deep .uni-list-cell {
  177. justify-content: left;
  178. }
  179. ::v-deep .uni-list-cell-left {
  180. padding: 0 0;
  181. font-size: 1.1rem;
  182. color: #333;
  183. flex: none;
  184. }
  185. ::v-deep .uni-list-cell::after {
  186. background-color: #f5f5f5;
  187. }
  188. ::v-deep .uni-input {
  189. padding: 0.5rem 0.25rem;
  190. text-decoration: underline;
  191. /* 给文字添加下划线 */
  192. color: blue;
  193. font-size: 1.1rem;
  194. background-color: #f5f5f5;
  195. overflow: hidden;
  196. /* 隐藏超出部分 */
  197. white-space: nowrap;
  198. /* 不换行 */
  199. text-overflow: ellipsis;
  200. /* 省略号 */
  201. max-width: 30vh;
  202. }
  203. ::v-deep .uni-list-cell-db,
  204. .uni-list-cell-right {
  205. flex: none;
  206. }
  207. ::v-deep .uni-card {
  208. background-color: #f5f5f5 !important;
  209. }
  210. ::v-deep .uni-card--shadow {
  211. box-shadow: none !important;
  212. }
  213. ::v-deep .uni-card--border {
  214. border: none !important;
  215. }
  216. </style>