Commit a779a283 authored by jyx's avatar jyx

代码优化

parent 0afa8f4f
...@@ -2,8 +2,16 @@ ...@@ -2,8 +2,16 @@
import { import {
PAKEAGE_NAME PAKEAGE_NAME
} from './utils/utils.js'; } 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 { export default {
usingComponents: {
"charge-dialog": "/components/charge-dialog/charge-dialog"
},
onLaunch: function(options) { onLaunch: function(options) {
// #ifdef APP-PLUS // #ifdef APP-PLUS
//设置2.4秒后主动关闭,最多设置6秒 //设置2.4秒后主动关闭,最多设置6秒
...@@ -22,6 +30,7 @@ ...@@ -22,6 +30,7 @@
// #endif // #endif
this.globalData.windowWidth = res.windowWidth; this.globalData.windowWidth = res.windowWidth;
// 抖音 // 抖音
// #ifdef MP-TOUTIAO // #ifdef MP-TOUTIAO
this.globalData.statusBarHeight = 0; this.globalData.statusBarHeight = 0;
...@@ -53,19 +62,18 @@ ...@@ -53,19 +62,18 @@
console.log(e); console.log(e);
} }
// checkUpdate(this);
}, // #ifdef MP-WEIXIN
onShow: function(options) { novelPlugin.onPageLoad(this._onNovelLoad.bind(this))
this.globalData.resetLogin = true // #endif
},
onHide: function() {
this.globalData.resetLogin = false
}, },
methods: { methods: {
_onNovelLoad(info) {
const novelManager = new NovelManager()
novelManager._onNovelLoad(info)
},
}, },
globalData: { globalData: {
resetLogin: false,
statusBarHeight: 0, statusBarHeight: 0,
titleBarHeight: 43, titleBarHeight: 43,
titlePadding: 8, titlePadding: 8,
......
...@@ -28,10 +28,11 @@ export default class Book { ...@@ -28,10 +28,11 @@ export default class Book {
bookLegumes, bookLegumes,
lockRate, lockRate,
shortis, shortis,
articleChapterList, articleChapterList,
freeNum, freeNum,
carouselUrl, carouselUrl,
isChecked isChecked,
wechatRecord,
} = param || {} } = param || {}
this.id = id; this.id = id;
this.title = title; this.title = title;
...@@ -42,6 +43,7 @@ export default class Book { ...@@ -42,6 +43,7 @@ export default class Book {
}).sort((a, b) => { }).sort((a, b) => {
return a.sort - b.sort return a.sort - b.sort
}) : []; }) : [];
this.wechatRecord = wechatRecord
this.author = author; this.author = author;
this.isStick = isStick; this.isStick = isStick;
this.isOriginal = isOriginal; this.isOriginal = isOriginal;
...@@ -61,9 +63,9 @@ export default class Book { ...@@ -61,9 +63,9 @@ export default class Book {
this.isUnlock = isUnlock; this.isUnlock = isUnlock;
this.bookLegumes = bookLegumes; this.bookLegumes = bookLegumes;
this.lockRate = lockRate; this.lockRate = lockRate;
this.shortis = shortis; this.shortis = shortis;
this.freeNum = freeNum; this.freeNum = freeNum;
this.carouselUrl = carouselUrl; this.carouselUrl = carouselUrl;
this.isChecked = isChecked; this.isChecked = isChecked;
this.articleChapterList = articleChapterList; 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) { ...@@ -319,7 +319,8 @@ function getRecommendV1(flag, quantity, callback) {
url: `/book/recommendv1`, url: `/book/recommendv1`,
data: { data: {
flag: flag, flag: flag,
quantity: quantity quantity: quantity,
reader: true
}, },
callback callback
}) })
......
...@@ -3,6 +3,10 @@ const { ...@@ -3,6 +3,10 @@ const {
ENUM_MESSAGE_PAGE_TYPE ENUM_MESSAGE_PAGE_TYPE
} = require("../../static/enums/enum_value"); } = require("../../static/enums/enum_value");
import {
navigateToNovel
} from '@/utils/novelManager.js';
// 搜索页面 // 搜索页面
function gotoBookSearchPage(searchType = ENUM_SEARCH_TYPE.WAREHOUSE, keyword) { function gotoBookSearchPage(searchType = ENUM_SEARCH_TYPE.WAREHOUSE, keyword) {
uni.navigateTo({ uni.navigateTo({
...@@ -17,37 +21,8 @@ function gotoBookSearchPage(searchType = ENUM_SEARCH_TYPE.WAREHOUSE, keyword) { ...@@ -17,37 +21,8 @@ function gotoBookSearchPage(searchType = ENUM_SEARCH_TYPE.WAREHOUSE, keyword) {
} }
// 文章详情 // 文章详情
function gotoBookContentPage(bookId, shortis) { function gotoBookContentPage(wxId, customId) {
if (shortis && shortis == 0) { navigateToNovel(wxId, customId)
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
})
}
})
} }
// 文章封面 // 文章封面
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
}, },
methods: { methods: {
handleBanner(e) { handleBanner(e) {
gotoBookContentPage(e.id, e.shortis) gotoBookContentPage(e.wechatRecord.wxId, e.id)
}, },
initData() { initData() {
this.refreshList(); this.refreshList();
......
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
</scroll-view> </scroll-view>
</template> </template>
<script> <script>
import { import {
gotoBookContentPage gotoBookContentPage
} from '../../common/services/page-route' } from '../../common/services/page-route'
import { import {
getFirstShow getFirstShow
} from "./services/index.js" } from "./services/index.js"
import RecommendList from "../recommend-list/recommend-list.vue"; import RecommendList from "../recommend-list/recommend-list.vue";
import Banner from "../banner/banner.vue"; import Banner from "../banner/banner.vue";
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
setTimeout(() => { setTimeout(() => {
// 匹配用户直接跳转小说 // 匹配用户直接跳转小说
if (data.articleMsg != null) { if (data.articleMsg != null) {
gotoBookContentPage(data.articleMsg.id, data.articleMsg.shortis); gotoBookContentPage(data.articleMsg.wechatRecord.wxId, data.articleMsg.id);
} }
}, 800); }, 800);
} }
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
return return
} }
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis) gotoBookContentPage(e.detail.data.wechatRecord.wxId, e.detail.id)
} }
} }
} }
......
...@@ -3,13 +3,16 @@ import { ...@@ -3,13 +3,16 @@ import {
apiPOST apiPOST
} from "../../../common/utils/apiRequest.js" } from "../../../common/utils/apiRequest.js"
function getFirstShow(callback) { function getFirstShow(callback) {
apiPOST({ apiPOST({
url: "/book/firstArticle", url: "/book/firstArticle",
callback data: {
}) reader: true
} },
callback
module.exports = { })
getFirstShow }
module.exports = {
getFirstShow
} }
\ No newline at end of file
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
return return
} }
gotoBookContentPage(e.detail.data.id, e.detail.data.shortis) gotoBookContentPage(e.detail.data.wechatRecord.wxId, e.detail.id)
}, },
showEditBarR(e) { showEditBarR(e) {
this.showEditBar = e this.showEditBar = e
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
deleteCollect() { deleteCollect() {
let str = '' let str = ''
for (let i = 0; i < this.dataList.length; i++) { for (let i = 0; i < this.dataList.length; i++) {
if (this.dataList[i].isChecked) { if (this.dataList[i].isChecked) {
if (this.dataList[i].id) { if (this.dataList[i].id) {
str += (this.dataList[i].id + ',') str += (this.dataList[i].id + ',')
} }
......
This diff is collapsed.
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
</view> </view>
<view class="rowitem" v-else-if="listType==2"> <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' <book-list-item3 class="item2" v-for='(item, index) in dataList' :key='index' :item='item'
@tapItem='tapItem($event, index)'> :showClose='false' @tapItem='tapItem($event, index)'>
</book-list-item3> </book-list-item3>
</view> </view>
<view class="columnitem" v-else-if="listType==3"> <view class="columnitem" v-else-if="listType==3">
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
}) })
}, },
tapItem(e, index) { 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 @@ ...@@ -165,17 +165,17 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
padding-left: 20rpx; padding-left: 20rpx;
.item2 { .item2 {
width: 47%; width: 47%;
margin-bottom: 20rpx; margin-bottom: 20rpx;
margin-right: 20rpx; margin-right: 20rpx;
} }
.item:last-child { .item:last-child {
margin-right: 0; margin-right: 0;
} }
.item { .item {
width: 22%; width: 22%;
......
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
computed: { computed: {
requestParam: function() { requestParam: function() {
return { return {
categoryId: this.category.value categoryId: this.category.value,
reader: true
} }
} }
}, },
...@@ -64,7 +65,7 @@ ...@@ -64,7 +65,7 @@
}) })
}, },
tapItem(e, index) { 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) { tapClose(e, index) {
// TODO 仓库点击关闭按钮,弹窗选择关闭原因 // TODO 仓库点击关闭按钮,弹窗选择关闭原因
......
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
import WarehouseList from "./components/warehouse-list.vue"; import WarehouseList from "./components/warehouse-list.vue";
import SystemInfoMixin from "../../common/mixins/system-info-mixin.js"; import SystemInfoMixin from "../../common/mixins/system-info-mixin.js";
import Category from "./models/Category.js"; import Category from "./models/Category.js";
import {
gotoBookContentPage
} from '../../common/services/page-route'
import { import {
getCategorys getCategorys
} from "./services/index.js" } 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 @@ ...@@ -145,7 +145,18 @@
"optimization": { "optimization": {
"subPackages": true "subPackages": true
}, },
"lazyCodeLoading": "requiredComponents" // 依赖按需注入 "plugins": {
"novel-plugin": {
"version": "latest",
"provider": "wx293c4b6097a8a4d0",
"genericsImplementation": {
"novel": {
"charge-dialog": "/components/charge-dialog/charge-dialog"
}
}
}
}
// "lazyCodeLoading": "requiredComponents" // 依赖按需注入
}, },
"mp-alipay": { "mp-alipay": {
"usingComponents": true, "usingComponents": true,
...@@ -164,7 +175,7 @@ ...@@ -164,7 +175,7 @@
"uniStatistics": { "uniStatistics": {
"enable": false "enable": false
}, },
"appid": "ttd50ba3b64a3c2deb01" "appid": ""
}, },
"uniStatistics": { "uniStatistics": {
"enable": false, "enable": false,
...@@ -215,18 +226,4 @@ ...@@ -215,18 +226,4 @@
"enable": false "enable": false
} }
} }
} }
// "devServer" : { \ No newline at end of file
// "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
...@@ -129,8 +129,8 @@ ...@@ -129,8 +129,8 @@
// 在C页面内 navigateBack,将返回A页面 // 在C页面内 navigateBack,将返回A页面
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 2
}); });
gotoBookContentPage(item.id, item.shortis); gotoBookContentPage(item.wechatRecord.wxId, item.id);
} }
} }
} }
......
...@@ -4,50 +4,53 @@ ...@@ -4,50 +4,53 @@
<view class="section"> <view class="section">
<view class="title"> <view class="title">
99%读过这本书的人还在读 99%读过这本书的人还在读
</view> </view>
<view class="book-list-item" v-for='(item, index) in dataList' :key='index' :item='item' @click="tapItem(item)"> <view class="book-list-item" v-for='(item, index) in dataList' :key='index' :item='item'
<view class="cover-box item"> @click="tapItem(item)">
<image v-if="item.avatar===''" class="cover" src="/static/images/logo.png" mode="aspectFill"></image> <view class="cover-box item">
<image v-else class="cover" :src="item.avatar" mode="aspectFill" ></image> <image v-if="item.avatar===''" class="cover" src="/static/images/logo.png" mode="aspectFill">
</view> </image>
<view class="c-flex_column"> <image v-else class="cover" :src="item.avatar" mode="aspectFill"></image>
<view class="c-flex_row c-justify_between row"> </view>
<view class="c-flex_column c-justify_center item"> <view class="c-flex_column">
<view class="title2"> <view class="c-flex_row c-justify_between row">
{{item.title}} <view class="c-flex_column c-justify_center item">
</view> <view class="title2">
</view> {{item.title}}
</view> </view>
<view class="c-flex_row row"> </view>
<view class="c-flex_column c-justify_between content c-flex_1 item"> </view>
<view class="desc row"> <view class="c-flex_row row">
{{item.summary}} <view class="c-flex_column c-justify_between content c-flex_1 item">
</view> <view class="desc row">
<view class="c-flex_row c-align_center label-box row"> {{item.summary}}
<slot name="footer"> </view>
<view class="label label-color-1" v-if="item.categoryName!=null&&item.categoryName!=''"> <view class="c-flex_row c-align_center label-box row">
{{item.categoryName}} <slot name="footer">
</view> <view class="label label-color-1"
<view class="label label-color-2" v-for='(label, labelIndex) in item.tagList' v-if="item.categoryName!=null&&item.categoryName!=''">
:key='labelIndex'> {{item.categoryName}}
{{label.name}} </view>
</view> <view class="label label-color-2" v-for='(label, labelIndex) in item.tagList'
</slot> :key='labelIndex'>
</view> {{label.name}}
</view> </view>
</view> </slot>
</view> </view>
<view style="display: flex;margin: auto;width: 200rpx;"> </view>
<button class="btn2" >去阅读</button> </view>
</view> </view>
<view style="display: flex;margin: auto;width: 200rpx;">
<button class="btn2">去阅读</button>
</view>
</view> </view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
</template> </template>
<script> <script>
import SystemInfoMixin from "../../../../common/mixins/system-info-mixin.js"; import SystemInfoMixin from "../../../../common/mixins/system-info-mixin.js";
import { import {
gotoBookContentPage gotoBookContentPage
...@@ -100,8 +103,7 @@ ...@@ -100,8 +103,7 @@
} }
} }
}, },
onUnload() { onUnload() {},
},
mounted() { mounted() {
this.requestPackData(); this.requestPackData();
}, },
...@@ -117,18 +119,18 @@ ...@@ -117,18 +119,18 @@
this.showPop = false; this.showPop = false;
}, },
requestPackData() { requestPackData() {
getBookRecommendData(this.bookId,(success, data) => { getBookRecommendData(this.bookId, (success, data) => {
if (success) { if (success) {
this.dataList = data.records; this.dataList = data.records;
} }
}) })
}, },
tapItem(item) { tapItem(item) {
// 在C页面内 navigateBack,将返回A页面 // 在C页面内 navigateBack,将返回A页面
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 2
}); });
gotoBookContentPage(item.id, item.shortis); gotoBookContentPage(item.wechatRecord.wxId, item.id);
} }
} }
} }
...@@ -231,117 +233,119 @@ ...@@ -231,117 +233,119 @@
margin: 30rpx auto; margin: 30rpx auto;
} }
} }
} }
.book-list-item {
display: flex; .book-list-item {
flex-direction: row; display: flex;
padding-top: 14rpx; flex-direction: row;
padding-bottom: 14rpx; padding-top: 14rpx;
.row { padding-bottom: 14rpx;
margin-bottom: 20rpx;
} .row {
margin-bottom: 20rpx;
.row:last-child { }
margin-bottom: 0;
} .row:last-child {
margin-bottom: 0;
.item { }
margin-right: 20rpx;
} .item {
margin-right: 20rpx;
.item:last-child { }
margin-right: 0;
} .item:last-child {
margin-right: 0;
.title { }
font-size: 32rpx;
font-weight: 700; .title {
color: #333; font-size: 32rpx;
} font-weight: 700;
color: #333;
.close-button { }
border-radius: 10rpx;
border: 2rpx solid #999; .close-button {
display: flex; border-radius: 10rpx;
flex-direction: column; border: 2rpx solid #999;
align-items: center; display: flex;
justify-content: center; flex-direction: column;
width: 40rpx; align-items: center;
height: 30rpx; justify-content: center;
position: relative; width: 40rpx;
height: 30rpx;
.cover { position: relative;
position: absolute;
top: 50%; .cover {
left: 50%; position: absolute;
width: 70rpx; top: 50%;
height: 70rpx; left: 50%;
transform: translate(-50%, -50%); width: 70rpx;
z-index: 2; height: 70rpx;
background: transparent; transform: translate(-50%, -50%);
} z-index: 2;
} background: transparent;
}
.desc { }
overflow: hidden;
text-overflow: ellipsis; .desc {
display: -webkit-box; overflow: hidden;
-webkit-line-clamp: 2; text-overflow: ellipsis;
-webkit-box-orient: vertical; display: -webkit-box;
-webkit-line-clamp: 2;
font-size: 26rpx; -webkit-box-orient: vertical;
color: #999
} font-size: 26rpx;
color: #999
.label-box { }
flex-wrap: wrap;
.label-box {
.label { flex-wrap: wrap;
padding: 5rpx 10rpx;
font-size: 20rpx; .label {
margin-right: 20rpx; padding: 5rpx 10rpx;
border-radius: 10rpx; font-size: 20rpx;
} margin-right: 20rpx;
border-radius: 10rpx;
.label-color-1 { }
background: #faefe6;
color: #cc6008; .label-color-1 {
} background: #faefe6;
color: #cc6008;
.label-color-2 { }
color: #3d99fd;
background: #d8ebff; .label-color-2 {
} color: #3d99fd;
background: #d8ebff;
.label-color-3 { }
background: #ff8787;
color: #ff3737; .label-color-3 {
} background: #ff8787;
} color: #ff3737;
} }
}
.cover-box { }
.cover {
width: 150rpx; .cover-box {
height: 200rpx; .cover {
border-radius: 15rpx; width: 150rpx;
} height: 200rpx;
} border-radius: 15rpx;
}
.title2 { }
font-size: 32rpx;
font-weight: 700; .title2 {
color: #333; font-size: 32rpx;
} font-weight: 700;
color: #333;
.btn2 { }
color: #d98c5c;
border: #DCBD3B solid 1rpx; .btn2 {
width: 140rpx; color: #d98c5c;
font-size: 24rpx; border: #DCBD3B solid 1rpx;
text-align: center; width: 140rpx;
border-radius: 80rpx; font-size: 24rpx;
height: 40rpx; text-align: center;
line-height: 40rpx; border-radius: 80rpx;
height: 40rpx;
line-height: 40rpx;
} }
</style> </style>
\ No newline at end of file
<template> <template>
<view class="recommond-item" @click="tapItem"> <view class="recommond-item" @click="tapItem">
<view class="cover-box item"> <view class="cover-box item">
<image class="cover" :src="item.avatar" mode="aspectFill"></image> <image class="cover" :src="item.avatar" mode="aspectFill"></image>
</view> </view>
<view class="info-box item"> <view class="info-box item">
<view class="row"> <view class="row">
<view class="title"> <view class="title">
{{item.title}} {{item.title}}
</view> </view>
</view> </view>
<view class="row"> <view class="row">
<view class="desc"> <view class="desc">
{{item.summary}} {{item.summary}}
</view> </view>
</view> </view>
<view class="row author-box"> <view class="row author-box">
<uni-icons type='icon-author' custom-prefix="readiconfont" size='20' color='#378eff'></uni-icons> <uni-icons type='icon-author' custom-prefix="readiconfont" size='20' color='#378eff'></uni-icons>
<view class="name"> <view class="name">
{{item.author}} {{item.author}}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { import {
gotoBookContentPage gotoBookContentPage
} from '../../../../common/services/page-route' } from '../../../../common/services/page-route'
export default { export default {
props: { props: {
item: { item: {
type: Object, type: Object,
default: function() { default: function() {
return {} return {}
} }
} }
}, },
data: function() { data: function() {
return { return {
imageError: true imageError: true
} }
}, },
methods: { methods: {
tapItem() { tapItem() {
gotoBookContentPage(this.item.id, this.item.shortis); gotoBookContentPage(this.item.wechatRecord.wxId, this.item.id);
}, },
loadImage() { loadImage() {
this.imageError = false this.imageError = false
}, },
errorImage() { errorImage() {
this.imageError = true this.imageError = true
} }
} }
} }
</script> </script>
<style lang='scss' scoped> <style lang='scss' scoped>
.recommond-item { .recommond-item {
padding: 20rpx; padding: 20rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
.item { .item {
margin-right: 20rpx; margin-right: 20rpx;
} }
.item:last-child { .item:last-child {
margin-right: 0; margin-right: 0;
} }
.row { .row {
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.row:last-child { .row:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.cover-box { .cover-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.cover { .cover {
width: 140rpx; width: 140rpx;
height: 180rpx; height: 180rpx;
border-radius: 15rpx; border-radius: 15rpx;
} }
} }
.info-box { .info-box {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.title { .title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 700; font-weight: 700;
color: #333; color: #333;
} }
.desc { .desc {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
font-size: 24rpx; font-size: 24rpx;
color: #999 color: #999
} }
.author-box { .author-box {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
.name { .name {
font-size: 26rpx; font-size: 26rpx;
color: #378eff; color: #378eff;
margin-left: 15rpx; margin-left: 15rpx;
} }
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
}) })
}, },
tapItem(e, index) { 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 @@ ...@@ -7,39 +7,18 @@
"^nx-(.*)": "@/nProX/$1/$1.vue" // 匹配nProX内的vue文件 "^nx-(.*)": "@/nProX/$1/$1.vue" // 匹配nProX内的vue文件
} }
}, },
"pages": [ "pages": [{
// #ifndef APP-PLUS "path": "pages/loading"
{
"path": "pages/loading",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "#000000"
}
}, },
// #endif
{ {
"path": "pages/home", "path": "pages/home",
"style": { "style": {
"navigationBarTitleText": "河狸故事汇", "navigationBarTitleText": "河狸故事汇"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "pages/brower/brower", "path": "pages/brower/brower"
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, { }, {
"path": "pages/index", "path": "pages/index"
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
} }
], ],
// 分包配置 // 分包配置
...@@ -48,35 +27,23 @@ ...@@ -48,35 +27,23 @@
"pages": [{ "pages": [{
"path": "vipPay/vipPay", "path": "vipPay/vipPay",
"style": { "style": {
"navigationBarTitleText": "会员中心", "navigationBarTitleText": "会员中心"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "cdkey/cdkey", "path": "cdkey/cdkey",
"style": { "style": {
"navigationBarTitleText": "兑换会员", "navigationBarTitleText": "兑换会员"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, },
{ {
"path": "unsign/unsign", "path": "unsign/unsign",
"style": { "style": {
"navigationBarTitleText": "管理自动续费", "navigationBarTitleText": "管理自动续费"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
},{ }, {
"path": "vipAppPay/vipAppPay", "path": "vipAppPay/vipAppPay",
"style": { "style": {
"navigationBarTitleText": "会员中心", "navigationBarTitleText": "会员中心"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
} }
] ]
...@@ -86,76 +53,48 @@ ...@@ -86,76 +53,48 @@
"path": "book-search/book-search", "path": "book-search/book-search",
"style": { "style": {
"navigationBarTitleText": "书籍搜索", "navigationBarTitleText": "书籍搜索",
"enablePullDownRefresh": false, "enablePullDownRefresh": false
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "book-content/book-content", "path": "book-content/book-content",
"style": { "style": {
"navigationBarTitleText": "阅读", "navigationBarTitleText": "阅读",
"enablePullDownRefresh": true, "enablePullDownRefresh": true
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "book-long-content/book-long-content", "path": "book-long-content/book-long-content",
"style": { "style": {
"navigationBarTitleText": "阅读", "navigationBarTitleText": "阅读",
"enablePullDownRefresh": true, "enablePullDownRefresh": true
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "book-cover/book-cover", "path": "book-cover/book-cover",
"style": { "style": {
"navigationBarTitleText": "封面", "navigationBarTitleText": "封面",
"enablePullDownRefresh": false, "enablePullDownRefresh": false
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}] }]
}, { }, {
"root": "pagesD", "root": "pagesD",
"pages": [{ "pages": [{
"path": "payRecord/payRecord", "path": "payRecord/payRecord",
"style": { "style": {
"navigationBarTitleText": "我的订单", "navigationBarTitleText": "我的订单"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "dotRecord/dotRecord", "path": "dotRecord/dotRecord",
"style": { "style": {
"navigationBarTitleText": "书豆记录", "navigationBarTitleText": "书豆记录"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "useDotRecord/useDotRecord", "path": "useDotRecord/useDotRecord",
"style": { "style": {
"navigationBarTitleText": "消费记录", "navigationBarTitleText": "消费记录"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}, { }, {
"path": "readerRecord/readerRecord", "path": "readerRecord/readerRecord",
"style": { "style": {
"navigationBarTitleText": "阅读记录", "navigationBarTitleText": "阅读记录"
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
} }
}] }]
}], }],
...@@ -168,8 +107,10 @@ ...@@ -168,8 +107,10 @@
} }
}, },
"globalStyle": { "globalStyle": {
"backgroundColor": "#f5f5f5", "backgroundColor": "#ffffff",
"navigationStyle": "default", "navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"app-plus": { "app-plus": {
"bounce": "none", "bounce": "none",
"scrollIndicator": "none" "scrollIndicator": "none"
......
...@@ -69,7 +69,8 @@ ...@@ -69,7 +69,8 @@
url: '/book/readRecordList', url: '/book/readRecordList',
data: { data: {
page, page,
size size,
reader: true
}, },
showLoading: false, showLoading: false,
success: ({ success: ({
...@@ -80,8 +81,8 @@ ...@@ -80,8 +81,8 @@
}); });
}, },
handleInfo(item) { handleInfo(item) {
gotoBookContentPage(item.id, item.shortis) gotoBookContentPage(item.wechatRecord.wxId, item.id)
// var bookId = item.id; // var bookId = item.id;
// uni.navigateTo({ // uni.navigateTo({
// url: `/page-subs/sub_A/book-content/book-content`, // 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 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 const PAKEAGE_NAME = 'com.test.test'
export function trim(str) { 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