diff --git a/CHANGELOG.md b/CHANGELOG.md index 76904b9..37d0248 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 0.1.0 (2021-12-27) +# 0.1.0 (2021-12-28) ### 🌟 新功能 范围|描述|commitId @@ -170,6 +170,7 @@ - | 初始展示角色修改 | [2ac4053](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/2ac4053) - | 卸载stylus | [610b465](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/610b465) - | 多处bug修改 | [4835581](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/4835581) + - | 完善分享功能 | [dab9e65](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/dab9e65) - | 完善扫描二维码逻辑 | [41421ba](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/41421ba) - | 完善扫描二维码逻辑 | [658245f](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/658245f) - | 完善雷达图 | [5f52d35](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/5f52d35) diff --git a/src/App.vue b/src/App.vue index cdcffca..1c19d21 100644 --- a/src/App.vue +++ b/src/App.vue @@ -9,6 +9,7 @@ export default { // TODO: this 先判断是不是通过扫二维码进来的 console.log('options: ', options); this.setScene(options.scene); + this.setEnterOptions(options); if (options.scene === 1047) { // 扫描小程序码 if (options.query && options.query.scene) { @@ -53,7 +54,7 @@ export default { ...mapActions('socket', ['initSocket']), ...mapMutations(['setSystemInfo']), ...mapMutations('user', ['setToken', 'setUser']), - ...mapMutations('yanyuan', ['setToolCode', 'setEnterByCode', 'setScene']), + ...mapMutations('yanyuan', ['setToolCode', 'setEnterByCode', 'setScene', 'setEnterOptions']), // 登录 async signin() { diff --git a/src/pagesProject/project/project.vue b/src/pagesProject/project/project.vue index 6c7e8b9..2853d5b 100644 --- a/src/pagesProject/project/project.vue +++ b/src/pagesProject/project/project.vue @@ -79,6 +79,7 @@ export default { }, onLoad(options) { + console.log('options: ', options); this.templateCode = options.code; if (options.share && options.share === '1') { // TODO: 判断用户第一次进来才会显示引导页 diff --git a/src/pagesUser/git-phone-power/git-phone-power.vue b/src/pagesUser/git-phone-power/git-phone-power.vue index 0bdb7c7..a32add1 100644 --- a/src/pagesUser/git-phone-power/git-phone-power.vue +++ b/src/pagesUser/git-phone-power/git-phone-power.vue @@ -54,7 +54,7 @@ export default { computed: { ...mapGetters('user', ['userId']), - ...mapState('yanyuan', ['enterByCode']), + ...mapState('yanyuan', ['enterByCode', 'enterOptions', 'scene']), }, mounted() { @@ -91,15 +91,9 @@ export default { this.$refs.uTips.show({ title: '绑定成功, 即将跳转', type: 'success', - duration: '2000', + duration: '3000', }); - let url = ''; - if (this.enterByCode) { - url = `/pages/index/index?u=${this.userId}&code=true`; - } else { - url = `/pages/index/index?u=${this.userId}`; - } - setTimeout(() => uni.reLaunch({ url }), 2000); + this.JumpPage(); } else { this.phone = data.phone; } @@ -136,26 +130,14 @@ export default { type: 'success', duration: '3000', }); - let url = ''; - if (this.enterByCode) { - url = `/pages/index/index?u=${this.userId}&code=true`; - } else { - url = `/pages/index/index?u=${this.userId}`; - } - setTimeout(() => uni.reLaunch({ url }), 3000); + this.JumpPage(); } else { this.$refs.uTips.show({ title: '即将跳转上一页', type: 'success', duration: '3000', }); - let url = ''; - if (this.enterByCode) { - url = `/pages/index/index?u=${this.userId}&code=true`; - } else { - url = `/pages/index/index?u=${this.userId}`; - } - setTimeout(() => uni.reLaunch({ url }), 3000); + this.JumpPage(); } } catch (error) { console.error('error: ', error); @@ -167,7 +149,6 @@ export default { // 取消 返回首页 back() { let url = ''; - console.log('this.enterByCode: ', this.enterByCode); if (this.enterByCode) { url = `/pages/index/index?u=${this.userId}&code=true`; } else { @@ -175,6 +156,35 @@ export default { } uni.reLaunch({ url }); }, + + // 进入首页 + JumpPage() { + if (this.enterByCode) { + let url = `/pages/index/index?u=${this.userId}&code=true`; + setTimeout(() => uni.reLaunch({ url }), 3000); + } else { + if (this.scene === 1007 || (this.scene === 1008 && this.enterOptions.path === 'pagesProject/project/project')) { + this.enterProject(); + } else { + let url = `/pages/index/index?u=${this.userId}`; + setTimeout(() => uni.reLaunch({ url }), 3000); + } + } + }, + + // 进入项目详情页 + enterProject() { + const { userId } = this; + const { path, query } = this.enterOptions; + const { code, p, pname, url, u } = query; + this.$u.route(`/${path}`, { + u: userId || u, + p, + pname: pname, + url: encodeURIComponent(url), + code, + }); + }, }, }; diff --git a/src/pagesUser/phone-bind/phone-bind.vue b/src/pagesUser/phone-bind/phone-bind.vue index 9abd33c..0988be7 100644 --- a/src/pagesUser/phone-bind/phone-bind.vue +++ b/src/pagesUser/phone-bind/phone-bind.vue @@ -47,7 +47,7 @@ diff --git a/src/store/yanyuan/mutations.js b/src/store/yanyuan/mutations.js index 3382408..4fc010e 100644 --- a/src/store/yanyuan/mutations.js +++ b/src/store/yanyuan/mutations.js @@ -169,6 +169,15 @@ const mutations = { setScene(state, data) { state.scene = data; }, + + /** + * 设置进入options + * @param {object} state + * @param {object} data + */ + setEnterOptions(state, data) { + state.enterOptions = data; + }, }; export default mutations; diff --git a/src/store/yanyuan/state.js b/src/store/yanyuan/state.js index e67433f..75bf72e 100644 --- a/src/store/yanyuan/state.js +++ b/src/store/yanyuan/state.js @@ -19,6 +19,7 @@ const state = { toolCode: '', // 二维码携带的工具箱code testNumber: 0, // 已经完成的试题编号 scene: '', // 场景值 + enterOptions: null, // 进入程序options }; export default state;