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>
<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 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>-->
</body>
</html>

4
src/router/index.js

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

6
src/utils/jweixin.js

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

34
src/views/communityPublicity/detail.vue

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

40
src/views/discussion/discusionDetail.vue

@ -23,7 +23,7 @@
</div>
</div>
<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">
支持
</van-button>
@ -41,17 +41,10 @@ import { andelClicDetail, icEventOldDiscuss, advertisingTag, communityPublicity,
export default {
data() {
return {
substance: '最近重庆南路60号院改造,很多居民反应希望 政府给楼外加保护层,冬天温度太低。',
datetime: '2002-01-05 12:00:00',
signUp: [
{},
],
detimgs: [
{ url: '@/assets/images/icons/resi.png' }
],
dataValue: 100,
dataValue: null,
support: false,
oppose: false,
supportNum: null,
@ -60,16 +53,14 @@ export default {
eventId: "",
ProblemDescription: {},
vote: {}
};
},
created() {
this.eventId = this.$route.query.eventId
console.log(this.id, "this.id");
this.id = this.$route.query.eventId
this.agencyId = this.$store.state.app.agencyId;
this.userId = this.$store.state.app.appId;
this.userId = this.$store.state.app.userInfo.id;
this.icEventOldDiscussDetil1()
},
computed: {
@ -94,10 +85,8 @@ export default {
userId: this.userId,
opinionFlag: 0
}
console.log(parm);
let res = await handelClicsupport(parm)
this.icEventOldDiscuss()
await this.icEventOldDiscussDetil1()
},
async handelClicopposeNum(data) {
let parm = {
@ -106,10 +95,8 @@ export default {
userId: this.userId,
opinionFlag: 1
}
console.log(parm);
let res = await handelClicsupport(parm)
this.icEventOldDiscuss()
await this.icEventOldDiscussDetil1()
},
async icEventOldDiscussDetil1() {
console.log(this.id, "this.id");
@ -117,7 +104,6 @@ export default {
icEventId: this.eventId
}
await andelClicDetail(parm).then(res => {
console.log(res, "res");
this.ProblemDescription = res;
this.dataValue = res.opposeNum + res.supportNum
})
@ -125,22 +111,6 @@ export default {
handsupport() {
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 class="selfCity flex flex-center2 p-12 flex-end">
<div class="flex flex-center2 flex-1">
<img src="@/assets/images/icons/homeBlue.png" alt="" @click="getAgency"/>
<span style="color: #666666;" v-if="!selfCity">请选择您所在城市</span>
<span v-else class="flex">
<img src="@/assets/images/icons/homeBlue.png" alt="" @click="getAgency" />
<!-- <span style="color: #666666;" v-if="!selfCity && district">请选择您所在城市</span> -->
<span class="flex">
<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>
</div>
</span>
</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 class="container">
<van-list finished-text="没有更多了" class="selectAgency">
@ -24,26 +24,79 @@
<script>
import { editUser, getAllOrgTreeList } from "@/api/user";
import { setConfig } from '@/utils/jweixin'
export default {
data() {
return {
cityJson: [],
selfCity: [],
address: null,
district: null,
show:true
};
},
created() {
this.getAgency()
},
mounted() {
setConfig(['checkJsApi', 'openLocation', 'getLocation', 'updateAppMessageShareData', 'updateTimelineShareData'])
this.signWX()
},
methods: {
async getAgency() {
this.selfCity = [];
let res = await getAllOrgTreeList({organizationName:''})
restAddress() {
this.district = null;
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 (type) {
this.selfCity.push({ label: this.district, children: res })
}
this.cityJson = res;
}
},
handelClickAgencyName(item,index){
if(item.id === this.selfCity[this.selfCity.length -1].id) return
handelClickAgencyNav(item, index) {
if (item.id === this.selfCity[this.selfCity.length - 1].id) return
this.selfCity.splice(index + 1);
this.cityJson = item.children;
},
@ -52,13 +105,14 @@ export default {
if (item.level === 'community') {
let parm = this.$store.state.app.userInfo;
parm.agencyId = item.value;
parm.agencyName= item.label;
parm.agencyName = item.label;
let res = await editUser(parm)
if (res) {
this.$router.replace('/')
}
} else {
this.cityJson = item.children
this.district = item.label;
this.getAgency()
}
}
},

Loading…
Cancel
Save