my.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <view>
  3. <Navbar title="我的" />
  4. <layout-page>
  5. <view :style="{'padding-top': navbarHeight + 'px'}">
  6. <view class="commonBackground"></view>
  7. <view class="defaultBgc" style="padding-bottom: 100rpx;">
  8. <view class="ss-p-x-30 d-flex justify-space-between align-center" @tap="handleTap">
  9. <view class="img-box" :class="vip ? 'vipBox' : ''">
  10. <img :src="getUserAvatar(baseInfo?.avatar, baseInfo?.sex)" alt="" class="img default-border">
  11. <image v-if="vip" src="/static/svg/vip.svg" class="vipIcon" @click.stop="handleToLink({path: '/pagesA/vip/index'})"></image>
  12. </view>
  13. <view style="z-index: 1 !important;">
  14. <view v-if="!useUserStore.isLogin" class="">
  15. <view class="MiSans-Medium default-text-color font-size-28rpx">点击登录/注册</view>
  16. <view class="MiSans-Normal color-666 ss-m-t-10" style="font-size: 24rpx;">Hi 欢迎登录门墩儿</view>
  17. </view>
  18. <view v-else class="MiSans-Medium font-size-20 default-text-color">{{ baseInfo?.name || userInfo?.phone }}</view>
  19. </view>
  20. </view>
  21. <view class="d-flex justify-space-between align-center">
  22. <resume-status style="flex: 1" />
  23. <view style="width: 100px; z-index: 1;" class="ss-m-r-30">
  24. <image
  25. src="https://minio.menduner.com/dev/fe9890be9b1176f84f2aa282b0f6adce300b133f65eb3d7b45ae057aa5698324.png"
  26. style="width: 93px; height: 40px;"
  27. ></image>
  28. </view>
  29. </view>
  30. <view class="d-flex" style="margin: 30rpx; border-radius: 20rpx;">
  31. <view v-for="(item, index) in itemList" :key="index" @tap="handleToLink(item)" class="parent">
  32. <view class="d-flex align-center">
  33. <image :src="item.src" mode="" style="width: 70rpx; height: 60rpx;"></image>
  34. <text class="ss-m-l-30 default-text-color">{{ item.title }}</text>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="list-card">
  39. <uni-list>
  40. <uni-list-item
  41. v-for="item in list"
  42. :clickable="true"
  43. :key="item.title"
  44. :title="item.title"
  45. showArrow
  46. :thumb="item.src"
  47. thumb-size="sm"
  48. :rightText="item.rightTex || ''"
  49. @click="handleToLink(item)"
  50. >
  51. </uni-list-item>
  52. </uni-list>
  53. </view>
  54. <button v-if="useUserStore.isLogin" class="send-button" style="margin-bottom: 50px;" @tap="handleLogout">退出登录</button>
  55. <uni-popup ref="popup" type="dialog">
  56. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确定" title="系统提示" content="确认退出账号?" @confirm="handleLogoutConfirm"
  57. @close="handleLogoutClose"></uni-popup-dialog>
  58. </uni-popup>
  59. <uni-popup ref="inputDialog" type="dialog">
  60. <view class="shareQrCodePopupContent">
  61. <view class="ss-m-b-10 MiSans-Normal">请前往网页版{{ dialogType ? '门墩儿招聘' : '门墩儿商城' }}</view>
  62. <uni-link class="MiSans-Normal" :href="dialogType ? 'https://www.menduner.com' : 'https://www.menduner.com/mall'" text="点击复制网页地址" color="#00B760" fontSize="16" copyTips="已复制,请在电脑端打开"></uni-link>
  63. </view>
  64. </uni-popup>
  65. </view>
  66. </view>
  67. </layout-page>
  68. </view>
  69. </template>
  70. <script setup>
  71. import { ref, computed, watch } from 'vue'
  72. import ResumeStatus from '@/components/ResumeStatus'
  73. import { userStore } from '@/store/user'
  74. import { getUserAvatar } from '@/utils/avatar'
  75. import { getAccessToken, showNecessaryInfoPopup } from '@/utils/request'
  76. import layoutPage from '@/layout'
  77. import { showAuthModal } from '@/hooks/useModal'
  78. import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  79. import Navbar from '@/components/Navbar'
  80. const navbarHeight = ref(uni.getStorageSync('navbarHeight'))
  81. // 设置自定义tabbar选中值
  82. onShow(() => {
  83. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  84. const currentTabBar = currentPage?.getTabBar?.();
  85. // 设置当前tab页的下标index
  86. currentTabBar?.setData({ selected: 4 });
  87. })
  88. const inputDialog = ref()
  89. const useUserStore = userStore()
  90. const baseInfo = computed(() => useUserStore?.baseInfo)
  91. const userInfo = computed(() => useUserStore?.userInfo)
  92. const vip = computed(() => new Date().getTime() < useUserStore?.userInfo?.vipExpireDate)
  93. const popup = ref()
  94. const itemList = [
  95. { title: "我的关注", path: "/pagesA/collect/index", src: "https://minio.menduner.com/dev/0490f8bd7d4894d6eb3001ba6a6c9080bbc3623113bf0050342466cdb44ccec6.png" },
  96. { title:'关注我的', path:'/pagesA/seenMe/index', src:'https://minio.menduner.com/dev/f6079be237dd39aa0929db31b7b35835e109b448ba0e1f278df64fa9391e6634.png' }
  97. ]
  98. const defaultList = [
  99. { title: '在线简历', path: '/pagesA/resumeOnline/index', src: 'https://minio.menduner.com/dev/ec05228053a844dfa89d3bcb3750aaf2571bff4c8e04a5de6dbee2e68200e792.png' },
  100. { title: '附件简历', path: '/pagesA/resume/index', src: 'https://minio.menduner.com/dev/d2687a2081847b092fc839880dd12fd7f374c58afeb07d567ae7cdfe8d68ce54.png' },
  101. { title: '学生专区', path: '/pagesA/student/index', key: 'student', defaultHide: true, src: 'https://minio.menduner.com/dev/ec05228053a844dfa89d3bcb3750aaf2571bff4c8e04a5de6dbee2e68200e792.png' },
  102. { title: '面试管理', path: '/pagesA/interview/index', src: 'https://minio.menduner.com/dev/747122b480d8358096e5848d0039cce0c8b8cf2a52f0409d073cc733cf4c0224.png' },
  103. { title: '会员套餐', path: '/pagesA/vipPackage/index', src: 'https://minio.menduner.com/dev/4e9f86f6a48b78c1aca7a6a6b3c5971044275a7f890f73d7c3b981f125378a0f.png' },
  104. { title: '我的分享码', path: '/pagesB/sharePoster/index', src: 'https://minio.menduner.com/dev/32e78eca5e003bb0136d874a973b582581eb4f9d3c746fb11ed3cc7f41a9b0e9.png' },
  105. { title: '新用户邀请记录', path: '/pagesB/inviteRecord/index', src: 'https://minio.menduner.com/dev/53c36e2fb4cb3b7852bcb9ce7584d9f4c1daaed034a065c33fdb4acd2f4b89b8.png' },
  106. { title: '门墩儿商城', appId: 'wx6decdf12f9e7a061', src: 'https://minio.menduner.com/dev/1f83900522317f36618b4b8314c2b6263c30d43ff1c0e8738903f85996f165d3.png' },
  107. { title: '我要招聘', key: 'recruit', src:'https://minio.menduner.com/dev/c8e7d358858eaf9bfe197473751d04d1bc79598b9ce6ecf882ec61c79b0d3bae.png' },
  108. { title: '联系我们', path: '/pagesB/contactUs/index', src: 'https://minio.menduner.com/dev/747122b480d8358096e5848d0039cce0c8b8cf2a52f0409d073cc733cf4c0224.png' },
  109. { title: '协议中心', path: '/pagesB/agreement/index', open: true, src: 'https://minio.menduner.com/dev/58cc8847965aaa4e80064732a2024b690ff2285aa57cc4d133846a1e06a23478.png' }
  110. ]
  111. const list = ref(defaultList.filter(e => !e.defaultHide))
  112. watch(
  113. () => baseInfo.value,
  114. (newVal) => {
  115. if (newVal) {
  116. list.value = defaultList.map(e => { // 不改变原数组,退出登录需要重置菜单
  117. let hide = e.defaultHide
  118. if (e?.key === 'student' && newVal.type === '1') hide = false // 学生信息管理。 type:0是求职者,1是学生
  119. return hide ? null : e
  120. }).filter(Boolean)
  121. }
  122. },
  123. { immediate: true },
  124. // { deep: true }
  125. )
  126. watch(
  127. () => vip.value,
  128. (newVal) => {
  129. if (newVal) list.value.splice(3, 0, { title: 'vip权益', key: 'vip', path: '/pagesA/vip/index' })
  130. else list.value = list.value.filter(e => !e.key || e.key !== 'vip')
  131. },
  132. { immediate: true },
  133. // { deep: true }
  134. )
  135. onLoad(() => {
  136. wx.showShareMenu({
  137. withShareTicket: true,
  138. menus: ['shareAppMessage', 'shareTimeline']
  139. })
  140. onShareAppMessage(() => {
  141. return {
  142. title: '门墩儿 专注顶尖招聘',
  143. path: '/pages/index/position',
  144. imageUrl: '../../static/img/share-poster.jpg'
  145. }
  146. })
  147. onShareTimeline(() => {
  148. return {
  149. title: '门墩儿 专注顶尖招聘',
  150. path: '/pages/index/position',
  151. imageUrl: '../../static/img/share-poster.jpg'
  152. }
  153. })
  154. })
  155. const openSubscribe = (path) => {
  156. wx.requestSubscribeMessage({
  157. tmplIds: ['2dByiI4wf6D3ZmxDH1QywH264F3N-9ysnvsS7xQm4PE'],
  158. success:(res)=>{
  159. console.log(res, 'uni.requestSubscribeMessage-res')
  160. uni.navigateTo({
  161. url: path
  162. })
  163. },
  164. fail:(err)=>{
  165. console.log('订阅失败', err)
  166. uni.navigateTo({
  167. url: path
  168. })
  169. }
  170. })
  171. }
  172. // 列表跳转
  173. const dialogType = ref('')
  174. const handleToLink = (item) => {
  175. if (item.open && item.path) return uni.navigateTo({ url: item.path })
  176. if (item.appId) {
  177. // uni.navigateToMiniProgram({
  178. // appId: item.appId,
  179. // })
  180. // return
  181. // uni.showToast({
  182. // title: '请前往网页版门墩儿商城',
  183. // icon: 'none'
  184. // })
  185. dialogType.value = 0
  186. inputDialog.value.open()
  187. }
  188. if (item.key === 'recruit') {
  189. dialogType.value = 1
  190. inputDialog.value.open()
  191. }
  192. if (!item.path) return
  193. if (!getAccessToken()) {
  194. uni.showToast({
  195. title: '请先登录',
  196. icon: 'none'
  197. })
  198. showAuthModal()
  199. return
  200. }
  201. if (showNecessaryInfoPopup()) {
  202. uni.showToast({
  203. title: '请先完善基本信息',
  204. icon: 'none'
  205. })
  206. showAuthModal('necessaryInfo')
  207. return
  208. }
  209. // 点击在线简历需调起订阅消息
  210. if (item.title === '在线简历'){
  211. openSubscribe(item.path)
  212. return
  213. }
  214. uni.navigateTo({
  215. url: item.path
  216. })
  217. }
  218. // 登录
  219. const handleTap = () => {
  220. if (!useUserStore.isLogin) {
  221. showAuthModal()
  222. return
  223. }
  224. uni.navigateTo({
  225. url: '/pagesA/resumeOnline/index'
  226. })
  227. }
  228. // 退出登录
  229. const handleLogout = () => {
  230. popup.value.open()
  231. }
  232. const handleLogoutClose = () => {
  233. popup.value.close()
  234. }
  235. const handleLogoutConfirm = () => {
  236. list.value = defaultList.filter(e => !e.hide) // 重置菜单
  237. useUserStore.handleLogout()
  238. }
  239. </script>
  240. <style scoped lang="scss">
  241. .font-size-28rpx {
  242. font-size: 28rpx;
  243. }
  244. .list-card {
  245. background-color: #fff;
  246. border-radius: 20rpx;
  247. margin: 30rpx;
  248. }
  249. .img-box {
  250. position: relative;
  251. display: flex;
  252. justify-content: center;
  253. .img {
  254. width: 100rpx;
  255. height: 100rpx;
  256. border-radius: 50%;
  257. }
  258. }
  259. .vipBox {
  260. color: #a18a0f;
  261. .img {
  262. border: 1px solid gold;
  263. }
  264. .vipIcon {
  265. position: absolute;
  266. width: 45px;
  267. height: 24px;
  268. bottom: 1px;
  269. left: 50%;
  270. }
  271. }
  272. :deep(.uni-list-item) {
  273. height: 120rpx !important;
  274. line-height: 120rpx !important;
  275. &:first-child {
  276. border-radius: 20rpx 20rpx 0 0;
  277. }
  278. &:last-child {
  279. border-radius: 0 0 20rpx 20rpx;
  280. }
  281. }
  282. :deep(.uni-list-item__content-title) {
  283. font-size: 28rpx !important;
  284. font-family: MiSans-Medium;
  285. }
  286. :deep(.uniui-arrowright) {
  287. color: #0E100F !important;
  288. }
  289. .parent{
  290. width: 50%;
  291. border-radius: 20rpx;
  292. background-color: #fff;
  293. padding: 30rpx;
  294. z-index: 1;
  295. }
  296. .parent:first-child{
  297. margin-right: 20rpx;
  298. }
  299. .shareQrCodePopupContent {
  300. width: 75vw;
  301. padding: 40rpx;
  302. margin-bottom: 20rpx;
  303. text-align: center;
  304. background-color: #fff;
  305. border-radius: 20rpx;
  306. .text {
  307. margin-bottom: 20px;
  308. }
  309. .qrCode {
  310. margin-left: 4px;
  311. }
  312. .saveImg {
  313. text-align: center;
  314. margin-top: 10px;
  315. color: #999;
  316. }
  317. }
  318. </style>