Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
educationStu
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
向伟
educationStu
Commits
0c91ba88
Commit
0c91ba88
authored
Aug 18, 2021
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
c2d9530e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
242 additions
and
216 deletions
+242
-216
main.js
src/main.js
+4
-0
askForLeaveList.vue
src/pages/course/askForLeaveList.vue
+1
-1
examPaper.vue
src/pages/exam/examPaper.vue
+5
-2
index.vue
src/pages/index/index.vue
+6
-2
index2.vue
src/pages/index/index2.vue
+19
-1
login.vue
src/pages/login/login.vue
+197
-207
common.css
src/static/css/common.css
+5
-1
request.js
src/utils/request.js
+5
-2
No files found.
src/main.js
View file @
0c91ba88
...
...
@@ -3,8 +3,12 @@ import {
}
from
'vue'
import
App
from
'./App.vue'
import
Toast
from
"./wxcomponents/vant/toast/toast"
;
import
Dialog
from
"./wxcomponents/vant/dialog/dialog"
;
import
plugin
from
'./utils/plugin'
let
app
=
createApp
(
App
)
app
.
provide
(
"$toast"
,
Toast
)
app
.
provide
(
"$dialog"
,
Dialog
)
app
.
use
(
plugin
)
// app.config.globalProperties.$toast = Toast;//全局挂载方法
// app.component('v-MessageBox',MessageBox);//全局注册组件
app
.
mount
()
src/pages/course/askForLeaveList.vue
View file @
0c91ba88
...
...
@@ -90,7 +90,6 @@ import {
}
from
"vue"
;
import
{
getStudentLeaveList
,
invalidReceiptInfo
}
from
"../../api/index"
;
import
Loadmore
from
"../../components/loadmore.vue"
;
import
Dialog
from
"../../wxcomponents/vant/dialog/dialog"
;
export
default
{
components
:
{
Loadmore
,
...
...
@@ -98,6 +97,7 @@ export default {
setup
()
{
let
userInfo
=
uni
.
getStorageSync
(
"userInfo"
);
let
Toast
=
inject
(
"$toast"
);
let
Dialog
=
inject
(
"$dialog"
);
let
data
=
reactive
({
data
:
[],
pageState
:
"more"
,
...
...
src/pages/exam/examPaper.vue
View file @
0c91ba88
...
...
@@ -2,9 +2,11 @@
<view
:style=
"
{ 'padding-top': `${statusBarHeight}px` }">
<view
style=
"height: 100rpx"
></view>
<van-nav-bar
fixed
>
<van-icon
name=
"cross"
slot=
"left"
size=
"30rpx"
@
click=
"back"
/>
<template
#
left
>
<van-icon
name=
"cross"
size=
"30rpx"
@
click=
"back"
/>
</
template
>
<
template
#
title
>
<view
slot=
"title"
class=
"flex"
style=
"justify-content: center"
@
click=
"start"
...
...
@@ -23,6 +25,7 @@
ref=
"countdown"
/>
</view>
</
template
>
</van-nav-bar>
<view
class=
"exam-con"
>
<Sub1
/>
...
...
src/pages/index/index.vue
View file @
0c91ba88
...
...
@@ -131,6 +131,7 @@ import {
}
from
"vue"
;
import
{
getIndexInfo
}
from
"../../api/index"
;
import
{
getSystemInfo
,
desensitization
}
from
"../../utils/index"
;
import
request
from
"../../utils/request.js"
;
export
default
{
name
:
""
,
props
:
{},
...
...
@@ -203,7 +204,6 @@ export default {
},
],
});
let
methods
=
{
jumpPage
(
url
)
{
uni
.
navigateTo
({
...
...
@@ -232,6 +232,7 @@ export default {
};
onMounted
(()
=>
{
console
.
log
(
process
.
env
);
getSystemInfo
((
res
)
=>
{
data
.
statusBarHeight
=
res
.
statusBarHeight
;
});
...
...
@@ -250,7 +251,10 @@ export default {
};
},
onLoad
()
{
console
.
log
(
"index load"
);
// let { ctx } = getCurrentInstance();
// ctx.$test("首页");
// this.$test("首页");
// console.log(256, this);
uni
.
setNavigationBarTitle
({
title
:
"首页"
,
});
...
...
src/pages/index/index2.vue
View file @
0c91ba88
...
...
@@ -6,7 +6,7 @@
如果需要解构 prop,可以通过使用 setup 函数中的 toRefs 来完成此操作
* // ref和reactive的区别: ref()传入的是js的基本数据类型; reactive()中传入的是object普通对象,------------reactive对象不能直接赋值--------------
*@reactive:处理的是对象的双向绑定, 对象不能被***解构或展开***,一旦被解构或者展开,返回的值将失去响应式,需用...toRef()
* 没有this 通过 @getCurrentInstance,获取当前页面实例,使用const { ctx,proxy } = getCurrentInstance(); ctx或proxy.$挂载的方法
* 没有this 通过 @getCurrentInstance,获取当前页面实例,使用const { ctx,proxy
,refs
} = getCurrentInstance(); ctx或proxy.$挂载的方法
*/
import
{
ref
,
...
...
@@ -37,11 +37,19 @@ export default {
watch
(
name
,
(
newVal
,
oldVal
)
=>
{
console
.
log
(
51
,
newVal
);
});
//监听对象的某一项
watch
(
()
=>
msg
.
Account
,
(
val
)
=>
{
console
.
log
(
val
);
}
);
// computed 计算属性 : 适合计算一个属性, 并且绑定.
// computed将监听它里面所有的变量, 里面变量发生变化就会触发结果重新计算
// 计算出来的结果是只读的, 所以fullName是不能被改变的
const
fullName
=
computed
(()
=>
name
.
firstname
+
name
.
lastname
);
// const fullName = computed(() => { return name.firstname + name.lastname});
// 高级用法: 可以修改值
const
fullName2
=
computed
({
get
:
()
=>
name
.
firstname
+
name
.
lastname
,
...
...
@@ -57,5 +65,15 @@ export default {
fullName2
,
};
},
onLoad
()
{
//这里有this
let
{
ctx
}
=
getCurrentInstance
();
ctx
.
$test
(
"首页"
);
this
.
$test
(
"首页"
);
console
.
log
(
69
,
this
);
uni
.
setNavigationBarTitle
({
title
:
"首页"
,
});
},
};
</
script
>
src/pages/login/login.vue
View file @
0c91ba88
<
template
>
<view
class=
""
>
<van-nav-bar>
<van-icon
slot=
"left"
name=
"cross"
size=
"50rpx"
@
click=
"back"
/>
</van-nav-bar>
<view
class=
"top"
>
登录
<van-image
width=
"193rpx"
height=
"242rpx"
fit=
"cover"
class=
"yuqi"
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png"
/>
</view>
<view
class=
"main"
>
<van-cell-group>
<van-field
:value=
"Account"
clearable
placeholder=
"请输入用户名"
clearable
@
input=
"usernameInput"
>
<i
class=
"iconfont icon-user2 left-iconfont"
slot=
"left-icon"
></i>
</van-field>
<van-field
:value=
"Password"
password
placeholder=
"请输入密码"
clearable
@
input=
"passwordInput"
>
<i
class=
"iconfont icon-password left-iconfont"
slot=
"left-icon"
></i>
</van-field>
</van-cell-group>
</view>
<van-button
block
custom-class=
"loginBtn"
@
click=
"login"
>
登录
</van-button>
<view
class=
"auth"
@
click=
"authLogin"
>
授权手机号一键登录
</view>
<van-toast
id=
"van-toast"
/>
</view>
<view
class=
""
>
<van-nav-bar>
<van-icon
slot=
"left"
name=
"cross"
size=
"50rpx"
@
click=
"back"
/>
</van-nav-bar>
<view
class=
"top"
>
登录
<van-image
width=
"193rpx"
height=
"242rpx"
fit=
"cover"
class=
"yuqi"
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/yuqi.png"
/>
</view>
<view
class=
"main"
>
<van-cell-group>
<van-field
:value=
"Account"
clearable
placeholder=
"请输入用户名"
clearable
@
input=
"usernameInput"
>
<i
class=
"iconfont icon-user2 left-iconfont"
slot=
"left-icon"
></i>
</van-field>
<van-field
:value=
"Password"
password
placeholder=
"请输入密码"
clearable
@
input=
"passwordInput"
>
<i
class=
"iconfont icon-password left-iconfont"
slot=
"left-icon"
></i>
</van-field>
</van-cell-group>
</view>
<van-button
block
custom-class=
"loginBtn"
@
click=
"login"
>
登录
</van-button>
<view
class=
"auth"
@
click=
"authLogin"
>
授权手机号一键登录
</view>
<van-toast
id=
"van-toast"
/>
</view>
</
template
>
<
script
>
import
{
ref
,
reactive
,
toRefs
,
toRef
,
getCurrentInstance
,
watch
,
computed
,
onMounted
,
inject
,
}
from
"vue"
;
// import Toast from "../../wxcomponents/vant/toast/toast";
import
{
login
}
from
"../../api/index"
;
export
default
{
setup
(
props
,
context
)
{
let
Toast
=
inject
(
"$toast"
);
let
msg
=
reactive
({
Account
:
"18981921485"
,
Password
:
"123456"
,
});
let
methods
=
{
usernameInput
(
val
)
{
msg
.
Account
=
val
.
detail
;
console
.
log
(
74
,
msg
);
},
passwordInput
(
val
)
{
msg
.
Password
=
val
.
detail
;
},
back
()
{
uni
.
navigateBack
();
},
jumpPage
()
{
uni
.
navigateTo
({
url
:
"/pages/index/index"
,
});
clearTimeout
();
},
authLogin
()
{
// that.getUserProfile();
},
// getUserProfile() {
// //新的获取用户资料
// wx.getUserProfile({
// desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
// success: (info) => {
// console.log(83, info);
// that.getUserInfo(info);
// },
// fail: () => {
// uni.showToast({
// title: "微信登录授权失败",
// icon: "none",
// });
// },
// });
// },
// getUserInfo(info) {
// uni.getProvider({
// service: "oauth",
// success: function (res) {
// if (~res.provider.indexOf("weixin")) {
// uni.login({
// provider: "weixin",
// success: (_res) => {
// console.log(107, _res);
// that.getunionid(_res.code);
// },
// fail: () => {
// uni.showToast({
// title: "微信登录授权失败",
// icon: "none",
// });
// },
// });
// } else {
// uni.showToast({
// title: "请先安装微信或升级版本",
// icon: "none",
// });
// }
// },
// });
// },
async
login
()
{
let
res
=
await
login
(
msg
);
if
(
res
)
{
res
.
Data
.
Account
=
msg
.
Account
;
uni
.
setStorageSync
(
"userInfo"
,
res
.
Data
);
Toast
.
success
(
"登录成功"
);
setTimeout
(()
=>
{
that
.
jumpPage
();
},
1000
);
}
},
// getunionid(code) {
// let appid = "wxaa108410092fd276";
// let secret = "31cd99f321612f95b0006905032de7f0";
// uni.request({
// url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`,
// success: (res) => {
// console.log(150, res);
// },
// fail: (err) => {
// console.log(154, err);
// },
// });
// },
};
onMounted
(()
=>
{});
let
that
=
methods
;
return
{
...
toRefs
(
msg
),
...
methods
,
};
},
};
import
{
ref
,
reactive
,
toRefs
,
toRef
,
getCurrentInstance
,
watch
,
computed
,
onMounted
,
inject
,
}
from
"vue"
;
// import Toast from "../../wxcomponents/vant/toast/toast";
import
{
login
}
from
"../../api/index"
;
export
default
{
setup
(
props
,
context
)
{
let
Toast
=
inject
(
"$toast"
);
let
msg
=
reactive
({
Account
:
"18981921485"
,
Password
:
"123456"
,
});
let
methods
=
{
usernameInput
(
val
)
{
msg
.
Account
=
val
.
detail
;
},
passwordInput
(
val
)
{
msg
.
Password
=
val
.
detail
;
},
back
()
{
uni
.
navigateBack
();
},
jumpPage
()
{
uni
.
navigateTo
({
url
:
"/pages/index/index"
,
});
clearTimeout
();
},
authLogin
()
{
// that.getUserProfile();
},
// getUserProfile() {
// //新的获取用户资料
// wx.getUserProfile({
// desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
// success: (info) => {
// console.log(83, info);
// that.getUserInfo(info);
// },
// fail: () => {
// uni.showToast({
// title: "微信登录授权失败",
// icon: "none",
// });
// },
// });
// },
// getUserInfo(info) {
// uni.getProvider({
// service: "oauth",
// success: function (res) {
// if (~res.provider.indexOf("weixin")) {
// uni.login({
// provider: "weixin",
// success: (_res) => {
// console.log(107, _res);
// that.getunionid(_res.code);
// },
// fail: () => {
// uni.showToast({
// title: "微信登录授权失败",
// icon: "none",
// });
// },
// });
// } else {
// uni.showToast({
// title: "请先安装微信或升级版本",
// icon: "none",
// });
// }
// },
// });
// },
async
login
()
{
let
res
=
await
login
(
msg
);
if
(
res
)
{
res
.
Data
.
Account
=
msg
.
Account
;
uni
.
setStorageSync
(
"userInfo"
,
res
.
Data
);
Toast
.
success
(
"登录成功"
);
setTimeout
(()
=>
{
that
.
jumpPage
();
},
1000
);
}
},
// getunionid(code) {
// let appid = "wxaa108410092fd276";
// let secret = "31cd99f321612f95b0006905032de7f0";
// uni.request({
// url: `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`,
// success: (res) => {
// console.log(150, res);
// },
// fail: (err) => {
// console.log(154, err);
// },
// });
// },
};
onMounted
(()
=>
{});
let
that
=
methods
;
return
{
...
toRefs
(
msg
),
...
methods
,
};
},
};
</
script
>
<
style
scoped
>
.top
{
height
:
242
rpx
;
box-sizing
:
border-box
;
padding-left
:
40
rpx
;
padding-top
:
70
rpx
;
font-size
:
50
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
bold
;
color
:
#0f1b35
;
position
:
relative
;
margin-bottom
:
20
rpx
;
}
.yuqi
{
position
:
absolute
;
top
:
0
;
right
:
1
rpx
;
}
.main
{
height
:
250
rpx
;
box-sizing
:
border-box
;
padding
:
0
40
rpx
;
margin-bottom
:
165
rpx
;
}
/
deep
/
.van-cell
{
height
:
124
rpx
;
padding-top
:
50
rpx
;
}
/
deep
/
.loginBtn
{
width
:
600
rpx
;
height
:
90
rpx
;
background-color
:
#00acf9
;
border-radius
:
12
rpx
;
margin
:
0
auto
;
font-size
:
32
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
500
;
color
:
#ffffff
;
}
.auth
{
text-align
:
center
;
font-size
:
26
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
500
;
color
:
#00acf9
;
margin-top
:
30
rpx
;
}
.left-iconfont
{
margin-right
:
20
rpx
;
font-size
:
30
rpx
;
color
:
#111111
;
}
.top
{
height
:
242
rpx
;
box-sizing
:
border-box
;
padding-left
:
40
rpx
;
padding-top
:
70
rpx
;
font-size
:
50
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
bold
;
color
:
#0f1b35
;
position
:
relative
;
margin-bottom
:
20
rpx
;
}
.yuqi
{
position
:
absolute
;
top
:
0
;
right
:
1
rpx
;
}
.main
{
height
:
250
rpx
;
box-sizing
:
border-box
;
padding
:
0
40
rpx
;
margin-bottom
:
165
rpx
;
}
/
deep
/
.van-cell
{
height
:
124
rpx
;
padding-top
:
50
rpx
;
}
/
deep
/
.loginBtn
{
width
:
600
rpx
;
height
:
90
rpx
;
background-color
:
#00acf9
;
border-radius
:
12
rpx
;
margin
:
0
auto
;
font-size
:
32
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
500
;
color
:
#ffffff
;
}
.auth
{
text-align
:
center
;
font-size
:
26
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
500
;
color
:
#00acf9
;
margin-top
:
30
rpx
;
}
.left-iconfont
{
margin-right
:
20
rpx
;
font-size
:
30
rpx
;
color
:
#111111
;
}
</
style
>
src/static/css/common.css
View file @
0c91ba88
*
{
/*
*{
font-family: PingFang SC;
box-sizing: border-box;
} */
:global
(*)
{
font-family
:
PingFang
SC
;
box-sizing
:
border-box
;
}
.flex
{
...
...
src/utils/request.js
View file @
0c91ba88
let
host
=
'http://192.168.20.17:8017/api'
if
(
process
.
env
.
NODE_ENV
===
"development"
)
{
host
=
'http://192.168.20.17:8017/api'
}
else
{
host
=
'http://192.168.20.17:8017/api'
}
import
Toast
from
'../wxcomponents/vant/toast/toast'
;
let
token
=
uni
.
getStorageSync
(
'userInfo'
).
Token
;
let
request
=
(
param
)
=>
{
...
...
@@ -28,7 +33,5 @@ let request = (param) => {
}
});
})
}
export
default
request
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment