diff --git a/src/assets/images/peoSuggestion/1.png b/src/assets/images/peoSuggestion/1.png index 5962bf5..440fd2c 100644 Binary files a/src/assets/images/peoSuggestion/1.png and b/src/assets/images/peoSuggestion/1.png differ diff --git a/src/assets/images/peoSuggestion/14.png b/src/assets/images/peoSuggestion/14.png new file mode 100644 index 0000000..3d64f05 Binary files /dev/null and b/src/assets/images/peoSuggestion/14.png differ diff --git a/src/assets/images/peoSuggestion/9.png b/src/assets/images/peoSuggestion/9.png index 253c84f..24ea168 100644 Binary files a/src/assets/images/peoSuggestion/9.png and b/src/assets/images/peoSuggestion/9.png differ diff --git a/src/utils/jweixin.js b/src/utils/jweixin.js index 64303e2..8c94c23 100644 --- a/src/utils/jweixin.js +++ b/src/utils/jweixin.js @@ -12,4 +12,21 @@ export const setConfig = function (jsApiList = []) { openTagList:['wx-open-launch-weapp'] }) }) + wx.ready(function(){ + wx.updateAppMessageShareData({ + title: '人民建议征集', // 分享标题 + desc: '倾听民声,汇集民智,期待您的好建议、金点子。', // 分享描述 + link: `${location.href.split('#')[0]+"#/peoSuggestion?appId=wx1078fa1e99424de9&&type=add"}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 + imgUrl: 'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet-saas/prod/20241223/0b3fb8a6d64a4f39a14e00a7f8641a00.png', // 分享图标 + success: function () { + // alert("陈工") + // 设置成功 + }, + fail:function(){ + console.log("出错了"); + } + + }); + // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。 + }); } diff --git a/src/views/home/index.vue b/src/views/home/index.vue index bc448bd..040cedc 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -52,7 +52,7 @@ -
+
diff --git a/src/views/peoSuggestion/index.vue b/src/views/peoSuggestion/index.vue index 6a472f8..be4a032 100644 --- a/src/views/peoSuggestion/index.vue +++ b/src/views/peoSuggestion/index.vue @@ -6,8 +6,11 @@
-
- +
+ +
+
+
@@ -236,7 +239,7 @@ export default { }, async mounted() { // setConfig(['updateAppMessageShareData', 'onMenuShareAppMessage', 'updateTimelineShareData']) - + setConfig(['updateAppMessageShareData', 'onMenuShareAppMessage', 'updateTimelineShareData']) const currentUrl = window.location.href; // 生成二维码 this.generateQRCode(currentUrl); diff --git a/src/views/selectAgency/index.vue b/src/views/selectAgency/index.vue index db5b75e..2882d77 100644 --- a/src/views/selectAgency/index.vue +++ b/src/views/selectAgency/index.vue @@ -41,6 +41,7 @@ import { setConfig } from '@/utils/jweixin' export default { data() { return { + type:"", cityJson: [], selfCity: [], address: null, @@ -55,6 +56,11 @@ export default { created() { }, mounted() { + const url = location.href; + const queryString = url.split('?')[1]; + const params = new URLSearchParams(queryString); + this.type = params.get('type'); + console.log(type); // 输出 "add" setConfig(['checkJsApi', 'openLocation', 'getLocation', 'updateAppMessageShareData', 'updateTimelineShareData']) this.signWX() if(this.latLng){ @@ -63,6 +69,7 @@ export default { }, methods: { search(){ + this.organizationName = this.searchKey; this.getAgency(); }, @@ -108,8 +115,8 @@ export default { this.city = res.data.regeocode.addressComponent.city this.district = res.data.regeocode.addressComponent.district; this.street = res.data.regeocode.addressComponent.township; - this.organizationName = res.data.regeocode.addressComponent.township; - this.selfCity.push({label:this.city},{ label: this.district},{label:this.street}) + this.organizationName = res.data.regeocode.addressComponent.district; + this.selfCity.push({label:this.city},{ label: this.district}) this.getAgency() } else{ console.log(res); @@ -125,6 +132,7 @@ export default { this.signWX() }, async getAgency(type) { + console.log(type,"adsfjlsjlsflks") let parm ={ organizationName:this.organizationName } @@ -154,7 +162,12 @@ export default { parm.agencyName = item.label; let res = await editUser(parm) if (res.code === 0) { - this.$router.replace('/') + if(this.type=="add"){ + this.$router.replace('/peoSuggestion') + }else{ + this.$router.replace('/') + } + } } else { this.organizationName = item.label;