|
|
|
@ -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() |
|
|
|
this.loadHome() |
|
|
|
this.loadDailyQuestion() |
|
|
|
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) { |
|
|
|
this.loadHome() |
|
|
|
this.loadDailyQuestion() |
|
|
|
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', |
|
|
|
|