Commit bc344ecf authored by youjie's avatar youjie

no message

parents bf1474cd 34e39f16
...@@ -18,3 +18,10 @@ export function getSudentsByClassInAccount(data) { ...@@ -18,3 +18,10 @@ export function getSudentsByClassInAccount(data) {
data data
}) })
} }
export function setStudentClassInAccount(data) {
return request({
url: '/AppletCenter/SetStudentClassInAccount',
method: 'post',
data
})
}
\ No newline at end of file
...@@ -54,7 +54,19 @@ export function getWeChatOpenId(data) { ...@@ -54,7 +54,19 @@ export function getWeChatOpenId(data) {
*/ */
export function phoneLogin(data) { export function phoneLogin(data) {
return request({ return request({
url: '/AppletLogin/LoginByAccount', url: '/Login/LoginByAccount',
method: 'post',
data
})
}
/**
* 手机号登录
* @param {JSON参数} data
*/
export function getStudentByAccount(data) {
return request({
url: '/Login/GetStudentByAccount',
method: 'post', method: 'post',
data data
}) })
......
...@@ -8,46 +8,37 @@ ...@@ -8,46 +8,37 @@
<view class="user-name"> <view class="user-name">
{{currentErpUser.AccountName}} {{currentErpUser.AccountName}}
</view> </view>
<view v-if="erpUsers.length>1" class="user-change-text"> <view class="user-change-text">
点击切换学员 点击切换学员
</view> </view>
</view> </view>
</view> </view>
<!-- catch:touchstart -->
<van-popup <van-popup
:show="showChange" :show="showChange"
round round
custom-style="height: 650rpx;width:650rpx" custom-style="height: 650rpx;width:650rpx"
@close="closeChangeUserHandler"> >
<view>
<view class="user-change-box"> <view class="user-change-box">
<view class="title-box">
<view class="icon"> <view class="icon">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1663912533000_168.png" <van-icon class-prefix="iconfont" name="icon-qiehuan1"></van-icon>
style="width:21rpx;height:21rpx;display: block;"></image>
</view> </view>
<view class="title"> <view class="title">
切换学员 切换学员
</view> </view>
<view class="close"> <view class="close">
<van-icon name='cross' @click="showChange=false"></van-icon> <van-icon name='cross' @click="closeChangeUserHandler"></van-icon>
</view>
</view> </view>
<scroll-view scroll-y="true" style="width:100%;height: 470rpx;">
<view class="stuList-box">
<view class="stuList" v-for="(item,index) in erpUsers" :key="index"
:class="{'active':item.AccountId==currentErpUser.AccountId}"
@click="toggleStu(item)">
<view class="stuList-left">
<view class="surname" :style="{background:item.bgColor}">{{item.AccountName.substring(0,1)}}</view>
<text>{{item.AccountName}}</text>
</view> </view>
<view class="stuList-right"> <scroll-view style="overflow-y: auto; height: 1px; flex:1;margin-top:50rpx">
<van-icon name='circle' color="#EFEFEF" size="23"></van-icon> <view class="user-item" @click="changeErpUserHandler(x)" v-for="(x,i) in erpUsers">
<image class="stuList-right-img" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1663917392000_451.png" <view class="avatar" :style="{background:x.bgColor}">{{x.AccountName.substring(0,1)}}</view>
style="width:36rpx;height:35rpx;"></image> <view class="uname">
{{x.AccountName}}
</view> </view>
<view class="check" v-if="x.AccountId==currentErpUser.AccountId">
<van-icon name="success" />
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
...@@ -68,16 +59,15 @@ ...@@ -68,16 +59,15 @@
data.erpUsers=uni.getStorageSync('ErpStus') data.erpUsers=uni.getStorageSync('ErpStus')
data.currentErpUser=uni.getStorageSync('erpUserInfo') data.currentErpUser=uni.getStorageSync('erpUserInfo')
let methods = { let methods = {
toggleStu(x){
if(x.AccountId!=data.currentErpUser.AccountId){
uni.removeStorageSync('erpUserInfo')
uni.setStorageSync('erpUserInfo',x)
data.currentErpUser=uni.getStorageSync('erpUserInfo')
this.initColor()
}
},
closeChangeUserHandler(){ closeChangeUserHandler(){
console.log('in....')
data.showChange=false
},
changeErpUserHandler(x){
uni.setStorageSync("erpUserInfo",x)
uni.reLaunch({
url:'/pages/index/index'
})
}, },
initColor(){ initColor(){
if(data.erpUsers){ if(data.erpUsers){
...@@ -107,7 +97,7 @@ ...@@ -107,7 +97,7 @@
}, },
}; };
</script> </script>
<style scoped> <style>
.index-header-userCard text{ .index-header-userCard text{
font-size: 26rpx; font-size: 26rpx;
font-weight: bold; font-weight: bold;
...@@ -143,69 +133,64 @@ ...@@ -143,69 +133,64 @@
font-weight: 500; font-weight: 500;
color: #B8B8B8; color: #B8B8B8;
} }
.userCard-box .user-change-box{ .userCard-box .user-change-box {
padding: 50rpx; padding: 50rpx;
box-sizing: border-box; box-sizing: border-box;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column;
}
.userCard-box .user-change-box .title-box {
display: flex;
flex-direction: row;
align-items: center; align-items: center;
} }
.userCard-box .user-change-box .icon{ .userCard-box .user-change-box .title-box .icon{
font-size: 22rpx; font-size: 22rpx;
color:#282828; color:#282828;
margin-right: 8rpx; margin-right: 8rpx;
} }
.userCard-box .user-change-box .title{ .userCard-box .user-change-box .title-box .title{
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
color: #000000; color: #000000;
width: 1px; width: 1px;
flex:1; flex:1;
} }
.userCard-box .user-change-box .title .close{ .userCard-box .user-change-box .title-box .close{
width: 26rpx; width: 26rpx;
height: 26rpx; height: 26rpx;
color:#282828; color:#282828;
} }
.stuList-box{ .userCard-box .user-item{
padding: 0 56rpx;
}
.stuList{
display: flex;
justify-content: space-between;
margin-bottom: 36rpx;
}
.stuList-left{
display: flex; display: flex;
flex-direction: row;
align-items: center; align-items: center;
margin-right: 20rpx; margin-bottom: 36rpx;
} }
.surname{ .userCard-box .user-item .avatar{
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
background: #9ADBC5;
border-radius: 50%; border-radius: 50%;
overflow: hidden;
margin-right: 32rpx;
color: #ffffff;
font-size: 38rpx; font-size: 38rpx;
font-weight: 500; font-weight: 500;
text-align: center; color: #FFFFFF;
line-height: 60rpx;
overflow: hidden;
}
.stuList-right{
position: relative;
flex-shrink: 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center;
} }
.stuList-right-img{ .userCard-box .user-item .uname{
display: none; font-size: 28rpx;
position: absolute; margin-left: 32rpx;
left: 1rpx; font-weight: 500;
top: 8rpx; color: #000000;
width:1px;
flex: 1;
} }
.stuList.active .stuList-right-img{ .userCard-box .user-item .check{
display: block; color: #000000;
font-size: 36rpx;
} }
</style> </style>
\ No newline at end of file
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
uni.setStorageSync("ErpStus",r.Data) uni.setStorageSync("ErpStus",r.Data)
let account=[] let account=[]
r.Data.forEach(x=>{ r.Data.forEach(x=>{
account.push(x.RealPhone) account.push(x.ClassInAccount)
}) })
methods.setAccountsLogin(`'${account.join("','")}'`) methods.setAccountsLogin(`'${account.join("','")}'`)
}else{ }else{
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
if(r.Data && r.Data.length>0){ if(r.Data && r.Data.length>0){
let erpStus=uni.getStorageSync('ErpStus') let erpStus=uni.getStorageSync('ErpStus')
erpStus.forEach(x=>{ erpStus.forEach(x=>{
if(x.RealPhone==r.Data[0].UserMobile){ if(x.ClassInAccount==r.Data[0].Account){
uni.setStorageSync('erpUserInfo',x) uni.setStorageSync('erpUserInfo',x)
} }
}) })
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
if(r.Data && r.Data.length>0){ if(r.Data && r.Data.length>0){
uni.setStorageSync("ErpStus",r.Data) uni.setStorageSync("ErpStus",r.Data)
r.Data.forEach(x=>{ r.Data.forEach(x=>{
if(x.RealPhone==u.Account){ if(x.ClassInAccount==u.Account){
uni.setStorageSync('erpUserInfo',x) uni.setStorageSync('erpUserInfo',x)
} }
}) })
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
<!-- <signOut :AccountType="0"></signOut> --> <!-- <signOut :AccountType="0"></signOut> -->
<userCard></userCard> <userCard></userCard>
</navbar> </navbar>
<view v-if="userData">
<view style="margin: 40rpx 0 10rpx 0;"> <view style="margin: 40rpx 0 10rpx 0;">
<view style="padding:0 50rpx;font-weight: 800;color: #282828;"> <view style="padding:0 50rpx;font-weight: 800;color: #282828;">
<view style="font-size: 36rpx;">Hello,{{userData.AccountName}}</view> <view style="font-size: 36rpx;">Hello,{{userData.AccountName}}</view>
...@@ -40,6 +42,29 @@ ...@@ -40,6 +42,29 @@
<view>暂无反馈信息</view> <view>暂无反馈信息</view>
</view> </view>
</view> </view>
</view>
<view class="unbind-box" v-else>
<view class="title">
未绑定学员ClassIn账号
</view>
<view class="search-box">
<input type="text" :disabled="submiting" maxlength="11" placeholder-style="font-size:28rpx;" @blur="changeSearchKeyHandler" auto-focus v-model="searchBindKey" placeholder="输入学员ClassIn账号进行绑定" />
</view>
<view class="result-box" v-if="searchResult">
<view class="avatar-result">
{{searchResult.AccountName.substring(0,1)}}
</view>
<view class="name-result">
{{searchResult.AccountName}}
</view>
<view style="margin-top: 50rpx;">
<van-button size="large" @click="setBindHandler" :loading="submiting" custom-style="border-radius:10rpx;" color="#C81727">
立即绑定
</van-button>
</view>
</view>
</view>
<tabbar active-name='home'></tabbar> <tabbar active-name='home'></tabbar>
</view> </view>
...@@ -67,11 +92,13 @@ ...@@ -67,11 +92,13 @@
} from "vue"; } from "vue";
import { import {
getSweepCode getSweepCode,
getStudentByAccount
} from '../../api/index.js' } from '../../api/index.js'
import { import {
getImageColor,VersionUpdate getImageColor
} from '../../utils/index.js' } from '../../utils/index.js'
import {setStudentClassInAccount} from '../../api/erp.js'
import userCard from '../../components/user-card.vue' import userCard from '../../components/user-card.vue'
import indexassembly from './components/indexassembly.vue' import indexassembly from './components/indexassembly.vue'
import navbar from '../../components/navbar.vue' import navbar from '../../components/navbar.vue'
...@@ -101,11 +128,23 @@ ...@@ -101,11 +128,23 @@
courseId: 0, courseId: 0,
}, },
showPopu:false, showPopu:false,
searchBindKey:'',
searchResult:null,
submiting:false,
workList: [],//学员作业、考试、评语数据 workList: [],//学员作业、考试、评语数据
}); });
let methods = { let methods = {
VersionUpdate, changeSearchKeyHandler(){
if(data.searchBindKey.length!=11){
uni.showToast({
title:'请输入正确手机号码'
})
}else{
console.log('in...')
methods.searchHandler()
}
},
changePopStatusHandler(status){ changePopStatusHandler(status){
data.showPopu=status==1 data.showPopu=status==1
}, },
...@@ -137,6 +176,109 @@ ...@@ -137,6 +176,109 @@
uni.hideLoading() uni.hideLoading()
}) })
}, },
searchHandler() {
uni.showLoading({
title:'正在查询'
})
getStudentByAccount({
Account:data.searchBindKey
}).then(r=>{
data.searchResult=r.Data
uni.hideLoading()
}).catch(e=>{
uni.hideLoading()
})
},
setBindHandler(){
data.submiting=true
uni.showLoading({
title:'正在绑定'
})
setStudentClassInAccount({account:data.searchResult.Account}).then(r=>{
if(r.Code==1){
let users=uni.getStorageSync("users")
users.push(data.searchResult)
uni.setStorageSync('users',users)
uni.setStorageSync('userInfo',data.searchResult)
let erpUsers=uni.getStorageSync("ErpStus")
let currentErpUser=uni.getStorageSync("erpUserInfo")
erpUsers.forEach(x=>{
if(x.AccountId==currentErpUser.AccountId){
x.ClassInAccount=data.searchResult.Account
currentErpUser.ClassInAccount=data.searchResult.Account
}
})
uni.setStorageSync('ErpStus',erpUsers)
uni.setStorageSync('erpUserInfo',currentErpUser)
}
data.submiting=false
uni.hideLoading()
uni.reLaunch({
url:'/pages/index/index'
})
}).catch(e=>{
data.submiting=false
uni.hideLoading()
})
},
//定义更新方法
VersionUpdate() {
// 判断应用的 getUpdateManager 是否在当前版本可用
if (uni.canIUse('getUpdateManager')) {
const updateManager = uni.getUpdateManager()
// 向小程序后台请求完新版本信息
updateManager.onCheckForUpdate(function(res) {
console.log(res.hasUpdate);
if (res.hasUpdate) {
//小程序有新版本,静默下载新版本,新版本下载完成
updateManager.onUpdateReady(function() {
//模态弹窗(确认、取消)
uni.showModal({
title: '更新提示',
content: '小程序已发布新版本,是否重启?',
success: function(res) {
//用户点击确定
if (res.confirm) {
//当新版本下载完成,调用该方法会强制当前小程序应用上新版本并重启
updateManager.applyUpdate()
} //用户点击取消
else if (res.cancel) {
//强制用户更新,弹出第二次弹窗
uni.showModal({
title: '提示',
content: '小程序已发布新版本,是否重启',
showCancel: false, //隐藏取消按钮
success: function(res) {
//第二次提示后,强制更新
if (res.confirm) {
// 当新版本下载完成,调用该方法会强制当前小程序应用上新版本并重启
updateManager.applyUpdate()
}
}
})
}
}
})
})
// 当新版本下载失败
updateManager.onUpdateFailed(function() {
uni.showModal({
title: '提示',
content: '请您删除当前小程序,重新打开小程序',
})
})
}
})
} else {
// 提示用户在最新版本的客户端上体验
uni.showModal({
title: '温馨提示',
content: '当前微信版本过低,可能无法使用该功能,请升级到最新版本后重试。'
})
}
}
}; };
methods.getStuCourse(); methods.getStuCourse();
data.userData = uni.getStorageSync('userInfo'); data.userData = uni.getStorageSync('userInfo');
...@@ -145,10 +287,9 @@ ...@@ -145,10 +287,9 @@
url:'/pages/index/workSituation' url:'/pages/index/workSituation'
}) })
} }
onMounted(() => { // onMounted(() => {
that.VersionUpdate()
}); // });
let that = methods;
return { return {
...toRefs(data), ...toRefs(data),
...methods, ...methods,
...@@ -161,7 +302,8 @@ ...@@ -161,7 +302,8 @@
}, },
onShow(){ onShow(){
//调用定义的更新方法
this.VersionUpdate();
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {
...@@ -284,4 +426,65 @@ ...@@ -284,4 +426,65 @@
top: 0; top: 0;
z-index: 9; z-index: 9;
} }
.unbind-box{
min-height: calc(100vh - 300rpx);
box-sizing: border-box;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
background-color: #FFF;
margin-top: 200rpx;
padding:50rpx;
}
.unbind-box .title{
font-size: 36rpx;
font-weight: 500;
color: #282828;
}
.unbind-box .search-box{
margin-top: 50rpx;
}
.unbind-box .search-box input{
height: 100rpx;
width: 100%;
box-sizing: border-box;
padding: 0 50rpx;
line-height: 100rpx;
color: #282828;
outline: none;
border-radius: 100rpx;
font-size: 40rpx;
border: 4rpx solid #999;
font-weight: bolder;
}
.unbind-box .search-box input:focus,
.unbind-box .search-box input:active{
border: 4rpx solid #C81727 !important;
}
.unbind-box .search-box .placeholder {
color: #C81727;
font-size: 28rpx;
opacity: .2;
}
.unbind-box .result-box{
margin-top: 50rpx;
}
.unbind-box .result-box .avatar-result{
width:160rpx;
height: 160rpx;
text-align: center;
background-color: coral;
border-radius: 10rpx;
line-height: 160rpx;
font-size: 60rpx;
color:#FFF;
font-weight: 400;
}
.unbind-box .result-box .name-result{
width:160rpx;
text-align: center;
font-size: 32rpx;
color:#282828;
margin-top: 10rpx;
}
</style> </style>
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
if(r.Data && r.Data.length>0){ if(r.Data && r.Data.length>0){
uni.setStorageSync("ErpStus",r.Data) uni.setStorageSync("ErpStus",r.Data)
r.Data.forEach(x=>{ r.Data.forEach(x=>{
if(x.RealPhone==u.Account){ if(x.ClassInAccount==u.Account){
uni.setStorageSync('erpUserInfo',x) uni.setStorageSync('erpUserInfo',x)
} }
}) })
......
...@@ -27,6 +27,8 @@ let request = (param) => { ...@@ -27,6 +27,8 @@ let request = (param) => {
resolve(res.data) resolve(res.data)
} else { } else {
if (res.data.Code==10001 || res.data.Code == 10000) { if (res.data.Code==10001 || res.data.Code == 10000) {
if(!uni.getStorageSync('erpUserInfo')){
console.log('in....')
uni.showToast({ uni.showToast({
title: "用户凭证失效,请重新授权", title: "用户凭证失效,请重新授权",
duration: 2000, duration: 2000,
...@@ -37,6 +39,9 @@ let request = (param) => { ...@@ -37,6 +39,9 @@ let request = (param) => {
url:"/pages/login/login" url:"/pages/login/login"
}) })
reject() reject()
}else{
resolve(res.data)
}
}else{ }else{
uni.showToast({ uni.showToast({
title: res.data.Message, title: res.data.Message,
......
...@@ -17,7 +17,7 @@ let request = (param) => { ...@@ -17,7 +17,7 @@ let request = (param) => {
method: param.method || "Post", method: param.method || "Post",
header: param.header || { header: param.header || {
'content-type': "application/json", 'content-type': "application/json",
'Authorization': token || "" 'token': token || ""
}, },
data: { data: {
Msg: param.data, Msg: param.data,
...@@ -27,16 +27,16 @@ let request = (param) => { ...@@ -27,16 +27,16 @@ let request = (param) => {
resolve(res.data) resolve(res.data)
} else { } else {
if (res.data.Code==10001 || res.data.Code == 10000) { if (res.data.Code==10001 || res.data.Code == 10000) {
uni.showToast({ // uni.showToast({
title: "用户凭证失效,请重新授权", // title: "用户凭证失效,请重新授权",
duration: 2000, // duration: 2000,
icon: "none", // icon: "none",
}); // });
uni.removeStorageSync('erpUserInfo'); // uni.removeStorageSync('erpUserInfo');
uni.reLaunch({ // uni.reLaunch({
url:"/pages/login/login" // url:"/pages/login/login"
}) // })
reject() // reject()
} else { } else {
uni.showToast({ uni.showToast({
title: res.data.Message, title: res.data.Message,
......
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