my.vue 11 KB

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