This commit is contained in:
parent
39ada29f62
commit
c281dbebe9
135
api/request.js
135
api/request.js
|
|
@ -4,74 +4,87 @@ import config from '@/config'
|
||||||
import { getToken } from '@/utils/auth.js'
|
import { getToken } from '@/utils/auth.js'
|
||||||
// import store from '@/store';
|
// import store from '@/store';
|
||||||
|
|
||||||
const baseUrl = config.baseUrl
|
let baseUrl = ''
|
||||||
|
if (uni.getStorageSync('jwtToken')) {
|
||||||
|
baseUrl = config.baseUrl
|
||||||
|
} else {
|
||||||
|
baseUrl = config.loginBaseUrl
|
||||||
|
}
|
||||||
|
console.log('baseUrl-请求', baseUrl)
|
||||||
|
|
||||||
const http = new Request({
|
const http = new Request({
|
||||||
// baseURL: "http://172.16.19.33:8081/prod-api", //设置请求的base url
|
// baseURL: "http://172.16.19.33:8081/prod-api", //设置请求的base url
|
||||||
// baseURL: "/dev-api", //设置请求的base url
|
// baseURL: "/dev-api", //设置请求的base url
|
||||||
baseURL: baseUrl, //设置请求的base url
|
baseURL: baseUrl, //设置请求的base url
|
||||||
timeout: 300000, //超时时长5分钟,
|
timeout: 300000, //超时时长5分钟,
|
||||||
header: {
|
header: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Authorization':getToken()
|
Authorization: getToken()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
//请求拦截器
|
//请求拦截器
|
||||||
http.interceptors.request.use((config) => { // 可使用async await 做异步操作
|
http.interceptors.request.use(
|
||||||
// console.log('请求拦截器');
|
config => {
|
||||||
|
// 可使用async await 做异步操作
|
||||||
|
// console.log('请求拦截器');
|
||||||
|
|
||||||
// // console.log(config);
|
// // console.log(config);
|
||||||
// if (config.method === 'POST' && config.data.h) {
|
// if (config.method === 'POST' && config.data.h) {
|
||||||
// config.header = {
|
// config.header = {
|
||||||
// ...config.header,
|
// ...config.header,
|
||||||
// 'Content-Type': 'application/json;charset=UTF-8;'
|
// 'Content-Type': 'application/json;charset=UTF-8;'
|
||||||
// }
|
// }
|
||||||
// // config.data = JSON.stringify(config.data);
|
// // config.data = JSON.stringify(config.data);
|
||||||
// }else{
|
// }else{
|
||||||
// config.header = {
|
// config.header = {
|
||||||
// ...config.header,
|
// ...config.header,
|
||||||
// // 'uToken':Vue.prototype.$store.state.token,
|
// // 'uToken':Vue.prototype.$store.state.token,
|
||||||
// 'content-type':'application/x-www-form-urlencoded',
|
// 'content-type':'application/x-www-form-urlencoded',
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // if(getToken()){
|
// // if(getToken()){
|
||||||
// // console.log(">>>>>>",getToken());
|
// // console.log(">>>>>>",getToken());
|
||||||
// // config.header.Authorization='Bearer ' +getToken();
|
// // config.header.Authorization='Bearer ' +getToken();
|
||||||
// // }
|
// // }
|
||||||
if(config.data&&!config.data.noShowLoading){
|
if (config.data && !config.data.noShowLoading) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
console.log(config.data)
|
console.log(config.data)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}, error => {
|
},
|
||||||
return Promise.resolve(error)
|
error => {
|
||||||
})
|
return Promise.resolve(error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
http.interceptors.response.use((response) => {
|
http.interceptors.response.use(
|
||||||
// console.log('响应拦截器');
|
response => {
|
||||||
uni.hideLoading();
|
// console.log('响应拦截器');
|
||||||
return response
|
uni.hideLoading()
|
||||||
}, (error) => {
|
return response
|
||||||
if (error.statusCode == 302) {
|
},
|
||||||
uni.clearStorageSync();
|
error => {
|
||||||
uni.switchTab({
|
if (error.statusCode == 302) {
|
||||||
url: "/pages/gzt/index"
|
uni.clearStorageSync()
|
||||||
})
|
uni.switchTab({
|
||||||
}
|
url: '/pages/gzt/index'
|
||||||
//未登录时清空缓存跳转
|
})
|
||||||
if (error.statusCode == 401) {
|
}
|
||||||
uni.clearStorageSync();
|
//未登录时清空缓存跳转
|
||||||
uni.switchTab({
|
if (error.statusCode == 401) {
|
||||||
// url: "/pages/changguan/subscribe-fill"
|
uni.clearStorageSync()
|
||||||
url: "/pages/gzt/index"
|
uni.switchTab({
|
||||||
})
|
// url: "/pages/changguan/subscribe-fill"
|
||||||
}
|
url: '/pages/gzt/index'
|
||||||
return Promise.resolve(error)
|
})
|
||||||
})
|
}
|
||||||
export default http;
|
return Promise.resolve(error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
export default http
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
// 应用全局配置
|
// 应用全局配置
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// baseUrl:'/prod-api',
|
// baseUrl:'/prod-api',
|
||||||
baseUrl:'http://112.29.103.165:1616',
|
loginBaseUrl:'http://112.29.103.165:1616',
|
||||||
|
// baseUrl:'http://192.168.0.14:2900',
|
||||||
|
baseUrl:'http://192.168.0.32:2900',
|
||||||
loginUrl: 'http://112.29.103.165:1616',
|
loginUrl: 'http://112.29.103.165:1616',
|
||||||
login: 'http://192.168.0.14:19200',
|
login: 'http://192.168.0.32:19200',
|
||||||
// baseUrl:'http://192.168.0.137:2900',
|
|
||||||
// 图片展示基础地址
|
// 图片展示基础地址
|
||||||
fileUrl:'http://192.168.0.137:2909/exam-file/',
|
fileUrl:'http://192.168.0.137:2909/exam-file/',
|
||||||
// 上传文件地址
|
// 上传文件地址
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name" : "作业管控智慧平台",
|
"name" : "作业管控智慧平台",
|
||||||
"appid" : "__UNI__0EB2E47",
|
"appid" : "__UNI__4165875",
|
||||||
"description" : "作业管控智慧平台",
|
"description" : "作业管控智慧平台",
|
||||||
"versionName" : "1.0.4",
|
"versionName" : "1.0.4",
|
||||||
"versionCode" : 104,
|
"versionCode" : 104,
|
||||||
|
|
@ -71,33 +71,33 @@
|
||||||
"icons" : {
|
"icons" : {
|
||||||
"ios" : {
|
"ios" : {
|
||||||
"iphone" : {
|
"iphone" : {
|
||||||
"app@2x" : "unpackage/res/icons/120x120.png",
|
"app@2x" : "",
|
||||||
"app@3x" : "unpackage/res/icons/180x180.png",
|
"app@3x" : "",
|
||||||
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
"spotlight@2x" : "",
|
||||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
"notification@2x" : "",
|
||||||
"notification@3x" : "unpackage/res/icons/60x60.png",
|
"notification@3x" : "",
|
||||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
"settings@2x" : "",
|
||||||
"settings@3x" : "unpackage/res/icons/87x87.png",
|
"settings@3x" : "",
|
||||||
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
"spotlight@3x" : ""
|
||||||
},
|
},
|
||||||
"appstore" : "unpackage/res/icons/1024x1024.png",
|
"appstore" : "",
|
||||||
"ipad" : {
|
"ipad" : {
|
||||||
"app" : "unpackage/res/icons/76x76.png",
|
"app" : "",
|
||||||
"app@2x" : "unpackage/res/icons/152x152.png",
|
"app@2x" : "",
|
||||||
"notification" : "unpackage/res/icons/20x20.png",
|
"notification" : "",
|
||||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
"notification@2x" : "",
|
||||||
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
"proapp@2x" : "",
|
||||||
"settings" : "unpackage/res/icons/29x29.png",
|
"settings" : "",
|
||||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
"settings@2x" : "",
|
||||||
"spotlight" : "unpackage/res/icons/40x40.png",
|
"spotlight" : "",
|
||||||
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
"spotlight@2x" : ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"android" : {
|
"android" : {
|
||||||
"hdpi" : "unpackage/res/icons/72x72.png",
|
"hdpi" : "",
|
||||||
"xhdpi" : "unpackage/res/icons/96x96.png",
|
"xhdpi" : "",
|
||||||
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
"xxhdpi" : "",
|
||||||
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
"xxxhdpi" : ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"splashscreen" : {
|
"splashscreen" : {
|
||||||
|
|
|
||||||
14
pages.json
14
pages.json
|
|
@ -201,6 +201,20 @@
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : "人脸识别"
|
"navigationBarTitleText" : "人脸识别"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/YNEduApp/user/myMsg",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "消息通知"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/YNEduApp/user/msgDetail",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"navigationBarTitleText" : "消息详情"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<uni-icons type="scan" size="24" style="margin-right: 2vw; color: #bababa" @click="toggleScan"></uni-icons>
|
<uni-icons type="scan" size="24" style="margin-right: 2vw; color: #bababa" @click="toggleScan"></uni-icons>
|
||||||
<uni-easyinput
|
<uni-easyinput
|
||||||
suffixIcon="search"
|
suffixIcon="search"
|
||||||
v-model="searchIpt"
|
v-model="keyword"
|
||||||
placeholder="请输入搜索关键词"
|
placeholder="请输入搜索关键词"
|
||||||
@iconClick="toggleSearch"
|
@iconClick="toggleSearch"
|
||||||
></uni-easyinput>
|
></uni-easyinput>
|
||||||
|
|
@ -28,18 +28,33 @@
|
||||||
scrollable
|
scrollable
|
||||||
color="#808080"
|
color="#808080"
|
||||||
background-color="transparent"
|
background-color="transparent"
|
||||||
text="uni-app 版正式发布,开发一次,同时发布iOS、Android、H5、微信小程序、支付宝小程序、百度小程序、头条小程序等7大平台。"
|
:text="msgList.length > 0 ? msgList[0].noticeName : '暂无消息'"
|
||||||
|
@click="handleMsg"
|
||||||
/>
|
/>
|
||||||
<view class="my-task">
|
<view class="my-task">
|
||||||
<h3 style="margin-bottom: 1vh">我的任务</h3>
|
<h3 style="margin-bottom: 1vh">我的任务</h3>
|
||||||
<view class="task-list">
|
<div class="task-list">
|
||||||
|
<div class="list-item" v-for="(item, index) in taskList" :key="index" @click="toggleDetail(item.id)">
|
||||||
|
<div class="item-title">{{ item.name }}</div>
|
||||||
|
<div>{{ item.userName }}</div>
|
||||||
|
<div>{{ item.validityDate }}</div>
|
||||||
|
<div class="item-progress">
|
||||||
|
<u-line-progress
|
||||||
|
:percentage="Number(item.trainPercentage)"
|
||||||
|
:showText="false"
|
||||||
|
height="8"
|
||||||
|
activeColor="#579AF8"
|
||||||
|
/>
|
||||||
|
<div>{{ item.trainPercentage }}%</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<view class="no-task" v-show="taskList.length === 0">
|
<view class="no-task" v-show="taskList.length === 0">
|
||||||
<view class="no-task-img">
|
<view class="no-task-img">
|
||||||
<image src="/static/eduImg/no-task.png"></image>
|
<image src="/static/eduImg/no-task.png"></image>
|
||||||
<span>可联系管理员发布</span>
|
<span>可联系管理员发布</span>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
<m-tabbar fixed fill :current="0" :tabbar="tabbar"></m-tabbar>
|
<m-tabbar fixed fill :current="0" :tabbar="tabbar"></m-tabbar>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -48,12 +63,14 @@
|
||||||
<script>
|
<script>
|
||||||
import TabbarConfig from '@/tabbar.js'
|
import TabbarConfig from '@/tabbar.js'
|
||||||
// import face from '../../../uni_modules/mcc-face/index'
|
// import face from '../../../uni_modules/mcc-face/index'
|
||||||
import { getNoticeAnnoByUserId } from '@/api/eduApp/index.js'
|
import { getNoticeAnnoByUserId, getStudentStudyWorkList } from '@/api/eduApp'
|
||||||
|
import config from '@/config'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
userId: uni.getStorageSync('userId'),
|
||||||
tabbar: TabbarConfig,
|
tabbar: TabbarConfig,
|
||||||
searchIpt: '',
|
keyword: '',
|
||||||
opts: [
|
opts: [
|
||||||
{ name: '学习项目', src: '/static/eduImg/learnProj.png', url: 'learnProj' },
|
{ name: '学习项目', src: '/static/eduImg/learnProj.png', url: 'learnProj' },
|
||||||
// { name: '学习', src: '/static/eduImg/learn.png', url: 'learn' },
|
// { name: '学习', src: '/static/eduImg/learn.png', url: 'learn' },
|
||||||
|
|
@ -74,10 +91,11 @@ export default {
|
||||||
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
|
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
taskList: []
|
taskList: [],
|
||||||
|
msgList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
mounted() {
|
||||||
this.getUserInfo()
|
this.getUserInfo()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -101,14 +119,58 @@ export default {
|
||||||
console.log('🚀 ~ getUserInfo ~ req:', req, req.data.access_token)
|
console.log('🚀 ~ getUserInfo ~ req:', req, req.data.access_token)
|
||||||
uni.setStorageSync('App-Token', req.data.access_token)
|
uni.setStorageSync('App-Token', req.data.access_token)
|
||||||
uni.setStorageSync('userId', req.data.loginUser.userId)
|
uni.setStorageSync('userId', req.data.loginUser.userId)
|
||||||
|
setTimeout(() => {
|
||||||
|
// this.getList()
|
||||||
|
}, 1000)
|
||||||
|
this.getMsgList()
|
||||||
},
|
},
|
||||||
fail: err => {
|
fail: err => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toggleSearch() {
|
async getList() {
|
||||||
console.log(this.searchIpt)
|
this.taskList = []
|
||||||
|
let params = {
|
||||||
|
userId: this.userId,
|
||||||
|
status: '0'
|
||||||
|
}
|
||||||
|
const res = await getStudentStudyWorkList(params)
|
||||||
|
this.taskList = res.data
|
||||||
|
},
|
||||||
|
// 搜索
|
||||||
|
async toggleSearch() {
|
||||||
|
this.taskList = []
|
||||||
|
console.log('开始搜索', this.keyword)
|
||||||
|
let params = {
|
||||||
|
userId: this.userId,
|
||||||
|
status: '0',
|
||||||
|
name: this.keyword
|
||||||
|
}
|
||||||
|
const res = await getStudentStudyWorkList(params)
|
||||||
|
this.taskList = res.data
|
||||||
|
},
|
||||||
|
// 获取消息列表
|
||||||
|
async getMsgList() {
|
||||||
|
uni.request({
|
||||||
|
url: config.bmwUrl + '/studentUsers/getNoticeList',
|
||||||
|
method: 'post',
|
||||||
|
data: {},
|
||||||
|
header: {
|
||||||
|
Authorization: this.token
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
console.log('🚀 ~ getMsgList ~ res:', res)
|
||||||
|
this.msgList = res.data
|
||||||
|
console.log('🚀 ~ getMsgList ~ this.msgList:', this.msgList)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 点击消息
|
||||||
|
handleMsg() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/YNEduApp/user/myMsg'
|
||||||
|
})
|
||||||
},
|
},
|
||||||
toggleScan() {
|
toggleScan() {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
|
|
@ -126,7 +188,12 @@ export default {
|
||||||
face.open(['a', 'c'], function (e) {
|
face.open(['a', 'c'], function (e) {
|
||||||
face.close()
|
face.close()
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
toggleDetail(id) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/YNEduApp/learnProj/learnProjDetail?id=${id}`
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
/* getNoticeAnnoByUserId({
|
/* getNoticeAnnoByUserId({
|
||||||
|
|
@ -211,6 +278,27 @@ export default {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
|
.list-item {
|
||||||
|
margin: 10px 0;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 5px;
|
||||||
|
font-size: 13px;
|
||||||
|
.item-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.item-progress {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.u-line-progress {
|
||||||
|
width: 80%;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.no-task {
|
.no-task {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
:isLink="true"
|
:isLink="true"
|
||||||
:border="false"
|
:border="false"
|
||||||
style="border-bottom: 1px solid #E9E9E9"
|
style="border-bottom: 1px solid #E9E9E9"
|
||||||
|
@click="handleAvatar"
|
||||||
>
|
>
|
||||||
<image
|
<image
|
||||||
:src="infos.avatar"
|
:src="infos.avatar"
|
||||||
|
|
@ -57,17 +58,25 @@
|
||||||
return {
|
return {
|
||||||
infos: {
|
infos: {
|
||||||
avatar: '',
|
avatar: '',
|
||||||
username: '马晓峰',
|
username: '',
|
||||||
unit: '测试单位'
|
unit: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(opt) {
|
||||||
console.log('🚀 ~ onLoad')
|
console.log('🚀 ~ onLoad')
|
||||||
|
opt = JSON.parse(opt.params)
|
||||||
|
this.infos.username = opt.userName
|
||||||
|
this.infos.unit = opt.className
|
||||||
this.infos.avatar = uni.getStorageSync('facePath')
|
this.infos.avatar = uni.getStorageSync('facePath')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 点击头像
|
||||||
|
handleAvatar() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/YNEduApp/user/faceScan'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<div class="msg-wrapper">
|
||||||
|
<div class="msg-title">{{ noticeName }}</div>
|
||||||
|
<div class="msg-content" v-html="noticeContent"></div>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
noticeName: '',
|
||||||
|
noticeContent: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(opt) {
|
||||||
|
opt = JSON.parse(opt.params)
|
||||||
|
console.log('🚀 ~ onLoad ~ opt:', opt)
|
||||||
|
this.noticeName = opt.noticeName
|
||||||
|
this.noticeContent = opt.noticeContent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.msg-wrapper {
|
||||||
|
margin: 10px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
.msg-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.msg-content {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<div class="msg-list" v-for="(item, index) in msgList" :key="index" @click="handleDetail(item)">
|
||||||
|
<div class="msg-title">{{ item.noticeName }}</div>
|
||||||
|
<div class="msg-time">{{ item.createTime }}</div>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import config from '@/config'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
userId: uni.getStorageSync('userId'),
|
||||||
|
token: uni.getStorageSync('App-Token'),
|
||||||
|
// 消息列表
|
||||||
|
msgList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
// this.getMsgList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取消息列表
|
||||||
|
async getMsgList() {
|
||||||
|
uni.request({
|
||||||
|
url: config.bmwUrl + '/studentUsers/getNoticeList',
|
||||||
|
method: 'post',
|
||||||
|
data: {},
|
||||||
|
header: {
|
||||||
|
Authorization: this.token
|
||||||
|
},
|
||||||
|
success: res => {
|
||||||
|
console.log('🚀 ~ getMsgList ~ res:', res)
|
||||||
|
this.msgList = res.data
|
||||||
|
console.log('🚀 ~ getMsgList ~ this.msgList:', this.msgList)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 跳转消息详情
|
||||||
|
handleDetail(item) {
|
||||||
|
const params = {
|
||||||
|
noticeName: item.noticeName,
|
||||||
|
noticeContent: item.noticeContent,
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/YNEduApp/user/msgDetail?params=${JSON.stringify(params)}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.msg-list {
|
||||||
|
margin: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 5px;
|
||||||
|
.msg-title {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.msg-time {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #999;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<span style="font-size: 12px; color: #8a8a8b">{{ className }}</span>
|
<span style="font-size: 12px; color: #8a8a8b">{{ className }}</span>
|
||||||
</view>
|
</view>
|
||||||
<view class="edit-btn">
|
<view class="edit-btn">
|
||||||
<view @click="jumpUrl('editProfile')">修改资料</view>
|
<view @click="handleEdit">修改资料</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="learn-infos">
|
<view class="learn-infos">
|
||||||
|
|
@ -63,11 +63,12 @@ export default {
|
||||||
{ id: 3, title: '我的消息', src: '/static/eduImg/myMsg.png', path: 'myMsg' },
|
{ id: 3, title: '我的消息', src: '/static/eduImg/myMsg.png', path: 'myMsg' },
|
||||||
{ id: 4, title: '设置', src: '/static/eduImg/settings.png', path: 'settings' }
|
{ id: 4, title: '设置', src: '/static/eduImg/settings.png', path: 'settings' }
|
||||||
],
|
],
|
||||||
token: ''
|
token: uni.getStorageSync('App-Token')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.token = uni.getStorageSync('App-Token')
|
// this.token = uni.getStorageSync('App-Token')
|
||||||
|
console.log('🚀 ~ onLoad ~ this.token:', this.token)
|
||||||
this.getUserInfo()
|
this.getUserInfo()
|
||||||
this.getLearnStats()
|
this.getLearnStats()
|
||||||
},
|
},
|
||||||
|
|
@ -112,16 +113,25 @@ export default {
|
||||||
url: config.baseUrl + '/exam-student/personalCenter/getStudyAndCer',
|
url: config.baseUrl + '/exam-student/personalCenter/getStudyAndCer',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
header: {
|
header: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
Authorization: this.token
|
Authorization: this.token
|
||||||
},
|
},
|
||||||
data: {},
|
data: {},
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log('🚀 ~ getLearnStats ~ res:', res)
|
console.log('🚀 ~ getLearnStats ~ res:', res)
|
||||||
this.allDuration = res.data.data.allDuration
|
this.allDuration = (res.data && res.data.data.allDuration) || 0
|
||||||
this.value = res.data.data.value
|
this.value = (res.data && res.data.data.value) || 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
// 修改资料
|
||||||
|
handleEdit() {
|
||||||
|
const params = {
|
||||||
|
userName: this.userName,
|
||||||
|
className: this.className
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/YNEduApp/user/editProfile?params=' + JSON.stringify(params)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,17 @@
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken, setToken } from '@/utils/auth'
|
||||||
import errorCode from '@/utils/errorCode'
|
import errorCode from '@/utils/errorCode'
|
||||||
import { toast, showConfirm, tansParams } from '@/utils/common'
|
import { toast, showConfirm, tansParams } from '@/utils/common'
|
||||||
|
|
||||||
let timeout = 10000
|
let timeout = 10000
|
||||||
const baseUrl = config.baseUrl
|
let baseUrl = ''
|
||||||
|
if (uni.getStorageSync('jwtToken')) {
|
||||||
|
baseUrl = config.baseUrl
|
||||||
|
} else {
|
||||||
|
baseUrl = config.loginBaseUrl
|
||||||
|
}
|
||||||
|
console.log('baseUrl-请求', baseUrl)
|
||||||
|
|
||||||
const request = config => {
|
const request = config => {
|
||||||
// 是否需要设置 token
|
// 是否需要设置 token
|
||||||
|
|
@ -13,6 +19,15 @@ const request = config => {
|
||||||
config.header = config.header || {}
|
config.header = config.header || {}
|
||||||
if (getToken() && !isToken) {
|
if (getToken() && !isToken) {
|
||||||
config.header['Authorization'] = 'Bearer ' + getToken()
|
config.header['Authorization'] = 'Bearer ' + getToken()
|
||||||
|
} else {
|
||||||
|
// 没有token - 去登录
|
||||||
|
// store.dispatch('LogOut').then(() => {
|
||||||
|
// uni.reLaunch({ url: '/pages/login' })
|
||||||
|
// })
|
||||||
|
// const token = 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozMSwidXNlcl9rZXkiOiJiZmJmOGEzZC1hYTc1LTQ4MzQtOGM3NC0yZmQzOTEwZDllYzAiLCJ1c2VybmFtZSI6IuaWueS6riJ9.kv1WmthbgTrqapbsGLvevk-nwbWbYJMniyjj8DC3BSnQjCwm8csQ5GaNpfsLFFFYIHBYa8CrN_sBxXhDKOfR_A'
|
||||||
|
// const userId = 31
|
||||||
|
// setUserId(userId)
|
||||||
|
// setToken(token)
|
||||||
}
|
}
|
||||||
// get请求映射params参数
|
// get请求映射params参数
|
||||||
if (config.params) {
|
if (config.params) {
|
||||||
|
|
@ -20,23 +35,25 @@ const request = config => {
|
||||||
url = url.slice(0, -1)
|
url = url.slice(0, -1)
|
||||||
config.url = url
|
config.url = url
|
||||||
}
|
}
|
||||||
if (config.method === 'post' ) {
|
if (config.method === 'post') {
|
||||||
config.header = {
|
config.header = {
|
||||||
...config.header,
|
...config.header,
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}
|
}
|
||||||
// config.data = JSON.stringify(config.data);
|
// config.data = JSON.stringify(config.data);
|
||||||
}
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.request({
|
uni
|
||||||
|
.request({
|
||||||
method: config.method || 'get',
|
method: config.method || 'get',
|
||||||
timeout: config.timeout || timeout,
|
timeout: config.timeout || timeout,
|
||||||
url: config.baseUrl || baseUrl + config.url,
|
url: baseUrl + config.url,
|
||||||
data: config.data,
|
data: config.data,
|
||||||
header: config.header,
|
header: config.header,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).then(response => {
|
})
|
||||||
// console.log(response)
|
.then(response => {
|
||||||
|
// console.log(response)
|
||||||
let [error, res] = response
|
let [error, res] = response
|
||||||
if (error) {
|
if (error) {
|
||||||
toast('后端接口连接异常')
|
toast('后端接口连接异常')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue