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

268 lines
6.7 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
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
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 class="icon-list"@click="handleGoto1()">
  67. <up-image class="mb20" :show-loading="true" width="68rpx"
  68. height="68rpx"></up-image>
  69. <view>123</view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <ModalCom :open="isoOpen" @close="modalClose" />
  75. <configPopup ref="configPopupRef" />
  76. </view>
  77. </template>
  78. <script setup>
  79. import ModalCom from "./components/modal.vue"
  80. import {
  81. onShow
  82. } from "@dcloudio/uni-app"
  83. import {
  84. banner,
  85. joinHh,
  86. joiBcs,
  87. indexConfig,
  88. indexConfigIco,
  89. getbaseInfo
  90. } from "../../api/home.js"
  91. import {
  92. computed,
  93. onMounted,
  94. reactive,
  95. ref
  96. } from "vue";
  97. import tab from "../../plugins/tab";
  98. import {
  99. getLoginStatus
  100. } from "../../utils/useMixin";
  101. import {
  102. useStore
  103. } from "vuex"
  104. import configPopup from '@/components/configPopup.vue'
  105. import { answeBaseIsFinish, answeTrainIsFinish } from '@/api/examination'
  106. import { code } from "../../uni_modules/uview-plus/libs/function/test";
  107. const configPopupRef = ref(null)
  108. const store = useStore();
  109. const state = reactive({
  110. banner: []
  111. })
  112. onMounted(() => {
  113. getBanner()
  114. getpz()
  115. })
  116. const userInfo = computed(() => {
  117. return store.getters.userInfo
  118. })
  119. const configList = computed(() => {
  120. return store.getters.configList
  121. })
  122. // 获取轮播图
  123. const getBanner = async () => {
  124. const res = await banner()
  125. if (res.code === 200) {
  126. state.banner = [...res.data]
  127. }
  128. }
  129. // 申请加入合伙人
  130. const num = ref(0)
  131. const isoOpen = ref(false)
  132. const handleJoin = (type) => {
  133. num.value = Number(type)
  134. const info = uni.getStorageSync("baseInfo")
  135. if (!info) {
  136. uni.navigateTo({
  137. url: "/pages/login/index"
  138. })
  139. return
  140. }
  141. const baseInfo = JSON.parse(info)
  142. if (type === 1) {
  143. // 加入合伙人工作台
  144. joinHh({
  145. appUserId: baseInfo.userId
  146. }).then(res => {
  147. isoOpen.value = true
  148. store.dispatch("getUserInfo");
  149. }).catch(() => {})
  150. } else {
  151. // 加入伴宠师工作台
  152. handleBc()
  153. // joiBcs({
  154. // appUserId: baseInfo.userId
  155. // }).then(res => {
  156. // isoOpen.value = true
  157. // changeBaseInfo(baseInfo.userId)
  158. // })
  159. }
  160. }
  161. // 更新基本信息
  162. const changeBaseInfo = (userId) => {
  163. getbaseInfo(userId).then(res => {
  164. })
  165. }
  166. const modalClose = () => {
  167. isoOpen.value = false
  168. if (num.value === 1) {
  169. show.value = false
  170. } else {
  171. show.value = false
  172. }
  173. }
  174. // 获取工作台图标
  175. const iconState = reactive({
  176. list1: [],
  177. list2: [],
  178. })
  179. const getpz = () => {
  180. indexConfig().then(res => {
  181. // 合伙人工作台菜单
  182. iconState.list1 = res?.rows?.slice(0, 4) || [];
  183. // 伴宠师工作台
  184. iconState.list2 = res?.rows?.slice(4) || [];
  185. })
  186. }
  187. const show = ref(true)
  188. const hhShow = ref(true)
  189. const handleGoto = (item) => {
  190. if(item.name == '平台手册'){
  191. // pet_platform_introduction
  192. return configPopupRef.value.open('pet_platform_introduction')
  193. }
  194. if(item.url) {
  195. uni.navigateTo({
  196. url: item.url
  197. })
  198. }
  199. }
  200. const handleGoto1 = () => {
  201. uni.navigateTo({
  202. url: '/otherPages/authentication/examination/train'
  203. })
  204. }
  205. // 加入合伙人
  206. const handleAdd = (type) => {
  207. if (!getLoginStatus()) return
  208. switch (type) {
  209. case 1:
  210. break
  211. case 2:
  212. tab.navigateTo("/otherPages/workbenchManage/feedingStaff/index")
  213. break
  214. }
  215. }
  216. const handleOpen = () => {
  217. show.value = false
  218. }
  219. const handleBc = async () => {
  220. if(!userInfo.value || !userInfo.value.userId){
  221. uni.navigateTo({
  222. url: "/otherPages/authentication/list/index"
  223. })
  224. return
  225. }
  226. uni.showLoading({
  227. title: '加载中...'
  228. })
  229. try{
  230. let code1 = await answeBaseIsFinish({userId : userInfo.value.userId})
  231. let code2 = await answeTrainIsFinish({userId : userInfo.value.userId})
  232. if(code1 && code2){
  233. uni.navigateTo({
  234. url: `/otherPages/authentication/examination/trainCompleted/index?status=0`
  235. })
  236. }else{
  237. uni.navigateTo({
  238. url: "/otherPages/authentication/list/index"
  239. })
  240. }
  241. }catch(e){
  242. uni.navigateTo({
  243. url: "/otherPages/authentication/list/index"
  244. })
  245. }finally{
  246. uni.hideLoading()
  247. }
  248. }
  249. </script>
  250. <style scoped lang="scss">
  251. @import "index";
  252. </style>