|
@@ -49,6 +49,8 @@
|
|
|
<script setup lang="ts">
|
|
|
import moment from 'moment';
|
|
|
import { getCurrentInstance, computed, ref } from 'vue';
|
|
|
+ //该依赖已内置不需要单独安装
|
|
|
+ import { onShow, onPullDownRefresh } from "@dcloudio/uni-app";
|
|
|
// 请求接口
|
|
|
const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
|
|
|
// openid
|
|
@@ -100,45 +102,60 @@
|
|
|
]
|
|
|
}
|
|
|
const uForm = ref(null);
|
|
|
+ onShow(() => {
|
|
|
+ if (openid.value) search();
|
|
|
+ })
|
|
|
+ // 查询
|
|
|
+ const search = async () => {
|
|
|
+ const res = await $api(`login/wxapp/${openid.value}`, 'POST', {});
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ form.value = res.data
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ };
|
|
|
// 开始验证
|
|
|
const formSubmit = () => {
|
|
|
if (agree.value) {
|
|
|
- // if (openid.value) {
|
|
|
- uForm.value.validate().then(async res => {
|
|
|
- console.log(form.value);
|
|
|
- }).catch(err => {
|
|
|
- console.log(err, '校验失败');
|
|
|
- })
|
|
|
- // uni.getUserProfile({
|
|
|
- // desc: '用于展示',
|
|
|
- // success: async function (res) {
|
|
|
- // let parmas = {
|
|
|
- // openid: openid.value,
|
|
|
- // nickname: res.userInfo.nickName + moment().valueOf()
|
|
|
- // }
|
|
|
- // const arr = await $api(`user`, 'POST', parmas);
|
|
|
- // if (arr.errcode == '0') {
|
|
|
- // uni.setStorageSync('user', arr.data);
|
|
|
- // uni.navigateBack({
|
|
|
- // delta: 1
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // uni.showToast({
|
|
|
- // title: arr.errmsg,
|
|
|
- // icon: 'error'
|
|
|
- // });
|
|
|
- // }
|
|
|
- // },
|
|
|
- // fail: function (err) {
|
|
|
- // console.log(err);
|
|
|
- // }
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // uni.showToast({
|
|
|
- // title: '系统更新中,请稍后再试!',
|
|
|
- // icon: 'none'
|
|
|
- // })
|
|
|
- // }
|
|
|
+ if (openid.value) {
|
|
|
+ uForm.value.validate().then(async res => {
|
|
|
+ console.log(form.value);
|
|
|
+ // uni.getUserProfile({
|
|
|
+ // desc: '用于展示',
|
|
|
+ // success: async function (res) {
|
|
|
+ // let parmas = {
|
|
|
+ // openid: openid.value,
|
|
|
+ // nickname: res.userInfo.nickName + moment().valueOf()
|
|
|
+ // }
|
|
|
+ // const arr = await $api(`user`, 'POST', parmas);
|
|
|
+ // if (arr.errcode == '0') {
|
|
|
+ // uni.setStorageSync('user', arr.data);
|
|
|
+ // uni.navigateBack({
|
|
|
+ // delta: 1
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // uni.showToast({
|
|
|
+ // title: arr.errmsg,
|
|
|
+ // icon: 'error'
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // fail: function (err) {
|
|
|
+ // console.log(err);
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ }).catch(err => {
|
|
|
+ console.log(err, '校验失败');
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '系统更新中,请稍后再试!',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: '请阅读并同意用户协议和隐私政策',
|