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,
......
...@@ -31,7 +31,8 @@ export default class Book { ...@@ -31,7 +31,8 @@ export default class Book {
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;
......
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();
......
...@@ -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)
} }
} }
} }
......
...@@ -6,6 +6,9 @@ import { ...@@ -6,6 +6,9 @@ import {
function getFirstShow(callback) { function getFirstShow(callback) {
apiPOST({ apiPOST({
url: "/book/firstArticle", url: "/book/firstArticle",
data: {
reader: true
},
callback callback
}) })
} }
......
...@@ -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
......
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)
}, },
} }
} }
......
...@@ -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,
...@@ -216,17 +227,3 @@ ...@@ -216,17 +227,3 @@
} }
} }
} }
\ No newline at end of file
// "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
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 2
}); });
gotoBookContentPage(item.id, item.shortis); gotoBookContentPage(item.wechatRecord.wxId, item.id);
} }
} }
} }
......
...@@ -6,10 +6,12 @@ ...@@ -6,10 +6,12 @@
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'
@click="tapItem(item)">
<view class="cover-box item"> <view class="cover-box item">
<image v-if="item.avatar===''" class="cover" src="/static/images/logo.png" mode="aspectFill"></image> <image v-if="item.avatar===''" class="cover" src="/static/images/logo.png" mode="aspectFill">
<image v-else class="cover" :src="item.avatar" mode="aspectFill" ></image> </image>
<image v-else class="cover" :src="item.avatar" mode="aspectFill"></image>
</view> </view>
<view class="c-flex_column"> <view class="c-flex_column">
<view class="c-flex_row c-justify_between row"> <view class="c-flex_row c-justify_between row">
...@@ -26,7 +28,8 @@ ...@@ -26,7 +28,8 @@
</view> </view>
<view class="c-flex_row c-align_center label-box row"> <view class="c-flex_row c-align_center label-box row">
<slot name="footer"> <slot name="footer">
<view class="label label-color-1" v-if="item.categoryName!=null&&item.categoryName!=''"> <view class="label label-color-1"
v-if="item.categoryName!=null&&item.categoryName!=''">
{{item.categoryName}} {{item.categoryName}}
</view> </view>
<view class="label label-color-2" v-for='(label, labelIndex) in item.tagList' <view class="label label-color-2" v-for='(label, labelIndex) in item.tagList'
...@@ -39,7 +42,7 @@ ...@@ -39,7 +42,7 @@
</view> </view>
</view> </view>
<view style="display: flex;margin: auto;width: 200rpx;"> <view style="display: flex;margin: auto;width: 200rpx;">
<button class="btn2" >去阅读</button> <button class="btn2">去阅读</button>
</view> </view>
</view> </view>
</view> </view>
...@@ -100,8 +103,7 @@ ...@@ -100,8 +103,7 @@
} }
} }
}, },
onUnload() { onUnload() {},
},
mounted() { mounted() {
this.requestPackData(); this.requestPackData();
}, },
...@@ -117,7 +119,7 @@ ...@@ -117,7 +119,7 @@
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;
} }
...@@ -128,7 +130,7 @@ ...@@ -128,7 +130,7 @@
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 2
}); });
gotoBookContentPage(item.id, item.shortis); gotoBookContentPage(item.wechatRecord.wxId, item.id);
} }
} }
} }
...@@ -232,11 +234,13 @@ ...@@ -232,11 +234,13 @@
} }
} }
} }
.book-list-item { .book-list-item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding-top: 14rpx; padding-top: 14rpx;
padding-bottom: 14rpx; padding-bottom: 14rpx;
.row { .row {
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
}, },
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
......
...@@ -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,7 +81,7 @@ ...@@ -80,7 +81,7 @@
}); });
}, },
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({
......
| 平台 | 账号 |
| ---- | ---- |
| [微信开放平台](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