Browse Source

Merge pull request 'feat: 接口对接;' (#6) from fox into master

Reviewed-on: http://175.178.51.79:3000/Augcl/pet-front/pulls/6
pull/7/head
Fox 3 weeks ago
parent
commit
188c013d15
8 changed files with 191 additions and 49 deletions
  1. +21
    -0
      api/userTeacher.js
  2. +6
    -2
      otherPages/authentication/components/questionCard.vue
  3. +13
    -5
      otherPages/authentication/examination/trainCompleted/index.vue
  4. +3
    -1
      otherPages/authentication/examination/trainCompleted/waiting.vue
  5. +94
    -12
      otherPages/authentication/list/index.vue
  6. +40
    -20
      pages/login/index.vue
  7. +7
    -6
      pages/workbenchManage/index.vue
  8. +7
    -3
      utils/getUrl.js

+ 21
- 0
api/userTeacher.js View File

@ -9,4 +9,25 @@ export const insertUser = (data) => {
method: 'post',
data
})
}
export const udpateUser = (data) => {
return request({
url: '/applet/UserTeacher/udpateUser',
headers: {
isToken: true
},
method: 'post',
data
})
}
// 伴宠师工作台-查询专业执照列表
export const getUserOne = (appUserId) => {
return request({
url: `/applet/UserTeacher/getUserOne/${appUserId}`,
method: "get"
}).then(res => {
return res.data
})
}

+ 6
- 2
otherPages/authentication/components/questionCard.vue View File

@ -58,6 +58,11 @@
<script setup>
import { computed, watch } from 'vue'
import { addBaseAnswer, addTrainAnswer } from '@/api/examination'
import { store } from '@/store'
const userId = computed(() => {
return store.state.user.userInfo.userId
})
const props = defineProps({
index: {
@ -98,9 +103,8 @@ const value = computed({
const onChange = (val) => {
value.value = val
console.log('--onChange', val)
const data = {
userId: userId.value,
questionId: props.data.id,
}


+ 13
- 5
otherPages/authentication/examination/trainCompleted/index.vue View File

@ -15,7 +15,7 @@
<script setup>
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { onLoad } from '@dcloudio/uni-app'
import stepProgress from '../../components/stepProgress.vue';
import waitingView from './waiting.vue'
@ -24,10 +24,18 @@
const status = ref('waiting')
onShow(() => {
// todo: fetch audit status
status.value = 'pass'
onLoad((option) => {
switch(option?.status) {
case '1':
status.value = 'pass'
break
case '2':
status.value = 'fail'
break
default:
status.value = 'waiting'
break
}
})
</script>


+ 3
- 1
otherPages/authentication/examination/trainCompleted/waiting.vue View File

@ -18,7 +18,9 @@
const configList = store.state.system.configList
const onClick = () => {
// todo
uni.reLaunch({
url: "/pages/workbenchManage/index"
})
}
</script>


+ 94
- 12
otherPages/authentication/list/index.vue View File

@ -13,7 +13,7 @@
<dForm ref="formRef" :list="state.list" labelWidth="220rpx" :isFooter="false" @input="onFormInput"></dForm>
</view>
<view class="license__view" v-if="form.license">
<view class="license__view" v-if="form.isHave">
<view class="license">
<up-checkbox-group
v-model="licenseData.selected"
@ -75,11 +75,11 @@
</template>
<script setup>
import { ref, reactive } from "vue";
import { onShow } from '@dcloudio/uni-app'
import { ref, reactive, computed } from "vue";
import { onLoad } from '@dcloudio/uni-app'
import { ossUpload } from '@/utils/oss-upload/oss/index.js'
import { getLicenseList, getPetTypeList } from '@/api/examination'
import { insertUser } from '@/api/userTeacher'
import { insertUser, udpateUser, getUserOne } from '@/api/userTeacher'
import { store } from '@/store'
import dForm from "@/components/dForm/index.vue"
@ -87,6 +87,12 @@
const configList = store.state.system.configList
const userId = computed(() => {
return store.state.user.userInfo.userId
})
const id = ref(null)
const state = reactive({
list: [{
type: "input",
@ -120,6 +126,12 @@
key: "age",
placeholder: "请输入您的年龄",
},
{
type: "input",
label: "手机号",
key: "phone",
placeholder: "请输入您的手机号",
},
{
type: "input",
label: "养宠经验",
@ -130,7 +142,7 @@
{
type: "radio",
label: "是否有专业执照",
key: "license",
key: "isHave",
placeholder: "请选择",
options: [{
name: "是",
@ -149,6 +161,66 @@
form.value = e
}
const fetchUserInfo = async () => {
try {
const { userTelephone } = store.state.user.userInfo
const data = await getUserOne(userId.value)
if (data) {
const {
id: _id,
status,
name,
idCard,
sex,
age,
phone,
experience,
isHave,
license,
images,
petType: _petType,
} = data
if ([1,2].includes(status)) { // status: 0- 1- 2-
uni.navigateTo({
url: `/otherPages/authentication/examination/trainCompleted/index?status=${status}`
})
return
}
id.value = _id
formRef.value.setData({
name,
idCard,
sex,
age,
phone: phone || userTelephone,
experience,
isHave,
})
licenseData.selected = license?.split?.(';').map(str => parseInt(str)) || []
licenseData.fileList = images?.split?.(';').map(url => ({ url })) || []
petType.value = _petType
} else {
formRef.value.setData({
phone: userTelephone,
})
}
fetchPetTypeOptions()
fetchLicenseOptions()
} catch (err) {
console.log('--err', err)
}
}
const licenseData = reactive({
selected: [],
fileList: []
@ -195,27 +267,36 @@
idCard,
sex,
age,
phone,
experience,
license,
isHave,
} = form.value
const data = {
userId: userId.value,
name,
idCard,
sex,
age,
phone,
experience,
isHave,
petType: petType.value,
}
if (license) {
if (isHave) {
const { selected, fileList } = licenseData
data.license = selected.join(';')
data.images = fileList.join(';')
data.images = fileList.map(item => item.url).join(';')
}
await insertUser(data)
if (id.value) {
data.id = id.value
await udpateUser(data)
} else {
await insertUser(data)
}
uni.setStorageSync('petTypeData', petTypeOptions.value.find(item => item.id === petType.value))
@ -227,9 +308,10 @@
}
}
onShow(() => {
fetchPetTypeOptions()
fetchLicenseOptions()
onLoad(() => {
fetchUserInfo()
})
</script>


+ 40
- 20
pages/login/index.vue View File

@ -5,22 +5,32 @@
<image class="d" :src="configList?.logo_icon?.paramValueImage" mode="aspectFill"></image>
</view>
<view class="login-submit">
<up-button class="mt24" type="primary" text="微信授权登陆" @tap="loginWx" shape="circle"
color="#FFBF60"></up-button>
<up-button @click="cancelLogin" class="mt24" type="primary" text="取消登录" shape="circle"
<up-button class="mt24" type="primary" text="微信授权登陆" @click="loginWx" shape="circle"
color="#FFBF60"></up-button>
</view>
<view class="flex-rowc">
<view class="select">
<image mode="widthFix"></image>
<view>
<up-checkbox
v-model:checked="isAgree"
size="29rpx"
icon-size="29rpx"
name="agree"
usedAlone
shape="circle"
activeColor="#FFBF60"
>
</up-checkbox>
</view>
<view class="size-26">
<view class="size-26 agreement">
<text>我已阅读并同意猫爸狗妈</text>
<text @click="privacyPolicy('login_xy')" class="main-color">注册协议</text>
<text></text>
<text @click="privacyPolicy('login_ys')" class="main-color">隐私政策</text>
</view>
</view>
<view class="login-footer flex-rowc">
<button @click="cancelLogin" class="btn-cancel" plain >暂不登录</button>
</view>
</view>
<up-popup :show="show" @close="close" :round="10">
@ -60,8 +70,16 @@
const show = ref(false)
const content = ref('')
const isAgree = ref(false)
//
const loginWx = () => {
if (!isAgree.value) {
return uni.showToast({
title: '请先同意隐私协议',
icon:'none'
})
}
store.dispatch("login")
}
@ -149,22 +167,24 @@
@import "index";
@import "@/style/index.scss";
.select {
width: 24rpx;
height: 24rpx;
border-radius: 50%;
border: 1rpx solid #C7C7C7;
margin-right: 8rpx;
.active {
background-color: $mainColor;
}
.agreement {
color: #C7C7C7;
font-size: 22rpx;
line-height: 29rpx;
}
.footer {
color: #C7C7C7;
.login-footer {
width: 100vw;
position: fixed;
bottom: 100rpx;
bottom: 127rpx;
.btn-cancel {
color: #C7C7C7;
font-size: 30rpx;
line-height: 40rpx;
border: none;
display: inline-block;
padding: 0;
}
}
</style>

+ 7
- 6
pages/workbenchManage/index.vue View File

@ -135,12 +135,13 @@
}).catch(() => {})
} else {
//
joiBcs({
appUserId: baseInfo.userId
}).then(res => {
isoOpen.value = true
changeBaseInfo(baseInfo.userId)
})
handleBc()
// joiBcs({
// appUserId: baseInfo.userId
// }).then(res => {
// isoOpen.value = true
// changeBaseInfo(baseInfo.userId)
// })
}
}
//


+ 7
- 3
utils/getUrl.js View File

@ -3,12 +3,16 @@ const accountInfo = wx.getAccountInfoSync();
current = accountInfo.miniProgram.envVersion;
const api = {
develop: "http://youyi-test.natapp1.cc/prod-api", // 开发
trial: "http://h5.xzaiyp.top", //测试
release: "http://h5.xzaiyp.top", // 线上
develop: "http://h5.xzaiyp.top/prod-api", // 开发
trial: "http://h5.xzaiyp.top/prod-api", //测试
release: "http://h5.xzaiyp.top/prod-api", // 线上
}
console.log('--current', current)
const currentUrl = api[current];
console.log('--currentUrl', currentUrl)
export {
currentUrl
};

Loading…
Cancel
Save