my.vue 10 KB

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