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

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