猫妈狗爸伴宠师小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

217 lines
5.4 KiB

<template>
<view>
<view class="swiper-container">
<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" style="height: 370rpx;">
<swiper-item class="w-100 h-100" v-for="item in state.banner" :key="item.id">
<image class="w-100 h-100" :src="item.image" mode=""></image>
</swiper-item>
</swiper>
</view>
<view class="container">
<view class="container-list">
<view class="mb28 col3 font32">合伙人工作台</view>
<!-- 申请加入 -->
<view class="container-list-but font28" v-if="userInfo.userHh != 1">
<view class="explain">
<view class="explain-text">
<text>{{ configList?.partner_work_statement?.paramValueText }}</text>
<view class="font24 add-but col-white join" @click="handleJoin(1)">申请加入 ></view>
</view>
<image class="explain-img" :src="configList?.partner_work_statement?.paramValueImage"
mode="aspectFit"></image>
</view>
</view>
<!-- 申请加入后 -->
<view class="flex flex-between font24 flex-wrap" v-if="userInfo.userHh==1">
<view class="icon-list" @click="handleGoto(item)" v-for="item in iconState.list1" :key="item.id">
<up-image class="mb20" :show-loading="true" :src="item.image" width="68rpx"
height="68rpx"></up-image>
<view>{{item.name}}</view>
</view>
<view class="icon-list"></view>
</view>
</view>
<view class="container-list">
<view class="mb28 col3 font32">伴宠师工作台</view>
<!-- 申请之前 -->
<view class="container-list-but" style="background: #FFECE5" v-if="userInfo.userBcs != 1">
<view class="explain">
<view class="explain-text">
<text>{{ configList?.pet_teacher_statement?.paramValueText }}</text>
<view class="font24 add-but col-white join" @click="handleJoin(2)"
style="background: #FF7935">申请加入 ></view>
</view>
<image class="explain-img" :src="configList?.pet_teacher_statement?.paramValueImage"
mode="aspectFit"></image>
</view>
</view>
<!-- 申请之后 -->
<view class="flex-rowl flex-wrap" v-if="userInfo.userBcs == 1" >
<view class="icon-list" v-for="item in iconState.list2" :key="item.id" @click="handleGoto(item)">
<up-image class="mb20" :show-loading="true" :src="item.image" width="68rpx"
height="68rpx"></up-image>
<view>{{ item.name }}</view>
</view>
</view>
</view>
</view>
<ModalCom :open="isoOpen" @close="modalClose" />
<configPopup ref="configPopupRef" />
</view>
</template>
<script setup>
import ModalCom from "./components/modal.vue"
import {
onShow
} from "@dcloudio/uni-app"
import {
banner,
joinHh,
joiBcs,
indexConfig,
indexConfigIco,
getbaseInfo
} from "../../api/home.js"
import {
computed,
onMounted,
reactive,
ref
} from "vue";
import tab from "../../plugins/tab";
import {
getLoginStatus
} from "../../utils/useMixin";
import {
useStore
} from "vuex"
import configPopup from '@/components/configPopup.vue'
const configPopupRef = ref(null)
const store = useStore();
const state = reactive({
banner: []
})
onMounted(() => {
getBanner()
getpz()
})
const userInfo = computed(() => {
return store.getters.userInfo
})
const configList = computed(() => {
return store.getters.configList
})
// 获取轮播图
const getBanner = async () => {
const res = await banner()
if (res.code === 200) {
state.banner = [...res.data]
}
}
// 申请加入合伙人
const num = ref(0)
const isoOpen = ref(false)
const handleJoin = (type) => {
num.value = Number(type)
const info = uni.getStorageSync("baseInfo")
if (!info) {
uni.navigateTo({
url: "/pages/login/index"
})
return
}
const baseInfo = JSON.parse(info)
if (type === 1) {
// 加入合伙人工作台
joinHh({
appUserId: baseInfo.userId
}).then(res => {
isoOpen.value = true
store.dispatch("getUserInfo");
}).catch(() => {})
} else {
// 加入伴宠师工作台
handleBc()
// joiBcs({
// appUserId: baseInfo.userId
// }).then(res => {
// isoOpen.value = true
// changeBaseInfo(baseInfo.userId)
// })
}
}
// 更新基本信息
const changeBaseInfo = (userId) => {
getbaseInfo(userId).then(res => {
})
}
const modalClose = () => {
isoOpen.value = false
if (num.value === 1) {
show.value = false
} else {
show.value = false
}
}
// 获取工作台图标
const iconState = reactive({
list1: [],
list2: [],
})
const getpz = () => {
indexConfig().then(res => {
// 合伙人工作台菜单
iconState.list1 = res?.rows?.slice(0, 4) || [];
// 伴宠师工作台
iconState.list2 = res?.rows?.slice(4) || [];
})
}
const show = ref(true)
const hhShow = ref(true)
const handleGoto = (item) => {
if(item.name == '平台手册'){
// pet_platform_introduction
return configPopupRef.value.open('pet_platform_introduction')
}
if(item.url) {
uni.navigateTo({
url: item.url
})
}
}
// 加入合伙人
const handleAdd = (type) => {
if (!getLoginStatus()) return
switch (type) {
case 1:
break
case 2:
tab.navigateTo("/otherPages/workbenchManage/feedingStaff/index")
break
}
}
const handleOpen = () => {
show.value = false
}
const handleBc = () => {
uni.navigateTo({
url: "/otherPages/authentication/list/index"
})
}
</script>
<style scoped lang="scss">
@import "index";
</style>