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

243 lines
6.1 KiB

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