wangfukang 2 weeks ago
parent
commit
d0ed46b4b9
  1. BIN
      components/kk-printer/empty-icon.png
  2. 41
      components/tab-bar/delivery.vue
  3. 18
      components/tab-bar/myCenter.vue
  4. 9
      components/tab-bar/postList.vue
  5. 13
      components/tab-bar/release.vue
  6. 5
      components/tab-bar/tab-bar.vue

BIN
components/kk-printer/empty-icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

41
components/tab-bar/delivery.vue

@ -451,6 +451,8 @@
</template> </template>
<script> <script>
import { requireLoginToPage } from '@/utils/authRedirect.js'
export default { export default {
data() { data() {
return { return {
@ -711,31 +713,27 @@
} }
if (this.loginRedirecting) return false if (this.loginRedirecting) return false
this.loginRedirecting = true this.loginRedirecting = true
const pages = getCurrentPages() const ok = requireLoginToPage('/pages/index/index?tabIndex=1')
const current = pages && pages.length ? pages[pages.length - 1] : null setTimeout(() => {
const route = current ? '/' + current.route : '/pages/index/index' this.loginRedirecting = false
const query = current && current.options }, 1200)
? Object.keys(current.options).map(key => key + '=' + encodeURIComponent(current.options[key])).join('&') return ok
: ''
const target = route + (query ? '?' + query : '')
const redirectKey = 'login_redirect_' + Date.now()
uni.setStorageSync(redirectKey, target)
uni.navigateTo({
url: '/package2/login/login?redirect=' + redirectKey,
complete: () => {
setTimeout(() => {
this.loginRedirecting = false
}, 1200)
}
})
return false
}, },
init() { init() {
if (!this.ensureLogin()) return
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
if (!uni.getStorageSync('hiver_token')) {
this.pageData = []
this.deliveryStatusCounts = { daiqu: 0, daisong: 0 }
this.loadStatus = 'nomore'
this.$nextTick(() => {
this.measureScrollView()
})
return
}
let worker = uni.getStorageSync('worker') let worker = uni.getStorageSync('worker')
if (worker == '' || worker == undefined || worker == null) { if (worker == '' || worker == undefined || worker == null) {
this.tui.toast('您还没有注册兼职') this.pageData = []
this.loadStatus = 'nomore'
return return
} }
this.isOnLine = uni.getStorageSync('worker').isOnLine this.isOnLine = uni.getStorageSync('worker').isOnLine
@ -759,11 +757,13 @@
this.goPartTimeRegister() this.goPartTimeRegister()
}, },
goDeliveryRanking() { goDeliveryRanking() {
if (!this.ensureLogin()) return
uni.navigateTo({ uni.navigateTo({
url: '/package3/shop/ranking' url: '/package3/shop/ranking'
}) })
}, },
goPartTimeRegister() { goPartTimeRegister() {
if (!this.ensureLogin()) return
if (uni.getStorageSync('worker')) { if (uni.getStorageSync('worker')) {
uni.navigateTo({ uni.navigateTo({
url: '/package2/myCenter/partTimeJobRegister' url: '/package2/myCenter/partTimeJobRegister'
@ -1300,6 +1300,7 @@
}, delay) }, delay)
}, },
makeCall(phone) { makeCall(phone) {
if (!this.ensureLogin()) return
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: phone phoneNumber: phone
}); });

18
components/tab-bar/myCenter.vue

@ -250,6 +250,8 @@
</template> </template>
<script> <script>
import { requireLoginToPage } from '@/utils/authRedirect.js'
const MY_CENTER_IMAGE_CACHE_KEY = 'my_center_image_cache_v1' const MY_CENTER_IMAGE_CACHE_KEY = 'my_center_image_cache_v1'
const MY_CENTER_IMAGE_CACHE_TTL = 30 * 24 * 60 * 60 * 1000 const MY_CENTER_IMAGE_CACHE_TTL = 30 * 24 * 60 * 60 * 1000
const MY_CENTER_IMAGE_CACHE_LIMIT = 30 const MY_CENTER_IMAGE_CACHE_LIMIT = 30
@ -479,10 +481,14 @@
uni.$off('myCenterCountsChange', this.setPendingCounts) uni.$off('myCenterCountsChange', this.setPendingCounts)
}, },
methods: { methods: {
requirePageLogin() {
return requireLoginToPage('/pages/index/index?tabIndex=4')
},
getMyCenterImage(key) { getMyCenterImage(key) {
return this.myCenterImages[key] || MY_CENTER_IMAGE_URLS[key] || '' return this.myCenterImages[key] || MY_CENTER_IMAGE_URLS[key] || ''
}, },
openProfileEditor() { openProfileEditor() {
if (!this.requirePageLogin()) return
this.editNickname = this.userName || '' this.editNickname = this.userName || ''
this.editAvatar = this.profileAvatar || '' this.editAvatar = this.profileAvatar || ''
this.nicknameInputByKeyboard = false this.nicknameInputByKeyboard = false
@ -490,12 +496,14 @@
this.$refs.profilePopup.open() this.$refs.profilePopup.open()
}, },
openOfficialAccountPopup() { openOfficialAccountPopup() {
if (!this.requirePageLogin()) return
this.officialAccountPopupVisible = true this.officialAccountPopupVisible = true
}, },
closeOfficialAccountPopup() { closeOfficialAccountPopup() {
this.officialAccountPopupVisible = false this.officialAccountPopupVisible = false
}, },
previewOfficialAccountQr() { previewOfficialAccountQr() {
if (!this.requirePageLogin()) return
uni.previewImage({ uni.previewImage({
current: this.officialAccountQr, current: this.officialAccountQr,
urls: [this.officialAccountQr] urls: [this.officialAccountQr]
@ -560,6 +568,7 @@
this.submitProfile(nickname) this.submitProfile(nickname)
}, },
submitProfile(nickname) { submitProfile(nickname) {
if (!this.requirePageLogin()) return
this.profileSaving = true this.profileSaving = true
this.tui.request('/user/miniProfile', 'POST', { this.tui.request('/user/miniProfile', 'POST', {
nickname, nickname,
@ -875,6 +884,12 @@
this.schoolName1 = area.title this.schoolName1 = area.title
this.schoolShop = this.normalizeShopList(uni.getStorageSync('schoolShop')) this.schoolShop = this.normalizeShopList(uni.getStorageSync('schoolShop'))
this.worker = uni.getStorageSync('worker') this.worker = uni.getStorageSync('worker')
if (!uni.getStorageSync('hiver_token')) {
this.workerCounts = 0
this.shopCounts = 0
this.balance = '0.00'
return Promise.resolve()
}
let shopId = uni.getStorageSync('shopId') let shopId = uni.getStorageSync('shopId')
let worker = uni.getStorageSync('worker') let worker = uni.getStorageSync('worker')
this.workerCounts = 0 this.workerCounts = 0
@ -919,6 +934,7 @@
}) })
}, },
clickShop(item) { clickShop(item) {
if (!this.requirePageLogin()) return
this.setCurrentShop(item) this.setCurrentShop(item)
this.$refs.shopPopup.close() this.$refs.shopPopup.close()
uni.navigateTo({ uni.navigateTo({
@ -937,6 +953,7 @@
}) })
}, },
onClickArea(item) { onClickArea(item) {
if (!this.requirePageLogin()) return
uni.setStorageSync('area', JSON.stringify(item)) uni.setStorageSync('area', JSON.stringify(item))
const area = this.getArea() const area = this.getArea()
this.schoolName1 = uni.getStorageSync('schoolName') || area.title || '沧州师范学院' this.schoolName1 = uni.getStorageSync('schoolName') || area.title || '沧州师范学院'
@ -960,6 +977,7 @@
this.$forceUpdate() this.$forceUpdate()
}, },
navigatorTo(e, index) { navigatorTo(e, index) {
if (!this.requirePageLogin()) return
let url = "" let url = ""
if (e == 'addgoods') { if (e == 'addgoods') {
url = '/package2/myCenter/addGoods' url = '/package2/myCenter/addGoods'

9
components/tab-bar/postList.vue

@ -188,6 +188,7 @@
} from '@/common/fishMarketApi.js' } from '@/common/fishMarketApi.js'
import { getIeProfile } from '@/common/ieApi.js' import { getIeProfile } from '@/common/ieApi.js'
import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js' import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js'
import { requireLoginToPage } from '@/utils/authRedirect.js'
const POST_LIST_IMAGE_CACHE_KEY = 'post_list_image_cache_v1' const POST_LIST_IMAGE_CACHE_KEY = 'post_list_image_cache_v1'
const POST_LIST_IMAGE_CACHE_TTL = 30 * 24 * 60 * 60 * 1000 const POST_LIST_IMAGE_CACHE_TTL = 30 * 24 * 60 * 60 * 1000
@ -463,6 +464,9 @@
} }
this.loadFishUnread() this.loadFishUnread()
}, },
requirePageLogin() {
return requireLoginToPage('/pages/index/index?tabIndex=3')
},
handleSearch() { handleSearch() {
uni.hideKeyboard() uni.hideKeyboard()
this.reloadGoods() this.reloadGoods()
@ -639,6 +643,7 @@
} }
}, },
toggleLike(item) { toggleLike(item) {
if (!this.requirePageLogin()) return
if (!item || item.type == 'want') return if (!item || item.type == 'want') return
if (!item.id) { if (!item.id) {
uni.showToast({ title: '商品ID不能为空', icon: 'none' }) uni.showToast({ title: '商品ID不能为空', icon: 'none' })
@ -676,6 +681,7 @@
}, },
goDetail(item) { goDetail(item) {
if (!item) return if (!item) return
if (!this.requirePageLogin()) return
if (item.type == 'want') { if (item.type == 'want') {
this.goPublish('sell') this.goPublish('sell')
return return
@ -692,6 +698,7 @@
}) })
}, },
goMyFish() { goMyFish() {
if (!this.requirePageLogin()) return
uni.navigateTo({ uni.navigateTo({
url: '/package2/myCenter/myPost' url: '/package2/myCenter/myPost'
}) })
@ -704,11 +711,13 @@
}) })
}, },
goWantSquare() { goWantSquare() {
if (!this.requirePageLogin()) return
uni.navigateTo({ uni.navigateTo({
url: '/package2/IdleTrad/wantList' url: '/package2/IdleTrad/wantList'
}) })
}, },
async ensureVerified(actionText) { async ensureVerified(actionText) {
if (!this.requirePageLogin()) return false
const profile = await getIeProfile().catch(() => null) const profile = await getIeProfile().catch(() => null)
return ensureIeVerifiedBeforeAction({ return ensureIeVerifiedBeforeAction({
profile: profile || {}, profile: profile || {},

13
components/tab-bar/release.vue

@ -234,6 +234,7 @@
} from '@/common/campusApi.js' } from '@/common/campusApi.js'
import { getIeProfile } from '@/common/ieApi.js' import { getIeProfile } from '@/common/ieApi.js'
import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js' import { ensureIeVerifiedBeforeAction } from '@/common/ieRealNameAuth.js'
import { requireLoginToPage } from '@/utils/authRedirect.js'
const CHANNELS = [ const CHANNELS = [
{ tone: 'wall', name: '校园墙', desc: '新鲜事', icon: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f3b050e7f6d74bb9adca54de0bf3fc17.png' }, { tone: 'wall', name: '校园墙', desc: '新鲜事', icon: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f3b050e7f6d74bb9adca54de0bf3fc17.png' },
@ -510,13 +511,21 @@
}) })
}, },
loadUnread() { loadUnread() {
if (!uni.getStorageSync('hiver_token')) {
this.myCircleUnread = 0
return
}
getCampusUnreadSummary().then(summary => this.applyUnread(summary)).catch(() => {}) getCampusUnreadSummary().then(summary => this.applyUnread(summary)).catch(() => {})
}, },
applyUnread(summary = {}) { applyUnread(summary = {}) {
this.myCircleUnread = Number(summary.myCircleUnread || summary.campusUnread) || 0 this.myCircleUnread = Number(summary.myCircleUnread || summary.campusUnread) || 0
}, },
requirePageLogin() {
return requireLoginToPage('/pages/index/index?tabIndex=2')
},
selectCategory(tone) { selectCategory(tone) {
if (tone === 'mine') { if (tone === 'mine') {
if (!this.requirePageLogin()) return
uni.navigateTo({ url: '/package1/campus/myCampusPosts' }) uni.navigateTo({ url: '/package1/campus/myCampusPosts' })
return return
} }
@ -547,6 +556,7 @@
this.reload() this.reload()
}, },
startMatch() { startMatch() {
if (!this.requirePageLogin()) return
if (this.matching) return if (this.matching) return
this.matchKeyword = this.keyword || '' this.matchKeyword = this.keyword || ''
this.matchTag = this.selectedTag || '' this.matchTag = this.selectedTag || ''
@ -720,6 +730,7 @@
uni.previewImage({ urls, current: urls[index] || urls[0] }) uni.previewImage({ urls, current: urls[index] || urls[0] })
}, },
goDetail(item) { goDetail(item) {
if (!this.requirePageLogin()) return
uni.navigateTo({ url: '/package1/post/postDetail?id=' + item.id + '&source=campus' }) uni.navigateTo({ url: '/package1/post/postDetail?id=' + item.id + '&source=campus' })
}, },
async goPublish() { async goPublish() {
@ -737,6 +748,7 @@
}) })
}, },
async react(item, emoji) { async react(item, emoji) {
if (!this.requirePageLogin()) return
const key = item.id + ':' + emoji const key = item.id + ':' + emoji
const now = Date.now() const now = Date.now()
if (this.reactionLocks[key] && now - this.reactionLocks[key] < 1200) return if (this.reactionLocks[key] && now - this.reactionLocks[key] < 1200) return
@ -780,6 +792,7 @@
}, 3100) }, 3100)
}, },
async ensureVerified(actionText) { async ensureVerified(actionText) {
if (!this.requirePageLogin()) return false
const profile = await getIeProfile().catch(() => null) const profile = await getIeProfile().catch(() => null)
return ensureIeVerifiedBeforeAction({ return ensureIeVerifiedBeforeAction({
profile: profile || {}, profile: profile || {},

5
components/tab-bar/tab-bar.vue

@ -151,11 +151,6 @@
}, },
//tab //tab
clickBar(index) { clickBar(index) {
if (index !== 0 && !this.hasLogin()) {
this.goLogin(index)
return
}
for (let i = 0; i < this.tabList.length; i++) { for (let i = 0; i < this.tabList.length; i++) {
if (index == i) { if (index == i) {
this.$emit('tab-index', i); this.$emit('tab-index', i);

Loading…
Cancel
Save