index.vue 6.3 KB

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