李双庆 10 months ago
parent
commit
3d55755fb6
  1. 15
      api/apiRoute.js
  2. 61
      pages/student/index/index.vue
  3. 59
      pages/student/login/login.vue

15
api/apiRoute.js

@ -403,7 +403,20 @@ export default {
//↓↓↓↓↓↓↓↓↓↓↓↓-----学生接口相关-----↓↓↓↓↓↓↓↓↓↓↓↓ //↓↓↓↓↓↓↓↓↓↓↓↓-----学生接口相关-----↓↓↓↓↓↓↓↓↓↓↓↓
//学生登陆接口
xy_login(data = {}) {
let url = '/customerResourcesAuth/login'
return http.post(url, data).then(res => {
return res;
})
},
//学生详情
xy_memberInfo(data = {}) {
let url = '/customerResourcesAuth/info'
return http.get(url, data).then(res => {
return res;
})
},

61
pages/student/index/index.vue

@ -6,7 +6,7 @@
<view class="head"> <view class="head">
<view class="head-img"> <view class="head-img">
<!-- <fui-avatar width="136" :src="$util.img(member_info.headimg)"></fui-avatar> --> <!-- <fui-avatar width="136" :src="$util.img(member_info.headimg)"></fui-avatar> -->
<image class="pic" :src="$util.img(member_info.headimg)"></image> <image class="pic" :src="member_info.memberHasOne ? member_info.memberHasOne.headimg : $util.img('/uniapp_src/static/images/common/yong_hu.png')"></image>
<view class="head-text">{{member_info.name}}</view> <view class="head-text">{{member_info.name}}</view>
</view> </view>
</view> </view>
@ -123,6 +123,8 @@
<script> <script>
import {Api_url} from "@/common/config"; import {Api_url} from "@/common/config";
import apiRoute from '@/api/apiRoute.js';
import memberApi from '@/api/member.js'; import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue" import AQTabber from "@/components/AQ/AQTabber.vue"
export default { export default {
@ -131,12 +133,15 @@
}, },
data() { data() {
return { return {
inited: false, // init
// //
uploadApiUrl: ``, uploadApiUrl: ``,
uploadImageApiUrl: `${Api_url}/file/image`, uploadImageApiUrl: `${Api_url}/file/image`,
uploadVideoApiUrl: `${Api_url}/file/video`, uploadVideoApiUrl: `${Api_url}/file/video`,
member_info: [], member_info: {},//
assignmentsList: [],// assignmentsList: [],//
jobAssignmentsInfo: [],// jobAssignmentsInfo: [],//
@ -168,23 +173,27 @@
} }
}, },
onLoad() { onLoad() {
this.openViewHome()//-
}, },
onShow(){ onShow(){
this.openViewHome()//- // onShow init
if (!this.inited) {
this.init()
this.inited = true
}
}, },
methods: { methods: {
// //
async init(){ async init(){
this.member_init() await this.member_init()
this.getMemberIndex() this.getMemberIndex()
this.getList() this.getList()
this.getJobAssignmentsInfo() this.getJobAssignmentsInfo()
}, },
//-
async openViewHome(){ async openViewHome_COPY(){
// //
let pages = getCurrentPages(); let pages = getCurrentPages();
// //
@ -194,21 +203,24 @@
this.openPath = this.path_arr[userType] this.openPath = this.path_arr[userType]
console.log(
'跳转',
this.thisPath,
userType,
this.path_arr[userType]
)
if(this.thisPath != this.openPath){ if(this.thisPath != this.openPath){
console.log('打印1')
//tabBar- //tabBar-
uni.setStorageSync('tabBerIndex', 0) uni.setStorageSync('tabBerIndex', 0)
uni.navigateTo({ uni.navigateTo({
url: this.openPath url: this.openPath
}) })
return
}else{ }else{
// //->
this.init() this.init()
} }
console.log(123123123123,this.thisPath,userType,this.path_arr[userType])
}, },
async getMemberIndex(){ async getMemberIndex(){
@ -269,15 +281,20 @@
}, },
// //
member_init() { async member_init() {
memberApi.member().then(res => { let res = await apiRoute.xy_memberInfo({})
if(res.code == 1){ if(res.code != 1){
this.member_info = res.data uni.showToast({
}else{ title: res.msg,
this.member_info = [] icon: 'none'
} })
}) return
}
this.member_info = res.data
console.log('xxxx',this.member_info)
}, },
//-
details() { details() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/student/index/work_details' url: '/pages/student/index/work_details'

59
pages/student/login/login.vue

@ -25,7 +25,6 @@
</fui-input> </fui-input>
</view> </view>
<view style="width: 95%;height: 30rpx;"></view>
<view style="width: 95%;margin:30rpx auto;"> <view style="width: 95%;margin:30rpx auto;">
<fui-input <fui-input
@click="picker_show_loginType=true" @click="picker_show_loginType=true"
@ -64,6 +63,8 @@ import apiRoute from '@/api/apiRoute.js';
export default { export default {
data() { data() {
return { return {
inited: false, // init
password: true, password: true,
user: '', // user: '', //
password1: '', // password1: '', //
@ -86,6 +87,13 @@ export default {
} }
], ],
picker_show_loginType:false,// picker_show_loginType:false,//
path_arr:{
'1':'/pages/coach/home/index',//
'2':'/pages/market/index/index',//
'3':'/pages/student/index/index',//
},
} }
}, },
onLoad(options) { onLoad(options) {
@ -94,14 +102,21 @@ export default {
this.loginType_str = selectedItem ? selectedItem.text : '未知类型'; this.loginType_str = selectedItem ? selectedItem.text : '未知类型';
// uni.hideHomeButton() // uni.hideHomeButton()
// console.log(uni.getStorageSync('um_id')) // console.log(uni.getStorageSync('um_id'))
this.init() // onShow init
if (!this.inited) {
this.openViewHome()
this.inited = true
}
}, },
methods: { methods: {
async init(){ async init(){
//
//#ifdef MP-WEIXIN
await this.getMiNiWxOpenId() await this.getMiNiWxOpenId()
//#endif
}, },
input(e) { input(e) {
console.log(e) //console.log(e)
}, },
change() { change() {
this.password = !this.password this.password = !this.password
@ -172,6 +187,7 @@ export default {
'login_type': 2, 'login_type': 2,
'mini_wx_openid':this.mini_wx_openid,//openid 'mini_wx_openid':this.mini_wx_openid,//openid
} }
res = await apiRoute.xy_login(params)
} }
if(!res.code){ if(!res.code){
@ -259,11 +275,44 @@ export default {
this.password1= '123123' // this.password1= '123123' //
}else{ }else{
// //
this.user= '' // this.user= '15335526445' //
this.password1= '' // this.password1= '123123' //
} }
}, },
//-
async openViewHome() {
const userType = String(uni.getStorageSync('userType') || '');
const token = uni.getStorageSync('token') || ''
if(!userType || !token){
return
}
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const thisPath = '/' + currentPage.route;
const openPath = this.path_arr[userType];
console.log('当前路径:', thisPath);
console.log('用户类型:', userType);
console.log('应跳转路径:', openPath);
if (thisPath !== openPath) {
//
uni.setStorageSync('tabBerIndex', 0)
// 使 redirectTo navigateTo
uni.redirectTo({
url: openPath
});
return
}
// onShow
},
} }
} }
</script> </script>

Loading…
Cancel
Save