...
|
...
|
@@ -9,10 +9,17 @@ |
|
|
/>
|
|
|
<div class="homesearch flexone">
|
|
|
<!-- <img src="../../../assets/sousuo.png" alt="" class="souimg" /> -->
|
|
|
<div class="souenter">请输入关键词搜索</div>
|
|
|
<div class="souenter">
|
|
|
<input
|
|
|
type="text"
|
|
|
placeholder="请输入关键词搜索"
|
|
|
v-model="keyword"
|
|
|
@blur="finishword"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="searchpro flexone" @click="selectpro">
|
|
|
<div class="proname">江苏省</div>
|
|
|
<div class="proname">{{ proname }}</div>
|
|
|
|
|
|
<img src="../../../assets/xiasanjiao.png" alt="" class="xiasanjiao" />
|
|
|
</div>
|
...
|
...
|
@@ -24,35 +31,20 @@ |
|
|
indicator-color="white"
|
|
|
loop="true"
|
|
|
>
|
|
|
<van-swipe-item>
|
|
|
<div class="bannerimg">
|
|
|
<img src="../../../assets/banner.png" alt="" />
|
|
|
</div>
|
|
|
</van-swipe-item>
|
|
|
<van-swipe-item>
|
|
|
<div class="bannerimg">
|
|
|
<img src="../../../assets/banner.png" alt="" />
|
|
|
</div>
|
|
|
</van-swipe-item>
|
|
|
<van-swipe-item>
|
|
|
<div class="bannerimg">
|
|
|
<img src="../../../assets/banner.png" alt="" />
|
|
|
</div>
|
|
|
</van-swipe-item>
|
|
|
<van-swipe-item>
|
|
|
<van-swipe-item v-for="(item, index) in bannertop" :key="index">
|
|
|
<div class="bannerimg">
|
|
|
<img src="../../../assets/banner.png" alt="" />
|
|
|
<img :src="item.image" alt="" />
|
|
|
</div>
|
|
|
</van-swipe-item>
|
|
|
</van-swipe>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="homepagebox ">
|
|
|
<div class="homepagebox">
|
|
|
<div class="homekind flexone">
|
|
|
<div
|
|
|
class="homepageboxitem flexfour"
|
|
|
@click="duanshipin(1)"
|
|
|
@click="duanshipin(1, item)"
|
|
|
v-for="(item, index) in tiezikind"
|
|
|
:key="index"
|
|
|
>
|
...
|
...
|
@@ -63,28 +55,29 @@ |
|
|
<div class="homefenlei flextwo">
|
|
|
<div
|
|
|
class="fenleiword"
|
|
|
:class="fenlei == 1 ? 'fenleiactive' : ''"
|
|
|
@click="getfen(1)"
|
|
|
:class="fenlei == 0 ? 'fenleiactive' : ''"
|
|
|
@click="getfen(0)"
|
|
|
>
|
|
|
最新
|
|
|
默认
|
|
|
</div>
|
|
|
<div
|
|
|
class="fenleiword"
|
|
|
:class="fenlei == 2 ? 'fenleiactive' : ''"
|
|
|
@click="getfen(2)"
|
|
|
:class="fenlei == 1 ? 'fenleiactive' : ''"
|
|
|
@click="getfen(1)"
|
|
|
>
|
|
|
最热
|
|
|
热门
|
|
|
</div>
|
|
|
<div
|
|
|
class="fenleiword"
|
|
|
:class="fenlei == 3 ? 'fenleiactive' : ''"
|
|
|
@click="getfen(3)"
|
|
|
:class="fenlei == 2 ? 'fenleiactive' : ''"
|
|
|
@click="getfen(2)"
|
|
|
>
|
|
|
我的
|
|
|
最高点赞
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 帖子列表 -->
|
|
|
<div class="tiezhlist">
|
|
|
<div class="nodata" v-if="tiezilist.length == 0">暂无数据</div>
|
|
|
<div class="tiezhlist" v-else>
|
|
|
<van-list
|
|
|
v-model="loading"
|
|
|
:finished="finished"
|
...
|
...
|
@@ -95,6 +88,7 @@ |
|
|
class="tieziitem"
|
|
|
v-for="(item, index) in tiezilist"
|
|
|
:key="index"
|
|
|
@click="luntandetail(item)"
|
|
|
>
|
|
|
<div class="tiezitop flexone">
|
|
|
<div class="tieziimg">
|
...
|
...
|
@@ -108,11 +102,13 @@ |
|
|
</div>
|
|
|
|
|
|
<div>
|
|
|
<div class="vipimg">
|
|
|
<div class="vipimg" v-if="item.forum_type == 1">
|
|
|
<img src="../../../assets/vip_icon@2x.png" alt="" />
|
|
|
<div class="vipname">VIP1</div>
|
|
|
<div class="vipname">{{ item.user.level.name1 }}</div>
|
|
|
</div>
|
|
|
<div class="tiezizhuan">
|
|
|
面坊转让
|
|
|
</div>
|
|
|
<div class="tiezizhuan">面坊转让</div>
|
|
|
</div>
|
|
|
<img
|
|
|
src="../../../assets/banggong_icon@2x.png"
|
...
|
...
|
@@ -136,7 +132,7 @@ |
|
|
<div class="tiezicontent">
|
|
|
<div class="teizicontenttop flextwo">
|
|
|
<div class="tiezicontentname">{{ item.title }}</div>
|
|
|
<img
|
|
|
<!-- <img
|
|
|
src="../../../assets/xingxing_icon@2x.png"
|
|
|
alt=""
|
|
|
class="starimg"
|
...
|
...
|
@@ -145,7 +141,7 @@ |
|
|
src="../../../assets/weishoucang_icon@2x.png"
|
|
|
alt=""
|
|
|
class="starimg"
|
|
|
/>
|
|
|
/> -->
|
|
|
</div>
|
|
|
<div class="tieziwordbox" v-html="item.content"></div>
|
|
|
|
...
|
...
|
@@ -168,7 +164,7 @@ |
|
|
class="tieziimgimg"
|
|
|
v-for="(item, indexk) in item.images"
|
|
|
:key="indexk"
|
|
|
@click.stop="previewimg(index, indexk)"
|
|
|
@click.stop="previewimg(index, indexk, item)"
|
|
|
>
|
|
|
<img :src="item" alt="" />
|
|
|
</div>
|
...
|
...
|
@@ -182,11 +178,20 @@ |
|
|
/>
|
|
|
{{ item.comment }}
|
|
|
</div>
|
|
|
<div class="teizipingitem flexone">
|
|
|
<div
|
|
|
class="teizipingitem flexone"
|
|
|
@click.stop="praisedian(item, index)"
|
|
|
>
|
|
|
<img
|
|
|
src="../../../assets/zan_icon@2x.png"
|
|
|
alt=""
|
|
|
class="lunimg zanimg"
|
|
|
v-if="item.is_praise == 1"
|
|
|
/>
|
|
|
<img
|
|
|
src="../../../assets/nodianzan.png"
|
|
|
alt=""
|
|
|
class="lunimg zanimg"
|
|
|
v-if="item.is_praise == 2"
|
|
|
/>
|
|
|
{{ item.praise }}
|
...
|
...
|
@@ -254,7 +259,6 @@ |
|
|
:columns="citylist"
|
|
|
@confirm="onConfirm"
|
|
|
@cancel="onCancel"
|
|
|
@change="onChange"
|
|
|
v-if="showcity"
|
|
|
/>
|
|
|
|
...
|
...
|
@@ -265,12 +269,11 @@ |
|
|
<script>
|
|
|
import Vue from "vue";
|
|
|
import wx from "weixin-js-sdk";
|
|
|
console.log(area);
|
|
|
console.log(wx);
|
|
|
import tabBar from "@/components/tabBar.vue";
|
|
|
import { Swipe, SwipeItem, List, Toast } from "vant";
|
|
|
import area from "../../../utils/area.js";
|
|
|
console.log(area, "地址地址");
|
|
|
import { changename } from "../../../utils/base.js"; //城市去掉市
|
|
|
|
|
|
Vue.use(List);
|
|
|
Vue.use(Swipe);
|
|
|
Vue.use(SwipeItem);
|
...
|
...
|
@@ -280,7 +283,7 @@ export default { |
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
fenlei: 1,
|
|
|
fenlei: 0,
|
|
|
showpublish: false,
|
|
|
tiezikind: [],
|
|
|
tiezilist: [],
|
...
|
...
|
@@ -288,19 +291,22 @@ export default { |
|
|
finished: false,
|
|
|
showpull: true,
|
|
|
page: 1,
|
|
|
|
|
|
citylist: area.province_list,
|
|
|
showcity: false
|
|
|
showcity: false,
|
|
|
proname: "",
|
|
|
province_id: "",
|
|
|
keyword: "",
|
|
|
bannertop: [] // 顶部轮播图
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
document.title = "中国面条";
|
|
|
// 获取帖子分类
|
|
|
this.gettiezikind();
|
|
|
// 获取帖子列表
|
|
|
this.getteizilist();
|
|
|
// 获取顶部轮播图
|
|
|
this.getbannertop();
|
|
|
// 获取jssdk
|
|
|
this.getappid();
|
|
|
// 获取帖子分类
|
|
|
this.gettiezikind();
|
|
|
},
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
var u = navigator.userAgent;
|
...
|
...
|
@@ -314,10 +320,36 @@ export default { |
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取轮播图
|
|
|
getbannertop() {
|
|
|
let that = this;
|
|
|
var url = "/api/sundry/get_slide2";
|
|
|
var params = {};
|
|
|
console.log("7766554", params);
|
|
|
that.$axios
|
|
|
.post(url, params)
|
|
|
.then(res => {
|
|
|
console.log(res, "000000");
|
|
|
that.bannertop = res.data;
|
|
|
})
|
|
|
.catch(err => {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
// 确定选择城市
|
|
|
onConfirm(value, index) {
|
|
|
console.log(value, index);
|
|
|
let that = this;
|
|
|
this.showcity = false;
|
|
|
if (changename(value) != "") {
|
|
|
that.proname = changename(value);
|
|
|
} else {
|
|
|
that.proname = value;
|
|
|
}
|
|
|
that.page = 1;
|
|
|
that.tiezilist = [];
|
|
|
that.getprovinceid();
|
|
|
},
|
|
|
onChange(picker, value, index) {},
|
|
|
onCancel() {
|
|
|
this.showcity = false;
|
|
|
},
|
...
|
...
|
@@ -325,6 +357,12 @@ export default { |
|
|
selectpro() {
|
|
|
this.showcity = true;
|
|
|
},
|
|
|
// 输入完成之后
|
|
|
finishword() {
|
|
|
this.page = 1;
|
|
|
this.tiezilist = [];
|
|
|
this.getteizilist();
|
|
|
},
|
|
|
onLoad() {
|
|
|
// 异步更新数据
|
|
|
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
|
...
|
...
|
@@ -333,10 +371,8 @@ export default { |
|
|
newpage++;
|
|
|
this.page = newpage;
|
|
|
this.getteizilist();
|
|
|
|
|
|
// 加载状态结束
|
|
|
this.loading = false;
|
|
|
|
|
|
// 数据全部加载完成
|
|
|
if (this.showpull == false) {
|
|
|
this.finished = true;
|
...
|
...
|
@@ -361,49 +397,38 @@ export default { |
|
|
.then(function(res) {
|
|
|
console.log(res, "jssdkjsskd");
|
|
|
wx.config({
|
|
|
debug: true,
|
|
|
debug: false,
|
|
|
appId: res.data.appId, // 和获取Ticke的必须一样------必填,公众号的唯一标识
|
|
|
timestamp: res.data.timestamp, // 必填,生成签名的时间戳
|
|
|
nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
|
|
|
signature: res.data.signature, // 必填,签名,见附录1
|
|
|
//需要分享的列表项:发送给朋友,分享到朋友圈,分享到QQ,分享到QQ空间
|
|
|
jsApiList: ["getLocation"]
|
|
|
jsApiList: ["getLocation", "previewImage"]
|
|
|
});
|
|
|
|
|
|
wx.getLocation({
|
|
|
type: "wgs84", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
|
|
type: "gcj02", // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
|
|
|
success: function(res) {
|
|
|
console.log(res, "获取地理位置");
|
|
|
// var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
|
|
|
// var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
|
|
|
// var speed = res.speed; // 速度,以米/每秒计
|
|
|
// var accuracy = res.accuracy; // 位置精度
|
|
|
|
|
|
let url =
|
|
|
"https://restapi.amap.com/v3/geocode/regeo?output=xml&location=" +
|
|
|
var url =
|
|
|
"https://restapi.amap.com/v3/geocode/regeo?key=735d888fa7a9599eea4de210edc32335&location=" +
|
|
|
res.longitude +
|
|
|
"," +
|
|
|
res.latitude +
|
|
|
"&key=9acc6606cdf7174f62398f7fe460e104&radius=1000&extensions=all";
|
|
|
// window.location.href = url;
|
|
|
that.$axios({
|
|
|
url: "https://restapi.amap.com/v3/geocode/regeo",
|
|
|
type: "get",
|
|
|
dataType: "jsonp",
|
|
|
data: {
|
|
|
location: res.longitude + "," + res.latitude, //位置坐标:格式:location=lng<经度>,lat<纬度>
|
|
|
key: "9acc6606cdf7174f62398f7fe460e104", //开发密钥(Key)
|
|
|
extensions: "base" //base,返回基本地址信息;all 时会返回基本地址信息、附近 POI 内容、道路信息以及道路交叉口信息
|
|
|
},
|
|
|
success: function(res) {
|
|
|
console.log(res);
|
|
|
_this.positionName = res.regeocode.formatted_address; //结构化地址信息
|
|
|
_this.positionDesc = res.regeocode.formatted_address; //结构化地址信息
|
|
|
},
|
|
|
error: function(err) {
|
|
|
alert("服务端错误,请刷新浏览器后重试");
|
|
|
}
|
|
|
});
|
|
|
"&output=JSON&batch=false&roadlevel=0";
|
|
|
that.$http
|
|
|
.get(url)
|
|
|
.then(mapres => {
|
|
|
console.log(mapres, "详细地址");
|
|
|
})
|
|
|
.catch(function(maperr) {
|
|
|
that.proname = maperr.regeocode.addressComponent.province;
|
|
|
if (changename(that.proname) != "") {
|
|
|
that.proname = changename(that.proname);
|
|
|
}
|
|
|
localStorage.setItem("proname", that.proname);
|
|
|
that.getprovinceid();
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
})
|
...
|
...
|
@@ -411,6 +436,77 @@ export default { |
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
|
|
|
// 根据城市名字获取id
|
|
|
getprovinceid() {
|
|
|
let that = this;
|
|
|
var url = "/api/question/get_area";
|
|
|
var params = {
|
|
|
province_name: that.proname
|
|
|
};
|
|
|
console.log("7766554", params);
|
|
|
that.$axios
|
|
|
.post(url, params)
|
|
|
.then(res => {
|
|
|
console.log(res, "000000");
|
|
|
that.province_id = res.data.id;
|
|
|
that.tiezilist = [];
|
|
|
that.page = 1;
|
|
|
// 获取论坛列表
|
|
|
this.getteizilist();
|
|
|
})
|
|
|
.catch(err => {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
// 格式化富文本
|
|
|
text(details) {
|
|
|
var texts = ""; //待拼接的内容
|
|
|
|
|
|
while (details.indexOf("<img") != -1) {
|
|
|
//寻找img 循环
|
|
|
|
|
|
texts += details.substring("0", details.indexOf("<img") + 4); //截取到<img前面的内容
|
|
|
|
|
|
details = details.substring(details.indexOf("<img") + 4); //<img 后面的内容
|
|
|
|
|
|
if (
|
|
|
details.indexOf("style=") != -1 &&
|
|
|
details.indexOf("style=") < details.indexOf(">")
|
|
|
) {
|
|
|
texts +=
|
|
|
details.substring(0, details.indexOf('style="') + 7) +
|
|
|
"max-width:100%;height:auto;margin:0 auto;"; //从 <img 后面的内容 截取到style= 加上自己要加的内容
|
|
|
|
|
|
details = details.substring(details.indexOf('style="') + 7); //style后面的内容拼接
|
|
|
} else {
|
|
|
texts += ' style="max-width:100%;height:auto;margin:0 auto;" ';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
while (details.indexOf("<td") != -1) {
|
|
|
//寻找img 循环
|
|
|
|
|
|
texts += details.substring("0", details.indexOf("<td") + 4); //截取到<img前面的内容
|
|
|
|
|
|
details = details.substring(details.indexOf("<td") + 4); //<img 后面的内容
|
|
|
|
|
|
if (
|
|
|
details.indexOf("style=") != -1 &&
|
|
|
details.indexOf("style=") < details.indexOf(">")
|
|
|
) {
|
|
|
texts +=
|
|
|
details.substring(0, details.indexOf('style="') + 7) +
|
|
|
"max-width:74!important;height:auto;margin:0 auto;"; //从 <img 后面的内容 截取到style= 加上自己要加的内容
|
|
|
|
|
|
details = details.substring(details.indexOf('style="') + 7); //style后面的内容拼接
|
|
|
} else {
|
|
|
texts += ' style="max-width:100%;height:auto;margin:0 auto;" ';
|
|
|
}
|
|
|
}
|
|
|
texts += details; //最后拼接的内容
|
|
|
return texts;
|
|
|
},
|
|
|
// 获取分类列表
|
|
|
gettiezikind() {
|
|
|
let that = this;
|
...
|
...
|
@@ -440,7 +536,7 @@ export default { |
|
|
search_type: "",
|
|
|
keyword: that.keyword,
|
|
|
type: that.type,
|
|
|
order: that.order,
|
|
|
order: that.fenlei,
|
|
|
page: that.page,
|
|
|
pageNum: 10
|
|
|
};
|
...
|
...
|
@@ -449,6 +545,9 @@ export default { |
|
|
.post(url, param)
|
|
|
.then(function(res) {
|
|
|
that.tiezilist = that.tiezilist.concat(res.data);
|
|
|
that.tiezilist.forEach(function(value, index, array) {
|
|
|
value.content = that.text(value.content);
|
|
|
});
|
|
|
if (that.page > 1) {
|
|
|
if (res.data.length == 0) {
|
|
|
Toast("没有更多了~");
|
...
|
...
|
@@ -461,29 +560,88 @@ export default { |
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
// 论坛详情
|
|
|
luntandetail(item) {
|
|
|
this.$router.push({
|
|
|
path: "/tiezidetail",
|
|
|
query: { id: item.id }
|
|
|
});
|
|
|
},
|
|
|
// 点赞和取消点赞
|
|
|
praisedian(item, index) {
|
|
|
let that = this;
|
|
|
if (that.tiezilist[index].is_praise == 2) {
|
|
|
Toast("点赞成功");
|
|
|
that.tiezilist[index].is_praise = 1;
|
|
|
that.tiezilist[index].praise = that.tiezilist[index].praise + 1;
|
|
|
} else {
|
|
|
Toast("取消点赞成功");
|
|
|
that.tiezilist[index].is_praise = 2;
|
|
|
that.tiezilist[index].praise = that.tiezilist[index].praise - 1;
|
|
|
}
|
|
|
|
|
|
that.tiezilist = that.tiezilist;
|
|
|
|
|
|
var url = "forum/praise";
|
|
|
var params = {
|
|
|
forum_id: item.id
|
|
|
};
|
|
|
console.log("参数", params);
|
|
|
that.$axios
|
|
|
.post(url, params)
|
|
|
.then(res => {
|
|
|
console.log(res);
|
|
|
})
|
|
|
.catch(err => {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
// 进入video
|
|
|
govideo(src) {
|
|
|
console.log(src);
|
|
|
this.$router.push({
|
|
|
path: "/videoplay",
|
|
|
query: { url: src }
|
|
|
});
|
|
|
},
|
|
|
getfen(id) {
|
|
|
this.fenlei = id;
|
|
|
this.page = 1;
|
|
|
this.tiezilist = [];
|
|
|
this.getteizilist();
|
|
|
},
|
|
|
hidetanceng() {
|
|
|
this.showpublish = false;
|
|
|
},
|
|
|
duanshipin(id) {
|
|
|
console.log(id);
|
|
|
// 预览图片
|
|
|
previewimg(index, indexk, item) {
|
|
|
wx.previewImage({
|
|
|
current: item, // 当前显示图片的http链接
|
|
|
urls: this.tiezilist[index].images // 需要预览的图片http链接列表
|
|
|
});
|
|
|
},
|
|
|
duanshipin(id, item) {
|
|
|
console.log(id, item.id);
|
|
|
if (id == 1) {
|
|
|
this.$router.push({
|
|
|
path: "/duanshipinlist"
|
|
|
path: "/duanshipinlist",
|
|
|
query: {
|
|
|
id: item.id
|
|
|
}
|
|
|
});
|
|
|
} else if (id == 2) {
|
|
|
this.$router.push({
|
|
|
path: "/banggonglist"
|
|
|
path: "/duanshipinlist",
|
|
|
query: {
|
|
|
id: item.id
|
|
|
}
|
|
|
});
|
|
|
} else if (id == 3) {
|
|
|
this.$router.push({
|
|
|
path: "/mianfanglsit"
|
|
|
path: "/duanshipinlist",
|
|
|
query: {
|
|
|
id: item.id
|
|
|
}
|
|
|
});
|
|
|
} else if (id == 4) {
|
|
|
this.$router.push({
|
...
|
...
|
@@ -504,4 +662,10 @@ export default { |
|
|
z-index: 999;
|
|
|
width: 100%;
|
|
|
}
|
|
|
.nodata {
|
|
|
color: #999;
|
|
|
font-size: 0.28rem;
|
|
|
text-align: center;
|
|
|
margin: 2rem auto 0;
|
|
|
}
|
|
|
</style> |
...
|
...
|
|