Commit 95d22c35 authored by 罗超's avatar 罗超

2

parent 506ac1eb
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="indexpage"> <view class="indexpage">
<navbar class="navbarSticky" bg="#F5F5F5"> <navbar class="navbarSticky" bg="#F5F5F5">
<view class="navbarCon"> <view class="navbarCon">
<view class="pagetitle" @click="jumpPage('/pages/login/login')"> <view class="pagetitle">
首页 首页
</view> </view>
<view class="loginBox"> <view class="loginBox">
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
return obj return obj
}, },
againdata() { againdata() {
data.pageData = uni.getStorageSync("userInfo"); data.userData = uni.getStorageSync('userInfo');
methods.getIndexData(); methods.getIndexData();
methods.getActivityData(); methods.getActivityData();
}, },
......
<template> <template>
<view > <view>
<van-nav-bar> <van-nav-bar>
<van-icon slot="left" name="cross" size="50rpx" @click="back" /> <van-icon slot="left" name="cross" size="50rpx" @click="back" />
</van-nav-bar> </van-nav-bar>
<view class="top"> <view class="top">
登录 登录
<van-image <van-image width="193rpx" height="242rpx" fit="cover" class="yuqi"
width="193rpx" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png" />
height="242rpx"
fit="cover"
class="yuqi"
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png"
/>
</view> </view>
<view class="main"> <view class="main">
<van-cell-group> <van-cell-group>
<van-field <van-field :value="Account" clearable placeholder="请输入用户名" clearable @input="usernameInput">
:value="Account"
clearable
placeholder="请输入用户名"
clearable
@input="usernameInput"
>
<i class="iconfont icon-user2 left-iconfont" slot="left-icon"></i> <i class="iconfont icon-user2 left-iconfont" slot="left-icon"></i>
</van-field> </van-field>
<van-field <van-field :value="Password" password placeholder="请输入密码" clearable @input="passwordInput">
:value="Password"
password
placeholder="请输入密码"
clearable
@input="passwordInput"
>
<i class="iconfont icon-password left-iconfont" slot="left-icon"></i> <i class="iconfont icon-password left-iconfont" slot="left-icon"></i>
</van-field> </van-field>
</van-cell-group> </van-cell-group>
...@@ -43,14 +26,15 @@ ...@@ -43,14 +26,15 @@
<!-- <view class="auth" @click="authLogin"> 授权手机号一键登录 </view> --> <!-- <view class="auth" @click="authLogin"> 授权手机号一键登录 </view> -->
<van-toast id="van-toast" /> <van-toast id="van-toast" />
<van-dialog :show='show' title="标题" message='游客登录,不能使用全部功能!' show-cancel-button @cancel='show = false' @confirm='login3'> <van-dialog :show='show' title="标题" message='游客登录,不能使用全部功能!' show-cancel-button @cancel='show = false'
@confirm='login3'>
</van-dialog> </van-dialog>
</view> </view>
</template> </template>
<script> <script>
import { import {
ref, ref,
reactive, reactive,
toRefs, toRefs,
...@@ -60,24 +44,31 @@ import { ...@@ -60,24 +44,31 @@ import {
computed, computed,
onMounted, onMounted,
inject, inject,
} from "vue"; } from "vue";
// import Toast from "../../wxcomponents/vant/toast/toast"; import {
import { login,phoneLogin,parsePhone } from "../../api/index"; login,
import { Dialog } from '../../wxcomponents/vant/dialog/index'; phoneLogin,
parsePhone
} from "../../api/index";
import {
Dialog
} from '../../wxcomponents/vant/dialog/index';
export default { export default {
setup(props, context) { setup(props, context) {
let { proxy } = getCurrentInstance(); let {
proxy
} = getCurrentInstance();
let Toast = inject("$toast"); let Toast = inject("$toast");
let msg = reactive({ let msg = reactive({
Account: "", Account: "",
Password: "", Password: "",
}); });
let data =reactive({ let data = reactive({
phoneNum: "", phoneNum: "",
openid:"", openid: "",
code:"", code: "",
show:false show: false
}); });
let methods = { let methods = {
...@@ -107,10 +98,7 @@ export default { ...@@ -107,10 +98,7 @@ export default {
Toast.fail("请输入密码"); Toast.fail("请输入密码");
return; return;
} }
// let res = await login(msg); let res = await this.$request('/AppletLogin/Login', msg)
console.log(103,this.$request)
let res=await this.$request('/AppletLogin/Login',msg)
console.log(104,res)
if (res) { if (res) {
res.Data.Account = msg.Account; res.Data.Account = msg.Account;
try { try {
...@@ -127,48 +115,48 @@ export default { ...@@ -127,48 +115,48 @@ export default {
}, 1000); }, 1000);
} }
}, },
login2(){ login2() {
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: async (loginRes)=> { success: async (loginRes) => {
let code=loginRes.code let code = loginRes.code
data.code=code data.code = code
} }
}); });
}, },
//获取手机号 //获取手机号
getphonenumber(e){ getphonenumber(e) {
if(e.detail.encryptedData&&e.detail.iv){ if (e.detail.encryptedData && e.detail.iv) {
let encryptedData = e.detail.encryptedData; let encryptedData = e.detail.encryptedData;
let iv = e.detail.iv; let iv = e.detail.iv;
that.parsePhoneNum(encryptedData,iv,data.code) that.parsePhoneNum(encryptedData, iv, data.code)
}else{ } else {
Toast.fail("授权失败,请重新授权") Toast.fail("授权失败,请重新授权")
} }
}, },
//解密手机号 //解密手机号
async parsePhoneNum(encryptedData,iv,code){ async parsePhoneNum(encryptedData, iv, code) {
let res = await parsePhone({ let res = await parsePhone({
encryptedData, encryptedData,
iv, iv,
code code
}) })
if(res&&res.Data.phoneNumber){ if (res && res.Data.phoneNumber) {
data.phoneNum=res.Data.phoneNumber data.phoneNum = res.Data.phoneNumber
data.openid=res.Data.openid data.openid = res.Data.openid
that.phoneNumLogin() that.phoneNumLogin()
}else{ } else {
Toast.fail("授权失败,请重新授权") Toast.fail("授权失败,请重新授权")
} }
}, },
//手机号授权登录 //手机号授权登录
async phoneNumLogin(){ async phoneNumLogin() {
let res=await phoneLogin({ let res = await phoneLogin({
Account:data.phoneNum, Account: data.phoneNum,
OpenId:data.openid OpenId: data.openid
}) })
if(res){ if (res) {
res.Data.Account =data.phoneNum; res.Data.Account = data.phoneNum;
uni.setStorageSync("userInfo", res.Data); uni.setStorageSync("userInfo", res.Data);
Toast.success("登录成功"); Toast.success("登录成功");
setTimeout(() => { setTimeout(() => {
...@@ -179,22 +167,22 @@ export default { ...@@ -179,22 +167,22 @@ export default {
}, 1000); }, 1000);
} }
}, },
async login3(){//游客登录 async login3() { //游客登录
data.show= false data.show = false
console.log(uni.getStorageSync("temporarydh")) console.log(uni.getStorageSync("temporarydh"))
let temporarydh = uni.getStorageSync("temporarydh") let temporarydh = uni.getStorageSync("temporarydh")
if(temporarydh){ if (temporarydh) {
let msg={ let msg = {
Account:temporarydh.Account, Account: temporarydh.Account,
OpenId:temporarydh.OpenId, OpenId: temporarydh.OpenId,
unionid:temporarydh.unionid, unionid: temporarydh.unionid,
WeChatName:temporarydh.WeChatName, WeChatName: temporarydh.WeChatName,
WeChatPhoto:temporarydh.WeChatPhoto, WeChatPhoto: temporarydh.WeChatPhoto,
IsVisitor:1, IsVisitor: 1,
} }
let res=await phoneLogin(msg) let res = await phoneLogin(msg)
if(res){ if (res) {
res.Data.Account =data.phoneNum; res.Data.Account = data.phoneNum;
uni.setStorageSync("userInfo", res.Data); uni.setStorageSync("userInfo", res.Data);
Toast.success("登录成功"); Toast.success("登录成功");
setTimeout(() => { setTimeout(() => {
...@@ -204,10 +192,18 @@ export default { ...@@ -204,10 +192,18 @@ export default {
} }
}, 1000); }, 1000);
} }
}else{ } else {
uni.showToast({
icon: "none",
title:"请先点击首页登录按钮授权",
duration:2000,
})
setTimeout(()=>{
uni.reLaunch({ uni.reLaunch({
url: '/pages/index/index'//没有授权登录 url: '/pages/index/index' //没有授权登录
}); });
},1500)
} }
} }
...@@ -220,14 +216,14 @@ export default { ...@@ -220,14 +216,14 @@ export default {
...methods, ...methods,
}; };
}, },
onLoad(){ onLoad() {
// uni.clearStorage(); // uni.clearStorage();
} }
}; };
</script> </script>
<style scoped> <style scoped>
.top { .top {
height: 242rpx; height: 242rpx;
box-sizing: border-box; box-sizing: border-box;
padding-left: 40rpx; padding-left: 40rpx;
...@@ -238,27 +234,27 @@ export default { ...@@ -238,27 +234,27 @@ export default {
color: #0f1b35; color: #0f1b35;
position: relative; position: relative;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.yuqi { .yuqi {
position: absolute; position: absolute;
top: 0; top: 0;
right: 1rpx; right: 1rpx;
} }
.main { .main {
height: 250rpx; height: 250rpx;
box-sizing: border-box; box-sizing: border-box;
padding: 0 40rpx; padding: 0 40rpx;
margin-bottom: 165rpx; margin-bottom: 165rpx;
} }
/deep/.van-cell { /deep/.van-cell {
height: 124rpx; height: 124rpx;
padding-top: 50rpx; padding-top: 50rpx;
} }
.loginBtn { .loginBtn {
width: 280rpx; width: 280rpx;
height: 90rpx; height: 90rpx;
background-color: #00acf9; background-color: #00acf9;
...@@ -267,8 +263,9 @@ export default { ...@@ -267,8 +263,9 @@ export default {
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #ffffff; color: #ffffff;
} }
.phoneBtn{
.phoneBtn {
width: 280rpx; width: 280rpx;
height: 90rpx; height: 90rpx;
background-color: #E6A23C; background-color: #E6A23C;
...@@ -278,22 +275,24 @@ export default { ...@@ -278,22 +275,24 @@ export default {
font-weight: 500; font-weight: 500;
color: #ffffff; color: #ffffff;
margin: 0; margin: 0;
} }
.auth {
.auth {
text-align: center; text-align: center;
font-size: 26rpx; font-size: 26rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #00acf9; color: #00acf9;
margin-top: 30rpx; margin-top: 30rpx;
} }
.left-iconfont { .left-iconfont {
margin-right: 20rpx; margin-right: 20rpx;
font-size: 30rpx; font-size: 30rpx;
color: #111111; color: #111111;
} }
.btnBox{
.btnBox {
width: 600rpx; width: 600rpx;
height: 90rpx; height: 90rpx;
border-radius: 12rpx; border-radius: 12rpx;
...@@ -303,5 +302,5 @@ export default { ...@@ -303,5 +302,5 @@ export default {
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #ffffff; color: #ffffff;
} }
</style> </style>
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
<!-- <view class="date"> <!-- <view class="date">
2021年12月30日 2021年12月30日
</view> --> </view> -->
<view class="name"> Hello,{{ pageData.StuName||'' }} </view> <view class="name"> <text v-if="pageData.StuName">Hello,{{ pageData.StuName }}</text><text
v-if="!pageData.StuName&&pageData.StuName!==''"
@click="jumpPage('/pages/login/login')">未登录</text> </view>
</view> </view>
<view class="right"> <view class="right">
<image :src="pageData.StuIcon" mode="aspectFill" style="width:100%;height:100%;border-radius: 50%;"> <image :src="pageData.StuIcon" mode="aspectFill" style="width:100%;height:100%;border-radius: 50%;">
...@@ -15,7 +17,7 @@ ...@@ -15,7 +17,7 @@
<view class="orderInfo flex_between_center"> <view class="orderInfo flex_between_center">
<view class="orderItem "> <view class="orderItem ">
<view class=" flex_between_center" style="width:100%"> <view class=" flex_between_center" style="width:100%">
<view class="orderNum">{{ pageData.OrderNum }}</view> <view class="orderNum">{{ pageData.OrderNum||0 }}</view>
<image src="../../static/image/person/order1.png" mode="aspectFill" class="orderIcon"></image> <image src="../../static/image/person/order1.png" mode="aspectFill" class="orderIcon"></image>
</view> </view>
<view class="orderName"> <view class="orderName">
...@@ -24,16 +26,16 @@ ...@@ -24,16 +26,16 @@
</view> </view>
<view class="orderItem "> <view class="orderItem ">
<view class=" flex_between_center" style="width:100%"> <view class=" flex_between_center" style="width:100%">
<view class="orderNum">{{ pageData.StudyAbroadNum }}</view> <view class="orderNum">{{ pageData.StudyAbroadNum||0 }}</view>
<image src="../../static/image/person/order2.png" mode="aspectFill" class="orderIcon"></image> <image src="../../static/image/person/order2.png" mode="aspectFill" class="orderIcon"></image>
</view> </view>
<view class="orderName"> <view class="orderName">
留学订单 留学订单
</view> </view>
</view> </view>
<view class="orderItem " > <view class="orderItem ">
<view class=" flex_between_center" style="width:100%"> <view class=" flex_between_center" style="width:100%">
<view class="orderNum">{{ pageData.ContractNum }}</view> <view class="orderNum">{{ pageData.ContractNum||0 }}</view>
<image src="../../static/image/person/order3.png" mode="aspectFill" class="orderIcon"></image> <image src="../../static/image/person/order3.png" mode="aspectFill" class="orderIcon"></image>
</view> </view>
<view class="orderName"> <view class="orderName">
...@@ -71,8 +73,29 @@ ...@@ -71,8 +73,29 @@
</view> </view>
<view class="courseBox"> <view class="courseBox">
<view class="left"> <view class="left">
<view style="width: 115rpx;
height: 13rpx;
background-color: #9CD4C1;
border-radius: 6rpx;
margin-bottom: 20rpx;
">
</view>
<view style="width: 90rpx;
height: 13rpx;
background-color: #9CD4C1;
border-radius: 6rpx;
margin-bottom: 20rpx;
">
</view>
<view style="width: 60rpx;
height: 13rpx;
background-color: #9CD4C1;
border-radius: 6rpx;
">
</view>
<image :src="pageData.CourseInfo.B2BIcon" mode="aspectFill" <image :src="pageData.CourseInfo.B2BIcon" mode="aspectFill"
style="width:100%;height:100%;border-radius: 30rpx;"></image> style="width:115rpx;height:115rpx;border-radius: 6rpx; position: absolute;bottom:10rpx;right: 18rpx;">
</image>
</view> </view>
<view class="right"> <view class="right">
<view class="className one_line">{{ <view class="className one_line">{{
...@@ -144,7 +167,7 @@ ...@@ -144,7 +167,7 @@
} = getCurrentInstance(); } = getCurrentInstance();
let data = reactive({ let data = reactive({
pageData: { pageData: {
AssistList:[] AssistList: []
}, },
}); });
const methods = { const methods = {
...@@ -171,7 +194,7 @@ ...@@ -171,7 +194,7 @@
}; };
}, },
onShow() { onShow() {
if(this.$isLogin()){ if (this.$isLogin()) {
this.getData(); this.getData();
} }
} }
...@@ -316,6 +339,10 @@ ...@@ -316,6 +339,10 @@
background: #d5f3e9; background: #d5f3e9;
border-radius: 30rpx; border-radius: 30rpx;
margin-right: 40rpx; margin-right: 40rpx;
box-sizing: border-box;
padding-top: 40rpx;
padding-left: 30rpx;
position: relative;
} }
.courseBox .right { .courseBox .right {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment