init
This commit is contained in:
70
pages/tabpages/find/find.js
Normal file
70
pages/tabpages/find/find.js
Normal file
@@ -0,0 +1,70 @@
|
||||
import articleApi from "../../../api/articleApi"
|
||||
import clientConfig from "../../../config/index"
|
||||
|
||||
|
||||
Page({
|
||||
|
||||
data: {
|
||||
searchKey: '',
|
||||
hotArticles:[],
|
||||
rankType: 'all',
|
||||
hasMore: true, // 是否有更多数据
|
||||
loading: false, // 是否正在加载
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
sortField: '',
|
||||
},
|
||||
|
||||
onSearch(){
|
||||
this.data.hotArticles = []
|
||||
this.data.pageNum = 1
|
||||
this.data.hasMore = true
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
onReachBottom: function () {
|
||||
if (this.data.hasMore) {
|
||||
this.fetchData(); // 触底时加载更多数据
|
||||
}
|
||||
},
|
||||
|
||||
fetchData(){
|
||||
if (this.data.loading) {
|
||||
return; // 如果正在加载,则不再加载
|
||||
}
|
||||
|
||||
articleApi.page({
|
||||
pageNum: this.data.pageNum,
|
||||
pageSize: this.data.pageSize,
|
||||
searchKey: this.data.searchKey,
|
||||
sortField: this.data.sortField,
|
||||
sortOrder: 'descend'
|
||||
}).then(res=>{
|
||||
res.data.rows.forEach(i => {
|
||||
if(i.fileList.length > 0){
|
||||
i.cover = i.fileList[0].fileUrl
|
||||
}
|
||||
})
|
||||
this.setData({
|
||||
hotArticles: [...this.data.hotArticles, ...res.data.rows],
|
||||
loading: false,
|
||||
pageNum: this.data.pageNum + 1
|
||||
})
|
||||
|
||||
if (res.data.rows.length < 10) {
|
||||
console.log(res.data.rows)
|
||||
this.setData({ hasMore: false });
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
rank(e){
|
||||
let rankType = e.currentTarget.dataset.type
|
||||
this.setData({rankType})
|
||||
this.fetchData()
|
||||
}
|
||||
})
|
||||
10
pages/tabpages/find/find.json
Normal file
10
pages/tabpages/find/find.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-search": "@vant/weapp/search/index",
|
||||
"article-card": "/components/articlecard/articlecard",
|
||||
"van-sticky": "@vant/weapp/sticky/index",
|
||||
"van-tag": "@vant/weapp/tag/index",
|
||||
"van-empty": "@vant/weapp/empty/index"
|
||||
},
|
||||
"navigationBarTitleText": "搜索"
|
||||
}
|
||||
33
pages/tabpages/find/find.wxml
Normal file
33
pages/tabpages/find/find.wxml
Normal file
@@ -0,0 +1,33 @@
|
||||
<van-sticky>
|
||||
<!-- 搜索框 -->
|
||||
<van-search
|
||||
model:value="{{searchKey}}"
|
||||
input-align="center"
|
||||
use-action-slot
|
||||
placeholder="请输入搜索关键词"
|
||||
bind:search="onSearch"
|
||||
>
|
||||
<view slot="action" bind:tap="onSearch" style="margin: 0 10px;">搜索</view>
|
||||
</van-search>
|
||||
</van-sticky>
|
||||
|
||||
|
||||
<view class="card-blank hot_title">
|
||||
<view>
|
||||
<van-icon name="fire" color="#DD001B" size="18px" />
|
||||
<text style="margin-left: 10px;">热门文章</text>
|
||||
</view>
|
||||
<!-- <van-button type="info" size="small" bindtap="rank" data-type="all">全部</van-button>
|
||||
<van-button type="info" size="small" bindtap="rank" data-type="collectionNum">收藏榜</van-button>
|
||||
<van-button type="info" size="small" bindtap="rank" data-type="downloadNum">下载榜</van-button> -->
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y="true" scroll-x="false" bindscrolltolower="onReachBottom">
|
||||
<view class="card" wx:for="{{hotArticles}}" wx:key="{{index}}">
|
||||
<article-card data="{{item}}" />
|
||||
</view>
|
||||
<view hidden="{{!hasMore}}" class="loading-more">加载中...</view>
|
||||
<view hidden="{{!loading}}" class="loading-icon">loading...</view>
|
||||
</scroll-view>
|
||||
|
||||
<van-empty wx:if="{{hotArticles.length==0}}" description="没有更多文章了~" />
|
||||
26
pages/tabpages/find/find.wxss
Normal file
26
pages/tabpages/find/find.wxss
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
.hot_title{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.hot_title>view{
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.hot_title van-button{
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.hot_title .van-button{
|
||||
background-color: #E9F2FF;
|
||||
color: #1E80FF;
|
||||
border: none;
|
||||
font-size: 10px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
min-width: 50px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
114
pages/tabpages/index/index.js
Normal file
114
pages/tabpages/index/index.js
Normal file
@@ -0,0 +1,114 @@
|
||||
import articleApi from "../../../api/articleApi"
|
||||
import systemApi from "../../../api/systemApi"
|
||||
import clientConfig from "../../../config/index"
|
||||
|
||||
Page({
|
||||
data: {
|
||||
funcList: [
|
||||
{
|
||||
name: '热门',
|
||||
path: '/pages/subpages/hot/hot',
|
||||
icon: 'fire-o',
|
||||
color: '#E7406B'
|
||||
},
|
||||
{
|
||||
name: '卡密',
|
||||
path: '/pages/subpages/activation/activation',
|
||||
icon: 'star-o',
|
||||
color: '#02DED8'
|
||||
},
|
||||
{
|
||||
name: 'VIP',
|
||||
path: '/pages/subpages/member/member',
|
||||
icon: 'diamond-o',
|
||||
color: '#F7E990'
|
||||
},
|
||||
{
|
||||
name: '全部',
|
||||
path: '/pages/tabpages/find/find',
|
||||
icon: 'points',
|
||||
color: '#47DBBC'
|
||||
}
|
||||
],
|
||||
carouselImgs: [],
|
||||
notice: null,
|
||||
latestArticles: []
|
||||
},
|
||||
|
||||
leavFor(e){
|
||||
const path = e.currentTarget.dataset.path
|
||||
if (path.includes("find")) {
|
||||
wx.switchTab({
|
||||
url: path,
|
||||
})
|
||||
}
|
||||
|
||||
wx.navigateTo({
|
||||
url: path,
|
||||
complete: function(res){
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onLoad(){
|
||||
// let clientConfig = tool.data.get('CLIENT_CONFIG')
|
||||
// this.setData({
|
||||
// carouselImgs: [...JSON.parse(clientConfig.CLIENT_CAROUSEL_IMAGES)],
|
||||
// notice: clientConfig.CLIENT_NOTEICE
|
||||
// })
|
||||
|
||||
articleApi.latestArticles().then(res=>{
|
||||
if (res.data) {
|
||||
console.log(res.data)
|
||||
res.data.forEach(i => {
|
||||
if(i.fileList.length > 0){
|
||||
i.cover = i.fileList[0].fileUrl
|
||||
}
|
||||
})
|
||||
}
|
||||
this.setData({
|
||||
latestArticles: res.data
|
||||
})
|
||||
})
|
||||
|
||||
systemApi.list().then(res=>{
|
||||
this.setData({
|
||||
carouselImgs: res.data
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 分享给朋友
|
||||
onShareAppMessage(res) {
|
||||
return new Promise((resolve) => {
|
||||
wx.showLoading({
|
||||
title: '生成分享图片...'
|
||||
})
|
||||
// 获取页面截图,选择轮播图区域作为分享图片
|
||||
wx.createSelectorQuery()
|
||||
.select('.card-blank')
|
||||
.fields({
|
||||
size: true,
|
||||
scrollOffset: true
|
||||
})
|
||||
.exec((res) => {
|
||||
wx.hideLoading()
|
||||
resolve({
|
||||
title: '南音源码助手',
|
||||
path: '/pages/tabpages/index/index',
|
||||
imageUrl: '' // 微信会自动使用页面截图
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 分享到朋友圈
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: '南音源码助手',
|
||||
query: '',
|
||||
imageUrl: '' // 微信会自动使用页面截图
|
||||
}
|
||||
}
|
||||
})
|
||||
10
pages/tabpages/index/index.json
Normal file
10
pages/tabpages/index/index.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-notice-bar": "@vant/weapp/notice-bar/index",
|
||||
"article-card": "/components/articlecard/articlecard",
|
||||
"van-tag": "@vant/weapp/tag/index",
|
||||
"van-empty": "@vant/weapp/empty/index"
|
||||
},
|
||||
"navigationBarTitleText": "Feastcoding"
|
||||
}
|
||||
40
pages/tabpages/index/index.wxml
Normal file
40
pages/tabpages/index/index.wxml
Normal file
@@ -0,0 +1,40 @@
|
||||
<!-- 轮播图区域 -->
|
||||
<view class="card-blank">
|
||||
<swiper indicator-dots autoplay interval="3000">
|
||||
<block wx:for="{{carouselImgs}}" wx:key="index">
|
||||
<swiper-item bindtap="leavFor" data-path="{{item.carouselArticle}}" style="border-radius: 4px;">
|
||||
<image src="{{item.carouselPic}}" style="width: 100%;" />
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<!-- 系统通知 -->
|
||||
<!-- <view class=".card-blank">
|
||||
<van-notice-bar left-icon="volume-o" background="#fff" color="#333" scrollable text="{{notice}}" />
|
||||
</view> -->
|
||||
|
||||
<!-- 功能导航 -->
|
||||
<!-- 功能列表 -->
|
||||
<!-- <view class="card func">
|
||||
<view class="func_item" wx:for="{{funcList}}" wx:key="index" bindtap="leavFor" data-path="{{item.path}}">
|
||||
<view class="func_item_icon" style="background-color: {{item.color}};" >
|
||||
<van-icon name="{{item.icon}}"/>
|
||||
</view>
|
||||
<text class="func_item_name">{{item.name}}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="card-blank new-article">
|
||||
<view>
|
||||
<van-icon name="new-arrival" size="26px" color="#3C9CFF" />
|
||||
<text style="margin-left: 10px;">最新文章</text>
|
||||
</view>
|
||||
<text bindtap="leavFor" data-path="/pages/tabpages/find/find" class="more">查看更多</text>
|
||||
</view>
|
||||
|
||||
<view class="card" wx:for="{{latestArticles}}" wx:key="index">
|
||||
<article-card data="{{item}}" />
|
||||
</view>
|
||||
|
||||
<van-empty wx:if="{{latestArticles.length==0}}" description="没有更多文章了~" />
|
||||
56
pages/tabpages/index/index.wxss
Normal file
56
pages/tabpages/index/index.wxss
Normal file
@@ -0,0 +1,56 @@
|
||||
swiper{
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.new-article{
|
||||
margin: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.new-article>view{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.func{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.func_item{
|
||||
width: 25%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.func_item .func_item_icon{
|
||||
height: 46px;
|
||||
width: 46px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.func_item .van-icon{
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.func_item_name{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.more{
|
||||
color: #707070;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.van-icon-volume-o{
|
||||
color: #3C9CFF;
|
||||
}
|
||||
112
pages/tabpages/org/org.js
Normal file
112
pages/tabpages/org/org.js
Normal file
@@ -0,0 +1,112 @@
|
||||
import articleApi from "../../../api/articleApi"
|
||||
import clientConfig from "../../../config/index"
|
||||
|
||||
|
||||
Page({
|
||||
|
||||
data: {
|
||||
searchKey: '',
|
||||
hotArticles:[],
|
||||
rankType: 'all',
|
||||
hasMore: true, // 是否有更多数据
|
||||
loading: false, // 是否正在加载
|
||||
pageSize: 10,
|
||||
pageNum: 1,
|
||||
sortField: '',
|
||||
},
|
||||
|
||||
onSearch(){
|
||||
this.data.hotArticles = []
|
||||
this.data.pageNum = 1
|
||||
this.data.hasMore = true
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
onReachBottom: function () {
|
||||
if (this.data.hasMore) {
|
||||
this.fetchData(); // 触底时加载更多数据
|
||||
}
|
||||
},
|
||||
|
||||
fetchData(){
|
||||
if (this.data.loading) {
|
||||
return; // 如果正在加载,则不再加载
|
||||
}
|
||||
|
||||
articleApi.projectPage({
|
||||
pageNum: this.data.pageNum,
|
||||
pageSize: this.data.pageSize,
|
||||
searchKey: this.data.searchKey,
|
||||
sortField: this.data.sortField,
|
||||
sortOrder: 'descend'
|
||||
}).then(res=>{
|
||||
this.setData({
|
||||
hotArticles: [...this.data.hotArticles, ...res.data.rows],
|
||||
loading: false,
|
||||
pageNum: this.data.pageNum + 1
|
||||
})
|
||||
|
||||
if (res.data.rows.length < 10) {
|
||||
console.log(res.data.rows)
|
||||
this.setData({ hasMore: false });
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
rank(e){
|
||||
let rankType = e.currentTarget.dataset.type
|
||||
this.setData({rankType})
|
||||
this.fetchData()
|
||||
},
|
||||
copyUrl: function(e) {
|
||||
const url = e.currentTarget.dataset.url;
|
||||
const name = e.currentTarget.dataset.name;
|
||||
|
||||
wx.setClipboardData({
|
||||
data: name + ' 演示视频:' + url,
|
||||
success: () => {
|
||||
wx.showToast({
|
||||
title: '已复制到剪贴板',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 分享给朋友
|
||||
onShareAppMessage(res) {
|
||||
return new Promise((resolve) => {
|
||||
wx.showLoading({
|
||||
title: '生成分享图片...'
|
||||
})
|
||||
// 获取页面截图
|
||||
wx.createSelectorQuery()
|
||||
.select('.card-blank') // 选择要截图的区域,这里选择了标题区域
|
||||
.fields({
|
||||
size: true,
|
||||
scrollOffset: true
|
||||
})
|
||||
.exec((res) => {
|
||||
wx.hideLoading()
|
||||
resolve({
|
||||
title: '南音源码资源搜索',
|
||||
path: '/pages/tabpages/org/org',
|
||||
imageUrl: '' // 微信会自动使用页面截图
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 分享到朋友圈
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: '南音源码资源搜索',
|
||||
query: '',
|
||||
imageUrl: '' // 微信会自动使用页面截图
|
||||
}
|
||||
}
|
||||
})
|
||||
9
pages/tabpages/org/org.json
Normal file
9
pages/tabpages/org/org.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-search": "@vant/weapp/search/index",
|
||||
"van-tree-select": "@vant/weapp/tree-select/index",
|
||||
"article-card": "/components/articlecard/articlecard",
|
||||
"van-empty": "@vant/weapp/empty/index"
|
||||
},
|
||||
"navigationBarTitleText": "全部资源"
|
||||
}
|
||||
32
pages/tabpages/org/org.wxml
Normal file
32
pages/tabpages/org/org.wxml
Normal file
@@ -0,0 +1,32 @@
|
||||
<van-sticky>
|
||||
<!-- 搜索框 -->
|
||||
<van-search
|
||||
model:value="{{searchKey}}"
|
||||
input-align="center"
|
||||
use-action-slot
|
||||
placeholder="请输入搜索关键词"
|
||||
bind:search="onSearch"
|
||||
>
|
||||
<view slot="action" bind:tap="onSearch" style="margin: 0 10px;">搜索</view>
|
||||
</van-search>
|
||||
</van-sticky>
|
||||
|
||||
|
||||
<view class="card-blank hot_title">
|
||||
<view>
|
||||
<van-icon name="fire" color="#DD001B" size="18px" />
|
||||
<text style="margin-left: 10px;">源码资源库</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y="true" scroll-x="false" bindscrolltolower="onReachBottom">
|
||||
<view class="card info-list" wx:for="{{hotArticles}}" wx:key="{{index}}">
|
||||
<view class="info-name">{{item.projectName1 || item.projectName}}</view>
|
||||
<text bindtap="copyUrl" data-name="{{item.projectName1 || item.projectName}}" data-url="{{ item.projectVurl}}" class="info-copy">复制链接</text>
|
||||
</view>
|
||||
|
||||
<view hidden="{{!hasMore}}" class="loading-more">加载中...</view>
|
||||
<view hidden="{{!loading}}" class="loading-icon">loading...</view>
|
||||
</scroll-view>
|
||||
|
||||
<van-empty wx:if="{{hotArticles.length==0}}" description="没有更多文章了~" />
|
||||
44
pages/tabpages/org/org.wxss
Normal file
44
pages/tabpages/org/org.wxss
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
|
||||
.hot_title{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.hot_title>view{
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.hot_title van-button{
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.hot_title .van-button{
|
||||
background-color: #E9F2FF;
|
||||
color: #1E80FF;
|
||||
border: none;
|
||||
font-size: 10px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
min-width: 50px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.info-list {
|
||||
height: 100rpx;
|
||||
font-size: 29rpx;
|
||||
}
|
||||
|
||||
.info-copy {
|
||||
float: right;
|
||||
color: #1E90FF;
|
||||
}
|
||||
|
||||
.info-name {
|
||||
overflow: hidden;
|
||||
width: 530rpx;
|
||||
display: inline-block;
|
||||
color: #636363;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
115
pages/tabpages/service/service.js
Normal file
115
pages/tabpages/service/service.js
Normal file
@@ -0,0 +1,115 @@
|
||||
Page({
|
||||
data: {
|
||||
services: [
|
||||
{
|
||||
id: 1,
|
||||
title: '项目定制',
|
||||
subtitle: 'custom',
|
||||
icon: 'setting-o',
|
||||
path: '/pages/subpages/services/custom/custom'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '代码部署',
|
||||
subtitle: 'deploy',
|
||||
icon: 'cluster-o',
|
||||
path: '/pages/subpages/services/deploy/deploy'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '解决问题',
|
||||
subtitle: 'problem',
|
||||
icon: 'question-o',
|
||||
path: '/pages/subpages/services/problem/problem'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: '部署上线',
|
||||
subtitle: 'online',
|
||||
icon: 'arrow-up',
|
||||
path: '/pages/subpages/services/online/online'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: '环境安装',
|
||||
subtitle: 'environment',
|
||||
icon: 'desktop-o',
|
||||
path: '/pages/subpages/services/environment/environment'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
title: '代码讲解',
|
||||
subtitle: 'code',
|
||||
icon: 'comment-o',
|
||||
path: '/pages/subpages/services/code/code'
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
title: '文档服务',
|
||||
subtitle: 'document',
|
||||
icon: 'description',
|
||||
path: '/pages/subpages/services/document/document'
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
title: '二次开发',
|
||||
subtitle: 'develop',
|
||||
icon: 'edit',
|
||||
path: '/pages/subpages/services/develop/develop'
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
title: '项目加急',
|
||||
subtitle: 'urgent',
|
||||
icon: 'setting-o',
|
||||
path: '/pages/subpages/services/urgent/urgent'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
navigateToService(e) {
|
||||
const index = e.currentTarget.dataset.index;
|
||||
const service = this.data.services[index];
|
||||
wx.navigateTo({
|
||||
url: service.path
|
||||
});
|
||||
},
|
||||
|
||||
onShare() {
|
||||
wx.showShareMenu({
|
||||
withShareTicket: true,
|
||||
menus: ['shareAppMessage', 'shareTimeline']
|
||||
});
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return new Promise((resolve) => {
|
||||
wx.showLoading({
|
||||
title: '生成分享图片...'
|
||||
});
|
||||
// 获取页面截图
|
||||
wx.createSelectorQuery()
|
||||
.select('.grid-container')
|
||||
.fields({
|
||||
size: true,
|
||||
scrollOffset: true
|
||||
})
|
||||
.exec((res) => {
|
||||
wx.hideLoading();
|
||||
resolve({
|
||||
title: '南音源码项目服务',
|
||||
path: '/pages/tabpages/service/service',
|
||||
imageUrl: '' // 微信会自动使用页面截图
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: '南音源码项目服务',
|
||||
query: '',
|
||||
imageUrl: '' // 微信会自动使用页面截图
|
||||
};
|
||||
}
|
||||
});
|
||||
3
pages/tabpages/service/service.json
Normal file
3
pages/tabpages/service/service.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
17
pages/tabpages/service/service.wxml
Normal file
17
pages/tabpages/service/service.wxml
Normal file
@@ -0,0 +1,17 @@
|
||||
<view class="container">
|
||||
<view class="header">
|
||||
<text class="title">敬请期待更多服务</text>
|
||||
</view>
|
||||
|
||||
<view class="grid-container">
|
||||
<view class="grid-item" wx:for="{{services}}" wx:key="id" bindtap="navigateToService" data-index="{{index}}">
|
||||
<view class="grid-icon">
|
||||
<van-icon name="{{item.icon}}" color="#1D90FB" size="40px" />
|
||||
</view>
|
||||
<view class="grid-text">
|
||||
<text class="grid-title">{{item.title}}</text>
|
||||
<text class="grid-subtitle">{{item.subtitle}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
56
pages/tabpages/service/service.wxss
Normal file
56
pages/tabpages/service/service.wxss
Normal file
@@ -0,0 +1,56 @@
|
||||
.container {
|
||||
padding: 20rpx;
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.grid-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 20rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.grid-item {
|
||||
background-color: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.grid-icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.grid-text {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.grid-title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.grid-subtitle {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
display: block;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
101
pages/tabpages/user/user.js
Normal file
101
pages/tabpages/user/user.js
Normal file
@@ -0,0 +1,101 @@
|
||||
import tool from '../../../utils/tool'
|
||||
import scoreApi from "../../../api/scoreApi"
|
||||
import userArticleApi from "../../../api/userArticleApi"
|
||||
|
||||
Page({
|
||||
|
||||
data: {
|
||||
total: [
|
||||
{
|
||||
value: 0,
|
||||
category: '我的积分',
|
||||
path: '/pages/subpages/scoreLog/scoreLog'
|
||||
},
|
||||
{
|
||||
value: 0,
|
||||
category: '下载记录',
|
||||
path: '/pages/subpages/downloadLog/downloadLog'
|
||||
},
|
||||
{
|
||||
value: 0,
|
||||
category: '收藏记录',
|
||||
path: '/pages/subpages/collectionLog/collectionLog'
|
||||
}
|
||||
],
|
||||
funcList: [
|
||||
{
|
||||
name:'每日签到',
|
||||
path: '每日签到',
|
||||
icon: 'thumb-circle-o',
|
||||
color: '#04D17A'
|
||||
},
|
||||
{
|
||||
name:'积分兑换',
|
||||
path: '/pages/subpages/member/member',
|
||||
icon: 'diamond',
|
||||
color: '#F7E031'
|
||||
},
|
||||
{
|
||||
name:'使用说明',
|
||||
path: '/pages/subpages/instruct/instruct',
|
||||
icon: 'notes',
|
||||
color: '#FC6760'
|
||||
},
|
||||
{
|
||||
name:'关于我们',
|
||||
path: '/pages/subpages/aboutus/aboutus',
|
||||
icon: 'friends',
|
||||
color: '#6650F6'
|
||||
}
|
||||
],
|
||||
userInfo: {},
|
||||
memberLevel: null,
|
||||
paymentShow: false,
|
||||
paymentCode: null
|
||||
},
|
||||
|
||||
leaveFor(e){
|
||||
const path = e.currentTarget.dataset.path
|
||||
if (path==="赞赏支持") {
|
||||
this.setData({paymentShow:true})
|
||||
}
|
||||
else if (path==="每日签到") {
|
||||
scoreApi.signIn().then((res)=>{
|
||||
if (res.code===200) {
|
||||
wx.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
this.onLoad()
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
wx.navigateTo({ url: path })
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(){
|
||||
const userInfo = tool.data.get('USER_INFO')
|
||||
const userMemberInfo = tool.data.get('USER_MEMBER_INFO')
|
||||
const clientConfig = tool.data.get('CLIENT_CONFIG')
|
||||
this.setData({
|
||||
userInfo,
|
||||
memberLevel: userMemberInfo ? userMemberInfo.level : null,
|
||||
paymentCode: clientConfig.CLIENT_PAYMENT_CODE[0].thumbUrl
|
||||
})
|
||||
|
||||
scoreApi.getUserScore().then(res=>{
|
||||
this.setData({
|
||||
'total[0].value': res.data
|
||||
})
|
||||
})
|
||||
|
||||
userArticleApi.userArticleTotal().then(res=>{
|
||||
this.setData({
|
||||
'total[1].value': res.data.downloadSum,
|
||||
'total[2].value': res.data.collectionSum,
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
9
pages/tabpages/user/user.json
Normal file
9
pages/tabpages/user/user.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-tag": "@vant/weapp/tag/index"
|
||||
},
|
||||
"navigationBarTitleText": "个人中心",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarBackgroundColor": "#1D90FB"
|
||||
}
|
||||
34
pages/tabpages/user/user.wxml
Normal file
34
pages/tabpages/user/user.wxml
Normal file
@@ -0,0 +1,34 @@
|
||||
<!-- 用户信息 -->
|
||||
<view class="user-info">
|
||||
<image src="{{userInfo.avatar}}" mode=""/>
|
||||
<view class="name">
|
||||
<text class="nick">{{userInfo.nickname}}</text>
|
||||
<text selectable class="id">ID: {{userInfo.id}} </text>
|
||||
</view>
|
||||
<view class="clock">
|
||||
<van-tag wx:if="{{memberLevel}}" color="#F7DB50" text-color="#ad0000">{{memberLevel}}</van-tag>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 历史记录 -->
|
||||
<view class="card record">
|
||||
<view class="records_item" wx:for="{{total}}" wx:key="index" bindtap="leaveFor" data-path="{{item.path}}">
|
||||
<text class="value">{{item.value}}</text>
|
||||
<text class="key">{{item.category}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能列表 -->
|
||||
<view class="card func">
|
||||
<view class="func_item" wx:for="{{funcList}}" wx:key="index" bindtap="leaveFor" data-path="{{item.path}}">
|
||||
<van-icon name="{{item.icon}}" color="{{item.color}}" />
|
||||
<text class="func_name">{{item.name}}</text>
|
||||
</view>
|
||||
|
||||
<view class="func_item ">
|
||||
<van-icon name="chat" color="#F7DB50" />
|
||||
<button class="contact" plain open-type="contact">
|
||||
<text class="func_name">客服</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
90
pages/tabpages/user/user.wxss
Normal file
90
pages/tabpages/user/user.wxss
Normal file
@@ -0,0 +1,90 @@
|
||||
.user-info{
|
||||
background-color: #1D90FB;
|
||||
padding: 30px;
|
||||
color: #FFF;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.user-info image{
|
||||
border-radius: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.user-info .name{
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.user-info .name .nick{
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.user-info .name .id{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.user-info .clock{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.record{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.records_item{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.records_item .value{
|
||||
font-size: 26px;
|
||||
color: #1D90FB;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.records_item:nth-child(2){
|
||||
border-left: 1px solid #F2F4FB;
|
||||
border-right: 1px solid #F2F4FB;
|
||||
}
|
||||
|
||||
.func{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.func_item{
|
||||
width: 33.3%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
padding: 14px 0;
|
||||
}
|
||||
|
||||
.func_item .van-icon{
|
||||
font-size: 24px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.contact{
|
||||
background-color: #fff;
|
||||
border: none!important;
|
||||
outline: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: fit-content;
|
||||
font-size: 14px;
|
||||
height: 19px;
|
||||
line-height: 19px;
|
||||
}
|
||||
Reference in New Issue
Block a user