猫妈狗爸伴宠师小程序前端代码
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.

207 lines
5.1 KiB

3 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
3 months ago
2 months ago
2 months ago
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view>
  3. <view class="swiper-container">
  4. <swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" style="height: 370rpx;">
  5. <swiper-item class="w-100 h-100" v-for="item in state.banner" :key="item.id">
  6. <image class="w-100 h-100" :src="item.image" mode=""></image>
  7. </swiper-item>
  8. </swiper>
  9. </view>
  10. <view class="container">
  11. <view class="container-list">
  12. <view class="mb28 col3 font32">合伙人工作台</view>
  13. <!-- 申请加入 -->
  14. <view class="container-list-but font28" v-if="userInfo.userHh != 1">
  15. <view class="explain">
  16. <view class="explain-text">
  17. <text>{{ configList?.partner_work_statement?.paramValueText }}</text>
  18. <view class="font24 add-but col-white join" @click="handleJoin(1)">申请加入 ></view>
  19. </view>
  20. <image class="explain-img" :src="configList?.partner_work_statement?.paramValueImage"
  21. mode="aspectFit"></image>
  22. </view>
  23. </view>
  24. <!-- 申请加入后 -->
  25. <view class="flex flex-between font24 flex-wrap" v-if="userInfo.userHh==1">
  26. <view class="icon-list" @click="handleGoto(item)" v-for="item in iconState.list1" :key="item.id">
  27. <up-image class="mb20" :show-loading="true" :src="item.image" width="68rpx"
  28. height="68rpx"></up-image>
  29. <view>{{item.name}}</view>
  30. </view>
  31. <view class="icon-list"></view>
  32. </view>
  33. </view>
  34. <view class="container-list">
  35. <view class="mb28 col3 font32">伴宠师工作台</view>
  36. <!-- 申请之前 -->
  37. <view class="container-list-but" style="background: #FFECE5" v-if="userInfo.userBcs != 1">
  38. <view class="explain">
  39. <view class="explain-text">
  40. <text>{{ configList?.pet_teacher_statement?.paramValueText }}</text>
  41. <view class="font24 add-but col-white join" @click="handleJoin(2)"
  42. style="background: #FF7935">申请加入 ></view>
  43. </view>
  44. <image class="explain-img" :src="configList?.pet_teacher_statement?.paramValueImage"
  45. mode="aspectFit"></image>
  46. </view>
  47. </view>
  48. <!-- 申请之后 -->
  49. <view class="flex-rowl flex-wrap" v-if="userInfo.userBcs == 1" >
  50. <view class="icon-list" v-for="item in iconState.list2" :key="item.id" @click="handleGoto(item)">
  51. <up-image class="mb20" :show-loading="true" :src="item.image" width="68rpx"
  52. height="68rpx"></up-image>
  53. <view>{{ item.name }}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <ModalCom :open="isoOpen" @close="modalClose" />
  59. </view>
  60. </template>
  61. <script setup>
  62. import ModalCom from "./components/modal.vue"
  63. import {
  64. onShow
  65. } from "@dcloudio/uni-app"
  66. import {
  67. banner,
  68. joinHh,
  69. joiBcs,
  70. indexConfig,
  71. indexConfigIco,
  72. getbaseInfo
  73. } from "../../api/home.js"
  74. import {
  75. computed,
  76. onMounted,
  77. reactive,
  78. ref
  79. } from "vue";
  80. import tab from "../../plugins/tab";
  81. import {
  82. getLoginStatus
  83. } from "../../utils/useMixin";
  84. import {
  85. useStore
  86. } from "vuex"
  87. const store = useStore();
  88. const state = reactive({
  89. banner: []
  90. })
  91. onMounted(() => {
  92. getBanner()
  93. getpz()
  94. })
  95. const userInfo = computed(() => {
  96. return store.getters.userInfo
  97. })
  98. const configList = computed(() => {
  99. return store.getters.configList
  100. })
  101. // 获取轮播图
  102. const getBanner = async () => {
  103. const res = await banner()
  104. if (res.code === 200) {
  105. state.banner = [...res.data]
  106. }
  107. }
  108. // 申请加入合伙人
  109. const num = ref(0)
  110. const isoOpen = ref(false)
  111. const handleJoin = (type) => {
  112. num.value = Number(type)
  113. const info = uni.getStorageSync("baseInfo")
  114. if (!info) {
  115. uni.navigateTo({
  116. url: "/pages/login/index"
  117. })
  118. return
  119. }
  120. const baseInfo = JSON.parse(info)
  121. if (type === 1) {
  122. // 加入合伙人工作台
  123. joinHh({
  124. appUserId: baseInfo.userId
  125. }).then(res => {
  126. isoOpen.value = true
  127. store.dispatch("getUserInfo");
  128. }).catch(() => {})
  129. } else {
  130. // 加入伴宠师工作台
  131. handleBc()
  132. // joiBcs({
  133. // appUserId: baseInfo.userId
  134. // }).then(res => {
  135. // isoOpen.value = true
  136. // changeBaseInfo(baseInfo.userId)
  137. // })
  138. }
  139. }
  140. // 更新基本信息
  141. const changeBaseInfo = (userId) => {
  142. getbaseInfo(userId).then(res => {
  143. })
  144. }
  145. const modalClose = () => {
  146. isoOpen.value = false
  147. if (num.value === 1) {
  148. show.value = false
  149. } else {
  150. show.value = false
  151. }
  152. }
  153. // 获取工作台图标
  154. const iconState = reactive({
  155. list1: [],
  156. list2: [],
  157. })
  158. const getpz = () => {
  159. indexConfig().then(res => {
  160. // 合伙人工作台菜单
  161. iconState.list1 = res?.rows?.slice(0, 4) || [];
  162. // 伴宠师工作台
  163. iconState.list2 = res?.rows?.slice(4) || [];
  164. })
  165. }
  166. const show = ref(true)
  167. const hhShow = ref(true)
  168. const handleGoto = (item) => {
  169. if(item.url) {
  170. uni.navigateTo({
  171. url: item.url
  172. })
  173. }
  174. }
  175. // 加入合伙人
  176. const handleAdd = (type) => {
  177. if (!getLoginStatus()) return
  178. switch (type) {
  179. case 1:
  180. break
  181. case 2:
  182. tab.navigateTo("/otherPages/workbenchManage/feedingStaff/index")
  183. break
  184. }
  185. }
  186. const handleOpen = () => {
  187. show.value = false
  188. }
  189. const handleBc = () => {
  190. uni.navigateTo({
  191. url: "/otherPages/authentication/list/index"
  192. })
  193. }
  194. </script>
  195. <style scoped lang="scss">
  196. @import "index";
  197. </style>