Browse Source

fix:修改小微权力一点通

master
xiaohei 1 year ago
parent
commit
807065a546
7 changed files with 462 additions and 397 deletions
  1. +3
    -3
      src/App.vue
  2. +347
    -283
      src/packages/people/pages/guide/guide.vue
  3. +2
    -0
      src/packages/people/pages/party-newspaper/create.vue
  4. +5
    -6
      src/packages/public/pages/web-view/web-view.vue
  5. BIN
      src/static/images/WechatIMG8826.jpg
  6. BIN
      src/static/images/WechatIMG8889.jpg
  7. +105
    -105
      src/utils/request.js

+ 3
- 3
src/App.vue View File

@@ -9,7 +9,7 @@
// 日志调试模式
if (config.debug) {
// eslint-disable-next-line no-console
console.log('小程序配置:', config);
// console.log('小程序配置:', config);
// eslint-disable-next-line no-console
// console.log('微信全局配置:', __wxConfig);
}
@@ -17,7 +17,7 @@
// 微信API支持Promise风格
promisifyAll();
export default {
globalData:{
globalData: {
config,
env: config.env,
api,
@@ -29,7 +29,7 @@
},
data() {
return {
};
},



+ 347
- 283
src/packages/people/pages/guide/guide.vue View File

@@ -17,11 +17,11 @@
<image class="guide-img" :src="item.photo"></image>

<text class="guide-name">{{ item.name }}</text>
<van-rate readonly icon="//images/void-icon2.png" :size="14" void-icon="@/images/rate-icon.png" v-model="item.star" />
<van-rate readonly icon="//images/void-icon2.png" :size="14" void-icon="@/images/rate-icon.png"
v-model="item.star" />
</view>
</view>
<view class="rural-list flex"
v-if="option.path === 'sonGuide4' || option.path === 'sonGuide5' || option.path === 'sonGuide3'">
<view class="rural-list flex" v-if="option.path === 'sonGuide4' || option.path === 'sonGuide5'">
<view class="guide-item flex flex-col flex-v-center" :data-item="item" @tap="toArea"
v-for="(item, index) in agencyPageList" :key="index">
<image class="guide-img" :src="item.image"></image>
@@ -29,6 +29,22 @@
<text class="guide-name">{{ item.agencyName }}</text>
</view>
</view>

<block v-if="option.path === 'sonGuide3'">
<view class="second-section-gird">
<view :class="songuid == 1 ? 'action' :''" @click="headerSonguid(1)">村务监督月例会</view>
<view :class="songuid == 2 ? 'action' :''" @click="headerSonguid(2)">在线投诉</view>
</view>
<view class="rural-list flex">
<view class="guide-item flex flex-col flex-v-center" :data-item="item" @tap="toArea"
v-for="(item, index) in agencyPageList" :key="index">
<image class="guide-img" :src="item.image"></image>

<text class="guide-name">{{ item.agencyName }}</text>
</view>
</view>
</block>

<view class="second-section" v-if="option.path === 'sonGuide1'">
<view class="section-item flex flex-between" :data-item="item" @tap="toArea"
v-for="(item, index) in partyBranchList" :key="index">
@@ -36,7 +52,8 @@

<view class="section-item-left flex1 flex flex-col">
<view class="consult-content-title text-line-2">{{ item.name }}</view>
<van-rate readonly icon="/src/images/void-icon2.png" :size="14" void-icon="/src/images/rate-icon.png" v-model="item.star" />
<van-rate readonly icon="/src/images/void-icon2.png" :size="14" void-icon="/src/images/rate-icon.png"
v-model="item.star" />
</view>
</view>
</view>
@@ -53,328 +70,375 @@
</template>
<!-- <script module="util" lang="wxs" src="@/wxs/util.wxs"></script> -->
<script>
import * as peopleApi from '@/api/peopleApi';
import * as publicApi from '@/api/publicApi';
export default {
components: {},
data() {
return {
indicatorColor: 'rgba(255,255,255,0.4)',
indicatorActiveColor: '#FFFFFF',
option: {
name: '',
path: ''
import * as peopleApi from '@/api/peopleApi';
import * as publicApi from '@/api/publicApi';
export default {
components: {},
data() {
return {
indicatorColor: 'rgba(255,255,255,0.4)',
indicatorActiveColor: '#FFFFFF',
option: {
name: '',
path: ''
},
imageList: [],
doctorPageList: [],
agencyPageList: [],
partyBranchList: [],
pageNo: 1,
pageSize: 10,
total: 0,
songuid: 1
};
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(option) {
this.option = option
console.log(option)
this.recursionApi();
this.callFcuntion();
},
onReachBottom() {
const data = {
sonGuide2: () => {
if (this.doctorPageList.length === this.total) {
return;
}
this.excellentPartMemberPageApi(false);
},
sonGuide4: () => {
console.log(2);
if (this.agencyPageList.length === this.total) {
return;
}
this.agencyPageApi(false);
},
sonGuide3: () => {
console.log(1);
if (this.agencyPageList.length === this.total) {
return;
}
this.agencyPageApi(false);
},
sonGuide1: () => {
if (this.partyBranchList.length === this.total) {
return;
}
this.partyBranchApi(false);
}
};
if (data[this.option.path]) {
data[this.option.path]();
}
},
methods: {
// 获取轮播图
async recursionApi() {
const res = await publicApi.recursionApi({
bannerType: 1,
parentId: this.option.parentId
});
if (res.data) {
this.imageList = res.data[0].children
}
},
imageList: [],
doctorPageList: [],
agencyPageList: [],
partyBranchList: [],
pageNo: 1,
pageSize: 10,
total: 0
};
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(option) {
this.option = option
console.log(option)
this.recursionApi();
this.callFcuntion();
},
onReachBottom() {
const data = {
sonGuide2: () => {
if (this.doctorPageList.length === this.total) {
return;

async excellentPartMemberPageApi(reset = true) {
const params = this.generalQueryData(reset);
const res = await peopleApi.excellentPartMemberPageApi(params);
let _goodsList = []
if (res.data) {
const {
list = [], total = 0
} = res.data;
if (reset) {
_goodsList = list;
} else {
_goodsList = this.doctorPageList.concat(list);
}
this.pageNo = params.pageNo || 1;
this.total = total;
this.doctorPageList = _goodsList
}
this.excellentPartMemberPageApi(false);
},
sonGuide4: () => {
console.log(2);
if (this.agencyPageList.length === this.total) {
return;

async agencyPageApi(reset = true) {
const params = this.generalQueryData(reset);
const res = await peopleApi.agencyPageApi(params);
let _goodsList = []
if (res.data) {
const {
list = [], total = 0
} = res.data;
if (reset) {
_goodsList = list;
} else {
_goodsList = this.agencyPageList.concat(list);
}
this.pageNo = params.pageNo || 1;
this.total = total;
this.agencyPageList = _goodsList
}
this.agencyPageApi(false);
},
sonGuide3: () => {
console.log(1);
if (this.agencyPageList.length === this.total) {
return;

async partyBranchApi(reset = true) {
const params = this.generalQueryData(reset);
const res = await peopleApi.partyBranchApi(params);
if (res.data) {
const {
list = [], total = 0
} = res.data;
const _goodsList = reset ? list : this.partyBranchList.concat(list);
this.pageNo = params.pageNo || 1;
this.total = total;
this.partyBranchList = _goodsList
}
this.agencyPageApi(false);
},
sonGuide1: () => {
if (this.partyBranchList.length === this.total) {
return;

// 调用函数
callFcuntion() {
const ApiConfig = {
sonGuide1: {
api: this.partyBranchApi
},
'五星党员': {
api: this.excellentPartMemberPageApi
},
sonGuide3: {
api: this.agencyPageApi
},
sonGuide4: {
api: this.agencyPageApi
},
sonGuide5: {
api: this.agencyPageApi
}
};
const obj = ApiConfig[this.option.path || this.option.name];
if (obj.api) {
obj.api();
}
this.partyBranchApi(false);
}
};
if (data[this.option.path]) {
data[this.option.path]();
}
},
methods: {
// 获取轮播图
async recursionApi() {
const res = await publicApi.recursionApi({
bannerType: 1,
parentId: this.option.parentId
});
if (res.data) {
this.imageList = res.data[0].children
}
},
},

async excellentPartMemberPageApi(reset = true) {
const params = this.generalQueryData(reset);
const res = await peopleApi.excellentPartMemberPageApi(params);
let _goodsList = []
if (res.data) {
// 分页参数处理事件
generalQueryData(reset = false) {
const {
list = [], total = 0
} = res.data;
pageNo,
pageSize
} = this;
const params = {
pageNo: 1,
pageSize: 10
};
if (this.option.path === 'sonGuide4') {
params.agencyType = 1;
}
if (this.option.path === 'sonGuide5') {
params.agencyType = 2;
}
if (this.option.path === 'sonGuide3') {
params.agencyType = 3;
}
if (reset) {
_goodsList = list;
} else {
_goodsList = this.doctorPageList.concat(list);
return params;
}
this.pageNo = params.pageNo || 1;
this.total = total;
this.doctorPageList = _goodsList
}
},
return {
...params,
pageNo: pageNo + 1,
pageSize
};
},

async agencyPageApi(reset = true) {
const params = this.generalQueryData(reset);
const res = await peopleApi.agencyPageApi(params);
let _goodsList = []
if (res.data) {
jumpDetail(event) {
const {
list = [], total = 0
} = res.data;
if (reset) {
_goodsList = list;
} else {
_goodsList = this.agencyPageList.concat(list);
id
} = event.currentTarget.dataset;
uni.navigateTo({
url: `/packages/people/pages/guide-detail/guide-detail?id=${id}`
});
},
headerSonguid(index) {
if (index === 2) {
uni.showToast({
title: '功能还在开发中...',
icon: 'none'
})
return
}
this.pageNo = params.pageNo || 1;
this.total = total;
this.agencyPageList = _goodsList
}
},
this.songuid = index
},

async partyBranchApi(reset = true) {
const params = this.generalQueryData(reset);
const res = await peopleApi.partyBranchApi(params);
if (res.data) {
toArea(event) {
const {
list = [], total = 0
} = res.data;
const _goodsList = reset ? list : this.partyBranchList.concat(list);
this.pageNo = params.pageNo || 1;
this.total = total;
this.partyBranchList = _goodsList
}
},

// 调用函数
callFcuntion() {
const ApiConfig = {
sonGuide1: {
api: this.partyBranchApi
},
'五星党员': {
api: this.excellentPartMemberPageApi
},
sonGuide3: {
api: this.agencyPageApi
},
sonGuide4: {
api: this.agencyPageApi
},
sonGuide5: {
api: this.agencyPageApi
item
} = event.currentTarget.dataset;
if (this.option.path === 'sonGuide1') {
item.agencyName = '支部详情';
item.agencyType = '12101';
}
};
const obj = ApiConfig[this.option.path || this.option.name];
if (obj.api) {
obj.api();
}
},

// 分页参数处理事件
generalQueryData(reset = false) {
const {
pageNo,
pageSize
} = this;
const params = {
pageNo: 1,
pageSize: 10
};
if (this.option.path === 'sonGuide4') {
params.agencyType = 1;
uni.navigateTo({
url: `/packages/people/pages/area/area?orgId=${item.orgId}&name=${item.agencyName}&type=${item.agencyType}&id=${item.id}`
});
}
if (this.option.path === 'sonGuide5') {
params.agencyType = 2;
}
if (this.option.path === 'sonGuide3') {
params.agencyType = 3;
}
if (reset) {
return params;
}
return {
...params,
pageNo: pageNo + 1,
pageSize
};
},

jumpDetail(event) {
const {
id
} = event.currentTarget.dataset;
uni.navigateTo({
url: `/packages/people/pages/guide-detail/guide-detail?id=${id}`
});
},

toArea(event) {
const {
item
} = event.currentTarget.dataset;
if (this.option.path === 'sonGuide1') {
item.agencyName = '支部详情';
item.agencyType = '12101';
}
uni.navigateTo({
url: `/packages/people/pages/area/area?orgId=${item.orgId}&name=${item.agencyName}&type=${item.agencyType}&id=${item.id}`
});
}
}
};
};
</script>
<style lang="less">
page {
--rate-icon-size: 26rpx; // 评分大小
--rate-icon-full-color: var(--item-dominant-color); // 评分选中颜色
--rate-icon-gutter: 3rpx; // 评分图标之前的距离
}

.people-custom-swiper {
width: 100%;
height: 330rpx;
position: relative;

.custom-swiper-img {
width: 100%;
height: 100%;
display: block;
page {
--rate-icon-size: 26rpx; // 评分大小
--rate-icon-full-color: var(--item-dominant-color); // 评分选中颜色
--rate-icon-gutter: 3rpx; // 评分图标之前的距离
}
}

.guide-list {
margin-top: 28rpx;
padding: 0 32rpx;
flex-wrap: wrap;

.guide-item {
flex-shrink: 0;
width: 218rpx;
height: 100%;
margin-right: 16rpx;
margin-top: 27rpx;

&:nth-child(3n) {
margin-right: 0;
}

.guide-img {
width: 218rpx;
height: 218rpx;
margin-bottom: 16rpx;
}
.people-custom-swiper {
width: 100%;
height: 330rpx;
position: relative;

.guide-name {
margin-bottom: 17rpx;
font-size: 32rpx;
font-weight: 400;
color: #333333;
line-height: 32rpx;
.custom-swiper-img {
width: 100%;
height: 100%;
display: block;
}
}
}

.rural-list {
margin-top: 45rpx;
padding: 0 40rpx;
flex-wrap: wrap;

.guide-item {
flex-shrink: 0;
width: 326rpx;
height: 100%;
margin-right: 16rpx;
margin-bottom: 40rpx;

&:nth-child(2n) {
margin-right: 0;
}

.guide-img {
width: 326rpx;
height: 168rpx;
margin-bottom: 24rpx;
}
.guide-list {
margin-top: 28rpx;
padding: 0 32rpx;
flex-wrap: wrap;

.guide-item {
flex-shrink: 0;
width: 218rpx;
height: 100%;
margin-right: 16rpx;
margin-top: 27rpx;

.guide-name {
font-size: 32rpx;
font-weight: 400;
color: #333333;
line-height: 32rpx;
&:nth-child(3n) {
margin-right: 0;
}

.guide-img {
width: 218rpx;
height: 218rpx;
margin-bottom: 16rpx;
border-radius: 8rpx;
}

.guide-name {
margin-bottom: 17rpx;
font-size: 32rpx;
font-weight: 400;
color: #333333;
line-height: 32rpx;
}
}
}
}

.second-section {
margin-top: 55rpx;
padding: 0 40rpx 0;
.rural-list {
margin-top: 45rpx;
padding: 0 40rpx;
flex-wrap: wrap;

.section-item {
padding: 14rpx 0;
border-bottom: 1px solid #e1e1e1;
.guide-item {
flex-shrink: 0;
width: 326rpx;
height: 100%;
margin-right: 16rpx;
margin-bottom: 40rpx;

&:first-child {
padding-top: 0;
}
&:nth-child(2n) {
margin-right: 0;
}

.section-item-left {
margin-left: 32rpx;
.guide-img {
width: 326rpx;
height: 168rpx;
margin-bottom: 24rpx;
border-radius: 8rpx;
}

.consult-content-title {
.guide-name {
font-size: 32rpx;
font-weight: 400;
color: #333333;
line-height: 40rpx;
margin-bottom: 24rpx;
line-height: 32rpx;
}
}
}

.second-section {
margin-top: 55rpx;
padding: 0 40rpx 0;

.section-item {
padding: 14rpx 0;
border-bottom: 1px solid #e1e1e1;

&:first-child {
padding-top: 0;
}

// .consult-content-block {
// font-size: 24rpx;
// font-weight: 400;
// color: #999999;
// }
.section-item-left {
margin-left: 32rpx;

.consult-content-title {
font-size: 32rpx;
font-weight: 400;
color: #333333;
line-height: 40rpx;
margin-bottom: 24rpx;
}

// .consult-content-block {
// font-size: 24rpx;
// font-weight: 400;
// color: #999999;
// }
}

.section-item-right {
width: 300rpx;
height: 140rpx;
border-radius: 8rpx;
}
}
}

.second-section-gird {
display: flex;
justify-content: space-between;
margin-top: 64rpx;

view {
flex: 1;
text-align: center;
font-size: 36rpx;
font-weight: 500;
color: #000000;
position: 3;
}

.action {
color: #FF4C4C;
position: relative;
z-index: 2;

.section-item-right {
width: 300rpx;
height: 140rpx;
border-radius: 8rpx;
&:before {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80%;
height: 20rpx;
opacity: 0.2;
background: linear-gradient(to bottom, #FF4C4C, #fff);
z-index: -1;
}
}
}
}
</style>

+ 2
- 0
src/packages/people/pages/party-newspaper/create.vue View File

@@ -381,7 +381,9 @@
'duties',
'mobile',
];
console.log(this.form)
const isRequired = required.every((e) => formKey.includes(e));
console.log(isRequired)
if (!isRequired) {
return wx.showToast({
title: '星号为必填!',


+ 5
- 6
src/packages/public/pages/web-view/web-view.vue View File

@@ -14,8 +14,7 @@
<view v-if="optins.name === '智慧社区'">
<image class="img" mode="aspectFit" src="/static/images/WechatIMG8889.jpg" />
<view style="padding:20rpx 100rpx;font-size:30rpx;line-height: 54rpx;">
长按图片前往“介休智慧社区”公众号或保存图片并扫码,关注“介休智慧社区”公众号
即可发布随手拍。
图片保存到手机本地,打开微信扫码此图片,前往“介休智慧示范社区服务端了解相关小区的智慧便民服务
</view>
</view>
</view>
@@ -64,18 +63,18 @@
height: 100%;
}

.web-view-image{
.web-view-image {
width: 100%;
// height: 100%;
position: absolute;
text-align: center;
transform: translate(-50% -50%);
margin-top: 100rpx;
transform: translate(-50% -50%);
margin-top: 100rpx;
}

.img {
display: inline-block;
margin:0 auto;
margin: 0 auto;
text-align: center;
// width: 750rpx;
// height: 1334rpx;


BIN
src/static/images/WechatIMG8826.jpg View File

Before After
Width: 546  |  Height: 564  |  Size: 301KB

BIN
src/static/images/WechatIMG8889.jpg View File

Before After
Width: 430  |  Height: 430  |  Size: 100KB

+ 105
- 105
src/utils/request.js View File

@@ -4,119 +4,119 @@
*/
import config from '../config/index';
import server from './server';
const request = async function (params, isLoading = true) {
if (isLoading) {
uni.showLoading({
title: '加载中',
mask: true
});
}
const token = uni.getStorageSync('token');
const defaultOptions = {
method: 'GET',
header: {
'Content-Type': 'application/json'
},
data: {}
};
if (token) {
Object.assign(defaultOptions.header, {
'X-Access-Token': token,
Authorization: `Bearer ${token}`
});
}
const request = async function(params, isLoading = true) {
if (isLoading) {
uni.showLoading({
title: '加载中',
mask: true
});
}
const token = uni.getStorageSync('token');
const defaultOptions = {
method: 'GET',
header: {
'Content-Type': 'application/json'
},
data: {}
};
if (token) {
Object.assign(defaultOptions.header, {
'X-Access-Token': token,
Authorization: `Bearer ${token}`
});
}

// 存储在Storage里的用户信息
const data = {};
// 存储在Storage里的用户信息
const data = {};

// 合并参数到默认配置
Object.assign(defaultOptions, params);
if (Object.hasOwnProperty.call(params, 'data')) {
// 如果请求用不到上述信息,请把data清空
Object.assign(data, params.data);
}
// 合并参数到默认配置
Object.assign(defaultOptions, params);
if (Object.hasOwnProperty.call(params, 'data')) {
// 如果请求用不到上述信息,请把data清空
Object.assign(data, params.data);
}

// 请求URL
let url = '';
if (Object.hasOwnProperty.call(params, 'url')) {
// 根据配置查询
const flag = params.url.indexOf('http') >= 0;
url = flag ? params.url : `${config.env.baseUrl}${params.url}`;
} else {
// eslint-disable-next-line no-console
console.log('请求url未定义');
}
const options = Object.assign(defaultOptions, {
url,
data
});
// 请求URL
let url = '';
if (Object.hasOwnProperty.call(params, 'url')) {
// 根据配置查询
const flag = params.url.indexOf('http') >= 0;
url = flag ? params.url : `${config.env.baseUrl}${params.url}`;
} else {
// eslint-disable-next-line no-console
console.log('请求url未定义');
}
const options = Object.assign(defaultOptions, {
url,
data
});

// 调用wx的请求api
return await uni.request({
...options
// 调用wx的请求api
return await uni.request({
...options
})
.then(async (res) => {
// 先判断登陆是否失效,401为于后端协商未登录时的状态
// if (res.data.code === 401) {
// server.login();
// }
// if (res.data.code === 1002003003) {
// // 1002003003 用户不存在,跳转注册
// uni.showToast({
// icon: 'none',
// title: '用户不存在,正在跳转至授权登陆...',
// mask: true,
// duration: 2000
// });
// setTimeout(() => {
// uni.navigateTo({
// url: '/pages/authorize/authorize'
// });
// }, 2000);
// return;
// }
// if (res.data.code !== 0) {
// uni.showToast({
// icon: 'none',
// title: res.data.msg
// });
// return;
// }
return res.data;
})
.catch(() => {
uni.showToast({
title: '网络错误',
icon: 'error',
duration: 2000,
mask: true
});
})
.finally(() => {
uni.hideLoading();
});
};
export const post = function () {
const arg = arguments;
if (typeof arg[0] === 'object') {
return request({
...arg[0],
method: 'post'
.then(async (res) => {
// 先判断登陆是否失效,401为于后端协商未登录时的状态
if (res.data.code === 401) {
server.login();
}
if (res.data.code === 1002003003) {
// 1002003003 用户不存在,跳转注册
uni.showToast({
icon: 'none',
title: '登录信息已过期...',
mask: true,
duration: 2000
});
}
if (typeof arg[0] === 'string' && typeof arg[1] === 'object') {
return request({
url: arg[0],
data: arg[1],
method: 'post'
setTimeout(() => {
uni.navigateTo({
url: '/pages/phone/index'
});
}, 2000);
return;
}
if (res.data.code !== 0) {
uni.showToast({
icon: 'none',
title: res.data.msg
});
}
return;
}
return res.data;
})
.catch(() => {
uni.showToast({
title: '网络错误',
icon: 'error',
duration: 2000,
mask: true
});
})
.finally(() => {
uni.hideLoading();
});
};
export const post = function() {
const arg = arguments;
if (typeof arg[0] === 'object') {
return request({
...arg[0],
method: 'post'
});
}
if (typeof arg[0] === 'string' && typeof arg[1] === 'object') {
return request({
url: arg[0],
method: 'post'
url: arg[0],
data: arg[1],
method: 'post'
});
}
return request({
url: arg[0],
method: 'post'
});
};
export const get = function (data) {
return request(data);
export const get = function(data) {
return request(data);
};
export default request;
export default request;

Loading…
Cancel
Save