my copy.vue 11 KB

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