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

209 lines
5.2 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
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. // uni.navigateTo({
  95. // url: '/otherPages/authentication/connectAddress/index'
  96. // });
  97. })
  98. const userInfo = computed(() => {
  99. return store.getters.userInfo
  100. })
  101. const configList = computed(() => {
  102. return store.getters.configList
  103. })
  104. // 获取轮播图
  105. const getBanner = async () => {
  106. const res = await banner()
  107. if (res.code === 200) {
  108. state.banner = [...res.data]
  109. }
  110. }
  111. // 申请加入合伙人
  112. const num = ref(0)
  113. const isoOpen = ref(false)
  114. const handleJoin = (type) => {
  115. num.value = Number(type)
  116. const info = uni.getStorageSync("baseInfo")
  117. if (!info) {
  118. uni.navigateTo({
  119. url: "/pages/login/index"
  120. })
  121. return
  122. }
  123. const baseInfo = JSON.parse(info)
  124. if (type === 1) {
  125. // 加入合伙人工作台
  126. joinHh({
  127. appUserId: baseInfo.userId
  128. }).then(res => {
  129. isoOpen.value = true
  130. changeBaseInfo(baseInfo.userId)
  131. }).catch(() => {})
  132. } else {
  133. // 加入伴宠师工作台
  134. joiBcs({
  135. appUserId: baseInfo.userId
  136. }).then(res => {
  137. isoOpen.value = true
  138. changeBaseInfo(baseInfo.userId)
  139. })
  140. }
  141. }
  142. // 更新基本信息
  143. const changeBaseInfo = (userId) => {
  144. getbaseInfo(userId).then(res => {
  145. })
  146. }
  147. const modalClose = () => {
  148. isoOpen.value = false
  149. if (num.value === 1) {
  150. show.value = false
  151. } else {
  152. show.value = false
  153. }
  154. }
  155. // 获取工作台图标
  156. const iconState = reactive({
  157. list1: [],
  158. list2: [],
  159. })
  160. const getpz = () => {
  161. indexConfig().then(res => {
  162. // 合伙人工作台菜单
  163. iconState.list1 = res?.rows?.slice(0, 4) || [];
  164. // 伴宠师工作台
  165. iconState.list2 = res?.rows?.slice(4) || [];
  166. })
  167. }
  168. const show = ref(true)
  169. const hhShow = ref(true)
  170. const handleGoto = (item) => {
  171. if(item.url) {
  172. uni.navigateTo({
  173. url: item.url
  174. })
  175. }
  176. }
  177. // 加入合伙人
  178. const handleAdd = (type) => {
  179. if (!getLoginStatus()) return
  180. switch (type) {
  181. case 1:
  182. break
  183. case 2:
  184. tab.navigateTo("/otherPages/workbenchManage/feedingStaff/index")
  185. break
  186. }
  187. }
  188. const handleOpen = () => {
  189. show.value = false
  190. }
  191. const handleBc = () => {
  192. uni.navigateTo({
  193. url: "/otherPages/authentication/list/index"
  194. })
  195. }
  196. </script>
  197. <style scoped lang="scss">
  198. @import "index";
  199. </style>