fix:重构前的保存
This commit is contained in:
parent
feeaa6a561
commit
e7104a1ae9
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -7,7 +7,7 @@
|
||||
"editor.tabSize": 1,
|
||||
"editor.formatOnPaste": true,
|
||||
"editor.guides.bracketPairs": "active",
|
||||
"files.autoSave": "off",
|
||||
"files.autoSave": "onFocusChange",
|
||||
"git.confirmSync": false,
|
||||
"workbench.startupEditor": "newUntitledFile",
|
||||
"editor.suggestSelection": "first",
|
||||
|
16
src/App.vue
16
src/App.vue
@ -1,17 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, nextTick } from 'vue'
|
||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
|
||||
import { parseUrlParams } from '@/utils/tool'
|
||||
import db from './utils/db'
|
||||
|
||||
onLaunch(() => {
|
||||
console.log('App Launch')
|
||||
})
|
||||
onShow(() => {
|
||||
console.log('App Show')
|
||||
})
|
||||
onHide(() => {
|
||||
console.log('App Hide')
|
||||
const { code } = parseUrlParams()
|
||||
if (code) {
|
||||
// 公众号回调地址传来的code
|
||||
db.set('code', code)
|
||||
}
|
||||
})
|
||||
onShow(() => {})
|
||||
onHide(() => {})
|
||||
</script>
|
||||
<style lang="scss">
|
||||
page {
|
||||
|
@ -1,27 +1,20 @@
|
||||
import $req from '../request'
|
||||
import { request } from '../request/request'
|
||||
import { http } from '../request/request'
|
||||
/**
|
||||
* 获取邀请配置
|
||||
* @param data 请求参数
|
||||
*/
|
||||
export const getJsapiSignatureApi = async (params: any) =>
|
||||
await request.get<any>('/wechatPublic/createJsapiSignature', params)
|
||||
await http.get<any>('/wechatPublic/createJsapiSignature', params)
|
||||
/**
|
||||
* 邀请绑定
|
||||
* @param data 请求参数
|
||||
*/
|
||||
export const parentBindInviteApi = (data: any) =>
|
||||
$req({
|
||||
method: 'post',
|
||||
url: '/parentBindInvite',
|
||||
data,
|
||||
})
|
||||
export const parentBindInviteApi = async (data: any) =>
|
||||
await http.post<any>('/parentBindInvite', data)
|
||||
|
||||
/**
|
||||
* 跳转邀请绑定页面后获取对应数据
|
||||
* @param data 请求参数
|
||||
*/
|
||||
export const getInviteInfoApi = id =>
|
||||
$req({
|
||||
method: 'get',
|
||||
url: `/parentBindInvite/${id}`,
|
||||
})
|
||||
export const getInviteInfoApi = async id => await http.get<any>(`/parentBindInvite/${id}`)
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $req from '../request'
|
||||
import { request } from '../request/request'
|
||||
import { http } from '../request/request'
|
||||
|
||||
/**
|
||||
* 家长绑定的孩子
|
||||
@ -16,7 +16,7 @@ export const getParentBindChildApi = (params: any) =>
|
||||
* @param params 请求参数
|
||||
*/
|
||||
export const getParentBindDeviceApi = async (params: any) =>
|
||||
await request.get<any>('/parentBindDevice/list', params)
|
||||
await http.get<any>('/parentBindDevice/list', params)
|
||||
/**
|
||||
* 我的孩子-绑定的家长
|
||||
* @param params 请求参数
|
||||
@ -51,7 +51,7 @@ export const parentUnBoundDeviceApi = (data: any) =>
|
||||
* @param params 请求参数
|
||||
*/
|
||||
export const parentDeviceCurrentLoginApi = async (id: string) =>
|
||||
await request.get<any>(`/parentBindDevice/${id}`)
|
||||
await http.get<any>(`/parentBindDevice/${id}`)
|
||||
|
||||
/**
|
||||
* 设备管理-绑定申请列表
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { type RequestOptions, type ResponseData } from './types'
|
||||
import type { RequestOptions, ResponseData } from './types'
|
||||
import { BASE_URL, REQUEST_TIMEOUT } from './config'
|
||||
import { requestInterceptor, responseInterceptor, errorInterceptor } from './interceptor'
|
||||
import obj from '@/utils/obj'
|
||||
@ -17,7 +17,7 @@ class HttpRequest {
|
||||
obj.clearNullProps(options.data)
|
||||
const interceptedOptions = await requestInterceptor(options)
|
||||
// URL处理
|
||||
let url = this.baseURL + interceptedOptions.url
|
||||
const url = this.baseURL + interceptedOptions.url
|
||||
const response = (await uni.request({
|
||||
...interceptedOptions,
|
||||
url,
|
||||
@ -39,6 +39,15 @@ class HttpRequest {
|
||||
})
|
||||
}
|
||||
|
||||
public async del<T>(url: string, data?: any, options: Partial<RequestOptions> = {}): Promise<T> {
|
||||
return this.http<T>({
|
||||
url,
|
||||
data,
|
||||
method: 'DELETE',
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
// 默认是json格式
|
||||
public async post<T>(url: string, data?: any, options: Partial<RequestOptions> = {}): Promise<T> {
|
||||
return this.http<T>({
|
||||
@ -53,6 +62,20 @@ class HttpRequest {
|
||||
})
|
||||
}
|
||||
|
||||
// 默认是json格式
|
||||
public async put<T>(url: string, data?: any, options: Partial<RequestOptions> = {}): Promise<T> {
|
||||
return this.http<T>({
|
||||
url,
|
||||
data,
|
||||
method: 'PUT',
|
||||
...options,
|
||||
header: {
|
||||
'Content-Type': 'application/json',
|
||||
...options.header,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 表单格式
|
||||
public async postForm<T>(
|
||||
url: string,
|
||||
@ -72,4 +95,4 @@ class HttpRequest {
|
||||
}
|
||||
}
|
||||
|
||||
export const request = new HttpRequest()
|
||||
export const http = new HttpRequest()
|
||||
|
@ -50,46 +50,46 @@
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { useRelation1, maskPhone } from '@/hooks';
|
||||
import type { ChildrenType, DeviceType } from './interface';
|
||||
import Empty from '@/components/Empty/index.vue';
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useRelation1, maskPhone } from '@/hooks'
|
||||
import type { ChildrenType, DeviceType } from '../interface'
|
||||
import Empty from '@/components/Empty/index.vue'
|
||||
import {
|
||||
getParentBindChildApi,
|
||||
getParentBindDeviceApi,
|
||||
childUnBoundParentApi,
|
||||
parentUnBoundDeviceApi,
|
||||
} from '@/api';
|
||||
import CustomPopup from '@/components/CustomPopup/index.vue';
|
||||
} from '@/api'
|
||||
import CustomPopup from '@/components/CustomPopup/index.vue'
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
type?: number; // 1-孩子账号 2-设备
|
||||
top?: number; // 顶部距离
|
||||
type?: number // 1-孩子账号 2-设备
|
||||
top?: number // 顶部距离
|
||||
}>(),
|
||||
{
|
||||
type: 1,
|
||||
top: 445,
|
||||
},
|
||||
);
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST;
|
||||
const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`;
|
||||
const showCustomPopup = ref(false);
|
||||
const unbind = ref<ChildrenType | DeviceType>();
|
||||
const dataList = ref<ChildrenType[] | DeviceType[]>();
|
||||
const paging = ref(null);
|
||||
)
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST
|
||||
const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`
|
||||
const showCustomPopup = ref(false)
|
||||
const unbind = ref<ChildrenType | DeviceType>()
|
||||
const dataList = ref<ChildrenType[] | DeviceType[]>()
|
||||
const paging = ref(null)
|
||||
|
||||
const detailInfo = ref<ChildrenType | DeviceType>();
|
||||
const detailInfo = ref<ChildrenType & DeviceType>()
|
||||
|
||||
const queryList = (pageNo: number, pageSize: number) => {
|
||||
if (props.type === 1) {
|
||||
getParentBindChildApi({ childId: detailInfo.value.childId, current: pageNo, size: pageSize })
|
||||
.then(res => {
|
||||
paging.value.complete(res.data.rows);
|
||||
paging.value.complete(res.data.rows)
|
||||
})
|
||||
.catch(res => {
|
||||
paging.value.complete(false);
|
||||
});
|
||||
paging.value.complete(false)
|
||||
})
|
||||
} else {
|
||||
getParentBindDeviceApi({
|
||||
simSerialNumber: detailInfo.value.simSerialNumber,
|
||||
@ -97,41 +97,41 @@ const queryList = (pageNo: number, pageSize: number) => {
|
||||
size: pageSize,
|
||||
})
|
||||
.then(res => {
|
||||
paging.value.complete(res.data.rows);
|
||||
paging.value.complete(res.data.rows)
|
||||
})
|
||||
.catch(res => {
|
||||
paging.value.complete(false);
|
||||
});
|
||||
paging.value.complete(false)
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
// 解绑
|
||||
function handleUnbind(i: ChildrenType | DeviceType) {
|
||||
showCustomPopup.value = true;
|
||||
unbind.value = i;
|
||||
showCustomPopup.value = true
|
||||
unbind.value = i
|
||||
}
|
||||
async function handleConfirmPopup() {
|
||||
uni.showLoading({
|
||||
title: '解绑中...',
|
||||
mask: true,
|
||||
});
|
||||
})
|
||||
if (props.type === 1) {
|
||||
await childUnBoundParentApi({
|
||||
parentId: unbind.value.parentId,
|
||||
childId: detailInfo.value.childId,
|
||||
});
|
||||
})
|
||||
} else {
|
||||
await parentUnBoundDeviceApi({
|
||||
parentId: unbind.value.parentId,
|
||||
simSerialNumber: detailInfo.value.simSerialNumber,
|
||||
});
|
||||
})
|
||||
}
|
||||
uni.hideLoading();
|
||||
paging.value.reload();
|
||||
showCustomPopup.value = false;
|
||||
uni.hideLoading()
|
||||
paging.value.reload()
|
||||
showCustomPopup.value = false
|
||||
}
|
||||
onLoad(option => {
|
||||
detailInfo.value = JSON.parse(decodeURIComponent(option.details));
|
||||
});
|
||||
detailInfo.value = JSON.parse(decodeURIComponent(option.details))
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.patriarch_list {
|
||||
|
@ -29,30 +29,30 @@
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import dayjs from 'dayjs';
|
||||
import bindPatriarch from './bindPatriarch.vue';
|
||||
import type { ChildrenType } from '../interface';
|
||||
import { user, shareConfigStore } from '@/store';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { parentBindInviteApi } from '@/api';
|
||||
import { onMounted } from 'vue';
|
||||
const { initWeixinShareConfig } = shareConfigStore();
|
||||
const { appId } = storeToRefs(shareConfigStore());
|
||||
const { userInfo } = storeToRefs(user());
|
||||
const detailInfo = ref<ChildrenType>({});
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST;
|
||||
const showMaskTip = ref(false); // 指示蒙层
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import dayjs from 'dayjs'
|
||||
import bindPatriarch from './bindPatriarch.vue'
|
||||
import type { ChildrenType } from '../interface'
|
||||
import { user, shareConfigStore } from '@/store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { parentBindInviteApi } from '@/api'
|
||||
import { onMounted } from 'vue'
|
||||
const { initWeixinShareConfig } = shareConfigStore()
|
||||
const { appId } = storeToRefs(shareConfigStore())
|
||||
const { userInfo } = storeToRefs(user())
|
||||
const detailInfo = ref<ChildrenType>({})
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST
|
||||
const showMaskTip = ref(false) // 指示蒙层
|
||||
async function share() {
|
||||
const { data } = await parentBindInviteApi({ bindId: detailInfo.value.id, bindType: 1 });
|
||||
const data = await parentBindInviteApi({ bindId: detailInfo.value.id, bindType: 1 })
|
||||
const options = {
|
||||
title: `[${userInfo.value.nickName}]邀请您一起绑定学小乐学习机`, // 分享的标题
|
||||
desc: '快来管理孩子的学习情况',
|
||||
link: `${import.meta.env.VITE_HOST}/#/pages/mine/inviteBind/index?id=${data.id}`, // 分享的链接
|
||||
imgUrl: `${OSS_URL}/urm/invite_bg.png`, // 分享的图片链接
|
||||
};
|
||||
await initWeixinShareConfig(options);
|
||||
}
|
||||
await initWeixinShareConfig(options)
|
||||
}
|
||||
async function clickShareBtn() {
|
||||
// 指示用户点击右上角
|
||||
@ -61,23 +61,23 @@ async function clickShareBtn() {
|
||||
title: '请稍后再试~',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
showMaskTip.value = true;
|
||||
showMaskTip.value = true
|
||||
// 开发测试使用
|
||||
// const { data } = await parentBindInviteApi({ bindId: detailInfo.value.id, bindType: 1 });
|
||||
// const data = await parentBindInviteApi({ bindId: detailInfo.value.id, bindType: 1 });
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/mine/inviteBind/index?id=${data.id}`,
|
||||
// });
|
||||
}
|
||||
|
||||
onLoad(option => {
|
||||
detailInfo.value = JSON.parse(decodeURIComponent(option.details));
|
||||
});
|
||||
detailInfo.value = JSON.parse(decodeURIComponent(option.details))
|
||||
})
|
||||
onMounted(async () => {
|
||||
share();
|
||||
});
|
||||
share()
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
|
@ -45,39 +45,39 @@
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app';
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { onLoad, onShareAppMessage } from '@dcloudio/uni-app'
|
||||
|
||||
import type { DeviceType, CurrentLoginAccountType } from '../interface';
|
||||
import type { DeviceType, CurrentLoginAccountType } from '../interface'
|
||||
|
||||
import bindPatriarch from './bindPatriarch.vue';
|
||||
import { parentDeviceCurrentLoginApi, parentBindInviteApi } from '@/api';
|
||||
import { user, shareConfigStore } from '@/store';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import dayjs from 'dayjs';
|
||||
import bindPatriarch from './bindPatriarch.vue'
|
||||
import { parentDeviceCurrentLoginApi, parentBindInviteApi } from '@/api'
|
||||
import { user, shareConfigStore } from '@/store'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
const { initWeixinShareConfig } = shareConfigStore();
|
||||
const { appId } = storeToRefs(shareConfigStore());
|
||||
const { userInfo } = storeToRefs(user());
|
||||
const showMaskTip = ref(false);
|
||||
const detailInfo = ref<DeviceType>();
|
||||
const currentLogin = ref<CurrentLoginAccountType>();
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST;
|
||||
const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`;
|
||||
const { initWeixinShareConfig } = shareConfigStore()
|
||||
const { appId } = storeToRefs(shareConfigStore())
|
||||
const { userInfo } = storeToRefs(user())
|
||||
const showMaskTip = ref(false)
|
||||
const detailInfo = ref<DeviceType>()
|
||||
const currentLogin = ref<CurrentLoginAccountType>()
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST
|
||||
const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`
|
||||
// 当前登录
|
||||
async function deviceCurrentLogin() {
|
||||
const { data } = await parentDeviceCurrentLoginApi(detailInfo.value.id);
|
||||
currentLogin.value = data;
|
||||
const { data } = await parentDeviceCurrentLoginApi(detailInfo.value.id)
|
||||
currentLogin.value = data
|
||||
}
|
||||
async function share() {
|
||||
const { data } = await parentBindInviteApi({ bindId: detailInfo.value.id, bindType: 0 });
|
||||
const data = await parentBindInviteApi({ bindId: detailInfo.value.id, bindType: 0 })
|
||||
const options = {
|
||||
title: `[${userInfo.value.nickName}]邀请您一起绑定学小乐学习机`, // 分享的标题
|
||||
desc: '快来管理设备的使用情况',
|
||||
link: `${import.meta.env.VITE_HOST}/#/pages/mine/inviteBind/index?id=${data.id}`, // 分享的链接
|
||||
imgUrl: `${OSS_URL}/urm/invite_bg.png`, // 分享的图片链接
|
||||
};
|
||||
await initWeixinShareConfig(options);
|
||||
}
|
||||
await initWeixinShareConfig(options)
|
||||
}
|
||||
async function clickShareBtn() {
|
||||
// 指示用户点击右上角
|
||||
@ -86,24 +86,24 @@ async function clickShareBtn() {
|
||||
title: '请稍后再试~',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
showMaskTip.value = true;
|
||||
showMaskTip.value = true
|
||||
// 开发测试使用
|
||||
// const { data } = await parentBindInviteApi({ bindId: detailInfo.value.id, bindType: 0 });
|
||||
// const data = await parentBindInviteApi({ bindId: detailInfo.value.id, bindType: 0 });
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/mine/inviteBind/index?id=${data.id}`,
|
||||
// });
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
deviceCurrentLogin();
|
||||
share();
|
||||
});
|
||||
deviceCurrentLogin()
|
||||
share()
|
||||
})
|
||||
onLoad(option => {
|
||||
detailInfo.value = JSON.parse(decodeURIComponent(option.details));
|
||||
});
|
||||
detailInfo.value = JSON.parse(decodeURIComponent(option.details))
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
|
@ -1,73 +1,73 @@
|
||||
// 我的孩子
|
||||
export interface ChildrenType {
|
||||
createTime?: string;
|
||||
createUser?: string;
|
||||
updateTime?: string;
|
||||
updateUser?: string;
|
||||
id?: string;
|
||||
parentId?: string;
|
||||
childId?: string;
|
||||
adminFlag?: number;
|
||||
identityType?: null;
|
||||
bindFlag?: number;
|
||||
bindTime?: string;
|
||||
unBindTime?: string;
|
||||
childName?: string;
|
||||
childAvatar?: string;
|
||||
parentName?: string;
|
||||
parentAvatar?: string;
|
||||
parentPhone?: string;
|
||||
vipEndTime?: string;
|
||||
currentLevel?: number;
|
||||
gradeId?: string;
|
||||
gradeName?: string;
|
||||
expLevel?: number;
|
||||
createTime?: string
|
||||
createUser?: string
|
||||
updateTime?: string
|
||||
updateUser?: string
|
||||
id?: string
|
||||
parentId?: string
|
||||
childId?: string
|
||||
adminFlag?: number
|
||||
identityType?: null
|
||||
bindFlag?: number
|
||||
bindTime?: string
|
||||
unBindTime?: string
|
||||
childName?: string
|
||||
childAvatar?: string
|
||||
parentName?: string
|
||||
parentAvatar?: string
|
||||
parentPhone?: string
|
||||
vipEndTime?: string
|
||||
currentLevel?: number
|
||||
gradeId?: string
|
||||
gradeName?: string
|
||||
expLevel?: number
|
||||
}
|
||||
// 我的设备
|
||||
export interface DeviceType {
|
||||
createTime?: string;
|
||||
createUser?: string;
|
||||
updateTime?: string;
|
||||
updateUser?: string;
|
||||
id?: string;
|
||||
parentId?: string;
|
||||
simSerialNumber?: string;
|
||||
adminFlag?: number;
|
||||
identityType?: number;
|
||||
bindFlag?: number;
|
||||
bindTime?: string;
|
||||
unBindTime?: string;
|
||||
parentName?: string;
|
||||
parentAvatar?: string;
|
||||
parentPhone?: string;
|
||||
firstLoginSimTime?: string;
|
||||
warrantyStatus?: string;
|
||||
warrantyEndTime?: string;
|
||||
createTime?: string
|
||||
createUser?: string
|
||||
updateTime?: string
|
||||
updateUser?: string
|
||||
id?: string
|
||||
parentId?: string
|
||||
simSerialNumber?: string
|
||||
adminFlag?: number
|
||||
identityType?: number
|
||||
bindFlag?: number
|
||||
bindTime?: string
|
||||
unBindTime?: string
|
||||
parentName?: string
|
||||
parentAvatar?: string
|
||||
parentPhone?: string
|
||||
firstLoginSimTime?: string
|
||||
warrantyStatus?: string
|
||||
warrantyEndTime?: string
|
||||
}
|
||||
// 当前登录
|
||||
export interface CurrentLoginAccountType {
|
||||
createTime?: string;
|
||||
createUser?: string;
|
||||
updateTime?: string;
|
||||
updateUser?: string;
|
||||
id?: string;
|
||||
parentId?: string;
|
||||
simSerialNumber?: string;
|
||||
adminFlag?: number;
|
||||
identityType?: number;
|
||||
bindFlag?: number;
|
||||
bindTime?: string;
|
||||
unBindTime?: string;
|
||||
parentName?: string;
|
||||
parentAvatar?: string;
|
||||
parentPhone?: string;
|
||||
firstLoginSimTime?: string;
|
||||
warrantyStatus?: string;
|
||||
warrantyEndTime?: string;
|
||||
curDeviceUserId?: string;
|
||||
curDeviceUserName?: string;
|
||||
curDeviceUserAvatar?: string;
|
||||
curDeviceUserAccount?: string;
|
||||
vipEndTime?: string;
|
||||
currentLevel?: number;
|
||||
createTime?: string
|
||||
createUser?: string
|
||||
updateTime?: string
|
||||
updateUser?: string
|
||||
id?: string
|
||||
parentId?: string
|
||||
simSerialNumber?: string
|
||||
adminFlag?: number
|
||||
identityType?: number
|
||||
bindFlag?: number
|
||||
bindTime?: string
|
||||
unBindTime?: string
|
||||
parentName?: string
|
||||
parentAvatar?: string
|
||||
parentPhone?: string
|
||||
firstLoginSimTime?: string
|
||||
warrantyStatus?: string
|
||||
warrantyEndTime?: string
|
||||
curDeviceUserId?: string
|
||||
curDeviceUserName?: string
|
||||
curDeviceUserAvatar?: string
|
||||
curDeviceUserAccount?: string
|
||||
vipEndTime?: string
|
||||
currentLevel?: number
|
||||
}
|
||||
|
@ -74,103 +74,102 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onLoad, onShow, onUnload } from '@dcloudio/uni-app';
|
||||
import { ref } from 'vue';
|
||||
import { getInviteInfoApi, parentBindApply, adminInfo } from '@/api';
|
||||
import { maskPhone } from '@/hooks';
|
||||
import CustomPopup from '@/components/CustomPopup/index.vue';
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST;
|
||||
const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`;
|
||||
const lightDefaultAvatar = `${OSS_URL}/urm/default_avatar_light.png`;
|
||||
const bg = `url(${OSS_URL}/urm/invite_tip_bg.png)`;
|
||||
const showCustomPopup = ref(false);
|
||||
const tipText = ref('您已绑定该学生账号!不用重复绑定哦~');
|
||||
const customPopupType = ref<number>(0); // 0-已绑定 1-未绑定已提交
|
||||
const inviterInfo = ref<any>({}); // 邀请信息
|
||||
const applyBindInfo = ref<any>({}); // 申请绑定
|
||||
import { onLoad, onShow, onUnload } from '@dcloudio/uni-app'
|
||||
import { ref } from 'vue'
|
||||
import { getInviteInfoApi, parentBindApply, adminInfo } from '@/api'
|
||||
import { maskPhone } from '@/hooks'
|
||||
import CustomPopup from '@/components/CustomPopup/index.vue'
|
||||
const OSS_URL = import.meta.env.VITE_OSS_HOST
|
||||
const defaultAvatar = `${OSS_URL}/urm/default_avatar.png`
|
||||
const lightDefaultAvatar = `${OSS_URL}/urm/default_avatar_light.png`
|
||||
const bg = `url(${OSS_URL}/urm/invite_tip_bg.png)`
|
||||
const showCustomPopup = ref(false)
|
||||
const tipText = ref('您已绑定该学生账号!不用重复绑定哦~')
|
||||
const customPopupType = ref<number>(0) // 0-已绑定 1-未绑定已提交
|
||||
const inviterInfo = ref<any>({}) // 邀请信息
|
||||
const applyBindInfo = ref<any>({}) // 申请绑定
|
||||
|
||||
const chooseRelation = ref<any>({}); // 家长选择关系
|
||||
const chooseRelation = ref<any>({}) // 家长选择关系
|
||||
|
||||
function subFun() {
|
||||
if (inviterInfo.value.bindFlag === 1) {
|
||||
showCustomPopup.value = true;
|
||||
customPopupType.value = 0;
|
||||
showCustomPopup.value = true
|
||||
customPopupType.value = 0
|
||||
tipText.value =
|
||||
inviterInfo.value.bindType === 1
|
||||
? '您已绑定该学生账号!不用重复绑定哦~'
|
||||
: '您已绑定该设备!不用重复绑定哦~';
|
||||
: '您已绑定该设备!不用重复绑定哦~'
|
||||
|
||||
return;
|
||||
return
|
||||
}
|
||||
if (inviterInfo.value.bindType === 0) {
|
||||
// 设备
|
||||
applyBindInfo.value.deviceDto = {
|
||||
simSerialNumber: inviterInfo.value.simSerialNumber,
|
||||
parentId: inviterInfo.value.inviteUserId,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// 孩子
|
||||
applyBindInfo.value.childDto = {
|
||||
childId: inviterInfo.value.childId,
|
||||
identityType: chooseRelation.value.id,
|
||||
parentId: inviterInfo.value.inviteUserId,
|
||||
};
|
||||
}
|
||||
}
|
||||
if (inviterInfo.value.bindType === 1 && !chooseRelation.value.id) {
|
||||
uni.showToast({
|
||||
title: '请选择亲子关系',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
parentBindApply(applyBindInfo.value).then(res => {
|
||||
showCustomPopup.value = true;
|
||||
customPopupType.value = 1;
|
||||
showCustomPopup.value = true
|
||||
customPopupType.value = 1
|
||||
// uni.showToast({ title: '已提交申请,请耐心等待管理员审核!', icon: 'none' });
|
||||
});
|
||||
})
|
||||
}
|
||||
// 选择关系
|
||||
function chooseRelative() {
|
||||
if (inviterInfo.value.bindFlag === 1) {
|
||||
showCustomPopup.value = true;
|
||||
customPopupType.value = 0;
|
||||
tipText.value = '您已绑定该学生账号!不用重复绑定哦~';
|
||||
return;
|
||||
showCustomPopup.value = true
|
||||
customPopupType.value = 0
|
||||
tipText.value = '您已绑定该学生账号!不用重复绑定哦~'
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/mine/inviteBind/relationShips',
|
||||
});
|
||||
})
|
||||
}
|
||||
function handleConfirmPopup() {
|
||||
showCustomPopup.value = false;
|
||||
showCustomPopup.value = false
|
||||
}
|
||||
// 获取邀请信息
|
||||
async function getInviteInfo(id: string) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
});
|
||||
const { data } = await getInviteInfoApi(id);
|
||||
inviterInfo.value = data;
|
||||
})
|
||||
inviterInfo.value = await getInviteInfoApi(id)
|
||||
} catch (err) {
|
||||
console.log('邀请绑定错误', err);
|
||||
console.log('邀请绑定错误', err)
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(option => {
|
||||
getInviteInfo(option.id);
|
||||
});
|
||||
getInviteInfo(option.id)
|
||||
})
|
||||
onShow(() => {
|
||||
uni.$on('updateChooseRelation', data => {
|
||||
chooseRelation.value = JSON.parse(decodeURIComponent(data.relation));
|
||||
});
|
||||
});
|
||||
chooseRelation.value = JSON.parse(decodeURIComponent(data.relation))
|
||||
})
|
||||
})
|
||||
onUnload(() => {
|
||||
uni.$off('updateChooseRelation');
|
||||
});
|
||||
uni.$off('updateChooseRelation')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
Loading…
x
Reference in New Issue
Block a user