sc
This commit is contained in:
@@ -9,4 +9,9 @@ VITE_APP_BASE_API = 'https://cloud.ahfkbg.com/'
|
|||||||
# VITE_APP_BASE_API = 'https://xj.ahduima.com/'
|
# VITE_APP_BASE_API = 'https://xj.ahduima.com/'
|
||||||
|
|
||||||
# 资源地址
|
# 资源地址
|
||||||
VITE_UPLOAD_URL = 'https://cloud.ahfkbg.com/'
|
VITE_UPLOAD_URL = 'https://cloud.ahfkbg.com/'
|
||||||
|
|
||||||
|
# 静态资源地址
|
||||||
|
VITE_STATIC_URL = 'https://cloud.ahfkbg.com/gds'
|
||||||
|
|
||||||
|
#
|
||||||
@@ -11,4 +11,6 @@ VITE_APP_BASE_API = 'https://xj.ahduima.com/'
|
|||||||
VITE_WEB_BASE_URL = 'https://xj.ahduima.com'
|
VITE_WEB_BASE_URL = 'https://xj.ahduima.com'
|
||||||
|
|
||||||
# 资源地址
|
# 资源地址
|
||||||
VITE_UPLOAD_URL = 'http://huodong.ahduima.com'
|
VITE_UPLOAD_URL = 'http://huodong.ahduima.com'
|
||||||
|
|
||||||
|
VITE_STATIC_URL = 'https://cloud.ahduima.com/gds'
|
||||||
@@ -4,65 +4,11 @@
|
|||||||
},
|
},
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"path": "pages/course/index",
|
"path": "pages//index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "pages/choseCity/choseCity",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/me/index",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/course/chapter",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "章节"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/course/detail",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "课程详情"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/me/userInfo",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "个人信息"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/me/good",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "我的点赞"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/me/like",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "我的收藏"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/me/look",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "我的关注"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": "pages/me/login",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "登录"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
@@ -70,23 +16,4 @@
|
|||||||
"navigationBarBackgroundColor": "#FFF",
|
"navigationBarBackgroundColor": "#FFF",
|
||||||
"backgroundColor": "#FFF"
|
"backgroundColor": "#FFF"
|
||||||
},
|
},
|
||||||
"tabBar": {
|
|
||||||
"color": "#333",
|
|
||||||
"selectedColor": "#18AFFF",
|
|
||||||
"backgroundColor": "#FFF",
|
|
||||||
"list": [
|
|
||||||
{
|
|
||||||
"pagePath": "pages/course/index",
|
|
||||||
"text": "课程",
|
|
||||||
"iconPath": "static/image/tabbar/tab-book.png",
|
|
||||||
"selectedIconPath": "static/image/tabbar/tab-book-selected.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pagePath": "pages/me/index",
|
|
||||||
"text": "我的",
|
|
||||||
"iconPath": "static/image/tabbar/tab-mine.png",
|
|
||||||
"selectedIconPath": "static/image/tabbar/tab-mine-selected.png"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<chose-city @selectCity="selectCity" v-if="showCity" @closeModal="closeModal"></chose-city>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import choseCity from "@/components/chose-city/chose-city"
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
choseCity
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
showCity:true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
selectCity(item) {
|
|
||||||
uni.setStorageSync('city', item.name)
|
|
||||||
uni.navigateBack()
|
|
||||||
// this.showCity = false
|
|
||||||
},
|
|
||||||
closeModal() {
|
|
||||||
this.showCity = false
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="p15">
|
|
||||||
<view class="chapter_item" v-for="(item, index) of chapterList" :key="index" @tap="toDetail(item)">
|
|
||||||
<view style="line-height: 20px;">
|
|
||||||
<text class="j-tag" style="background: #DDEEFF;color: #1A8CFE">{{ item.chapterIndex }}</text>
|
|
||||||
<text class="fs14 ml5 ">{{ item.chapterName }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="mt10 flex ai-c jc-sb fs12 mt8 cor-999">
|
|
||||||
<view class="flex ai-c">
|
|
||||||
<u-icon name="eye" color="#999" size="14" :label="item.browseCount" label-color="#999" label-size="12"></u-icon>
|
|
||||||
<u-icon class="ml20" name="thumb-up" color="#999" size="14" :label="item.goodCount" label-color="#999" label-size="12"></u-icon>
|
|
||||||
</view>
|
|
||||||
<text>{{ item.author }}</text>
|
|
||||||
<text>{{ item.publicTime }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { getCourseChapter } from '@/jtools/api/index'
|
|
||||||
import { mapState } from 'pinia'; //引入映射函数
|
|
||||||
import useUserStore from '@/jtools/store/user'; //引入store
|
|
||||||
|
|
||||||
export default {
|
|
||||||
computed: {
|
|
||||||
...mapState(useUserStore, ['isLogin'])
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
chapterList: [],
|
|
||||||
lessonId: undefined
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(op){
|
|
||||||
this.lessonId = op.id
|
|
||||||
this.getChapterList(op.id)
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
if(this.lessonId) {
|
|
||||||
this.getChapterList(this.lessonId)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods:{
|
|
||||||
getChapterList(lessonId){
|
|
||||||
getCourseChapter({lessonId}).then(resp=>{
|
|
||||||
if(resp.code==='0000'){
|
|
||||||
this.chapterList=resp.data
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
toDetail(chapter){
|
|
||||||
if(!this.isLogin){
|
|
||||||
uni.showToast({
|
|
||||||
title: '请先登录',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/me/login'
|
|
||||||
});
|
|
||||||
}, 1500);
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/course/detail?id=${chapter.chapterId}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.chapter_item {
|
|
||||||
padding: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
.chapter_item:hover {
|
|
||||||
background-color: rgb(210, 209, 214);
|
|
||||||
}
|
|
||||||
|
|
||||||
.j-tag {
|
|
||||||
padding: 1px 3px;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 14px;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="bc-fff p10 relative">
|
|
||||||
<u-parse :content="chapterInfo.content"></u-parse>
|
|
||||||
<!-- 右下角点赞收藏 -->
|
|
||||||
<view class="btns">
|
|
||||||
<view class="btn">
|
|
||||||
<u-icon name="thumb-up-fill" color="#999" size="28" :label="chapterInfo.goodCount" label-pos="bottom" label-size="12" @tap="good"></u-icon>
|
|
||||||
</view>
|
|
||||||
<view class="btn">
|
|
||||||
<u-icon name="heart-fill" color="#999" size="28" :label="chapterInfo.collectCount" label-pos="bottom" label-size="12" @tap="like"></u-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { getChapterDetail } from '@/jtools/api/index';
|
|
||||||
import { userGood, userLike } from '@/jtools/api/user';
|
|
||||||
import { mapState } from 'pinia'; //引入映射函数
|
|
||||||
import useUserStore from '@/jtools/store/user'; //引入store
|
|
||||||
export default {
|
|
||||||
computed: {
|
|
||||||
...mapState(useUserStore, ['userInfo'])
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
chapterInfo: {
|
|
||||||
content: "",
|
|
||||||
goodCount: 0,
|
|
||||||
collectCount: 0
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(op) {
|
|
||||||
this.getInfo(op.id);
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getInfo(chapterId) {
|
|
||||||
try {
|
|
||||||
const _this = this;
|
|
||||||
getChapterDetail({ chapterId }).then(res => {
|
|
||||||
if (res.code === '0000') {
|
|
||||||
_this.chapterInfo = res.data;
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: res.data.chapterIndex
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
like() {
|
|
||||||
const _this = this;
|
|
||||||
userLike({ chapterId: this.chapterInfo.chapterId,userId:this.userInfo.userId }).then(res => {
|
|
||||||
if (res.code === '0000') {
|
|
||||||
_this.chapterInfo.collectCount += 1;
|
|
||||||
uni.showToast({
|
|
||||||
title: '收藏成功',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
good() {
|
|
||||||
const _this = this;
|
|
||||||
userGood({ chapterId: this.chapterInfo.chapterId,userId: this.userInfo.userId }).then(res => {
|
|
||||||
if (res.code === '0000') {
|
|
||||||
_this.chapterInfo.goodCount += 1;
|
|
||||||
uni.showToast({
|
|
||||||
title: '点赞成功',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.btns {
|
|
||||||
position: fixed;
|
|
||||||
right: 20px;
|
|
||||||
bottom: 80px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 20px;
|
|
||||||
.btn {
|
|
||||||
width: 60px;
|
|
||||||
height: 60px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
padding: 5px;
|
|
||||||
border: 1px solid #333;
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="wp100 hp100">
|
|
||||||
<view class="p5" style="background-color: #fff;">
|
|
||||||
<u-search v-model="queryParams.searchValue" placeholder="搜索标题/作者" :showAction="false"
|
|
||||||
@search="handleSearch">搜索</u-search>
|
|
||||||
</view>
|
|
||||||
<u-list v-if="pageList.length > 0" @scrolltolower="scrolltolower" class="course-list">
|
|
||||||
<u-list-item v-for="(item, index) in pageList" :key="index">
|
|
||||||
<view class="flex ai-c jc-sb p10lr p5tb bc-fff" @click="handleClick(item)">
|
|
||||||
<view class="flex ai-c">
|
|
||||||
<image :src="item.image" mode="aspectFill" style="width: 160px;height: 100px;border-radius: 6px;" />
|
|
||||||
</view>
|
|
||||||
<view class="fl1 ml10 overflow-h">
|
|
||||||
<view class="fs14">{{ item.lessonName }}</view>
|
|
||||||
<view class="fs13 mt8 cor-999 text-ellipsis">{{ item.introduction }}</view>
|
|
||||||
<view class="flex ai-c jc-sb fs12 mt8 cor-999">
|
|
||||||
<u-icon name="eye" color="#999" size="14" :label="item.browseCount" label-color="#999" label-size="12"></u-icon>
|
|
||||||
<u-icon name="thumb-up" color="#999" size="14" :label="item.goodCount" label-color="#999" label-size="12"></u-icon>
|
|
||||||
<text>{{ item.author }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</u-list-item>
|
|
||||||
</u-list>
|
|
||||||
<u-empty v-else mode="list" text="暂无数据"></u-empty>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { getCourseList } from '@/jtools/api/index'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
pageList: [],
|
|
||||||
total: 0,
|
|
||||||
queryParams: {
|
|
||||||
searchValue: '',
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 20
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.handleSearch()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
scrolltolower() {
|
|
||||||
if (this.pageList.length < this.total) {
|
|
||||||
this.queryParams.pageNo++
|
|
||||||
this.getPageList()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleSearch() {
|
|
||||||
this.pageList = []
|
|
||||||
this.queryParams.pageNo = 1
|
|
||||||
this.getPageList()
|
|
||||||
},
|
|
||||||
getPageList() {
|
|
||||||
const _this = this
|
|
||||||
const params = { ...this.queryParams }
|
|
||||||
getCourseList(params).then(res => {
|
|
||||||
_this.pageList = [..._this.pageList, ...res.data.records]
|
|
||||||
_this.total = res.data.total
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleClick(item) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/course/chapter?id=${item.lessonId}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.course-list {
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
15
src/pages/index/index.vue
Normal file
15
src/pages/index/index.vue
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<web-view :webview-styles="webviewStyles" src="https://uniapp.dcloud.io/static/web-view.html"></web-view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<u-list v-if="pageList.length > 0" @scrolltolower="scrolltolower" class="course-list">
|
|
||||||
<u-list-item v-for="(item, index) in pageList" :key="index">
|
|
||||||
<view class="flex ai-c jc-sb p10lr p5tb bc-fff" @click="handleClick(item)">
|
|
||||||
<view class="flex ai-c">
|
|
||||||
<image :src="item.image" mode="aspectFill" style="width: 150px;height: 100px;border-radius: 6px;" />
|
|
||||||
</view>
|
|
||||||
<view class="fl1 ml10">
|
|
||||||
<view class="fs14">{{ item.lessonName }}</view>
|
|
||||||
<view class="fs13 mt8 cor-999">
|
|
||||||
<text class="j-tag" style="background: #DDEEFF;color: #1A8CFE">{{ item.chapterIndex }}</text>
|
|
||||||
<text>{{ item.chapterName }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</u-list-item>
|
|
||||||
</u-list>
|
|
||||||
<u-empty v-else mode="list" text="暂无数据"></u-empty>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { getUserGoodList } from '@/jtools/api/user'
|
|
||||||
import { mapState } from 'pinia'; //引入映射函数
|
|
||||||
import useUserStore from '@/jtools/store/user'; //引入store
|
|
||||||
|
|
||||||
export default {
|
|
||||||
computed: {
|
|
||||||
...mapState(useUserStore, ['userInfo'])
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
pageList: [],
|
|
||||||
total: 0,
|
|
||||||
queryParams: {
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 20
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.handleSearch()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
scrolltolower() {
|
|
||||||
if (this.pageList.length < this.total) {
|
|
||||||
this.queryParams.pageNo++
|
|
||||||
this.getPageList()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleSearch() {
|
|
||||||
this.pageList = []
|
|
||||||
this.queryParams.pageNo = 1
|
|
||||||
this.getPageList()
|
|
||||||
},
|
|
||||||
getPageList() {
|
|
||||||
const _this = this
|
|
||||||
const params = { ...this.queryParams, userId: this.userInfo.userId }
|
|
||||||
getUserGoodList(params).then(res => {
|
|
||||||
_this.pageList = [..._this.pageList, ...res.data.records]
|
|
||||||
_this.total = res.data.total
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleClick(chapter) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/course/detail?id=${chapter.chapterId}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.j-tag {
|
|
||||||
padding: 1px 3px;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 14px;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="container">
|
|
||||||
<view class="p15">
|
|
||||||
<!-- 用户信息 -->
|
|
||||||
<view class="user-info" @tap="next('/pages/me/userInfo')">
|
|
||||||
<view class="fl1 flex ai-c">
|
|
||||||
<u-avatar size="48" :src="userInfo?.avatar"></u-avatar>
|
|
||||||
<view class="ml10 fs16 fw600">
|
|
||||||
<view>{{ isLogin ? userInfo?.userName : '点击登陆' }}</view>
|
|
||||||
<view class="fs12 cor-999">{{ isLogin ? userInfo?.phone : '未登录' }}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<u-icon name="arrow-right" size="16"></u-icon>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- cells 列表 -->
|
|
||||||
<u-cell-group :customStyle="{ 'background-color': '#fff', 'margin-top': '10px', 'border-radius': '8px' }">
|
|
||||||
<u-cell icon="thumb-up" size="large" title="我的点赞" isLink @tap="next('/pages/me/good')"></u-cell>
|
|
||||||
<u-cell icon="heart" size="large" title="我的收藏" isLink @tap="next('/pages/me/like')"></u-cell>
|
|
||||||
|
|
||||||
<u-cell icon="level" size="large" title="当前版本" :value="version"></u-cell>
|
|
||||||
<u-cell icon="phone" size="large" title="联系我们" :value="contactInfo.configDesc" isLink @tap="makePhone"></u-cell>
|
|
||||||
</u-cell-group>
|
|
||||||
|
|
||||||
<!-- 退出登陆 -->
|
|
||||||
<u-button v-if="isLogin" plain :customStyle="{ 'margin-top': '20px' }" @tap="logout">退出登录</u-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { getSysConfig } from '@/jtools/api/index';
|
|
||||||
import { mapState, mapActions } from 'pinia'; //引入映射函数
|
|
||||||
import useUserStore from '@/jtools/store/user'; //引入store
|
|
||||||
export default {
|
|
||||||
computed: {
|
|
||||||
...mapState(useUserStore, ['userInfo', 'isLogin'])
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
version: uni.getAppBaseInfo().appVersion,
|
|
||||||
contactInfo: {
|
|
||||||
configValue: '18056811878',
|
|
||||||
configDesc: '周老师'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
getSysConfig({ configKey: 'AppletContact', driverTypeId: -1 }).then(res => {
|
|
||||||
this.contactInfo = res.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapActions(useUserStore, ['logout']),
|
|
||||||
next(url) {
|
|
||||||
if (this.isLogin) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: url
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/me/login'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
makePhone() {
|
|
||||||
uni.makePhoneCall({
|
|
||||||
phoneNumber: this.contactInfo.configValue
|
|
||||||
});
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.container {
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
background: linear-gradient(180deg, rgb(242, 242, 242), #fff); // 线性渐变
|
|
||||||
.user-info {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 15px;
|
|
||||||
}
|
|
||||||
.share {
|
|
||||||
background-color: #fff;
|
|
||||||
width: 100%;
|
|
||||||
padding: 0;
|
|
||||||
text-align: left;
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<u-list v-if="pageList.length > 0" @scrolltolower="scrolltolower" class="course-list">
|
|
||||||
<u-list-item v-for="(item, index) in pageList" :key="index">
|
|
||||||
<view class="flex ai-c jc-sb p10lr p5tb bc-fff" @click="handleClick(item)">
|
|
||||||
<view class="flex ai-c">
|
|
||||||
<image :src="item.image" mode="aspectFill" style="width: 150px;height: 100px;border-radius: 6px;" />
|
|
||||||
</view>
|
|
||||||
<view class="fl1 ml10">
|
|
||||||
<view class="fs14">{{ item.lessonName }}</view>
|
|
||||||
<view class="fs13 mt8 cor-999">
|
|
||||||
<text class="j-tag" style="background: #DDEEFF;color: #1A8CFE">{{ item.chapterIndex }}</text>
|
|
||||||
<text>{{ item.chapterName }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="mt5 flex ai-c jc-sb fs13 cor-999">
|
|
||||||
<text>{{ item.author }}</text>
|
|
||||||
<text>{{ item.publicTime }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</u-list-item>
|
|
||||||
</u-list>
|
|
||||||
<u-empty v-else mode="list" text="暂无数据"></u-empty>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { getUserLikeList } from '@/jtools/api/user'
|
|
||||||
import { mapState } from 'pinia'; //引入映射函数
|
|
||||||
import useUserStore from '@/jtools/store/user'; //引入store
|
|
||||||
|
|
||||||
export default {
|
|
||||||
computed: {
|
|
||||||
...mapState(useUserStore, ['userInfo'])
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
pageList: [],
|
|
||||||
total: 0,
|
|
||||||
queryParams: {
|
|
||||||
pageNo: 1,
|
|
||||||
pageSize: 20
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.handleSearch()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
scrolltolower() {
|
|
||||||
if (this.pageList.length < this.total) {
|
|
||||||
this.queryParams.pageNo++
|
|
||||||
this.getPageList()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleSearch() {
|
|
||||||
this.pageList = []
|
|
||||||
this.queryParams.pageNo = 1
|
|
||||||
this.getPageList()
|
|
||||||
},
|
|
||||||
getPageList() {
|
|
||||||
const _this = this
|
|
||||||
const params = { ...this.queryParams, userId: this.userInfo.userId }
|
|
||||||
getUserLikeList(params).then(res => {
|
|
||||||
_this.pageList = [..._this.pageList, ...res.data.records]
|
|
||||||
_this.total = res.data.total
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleClick(chapter) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/course/detail?id=${chapter.chapterId}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.j-tag {
|
|
||||||
padding: 1px 3px;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 14px;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="content">
|
|
||||||
<view class="mb40" style="border-bottom: 1px solid #eee;margin-top: 100px;">
|
|
||||||
<u-input border="none" v-model="loginForm.phone" type="number" maxlength="11"
|
|
||||||
placeholder="输入手机号" />
|
|
||||||
</view>
|
|
||||||
<u-button shape="circle" type="primary" @click="bindLogin()">授权登录</u-button>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import useUserStore from '@/jtools/store/user'
|
|
||||||
import storage from '@/jtools/storage';
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
loginForm: {
|
|
||||||
phone: '',
|
|
||||||
code: '000000'
|
|
||||||
},
|
|
||||||
countDown: 0,
|
|
||||||
js: undefined
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
bindLogin() {
|
|
||||||
let params = { ...this.loginForm }
|
|
||||||
if (storage.get('companyId')) {
|
|
||||||
params.id = storage.get('companyId')
|
|
||||||
}
|
|
||||||
useUserStore().login(params).then(resp => {
|
|
||||||
if (resp.userId) {
|
|
||||||
useUserStore().getUserInfo()
|
|
||||||
uni.navigateBack()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.content {
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="container">
|
|
||||||
<view class="flex ai-c jc-sb p15lr p5tb bb1">
|
|
||||||
<view class="fs14 fl1">头像</view>
|
|
||||||
<u-avatar size="56" :src="form.avatar" @tap="chooseAvatar" />
|
|
||||||
</view>
|
|
||||||
<view class="flex ai-c jc-sb p15 bb1">
|
|
||||||
<view class="fs14">
|
|
||||||
<text style="color: red;">*</text>
|
|
||||||
<text class="ml2">昵称</text>
|
|
||||||
</view>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
v-model="form.userName"
|
|
||||||
placeholder="请输入昵称"
|
|
||||||
style="width: 100px;text-align: right; flex: 1;"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
<view class="flex ai-c jc-sb p15 bb1">
|
|
||||||
<view class="fs14">性别</view>
|
|
||||||
<view class="flex" @tap="showSexPicker">
|
|
||||||
<text class="cor-666">{{ ['男', '女'][form.sex] || '请选择性别' }}</text>
|
|
||||||
<u-icon name="arrow-right" size="16" class="ml10"></u-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex ai-c jc-sb p15 bb1">
|
|
||||||
<view class="fs14">生日</view>
|
|
||||||
<view class="flex" @tap="showDate = true">
|
|
||||||
<text class="cor-666">{{ form.birthday || '请选择出生日期' }}</text>
|
|
||||||
<u-icon name="arrow-right" size="16" class="ml10"></u-icon>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex ai-c jc-sb p15 bb1">
|
|
||||||
<view class="fs14 fl1">手机号码</view>
|
|
||||||
<text class="cor-999">{{ form.phone }}</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 保存 -->
|
|
||||||
<view class="p15 mt20">
|
|
||||||
<u-button type="primary" @tap="submit">保存</u-button>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<u-datetime-picker :show="showDate" mode="date" closeOnClickOverlay v-model="form.birthday" :minDate="Number(new Date('1900-01-01'))" @confirm="confirmDate" @cancel="showDate=false"></u-datetime-picker>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { updateUserInfo } from '@/jtools/api/user'
|
|
||||||
import useUserStore from '@/jtools/store/user' //引入store
|
|
||||||
export default {
|
|
||||||
name: 'UserInfo',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
form: {...useUserStore().userInfo, sex: useUserStore().userInfo.sex || 0},
|
|
||||||
saving: false,
|
|
||||||
showDate: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async submit() {
|
|
||||||
const res = await updateUserInfo(this.form)
|
|
||||||
if (res.code == '0000') {
|
|
||||||
uni.showToast({
|
|
||||||
title: '修改成功',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
useUserStore().setUserInfo(this.form)
|
|
||||||
uni.navigateBack()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
chooseAvatar() {
|
|
||||||
const _this = this
|
|
||||||
uni.chooseImage({
|
|
||||||
count: 1,
|
|
||||||
success: (res) => {
|
|
||||||
_this.form.avatar = res.tempFilePaths[0]
|
|
||||||
_this.saving = true
|
|
||||||
_this.uploadAvatar(res.tempFilePaths[0])
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
uploadAvatar(url) {
|
|
||||||
const _this = this
|
|
||||||
uni.uploadFile({
|
|
||||||
url: import.meta.env.VITE_UPLOAD_URL + 'sinology-api/system/file/upload', // 仅为示例,非真实的接口地址
|
|
||||||
filePath: url,
|
|
||||||
name: 'file',
|
|
||||||
success: (res) => {
|
|
||||||
console.log(JSON.parse(res.data).data);
|
|
||||||
|
|
||||||
_this.form.avatar = JSON.parse(res.data).data
|
|
||||||
this.saving = false;
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
uni.showToast({ title: '上传失败', icon: 'none' });
|
|
||||||
this.saving = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
showSexPicker() {
|
|
||||||
uni.showActionSheet({
|
|
||||||
itemList: ['男', '女'],
|
|
||||||
success: (res) => {
|
|
||||||
this.form.sex = res.tapIndex
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
confirmDate(e) {
|
|
||||||
this.showDate = false;
|
|
||||||
this.form.birthday = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.container {
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Reference in New Issue
Block a user