index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="content">
  3. <!-- 用户信息部分 -->
  4. <uni-card margin="0" spacing="0">
  5. <view class="headImg">
  6. <image :src="headImg" class="avatar" @click="toEditAvatar"></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.useId }}</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.positionName ||'暂无'}}</text>
  29. </view>
  30. </view>
  31. <uni-icons @click="lookMsg()" type="forward" size="16" style="margin-right: 30rpx;"></uni-icons>
  32. </view>
  33. </uni-card>
  34. <uni-card margin="0" spacing="0" is-shadow="false">
  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="clockIn">
  53. <text class="ygoa-icon icon-clockIn"></text>
  54. <text class="title">我的打卡</text>
  55. <text class="desc">></text>
  56. </view>
  57. <view class="function-item" @click="setting">
  58. <text class="ygoa-icon icon-setting"></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 lang="ts">
  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 { getUnReadMessageNum } from '@/api/message';
  75. import { getUnProcessNum } from '@/api/process';
  76. import {
  77. useUserStore
  78. } from '@/store/user.js'
  79. const userStore = useUserStore()
  80. const userInfo = ref({})
  81. onMounted(() => {
  82. userInfo.value = userStore.user
  83. showTarBarBadge();
  84. })
  85. function showTarBarBadge(){
  86. let unReadMsgNum=0;
  87. let unProcessNum=0;
  88. getUnProcessNum(userStore.user.useId,"").then(res=>{
  89. unProcessNum=parseInt(res.returnParams.total, 10);
  90. // console.log('unProcessNum',res.returnParams.total);
  91. // if(unProcessNum==0){
  92. // uni.removeTabBarBadge({
  93. // index:1
  94. // })
  95. // }else{
  96. // uni.setTabBarBadge({
  97. // index: 1,
  98. // text: String(unProcessNum)
  99. // })
  100. // }
  101. getUnReadMessageNum(userStore.user.useId).then(res=>{
  102. unReadMsgNum=parseInt(res.returnParams, 10)+unProcessNum;
  103. if(unReadMsgNum==0){
  104. uni.removeTabBarBadge({
  105. index:0
  106. })
  107. }else{
  108. uni.setTabBarBadge({
  109. index: 0,
  110. text: unReadMsgNum>99?'99+':String(unReadMsgNum)
  111. })
  112. }
  113. })
  114. })
  115. }
  116. // 部门数组
  117. const array = ref(['研发部', '业务部', '法务部']);
  118. const index = ref(0);
  119. // 部门切换事件
  120. function bindPickerChange(e) {
  121. index.value = e.detail.value; // 更新选择的部门索引
  122. };
  123. // 查看个人信息的函数
  124. function lookMsg() {
  125. $tab.navigateTo('/pages/mine/personal_message/personal_message?id=' + userInfo.useId + '&name=' + userInfo.name);
  126. };
  127. // 编辑资料的函数
  128. function editData() {
  129. $tab.navigateTo('/pages/mine/edit/edit')
  130. };
  131. // 待办事项的函数
  132. // function waitWork() {
  133. // $tab.navigateTo('/pages/mine/waitWork/waitWork')
  134. // }
  135. // 我的考勤的函数
  136. function checkIn() {
  137. $tab.navigateTo('/pages/mine/checkIn/checkIn')
  138. }
  139. // 应用设置的函数
  140. function setting() {
  141. $tab.navigateTo('/pages/mine/setting/setting')
  142. };
  143. // 打卡的函数
  144. function clockIn() {
  145. $tab.navigateTo('/pages/mine/clockIn/clockIn')
  146. };
  147. function toEditAvatar(){
  148. $tab.navigateTo('/pages/mine/avatar/avatar')
  149. }
  150. </script>
  151. <style lang="scss">
  152. @import "@/static/font/ygoa/iconfont.css";
  153. .ygoa-icon {
  154. margin-right: 0.625rem;
  155. font-size: 1.6rem;
  156. }
  157. .content {
  158. display: flex;
  159. flex-direction: column;
  160. }
  161. .user-info {
  162. display: flex;
  163. align-items: center;
  164. padding: 1rem 4rem;
  165. border-bottom: 1rpx solid #666;
  166. color: #777;
  167. }
  168. .avatar {
  169. width: 6.25rem;
  170. height: 6.25rem;
  171. border-radius: 50%;
  172. }
  173. .info-detail {
  174. flex-grow: 1;
  175. // text-align: center;
  176. }
  177. .name {
  178. padding: 0.5rem 0;
  179. color: #333;
  180. font-size: 1.1rem;
  181. }
  182. .function-list {
  183. margin-bottom: 2rem;
  184. }
  185. .function-item {
  186. display: flex;
  187. align-items: center;
  188. justify-content: space-between;
  189. padding: 0.75rem;
  190. background-color: #ffffff;
  191. border-radius: 10rpx;
  192. margin-bottom: 0.75rem;
  193. border-bottom: 1px solid gainsboro;
  194. }
  195. .title {
  196. flex-grow: 1;
  197. font-size: 1rem;
  198. }
  199. .desc {
  200. color: #777;
  201. margin-right: 0.5rem;
  202. }
  203. .select1 {
  204. display: inline-block;
  205. width: 50%;
  206. margin-top: 0.3rem;
  207. }
  208. .headImg {
  209. text-align: center;
  210. }
  211. //样式穿透
  212. ::v-deep .uni-list-cell {
  213. justify-content: left;
  214. }
  215. ::v-deep .uni-list-cell-left {
  216. padding: 0 0;
  217. font-size: 1.1rem;
  218. color: #333;
  219. flex: none;
  220. }
  221. ::v-deep .uni-list-cell::after {
  222. background-color: #f5f5f5;
  223. }
  224. ::v-deep .uni-input {
  225. padding: 0.5rem 0.25rem;
  226. text-decoration: underline;
  227. /* 给文字添加下划线 */
  228. color: blue;
  229. font-size: 1.1rem;
  230. background-color: #f5f5f5;
  231. // text-decoration-color: blue;
  232. }
  233. ::v-deep .uni-list-cell-db,
  234. .uni-list-cell-right {
  235. flex: none;
  236. }
  237. ::v-deep .uni-card {
  238. background-color: #f5f5f5 !important;
  239. }
  240. ::v-deep .uni-card--shadow {
  241. box-shadow: none !important;
  242. }
  243. ::v-deep .uni-card--border {
  244. border: none !important;
  245. }
  246. </style>