wangfukang 2 weeks ago
parent
commit
a48487321c
  1. 55
      package4/ieBrowser/index.vue
  2. 37
      package4/ieBrowser/mySpace.vue

55
package4/ieBrowser/index.vue

@ -287,6 +287,7 @@
import { ieHome, getIeUnreadCount, updateIeStatus, startIeMatch, matchIeProfile, getIeDailyQuestion, saveIeProfile } from '@/common/ieApi.js'
import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js'
import { buildHomeSharePath } from '@/utils/sharePath.js'
import { hasLogin, requireLoginToCurrentPage } from '@/utils/authRedirect.js'
import IeBottomTab from '@/package4/components/ie-bottom-tab/ie-bottom-tab.vue'
import IeAuthDialog from '@/package4/components/ie-auth-dialog/ie-auth-dialog.vue'
import CommonLoading from '@/package4/components/common-loading/common-loading.vue'
@ -458,8 +459,10 @@
this.lowPowerMode = uni.getStorageSync('ieLowPowerMode') === '1'
this.detectPlatform()
this.pickCompanion()
if (hasLogin()) {
this.loadHome()
this.loadDailyQuestion()
}
this.animateAwakeCount(this.awakeCount)
this.startPageTimers()
this.displayMoodCopy = this.activeMood.copy
@ -468,20 +471,13 @@
this.enableShareMenu()
this.startPageTimers()
if (this.hasShownOnce) {
if (hasLogin()) {
this.loadHome()
this.loadDailyQuestion()
}
} else {
this.hasShownOnce = true
}
uni.authorize({
scope: 'scope.record',
success() {
},
fail() {
this.tui.toast("您未授权,语音功能可能会出现错误")
}
})
},
onHide() {
this.stopPageTimers()
@ -566,6 +562,7 @@
}
},
async refreshUnreadCount() {
if (!hasLogin()) return
const count = await getIeUnreadCount()
if (count === null || count === undefined) return
this.unreadCount = Number(count) || 0
@ -576,6 +573,9 @@
wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
},
requirePageLogin() {
return requireLoginToCurrentPage()
},
randomAwakeCount(onlineCount) {
const count = Number(onlineCount) || 0
if (count > 1000) {
@ -618,11 +618,13 @@
uni.showToast({ title: this.lowPowerMode ? '已开启流畅模式' : '已开启氛围动效', icon: 'none' })
},
loadDailyQuestion() {
if (!hasLogin()) return
getIeDailyQuestion().then(res => {
if (res) this.dailyQuestion = res
}).catch(() => {})
},
async goDailyQuestion() {
if (!this.requirePageLogin()) return
const verified = await ensureIeVerifiedBeforeAction({
profile: this.profile,
actionText: '参与每日同频一题',
@ -650,10 +652,12 @@
return item ? item.label : '搭子'
},
goGroupBuy() {
if (!this.requirePageLogin()) return
this.showMatch = false
uni.navigateTo({ url: '/package2/group/groupBuyList' })
},
async loadHome() {
if (!hasLogin()) return null
const home = await ieHome()
if (home && home.banned) {
this.redirectBannedIe(home.message)
@ -720,6 +724,7 @@
}, 1800)
},
syncStatus() {
if (!hasLogin()) return
if (!this.profileReady) return
const areaInfo = this.getAreaInfo()
updateIeStatus({
@ -744,6 +749,7 @@
}
},
async openMatch() {
if (!this.requirePageLogin()) return
if (this.matching) return
this.showTargetPanel = false
if (this.chancesLeft === 0) {
@ -868,6 +874,7 @@
}
},
async ensureRealNameBeforeMatch() {
if (!this.requirePageLogin()) return false
if (this.realNameVerifying) return false
this.realNameVerifying = true
try {
@ -910,12 +917,14 @@
this.goUniverse()
},
openTargetPanel() {
if (!this.requirePageLogin()) return
this.showTargetPanel = true
},
closeTargetPanel() {
this.showTargetPanel = false
},
openCompanionEditor() {
if (!this.requirePageLogin()) return
this.editCompanionIntent = this.customCompanionIntent || ''
this.showCompanionEditor = true
},
@ -932,6 +941,7 @@
this.keyboardHeight = 0
},
async saveCompanionIntent() {
if (!this.requirePageLogin()) return
if (this.savingCompanionIntent) return
const text = this.editCompanionIntent.trim()
if (!text) {
@ -1000,6 +1010,7 @@
uni.showToast({ title: "这次轻轻划过了", icon: 'none' })
},
goChat() {
if (!this.requirePageLogin()) return
this.showMatch = false
const room = this.currentMatch ? '&roomId=' + this.currentMatch.roomId + '&targetUserId=' + this.currentMatch.targetUserId +
'&name=' + encodeURIComponent(this.matchedPerson.name || '') +
@ -1012,13 +1023,29 @@
await this.openMatch()
},
goMatchPage() {
if (!this.requirePageLogin()) return
uni.navigateTo({ url: '/package4/ieBrowser/match?mode=' + this.currentMode + '&mood=' + this.currentMood + '&targetMode=' + this.targetMode + '&targetGender=' + this.targetGender + '&matchScope=' + this.matchScope + '&intent=' + (this.matchIntent || '') })
},
goRecords() { uni.navigateTo({ url: '/package4/ieBrowser/chatList' }) },
goArchive() { uni.navigateTo({ url: '/package4/ieBrowser/universe' }) },
goFate() { uni.navigateTo({ url: '/package4/ieBrowser/fate' }) },
goMessages() { uni.navigateTo({ url: '/package4/ieBrowser/messages?unreadCount=' + encodeURIComponent(String(this.unreadCount || 0)) }) },
goUniverse() { uni.navigateTo({ url: '/package4/ieBrowser/universe?unreadCount=' + encodeURIComponent(String(this.unreadCount || 0)) }) },
goRecords() {
if (!this.requirePageLogin()) return
uni.navigateTo({ url: '/package4/ieBrowser/chatList' })
},
goArchive() {
if (!this.requirePageLogin()) return
uni.navigateTo({ url: '/package4/ieBrowser/universe' })
},
goFate() {
if (!this.requirePageLogin()) return
uni.navigateTo({ url: '/package4/ieBrowser/fate' })
},
goMessages() {
if (!this.requirePageLogin()) return
uni.navigateTo({ url: '/package4/ieBrowser/messages?unreadCount=' + encodeURIComponent(String(this.unreadCount || 0)) })
},
goUniverse() {
if (!this.requirePageLogin()) return
uni.navigateTo({ url: '/package4/ieBrowser/universe?unreadCount=' + encodeURIComponent(String(this.unreadCount || 0)) })
},
backHome() {
uni.switchTab({
url: '/pages/index/index',

37
package4/ieBrowser/mySpace.vue

@ -5,7 +5,7 @@
<view class="float-bar">
<view class="home-back" @tap="back">
<text class="home-back-icon"></text>
<text>返回资料</text>
<text>{{ listingAuditEntry ? '返回首页' : '返回资料' }}</text>
</view>
</view>
@ -78,6 +78,7 @@
<script>
import { ieHome, getIeProfile, pageIeMoments, publishIeMoment, deleteIeMoment } from '@/common/ieApi.js'
import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js'
import { hasLogin, requireLoginToCurrentPage } from '@/utils/authRedirect.js'
import tui from '@/common/httpRequest.js'
import IeAuthDialog from '@/package4/components/ie-auth-dialog/ie-auth-dialog.vue'
import CommonLoading from '@/package4/components/common-loading/common-loading.vue'
@ -97,7 +98,8 @@
composeImages: [],
composeVideo: null,
publishing: false,
realNameVerifying: false
realNameVerifying: false,
listingAuditEntry: false
}
},
computed: {
@ -106,8 +108,15 @@
return this.composeImages.length < 5
}
},
onLoad() {
onLoad(options = {}) {
this.listingAuditEntry = String(options.fromListingAudit || '') === '1'
if (uni.getMenuButtonBoundingClientRect) this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
if (!hasLogin()) {
this.profile = this.guestProfile()
this.moments = []
this.hasMoreMoments = false
return
}
this.loadProfile()
this.loadMoments(true)
},
@ -126,15 +135,35 @@
},
methods: {
back() {
if (this.listingAuditEntry) {
uni.reLaunch({ url: '/pages/index/index' })
return
}
uni.navigateBack({ fail: () => uni.redirectTo({ url: '/package4/ieBrowser/universe' }) })
},
guestProfile() {
return {
avatarText: '我',
anonymousName: '半匿名漂流者',
currentMode: 'i'
}
},
async loadProfile() {
if (!hasLogin()) {
this.profile = this.guestProfile()
return this.profile
}
const home = await ieHome().catch(() => null)
const profile = home && home.profile ? home.profile : await getIeProfile()
if (profile) this.profile = profile
return this.profile
},
async loadMoments(reset, force = false) {
if (!hasLogin()) {
this.moments = []
this.hasMoreMoments = false
return
}
if (this.loadingMoments && !force) return
if (!reset && !this.hasMoreMoments) return
this.loadingMoments = true
@ -215,6 +244,7 @@
})
},
async openComposer() {
if (!requireLoginToCurrentPage()) return
if (this.realNameVerifying) return
this.realNameVerifying = true
try {
@ -358,6 +388,7 @@
if (video && video.status !== 'done') throw new Error('视频上传失败')
},
async submitMoment() {
if (!requireLoginToCurrentPage()) return
if (this.publishing) return
const content = this.composeText.trim()
if (!content && !this.composeImages.length && !this.composeVideo) {

Loading…
Cancel
Save