You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

387 lines
9.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="content">
<view class='openinfo'>
<view>
<view>
<span></span>
<span>开放信息</span>
</view>
</view>
<view>
<view class='open_info'>
<block v-for="(item,key) of openInfoObj">
<view v-if="key!='提醒' && key!='地址' && key!='咨询电话' && key!='服务时间'">
<view>{{item}}</view>
<view>{{key}}</view>
</view>
</block>
</view>
<!-- <uParse></uParse> -->
<view class='open_text'>
<u-parse v-if='showContent' :content="openInfoHtml?openInfoHtml:' '"/>
</view>
<!-- <view class='open_text'>
<span></span>
{{openInfoObj['提醒']?openInfoObj['提醒']:''}}
</view>
<view class='open_text'>
<span></span>
{{openInfoObj['服务时间']?openInfoObj['服务时间']:''}}
</view>
<view class='open_text'>
<span></span>
地址:{{openInfoObj['地址']?openInfoObj['地址']:''}}
</view>
<view class='open_text'>
<span></span>
咨询电话:{{openInfoObj['咨询电话']?openInfoObj['咨询电话']:''}}
</view> -->
</view>
</view>
<view class="back40"></view>
<view class="contentlist">
<block v-for="(item,index) in noticeList" :key="index">
<view class="content_box" v-if="item.name!='开放信息'">
<view class="content_title" @click="showwhat(index)">
<view class="infoicon">
<u-icon size="16" color="#cf995a" name="info-circle-fill"></u-icon>
<text>{{item.name}}</text>
</view>
<u-icon v-if="!item.shownotice" size="16" name="arrow-down"></u-icon>
<u-icon v-if="item.shownotice" size="16" name="arrow-up"></u-icon>
</view>
<view class="content_info" v-if="item.shownotice">
<rich-text style="text-indent: 2em;font-size: 28rpx;" :nodes="item.content"></rich-text>
</view>
</view>
</block>
<view class="content_box">
<view class="content_title" @click="showwhat('showform')">
<view class="infoicon">
<u-icon size="16" color="#cf995a" name="info-circle-fill"></u-icon>
<text>意见建议</text>
</view>
<u-icon v-if="!show.showform" size="16" name="arrow-down"></u-icon>
<u-icon v-if="show.showform" size="16" name="arrow-up"></u-icon>
</view>
<view class="content_info" v-if="show.showform">
<u-form labelPosition="top" :model="form">
<u-form-item label="手机号" prop="mobile" labelWidth="60px" required>
<u-input v-model="form.mobile" placeholder="请输入手机号"></u-input>
</u-form-item>
<u-form-item label="内容" prop="content" labelWidth="60px" required>
<u-textarea v-model="form.content" placeholder="请输入内容"></u-textarea>
</u-form-item>
</u-form>
<u-button type="primary" @click="tosubmit">确认提交</u-button>
</view>
</view>
</view>
<tabbar :current-page="1"></tabbar>
</view>
</template>
<script>
import tabbar from "../../components/tabbar/tabbar.vue"
import uParse from '@/components/gaoyia-parse/parse.vue'
export default {
components: {
tabbar,
uParse
},
data() {
return {
notice: {},
ask: {},
form: {
mobile: "",
content: ""
},
openInfoObj: {},
openInfoHtml:'',
showContent:false,
show: {
shownotice: false,
showask: false,
showform: false
},
urls: {
1: '/api/mobile/other/visit-notice-index',
4: '/api/mobile/other/ask-index'
},
noticeList: []
}
},
onLoad() {
var that = this;
that.loadList(1, 1)
//that.loadList(1, 4)
},
onShareAppMessage() {
return this.util.shareInfo
},
onShareTimeline(){
return this.util.shareInfo
},
methods: {
showwhat(type) {
if (type == "showform")
this.show[type] = !this.show[type];
else
this.noticeList[type].shownotice = !this.noticeList[type].shownotice;
this.$forceUpdate();
},
loadList(page, type) {
var that = this;
this.util.request({
api: this.urls[type],
data: {
page: page
},
utilSuccess: function(res) {
if (type == 1)
that.notice = res.data[0];
if (type == 4)
that.ask = res.data[0];
for (var mod of res.data) {
mod.shownotice = false;
if (mod.name === '开放信息') {
let str = mod.content
let beforeIndex = str.indexOf("<p>") + 3
let afterIndex = str.indexOf("</p>")
let openStr = str.substring(beforeIndex, afterIndex)
let openArr = openStr.split('|')
for (let o of openArr) {
let oArr = o.split('')
if(oArr[1].indexOf('&mdash;')>-1){
oArr[1] = oArr[1].replace(/&mdash;/g,'—')
}
that.openInfoObj[oArr[0]] = oArr[1]
}
let libeforeIndex = str.indexOf("<ul>") + 4
let liafterIndex = str.indexOf("</ul>")
that.openInfoHtml = str.substring(libeforeIndex, liafterIndex)
that.showContent = true
}
}
that.noticeList = res.data
},
utilFail: function(res) {
uni.showToast({
icon: "none",
title: res
})
}
})
},
tosubmit() {
let that = this;
if (this.util.isNull(that.form.mobile)) {
this.util.toast("请填写手机号!");
return false;
} else {
if (!uni.$u.test.mobile(that.form.mobile)) {
this.util.toast("请填写正确的手机号!");
return false;
}
}
if (this.util.isNull(that.form.content)) {
this.util.toast("请填写内容!");
return false;
}
this.util.request({
api: '/api/mobile/other/tip-store',
data: this.form,
method: "POST",
utilSuccess: function(res) {
uni.showToast({
icon: "none",
title: "提交成功"
})
that.newsSubscription();
},
utilFail: function(res) {
that.util.toast(res);
}
})
},
newsSubscription() {
uni.getSetting({
withSubscriptions: true, //是否获取用户订阅消息的订阅状态默认false不返回
success(res) {
if (res.authSetting['scope.subscribeMessage']) {
uni.redirectTo({
url: '/pages/success/success?from=feed'
})
} else {
// 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
uni.requestSubscribeMessage({
tmplIds: ['12MYVOc27cEbWbBMgdfDqtNkvu4z81vRV2ZhiB755L0'],
success(res) {
uni.showToast({
title: '订阅成功'
})
uni.redirectTo({
url: '/pages/success/success?from=feed'
})
}
})
}
}
});
}
}
}
</script>
<style>
@import url("/components/gaoyia-parse/parse.css");
page {
background: #f7f6f4;
}
.content {
/* padding: 0 24rpx 60rpx 24rpx; */
min-height: 100vh;
background: #fff;
padding-bottom: 200rpx;
}
.back40 {
width: 100%;
height: 40rpx;
background: #f6f6f6;
}
.openinfo {
background-color: #fff;
border-top: 1px solid #ccc;
padding: 35rpx 20rpx;
}
.openinfo>view:first-child view span:first-child {
background-color: #DEA166;
width: 5rpx;
height: 40rpx;
margin-right: 22rpx;
display: inline-block;
vertical-align: text-top;
}
.open_info {
display: flex;
justify-content: space-between;
padding: 36rpx 0;
}
.open_info>view {
border: 1px solid #c48944;
border-radius: 10rpx;
text-align: center;
}
.open_info view view {
padding: 10rpx 50rpx;
}
.open_info view view:first-child {
background-color: #f5ebde;
color: #c48944;
font-size: 36rpx;
border-radius: 10rpx 10rpx 0 0;
}
.open_info view view:last-child {
border-radius: 0 0 10rpx 10rpx;
}
.open_text {
color: #252525;
font-size: 28rpx;
line-height: 2.3;
}
.open_text .li{
line-height: 2.3;
}
.open_text .li::before{
content:'';
width: 8rpx;
height: 8rpx;
border-radius: 8rpx;
background-color: #BFBFBF;
display: inline-block;
vertical-align: middle;
margin: 0 10rpx;
margin-top: -6rpx;
}
.open_text span {
width: 8rpx;
height: 8rpx;
border-radius: 8rpx;
background-color: #BFBFBF;
display: inline-block;
vertical-align: middle;
margin: 0 16rpx;
margin-top: -6rpx;
}
.content_box {
/* background: #FFFFFF;
border-radius: 16rpx;
padding: 30rpx 21rpx;
margin-bottom: 25rpx; */
}
.content_title {
padding: 26rpx 0;
border-bottom: #ddd 1rpx solid;
font-size: 32rpx;
color: #351C1B;
display: flex;
justify-content: space-between;
}
.contentlist {
background-color: #fff;
padding: 35rpx 20rpx;
padding-top: 9rpx;
}
.infoicon view {
display: inline-block !important;
margin-right: 20rpx
}
.content_info {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #828282;
line-height: 40rpx;
padding-top: 32rpx;
line-height: 2.3;
}
.u-form {
padding: 0 32rpx !important;
padding: 0 20rpx !important;
padding-right: 0 !important;
}
.u-form-item__body__left__content__required{
margin-left: 18rpx!important;
}
.u-form-item__body__left__content__label{
margin-left: 30rpx!important;
width:200rpx;
}
</style>