Commit 03752414 authored by 罗超's avatar 罗超

调整

parent 85ff50cf
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</view> </view>
</view> </view>
</view> </view>
<view v-else class="index-header-userCard flex"> <view v-else class="index-header-userCard flex" @click="goBindHandler">
<view class="user-avatar" style="background-color: gray;"></view> <view class="user-avatar" style="background-color: gray;"></view>
<view> <view>
<view class="user-change-text"> <view class="user-change-text">
...@@ -81,6 +81,11 @@ ...@@ -81,6 +81,11 @@
} }
} }
let methods = { let methods = {
goBindHandler(){
uni.navigateTo({
url:'/pages/person/bind'
})
},
closeChangeUserHandler(){ closeChangeUserHandler(){
console.log('in....') console.log('in....')
data.showChange=false data.showChange=false
......
...@@ -99,6 +99,14 @@ ...@@ -99,6 +99,14 @@
"backgroundColor": "#F6F6F6", "backgroundColor": "#F6F6F6",
"navigationBarBackgroundColor": "#F6F6F6" "navigationBarBackgroundColor": "#F6F6F6"
} }
},{
"path": "pages/person/bind",
"navigationStyle": "custom",
"style": {
"navigationBarTitleText": "绑定帐号",
"backgroundColor": "#F6F6F6",
"navigationBarBackgroundColor": "#F6F6F6"
}
} }
], ],
......
...@@ -196,15 +196,15 @@ ...@@ -196,15 +196,15 @@
uni.showLoading({ uni.showLoading({
title:'正在绑定' title:'正在绑定'
}) })
setStudentClassInAccount({account:data.searchResult.Account}).then(r=>{ let erpUsers=uni.getStorageSync("ErpStus")
let currentErpUser=uni.getStorageSync("erpUserInfo")
setStudentClassInAccount({account:data.searchResult.Account,uid:currentErpUser.AccountId}).then(r=>{
if(r.Code==1){ if(r.Code==1){
let users=uni.getStorageSync("users") let users=uni.getStorageSync("users")
users.push(data.searchResult) users.push(data.searchResult)
uni.setStorageSync('users',users) uni.setStorageSync('users',users)
uni.setStorageSync('userInfo',data.searchResult) uni.setStorageSync('userInfo',data.searchResult)
let erpUsers=uni.getStorageSync("ErpStus")
let currentErpUser=uni.getStorageSync("erpUserInfo")
erpUsers.forEach(x=>{ erpUsers.forEach(x=>{
if(x.AccountId==currentErpUser.AccountId){ if(x.AccountId==currentErpUser.AccountId){
x.ClassInAccount=data.searchResult.Account x.ClassInAccount=data.searchResult.Account
......
<template> <style scoped>
</template> .pages {
min-height: 100vh;
<script> background-color: #f6f6f6;
}
.addChild-header {
flex-direction: column;
align-items: center;
}
.addChild-header image {
padding: 54rpx 0 31rpx 0;
}
.addChild-header text {
font-size: 34rpx;
font-weight: 800;
color: #111111;
}
.header-text {
padding: 22rpx 0 37rpx 0;
font-size: 26rpx;
font-weight: 500;
color: #BEBEBE;
}
.header-input {
width: 100%;
box-sizing: border-box;
vertical-align: middle;
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 51rpx;
margin-bottom: 51rpx;
}
/deep/.van-cell {
line-height: 120rpx;
border-radius: 40rpx;
border: 4rpx solid red;
}
.addChild-buttom {
background: #C91727;
border-radius: 44px;
position: fixed;
left: 50rpx;
right: 50rpx;
bottom: 34rpx;
line-height: 88rpx;
color: #ffffff;
font-weight: 500;
font-size: 30rpx;
z-index: 999;
text-align: center;
}
.addChild-buttom.active {
background: rgba(201, 23, 39, .5);
}
.addChild .user-item {
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 36rpx;
background: #FFFFFF;
border-radius: 40rpx;
margin: 0 50rpx;
padding: 42rpx 54rpx;
margin-bottom: 40rpx;
}
.addChild .user-item .avatar {
width: 100rpx;
height: 100rpx;
background: rgba(252, 238, 239, 1);
border-radius: 40rpx;
font-size: 46rpx;
font-weight: 500;
color: rgba(206, 128, 134, 1);
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
.addChild .user-item .uname {
font-size: 28rpx;
margin-left: 32rpx;
font-weight: 500;
color: #000000;
width: 1px;
flex: 1;
}
.addChild .user-item .check {
color: #000000;
font-size: 36rpx;
}
/deep/.van-empty {
padding: 0;
}
</style>
<template>
<view class="addChild pages">
<scroll-view scroll-y="true" style="width:100%;height: 100%;margin-bottom: 70rpx;">
<view class="addChild-header flex">
<image
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1664160541000_21.png"
style="width: 352rpx;height: 218rpx;"></image>
<text v-if="userInfo">绑定学员 {{userInfo.AccountName}} 的帐户</text>
<view class="header-text">输入报名时填写的手机号码</view>
<view class="header-input">
<van-cell-group>
<van-field type="tel" :value="msg.StuTel" placeholder="输入手机号" clearable input-align="center"
right-icon="search" @blur="usernameInput" @click-icon="clickIcon" />
</van-cell-group>
</view>
</view>
<view style="margin-bottom: 100rpx;">
<view class="user-item" v-for="(item,index) in dataList" :key="index" @click="clickChecked(item)">
<view class="avatar">
{{item.StuName.substring(0,1)}}
</view>
<view class="uname">
{{item.StuName}}
</view>
<view class="check">
<van-icon :name="item.checked?'success':'circle'" />
</view>
</view>
<van-empty description="暂无小孩信息" v-if="dataList.length === 0 && isSearched" />
<view style="padding:0 52rpx;" v-if="(!dataList || dataList.length==0) && !isSearched">
<view style="font-size: 28rpx;color:#282828;">为什么需要手动绑定?</view>
<view style="font-size: 24rpx;color:#999;margin-top:10rpx">
这是由于您在为学员报名时提供的手机号码,与学员在ClassIn上课时使用的电话号码不一致造成的,您只需要完成首次绑定后即可正常使用系统
</view>
</view>
<!-- <view v-if="dataList.length > 0">
<Loadmore :state="pageState" />
</view> -->
</view>
</scroll-view>
<view v-if="loading" class="addChild-buttom" @click="setBindHandler">
已选{{list.length}}个,确认绑定
</view>
<view v-else class="addChild-buttom active">
已选{{list.length}}个,确认绑定
</view>
</view>
</template>
<script>
import {
ref,
reactive,
toRefs,
toRef,
getCurrentInstance,
watch,
computed,
onMounted,
inject,
} from "vue";
import Loadmore from "../../components/loadmore.vue";
import bottom from "../../components/bottom";
import {
GetStudentPageList,
SetMyChild,
setStudentClassInAccount
} from "../../api/erp";
export default {
components: {
bottom,
Loadmore,
},
setup(props, context) {
uni.hideLoading()
let {
proxy
} = getCurrentInstance();
let data = reactive({
loading: true,
form: {
Id: '',
AccountId: '',
StuId: '',
OpenId: '',
WeChatName: '',
WeChatImg: '',
UnionId: ''
},
msg: {
pageIndex: 1,
pageSize: 10,
StuTel: '', //关键词
},
pageCount: 0,
dataList: [],
list: [],
pageState: "more",
timer: null, //防抖
isSearched: false,
userInfo: null
});
data.userInfo = uni.getStorageSync('userInfo')
console.log(uni.getStorageSync('userInfo'))
const methods = {
setBindHandler() {
if (data.list.length == 0) {
uni.showToast({
title: '请选择需要添加的小孩',
icon: 'none',
duration: 1000
})
return;
}
data.loading = false
uni.showLoading({
title: '正在绑定'
})
setStudentClassInAccount({
account: data.userInfo.Account,
uid:data.list[0].StuId
}).then(r => {
if(r.Code==1){
methods.addChild();
}else{
data.loading=true
uni.hideLoading()
}
}).catch(e => {
data.loading = false
uni.hideLoading()
})
},
clickChecked(item) {
data.list = []
data.dataList.forEach(i => {
i.checked = false
if (item.StuId == i.StuId) {
data.list.push(i)
}
})
item.checked = true
},
clickIcon() {},
usernameInput(val) {
data.isSearched = false
console.log(val.detail.value)
if (val.detail.value.length == 11) {
data.msg.StuTel = val.detail.value
that.getData()
}
},
async addChild() {
let param = {}
let userWxInfo = uni.getStorageSync('userWxInfo')
let wxUserAuthInfo = uni.getStorageSync('wxUserAuthInfo')
param.StuId = data.list[0].StuId
param.WeChatName = userWxInfo.userInfo.nickName
param.WeChatImg = userWxInfo.userInfo.avatarUrl
param.UnionId = wxUserAuthInfo.unionid
data.loading = false
SetMyChild(param).then(res=>{
if (res.Code==1) {
uni.hideLoading()
uni.showToast({
title:'绑定成功'
})
//重新获取
uni.setStorageSync('erpUserInfo',res.Data)
let erpStus=uni.getStorageSync('ErpStus')
erpStus.push(res.Data)
uni.setStorageSync('ErpStus',erpStus)
data.loading = true
uni.reLaunch({
url:'/pages/index/index'
})
}else{
data.loading = true
uni.hideLoading()
uni.showToast({
title:'绑定失败',
icon:"error"
})
}
}).catch(e=>{
data.loading = true
uni.hideLoading()
uni.showToast({
title:'绑定失败',
icon:"error"
})
});
},
async getData() {
uni.showLoading()
let res = await GetStudentPageList(data.msg);
if (res) {
uni.hideLoading()
let datas = res.Data.PageData
let addList = function(arr) {
arr.forEach(item => {
item.checked = false
});
};
addList(datas);
if (data.timer) data.timer = null;
// data.dataList = res.Data&&res.Data.PageData;
// return
if (data.msg.pageIndex === 1) {
data.dataList = res.Data.PageData;
} else {
data.dataList = [...data.dataList, ...res.Data.PageData];
}
data.pageCount = res.Data.PageCount
if (data.msg.pageIndex >= res.Data.PageCount) {
data.pageState = "none";
} else {
data.pageState = "more";
}
}
data.isSearched = true
},
};
let that = methods;
onMounted(() => {
//that.getData()
});
return {
...toRefs(data),
...methods
};
},
onLoad(options) {
},
onShow() {
this.dataList = []
},
onReachBottom() {
if (this.msg.pageIndex < this.pageCount) {
this.pageState = "loading";
if (this.timer) clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.msg.pageIndex++;
this.getData();
}, 1000);
} else {
this.pageState = "none";
}
}
};
</script> </script>
<style>
</style>
\ No newline at end of file
...@@ -221,6 +221,7 @@ ...@@ -221,6 +221,7 @@
carousel carousel
}, },
setup(props, context) { setup(props, context) {
let { let {
proxy proxy
} = getCurrentInstance(); } = getCurrentInstance();
...@@ -323,6 +324,12 @@ ...@@ -323,6 +324,12 @@
}; };
}, },
onShow() { onShow() {
if(uni.getStorageSync('userInfo') && !uni.getStorageSync('erpUserInfo')){
uni.reLaunch({
url:'/pages/person/bind'
})
return;
}
if (this.$isLogin()) { if (this.$isLogin()) {
this.getData(); this.getData();
this.getyuyue() this.getyuyue()
......
...@@ -107,6 +107,13 @@ ...@@ -107,6 +107,13 @@
tabbar tabbar
}, },
setup(props) { setup(props) {
if(uni.getStorageSync('userInfo') && !uni.getStorageSync('erpUserInfo')){
uni.reLaunch({
url:'/pages/person/bind'
})
return;
}
const Toast = inject('$toast') const Toast = inject('$toast')
const indexData=uni.getStorageSync('indexData') const indexData=uni.getStorageSync('indexData')
let weekArr = ["日", "一", "二", "三", "四", "五", "六"]; let weekArr = ["日", "一", "二", "三", "四", "五", "六"];
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
let host = '' let host = ''
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
//host = 'https://jjswapi.oytour.com/api' //host = 'https://jjswapi.oytour.com/api'
// host = 'http://192.168.10.206:5004/api' host = 'http://192.168.10.206:5004/api'
host = 'http://192.168.10.128:8800/api' //host = 'http://192.168.10.206:8800/api'
} else { } else {
host = 'https://jjswapi.oytour.com/api' host = 'https://jjswapi.oytour.com/api'
} }
......
...@@ -2,15 +2,16 @@ ...@@ -2,15 +2,16 @@
let host = '' let host = ''
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
//host = 'https://jjswapi.oytour.com/api' //host = 'https://jjswapi.oytour.com/api'
// host = 'http://192.168.10.206:5005/api' host = 'http://192.168.10.206:5005/api'
host = 'http://192.168.10.128:8900/api' //host = 'http://192.168.10.128:8900/api'
} else { } else {
host = 'https://jjswapi.oytour.com/api' host = 'https://jjswapi.oytour.com/api'
} }
import Toast from '../wxcomponents/vant/toast/toast'; import Toast from '../wxcomponents/vant/toast/toast';
let request = (param) => { let request = (param) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let token = uni.getStorageSync('erpUserInfo').Token; let token = uni.getStorageSync('erpUserInfo').Token;
uni.request({ uni.request({
url: host + param.url, url: host + param.url,
method: param.method || "Post", method: param.method || "Post",
......
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