Browse Source

议事详情样式,选择社区

feature
mk 1 year ago
parent
commit
02c8aac9c6
  1. 1
      public/index.html
  2. 4
      src/router/index.js
  3. 6
      src/utils/jweixin.js
  4. 34
      src/views/communityPublicity/detail.vue
  5. 40
      src/views/discussion/discusionDetail.vue
  6. 80
      src/views/selectAgency/index.vue

1
public/index.html

@ -14,6 +14,7 @@
<div id="app"></div> <div id="app"></div>
<script src="//res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script> <script src="//res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script> <script src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script>
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=5D6BZ-KHLW4-JUXU5-XIM47-5Q2DJ-IPBBT"></script> <!-- 腾讯地图 -->
<!-- <script type="text/javascript" src="//mapapi.qq.com/web/mapComponents/geoLocation/v/geolocation.min.js"></script>--> <!-- <script type="text/javascript" src="//mapapi.qq.com/web/mapComponents/geoLocation/v/geolocation.min.js"></script>-->
</body> </body>
</html> </html>

4
src/router/index.js

@ -5,7 +5,7 @@ import { constantRouterMap } from './router.config.js'
import { checkWxmpRegister, login } from '@/api/user' import { checkWxmpRegister, login } from '@/api/user'
import { title } from '@/config' import { title } from '@/config'
const whiteList = ['/login', '/register', '/errorPage','/selectAgency','/houseQR'] const whiteList = ['/login', '/register', '/errorPage','/selectAgency','/houseQR','/event']
const originalPush = Router.prototype.push const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) { Router.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject) if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
@ -92,7 +92,7 @@ router.beforeEach((to, from, next) => {
} }
}) })
} else { } else {
if (getQueryStringByName('code') && to.path != '/houseQR') { if (getQueryStringByName('code') && to.path != '/houseQR'&& to.path != '/event') {
login({ wxCode: getQueryStringByName('code'),appId:'wx1078fa1e99424de9'}).then(res => { login({ wxCode: getQueryStringByName('code'),appId:'wx1078fa1e99424de9'}).then(res => {
localStorage.setItem('token', res.token) localStorage.setItem('token', res.token)
localStorage.setItem('userId', res.userH5DTO.id) localStorage.setItem('userId', res.userH5DTO.id)

6
src/utils/jweixin.js

@ -1,14 +1,14 @@
import { getAutograph } from '@/api/basic' import { getAutograph } from '@/api/basic'
export const setConfig = function () { export const setConfig = function (jsApiList = []) {
getAutograph({ url: location.href.split('#')[0] }).then(res => { getAutograph({ url: location.href.split('#')[0] }).then(res => {
console.log(res) console.log(res)
wx.config({ wx.config({
debug: process.env.NODE_ENV !== 'production', debug: process.env.NODE_ENV === 'development',
appId: res.appId, appId: res.appId,
timestamp: res.timestamp, timestamp: res.timestamp,
nonceStr: res.nonceStr, nonceStr: res.nonceStr,
signature: res.signature, signature: res.signature,
jsApiList:[] jsApiList
}) })
}) })
} }

34
src/views/communityPublicity/detail.vue

@ -30,7 +30,7 @@
</template> </template>
<script> <script>
import {setConfig} from '@/utils/jweixin' import { setConfig } from '@/utils/jweixin'
export default { export default {
data() { data() {
return { return {
@ -42,27 +42,35 @@ export default {
this.info = JSON.parse(this.$route.query.item); this.info = JSON.parse(this.$route.query.item);
} }
}, },
mounted(){ mounted() {
setConfig(['updateAppMessageShareData','onMenuShareAppMessage', 'updateTimelineShareData']) setConfig(['updateAppMessageShareData', 'onMenuShareAppMessage', 'updateTimelineShareData'])
this.share()
}, },
methods: { methods: {
share() { share() {
console.log('zhixingle');
let than = this
if (wx.updateAppMessageShareData) { if (wx.updateAppMessageShareData) {
wx.updateAppMessageShareData({ wx.ready(function () {
title: 'e智社区', wx.updateAppMessageShareData({
desc: this.info.title, title: 'e智社区',
link: `http://epmet-cloud.elinkservice.cn/#/communityPublicityDetail?item=${JSON.stringify(this.info)}`, desc: than.info.title,
imgUrl: '', link: `http://epmet-cloud.elinkservice.cn/#/communityPublicityDetail?item=${encodeURIComponent(than.info)}`,
success: function () { imgUrl: '',
} success: function () {
}) console.log('分享成功');
}
})
});
} else { } else {
wx.onMenuShareAppMessage({ wx.onMenuShareAppMessage({
title: 'e智社区', title: 'e智社区',
desc: this.info.title, desc: than.info.title,
link: `http://epmet-cloud.elinkservice.cn/#/communityPublicityDetail?id=${JSON.stringify(this.info)}`, link: `http://epmet-cloud.elinkservice.cn/#/communityPublicityDetail?item=${encodeURIComponent(than.info)}}`,
imgUrl: '', imgUrl: '',
success: function () { success: function () {
console.log('分享成功');
} }
}) })
} }

40
src/views/discussion/discusionDetail.vue

@ -23,7 +23,7 @@
</div> </div>
</div> </div>
<div class="bot_btn flex flex-x flex-mean m-bot50 back_color back_color"> <div class="bot_btn flex flex-x flex-mean m-bot50 back_color back_color">
<van-button :disabled="disableAllButtons" round :class="supportNum ? 'support' : ''" <van-button :disabled="disableAllButtons" round class="support"
:icon="require('@/assets/images/icons/support.png')" type="info" @click="handelClicsupport"> :icon="require('@/assets/images/icons/support.png')" type="info" @click="handelClicsupport">
支持 支持
</van-button> </van-button>
@ -41,17 +41,10 @@ import { andelClicDetail, icEventOldDiscuss, advertisingTag, communityPublicity,
export default { export default {
data() { data() {
return { return {
substance: '最近重庆南路60号院改造,很多居民反应希望 政府给楼外加保护层,冬天温度太低。',
datetime: '2002-01-05 12:00:00',
signUp: [ signUp: [
{}, {},
],
detimgs: [
{ url: '@/assets/images/icons/resi.png' }
], ],
dataValue: 100, dataValue: null,
support: false, support: false,
oppose: false, oppose: false,
supportNum: null, supportNum: null,
@ -60,16 +53,14 @@ export default {
eventId: "", eventId: "",
ProblemDescription: {}, ProblemDescription: {},
vote: {} vote: {}
}; };
}, },
created() { created() {
this.eventId = this.$route.query.eventId this.eventId = this.$route.query.eventId
console.log(this.id, "this.id");
this.id = this.$route.query.eventId this.id = this.$route.query.eventId
this.agencyId = this.$store.state.app.agencyId; this.agencyId = this.$store.state.app.agencyId;
this.userId = this.$store.state.app.appId; this.userId = this.$store.state.app.userInfo.id;
this.icEventOldDiscussDetil1() this.icEventOldDiscussDetil1()
}, },
computed: { computed: {
@ -94,10 +85,8 @@ export default {
userId: this.userId, userId: this.userId,
opinionFlag: 0 opinionFlag: 0
} }
console.log(parm);
let res = await handelClicsupport(parm) let res = await handelClicsupport(parm)
this.icEventOldDiscuss() await this.icEventOldDiscussDetil1()
}, },
async handelClicopposeNum(data) { async handelClicopposeNum(data) {
let parm = { let parm = {
@ -106,10 +95,8 @@ export default {
userId: this.userId, userId: this.userId,
opinionFlag: 1 opinionFlag: 1
} }
console.log(parm);
let res = await handelClicsupport(parm) let res = await handelClicsupport(parm)
this.icEventOldDiscuss() await this.icEventOldDiscussDetil1()
}, },
async icEventOldDiscussDetil1() { async icEventOldDiscussDetil1() {
console.log(this.id, "this.id"); console.log(this.id, "this.id");
@ -117,7 +104,6 @@ export default {
icEventId: this.eventId icEventId: this.eventId
} }
await andelClicDetail(parm).then(res => { await andelClicDetail(parm).then(res => {
console.log(res, "res");
this.ProblemDescription = res; this.ProblemDescription = res;
this.dataValue = res.opposeNum + res.supportNum this.dataValue = res.opposeNum + res.supportNum
}) })
@ -125,22 +111,6 @@ export default {
handsupport() { handsupport() {
this.support = true; this.support = true;
}, },
Onsupport() {
this.supportNum++;
this.dataValue++;
this.disableAllButtons = true; //
console.log(this.supportNum)
},
Onoppose() {
console.log("1111")
this.opposeNum++;
this.dataValue++;
this.disableAllButtons = true; //
console.log(this.supportNum)
}
}, },
} }

80
src/views/selectAgency/index.vue

@ -2,16 +2,16 @@
<div> <div>
<div class="selfCity flex flex-center2 p-12 flex-end"> <div class="selfCity flex flex-center2 p-12 flex-end">
<div class="flex flex-center2 flex-1"> <div class="flex flex-center2 flex-1">
<img src="@/assets/images/icons/homeBlue.png" alt="" @click="getAgency"/> <img src="@/assets/images/icons/homeBlue.png" alt="" @click="getAgency" />
<span style="color: #666666;" v-if="!selfCity">请选择您所在城市</span> <!-- <span style="color: #666666;" v-if="!selfCity && district">请选择您所在城市</span> -->
<span v-else class="flex"> <span class="flex">
<div v-for="(item, index) in selfCity"> <div v-for="(item, index) in selfCity">
<span @click="handelClickAgencyName(item,index)"> {{ item.label }}</span> <span @click="handelClickAgencyNav(item, index)"> {{ item.label }}</span>
<span v-if="index != selfCity.length - 1"></span> <span v-if="index != selfCity.length - 1"></span>
</div> </div>
</span> </span>
</div> </div>
<van-button type="info" size="small" round class="m-right10">手动选择</van-button> <van-button type="info" size="small" round class="m-right10" @click="restAddress">手动选择</van-button>
</div> </div>
<div class="container"> <div class="container">
<van-list finished-text="没有更多了" class="selectAgency"> <van-list finished-text="没有更多了" class="selectAgency">
@ -24,26 +24,79 @@
<script> <script>
import { editUser, getAllOrgTreeList } from "@/api/user"; import { editUser, getAllOrgTreeList } from "@/api/user";
import { setConfig } from '@/utils/jweixin'
export default { export default {
data() { data() {
return { return {
cityJson: [], cityJson: [],
selfCity: [], selfCity: [],
address: null,
district: null,
show:true
}; };
}, },
created() { created() {
this.getAgency() },
mounted() {
setConfig(['checkJsApi', 'openLocation', 'getLocation', 'updateAppMessageShareData', 'updateTimelineShareData'])
this.signWX()
}, },
methods: { methods: {
async getAgency() { restAddress() {
this.selfCity = []; this.district = null;
let res = await getAllOrgTreeList({organizationName:''}) this.selfCity = null;
this.getAgency();
},
signWX() {
let _this = this
wx.checkJsApi({
jsApiList: ['getLocation'],
success: function (res) {
// alert(JSON.stringify(res));
if (res.checkResult.getLocation === false) {
alert('你的微信版本太低,不支持微信JS接口,请升级到最新的微信版本!')
return false
}
}
})
wx.ready(function () {
wx.getLocation({
type: 'gcj02', // wgs84gpsopenLocation'gcj02'
success: function (res) {
var latLng = new qq.maps.LatLng(res.latitude, res.longitude)
getAddr.getAddress(latLng)
},
cancel: function (res) {
alert('用户拒绝授权获取地理位置')
}
})
})
wx.error(function (res) {
console.log('微信js-sdk 配置失败000' + res.errMsg)
})
//
var getAddr = new qq.maps.Geocoder({
complete: function (res) {
_this.address = res.detail
var allAddress = res.detail.addressComponents
var address = res.detail.address
console.log('地址:', address, allAddress.province, allAddress.city, allAddress.district)
_this.district = allAddress.district;
_this.getAgency(true)
}
})
},
async getAgency(type) {
let res = await getAllOrgTreeList({ organizationName: this.district })
if (res) { if (res) {
if (type) {
this.selfCity.push({ label: this.district, children: res })
}
this.cityJson = res; this.cityJson = res;
} }
}, },
handelClickAgencyName(item,index){ handelClickAgencyNav(item, index) {
if(item.id === this.selfCity[this.selfCity.length -1].id) return if (item.id === this.selfCity[this.selfCity.length - 1].id) return
this.selfCity.splice(index + 1); this.selfCity.splice(index + 1);
this.cityJson = item.children; this.cityJson = item.children;
}, },
@ -52,13 +105,14 @@ export default {
if (item.level === 'community') { if (item.level === 'community') {
let parm = this.$store.state.app.userInfo; let parm = this.$store.state.app.userInfo;
parm.agencyId = item.value; parm.agencyId = item.value;
parm.agencyName= item.label; parm.agencyName = item.label;
let res = await editUser(parm) let res = await editUser(parm)
if (res) { if (res) {
this.$router.replace('/') this.$router.replace('/')
} }
} else { } else {
this.cityJson = item.children this.district = item.label;
this.getAgency()
} }
} }
}, },

Loading…
Cancel
Save