小程序最新修改

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

View File

@ -134,7 +134,8 @@
</template> </template>
<script> <script>
import { import {
getPreOrderById getPreOrderById,
getInfoByPhone
} from '@/api/index/index.js' } from '@/api/index/index.js'
export default { export default {
components: {}, components: {},
@ -151,10 +152,12 @@
yonghuwx: [], yonghuwx: [],
logincode: '', logincode: '',
phonecode: '', phonecode: '',
phone: '',
studentList: [], studentList: [],
classList: [], classList: [],
parentList: [], parentList: [],
msg: '', msg: '',
openId: '',
} }
}, },
methods: { methods: {
@ -176,21 +179,37 @@
}); });
}, },
gophone() { gophone() {
const openid = this.openId
uni.navigateTo({ uni.navigateTo({
url: '/pages/phone/phone' url: `/pages/phone/phone?openId=${openid}`
}) })
this.mask=false;
}, },
getPreOrderById() { getPreOrderById() {
getPreOrderById(this.logincode, this.phonecode).then(res => { getPreOrderById(this.logincode, this.phonecode).then(res => {
console.log((res)) console.log((res))
if (res.code == 200) { if (res.code == 200) {
this.studentList = res.data.studentInfoList; if (res.data.flag == "EMPTY") {
this.classList = res.data.classInfoList; this.mask = true;
this.parentList = res.data; this.openId = res.data.openId
// this.mask = true; } else {
this.mask2 = false; // this.mask = true;
} else if (res.code == 500 && res.msg == "EMPTY") { this.phone = res.data.phone
this.mask = true; 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) { getPhoneNumberp(val) {
this.phonecode = val.detail.code this.phonecode = val.detail.code
console.log(val) console.log(val)
uni.setStorage({
key: 'phonecode',
data: val.detail.code
});
console.log(this.phonecode)
let that = this; let that = this;
wx.login({ wx.login({
provider: 'weixin', provider: 'weixin',
@ -211,11 +225,6 @@
that.logincode = loginRes.code that.logincode = loginRes.code
console.log(that.logincode) console.log(that.logincode)
that.getPreOrderById(); that.getPreOrderById();
that.login = true
that.stuinfos = true
that.tip = false
that.top2 = true
that.top = false
that.mask2 = 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: { filters: {
// //
@ -252,26 +274,16 @@
return sexEnum[str]; return sexEnum[str];
}, },
}, },
onShow(){
},
onLoad(options) { onLoad(options) {
let that = this; let that = this;
uni.getStorage({ uni.getStorage({
key: 'phonecode', key: 'phone',
success: function(res) { success: function(res) {
that.phonecode = res.data that.phone = res.data
// that.mask = true // that.mask = true
} that.getInfoByPhoneinfo();
});
wx.login({
provider: 'weixin',
success: function(loginRes) {
console.log(loginRes)
that.logincode = loginRes.code
console.log(that.logincode)
if (that.logincode != '') {
that.getPreOrderById();
}
} }
}); });
uni.getStorage({ uni.getStorage({
@ -334,6 +346,7 @@
/* background-color: #4486e8; */ /* background-color: #4486e8; */
right: 0; right: 0;
} }
.btn1 { .btn1 {
border-top: 1px solid #eeeeee; border-top: 1px solid #eeeeee;
border-right: 1px solid #eeeeee; border-right: 1px solid #eeeeee;
@ -351,6 +364,7 @@
top: 0; top: 0;
z-index: 999; z-index: 999;
} }
.mask2 { .mask2 {
width: 70%; width: 70%;
height: 400rpx; 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> <template>
<view class="content"> <view class="content">
<uni-section class="card"> <uni-section class="card">
@ -6,7 +5,7 @@
<uni-card> <uni-card>
<view class="bind"> <view class="bind">
<view class="name"> <view class="name">
家长姓名<input type="text" v-model="data.parentName" > 家长姓名<input type="text" v-model="data.parentName">
</view> </view>
<view class="id"> <view class="id">
学生身份证<input type="text" v-model="data.cardNo" maxlength="18"> 学生身份证<input type="text" v-model="data.cardNo" maxlength="18">
@ -44,23 +43,34 @@
cardNo: "", cardNo: "",
parentName: "", parentName: "",
phone: "", phone: "",
openId: '',
}, },
} }
}, },
methods: { methods: {
bindParent() { bindParent() {
uni.removeStorage({
key: 'phone',
success: function(res) {
console.log(res);
}
});
bindParent(this.data).then(res => { bindParent(this.data).then(res => {
console.log((res)) console.log((res))
if (res.code == 200) { if (res.code == 200) {
uni.setStorage({
key: 'phone',
data: res.msg
});
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/index' url: '/pages/index/index'
}) })
// uni.showToast({ uni.showToast({
// title: res.msg, title: '添加成功',
// icon: 'none', icon: 'none',
// duration: 2000 duration: 2000
// }); });
} else if (res.code == 500) { } else if (res.code == 500) {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -78,6 +88,11 @@
}) })
}, },
},
onLoad(options) {
console.log(options)
this.data.openId = options.openId
console.log(this.data.openId)
} }
} }
</script> </script>