小程序最新修改

This commit is contained in:
shidongli 2022-08-26 17:51:21 +08:00
parent a4d147c26c
commit 4de1689c2d
4 changed files with 73 additions and 152 deletions

View File

@ -44,7 +44,7 @@
},
onLoad(options) {
console.log(options)
this.studentId=options.studentId
this.studentId = options.studentId
this.getStudentScore()
},
@ -89,7 +89,7 @@
align-items: center;
background-color: #ffffff;
min-height: 100vh;
background-image: linear-gradient(#55C5E3,#fff);
background-image: linear-gradient(#55C5E3, #fff);
}
/* 测试成绩 */
@ -116,6 +116,7 @@
margin-bottom: 40rpx;
border-radius: 20rpx;
}
.itemName {
height: 100rpx;
width: 50%;

View File

@ -134,7 +134,8 @@
</template>
<script>
import {
getPreOrderById
getPreOrderById,
getInfoByPhone
} from '@/api/index/index.js'
export default {
components: {},
@ -151,10 +152,12 @@
yonghuwx: [],
logincode: '',
phonecode: '',
phone: '',
studentList: [],
classList: [],
parentList: [],
msg: '',
openId: '',
}
},
methods: {
@ -176,21 +179,37 @@
});
},
gophone() {
const openid = this.openId
uni.navigateTo({
url: '/pages/phone/phone'
url: `/pages/phone/phone?openId=${openid}`
})
this.mask=false;
},
getPreOrderById() {
getPreOrderById(this.logincode, this.phonecode).then(res => {
console.log((res))
if (res.code == 200) {
this.studentList = res.data.studentInfoList;
this.classList = res.data.classInfoList;
this.parentList = res.data;
// this.mask = true;
this.mask2 = false;
} else if (res.code == 500 && res.msg == "EMPTY") {
this.mask = true;
if (res.data.flag == "EMPTY") {
this.mask = true;
this.openId = res.data.openId
} else {
// this.mask = true;
this.phone = res.data.phone
uni.setStorage({
key: 'phone',
data: res.data.phone
});
if (this.phone != '') {
this.getInfoByPhoneinfo()
}
this.login = true
this.stuinfos = true
this.tip = false
this.top2 = true
this.top = false
this.mask2 = false;
}
}
})
},
@ -198,11 +217,6 @@
getPhoneNumberp(val) {
this.phonecode = val.detail.code
console.log(val)
uni.setStorage({
key: 'phonecode',
data: val.detail.code
});
console.log(this.phonecode)
let that = this;
wx.login({
provider: 'weixin',
@ -211,11 +225,6 @@
that.logincode = loginRes.code
console.log(that.logincode)
that.getPreOrderById();
that.login = true
that.stuinfos = true
that.tip = false
that.top2 = true
that.top = false
that.mask2 = false;
}
});
@ -240,6 +249,19 @@
});
},
getInfoByPhoneinfo() {
getInfoByPhone(this.phone).then(res => {
if (res.code == 200) {
console.log(res)
this.studentList = res.data.studentInfoList;
this.classList = res.data.classInfoList;
this.parentList = res.data;
// this.mask = true;
}
})
}
},
filters: {
//
@ -252,26 +274,16 @@
return sexEnum[str];
},
},
onShow(){
},
onLoad(options) {
let that = this;
uni.getStorage({
key: 'phonecode',
key: 'phone',
success: function(res) {
that.phonecode = res.data
that.phone = res.data
// that.mask = true
}
});
wx.login({
provider: 'weixin',
success: function(loginRes) {
console.log(loginRes)
that.logincode = loginRes.code
console.log(that.logincode)
if (that.logincode != '') {
that.getPreOrderById();
}
that.getInfoByPhoneinfo();
}
});
uni.getStorage({
@ -334,6 +346,7 @@
/* background-color: #4486e8; */
right: 0;
}
.btn1 {
border-top: 1px solid #eeeeee;
border-right: 1px solid #eeeeee;
@ -351,6 +364,7 @@
top: 0;
z-index: 999;
}
.mask2 {
width: 70%;
height: 400rpx;

View File

@ -1,109 +0,0 @@
<!-- <template>
<view class="login">
<view class="login1">
<img src="/static/login.png" alt="" sizes="" srcset="">
</view>
<view class="btn">
<button @tap='wxGetUserInfo'>登录</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onShow() {},
onLoad(options) {
console.log(options)
},
methods: {
login() {
wx.login({
provider: 'weixin',
success: function(loginRes) {
console.log(loginRes)
}
});
},
wxGetUserInfo() {
let that = this;
uni.getUserProfile({
desc: "获取用户信息",
lang: "zh_CN",
success(res) {
console.log(res)
that.login();
uni.navigateTo({
url:`/pages/index/index?userinfo=`+JSON.stringify(res.userInfo)
})
// that.yonghuwx = res.userInfo
// that.getPreOrderById()
},
fail(res) {
//home
},
});
},
}
}
</script>
<style>
/* .login{
width: 650rpx;
height: 650rpx;
background-color: red;
} */
.login1 {
width: 270rpx;
height: 270rpx;
margin: 0 auto;
/* background-color: orange; */
/* display: flex;
align-items: center;
justify-content: center; */
}
.login {
width: 350rpx;
height: 400rpx;
/* background-color: red; */
margin: 0 auto;
margin-top: 34%;
/* display: flex;
align-items: center;
justify-content: center; */
/* display: flex;
align-items: center;
justify-content: center; */
/* margin-top: 30%;
margin-left: 20%; */
}
img {
width: 270rpx;
height: 270rpx;
}
.btn {
/* float: left; */
width: 200rpx;
height: 200rpx;
margin: 0 auto;
margin-top: 50rpx;
}
button {
color: #4486e8;
}
</style>
-->

View File

@ -1,4 +1,3 @@
<template>
<view class="content">
<uni-section class="card">
@ -6,7 +5,7 @@
<uni-card>
<view class="bind">
<view class="name">
家长姓名<input type="text" v-model="data.parentName" >
家长姓名<input type="text" v-model="data.parentName">
</view>
<view class="id">
学生身份证<input type="text" v-model="data.cardNo" maxlength="18">
@ -44,23 +43,34 @@
cardNo: "",
parentName: "",
phone: "",
openId: '',
},
}
},
methods: {
bindParent() {
uni.removeStorage({
key: 'phone',
success: function(res) {
console.log(res);
}
});
bindParent(this.data).then(res => {
console.log((res))
if (res.code == 200) {
uni.setStorage({
key: 'phone',
data: res.msg
});
uni.navigateTo({
url: '/pages/index/index'
})
// uni.showToast({
// title: res.msg,
// icon: 'none',
// duration: 2000
// });
uni.showToast({
title: '添加成功',
icon: 'none',
duration: 2000
});
} else if (res.code == 500) {
uni.showToast({
title: res.msg,
@ -78,6 +88,11 @@
})
},
},
onLoad(options) {
console.log(options)
this.data.openId = options.openId
console.log(this.data.openId)
}
}
</script>