| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <template>
- <view class="container">
- <!-- 分段器区域 -->
- <common-controlTag :tagList="tagList" :currentIndex="currentIndex" @change="handleChange"></common-controlTag>
- <view v-if="currentIndex == 0">
- <school-photo-upload-box :type="type" :currentId="currentId" @change="changeIndex"></school-photo-upload-box>
- </view>
- <view v-if="currentIndex == 1">
- <school-photo-upload-my :type="type"></school-photo-upload-my>
- </view>
- </view>
- </template>
- <script setup>
- import { onLoad } from '@dcloudio/uni-app'
- import { ref } from 'vue'
- // 1为活动相册 2为校友相册
- const type = ref()
- // 分段器数组
- const tagList = ['上传照片', '我上传的']
- // 分段器当前索引
- const currentIndex = ref(0)
- // 活动ID
- const currentId = ref()
- onLoad((options) => {
- if (options.type) {
- type.value = options.type
- }
- if (options.currentId) {
- currentId.value = options.currentId
- }
- if (options.type == 1) {
- uni.setNavigationBarTitle({
- title: '上传照片'
- })
- }
- if (options.type == 2) {
- uni.setNavigationBarTitle({
- title: '校友相册'
- })
- }
- })
- // 分段器切换回调
- const handleChange = (e) => {
- if (currentIndex.value != e) {
- currentIndex.value = e
- // console.log(e)
- }
- }
- // 自定义事件
- const changeIndex = (e) => {
- // console.log(e);
- currentIndex.value = e
- }
- </script>
- <style lang="scss" scoped>
- .container {
- padding: 20rpx 18rpx;
- min-height: 100vh;
- }
- </style>
|