Commit a779a283 authored by jyx's avatar jyx

代码优化

parent 0afa8f4f
......@@ -2,8 +2,16 @@
import {
PAKEAGE_NAME
} from './utils/utils.js';
import checkUpdate from './utils/update.js';
// #ifdef MP-WEIXIN
const novelPlugin = requirePlugin('novel-plugin')
const NovelManager = require('@/utils/novelManager.js')
// #endif
export default {
usingComponents: {
"charge-dialog": "/components/charge-dialog/charge-dialog"
},
onLaunch: function(options) {
// #ifdef APP-PLUS
//设置2.4秒后主动关闭,最多设置6秒
......@@ -22,6 +30,7 @@
// #endif
this.globalData.windowWidth = res.windowWidth;
// 抖音
// #ifdef MP-TOUTIAO
this.globalData.statusBarHeight = 0;
......@@ -53,19 +62,18 @@
console.log(e);
}
// checkUpdate(this);
},
onShow: function(options) {
this.globalData.resetLogin = true
},
onHide: function() {
this.globalData.resetLogin = false
// #ifdef MP-WEIXIN
novelPlugin.onPageLoad(this._onNovelLoad.bind(this))
// #endif
},
methods: {
_onNovelLoad(info) {
const novelManager = new NovelManager()
novelManager._onNovelLoad(info)
},
},
globalData: {
resetLogin: false,
statusBarHeight: 0,
titleBarHeight: 43,
titlePadding: 8,
......
......@@ -28,10 +28,11 @@ export default class Book {
bookLegumes,
lockRate,
shortis,
articleChapterList,
freeNum,
carouselUrl,
isChecked
articleChapterList,
freeNum,
carouselUrl,
isChecked,
wechatRecord,
} = param || {}
this.id = id;
this.title = title;
......@@ -42,6 +43,7 @@ export default class Book {
}).sort((a, b) => {
return a.sort - b.sort
}) : [];
this.wechatRecord = wechatRecord
this.author = author;
this.isStick = isStick;
this.isOriginal = isOriginal;
......@@ -61,9 +63,9 @@ export default class Book {
this.isUnlock = isUnlock;
this.bookLegumes = bookLegumes;
this.lockRate = lockRate;
this.shortis = shortis;
this.freeNum = freeNum;
this.carouselUrl = carouselUrl;
this.shortis = shortis;
this.freeNum = freeNum;
this.carouselUrl = carouselUrl;
this.isChecked = isChecked;
this.articleChapterList = articleChapterList;
}
......
export default class Label {
constructor(param) {
const {
id,
name,
type,
sort,
clickVolume
} = param || {}
this.id = id;
this.name = name;
this.type = type;
}
}
\ No newline at end of file
......@@ -319,7 +319,8 @@ function getRecommendV1(flag, quantity, callback) {
url: `/book/recommendv1`,
data: {
flag: flag,
quantity: quantity
quantity: quantity,
reader: true
},
callback
})
......
......@@ -3,6 +3,10 @@ const {
ENUM_MESSAGE_PAGE_TYPE
} = require("../../static/enums/enum_value");
import {
navigateToNovel
} from '@/utils/novelManager.js';
// 搜索页面
function gotoBookSearchPage(searchType = ENUM_SEARCH_TYPE.WAREHOUSE, keyword) {
uni.navigateTo({
......@@ -17,37 +21,8 @@ function gotoBookSearchPage(searchType = ENUM_SEARCH_TYPE.WAREHOUSE, keyword) {
}
// 文章详情
function gotoBookContentPage(bookId, shortis) {
if (shortis && shortis == 0) {
gotoShortBookContentPage(bookId)
} else {
gotoLongBookContentPage(bookId)
}
}
// 短篇文章详情
function gotoShortBookContentPage(bookId) {
// 短篇小说
uni.navigateTo({
url: `/page-subs/sub_A/book-content/book-content`,
success: (res) => {
res.eventChannel.emit("openBookContentPage", {
bookId
})
}
})
}
// 长篇文章详情
function gotoLongBookContentPage(bookId) {
uni.navigateTo({
url: `/page-subs/sub_A/book-long-content/book-long-content`,
success: (res) => {
res.eventChannel.emit("openBookContentPage", {
bookId
})
}
})
function gotoBookContentPage(wxId, customId) {
navigateToNovel(wxId, customId)
}
// 文章封面
......
......@@ -27,7 +27,7 @@
},
methods: {
handleBanner(e) {
gotoBookContentPage(e.id, e.shortis)
gotoBookContentPage(e.wechatRecord.wxId, e.id)
},
initData() {
this.refreshList();
......
......@@ -8,12 +8,12 @@
</scroll-view>
</template>
<script>
import {
gotoBookContentPage
} from '../../common/services/page-route'
import {
getFirstShow
<script>
import {
gotoBookContentPage
} from '../../common/services/page-route'
import {
getFirstShow
} from "./services/index.js"
import RecommendList from "../recommend-list/recommend-list.vue";
import Banner from "../banner/banner.vue";
......@@ -51,7 +51,7 @@
setTimeout(() => {
// 匹配用户直接跳转小说
if (data.articleMsg != null) {
gotoBookContentPage(data.articleMsg.id, data.articleMsg.shortis);
gotoBookContentPage(data.articleMsg.wechatRecord.wxId, data.articleMsg.id);
}
}, 800);
}
......
......@@ -63,7 +63,7 @@
return
}
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis)
gotoBookContentPage(e.detail.data.wechatRecord.wxId, e.detail.id)
}
}
}
......
......@@ -3,13 +3,16 @@ import {
apiPOST
} from "../../../common/utils/apiRequest.js"
function getFirstShow(callback) {
apiPOST({
url: "/book/firstArticle",
callback
})
}
module.exports = {
getFirstShow
function getFirstShow(callback) {
apiPOST({
url: "/book/firstArticle",
data: {
reader: true
},
callback
})
}
module.exports = {
getFirstShow
}
\ No newline at end of file
......@@ -93,7 +93,7 @@
return
}
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis)
gotoBookContentPage(e.detail.data.wechatRecord.wxId, e.detail.id)
},
showEditBarR(e) {
this.showEditBar = e
......@@ -126,7 +126,7 @@
deleteCollect() {
let str = ''
for (let i = 0; i < this.dataList.length; i++) {
if (this.dataList[i].isChecked) {
if (this.dataList[i].isChecked) {
if (this.dataList[i].id) {
str += (this.dataList[i].id + ',')
}
......
This diff is collapsed.
......@@ -25,8 +25,8 @@
</view>
<view class="rowitem" v-else-if="listType==2">
<!-- 新书推荐 -->
<book-list-item3 class="item2" v-for='(item, index) in dataList' :key='index' :item='item' :showClose='false'
@tapItem='tapItem($event, index)'>
<book-list-item3 class="item2" v-for='(item, index) in dataList' :key='index' :item='item'
:showClose='false' @tapItem='tapItem($event, index)'>
</book-list-item3>
</view>
<view class="columnitem" v-else-if="listType==3">
......@@ -113,7 +113,7 @@
})
},
tapItem(e, index) {
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis)
gotoBookContentPage(e.detail.data.wechatRecord.wxId, e.detail.data.id)
},
}
}
......@@ -165,17 +165,17 @@
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding-left: 20rpx;
.item2 {
width: 47%;
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.item:last-child {
margin-right: 0;
}
padding-left: 20rpx;
.item2 {
width: 47%;
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.item:last-child {
margin-right: 0;
}
.item {
width: 22%;
......
......@@ -39,7 +39,8 @@
computed: {
requestParam: function() {
return {
categoryId: this.category.value
categoryId: this.category.value,
reader: true
}
}
},
......@@ -64,7 +65,7 @@
})
},
tapItem(e, index) {
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis)
gotoBookContentPage(e.detail.data.wechatRecord.wxId, e.detail.data.id)
},
tapClose(e, index) {
// TODO 仓库点击关闭按钮,弹窗选择关闭原因
......
......@@ -22,9 +22,6 @@
import WarehouseList from "./components/warehouse-list.vue";
import SystemInfoMixin from "../../common/mixins/system-info-mixin.js";
import Category from "./models/Category.js";
import {
gotoBookContentPage
} from '../../common/services/page-route'
import {
getCategorys
} from "./services/index.js"
......
<template>
<view style="padding-top: 50rpx;">
<profile-header :userInfo='userInfo'></profile-header>
<CategoryBar id='category' :range='categorys' :current='currentIndex' @change='changeCategory'
@ready='readyCategory'></CategoryBar>
<view :style="[listStyle]" v-if='showEmpty'>
<c-empty emptyTitle="暂无数据"></c-empty>
</view>
<view :style="[listStyle]" v-else>
<swiper :style="[listStyle]" :indicator-dots="false" :autoplay="false" :current="currentIndex"
@change="changeSwiper">
<swiper-item v-for='(item, index) in categorys' :key='index'>
<WarehouseList ref='bookList' :category='item' :height='listHeight'></WarehouseList>
</swiper-item>
</swiper>
</view>
<c-login></c-login>
</view>
</template>
<script>
import ProfileHeader from "./components/profile-headertemp.vue";
import {
watchUserInfoChange,
refreshUserInfo
} from "../../common/services/userServices.js"
import CategoryBar from "./components/category-bar.vue";
import WarehouseList from "./components/warehouse-list.vue";
import SystemInfoMixin from "../../common/mixins/system-info-mixin.js";
import Category from "./models/Category.js";
import {
getCategorys
} from "./services/index.js"
import {
isEmpty
} from "../../common/utils/util";
import {
readStorage,
saveStorage
} from '../../common/utils/storageUtil';
export default {
mixins: [SystemInfoMixin],
components: {
CategoryBar,
ProfileHeader,
WarehouseList
},
data() {
return {
userInfo: null,
listHeight: 0,
categorys: [],
currentIndex: 0
};
},
onLoad() {
},
computed: {
showEmpty: function() {
return isEmpty(this.categorys);
},
listStyle: function() {
return {
height: `${this.listHeight}px`
}
},
categroyChange: function() {
const {
categorys,
currentIndex
} = this;
return {
categorys,
currentIndex
}
}
},
watch: {
categroyChange: {
handler: function(n, o) {
this.$nextTick(() => {
let ref = this.$refs.bookList;
if (ref) {
ref[n.currentIndex].initRefresh();
}
})
},
deep: true
}
},
methods: {
show(){
console.log("123123123")
this.getCategoryData();
watchUserInfoChange((info) => {
this.userInfo = info.userInfo
}, this);
this.refreshUserData();
},
hide() {
},
readyCategory() {
setTimeout(() => {
this.initHeight()
}, 300)
},
getCategoryData() {
getCategorys((success, data) => {
if (success) {
let result = data ? data.map(item => {
return new Category(item)
}).sort((a, b) => {
return a.sort - b.sort
}) : [];
result.unshift(new Category({
name: "全部",
id: ""
}))
this.categorys = result;
}
})
},
initHeight() {
const query = uni.createSelectorQuery().in(this);
// query.select("#navi").boundingClientRect();
// query.select("#search").boundingClientRect();
query.select("#category").boundingClientRect();
query.exec((res) => {
let result = 0;
res.forEach(item => {
result = result + item.height;
})
this.listHeight = this.windowHeight - result;
})
},
changeCategory(e) {
this.changeCurrent(e.index);
},
changeSwiper(e) {
this.changeCurrent(e.detail.current);
},
changeCurrent(index) {
if (index != this.currentIndex) {
this.currentIndex = index;
}
},
refreshUserData() {
if (this.userInfo) {
refreshUserInfo();
}
}
}
}
</script>
<style lang="scss">
.name {
font-size: 34rpx;
font-weight: 700;
}
</style>
\ No newline at end of file
......@@ -145,7 +145,18 @@
"optimization": {
"subPackages": true
},
"lazyCodeLoading": "requiredComponents" // 依赖按需注入
"plugins": {
"novel-plugin": {
"version": "latest",
"provider": "wx293c4b6097a8a4d0",
"genericsImplementation": {
"novel": {
"charge-dialog": "/components/charge-dialog/charge-dialog"
}
}
}
}
// "lazyCodeLoading": "requiredComponents" // 依赖按需注入
},
"mp-alipay": {
"usingComponents": true,
......@@ -164,7 +175,7 @@
"uniStatistics": {
"enable": false
},
"appid": "ttd50ba3b64a3c2deb01"
"appid": ""
},
"uniStatistics": {
"enable": false,
......@@ -215,18 +226,4 @@
"enable": false
}
}
}
// "devServer" : {
// "proxy" : {
// "/https://nft-web.tech-mints.com" : {
// "target" : "https://nft-web.tech-mints.com",
// "changeOrgin" : true, //是否跨域
// "seure" : true, //是否支持https协议的代理
// "pathRewrite" : {
// "^/https://nft-web.tech-mints.com" : "/",
// "^/zs-ui/hap/https://nft-web.tech-mints.com" : "/"
// }
// }
// },
// "https" : true
// }
\ No newline at end of file
}
\ No newline at end of file
......@@ -129,8 +129,8 @@
// 在C页面内 navigateBack,将返回A页面
uni.navigateBack({
delta: 2
});
gotoBookContentPage(item.id, item.shortis);
});
gotoBookContentPage(item.wechatRecord.wxId, item.id);
}
}
}
......
......@@ -4,50 +4,53 @@
<view class="section">
<view class="title">
99%读过这本书的人还在读
</view>
<view class="book-list-item" v-for='(item, index) in dataList' :key='index' :item='item' @click="tapItem(item)">
<view class="cover-box item">
<image v-if="item.avatar===''" class="cover" src="/static/images/logo.png" mode="aspectFill"></image>
<image v-else class="cover" :src="item.avatar" mode="aspectFill" ></image>
</view>
<view class="c-flex_column">
<view class="c-flex_row c-justify_between row">
<view class="c-flex_column c-justify_center item">
<view class="title2">
{{item.title}}
</view>
</view>
</view>
<view class="c-flex_row row">
<view class="c-flex_column c-justify_between content c-flex_1 item">
<view class="desc row">
{{item.summary}}
</view>
<view class="c-flex_row c-align_center label-box row">
<slot name="footer">
<view class="label label-color-1" v-if="item.categoryName!=null&&item.categoryName!=''">
{{item.categoryName}}
</view>
<view class="label label-color-2" v-for='(label, labelIndex) in item.tagList'
:key='labelIndex'>
{{label.name}}
</view>
</slot>
</view>
</view>
</view>
</view>
<view style="display: flex;margin: auto;width: 200rpx;">
<button class="btn2" >去阅读</button>
</view>
</view>
<view class="book-list-item" v-for='(item, index) in dataList' :key='index' :item='item'
@click="tapItem(item)">
<view class="cover-box item">
<image v-if="item.avatar===''" class="cover" src="/static/images/logo.png" mode="aspectFill">
</image>
<image v-else class="cover" :src="item.avatar" mode="aspectFill"></image>
</view>
<view class="c-flex_column">
<view class="c-flex_row c-justify_between row">
<view class="c-flex_column c-justify_center item">
<view class="title2">
{{item.title}}
</view>
</view>
</view>
<view class="c-flex_row row">
<view class="c-flex_column c-justify_between content c-flex_1 item">
<view class="desc row">
{{item.summary}}
</view>
<view class="c-flex_row c-align_center label-box row">
<slot name="footer">
<view class="label label-color-1"
v-if="item.categoryName!=null&&item.categoryName!=''">
{{item.categoryName}}
</view>
<view class="label label-color-2" v-for='(label, labelIndex) in item.tagList'
:key='labelIndex'>
{{label.name}}
</view>
</slot>
</view>
</view>
</view>
</view>
<view style="display: flex;margin: auto;width: 200rpx;">
<button class="btn2">去阅读</button>
</view>
</view>
</view>
</view>
</uni-popup>
</template>
<script>
<script>
import SystemInfoMixin from "../../../../common/mixins/system-info-mixin.js";
import {
gotoBookContentPage
......@@ -100,8 +103,7 @@
}
}
},
onUnload() {
},
onUnload() {},
mounted() {
this.requestPackData();
},
......@@ -117,18 +119,18 @@
this.showPop = false;
},
requestPackData() {
getBookRecommendData(this.bookId,(success, data) => {
if (success) {
this.dataList = data.records;
getBookRecommendData(this.bookId, (success, data) => {
if (success) {
this.dataList = data.records;
}
})
},
tapItem(item) {
// 在C页面内 navigateBack,将返回A页面
uni.navigateBack({
delta: 2
});
gotoBookContentPage(item.id, item.shortis);
})
},
tapItem(item) {
// 在C页面内 navigateBack,将返回A页面
uni.navigateBack({
delta: 2
});
gotoBookContentPage(item.wechatRecord.wxId, item.id);
}
}
}
......@@ -231,117 +233,119 @@
margin: 30rpx auto;
}
}
}
.book-list-item {
display: flex;
flex-direction: row;
padding-top: 14rpx;
padding-bottom: 14rpx;
.row {
margin-bottom: 20rpx;
}
.row:last-child {
margin-bottom: 0;
}
.item {
margin-right: 20rpx;
}
.item:last-child {
margin-right: 0;
}
.title {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
.close-button {
border-radius: 10rpx;
border: 2rpx solid #999;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 40rpx;
height: 30rpx;
position: relative;
.cover {
position: absolute;
top: 50%;
left: 50%;
width: 70rpx;
height: 70rpx;
transform: translate(-50%, -50%);
z-index: 2;
background: transparent;
}
}
.desc {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 26rpx;
color: #999
}
.label-box {
flex-wrap: wrap;
.label {
padding: 5rpx 10rpx;
font-size: 20rpx;
margin-right: 20rpx;
border-radius: 10rpx;
}
.label-color-1 {
background: #faefe6;
color: #cc6008;
}
.label-color-2 {
color: #3d99fd;
background: #d8ebff;
}
.label-color-3 {
background: #ff8787;
color: #ff3737;
}
}
}
.cover-box {
.cover {
width: 150rpx;
height: 200rpx;
border-radius: 15rpx;
}
}
.title2 {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
.btn2 {
color: #d98c5c;
border: #DCBD3B solid 1rpx;
width: 140rpx;
font-size: 24rpx;
text-align: center;
border-radius: 80rpx;
height: 40rpx;
line-height: 40rpx;
}
.book-list-item {
display: flex;
flex-direction: row;
padding-top: 14rpx;
padding-bottom: 14rpx;
.row {
margin-bottom: 20rpx;
}
.row:last-child {
margin-bottom: 0;
}
.item {
margin-right: 20rpx;
}
.item:last-child {
margin-right: 0;
}
.title {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
.close-button {
border-radius: 10rpx;
border: 2rpx solid #999;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 40rpx;
height: 30rpx;
position: relative;
.cover {
position: absolute;
top: 50%;
left: 50%;
width: 70rpx;
height: 70rpx;
transform: translate(-50%, -50%);
z-index: 2;
background: transparent;
}
}
.desc {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 26rpx;
color: #999
}
.label-box {
flex-wrap: wrap;
.label {
padding: 5rpx 10rpx;
font-size: 20rpx;
margin-right: 20rpx;
border-radius: 10rpx;
}
.label-color-1 {
background: #faefe6;
color: #cc6008;
}
.label-color-2 {
color: #3d99fd;
background: #d8ebff;
}
.label-color-3 {
background: #ff8787;
color: #ff3737;
}
}
}
.cover-box {
.cover {
width: 150rpx;
height: 200rpx;
border-radius: 15rpx;
}
}
.title2 {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
.btn2 {
color: #d98c5c;
border: #DCBD3B solid 1rpx;
width: 140rpx;
font-size: 24rpx;
text-align: center;
border-radius: 80rpx;
height: 40rpx;
line-height: 40rpx;
}
</style>
\ No newline at end of file
<template>
<view class="recommond-item" @click="tapItem">
<view class="cover-box item">
<image class="cover" :src="item.avatar" mode="aspectFill"></image>
</view>
<view class="info-box item">
<view class="row">
<view class="title">
{{item.title}}
</view>
</view>
<view class="row">
<view class="desc">
{{item.summary}}
</view>
</view>
<view class="row author-box">
<uni-icons type='icon-author' custom-prefix="readiconfont" size='20' color='#378eff'></uni-icons>
<view class="name">
{{item.author}}
</view>
</view>
</view>
</view>
</template>
<script>
import {
gotoBookContentPage
} from '../../../../common/services/page-route'
export default {
props: {
item: {
type: Object,
default: function() {
return {}
}
}
},
data: function() {
return {
imageError: true
}
},
methods: {
tapItem() {
gotoBookContentPage(this.item.id, this.item.shortis);
},
loadImage() {
this.imageError = false
},
errorImage() {
this.imageError = true
}
}
}
</script>
<style lang='scss' scoped>
.recommond-item {
padding: 20rpx;
display: flex;
flex-direction: row;
.item {
margin-right: 20rpx;
}
.item:last-child {
margin-right: 0;
}
.row {
margin-bottom: 20rpx;
}
.row:last-child {
margin-bottom: 0;
}
.cover-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.cover {
width: 140rpx;
height: 180rpx;
border-radius: 15rpx;
}
}
.info-box {
flex: 1;
display: flex;
flex-direction: column;
.title {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
.desc {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 24rpx;
color: #999
}
.author-box {
display: flex;
flex-direction: row;
align-items: center;
height: 50rpx;
line-height: 50rpx;
.name {
font-size: 26rpx;
color: #378eff;
margin-left: 15rpx;
}
}
}
}
<template>
<view class="recommond-item" @click="tapItem">
<view class="cover-box item">
<image class="cover" :src="item.avatar" mode="aspectFill"></image>
</view>
<view class="info-box item">
<view class="row">
<view class="title">
{{item.title}}
</view>
</view>
<view class="row">
<view class="desc">
{{item.summary}}
</view>
</view>
<view class="row author-box">
<uni-icons type='icon-author' custom-prefix="readiconfont" size='20' color='#378eff'></uni-icons>
<view class="name">
{{item.author}}
</view>
</view>
</view>
</view>
</template>
<script>
import {
gotoBookContentPage
} from '../../../../common/services/page-route'
export default {
props: {
item: {
type: Object,
default: function() {
return {}
}
}
},
data: function() {
return {
imageError: true
}
},
methods: {
tapItem() {
gotoBookContentPage(this.item.wechatRecord.wxId, this.item.id);
},
loadImage() {
this.imageError = false
},
errorImage() {
this.imageError = true
}
}
}
</script>
<style lang='scss' scoped>
.recommond-item {
padding: 20rpx;
display: flex;
flex-direction: row;
.item {
margin-right: 20rpx;
}
.item:last-child {
margin-right: 0;
}
.row {
margin-bottom: 20rpx;
}
.row:last-child {
margin-bottom: 0;
}
.cover-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.cover {
width: 140rpx;
height: 180rpx;
border-radius: 15rpx;
}
}
.info-box {
flex: 1;
display: flex;
flex-direction: column;
.title {
font-size: 32rpx;
font-weight: 700;
color: #333;
}
.desc {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 24rpx;
color: #999
}
.author-box {
display: flex;
flex-direction: row;
align-items: center;
height: 50rpx;
line-height: 50rpx;
.name {
font-size: 26rpx;
color: #378eff;
margin-left: 15rpx;
}
}
}
}
</style>
\ No newline at end of file
......@@ -79,7 +79,7 @@
})
},
tapItem(e, index) {
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis)
gotoBookContentPage(e.detail.data.wechatRecord.wxId,e.detail.data.id)
},
}
}
......
......@@ -7,39 +7,18 @@
"^nx-(.*)": "@/nProX/$1/$1.vue" // 匹配nProX内的vue文件
}
},
"pages": [
// #ifndef APP-PLUS
{
"path": "pages/loading",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "#000000"
}
"pages": [{
"path": "pages/loading"
},
// #endif
{
"path": "pages/home",
"style": {
"navigationBarTitleText": "河狸故事汇",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "河狸故事汇"
}
}, {
"path": "pages/brower/brower",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
"path": "pages/brower/brower"
}, {
"path": "pages/index",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
"path": "pages/index"
}
],
// 分包配置
......@@ -48,35 +27,23 @@
"pages": [{
"path": "vipPay/vipPay",
"style": {
"navigationBarTitleText": "会员中心",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "会员中心"
}
}, {
"path": "cdkey/cdkey",
"style": {
"navigationBarTitleText": "兑换会员",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "兑换会员"
}
},
{
"path": "unsign/unsign",
"style": {
"navigationBarTitleText": "管理自动续费",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "管理自动续费"
}
},{
}, {
"path": "vipAppPay/vipAppPay",
"style": {
"navigationBarTitleText": "会员中心",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "会员中心"
}
}
]
......@@ -86,76 +53,48 @@
"path": "book-search/book-search",
"style": {
"navigationBarTitleText": "书籍搜索",
"enablePullDownRefresh": false,
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"enablePullDownRefresh": false
}
}, {
"path": "book-content/book-content",
"style": {
"navigationBarTitleText": "阅读",
"enablePullDownRefresh": true,
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"enablePullDownRefresh": true
}
}, {
"path": "book-long-content/book-long-content",
"style": {
"navigationBarTitleText": "阅读",
"enablePullDownRefresh": true,
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"enablePullDownRefresh": true
}
}, {
"path": "book-cover/book-cover",
"style": {
"navigationBarTitleText": "封面",
"enablePullDownRefresh": false,
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"enablePullDownRefresh": false
}
}]
}, {
"root": "pagesD",
"pages": [{
"path": "payRecord/payRecord",
"style": {
"navigationBarTitleText": "我的订单",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "我的订单"
}
}, {
"path": "dotRecord/dotRecord",
"style": {
"navigationBarTitleText": "书豆记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "书豆记录"
}
}, {
"path": "useDotRecord/useDotRecord",
"style": {
"navigationBarTitleText": "消费记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "消费记录"
}
}, {
"path": "readerRecord/readerRecord",
"style": {
"navigationBarTitleText": "阅读记录",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "阅读记录"
}
}]
}],
......@@ -168,8 +107,10 @@
}
},
"globalStyle": {
"backgroundColor": "#f5f5f5",
"backgroundColor": "#ffffff",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"app-plus": {
"bounce": "none",
"scrollIndicator": "none"
......
......@@ -69,7 +69,8 @@
url: '/book/readRecordList',
data: {
page,
size
size,
reader: true
},
showLoading: false,
success: ({
......@@ -80,8 +81,8 @@
});
},
handleInfo(item) {
gotoBookContentPage(item.id, item.shortis)
gotoBookContentPage(item.wechatRecord.wxId, item.id)
// var bookId = item.id;
// uni.navigateTo({
// url: `/page-subs/sub_A/book-content/book-content`,
......
| 平台 | 账号 |
| ---- | ---- |
| [微信开放平台](https://open.weixin.qq.com/) | |
| [DCloud开发者](https://dev.dcloud.net.cn/) | 1359763362@qq.com |
┌─uniCloud 云空间目录,阿里云为uniCloud-aliyun,腾讯云为uniCloud-tcb(详见uniCloud)
│─components 符合vue组件规范的uni-app组件目录
│ └─comp-a.vue 可复用的a组件
├─hybrid App端存放本地html文件的目录,详见
├─platforms 存放各平台专用页面的目录,详见
├─pages 业务页面文件存放的目录
│ ├─index
│ │ └─index.vue index页面
│ └─list
│ └─list.vue list页面
├─static 存放应用引用的本地静态资源(如图片、视频等)的目录,注意:静态资源只能存放于此
├─uni_modules 存放[uni_module](/uni_modules)规范的插件。
├─wxcomponents 存放小程序组件的目录,详见
├─main.js Vue初始化入口文件
├─App.vue 应用配置,用来配置App全局样式以及监听 应用生命周期
├─manifest.json 配置应用名称、appid、logo、版本等打包信息,详见
├─pages.json 配置页面路由、导航条、选项卡等页面类信息,详见
└─uni.scss 这里是uni-app内置的常用样式变量
\ No newline at end of file
import {
apiPOST
} from "../common/utils/apiRequest.js"
var novelPlugin = requirePlugin("novel-plugin");
// 点击按钮触发此函数跳转到播放器页面
function navigateToNovel(wxId, customId) {
wx.redirectTo({
url: `plugin-private://wx293c4b6097a8a4d0/pages/novel/index?bookId=${wxId}&customServerParams=${customId}`
})
}
const proto = {
_onNovelLoad(data) {
const novelManager = novelPlugin.getNovelManager(data.id)
// this.nm = novelManager
novelPlugin.setLoggerConfig({
info: true,
debug: true,
log: true,
warn: true,
error: true,
})
const customId = novelManager.getCustomServerParams()
this.getContent(customId).then(res => {
novelManager.setContents({
contents: res.chapter
})
})
// 调整分享参数
novelManager.setShareParams({
title: 'xxx',
imageUrl: 'xxx'
})
novelManager.onUserTriggerEvent((obj) => {
console.log('onUserTriggerEvent----->' + obj.event_id)
//开始阅读书籍时
if (obj.event_id === 'start_read') {
this.nm_report(customId)
}
//点击“加入书架”
if (obj.event_id === 'click_addbookshelf') {
this.nm_collect(customId)
}
})
},
getContent(customId) {
return new Promise((resolve, reject) => {
apiPOST({
url: '/book/info',
data: {
id: customId,
reader: true
},
callback: (success, data) => {
if (success) {
resolve({
chapter: data.wechatRecord.wxChapter
})
} else {
reject('')
}
}
})
})
},
// 加入书架
nm_collect(customId) {
apiPOST({
url: '/book/collect',
data: {
articleId: customId
}
});
},
// 删除书架
nm_uncollect(customId) {
apiPOST({
url: '/book/collectCancel',
data: {
articleId: customId
}
});
},
// 添加阅读记录
nm_report(articleId) {
apiPOST({
url: '/book/addReadRecord',
data: {
articleId
},
success: (res) => {
console.log('ssssssss')
},
fail: (res) => {
console.log('eeeeeee')
}
})
},
// 解锁剧集
unlockSerial() {
}
}
function NovelManager() {
var newProto = Object.assign({}, proto)
for (const k in newProto) {
if (typeof newProto[k] === 'function') {
this[k] = newProto[k].bind(this)
}
}
}
NovelManager.navigateToNovel = navigateToNovel
module.exports = NovelManager
\ No newline at end of file
export const PAKEAGE_NAME = 'com.mints.wxhelistory'
export const VERSION_CODE = '1.0.5'
export const VERSION_CODE = '1.0.0'
// export const PAKEAGE_NAME = 'com.test.test'
export function trim(str) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment