my.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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/resumeOnline/index' },
  71. // { title: '附件简历', path: '/pagesA/resume/index' },
  72. // { title: '学生专区', path: '/pagesA/student/index', key: 'student', defaultHide: true },
  73. // { title: '面试管理', path: '/pagesA/interview/index' },
  74. // { title: '会员套餐', path: '/pagesA/vipPackage/index' },
  75. // { title: '门墩儿商城', showDialog: true }, // wx6decdf12f9e7a061
  76. { title: '会员套餐', path: '' },
  77. { title: '联系我们', path: '/pagesB/contactUs/index' },
  78. { title: '协议中心', path: '/pagesB/agreement/index', open: true },
  79. { title: '我要求职', appId: 'wx5dd538ccc752b03a' },
  80. ]
  81. const list = ref(defaultList.filter(e => !e.defaultHide))
  82. onLoad(() => {
  83. wx.showShareMenu({
  84. withShareTicket: true,
  85. menus: ['shareAppMessage', 'shareTimeline']
  86. })
  87. onShareAppMessage(() => {
  88. return {
  89. title: '门墩儿 专注顶尖招聘',
  90. path: '/pages/index/position',
  91. imageUrl: '../../static/img/share-poster.jpg'
  92. }
  93. })
  94. onShareTimeline(() => {
  95. return {
  96. title: '门墩儿 专注顶尖招聘',
  97. path: '/pages/index/position',
  98. imageUrl: '../../static/img/share-poster.jpg'
  99. }
  100. })
  101. })
  102. // 列表跳转
  103. const dialogType = ref('')
  104. const handleToLink = (item) => {
  105. if (item.open && item.path) return uni.navigateTo({ url: item.path })
  106. if (item.appId) {
  107. uni.navigateToMiniProgram({
  108. appId: item.appId,
  109. })
  110. return
  111. }
  112. if (item?.showDialog) {
  113. dialogType.value = 0
  114. inputDialog.value.open()
  115. return
  116. }
  117. if (!item.path) return
  118. if (!getAccessToken()) {
  119. uni.showToast({
  120. title: '请先登录',
  121. icon: 'none'
  122. })
  123. showAuthModal()
  124. return
  125. }
  126. uni.navigateTo({
  127. url: item.path
  128. })
  129. }
  130. const handleEdit = (url) => {
  131. if (!useUserStore.isLogin) {
  132. showAuthModal()
  133. return
  134. }
  135. if (!url) return
  136. uni.navigateTo({
  137. url
  138. })
  139. }
  140. // 退出登录
  141. const handleLogout = () => {
  142. popup.value.open()
  143. }
  144. const handleLogoutClose = () => {
  145. popup.value.close()
  146. }
  147. const handleLogoutConfirm = () => {
  148. // list.value = defaultList.filter(e => !e.hide) // 重置菜单
  149. useUserStore.handleLogout()
  150. }
  151. const handleLogin = () => {
  152. if (!getAccessToken()) {
  153. showAuthModal()
  154. return
  155. }
  156. }
  157. </script>
  158. <style scoped lang="scss">
  159. .pb-150 {
  160. padding-bottom: 100px;
  161. }
  162. .img-box {
  163. width: 150rpx;
  164. height: 150rpx;
  165. border: 2rpx solid #ccc;
  166. border-radius: 50%;
  167. }
  168. .vipBox {
  169. color: #a18a0f;
  170. position: relative;
  171. .img-box {
  172. border: 1px solid gold;
  173. }
  174. .vipIcon {
  175. position: absolute;
  176. width: 45px;
  177. height: 24px;
  178. top: 60px;
  179. left: 50%;
  180. }
  181. }
  182. :deep(.uni-list-item) {
  183. height: 120rpx !important;
  184. line-height: 120rpx !important;
  185. }
  186. :deep(.uni-list-item__content-title) {
  187. font-size: 32rpx !important;
  188. font-weight: 500;
  189. }
  190. .colors{
  191. font-size: 24rpx;
  192. color: #606266;
  193. }
  194. .size-16{
  195. color: #3f424f;
  196. font-size: 32rpx;
  197. margin: 13rpx 0 5rpx 0;
  198. }
  199. .itemText {
  200. color: #3f424f;
  201. font-size: 36rpx;
  202. }
  203. .parent{
  204. width: 50%;
  205. border: 1px solid #f4f4f4;
  206. border-radius: 10rpx;
  207. margin: 0 30rpx 20rpx 30rpx;
  208. padding: 20rpx;
  209. }
  210. .parent:first-child{
  211. margin: 0 0 20rpx 30rpx;
  212. }
  213. .shareQrCodePopupContent {
  214. width: 75vw;
  215. padding: 40rpx;
  216. margin-bottom: 20rpx;
  217. text-align: center;
  218. background-color: #fff;
  219. .text {
  220. margin-bottom: 20px;
  221. }
  222. .qrCode {
  223. margin-left: 4px;
  224. }
  225. .saveImg {
  226. text-align: center;
  227. margin-top: 10px;
  228. color: #999;
  229. }
  230. }
  231. </style>