index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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)" 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 v-if="config.companyCode !== 'yz'" 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. <!-- 根据companyCode显示我的工资 -->
  56. <view v-if="config.companyCode === 'yz'" class="function-item" @click="mySalary">
  57. <text class="ygoa_icon icon-calculator"></text>
  58. <text class="title">我的工资</text>
  59. <text class="desc"></text>
  60. </view>
  61. <view class="function-item" @click="myTrain">
  62. <text class="ygoa_icon icon-diary"></text>
  63. <text class="title">我的培训</text>
  64. <text class="desc"></text>
  65. </view>
  66. <view class="function-item" @click="setting">
  67. <text class="ygoa_icon icon-setting"></text>
  68. <text class="title">应用设置</text>
  69. <text class="desc"></text>
  70. </view>
  71. </view>
  72. </uni-card>
  73. </view>
  74. </template>
  75. <script setup lang="ts">
  76. import { onMounted, ref } from 'vue';
  77. import $tab from "@/plugins/tab.js"
  78. import { useUserStore } from '@/store/user.js'
  79. import config from '@/config';
  80. import { onShow } from '@dcloudio/uni-app'
  81. const userStore = useUserStore()
  82. onShow(() => {
  83. uni.$emit('showTabBarBadge')
  84. })
  85. // 部门数组
  86. const deptNameArray = ref(['研发部', '业务部', '法务部']);
  87. const index = ref(0);
  88. onMounted(() => {
  89. initDeptArray();
  90. })
  91. //部门初始化
  92. function initDeptArray() {
  93. const groupXUsers = userStore.user.groupXUsers;
  94. // 使用map方法提取groupName
  95. deptNameArray.value = groupXUsers.map(groupXUser => groupXUser.groupName) || ['无数据'];
  96. }
  97. // 部门切换事件
  98. function bindPickerChange(e) {
  99. index.value = e.detail.value; // 更新选择的部门索引
  100. };
  101. // 查看个人信息的函数
  102. function lookMsg() {
  103. $tab.navigateTo('/pages/mine/personal_message/personal_message?id=' + userStore.user.useId + '&name=' + userStore.user.name);
  104. };
  105. // 编辑资料的函数
  106. function editData() {
  107. $tab.navigateTo('/pages/mine/edit/edit')
  108. };
  109. // 我的考勤的函数
  110. function checkIn() {
  111. $tab.navigateTo('/pages/mine/checkIn/checkIn')
  112. }
  113. // 应用设置的函数
  114. function setting() {
  115. $tab.navigateTo('/pages/mine/setting/setting')
  116. };
  117. // 打卡的函数
  118. function clockIn() {
  119. $tab.navigateTo('/pages/mine/clockIn/clockIn')
  120. };
  121. // 我的工资的函数
  122. function mySalary() {
  123. $tab.navigateTo('/pages/mine/salary/salaryList')
  124. }
  125. // 我的培训的函数
  126. function myTrain() {
  127. $tab.navigateTo('/pages/mine/train/trainList')
  128. }
  129. //头像修改页
  130. function toEditAvatar() {
  131. // $tab.navigateTo('/pages/mine/avatar/avatarTest/avatarTest')
  132. $tab.navigateTo('/pages/mine/avatar/avatar')
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. // @import "@/static/font/ygoa/iconfont.css";
  137. .ygoa_icon {
  138. margin-right: calc(10px + .5*(1rem - 16px)) !important;
  139. font-size: calc(1.6rem + 0px) !important;
  140. }
  141. .content {
  142. display: flex;
  143. flex-direction: column;
  144. }
  145. .user-info {
  146. display: flex;
  147. align-items: center;
  148. padding: 16px 48px;
  149. border-bottom: 1rpx solid #666;
  150. color: #777;
  151. ::v-deep .uni-icons {
  152. font-size: calc(1rem + 0px) !important;
  153. }
  154. }
  155. .avatar {
  156. width: calc(6.25rem + 0px) !important;
  157. height: calc(6.25rem + 0px) !important;
  158. border-radius: 50%;
  159. }
  160. .info-detail {
  161. flex-grow: 1;
  162. // text-align: center;
  163. .name {
  164. padding: 0.5rem 0;
  165. color: #333;
  166. font-size: calc(1.1rem + 0px) !important;
  167. }
  168. .desc {
  169. font-size: calc(0.875rem + 0px) !important;
  170. }
  171. }
  172. .function-list {
  173. margin-bottom: calc(16px + .5*(1rem - 16px)) !important;
  174. }
  175. .function-item {
  176. display: flex;
  177. align-items: center;
  178. justify-content: space-between;
  179. padding: calc(12px + .5*(1rem - 16px)) !important;
  180. background-color: #ffffff;
  181. border-radius: 10rpx;
  182. margin-bottom: 0.75rem;
  183. border-bottom: 1px solid gainsboro;
  184. }
  185. .title {
  186. flex-grow: 1;
  187. font-size: calc(1rem + 0px) !important;
  188. }
  189. .desc {
  190. color: #777;
  191. margin-right: 0.5rem;
  192. }
  193. .desc::after {
  194. content: ">";
  195. }
  196. .select1 {
  197. display: inline-block;
  198. width: 50%;
  199. margin-top: 0.3rem;
  200. }
  201. .headImg {
  202. text-align: center;
  203. }
  204. //样式穿透
  205. ::v-deep .uni-list-cell {
  206. justify-content: left;
  207. }
  208. ::v-deep .uni-list-cell-left {
  209. padding: 0 0;
  210. font-size: calc(1.1rem + 0px) !important;
  211. color: #333;
  212. flex: none;
  213. }
  214. ::v-deep .uni-list-cell::after {
  215. background-color: #f5f5f5;
  216. }
  217. ::v-deep .uni-input {
  218. padding: 0.5rem 0.25rem;
  219. text-decoration: underline;
  220. /* 给文字添加下划线 */
  221. color: blue;
  222. font-size: calc(1.1rem + 0px) !important;
  223. background-color: #f5f5f5;
  224. overflow: hidden;
  225. /* 隐藏超出部分 */
  226. white-space: nowrap;
  227. /* 不换行 */
  228. text-overflow: ellipsis;
  229. /* 省略号 */
  230. max-width: 30vh;
  231. }
  232. ::v-deep .uni-list-cell-db,
  233. .uni-list-cell-right {
  234. flex: none;
  235. }
  236. ::v-deep .uni-card {
  237. background-color: #f5f5f5 !important;
  238. }
  239. ::v-deep .uni-card--shadow {
  240. box-shadow: none !important;
  241. }
  242. ::v-deep .uni-card--border {
  243. border: none !important;
  244. }
  245. </style>