my.vue 6.3 KB

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