diff --git a/App.vue b/App.vue index cc1058b..651fe9f 100644 --- a/App.vue +++ b/App.vue @@ -3,7 +3,7 @@ onLaunch: function() { }, onShow: function() { - // this.$store.commit('initConfig') + this.$store.commit('initConfig') }, onHide: function() { } diff --git a/api/api.js b/api/api.js index d566315..77cb7df 100644 --- a/api/api.js +++ b/api/api.js @@ -5,7 +5,7 @@ import utils from '../utils/utils.js' let limit = {} let debounce = {} -const models = ['login', 'index', 'vip', 'info'] +const models = ['login', 'index', 'center', 'sharing', 'vip', 'info'] const config = { // 示例 @@ -14,7 +14,7 @@ const config = { // limit : 1000 // }, - getConfig : {url : '/config_common/getConfig', method : 'GET', limit : 500}, + getConfig : {url : '/all_login/getConfig', method : 'GET', limit : 500}, } @@ -81,6 +81,12 @@ export function api(key, data, callback, loadingTitle) { loadingTitle || req.showLoading, loadingTitle || req.loadingTitle) } +export const fetch = (key, data = {}, loadingTitle) => { + return new Promise(resolve => { + api(key, data, resolve, loadingTitle) + }) +} + function addApiModel(model, key){ for(let k in model){ diff --git a/api/fetch.js b/api/fetch.js new file mode 100644 index 0000000..6443777 --- /dev/null +++ b/api/fetch.js @@ -0,0 +1,20 @@ +import api from './api.js' + +const fetch = (key, data = {}, transform = true, loadingTitle) => { + return new Promise(resolve => { + + const callback = (res) => { + if (!transform) { + resolve(res) + return + } + if (res.code == 200) { + resolve(res.result) + } + } + + api(key, data, callback, loadingTitle) + }) +} + +export default fetch diff --git a/api/model/center.js b/api/model/center.js new file mode 100644 index 0000000..692f3b6 --- /dev/null +++ b/api/model/center.js @@ -0,0 +1,21 @@ + +const api = { + /** + * 获取公告信息 + */ + getNotice: { + url: '/all_login/getNotice', + method: 'GET', + auth: true, + }, + /** + * 获取动态列表 + */ + getNews: { + url: '/all_login/getNews', + method: 'GET', + auth: true, + }, +} + +export default api \ No newline at end of file diff --git a/api/model/info.js b/api/model/info.js index 5f170cc..f61c5d6 100644 --- a/api/model/info.js +++ b/api/model/info.js @@ -1,6 +1,14 @@ // 个人相关接口 const api = { + /** + * 获取推广二维码 + */ + getQrCode: { + url: '/info/getQrCode', + method: 'GET', + auth: true, + }, } export default api \ No newline at end of file diff --git a/api/model/login.js b/api/model/login.js index c818a04..c558ed3 100644 --- a/api/model/login.js +++ b/api/model/login.js @@ -5,20 +5,20 @@ const api = { // 微信登录接口 wxLogin: { - url: '/login_common/appletLogin', + url: '/all_login/appletLogin', method: 'GET', limit : 500, showLoading : true, }, // 获取绑定手机号码 bindPhone: { - url: '/login_common/bindPhone', + url: '/all_login/bindPhone', method: 'GET', auth: true, }, // 修改个人信息接口 updateInfo: { - url: '/info_common/updateInfo', + url: '/info/updateUserInfo', method: 'POST', auth: true, limit : 500, @@ -26,7 +26,7 @@ const api = { }, // 获取个人信息 getInfo: { - url: '/info_common/getInfo', + url: '/info/getUserInfo', method: 'GET', auth: true, }, diff --git a/api/model/sharing.js b/api/model/sharing.js new file mode 100644 index 0000000..c3f326b --- /dev/null +++ b/api/model/sharing.js @@ -0,0 +1,122 @@ +const api = { + /** + * 获取个人分享记录详情 + */ + getShareInfo: { + url: '/fen/getShareInfo', + method: 'GET', + auth: true, + }, + /** + * 增加或者修改个人分享 + */ + saveOrUpdateShare: { + url: '/fen/saveOrUpdateShare', + method: 'POST', + auth: true, + limit : 500, + showLoading : true, + }, + /** + * 获取视频分享记录详情 + */ + getVideoShareInfo: { + url: '/fen/getVideoShareInfo', + method: 'GET', + auth: true, + }, + /** + * 增加或者修改视频分享 + */ + saveOrUpdateVideoShare: { + url: '/fen/saveOrUpdateVideoShare', + method: 'POST', + auth: true, + limit : 500, + showLoading : true, + }, + /** + * 获取群分享记录详情 + */ + getGroupShareInfo: { + url: '/fen/getGroupShareInfo', + method: 'GET', + auth: true, + }, + /** + * 增加或者修改群分享 + */ + saveOrUpdateGroupShare: { + url: '/fen/saveOrUpdateGroupShare', + method: 'POST', + auth: true, + limit : 500, + showLoading : true, + }, + /** + * 获取文章分享记录详情 + */ + getArticleShareInfo: { + url: '/fen/getArticleShareInfo', + method: 'GET', + auth: true, + }, + /** + * 增加或者修改文章分享 + */ + saveOrUpdateArticleShare: { + url: '/fen/saveOrUpdateArticleShare', + method: 'POST', + auth: true, + limit : 500, + showLoading : true, + }, + /** + * 获取分享记录列表带分页 + */ + getSharePage: { + url: '/fen/getSharePage', + method: 'GET', + auth: true, + }, + /** + * 校验个人转发是否达标 + */ + checkShare: { + url: '/fen/checkShare', + method: 'POST', + auth: true, + }, + /** + * 校验视频转发是否达标 + */ + checkVideoShare: { + url: '/fen/checkVideoShare', + method: 'POST', + auth: true, + limit : 500, + showLoading : true, + }, + /** + * 校验群转发是否达标 + */ + checkGroupShare: { + url: '/fen/checkGroupShare', + method: 'POST', + auth: true, + limit : 500, + showLoading : true, + }, + /** + * 校验文章转发是否达标 + */ + checkArticleShare: { + url: '/fen/checkArticleShare', + method: 'POST', + auth: true, + limit : 500, + showLoading : true, + }, +} + +export default api \ No newline at end of file diff --git a/config.js b/config.js index 4175d2b..6ccb044 100644 --- a/config.js +++ b/config.js @@ -1,22 +1,23 @@ import Vue from 'vue' import api from '@/api/api.js' +import fetch from '@/api/fetch.js' import utils from './utils/utils.js' import uvUI from '@/uni_modules/uv-ui-tools' Vue.use(uvUI); // 当前环境 -const type = 'dev' +const type = 'prod' // 环境配置 const config = { dev : { - baseUrl : 'http://www.gcosc.fun:82', + baseUrl : 'http://h5.xzaiyp.top/fission-star-api', }, prod : { - baseUrl : 'http://xxx.xxx.xxx/xxx', + baseUrl : 'https://fission-star-api.hhlm1688.com/fission-star-api', } } @@ -52,5 +53,6 @@ uni.$uv.setConfig({ Vue.prototype.$config = utils.deepMergeObject(defaultConfig, config[type]) Vue.prototype.$api = api +Vue.prototype.$fetch = fetch export default Vue.prototype.$config \ No newline at end of file diff --git a/pages.json b/pages.json index 88ab439..45bbd1d 100644 --- a/pages.json +++ b/pages.json @@ -8,7 +8,8 @@ { "path": "pages/index/record", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "", + "enablePullDownRefresh": true } }, { @@ -54,6 +55,9 @@ { "path": "mine/setting" }, + { + "path": "mine/news" + }, { "path": "mine/sharing" }, diff --git a/pages/index/center.vue b/pages/index/center.vue index 0fd5699..44923f9 100644 --- a/pages/index/center.vue +++ b/pages/index/center.vue @@ -5,20 +5,18 @@ - - + - - 裂变星1号 + {{ userInfo.nickName }} - ID: - 12345678 + {{ userInfo.id }} + @@ -56,24 +54,28 @@ + 分享好友 + 激活码 + 我的钱包 + @@ -84,7 +86,7 @@ - + @@ -111,16 +113,16 @@ - + - {{ item.title }} - {{ item.description }} + {{ item.title || '' }} + {{ getDesc(item.details) }} @@ -139,93 +141,62 @@ diff --git a/pages/index/record.vue b/pages/index/record.vue index 1b8255b..89a0ebc 100644 --- a/pages/index/record.vue +++ b/pages/index/record.vue @@ -6,7 +6,9 @@ - + + \ No newline at end of file diff --git a/pages_order/mine/sharing.vue b/pages_order/mine/sharing.vue index 7fbd334..5c1a34c 100644 --- a/pages_order/mine/sharing.vue +++ b/pages_order/mine/sharing.vue @@ -3,33 +3,130 @@ - + + + + + - - + + @@ -78,9 +175,11 @@ } .btn { + display: inline-flex; width: 280rpx; height: 90rpx; font-size: 36rpx; + line-height: 1; color: #FFFFFF; border-radius: 45rpx; margin: 0; diff --git a/pages_order/mine/team.vue b/pages_order/mine/team.vue index d36b1bf..f2c6eb9 100644 --- a/pages_order/mine/team.vue +++ b/pages_order/mine/team.vue @@ -205,7 +205,8 @@ }) }, //点击tab栏 - clickTabs(index) { + clickTabs(e) { + const { index } = e if (index == 0) { this.state = -1; } else { diff --git a/pages_order/record/articleSharing.vue b/pages_order/record/articleSharing.vue index 0cf72ab..7b7cca8 100644 --- a/pages_order/record/articleSharing.vue +++ b/pages_order/record/articleSharing.vue @@ -6,7 +6,7 @@ + errorType="toast" + > - + - + {{ userId }} + + + - + - + @@ -37,82 +40,99 @@ return { detail: { id: null, - title: null, - videoUrl: null, - times: 10, - qrCode: null, - description: null, + headTitle: null, + indexImage: null, + vio: null, + mins: 10, + num: 10, + wxCodeImage: null, + textDetails: null, }, + timeIsUp: false, isLocked: true, videoContext: null } }, async onLoad(option) { - console.log('--option', option) const { id } = option - await this.fetchSharingDetail(id) + await this.fetchDetails(id) this.videoContext = uni.createVideoContext('video'); - - console.log('--videoContext', this.videoContext) - - // this.videoContext.requestFullScreen() - }, onShareAppMessage(res) { const { - title, - coverImageUrl, + headTitle, + indexImage, } = this.detail - // todo: check let o = { - title : title, - imageUrl: coverImageUrl, - query: `id=${this.detail.id}`, + title : headTitle, + imageUrl: indexImage, + query: `id=${this.id}`, } - // todo: check callback? settimeout? - // todo: get times and check is unlocked - - this.isLocked = false - - this.$refs.popupQrCode.open() + this.refreshLockStatus() return o }, methods: { - async fetchSharingDetail(id) { - // todo: init data by id - - this.detail = { - id: '001', - author: '@裂变星', - coverImageUrl: 'http://gips3.baidu.com/it/u=70459541,3412285454&fm=3028&app=3028&f=JPEG&fmt=auto?w=960&h=1280', - videoUrl: 'http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400', - mins: 10, - times: 10, - qrCode: '../static/temp-qrcode.png', - title: '20秒学会日赚1000+,全自动获客', - description: '裂变获客,轻松引流!', - auditStatus: 2, - createTime: '2025年2月1日', - state: 1, + async fetchDetails(id) { + try { + this.detail = await this.$fetch('getVideoShareInfo', { id }) + } catch (err) { + } }, - onTimeupdate(e) { + async fetchCheckShare(id) { + try { + return await this.$fetch('checkVideoShare', { id }, false) + } catch (err) { + return {} + } + }, + async refreshLockStatus() { + const res = await this.fetchCheckShare() + const { result, message } = res + + if (result) { + this.isLocked = false + this.$refs.popupUnlock.close(); + this.$refs.popupQrCode.open() + return + } + + message && uni.showToast({ + title: message, + icon: 'none' + }) + }, + async onPlay() { + if (!this.isLocked) { + this.$refs.popupQrCode.open() + return + } + + const res = await this.fetchCheckShare() + + const { result, message } = res + + if (result) { // 转发已达标 + this.isLocked = false + this.$refs.popupQrCode.open() + } else { + this.$refs.popupUnlock.open(); + } + }, + async onTimeupdate(e) { const { currentTime } = e.target - if (currentTime >= this.detail.mins) { + // todo: check + if (currentTime >= (this.detail.mins || 5)) { this.videoContext.pause() - - if (this.isLocked) { - this.$refs.popupUnlock.open(); - } else { - this.$refs.popupQrCode.open() - } + this.timeIsUp = true + this.onPlay() } }, }, diff --git a/pages_order/static/temp-avatar.png b/pages_order/static/temp-avatar.png deleted file mode 100644 index 46330de..0000000 Binary files a/pages_order/static/temp-avatar.png and /dev/null differ diff --git a/pages_order/static/temp-qrcode.png b/pages_order/static/temp-qrcode.png deleted file mode 100644 index d0f20ae..0000000 Binary files a/pages_order/static/temp-qrcode.png and /dev/null differ diff --git a/store/store.js b/store/store.js index 3b6d27d..9aa1e78 100644 --- a/store/store.js +++ b/store/store.js @@ -65,7 +65,7 @@ const store = new Vuex.Store({ return } - state.userInfo = res.result.userInfo + Vue.set(state, 'userInfo', res.result.userInfo) uni.setStorageSync('token', res.result.token) if(!state.userInfo.nickName || !state.userInfo.headImage){ @@ -83,7 +83,7 @@ const store = new Vuex.Store({ getUserInfo(state){ api('getInfo', res => { if(res.code == 200){ - state.userInfo = res.result + Vue.set(state, 'userInfo', res.result) } }) }, @@ -93,7 +93,7 @@ const store = new Vuex.Store({ title: '确认退出登录吗', success(r) { if(r.confirm){ - state.userInfo = {} + Vue.set(state, 'userInfo', {}) state.role = false uni.removeStorageSync('token') uni.reLaunch({