|
@@ -3,9 +3,7 @@ import {
|
|
getCategoryList,
|
|
getCategoryList,
|
|
getResourceList
|
|
getResourceList
|
|
} from "~/api/works"
|
|
} from "~/api/works"
|
|
-import {
|
|
|
|
- setSubscribe,
|
|
|
|
-} from '~/api/global'
|
|
|
|
|
|
+
|
|
import event from '~/mixins/event'
|
|
import event from '~/mixins/event'
|
|
import share from '~/mixins/share'
|
|
import share from '~/mixins/share'
|
|
import {
|
|
import {
|
|
@@ -19,10 +17,8 @@ Page({
|
|
behaviors: [share, event],
|
|
behaviors: [share, event],
|
|
data: {
|
|
data: {
|
|
navBarHeight: app.globalData.navBarHeight,
|
|
navBarHeight: app.globalData.navBarHeight,
|
|
- desktopTips: app.globalData.desktopTips,
|
|
|
|
categoryList: [],
|
|
categoryList: [],
|
|
listOptions: {},
|
|
listOptions: {},
|
|
- subscribeShow: false,
|
|
|
|
tmplIds: [],
|
|
tmplIds: [],
|
|
},
|
|
},
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
@@ -35,20 +31,6 @@ Page({
|
|
this.requestAgain()
|
|
this.requestAgain()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- let {
|
|
|
|
- desktopTips
|
|
|
|
- } = app.globalData
|
|
|
|
- if (desktopTips) {
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.setData({
|
|
|
|
- desktopTips: false
|
|
|
|
- })
|
|
|
|
- wx.setStorage({
|
|
|
|
- key: "preDesktopTime",
|
|
|
|
- data: new Date()
|
|
|
|
- })
|
|
|
|
- }, 6000)
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
if (typeof this.getTabBar === 'function') {
|
|
if (typeof this.getTabBar === 'function') {
|
|
@@ -57,30 +39,9 @@ Page({
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 分享到朋友圈
|
|
|
|
- shareImageMessage() {
|
|
|
|
- wx.miniapp.shareImageMessage({
|
|
|
|
- imagePath: '/static/375-300-1.jpg',
|
|
|
|
- thumbPath: '/static/inviteH.png',
|
|
|
|
- scene: 1,
|
|
|
|
- success(res) {
|
|
|
|
- console.log(res);
|
|
|
|
- wx.showToast({
|
|
|
|
- title: '成功:分享图片',
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- fail(res) {
|
|
|
|
- console.log(res);
|
|
|
|
- wx.showToast({
|
|
|
|
- title: '失败:分享图片',
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
requestAgain() {
|
|
requestAgain() {
|
|
this.getResource()
|
|
this.getResource()
|
|
this.getCategoryList()
|
|
this.getCategoryList()
|
|
- this.getSubscribe()
|
|
|
|
},
|
|
},
|
|
async getLocUserInfo() {
|
|
async getLocUserInfo() {
|
|
this.storeBindings = createStoreBindings(this, {
|
|
this.storeBindings = createStoreBindings(this, {
|
|
@@ -125,62 +86,11 @@ Page({
|
|
success(res) {}
|
|
success(res) {}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- closeDesktop() {
|
|
|
|
- this.setData({
|
|
|
|
- desktopTips: false
|
|
|
|
- })
|
|
|
|
- wx.setStorage({
|
|
|
|
- key: "preDesktopTime",
|
|
|
|
- data: new Date()
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
jumpSearch() {
|
|
jumpSearch() {
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
url: '/pages/childClassify/index?type=search',
|
|
url: '/pages/childClassify/index?type=search',
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- async getSubscribe() {
|
|
|
|
- let tmplIds = await setSubscribe()
|
|
|
|
- this.setData({
|
|
|
|
- tmplIds: tmplIds ? tmplIds : [],
|
|
|
|
- subscribeShow: tmplIds ? true : false,
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- requestMessage() {
|
|
|
|
- wx.requestSubscribeMessage({
|
|
|
|
- tmplIds: this.data.tmplIds,
|
|
|
|
- success: async (res) => {
|
|
|
|
- let accept = []
|
|
|
|
- this.data.tmplIds.forEach(item => {
|
|
|
|
- if (res[item] == 'accept') {
|
|
|
|
- accept.push(item)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- await setSubscribe({
|
|
|
|
- ids: accept
|
|
|
|
- }, 'post')
|
|
|
|
- this.getSubscribe()
|
|
|
|
- },
|
|
|
|
- fail: async (err) => {
|
|
|
|
- await setSubscribe({
|
|
|
|
- ids: []
|
|
|
|
- }, 'post')
|
|
|
|
- this.getSubscribe()
|
|
|
|
- /* console.log(err);
|
|
|
|
- if (err.errCode == '20004') {
|
|
|
|
- // 20004
|
|
|
|
- wx.showModal({
|
|
|
|
- title: '温馨提示',
|
|
|
|
- content: '请同意允许我们向您发送订阅信息,请打开设置勾选订阅消息,这样能随时接到关于您作品的最新消息',
|
|
|
|
- complete: (res) => {
|
|
|
|
- if (res.cancel) {}
|
|
|
|
- if (res.confirm) {}
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } */
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
onUnload() {
|
|
onUnload() {
|
|
this.storeBindings.destroyStoreBindings()
|
|
this.storeBindings.destroyStoreBindings()
|
|
},
|
|
},
|