李双庆 10 months ago
parent
commit
3d55755fb6
  1. 15
      api/apiRoute.js
  2. 59
      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;
})
},

59
pages/student/index/index.vue

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

59
pages/student/login/login.vue

@ -25,7 +25,6 @@
</fui-input>
</view>
<view style="width: 95%;height: 30rpx;"></view>
<view style="width: 95%;margin:30rpx auto;">
<fui-input
@click="picker_show_loginType=true"
@ -64,6 +63,8 @@ import apiRoute from '@/api/apiRoute.js';
export default {
data() {
return {
inited: false, // init
password: true,
user: '', //
password1: '', //
@ -86,6 +87,13 @@ export default {
}
],
picker_show_loginType:false,//
path_arr:{
'1':'/pages/coach/home/index',//
'2':'/pages/market/index/index',//
'3':'/pages/student/index/index',//
},
}
},
onLoad(options) {
@ -94,14 +102,21 @@ export default {
this.loginType_str = selectedItem ? selectedItem.text : '未知类型';
// uni.hideHomeButton()
// console.log(uni.getStorageSync('um_id'))
this.init()
// onShow init
if (!this.inited) {
this.openViewHome()
this.inited = true
}
},
methods: {
async init(){
//
//#ifdef MP-WEIXIN
await this.getMiNiWxOpenId()
//#endif
},
input(e) {
console.log(e)
//console.log(e)
},
change() {
this.password = !this.password
@ -172,6 +187,7 @@ export default {
'login_type': 2,
'mini_wx_openid':this.mini_wx_openid,//openid
}
res = await apiRoute.xy_login(params)
}
if(!res.code){
@ -259,11 +275,44 @@ export default {
this.password1= '123123' //
}else{
//
this.user= '' //
this.password1= '' //
this.user= '15335526445' //
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>

Loading…
Cancel
Save