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
4d4c3e84
Commit
4d4c3e84
authored
Aug 11, 2021
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
62156b8e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
308 additions
and
174 deletions
+308
-174
main.js
src/main.js
+4
-5
manifest.json
src/manifest.json
+37
-37
course.vue
src/pages/course/course.vue
+56
-16
timeTable-item.vue
src/pages/course/timeTable-item.vue
+29
-12
timeTable.vue
src/pages/course/timeTable.vue
+48
-16
index.vue
src/pages/index/index.vue
+59
-15
login.vue
src/pages/login/login.vue
+44
-28
request.js
src/utils/request.js
+31
-45
No files found.
src/main.js
View file @
4d4c3e84
...
...
@@ -2,10 +2,9 @@ import {
createApp
}
from
'vue'
import
App
from
'./App.vue'
let
app
=
createApp
(
App
)
// app.config.globalProperties.$message = message;//全局挂载方法
import
Toast
from
"./wxcomponents/vant/toast/toast"
;
let
app
=
createApp
(
App
)
app
.
provide
(
"$toast"
,
Toast
)
// app.config.globalProperties.$toast = Toast;//全局挂载方法
// app.component('v-MessageBox',MessageBox);//全局注册组件
app
.
mount
()
src/manifest.json
View file @
4d4c3e84
{
"name"
:
""
,
"appid"
:
""
,
"description"
:
""
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
"app-plus"
:
{
"name"
:
""
,
"appid"
:
""
,
"description"
:
""
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
"app-plus"
:
{
/*
5
+App特有相关
*/
"usingComponents"
:
true
,
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
true
,
"waiting"
:
true
,
"autoclose"
:
true
,
"delay"
:
0
"usingComponents"
:
true
,
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
true
,
"waiting"
:
true
,
"autoclose"
:
true
,
"delay"
:
0
},
"modules"
:
{},
"modules"
:
{},
/*
模块配置
*/
"distribute"
:
{
"distribute"
:
{
/*
应用发布信息
*/
"android"
:
{
"android"
:
{
/*
android打包配置
*/
"permissions"
:
[
"permissions"
:
[
"<uses-permission android:name=
\"
android.permission.CHANGE_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.MOUNT_UNMOUNT_FILESYSTEMS
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.READ_CONTACTS
\"
/>"
,
...
...
@@ -45,36 +45,36 @@
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
]
},
"ios"
:
{},
"ios"
:
{},
/*
ios打包配置
*/
"sdkConfigs"
:
{},
"splashscreen"
:
{
"androidStyle"
:
"common"
,
"iosStyle"
:
"common"
"sdkConfigs"
:
{},
"splashscreen"
:
{
"androidStyle"
:
"common"
,
"iosStyle"
:
"common"
}
}
},
/*
SDK配置
*/
"quickapp"
:
{},
"quickapp"
:
{},
/*
快应用特有相关
*/
"mp-weixin"
:
{
"mp-weixin"
:
{
/*
微信小程序特有相关
*/
"appid"
:
"wx38e054ee42b054f4
"
,
"setting"
:
{
"urlCheck"
:
false
"appid"
:
"wxaa108410092fd276
"
,
"setting"
:
{
"urlCheck"
:
false
},
"usingComponents"
:
true
"usingComponents"
:
true
},
"mp-alipay"
:
{
"usingComponents"
:
true
"mp-alipay"
:
{
"usingComponents"
:
true
},
"mp-baidu"
:
{
"usingComponents"
:
true
"mp-baidu"
:
{
"usingComponents"
:
true
},
"mp-toutiao"
:
{
"usingComponents"
:
true
"mp-toutiao"
:
{
"usingComponents"
:
true
},
"mp-qq"
:
{
"usingComponents"
:
true
"mp-qq"
:
{
"usingComponents"
:
true
}
}
}
\ No newline at end of file
src/pages/course/course.vue
View file @
4d4c3e84
...
...
@@ -16,22 +16,46 @@
</view>
</view>
<view
v-for=
"(item, index) in data"
:key=
"index"
>
<view
class=
"chapter"
@
click=
"openLayer
"
>
<view
class=
"chapter"
v-if=
"item.ChildList.length > 0
"
>
<view
class=
"flex flex_between_center"
>
<view
class=
"flex flex_between_center"
>
<view
class=
"dot"
></view>
<text
class=
"chapter-name"
>
{{
item
.
n
ame
}}
</text>
<text
class=
"chapter-name"
>
{{
item
.
ChapterN
ame
}}
</text>
</view>
<view
class=
"course-time"
>
{{
item
.
coursetime
}}
</view>
<view
class=
"course-time"
>
{{
item
.
StudyHours
}}
课时
</view>
</view>
<view
v-for=
"(_item, _index) in item.children"
v-if=
"item.ChildList.length > 0"
v-for=
"(_item, _index) in item.ChildList"
:key=
"_index"
class=
"course-list"
class=
"course-list one_line"
@
click=
"openLayer(_item.ChapterContent)"
>
{{
_item
.
n
ame
}}
{{
_item
.
ChapterN
ame
}}
</view>
</view>
<view
class=
"chapter"
v-if=
"item.ChildList.length == 0"
@
click=
"openLayer(item.ChapterContent)"
>
<view
class=
"flex flex_between_center"
>
<view
class=
"flex flex_between_center"
>
<view
class=
"dot"
></view>
<text
class=
"chapter-name"
>
{{
item
.
ChapterName
}}
</text>
</view>
<view
class=
"course-time"
>
{{
item
.
StudyHours
}}
课时
</view>
</view>
<!--
<view
v-if=
"item.ChildList.length 0"
v-for=
"(_item, _index) in item.ChildList"
:key=
"_index"
class=
"course-list one_line"
@
click=
"openLayer(_item.ChapterContent)"
>
{{
_item
.
ChapterName
}}
</view>
-->
</view>
</view>
<!-- 章节内容 -->
...
...
@@ -48,14 +72,7 @@
章节学习内容
</view>
<view
class=
"info-con"
>
1、章节学习的具体内容,比如活动篇什
么什么,理解篇什么什么,语法什么。
2、章节学习的具体内容,比如活动篇什
么什么,理解篇什么什么,语法什么。
3、章节学习的具体内容,比如活动篇什
么什么,理解篇什么什么,语法什么。
4、章节学习的具体内容,比如活动篇什
么什么,理解篇什么什么,语法什么。
<rich-text
:nodes=
"richTextNode"
/>
</view>
<view
class=
"Know-btn flex flex_center_center"
@
click=
"closeLayer"
>
我知道了
...
...
@@ -77,7 +94,9 @@ import {
watch
,
computed
,
onMounted
,
inject
,
}
from
"vue"
;
import
{
getCourse
}
from
"../../api/index"
;
export
default
{
setup
()
{
let
data
=
reactive
({
...
...
@@ -96,24 +115,43 @@ export default {
],
},
],
msg
:
{
CourseId
:
0
,
},
richTextNode
:
""
,
});
let
methods
=
{
openLayer
()
{
openLayer
(
item
)
{
data
.
richTextNode
=
decodeURIComponent
(
item
);
data
.
showLayer
=
true
;
console
.
log
(
"105"
,
data
.
richTextNode
);
},
closeLayer
()
{
data
.
showLayer
=
false
;
},
async
getdata
()
{
let
res
=
await
getCourse
(
data
.
msg
);
console
.
log
(
"114"
,
res
);
if
(
res
)
{
data
.
data
=
res
.
Data
;
}
},
};
onMounted
(()
=>
{});
return
{
...
toRefs
(
data
),
...
methods
,
};
},
onLoad
()
{
onLoad
(
options
)
{
uni
.
setNavigationBarTitle
({
title
:
"课程"
,
});
let
{
ctx
}
=
getCurrentInstance
();
ctx
.
msg
.
CourseId
=
options
.
id
;
ctx
.
getdata
();
},
};
</
script
>
...
...
@@ -252,12 +290,14 @@ export default {
margin-right
:
10
rpx
;
}
.info-con
{
height
:
340
rpx
;
padding-left
:
65
rpx
;
padding-right
:
55
rpx
;
font-size
:
24
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
500
;
color
:
#111111
;
overflow-y
:
scroll
;
}
.Know-btn
{
width
:
300
rpx
;
...
...
src/pages/course/timeTable-item.vue
View file @
4d4c3e84
<
template
>
<view
class=
"timetable-item"
>
<view
class=
"timetable-item"
v-for=
"(item, index) in data.PlanTimeList"
:key=
"index"
>
<view
class=
"flex flex_start_center title-row"
>
<view
class=
"class-time"
>
20:30
</view>
<view
class=
"class-time"
>
{{
item
.
StartTime
}}
</view>
<view
class=
"circle"
></view>
<view
class=
"class-title"
>
今日章节内容
</view>
<view
class=
"class-title one_line flex"
>
{{
data
.
ClassName
}}
<view
v-for=
"(_item, _index) in data.Chapter"
:key=
"_index"
>
{{
_item
.
ChapterName
}}
<text
v-if=
"_index !== data.Chapter.length - 1"
>
,
</text>
</view>
</view>
</view>
<view
class=
"left-line"
></view>
<view
class=
"class-con flex"
>
...
...
@@ -11,21 +21,29 @@
round
width=
"84rpx"
height=
"84rpx"
src=
"https://img.yzcdn.cn/vant/cat.jpeg"
fit=
"cover"
:src=
"item.UserIcon"
class=
"teacherimg"
/>
<view
class=
"class-right flex_grow"
>
<view
class=
"study-con"
>
今日学习课程内容
</view>
<view
class=
"teacher-name"
>
李琴
</view>
<view
class=
"class-right flex_grow flex flex_start_center"
>
<!--
<view
class=
"study-con"
>
今日学习课程内容
</view>
-->
<view
class=
"teacher-name flex flex_start-center"
>
{{
item
.
TeacherName
}}
</view
>
</view>
</view>
<view
class=
"btn-box"
>
<van-button
custom-class=
"leave-btn"
@
click=
"jumpPage('/pages/course/askForLeave')"
v-if=
"item.IsLeave === 1"
>
请假
</van-button
>
<van-button
custom-class=
"already-leave-btn one_line"
>
已请假
</van-button>
<van-button
custom-class=
"already-leave-btn one_line"
v-if=
"item.IsLeave === 0"
>
已请假
</van-button
>
</view>
</view>
</
template
>
...
...
@@ -43,10 +61,9 @@ import {
}
from
"vue"
;
export
default
{
name
:
""
,
props
:
{},
props
:
{
data
:
Object
},
components
:
{},
setup
(
props
)
{
let
data
=
reactive
({});
let
methods
=
{
jumpPage
(
url
)
{
uni
.
navigateTo
({
...
...
@@ -54,9 +71,9 @@ export default {
});
},
};
console
.
log
(
57
,
props
);
return
{
...
toRefs
(
data
),
...
toRefs
(
props
),
...
methods
,
};
},
...
...
src/pages/course/timeTable.vue
View file @
4d4c3e84
...
...
@@ -87,8 +87,10 @@
</view>
</view>
<view
class=
"Timetable-box"
>
<Item
/>
<Item
/>
<!--
<Item
/>
-->
<view
v-for=
"(item, index) in dataList"
:key=
"index"
>
<Item
:data=
"item"
/>
</view>
</view>
</view>
</
template
>
...
...
@@ -107,6 +109,7 @@ import {
nextTick
,
}
from
"vue"
;
import
{
getWeek
,
getToday
}
from
"../../utils/date.js"
;
import
{
getStundentPlanStatistical
}
from
"../../api/index"
;
export
default
{
name
:
""
,
props
:
{},
...
...
@@ -126,7 +129,7 @@ export default {
let
onClose
=
()
=>
{
showPopup
.
value
=
false
;
};
//选择月份
let
onConfirm
=
(
val
)
=>
{
showPopup
.
value
=
false
;
isShowAllDay
.
value
=
true
;
...
...
@@ -142,6 +145,9 @@ export default {
getcalendar
(
curdate
.
getFullYear
(),
curdate
.
getMonth
()
+
1
);
let
newArr
=
calendar
.
value
.
slice
(
emptyArr
.
length
,
calendar
.
value
.
length
);
sliceWeek
(
newArr
[
0
]);
data
.
msg
.
StartTime
=
currentDate
.
value
+
"-01"
;
data
.
msg
.
EndTime
=
currentDate
.
value
+
"-01"
;
that
.
getData
();
};
//获取当月日历数组
let
calendar
=
ref
([]);
...
...
@@ -150,6 +156,10 @@ export default {
//切换选中日期
let
calendarActive
=
(
item
)
=>
{
activeDay
.
value
=
item
.
day
;
let
day
=
item
.
day
<
10
?
"0"
+
item
.
day
:
item
.
day
;
data
.
msg
.
StartTime
=
currentDate
.
value
+
"-"
+
day
;
data
.
msg
.
EndTime
=
currentDate
.
value
+
"-"
+
day
;
that
.
getData
();
};
let
emptyArr
=
[];
//日历补空
let
getcalendar
=
(
y
,
m
)
=>
{
...
...
@@ -176,7 +186,32 @@ export default {
let
changeCalendar
=
()
=>
{
isShowAllDay
.
value
=
!
isShowAllDay
.
value
;
};
//-------------------上边日历部分---------------------------------------
let
data
=
reactive
({
msg
:
{
ClassId
:
0
,
StartTime
:
""
,
EndTime
:
""
,
},
dataList
:
[],
});
let
methods
=
{
async
getData
()
{
let
res
=
await
getStundentPlanStatistical
(
data
.
msg
);
if
(
res
)
{
data
.
dataList
=
res
.
Data
;
console
.
log
(
199
,
data
);
}
},
jumpPage
(
url
)
{
uni
.
navigateTo
({
url
:
url
,
});
},
back
()
{
uni
.
navigateBack
();
},
};
onMounted
(()
=>
{
getcalendar
(
new
Date
().
getFullYear
(),
new
Date
().
getMonth
()
+
1
);
let
today
=
calendar
.
value
.
find
((
e
)
=>
{
...
...
@@ -187,14 +222,7 @@ export default {
}
sliceWeek
(
today
);
});
let
jumpPage
=
(
url
)
=>
{
uni
.
navigateTo
({
url
:
url
,
});
};
let
back
=
()
=>
{
uni
.
navigateBack
();
};
let
that
=
methods
;
return
{
currentDate
,
getCurrentDate
,
...
...
@@ -210,12 +238,16 @@ export default {
sliceWeek
,
isShowAllDay
,
changeCalendar
,
jumpPage
,
back
,
...
toRefs
(
data
)
,
...
methods
,
};
},
onLoad
()
{
uni
.
hideShareMenu
();
onLoad
(
options
)
{
let
{
ctx
}
=
getCurrentInstance
();
ctx
.
msg
.
StartTime
=
getToday
();
ctx
.
msg
.
EndTime
=
getToday
();
// ctx.msg.ClassId = JSON.parse(options.classId);
ctx
.
getData
();
},
};
</
script
>
...
...
src/pages/index/index.vue
View file @
4d4c3e84
<
template
>
<view>
<van-nav-bar
:border=
"fasle"
>
<van-nav-bar
:border=
"fasle"
fixed
:z-index=
"99"
>
<view
slot=
"left"
class=
"page-title"
title=
"shouye"
>
首页
</view>
</van-nav-bar>
<view
class=
"con"
>
<view
class=
"con"
:style=
"
{ 'padding-top': `${statusBarHeight}px` }">
<view
style=
"height: 100rpx"
></view>
<view
class=
"personInfo flex flex_start_center"
>
<van-image
round
...
...
@@ -31,11 +32,11 @@
:style=
"
{ 'background-color': item.bgcolor }"
@click="jumpPage(item.jumpUrl)"
>
<view
class=
"
"
>
<view
style=
"height: 100%; max-width: 120rpx
"
>
<view
class=
"baseInfo_name"
>
{{
item
.
name
}}
</view>
<view
class=
"baseInfo_desc"
>
<view
class=
"baseInfo_desc
one_line"
:title=
"item.desc
"
>
{{
item
.
desc
}}
</view>
</view>
...
...
@@ -47,16 +48,30 @@
<text
class=
"timetable_title"
>
我的课表
</text>
<view
class=
"timetable_btn"
@
click=
"jumpPage('/pages/course/timeTable')"
@
click=
"
jumpPage(`/pages/course/timeTable?classId=$
{indexData.ClassId}`)
"
>
全部
<van-icon
name=
"arrow"
style=
"margin-left: 30rpx"
/>
</view>
</view>
<view
class=
"timetable_item2"
>
日期:2021-07-29
</view>
<view
class=
"timetable_item2"
>
时间:上午09:30
</view>
<view
class=
"timetable_item2"
>
时间:上午09:30
</view>
<view
class=
"timetable_item2"
>
状态:教完
</view>
<view
class=
"timetable_item2"
>
日期:
{{
indexData
.
ClassPlan
.
NewPlanDateTimeStr
}}
</view>
<view
class=
"timetable_item2"
>
时间:
{{
indexData
.
ClassPlan
.
TimeStr
}}{{
indexData
.
ClassPlan
.
TimeStart
}}
</view>
<view
class=
"timetable_item2"
>
老师:
{{
indexData
.
ClassPlan
.
TeacherName
}}
</view>
<view
class=
"timetable_item2"
>
状态:
<text
v-if=
"indexData.ClassPlan.TimeStatusStr === 0"
>
待上课
</text>
<text
v-if=
"indexData.ClassPlan.TimeStatusStr === 1"
>
上课中
</text>
<text
v-if=
"indexData.ClassPlan.TimeStatusStr === 2"
>
下课
</text>
</view>
</view>
<van-cell-group
:border=
"false"
>
<van-cell
title=
"我的考试"
title-class=
"title"
:border=
"false"
>
...
...
@@ -96,6 +111,7 @@
</view>
</view>
</view>
<van-toast
id=
"van-toast"
/>
</view>
</
template
>
...
...
@@ -109,17 +125,22 @@ import {
watch
,
computed
,
onMounted
,
provide
,
}
from
"vue"
;
import
{
getIndexInfo
}
from
"../../api/index"
;
import
{
getSystemInfo
}
from
"../../utils/index"
;
export
default
{
name
:
""
,
props
:
{},
components
:
{},
setup
(
props
)
{
let
data
=
reactive
({
statusBarHeight
:
0
,
indexData
:
{},
baseInfo
:
[
{
name
:
"
学
区"
,
desc
:
"
锦江校区
"
,
name
:
"
校
区"
,
desc
:
""
,
img
:
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/icon1.png"
,
bgcolor
:
"#CCEDFE"
,
jumpUrl
:
"/pages/exam/answerSheet"
,
...
...
@@ -139,8 +160,8 @@ export default {
jumpUrl
:
"/pages/progress/progress"
,
},
{
name
:
"剩余
时间
"
,
desc
:
"100
课时
"
,
name
:
"剩余
课时
"
,
desc
:
"100"
,
img
:
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/icon4.png"
,
bgcolor
:
"#FFEAFE"
,
jumpUrl
:
"/pages/surplusTime/surplusTime"
,
...
...
@@ -179,15 +200,37 @@ export default {
},
],
});
let
methods
=
{
jumpPage
(
url
)
{
uni
.
navigateTo
({
url
:
url
,
});
},
async
getIndexdata
()
{
let
res
=
await
getIndexInfo
();
if
(
res
)
{
data
.
indexData
=
res
.
Data
;
data
.
baseInfo
[
0
].
desc
=
res
.
Data
.
SName
;
data
.
baseInfo
[
1
].
desc
=
res
.
Data
.
CourseName
;
data
.
baseInfo
[
1
].
jumpUrl
=
"/pages/course/course?id="
+
res
.
Data
.
CourseId
;
// data.baseInfo[2].desc = res.Data.SName;
data
.
baseInfo
[
3
].
desc
=
res
.
Data
.
SurplusHours
+
"课时"
;
data
.
baseInfo
[
4
].
desc
=
res
.
Data
.
ContractNum
;
data
.
baseInfo
[
5
].
desc
=
res
.
Data
.
TeacherName
;
}
},
};
onMounted
(()
=>
{});
onMounted
(()
=>
{
getSystemInfo
((
res
)
=>
{
data
.
statusBarHeight
=
res
.
statusBarHeight
;
});
that
.
getIndexdata
();
});
let
that
=
methods
;
return
{
...
toRefs
(
data
),
...
methods
,
...
...
@@ -208,7 +251,8 @@ export default {
<
style
scoped
>
.con
{
box-sizing
:
border-box
;
padding
:
10
rpx
30
rpx
50
rpx
;
padding
:
100
rpx
30
rpx
50
rpx
;
/* padding-top: calc(140rpx + env(safe-area-inset-top)); */
}
.page-title
{
font-size
:
44
rpx
;
...
...
src/pages/login/login.vue
View file @
4d4c3e84
...
...
@@ -16,7 +16,7 @@
<view
class=
"main"
>
<van-cell-group>
<van-field
:value=
"
username
"
:value=
"
Account
"
clearable
placeholder=
"请输入用户名"
clearable
...
...
@@ -25,7 +25,7 @@
<i
class=
"iconfont icon-user2 left-iconfont"
slot=
"left-icon"
></i>
</van-field>
<van-field
:value=
"
p
assword"
:value=
"
P
assword"
password
placeholder=
"请输入密码"
clearable
...
...
@@ -35,8 +35,9 @@
</van-field>
</van-cell-group>
</view>
<van-button
block
custom-class=
"loginBtn"
>
登录
</van-button>
<van-button
block
custom-class=
"loginBtn"
@
click=
"login"
>
登录
</van-button>
<view
class=
"auth"
@
click=
"authLogin"
>
授权手机号一键登录
</view>
<van-toast
id=
"van-toast"
/>
</view>
</
template
>
...
...
@@ -50,41 +51,43 @@ import {
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
({
username
:
"123123123
"
,
password
:
"
"
,
Account
:
"18170039207
"
,
Password
:
"123456
"
,
});
let
methods
=
{
usernameInput
(
val
)
{
msg
.
username
=
val
.
detail
;
msg
.
Account
=
val
.
detail
;
console
.
log
(
74
,
msg
);
},
passwordInput
(
val
)
{
msg
.
p
assword
=
val
.
detail
;
msg
.
P
assword
=
val
.
detail
;
},
back
()
{
uni
.
navigateBack
();
},
jumpPage
()
{
uni
.
navigateTo
({
url
:
"/pages/index/index"
,
});
clearTimeout
();
},
authLogin
()
{
let
that
=
methods
;
that
.
getUserProfile
();
},
getUserProfile
()
{
//新的获取用户资料
var
that
=
methods
;
wx
.
getUserProfile
({
desc
:
"用于完善资料"
,
// 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success
:
(
info
)
=>
{
console
.
log
(
info
);
// this.msg = {
// Id: 0,
// AliasName: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// };
console
.
log
(
83
,
info
);
that
.
getUserInfo
(
info
);
},
fail
:
()
=>
{
...
...
@@ -104,18 +107,7 @@ export default {
provider
:
"weixin"
,
success
:
(
_res
)
=>
{
console
.
log
(
107
,
_res
);
// //这里请求接口
// let obj = {
// Source: 1,
// OpenId: "",
// Name: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// Gender: info.userInfo.gender,
// Moblie: "",
// SuperiorId: 0,
// code: res.code,
// };
// that.getCode(obj);
that
.
getunionid
(
_res
.
code
);
},
fail
:
()
=>
{
uni
.
showToast
({
...
...
@@ -133,8 +125,32 @@ export default {
},
});
},
async
login
()
{
let
res
=
await
login
(
msg
);
if
(
res
)
{
uni
.
setStorageSync
(
"userInfo"
,
res
.
Data
);
Toast
.
success
(
"登录成功"
);
setTimeout
(()
=>
{
that
.
jumpPage
();
},
500
);
}
},
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
,
...
...
src/utils/request.js
View file @
4d4c3e84
let
host
=
''
export
default
let
request
=
(
param
,
success
,
failed
)
=>
{
let
host
=
'http://192.168.20.17:8017/api'
import
Toast
from
'../wxcomponents/vant/toast/toast'
;
let
token
=
uni
.
getStorageSync
(
'userInfo'
).
Token
;
let
request
=
(
param
)
=>
{
//网络请求
uni
.
request
({
url
:
this
.
host
+
param
.
url
,
method
:
param
.
method
||
"Post"
,
header
:
param
.
header
||
{
'content-type'
:
"application/json"
},
data
:
{
// MallBaseId: this.GetMiniAppId().MallBaseId,
// TenantId: this.GetMiniAppId().TenantId,
// OpenId: this.GetOpenId().OpenId,
// UserId: this.GetOpenId().UserId,
// SmallShopsId: this.GetOpenId().SmallShopsId,
// MiniAppId: this.GetMiniAppId().AppId,
msg
:
param
.
data
,
// token: this.GetOpenId().token
},
success
:
res
=>
{
// if (res.data.resultCode == 10000) {
// let u = uni.getStorageSync("mall_UserInfo");
// if (u) {
// this.getLogin_t(u)
// typeof failed == "function" && failed(res.data);
// }
// } else if (res.data.resultCode != 1) {
// if (res.data.message != '') {
// uni.showToast({
// title: res.data.message,
// icon: "none",
// });
// }
// typeof failed == "function" && failed(res.data);
// } else {
// typeof success == "function" && success(res.data);
// }
},
fail
:
(
e
)
=>
{
// console.log("网络请求fail:" + JSON.stringify(e));
// uni.showModal({
// content: "" + res.errMsg
// });
// typeof failed == "function" && failed(res.data);
}
});
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
request
({
url
:
host
+
param
.
url
,
method
:
param
.
method
||
"Post"
,
header
:
param
.
header
||
{
'content-type'
:
"application/json"
,
'token'
:
token
||
""
},
data
:
{
msg
:
param
.
data
,
},
success
:
res
=>
{
if
(
res
.
data
.
Code
===
1
)
{
resolve
(
res
.
data
)
}
else
{
Toast
.
fail
(
res
.
data
.
Message
)
}
},
fail
:
(
err
)
=>
{
// reject(err)
console
.
log
(
"fail:"
+
JSON
.
stringify
(
err
));
Toast
.
fail
(
"网络请求失败"
)
}
});
})
}
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