index.vue 5.8 KB

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