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

18
components/tab-bar/myCenter.vue

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

9
components/tab-bar/postList.vue

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

13
components/tab-bar/release.vue

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

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

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

Loading…
Cancel
Save