diff --git a/api/model/sharing.js b/api/model/sharing.js index 59ad432..4d88525 100644 --- a/api/model/sharing.js +++ b/api/model/sharing.js @@ -6,6 +6,7 @@ const api = { url: '/fen/getShareInfo', method: 'GET', auth: true, + debounce: 500, }, /** * 删除分享记录 @@ -34,6 +35,7 @@ const api = { url: '/fen/getVideoShareInfo', method: 'GET', auth: true, + debounce: 500, }, /** * 增加或者修改视频分享 @@ -52,6 +54,7 @@ const api = { url: '/fen/getGroupShareInfo', method: 'GET', auth: true, + debounce: 500, }, /** * 增加或者修改群分享 @@ -70,6 +73,7 @@ const api = { url: '/fen/getArticleShareInfo', method: 'GET', auth: true, + debounce: 500, }, /** * 增加或者修改文章分享 diff --git a/pages_order/auth/wxUserInfo.vue b/pages_order/auth/wxUserInfo.vue index 7a2fb8e..fd4f4e3 100644 --- a/pages_order/auth/wxUserInfo.vue +++ b/pages_order/auth/wxUserInfo.vue @@ -157,9 +157,14 @@ wxCode : self.userInfoForm.wxCode, }, res => { if (res.code == 200) { - uni.reLaunch({ - url:'/pages/index/index' - }) + uni.navigateBack({ + delta: 2, + fail: () => { + uni.reLaunch({ + url: '/pages/index/index' + }) + } + }); } }) }) diff --git a/pages_order/components/formNumberBox.vue b/pages_order/components/formNumberBox.vue index 9062e7f..34088cb 100644 --- a/pages_order/components/formNumberBox.vue +++ b/pages_order/components/formNumberBox.vue @@ -3,7 +3,7 @@ - diff --git a/pages_order/record/articleSharing.vue b/pages_order/record/articleSharing.vue index b5e95f6..dbb10fa 100644 --- a/pages_order/record/articleSharing.vue +++ b/pages_order/record/articleSharing.vue @@ -138,7 +138,7 @@ userId: null, headImage: null, headTitle: null, - num: 10, + num: 0, wxCodeImage: null, textDetails: null, }, @@ -164,6 +164,9 @@ this.fetchDetails(id) }, + onReady() { + this.$refs.form.setRules(this.getRules()); + }, onShareAppMessage(res) { const { headTitle, @@ -262,7 +265,14 @@ 'num': { type: 'number', required: true, - message: '请设置转发次数', + message: '请设置转发次数(大于1)', + validator: (rule, value, callback) => { + if (value > 1) { + return true + } + + return false; + }, }, 'wxCodeImage': { type: 'string', diff --git a/pages_order/record/groupSharing.vue b/pages_order/record/groupSharing.vue index 64cdf17..ffca964 100644 --- a/pages_order/record/groupSharing.vue +++ b/pages_order/record/groupSharing.vue @@ -76,14 +76,14 @@ - + - + @@ -144,8 +144,8 @@ headImage: null, headTitle: null, indexImage: null, - memberNum: 200, - num: 10, + memberNum: 50, + num: 0, wxCodeImage: null, }, rules: { @@ -172,7 +172,14 @@ 'num': { type: 'number', required: true, - message: '请设置转发次数', + message: '请设置转发次数(大于1)', + validator: (rule, value, callback) => { + if (value > 1) { + return true + } + + return false; + }, }, 'wxCodeImage': { type: 'string', @@ -200,6 +207,9 @@ this.fetchDetails(id) }, + onReady() { + this.$refs.form.setRules(this.rules); + }, onShareAppMessage(res) { const { headTitle, diff --git a/pages_order/record/personalSharing.vue b/pages_order/record/personalSharing.vue index 2866a9b..36f2c08 100644 --- a/pages_order/record/personalSharing.vue +++ b/pages_order/record/personalSharing.vue @@ -147,7 +147,7 @@ headImage: null, headTitle: null, indexImage: null, - num: 10, + num: 0, wxCodeImage: null, textDetails: null, }, @@ -170,7 +170,14 @@ 'num': { type: 'number', required: true, - message: '请设置转发次数', + message: '请设置转发次数(大于1)', + validator: (rule, value, callback) => { + if (value > 1) { + return true + } + + return false; + }, }, 'wxCodeImage': { type: 'string', @@ -206,6 +213,9 @@ this.fetchDetails(id) }, + onReady() { + this.$refs.form.setRules(this.rules); + }, onShareAppMessage(res) { const { headTitle, @@ -218,8 +228,6 @@ path: `/pages_order/sharing/personal?id=${this.id}&state=0&shareId=${this.userInfo.id}` } - // todo: get times and check is unlocked - this.isLocked = false return o diff --git a/pages_order/record/videoSharing.vue b/pages_order/record/videoSharing.vue index d968fc5..b92b443 100644 --- a/pages_order/record/videoSharing.vue +++ b/pages_order/record/videoSharing.vue @@ -141,8 +141,8 @@ headTitle: null, indexImage: null, vio: null, - timeNum: 10, - num: 10, + timeNum: 0, + num: 0, wxCodeImage: null, textDetails: null, }, @@ -165,12 +165,26 @@ 'timeNum': { type: 'number', required: true, - message: '请设置广告弹出时间', + message: '请设置广告弹出时间(大于1)', + validator: (rule, value, callback) => { + if (value > 1) { + return true + } + + return false; + }, }, 'num': { type: 'number', required: true, - message: '请设置转发次数', + message: '请设置转发次数(大于1)', + validator: (rule, value, callback) => { + if (value > 1) { + return true + } + + return false; + }, }, 'wxCodeImage': { type: 'string', @@ -199,6 +213,9 @@ this.fetchDetails(id) }, + onReady() { + this.$refs.form.setRules(this.rules); + }, onShareAppMessage(res) { const { headTitle, diff --git a/pages_order/sharing/article.vue b/pages_order/sharing/article.vue index 535d88b..749bc1a 100644 --- a/pages_order/sharing/article.vue +++ b/pages_order/sharing/article.vue @@ -47,7 +47,7 @@ userId: null, headImage: null, headTitle: null, - num: 10, + num: 0, wxCodeImage: null, textDetails: null, }, @@ -57,6 +57,11 @@ computed: { ...mapState(['userInfo']), }, + onShow() { + if (this.id && uni.getStorageSync('token')) { + this.initData() + } + }, async onLoad(option) { const { id, state, shareId } = option @@ -74,10 +79,12 @@ this.id = id - if(uni.getStorageSync('token')){ + if (uni.getStorageSync('token')) { this.initData() - }else{ - this.$refs.loginPopup.open() + } else { + uni.navigateTo({ + url: '/pages_order/auth/wxLogin' + }) } }, @@ -126,9 +133,9 @@ await this.fetchDetails(this.id) this.initEditor(this.detail.textDetails) }, - async fetchCheckShare(id) { + async fetchCheckShare() { try { - return await this.$fetch('checkArticleShare', { id }) + return await this.$fetch('checkArticleShare', { id: this.id }) } catch (err) { return {} } @@ -157,12 +164,16 @@ } const result = await this.fetchCheckShare() - const { open } = result + const { open, need_num, num } = result if (open) { // 转发已达标 this.isLocked = false this.$refs.popupQrCode.open() } else { + uni.showToast({ + title: `还需转发${need_num - num}次`, + icon: 'none', + }) this.$refs.popupUnlock.open(); } }, diff --git a/pages_order/sharing/group.vue b/pages_order/sharing/group.vue index 473485b..d0169b8 100644 --- a/pages_order/sharing/group.vue +++ b/pages_order/sharing/group.vue @@ -41,7 +41,7 @@ avatarUrl: null, nickName: null, imageUrl: null, - times: 10, + times: 0, qrCode: null, description: null, }, @@ -51,6 +51,11 @@ computed: { ...mapState(['userInfo']), }, + onShow() { + if (this.id && uni.getStorageSync('token')) { + this.fetchDetails() + } + }, onLoad(option) { const { id, state, shareId } = option @@ -68,10 +73,12 @@ this.id = id - if(uni.getStorageSync('token')){ + if (uni.getStorageSync('token')) { this.fetchDetails() - }else{ - this.$refs.loginPopup.open() + } else { + uni.navigateTo({ + url: '/pages_order/auth/wxLogin' + }) } }, onShareAppMessage(res) { @@ -99,9 +106,9 @@ } }, - async fetchCheckShare(id) { + async fetchCheckShare() { try { - return await this.$fetch('checkGroupShare', { id }) + return await this.$fetch('checkGroupShare', { id: this.id }) } catch (err) { return {} } @@ -128,14 +135,18 @@ async onAdd() { const result = await this.fetchCheckShare() - const { open } = result + const { open, need_num, num } = result - // todo: check if (open) { // 转发已达标 this.isLocked = false return } + uni.showToast({ + title: `还需转发${need_num - num}次`, + icon: 'none', + }) + this.openPopup() } }, diff --git a/pages_order/sharing/personal.vue b/pages_order/sharing/personal.vue index 1e34b34..f0f7400 100644 --- a/pages_order/sharing/personal.vue +++ b/pages_order/sharing/personal.vue @@ -14,8 +14,6 @@ - - @@ -23,12 +21,10 @@