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

2

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