my.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <layout-page>
  3. <view class="pb-150">
  4. <view class="text-center ss-p-b-30" :class="vip ? 'vipBox' : 'avatarBox'" @tap="handleLogin">
  5. <img :src="getUserAvatar(userInfo?.avatar, userInfo?.sex)" alt="" class="img-box">
  6. <image v-if="vip" src="/static/svg/vip.svg" class="vipIcon"></image>
  7. <view v-if="!useUserStore.isLogin" class="font-weight-bold font-size-20">点击登录</view>
  8. <view v-else>
  9. <view>
  10. <span class="font-weight-bold font-size-20">{{ userInfo?.name || userInfo?.phone }}</span>
  11. <uni-icons @tap="handleEdit('/pagesB/staffInfoEdit/index')" class="ss-m-l-10" type="compose" :size="22"></uni-icons>
  12. </view>
  13. <view style="color: #0E100F" class="ss-m-t-20">
  14. <span>{{ formatName(userInfo?.enterpriseAnotherName || userInfo?.enterpriseName) }}</span>
  15. <uni-icons @tap="handleEdit('/pagesB/companyInfoEdit/index')" class="ss-m-l-10" type="compose" :size="22"></uni-icons>
  16. </view>
  17. </view>
  18. </view>
  19. <view style="height: 20rpx; background-color: #f8f8fa;"></view>
  20. <view class="card">
  21. <uni-list>
  22. <uni-list-item
  23. v-for="item in list"
  24. :clickable="true"
  25. :key="item.title"
  26. :title="item.title"
  27. showArrow
  28. :rightText="item.rightTex || ''"
  29. @click="handleToLink(item)"
  30. >
  31. </uni-list-item>
  32. </uni-list>
  33. </view>
  34. <button v-if="useUserStore.isLogin" class="send-button" style="margin-bottom: 50px;" @tap="handleLogout">退出登录</button>
  35. <uni-popup ref="popup" type="dialog">
  36. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="系统提示" content="确认退出账号?" @confirm="handleLogoutConfirm"
  37. @close="handleLogoutClose"></uni-popup-dialog>
  38. </uni-popup>
  39. <uni-popup ref="inputDialog" type="dialog">
  40. <view class="shareQrCodePopupContent">
  41. <view>请前往网页版{{ dialogType ? '门墩儿招聘' : '门墩儿商城' }}</view>
  42. <uni-link class="ss-m-t-10" :href="dialogType ? 'https://www.menduner.com' : 'https://www.menduner.com/mall'" text="点击复制网页地址" color="#00B760" fontSize="16" copyTips="已复制,请在电脑端打开"></uni-link>
  43. </view>
  44. </uni-popup>
  45. </view>
  46. </layout-page>
  47. </template>
  48. <script setup>
  49. import { ref, computed, watch } from 'vue'
  50. import { userStore } from '@/store/user'
  51. import { getUserAvatar } from '@/utils/avatar'
  52. import { getAccessToken } from '@/utils/request'
  53. import layoutPage from '@/layout'
  54. import { formatName } from '@/utils/getText'
  55. import { showAuthModal } from '@/hooks/useModal'
  56. import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  57. // 设置自定义tabbar选中值
  58. onShow(() => {
  59. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  60. const currentTabBar = currentPage?.getTabBar?.();
  61. // 设置当前tab页的下标index
  62. currentTabBar?.setData({ selected: 4 });
  63. })
  64. const inputDialog = ref()
  65. const useUserStore = userStore()
  66. const userInfo = computed(() => useUserStore?.userInfo)
  67. const vip = computed(() => new Date().getTime() < useUserStore?.userInfo?.vipExpireDate)
  68. const popup = ref()
  69. const defaultList = [
  70. { title: '简历管理', path: '/pagesA/resume/index' },
  71. { title: '面试管理', path: '/pagesA/interview/index' },
  72. { title: '修改密码', path: '/pagesA/editPassword/index' },
  73. { title: '联系我们', path: '/pagesB/contactUs/index' },
  74. { title: '协议中心', path: '/pagesB/agreement/index', open: true },
  75. { title: '我要求职', appId: 'wx5dd538ccc752b03a' },
  76. ]
  77. const list = ref(defaultList.filter(e => !e.defaultHide))
  78. onLoad(() => {
  79. wx.showShareMenu({
  80. withShareTicket: true,
  81. menus: ['shareAppMessage', 'shareTimeline']
  82. })
  83. onShareAppMessage(() => {
  84. return {
  85. title: '门墩儿 专注顶尖招聘',
  86. path: '/pages/index/position',
  87. imageUrl: '../../static/img/share-poster.jpg'
  88. }
  89. })
  90. onShareTimeline(() => {
  91. return {
  92. title: '门墩儿 专注顶尖招聘',
  93. path: '/pages/index/position',
  94. imageUrl: '../../static/img/share-poster.jpg'
  95. }
  96. })
  97. })
  98. // 列表跳转
  99. const dialogType = ref('')
  100. const handleToLink = (item) => {
  101. if (item.open && item.path) return uni.navigateTo({ url: item.path })
  102. if (item.appId) {
  103. uni.navigateToMiniProgram({
  104. appId: item.appId,
  105. })
  106. return
  107. }
  108. if (item?.showDialog) {
  109. dialogType.value = 0
  110. inputDialog.value.open()
  111. return
  112. }
  113. if (!item.path) return
  114. if (!getAccessToken()) {
  115. uni.showToast({
  116. title: '请先登录',
  117. icon: 'none'
  118. })
  119. showAuthModal()
  120. return
  121. }
  122. uni.navigateTo({
  123. url: item.path
  124. })
  125. }
  126. const handleEdit = (url) => {
  127. if (!useUserStore.isLogin) {
  128. showAuthModal()
  129. return
  130. }
  131. if (!url) return
  132. uni.navigateTo({
  133. url
  134. })
  135. }
  136. // 退出登录
  137. const handleLogout = () => {
  138. popup.value.open()
  139. }
  140. const handleLogoutClose = () => {
  141. popup.value.close()
  142. }
  143. const handleLogoutConfirm = () => {
  144. // list.value = defaultList.filter(e => !e.hide) // 重置菜单
  145. useUserStore.handleLogout()
  146. }
  147. const handleLogin = () => {
  148. if (!getAccessToken()) {
  149. showAuthModal()
  150. return
  151. }
  152. }
  153. </script>
  154. <style scoped lang="scss">
  155. .pb-150 {
  156. padding-bottom: 100px;
  157. }
  158. .img-box {
  159. width: 150rpx;
  160. height: 150rpx;
  161. border: 2rpx solid #ccc;
  162. border-radius: 50%;
  163. }
  164. .vipBox {
  165. color: #a18a0f;
  166. position: relative;
  167. .img-box {
  168. border: 1px solid gold;
  169. }
  170. .vipIcon {
  171. position: absolute;
  172. width: 45px;
  173. height: 24px;
  174. top: 60px;
  175. left: 50%;
  176. }
  177. }
  178. :deep(.uni-list-item) {
  179. height: 120rpx !important;
  180. line-height: 120rpx !important;
  181. }
  182. :deep(.uni-list-item__content-title) {
  183. font-size: 32rpx !important;
  184. font-weight: 500;
  185. }
  186. .colors{
  187. font-size: 24rpx;
  188. color: #606266;
  189. }
  190. .size-16{
  191. color: #3f424f;
  192. font-size: 32rpx;
  193. margin: 13rpx 0 5rpx 0;
  194. }
  195. .itemText {
  196. color: #3f424f;
  197. font-size: 36rpx;
  198. }
  199. .parent{
  200. width: 50%;
  201. border: 1px solid #f4f4f4;
  202. border-radius: 10rpx;
  203. margin: 0 30rpx 20rpx 30rpx;
  204. padding: 20rpx;
  205. }
  206. .parent:first-child{
  207. margin: 0 0 20rpx 30rpx;
  208. }
  209. .shareQrCodePopupContent {
  210. width: 75vw;
  211. padding: 40rpx;
  212. margin-bottom: 20rpx;
  213. text-align: center;
  214. background-color: #fff;
  215. .text {
  216. margin-bottom: 20px;
  217. }
  218. .qrCode {
  219. margin-left: 4px;
  220. }
  221. .saveImg {
  222. text-align: center;
  223. margin-top: 10px;
  224. color: #999;
  225. }
  226. }
  227. </style>