wangfukang 22 hours ago
parent
commit
61036e9b42
  1. 18
      package1/ieBrowser/dailyQuestion.vue
  2. 39
      package1/ieBrowser/index.vue
  3. 27
      package1/ieBrowser/mySpace.vue

18
package1/ieBrowser/dailyQuestion.vue

@ -69,7 +69,8 @@
</template>
<script>
import { getIeDailyQuestion, answerIeDailyQuestion, pageIeDailyAnswers, matchIeByAnswer } from '@/common/ieApi.js'
import { getIeProfile, getIeDailyQuestion, answerIeDailyQuestion, pageIeDailyAnswers, matchIeByAnswer } from '@/common/ieApi.js'
import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js'
export default {
data() {
@ -77,6 +78,7 @@
menuButtonInfo: { top: 44 },
loading: true,
question: { exists: false },
profile: {},
draft: '',
submitting: false,
answers: [],
@ -97,6 +99,7 @@
if (uni.getMenuButtonBoundingClientRect) {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
}
this.loadProfile()
this.loadQuestion()
},
onReachBottom() {
@ -121,9 +124,22 @@
this.loadAnswers()
}
},
async loadProfile() {
const profile = await getIeProfile().catch(() => null)
if (profile) this.profile = profile
},
async submit() {
const content = this.draft.trim()
if (!content || this.submitting) return
const verified = await ensureIeVerifiedBeforeAction({
profile: this.profile,
actionText: '提交每日同频一题回答',
cancelText: '暂不提交',
reload: async () => {
await this.loadProfile()
}
})
if (!verified) return
this.submitting = true
try {
const res = await answerIeDailyQuestion(content)

39
package1/ieBrowser/index.vue

@ -276,6 +276,7 @@
<script>
import { ieHome, getIeUnreadCount, updateIeStatus, startIeMatch, matchIeProfile, getIeDailyQuestion, saveIeProfile } from '@/common/ieApi.js'
import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js'
import IeBottomTab from '@/components/ie-bottom-tab/ie-bottom-tab.vue'
export default {
@ -303,6 +304,7 @@
showTargetPanel: false,
showCompanionEditor: false,
matching: false,
realNameVerifying: false,
savingCompanionIntent: false,
keyboardHeight: 0,
profileReady: false,
@ -579,7 +581,16 @@
if (res) this.dailyQuestion = res
}).catch(() => {})
},
goDailyQuestion() {
async goDailyQuestion() {
const verified = await ensureIeVerifiedBeforeAction({
profile: this.profile,
actionText: '参与每日同频一题',
cancelText: '暂不回答',
reload: async () => {
await this.loadHome()
}
})
if (!verified) return
uni.navigateTo({ url: '/package1/ieBrowser/dailyQuestion' })
},
toggleIntent(key) {
@ -608,14 +619,10 @@
return
}
if (!home) return
if (home.profileCompleted !== 1) {
uni.redirectTo({ url: '/package1/ieBrowser/profileSetup' })
return
}
this.profile = home.profile || {}
this.customCompanionIntent = this.profile.companionIntent || this.customCompanionIntent
this.editCompanionIntent = this.customCompanionIntent
this.profileReady = true
this.profileReady = !!(this.profile && this.profile.exists && this.profile.profileCompleted === 1)
this.onlineCountBase = Number(home.onlineCount) || 0
this.awakeCount = this.randomAwakeCount(this.onlineCountBase)
this.waitingCount = home.waitingCount || this.waitingCount
@ -706,6 +713,8 @@
uni.showToast({ title: '请先选择校区', icon: 'none' })
return
}
const verified = await this.ensureRealNameBeforeMatch()
if (!verified) return
this.matching = true
try {
const matchAnimation = this.wait(2000)
@ -801,6 +810,8 @@
},
async matchDriftUser(item) {
if (this.matching) return
const verified = await this.ensureRealNameBeforeMatch()
if (!verified) return
this.matching = true
try {
const match = await matchIeProfile(item.userId)
@ -814,6 +825,22 @@
this.matching = false
}
},
async ensureRealNameBeforeMatch() {
if (this.realNameVerifying) return false
this.realNameVerifying = true
try {
return await ensureIeVerifiedBeforeAction({
profile: this.profile,
actionText: '开始匹配',
cancelText: '暂不匹配',
reload: async () => {
await this.loadHome()
}
})
} finally {
this.realNameVerifying = false
}
},
playMoodCopy(text) {
if (this.moodTypeTimer) {
clearInterval(this.moodTypeTimer)

27
package1/ieBrowser/mySpace.vue

@ -71,7 +71,8 @@
</template>
<script>
import { getIeProfile, pageIeMoments, publishIeMoment, deleteIeMoment } from '@/common/ieApi.js'
import { ieHome, getIeProfile, pageIeMoments, publishIeMoment, deleteIeMoment } from '@/common/ieApi.js'
import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js'
import tui from '@/common/httpRequest.js'
export default {
@ -87,7 +88,8 @@
composeText: '',
composeImages: [],
composeVideo: null,
publishing: false
publishing: false,
realNameVerifying: false
}
},
computed: {
@ -119,7 +121,8 @@
uni.navigateBack({ fail: () => uni.redirectTo({ url: '/package1/ieBrowser/universe' }) })
},
async loadProfile() {
const profile = await getIeProfile()
const home = await ieHome().catch(() => null)
const profile = home && home.profile ? home.profile : await getIeProfile()
if (profile) this.profile = profile
},
async loadMoments(reset, force = false) {
@ -202,8 +205,24 @@
}
})
},
openComposer() {
async openComposer() {
if (this.realNameVerifying) return
this.realNameVerifying = true
try {
await this.loadProfile()
const verified = await ensureIeVerifiedBeforeAction({
profile: this.profile,
actionText: '发布动态',
cancelText: '暂不发布',
reload: async () => {
await this.loadProfile()
}
})
if (!verified) return
this.showComposer = true
} finally {
this.realNameVerifying = false
}
},
closeComposer() {
this.showComposer = false

Loading…
Cancel
Save