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