作者 lihongjuan

论坛模块

... ... @@ -14196,6 +14196,11 @@
}
}
},
"vue-jsonp": {
"version": "0.1.8",
"resolved": "https://registry.npm.taobao.org/vue-jsonp/download/vue-jsonp-0.1.8.tgz",
"integrity": "sha1-LOwFSwrKWpx94BRrFrKsvuwtc6c="
},
"vue-lazyload": {
"version": "1.2.3",
"resolved": "https://registry.npm.taobao.org/vue-lazyload/download/vue-lazyload-1.2.3.tgz",
... ...
{
"name": "zhongmianpublic",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "lihongjuan <18848113498@163.com>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"build": "node build/build.js"
},
"dependencies": {
"vant": "^2.10.7",
"vconsole": "^3.3.4",
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"weixin-js-sdk": "^1.6.0"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"axios": "^0.20.0",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^21.0.2",
"babel-loader": "^7.1.1",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"chromedriver": "^2.27.2",
"copy-webpack-plugin": "^4.0.1",
"cross-spawn": "^5.0.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"jest": "^22.0.4",
"jest-serializer-vue": "^0.3.0",
"nightwatch": "^0.9.12",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-jest": "^1.0.2",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
"name": "zhongmianpublic",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "lihongjuan <18848113498@163.com>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"build": "node build/build.js"
},
"dependencies": {
"vant": "^2.10.7",
"vconsole": "^3.3.4",
"vue": "^2.5.2",
"vue-jsonp": "^0.1.8",
"vue-router": "^3.0.1",
"weixin-js-sdk": "^1.6.0"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"axios": "^0.20.0",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^21.0.2",
"babel-loader": "^7.1.1",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"chromedriver": "^2.27.2",
"copy-webpack-plugin": "^4.0.1",
"cross-spawn": "^5.0.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"jest": "^22.0.4",
"jest-serializer-vue": "^0.3.0",
"nightwatch": "^0.9.12",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-jest": "^1.0.2",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
\ No newline at end of file
... ...
... ... @@ -17,6 +17,27 @@ html {
}
#app {
}
a标签去除默认样式
/*包含以下四种的链接*/
a {
text-decoration: none;
}
/*正常的未被访问过的链接*/
a:link {
text-decoration: none;
}
/*已经访问过的链接*/
a:visited {
text-decoration: none;
}
/*鼠标划过(停留)的链接*/
a:hover {
text-decoration: none;
}
/* 正在点击的链接*/
a:active {
text-decoration: none;
}
img {
width: 100%;
height: 100%;
... ...
... ... @@ -108,7 +108,7 @@
}
.homepageboxitem {
margin-right: 0.45rem;
margin-right: 0.42rem;
margin-bottom: 0.17rem;
}
... ... @@ -128,6 +128,18 @@
background: #fff;
}
.mykind {
padding: 0.24rem 0.32rem;
box-sizing: border-box;
border-bottom: 0.13rem solid #f5f5f5;
background: #fff;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 999;
}
.fenleiactive {
position: relative;
color: #000000;
... ... @@ -185,6 +197,8 @@
.tieziitem {
padding: 0.15rem 0.49rem;
box-sizing: border-box;
background: #fff;
margin-bottom: 0.2rem;
}
.tieziming {
... ... @@ -206,17 +220,18 @@
.tiezizhuan {
width: 1.2rem;
height: 0.35rem;
line-height: 0.35rem;
padding: 0.02rem 0;
box-sizing: border-box;
text-align: center;
box-sizing: border-box;
background: rgba(0, 0, 0, 0);
border: 1px solid #c68c3e;
border-radius: 0.18rem;
color: #c68c3e;
font-size: 0.2rem;
font-size: 0.23rem;
text-align: center;
margin-top: 0.15rem;
margin-right: 0.2rem;
}
.teizicontenttop {
... ... @@ -272,9 +287,10 @@
.teizipingitem {
color: #898989;
font-size: 0.2rem;
font-size: 0.26rem;
margin-left: 0.05rem;
margin-right: 0.58rem;
margin-top: 0.12rem;
}
.tiezipingbot {
... ... @@ -294,7 +310,7 @@
}
.tiezhlist {
background: #fff;
/* background: #fff; */
}
.publishwrap {
... ... @@ -313,6 +329,7 @@
width: 0.55rem;
height: 0.55rem;
margin: 0.25rem auto 0;
font-size: 0;
}
.tiezilisttopk {
... ... @@ -323,6 +340,7 @@
padding: 0.25rem 2.05rem;
box-sizing: border-box;
border-bottom: 0.12rem solid #f5f5f5;
background: #fff;
}
.tiezikinditem {
... ... @@ -408,7 +426,7 @@
background: #d3d3d3;
border: 1px solid #7f7f7f;
border-radius: 0.29rem;
color: #aaaaaa;
color: #333;
font-size: 0.28rem;
}
... ... @@ -418,6 +436,8 @@
height: 100%;
padding: 0.1rem 0.4rem;
box-sizing: border-box;
color: #333;
font-size: 0.28rem;
}
.fasend {
... ... @@ -449,10 +469,24 @@
}
.personguan {
width: 1.24rem;
height: 0.35rem;
width: 1.28rem;
padding: 0.05rem 0;
box-sizing: border-box;
text-align: center;
background: #f19b18;
border-radius: 0.17rem;
font-size: 0.28rem;
}
.noattention {
width: 1.28rem;
padding: 0.05rem 0;
box-sizing: border-box;
text-align: center;
border-radius: 0.17rem;
color: #fff;
font-size: 0.28rem;
background: #bdc4ce;
}
.personboxleft {
... ... @@ -474,7 +508,6 @@
.personguan {
width: 1.24rem;
height: 0.35rem;
background: #f19b18;
border-radius: 0.17rem;
color: #fff;
... ... @@ -919,6 +952,11 @@
margin-bottom: 0.12rem;
}
.ponenum {
color: #f19b18;
font-size: 0.28rem;
}
.quxiao {
width: 7.15rem;
height: 0.72rem;
... ...
... ... @@ -88,7 +88,9 @@
<div class="quxiaofix">
<div class="phone flexthree">
<img src="../assets/phone.png" alt="" class="phonimg" />
呼叫400-0230-777
<a :href="'tel:' + '400-0230-777'" class="ponenum">
呼叫400-0230-777</a
>
</div>
<div class="quxiao" @click="cancelphone">取消</div>
</div>
... ... @@ -132,7 +134,7 @@ export default {
onChange(index) {
console.log(index);
if (index == 0) {
this.$router.push("/homepage");
this.$router.push("/");
} else if (index == 1) {
this.$router.push("/xiaoxi");
} else if (index == 2) {
... ... @@ -140,7 +142,9 @@ export default {
} else if (index == 4) {
this.$router.push("/mine");
} else if (index == 3) {
console.log(9999);
this.showphone = true;
console.log(this.showphone);
}
// const routerArray = ["/homepage", "/zhishi", "/message"];
// this.$router.push(routerArray[index]);
... ...
<template>
<div class="container">
<div class="tiezitop tiezilisttopk">
<div class="hometopbark flextwo">
<div class="homesearch homesearchk flexone">
<img src="../../../assets/sousuo.png" alt="" class="souimg" />
<div class="souenter">请输入关键词搜索</div>
</div>
<div class="searchpro searchprok flexone">
<div class="proname">江苏省</div>
<img src="../../../assets/xiasanjiao.png" alt="" class="xiasanjiao" />
</div>
</div>
<div class="tiezikind flextwo">
<div
class="tiezikinditem"
:class="tiezisel == 1 ? 'tiezikindactive' : ''"
@click="seltiekind(1)"
>
招聘
</div>
<div
class="tiezikinditem"
:class="tiezisel == 2 ? 'tiezikindactive' : ''"
@click="seltiekind(2)"
>
求职
</div>
</div>
</div>
<div class="tiezhlist">
<div class="tieziitem">
<div class="tiezitop flexone">
<div class="tieziimg">
<img src="../../../assets/touxiang_img@2x.png" alt="" />
</div>
<div class="tieziright">
<div class="tiezirighttop flex">
<div>
<div class="tieziming">中面小麦</div>
<div class="tiezifen">30分钟</div>
</div>
<div>
<div class="vipimg">
<img src="../../../assets/vip_icon@2x.png" alt="" />
<div class="vipname">VIP1</div>
</div>
<div class="tiezizhuan">面坊转让</div>
</div>
<img
src="../../../assets/banggong_icon@2x.png"
class="banggongimg"
alt=""
/>
<img
src="../../../assets/peisong_icon@2x.png"
class="banggongimg"
alt=""
/>
<img
src="../../../assets/yirenzheng_icon@2x.png"
class="banggongimg"
alt=""
/>
</div>
<div class="tiezibto flexone"></div>
</div>
</div>
<div class="tiezicontent">
<div class="teizicontenttop flextwo">
<div class="tiezicontentname">滚滚长江东逝水</div>
<img
src="../../../assets/xingxing_icon@2x.png"
alt=""
class="starimg"
/>
<img
src="../../../assets/weishoucang_icon@2x.png"
alt=""
class="starimg"
/>
</div>
<div class="tieziwordbox">滚滚长江东逝水</div>
<div class="teiziimgbox flexone">
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
</div>
<div class="tiezipingbot">
<div class="teizipingitem flexone">
<img
src="../../../assets/pinglun_icon@2x.png"
alt=""
class="lunimg"
/>
1005
</div>
<div class="teizipingitem flexone">
<img
src="../../../assets/zan_icon@2x.png"
alt=""
class="lunimg zanimg"
/>
1005
</div>
<div class="teizipingitem flexone">
<img
src="../../../assets/cai_icon@2x.png"
alt=""
class="lunimg zanimg"
/>
1005
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
tiezisel: 1
};
},
created() {
document.title = "帮工招聘";
},
methods: {
seltiekind(id) {
this.tiezisel = id;
}
}
};
</script>
<style scoped>
@import "../../style/homepage.css";
</style>
... ... @@ -4,124 +4,243 @@
<div class="hometopbark hometopbackk flextwo">
<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="finish"
/>
</div>
</div>
<div class="searchpro flexone">
<div class="proname">江苏省</div>
<div class="searchpro flexone" @click="showprovince">
<div class="proname">{{ proname }}</div>
<img src="../../../assets/xiasanjiao.png" alt="" class="xiasanjiao" />
</div>
</div>
</div>
<div class="tiezhlist">
<div class="tieziitem" @click="tiezidetail">
<div class="tiezitop flexone">
<div class="tieziimg">
<img src="../../../assets/touxiang_img@2x.png" alt="" />
</div>
<div class="tieziright">
<div class="tiezirighttop flex">
<div>
<div class="tieziming">中面小麦</div>
<div class="tiezifen">30分钟</div>
</div>
<div>
<div class="vipimg">
<img src="../../../assets/vip_icon@2x.png" alt="" />
<div class="vipname">VIP1</div>
</div>
<div class="tiezizhuan">面坊转让</div>
</div>
<img
src="../../../assets/banggong_icon@2x.png"
class="banggongimg"
alt=""
/>
<img
src="../../../assets/peisong_icon@2x.png"
class="banggongimg"
alt=""
/>
<img
src="../../../assets/yirenzheng_icon@2x.png"
class="banggongimg"
alt=""
/>
</div>
<div class="tiezibto flexone"></div>
</div>
</div>
<div class="tiezicontent">
<div class="teizicontenttop flextwo">
<div class="tiezicontentname">滚滚长江东逝水</div>
<img
src="../../../assets/xingxing_icon@2x.png"
alt=""
class="starimg"
/>
<img
src="../../../assets/weishoucang_icon@2x.png"
alt=""
class="starimg"
/>
</div>
<div class="tieziwordbox">滚滚长江东逝水</div>
<div class="teiziimgbox flexone">
<div class="videoimg">
<img src="../../../assets/banner.png" alt="" />
<img
src="../../../assets/bofang_icon@2x.png"
alt=""
class="videobtn"
/>
</div>
</div>
<div class="tiezipingbot">
<div class="teizipingitem flexone">
<img
src="../../../assets/pinglun_icon@2x.png"
alt=""
class="lunimg"
/>
1005
</div>
<div class="teizipingitem flexone">
<img
src="../../../assets/zan_icon@2x.png"
alt=""
class="lunimg zanimg"
/>
1005
</div>
<div class="teizipingitem flexone">
<img
src="../../../assets/cai_icon@2x.png"
alt=""
class="lunimg zanimg"
/>
1005
</div>
</div>
</div>
<!-- 帮工招聘 -->
<div class="tiezikind flextwo" v-if="kindtype == 2">
<div
class="tiezikinditem"
:class="search_type == 1 ? 'tiezikindactive' : ''"
@click="seltiekind(1)"
>
招聘
</div>
<div
class="tiezikinditem"
:class="search_type == 2 ? 'tiezikindactive' : ''"
@click="seltiekind(2)"
>
求职
</div>
</div>
<!-- 面坊转让 -->
<div class="tiezikind flextwo" v-if="kindtype == 3">
<div
class="tiezikinditem"
:class="search_type == 3 ? 'tiezikindactive' : ''"
@click="seltiekind(3)"
>
求购
</div>
<div
class="tiezikinditem"
:class="search_type == 4 ? 'tiezikindactive' : ''"
@click="seltiekind(4)"
>
转让
</div>
</div>
<!-- 征婚交友 -->
<div class="tiezikind flextwo" v-if="kindtype == 4">
<div
class="tiezikinditem"
:class="search_type == 5 ? 'tiezikindactive' : ''"
@click="seltiekind(5)"
>
找男友
</div>
<div
class="tiezikinditem"
:class="search_type == 6 ? 'tiezikindactive' : ''"
@click="seltiekind(6)"
>
找女友
</div>
</div>
<!-- 帖子列表 -->
<div class="tiezhlist">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<tiezicontent :tiezilist="tiezilist" :showpull="showpull" />
</van-list>
</div>
<!-- 选择器 -->
<van-picker
title="标题"
show-toolbar
:columns="citylist"
@confirm="onConfirm"
@cancel="onCancel"
v-if="showcity"
/>
</div>
</template>
<script>
import tiezicontent from "@/components/tiezicontent.vue";
import area from "../../../utils/area.js";
import { changename } from "../../../utils/base.js"; //城市去掉市
export default {
components: {
tiezicontent
},
data() {
return {
tiezisel: 1
tiezisel: 1,
showcity: false,
citylist: area.province_list,
tiezilist: [],
showpull: true,
loading: false,
finished: false,
proname: "",
province_id: "",
kindtype: "",
search_type: "",
keyword: ""
};
},
created() {
document.title = "短视频专区";
// 分类id
this.kindtype = this.$route.query.id;
if (this.kindtype == 2) {
// 帮工招聘
this.search_type = 1;
} else if (this.kindtype == 3) {
//面坊转让
this.search_type = 3;
} else if (this.kindtype == 4) {
//征婚交友
this.search_type = 5;
}
// localStorage.setItem("proname", "天津");
this.proname = localStorage.getItem("proname");
this.getprovinceid();
},
methods: {
// 显示省份
showprovince() {
this.showcity = true;
},
// 1 帮工2 招聘 3求购 4 转让 5 找男友 6 找女友
seltiekind(id) {
this.tiezisel = id;
this.search_type = id;
this.page = 1;
this.tiezilist = [];
this.getteizilist();
},
onLoad() {
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
let newpage = this.page;
newpage++;
this.page = newpage;
this.getteizilist();
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (this.showpull == false) {
this.finished = true;
}
}, 1000);
},
// 关键词搜索
finish() {
this.page = 1;
this.tiezilist = [];
this.getteizilist();
},
// 确定选择城市
onConfirm(value, index) {
let tat = this;
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();
},
// 根据城市名字获取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 => {
that.province_id = res.data.id;
that.tiezilist = [];
that.page = 1;
// 获取论坛列表
this.getteizilist();
})
.catch(err => {
console.log(err);
});
},
// 获取论坛列表
getteizilist() {
let that = this;
var url = "/api/forum/get_forum";
var params = {
search_type: that.search_type,
keyword: that.keyword,
province_id: that.province_id,
type: that.kindtype,
page: that.page,
pageNum: 10
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {
console.log(res);
that.tiezilist = that.tiezilist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false;
}
}
})
.catch(err => {
console.log(err);
});
},
onCancel() {
this.showcity = false;
},
tiezidetail() {
this.$router.push({
... ... @@ -137,4 +256,11 @@ export default {
<style scoped>
@import "../../style/homepage.css";
.van-picker {
position: fixed;
bottom: 0;
left: 0;
z-index: 999;
width: 100%;
}
</style>
... ...
... ... @@ -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>
... ...
<template>
<div class="container">
<div class="personbox flexone">
<div class="personbox flexone" v-if="show">
<div class="personboxleft">
<img src="../../../assets/touxiang_img@2x.png" alt="" />
<img :src="user.avatar" alt="" />
</div>
<div class="personboxright">
<div class="persondis flexone">
<div class="personname">中面小麦</div>
<div class="personguan">关注</div>
<div class="personname">{{ user.nickname }}</div>
<div
class="personguan"
v-if="user.is_attention == 2"
@click="attentionguan"
>
关注
</div>
<div
class="noattention"
@click="noattention"
v-if="user.is_attention == 1"
>
取消关注
</div>
</div>
<div class="connectphone">联系方式:15822184563</div>
</div>
</div>
<div class="tiezhlist">
<div class="tieziitem">
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<tiezicontent :tiezilist="personlist" :showpull="showpull" />
</van-list>
<!-- <div class="tieziitem">
<div class="tiezitop flexone">
<div class="tieziimg">
<img src="../../../assets/touxiang_img@2x.png" alt="" />
... ... @@ -110,24 +131,121 @@
</div>
</div>
</div>
</div>
</div> -->
</div>
</div>
</template>
<script>
import tiezicontent from "@/components/tiezicontent.vue";
import { Toast } from "vant";
export default {
components: {
tiezicontent
},
data() {
return {
tiezisel: 1
tiezisel: 1,
user_id: "",
suer: "",
personlist: [],
showpull: true,
loading: false,
finished: false,
page: 1,
show: false
};
},
created() {
document.title = "征婚交友";
this.user_id = this.$route.query.userid;
this.getpersonpage();
},
methods: {
seltiekind(id) {
this.tiezisel = id;
},
onLoad() {
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
let newpage = this.page;
newpage++;
this.page = newpage;
this.getpersonpage();
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (this.showpull == false) {
this.finished = true;
}
}, 1000);
},
// 获取个人主页
getpersonpage() {
let that = this;
let url = "/api/forum/get_user_forum";
var params = {
user_id: that.user_id,
page: that.page,
pageNum: 10
};
console.log("8934394889", params);
that.$axios
.post(url, params)
.then(res => {
console.log("个人主页信息", res);
that.user = res.data.user;
console.log("676767676767", that.user);
setTimeout(function() {
that.show = true;
}, 200);
that.personlist = that.personlist.concat(res.data.list);
if (that.page > 1) {
if (res.data.list.length == 0) {
that.showpull = false;
}
}
})
.catch(err => {
console.log(err);
});
},
// 关注和取消关注
attentionguan() {
let that = this;
let url = "/api/forum/attention";
var params = {
to_user_id: that.user_id
};
that.$axios
.post(url, params)
.then(res => {
Toast("关注成功");
that.user.is_attention = 1;
that.user = that.user;
that.$forceUpdate();
})
.catch(err => {
console.log(err);
});
},
noattention() {
let that = this;
let url = "/api/forum/attention";
var params = {
to_user_id: that.user_id
};
that.$axios.post(url, params).then(res => {
Toast("取消关注成功");
that.user.is_attention = 2;
that.user = that.user;
that.$forceUpdate();
});
}
}
};
... ...
... ... @@ -3,7 +3,7 @@
<div class="addtop flextwo">
<div class="addtopleft">发布省份</div>
<div class="addprovince flexone" @click="selectcity">
<div class="proname">{{ provincename }}</div>
<div class="proname">{{ proname }}</div>
<div class="xiala">
<img src="../../../assets/huixia.png" alt="" />
</div>
... ... @@ -24,13 +24,13 @@
<div class="connectbox flexone">
<div class="connectname">联系方式</div>
<div class="connectenter">
<input type="number" placeholder="输入号码" />
<input type="number" placeholder="输入号码" v-model="mobile" />
</div>
</div>
<div class="connectbox flexone">
<div class="connectbox flexone" v-if="type != 1">
<div class="connectname">联系人</div>
<div class="connectenter enternamek">
<input type="text" placeholder="输入姓名" />
<input type="text" placeholder="输入姓名" v-model="name" />
</div>
</div>
</div>
... ... @@ -40,7 +40,7 @@
type="text"
placeholder="加个标题哦~"
placeholder-class="entertitle"
@input="entertitle"
v-model="title"
/>
</div>
<div class="contractcontent">
... ... @@ -50,6 +50,7 @@
cols="30"
rows="10"
placeholder="请输入帖子内容"
v-model="content"
></textarea>
</div>
... ... @@ -57,14 +58,18 @@
<div v-if="type == 1">
<div class="text">请上传视频大小在25M以下</div>
<div class="addpicox flexone">
<div
class="addpic addvideo"
@click="chooseVideo"
v-if="videoimg == ''"
>
<div class="addpic addvideo" v-if="videoimg == ''">
<div class=" ">
<input
type="file"
class="videoimgkk"
accept="video/*"
@change="uploadfileone"
/>
</div>
<img src="../../../assets/add.png" alt="" />
</div>
<div class="addpic addvideo" @click="chooseVideo" v-else>
<div class="addpic addvideo" v-else>
<video :src="videoimg"></video>
</div>
</div>
... ... @@ -72,153 +77,267 @@
<!-- 上传图片 -->
<div class="addpicox flexone" v-else>
<div class="addpic" v-for="(item, index) in image" :key="index">
<!-- <div class="addpic" v-for="(item, index) in images" :key="index">
<image :src="item" mode=""></image>
<div class="delimg" @click="deleteimg(index)" :data-url="item">
<image src="../../../assets/close.png" mode=""></image>
</div>
</div>
<div class="addpic" @click="chooseImage">
<img src="../../../assets/add.png" alt="" />
</div> -->
<div class="flexone">
<van-uploader
v-model="fileList"
multiple="true"
:after-read="afterRead"
:max-count="9"
@delete="deleftimg"
style="margin-right:0.2rem"
/>
<!-- <img src="../../../assets/add.png" alt="" /> -->
</div>
</div>
</div>
<div class="buybtn surebtn" @click="issure == false ? sure() : ''">
<div class="buybtn surebtn" @click="issure == true ? sure() : ''">
<div class="queding">确定</div>
</div>
<!-- 城市选择 -->
<!-- 选择器 -->
<van-picker
v-if="showcity"
show-toolbar
title="标题"
:columns="columns"
:default-index="2"
show-toolbar
:columns="citylist"
@confirm="onConfirm"
@cancel="onCancel"
v-if="showcity"
/>
<!-- 选择器 -->
<van-picker
v-if="showhelp"
show-toolbar
title="标题"
show-toolbar
:columns="banggongcolumns"
:default-index="2"
@confirm="onConfirm"
@cancel="onCancel"
@confirm="onConfirmkind"
@cancel="onCancelkind"
v-if="showkind"
/>
<!-- 图片上传中 -->
<van-loading type="spinner" color="#1989fa" v-if="cardzheng" />
</div>
</template>
<script>
import { changename } from "../../../utils/base.js"; //城市去掉市
import area from "../../../utils/area.js";
import Vue from "vue";
import "vant/lib/index.css";
import { Picker, Toast } from "vant";
import { Uploader, Loading } from "vant";
Vue.use(Loading);
Vue.use(Toast);
Vue.use(Uploader);
Vue.use(Picker);
export default {
data() {
return {
type: 2,
provincelist: [],
provincename: "江苏省",
index: 0,
province_id: "",
image: [],
title: "",
content: "",
// 上传图片
images: [],
chuanimage: [],
delimg: [],
fileList: [],
videoimg: "",
issure: false,
issure: true,
kindname: "请选择",
search_type: "",
zhaoarr: [],
showcity: false,
columns: ["杭州", "宁波", "温州", "绍兴", "湖州", "嘉兴", "金华", "衢州"],
citylist: area.province_list,
banggongcolumns: ["帮工", "招聘"],
showhelp: false,
type: ""
proname: "",
province_id: "",
showcity: false,
showkind: false, // 帮工招聘
mobile: "", //手机号
name: "", //联系人
title: "", //帖子标题
content: "", //帖子内容
cardzheng: false,
chuanvideo: ""
};
},
created() {
this.type = this.$route.query.type;
// this.provincename = uni.getStorageSync("provincename");
localStorage.setItem("proname", "天津");
this.proname = localStorage.getItem("proname");
this.getprovinceid();
// this.type = options.type;
// if (options.type == 2) {
// let arr = [
// {
// id: 1,
// name: "招聘"
// },
// {
// id: 1,
// name: "求职"
// }
// ];
// this.zhaoarr = arr;
// } else if (options.type == 3) {
// let arr = [
// {
// id: 3,
// name: "求购"
// },
// {
// id: 4,
// name: "转让"
// }
// ];
// this.zhaoarr = arr;
// } else if (options.type == 4) {
// let arr = [
// {
// id: 5,
// name: "找男友"
// },
// {
// id: 6,
// name: "找女友"
// }
// ];
// this.zhaoarr = arr;
// }
this.getprovincelist();
this.type = this.$route.query.type;
let type = this.type;
if (type == 2) {
this.banggongcolumns = ["招聘", "求职"];
} else if (type == 3) {
this.banggongcolumns = ["求购", "转让"];
} else if (type == 4) {
this.banggongcolumns = ["找男友", "找女友"];
}
},
methods: {
// 上传图片
afterRead(file) {
let that = this;
console.log(file);
console.log(file.length);
that.cardzheng = true;
if (file.length == undefined) {
var formdata = new FormData();
formdata.append("file", file.file);
that.delimg.push(file.file.name);
var url = "/api/common/upload";
that.$uploadFile
.post(url, formdata)
.then(function(res) {
console.log(res);
that.cardzheng = false;
let url = "http://tangyuanji.t.brotop.cn" + res.data.url;
that.images.push(url);
that.chuanimage.push(res.data.url);
})
.catch(err => {
console.log(err);
});
} else {
for (var i = 0; i < file.length; i++) {
console.log(file[i].file);
var formdata = new FormData();
formdata.append("file", file[i].file);
that.delimg.push(file[i].file.name);
var url = "/api/common/upload";
that.$uploadFile
.post(url, formdata)
.then(function(res) {
console.log(res);
that.cardzheng = false;
let url = "https://app.chinesenooddles.com" + res.data.url;
that.images.push(url);
that.chuanimage.push(res.data.url);
})
.catch(err => {
console.log(err);
that.cardzheng = false;
});
}
}
},
// 删除图片
deleftimg(e) {
let that = this;
let item = e.file.name;
this.delimg.forEach(function(value, index, array) {
if (value == item) {
that.delimg.splice(index, 1);
that.images.splice(index, 1);
that.chuanimage.splice(index, 1);
that.fileList.splice(index, 1);
}
});
this.delimg = this.delimg;
this.images = this.images;
this.chuanimage = this.chuanimage;
this.$forceUpdate();
},
// 上传视频
uploadfileone(e) {
let that = this;
that.cardzheng = true;
console.log(e);
let file = e.target.files[0];
console.log(file);
var formdata = new FormData();
formdata.append("file", file);
// formdata.append("token", localStorage.getItem("token"));
var url = "/api/common/upload";
that.$uploadFile
.post(url, formdata)
.then(function(res) {
console.log(res);
that.cardzheng = false;
that.videoimg = res.data.url;
// that.showvideo = res.data.priview_url;
// that.video_image = res.data.video_image;
})
.catch(err => {
that.cardzheng = false;
console.log(err);
});
},
// 选择城市
selectcity() {
this.showcity = true;
},
// 城市选择
// 确定选择城市
onConfirm(value, index) {
// Toast(`当前值:${value}, 当前索引:${index}`);
console.log(value, index);
let that = this;
this.showcity = false;
this.showhelp = false;
},
onChange(picker, value, index) {
// Toast(`当前值:${value}, 当前索引:${index}`);
if (changename(value) != "") {
that.proname = changename(value);
} else {
that.proname = value;
}
that.getprovinceid();
},
onCancel() {
// Toast("取消");
this.showcity = false;
this.showhelp = false;
},
// 选择种类
onConfirmkind(value, index) {
console.log(value, index);
if (value == "招聘") {
this.search_type = 1;
} else if (value == "求职") {
this.search_type = 2;
} else if (value == "求购") {
this.search_type = 3;
} else if (value == "转让") {
this.search_type = 4;
} else if (value == "找男友") {
this.search_type = 5;
} else if (value == "找女友") {
this.search_type = 6;
}
this.showkind = false;
this.kindname = value;
},
onCancelkind() {
this.showkind = false;
},
//帮工招聘
banggong() {
this.showhelp = true;
this.showkind = true;
},
// 根据城市名字获取id
getprovinceid() {
let that = this;
var url = "question/get_area";
var url = "/api/question/get_area";
var params = {
province_name: that.provincename
province_name: that.proname
};
console.log("7766554", params);
// app
// .post(url, params)
// .then(res => {
// that.province_id = res.data.data.id;
// })
// .catch(err => {
// console.log(err);
// });
that.$axios
.post(url, params)
.then(res => {
that.province_id = res.data.id;
})
.catch(err => {
console.log(err);
});
},
// 选择招聘求职
bindzhaoChange(e) {
... ... @@ -230,168 +349,160 @@ export default {
entertitle(e) {
this.title = e.detail.value;
},
//输入内容
entercontent(e) {
this.content = e.detail.value;
},
// 获取省份列表
getprovincelist() {
let that = this;
var url = "forum/get_province";
var params = {
is_forum_hot: ""
};
console.log("7766554", params);
// app
// .post(url, params)
// .then(res => {
// console.log(res);
// that.provincelist = res.data.data;
// that.provincelist.forEach(function(value, index, array) {
// if (value.name == that.provincename) {
// that.index = index;
// }
// });
// this.getluntanlist();
// })
// .catch(err => {});
},
bindproChange(e) {
this.index = e.target.value;
this.provincename = this.provincelist[e.target.value].name;
this.province_id = this.provincelist[e.target.value].id;
this.page = 1;
this.luntanlist = [];
},
// 验证
yanzheng() {},
// 上传图片
chooseImage() {
sure() {
let that = this;
// uni.chooseImage({
// count: 9,
// sizeType: ["original", "compressed"],
// success: function(res) {
// console.log(res);
// console.log(res.tempFilePaths);
// console.log(res.tempFilePaths[0]);
that.issure = false;
// res.tempFilePaths.forEach(function(value, index, array) {
// app
// .upload("image", value, "post")
// .then(res => {
// console.log("上传文件", res);
// let url = app.globalData.imgurl + res.url;
// that.image.push(url);
// console.log(that.image);
// })
// .catch(err => {
// console.log(err);
// });
// });
// },
// fail: function(res) {}
// });
},
if (that.type == 1) {
if (that.mobile == "") {
Toast("请输入手机号");
that.issure = true;
return false;
}
deleteimg(index) {
this.image.splice(index, 1);
this.image = this.image;
console.log(this.iamge);
},
//上传视频
chooseVideo() {
let that = this;
uni.chooseVideo({
sourceType: ["album", "camera"],
maxDuration: 60,
camera: "back",
success(res) {
let file = res.tempFilePath;
// app
// .upload("image", file, "post")
// .then(res => {
// console.log("上传文件", res);
// let url = app.globalData.imgurl + res.url;
// that.videoimg = url;
// console.log(that.videoimg);
// })
// .catch(err => {
// console.log(err);
// });
if (that.mobile != "") {
if (!/^1[3456789]\d{9}$/.test(that.mobile)) {
Toast("请输入正确的联系方式");
that.issure = true;
return false;
}
}
});
},
sure() {
let that = this;
that.issure = true;
}
if (that.type == 2) {
if (that.search_type == "") {
Toast("请选择招聘求职");
that.issure = false;
that.issure = true;
return false;
}
if (that.mobile == "") {
Toast("请输入手机号");
that.issure = true;
return false;
}
}
if (that.type == 3) {
if (that.search_type == "") {
Toast("请选择招求购转让");
that.issure = false;
that.issure = true;
return false;
}
if (that.mobile == "") {
Toast("请输入手机号");
that.issure = true;
return false;
}
if (that.mobile != "") {
if (!/^1[3456789]\d{9}$/.test(that.mobile)) {
Toast("请输入正确的联系方式");
that.issure = true;
return false;
}
}
if (that.name == "") {
Toast("请输入联系人");
that.issure = true;
return false;
}
}
if (that.type == 4) {
if (that.search_type == "") {
Toast("请选择招求购转让");
that.issure = false;
Toast("请选择交友方式");
that.issure = true;
return false;
}
if (that.mobile == "") {
Toast("请输入手机号");
that.issure = true;
return false;
}
if (that.mobile != "") {
if (!/^1[3456789]\d{9}$/.test(that.mobile)) {
Toast("请输入正确的联系方式");
that.issure = true;
return false;
}
}
if (that.name == "") {
Toast("请输入联系人");
that.issure = true;
return false;
}
}
if (that.title == "") {
Toast("请输入标题");
that.issure = false;
that.issure = true;
return false;
}
if (that.content == "") {
Toast("请输入帖子内容");
that.issure = false;
that.issure = true;
return false;
}
if (that.type == 1) {
if (that.videoimg == "") {
Toast("请上传视频");
that.issure = false;
that.issure = true;
return false;
}
}
var url = "forum/publish_forum";
if (that.fileList.length != that.chuanimage.length) {
Toast("图片上传中");
that.issure = true;
return false;
}
var url = "/api/forum/publish_forum";
var params = {
type: that.type,
province_id: that.province_id,
title: that.title,
content: that.content,
images: that.image.join(","),
images: that.chuanimage.join(","),
search_type: that.search_type,
video: that.videoimg
video: that.videoimg,
name: that.name,
mobile: that.mobile
};
console.log("7766554", params);
// app
// .post(url, params)
// .then(res => {
// console.log(res);
// })
// .catch(err => {
// console.log(err, 78767767667);
// });
that.$axios
.post(url, params)
.then(res => {
console.log(res);
Toast("发布成功");
that.$router.push({
path: "/"
});
})
.catch(err => {
console.log(err, 78767767667);
});
}
}
};
</script>
<style scoped>
.van-loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 99;
}
.van-picker {
position: fixed;
bottom: 0;
left: 0;
z-index: 999;
width: 100%;
}
.text {
color: #bdc4ce;
font-size: 0.28rem;
... ... @@ -411,9 +522,31 @@ export default {
margin-bottom: 0.2rem;
position: relative;
}
.shangtu {
width: 1.5rem;
height: 1.5rem;
position: absolute;
left: 0;
top: 0;
background: transparent;
border: none;
outline: none;
opacity: 0;
}
.addvideo {
width: 1.5rem;
height: 1.5rem;
position: relative;
}
.videoimgkk {
width: 1.5rem;
height: 1.5rem;
position: absolute;
left: 0;
top: 0;
border: none;
outline: none;
opacity: 0;
}
.addvideo image {
width: 100%;
... ... @@ -550,4 +683,11 @@ export default {
padding: 0.25rem 0.32rem;
box-sizing: border-box;
}
.van-loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 99;
}
</style>
... ...
... ... @@ -4,17 +4,21 @@
<div class="tieziitem">
<div class="tiezitop flexone" @click="personclick">
<div class="tieziimg">
<img src="../../../assets/touxiang_img@2x.png" alt="" />
<img :src="tiezidetail.user.avatar" alt="" />
</div>
<div class="tieziright">
<div class="tiezirighttop flex">
<div>
<div class="tieziming">中面小麦</div>
<div class="tieziming">{{ tiezidetail.user.nickname }}</div>
</div>
<div>
<div class="vipimg">
<img src="../../../assets/vip_icon@2x.png" alt="" />
<div class="vipname">VIP1</div>
<img
src="../../../assets/vip_icon@2x.png"
alt=""
v-if="tiezidetail.forum_type == 1"
/>
<div class="vipname">{{ tiezidetail.user.level.name1 }}</div>
</div>
</div>
<img
... ... @@ -43,8 +47,8 @@
</div>
<div class="teizicontenttop flextwo">
<div class="tiezicontentname">滚滚长江东逝水</div>
<img
<div class="tiezicontentname">{{ tiezidetail.title }}</div>
<!-- <img
src="../../../assets/xingxing_icon@2x.png"
alt=""
class="starimg"
... ... @@ -53,12 +57,16 @@
src="../../../assets/weishoucang_icon@2x.png"
alt=""
class="starimg"
/>
/> -->
</div>
<div class="tieziwordbox">滚滚长江东逝水</div>
<div class="teiziimgbox flexone">
<div class="tieziwordbox">{{ tiezidetail.content }}</div>
<div
class="teiziimgbox flexone"
v-if="tiezidetail.video != null"
@click="govideo(tiezidetail.video)"
>
<div class="videoimg">
<img src="../../../assets/banner.png" alt="" />
<img :src="tiezidetail.video_image" alt="" />
<img
src="../../../assets/bofang_icon@2x.png"
alt=""
... ... @@ -66,6 +74,17 @@
/>
</div>
</div>
<div class="teiziimgbox flexone" v-if="tiezidetail.images != null">
<div
class="tieziimgimg"
v-for="(item, indexk) in item.images"
:key="indexk"
@click.stop="previewimg(index, indexk, item)"
>
<img :src="item" alt="" />
</div>
</div>
<div class="tiezipingbot">
<div class="teizipingitem flexone">
<img
... ... @@ -73,15 +92,22 @@
alt=""
class="lunimg"
/>
1005
{{ tiezidetail.comment }}
</div>
<div class="teizipingitem flexone">
<div class="teizipingitem flexone" @click="tiezizan">
<img
src="../../../assets/zan_icon@2x.png"
alt=""
class="lunimg zanimg"
v-if="tiezidetail.is_praise == 1"
/>
1005
<img
src="../../../assets/nodianzan.png"
alt=""
class="lunimg zanimg"
v-if="tiezidetail.is_praise == 2"
/>
{{ tiezidetail.praise }}
</div>
<div class="teizipingitem flexone">
<img
... ... @@ -89,6 +115,7 @@
alt=""
class="lunimg zanimg"
/>
1005
</div>
</div>
... ... @@ -97,37 +124,299 @@
<!-- 全部评论 -->
<div class="allcomentbox">
<div class="commentname">全部评论</div>
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<div
class="tieziitem"
v-for="(item, index) in commentlist"
:key="index"
>
<div class="tiezitop flexone">
<div class="tieziimg">
<img :src="item.user.avatar" alt="" />
</div>
<div class="tieziright">
<div class="tiezirighttop flex">
<div>
<div class="tieziming">{{ item.user.nickname }}</div>
<div class="tiezifen">30分钟</div>
</div>
<div>
<div class="vipimg" v-if="item.forum_type == 1">
<img src="../../../assets/vip_icon@2x.png" alt="" />
<div class="vipname">{{ item.user.level.name1 }}</div>
</div>
<div class="tiezizhuan">
面坊转让
</div>
</div>
<img
src="../../../assets/banggong_icon@2x.png"
class="banggongimg"
alt=""
/>
<img
src="../../../assets/peisong_icon@2x.png"
class="banggongimg"
alt=""
/>
<img
src="../../../assets/yirenzheng_icon@2x.png"
class="banggongimg"
alt=""
/>
</div>
<div class="tiezibto flexone"></div>
</div>
</div>
<div class="tiezicontent">
<div class="teizicontenttop flextwo">
<div class="tiezicontentname">{{ item.title }}</div>
<!-- <img
src="../../../assets/xingxing_icon@2x.png"
alt=""
class="starimg"
/>
<img
src="../../../assets/weishoucang_icon@2x.png"
alt=""
class="starimg"
/> -->
</div>
<div class="tieziwordbox" v-html="item.content"></div>
<div class="tiezipingbot">
<div
class="teizipingitem flexone"
@click="dianzan(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 }}
</div>
</div>
</div>
</div>
</van-list>
</div>
<div class="commentboxfix flexone">
<div class="writebox">
<input type="text" placeholder="写点什么..." />
<input type="text" placeholder="写点什么..." v-model="comment" />
</div>
<div class="fasend">发送</div>
<div class="fasend" @click="sendcomment">发送</div>
</div>
</div>
</div>
</template>
<script>
import { Toast } from "vant";
export default {
data() {
return {
tiezisel: 1
tiezisel: 1,
forum_id: "",
tiezidetail: "",
page: 1,
loading: false,
finished: false,
showpull: true,
commentlist: [],
// 发送评论
comment: "",
user: "" //用户信息
};
},
created() {
document.title = "帖子详情";
this.forum_id = this.$route.query.id;
console.log(this.forum_id);
// 获取帖子详情
this.getformdetail();
// 获取评论列表
this.getcommentlist();
},
methods: {
seltiekind(id) {
this.tiezisel = id;
},
onLoad() {
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
let newpage = this.page;
newpage++;
this.page = newpage;
this.getcommentlist();
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (this.showpull == false) {
this.finished = true;
}
}, 1000);
},
// 获取帖子详情
getformdetail() {
let that = this;
var url = "/api/forum/get_forum_detail";
var params = {
forum_id: that.forum_id
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {
console.log("111111111", res);
setTimeout(function() {
that.tiezidetail = res.data;
that.user = res.data.user;
}, 200);
})
.catch(err => {
console.log(err);
});
},
// 帖子详情点赞
tiezizan() {
let that = this;
if (that.tiezidetail.is_praise == 2) {
that.tiezidetail.is_praise = 1;
that.tiezidetail.praise = that.tiezidetail.praise + 1;
Toast("点赞成功");
} else {
that.tiezidetail.is_praise = 2;
that.tiezidetail.praise = that.tiezidetail.praise - 1;
Toast("取消点赞成功");
}
that.tiezidetail = that.tiezidetail;
var url = "/api/forum/praise";
var params = {
forum_id: that.forum_id
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {})
.catch(err => {
console.log(err);
});
},
// 获取评论列表
getcommentlist() {
let that = this;
var url = "/api/comments/get_comments";
var params = {
forum_id: that.forum_id,
page: that.page,
pageNum: 10
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {
console.log(res, "评论列表", this.commentlist);
this.commentlist = this.commentlist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false;
}
}
console.log(this.commentlist);
})
.catch(err => {
console.log(err);
});
},
// 发送评论
sendcomment() {
let that = this;
if (that.comment == "") {
Toast("请输入评论内容");
return false;
}
var url = "/api/comments/publish_comments";
var params = {
forum_id: that.forum_id,
content: that.comment
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {
console.log(res);
Toast("评论成功");
that.comment = "";
that.page = 1;
that.commentlist = [];
that.getcommentlist();
})
.catch(err => {
console.log(err);
});
},
// 评论列表点赞
dianzan(item, index) {
let that = this;
console.log(item, index);
if (this.commentlist[index].is_praise == 2) {
Toast("点赞成功");
this.commentlist[index].is_praise = 1;
this.commentlist[index].praise = this.commentlist[index].praise + 1;
} else {
this.commentlist[index].is_praise = 2;
this.commentlist[index].praise = this.commentlist[index].praise - 1;
Toast("取消点赞成功");
}
this.commentlist = this.commentlist;
var url = "/api/comments/praise";
var params = {
comments_id: item.id
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {})
.catch(err => {
console.log(err);
});
},
govideo(src) {
this.$router.push({
path: "/videoplay",
query: { url: src }
});
},
personclick() {
this.$router.push({
path: "/personpage",
query: {
type: 3
type: 3,
userid: this.tiezidetail.user_id
}
});
}
... ...
<template>
<div class="container">
<div class="tiezitop tiezilisttopk">
<div class="hometopbark flextwo">
<div class="homesearch homesearchk flexone">
<img src="../../../assets/sousuo.png" alt="" class="souimg" />
<div class="souenter">请输入关键词搜索</div>
</div>
<div class="searchpro searchprok flexone">
<div class="proname">江苏省</div>
<img src="../../../assets/xiasanjiao.png" alt="" class="xiasanjiao" />
</div>
</div>
<div class="tiezikind flextwo">
<div
class="tiezikinditem"
:class="tiezisel == 1 ? 'tiezikindactive' : ''"
@click="seltiekind(1)"
>
找男友
</div>
<div
class="tiezikinditem"
:class="tiezisel == 2 ? 'tiezikindactive' : ''"
@click="seltiekind(2)"
>
找女友
</div>
</div>
</div>
<div class="tiezhlist">
<div class="tieziitem">
<div class="tiezitop flexone">
<div class="tieziimg">
<img src="../../../assets/touxiang_img@2x.png" alt="" />
</div>
<div class="tieziright">
<div class="tiezirighttop flex">
<div>
<div class="tieziming">中面小麦</div>
<div class="tiezifen">30分钟</div>
</div>
<div>
<div class="vipimg">
<img src="../../../assets/vip_icon@2x.png" alt="" />
<div class="vipname">VIP1</div>
</div>
<div class="tiezizhuan">面坊转让</div>
</div>
<img
src="../../../assets/banggong_icon@2x.png"
class="banggongimg"
alt=""
/>
<img
src="../../../assets/peisong_icon@2x.png"
class="banggongimg"
alt=""
/>
<img
src="../../../assets/yirenzheng_icon@2x.png"
class="banggongimg"
alt=""
/>
</div>
<div class="tiezibto flexone"></div>
</div>
</div>
<div class="tiezicontent">
<div class="teizicontenttop flextwo">
<div class="tiezicontentname">滚滚长江东逝水</div>
<img
src="../../../assets/xingxing_icon@2x.png"
alt=""
class="starimg"
/>
<img
src="../../../assets/weishoucang_icon@2x.png"
alt=""
class="starimg"
/>
</div>
<div class="tieziwordbox">滚滚长江东逝水</div>
<div class="teiziimgbox flexone">
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
<div class="tieziimgimg">
<img src="../../../assets/banner.png" alt="" />
</div>
</div>
<div class="tiezipingbot">
<div class="teizipingitem flexone">
<img
src="../../../assets/pinglun_icon@2x.png"
alt=""
class="lunimg"
/>
1005
</div>
<div class="teizipingitem flexone">
<img
src="../../../assets/zan_icon@2x.png"
alt=""
class="lunimg zanimg"
/>
1005
</div>
<div class="teizipingitem flexone">
<img
src="../../../assets/cai_icon@2x.png"
alt=""
class="lunimg zanimg"
/>
1005
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
tiezisel: 1
};
},
created() {
document.title = "征婚交友";
},
methods: {
seltiekind(id) {
this.tiezisel = id;
}
}
};
</script>
<style scoped>
@import "../../style/homepage.css";
</style>
<template>
<div class="container">
<div class="minetopkkk">
<div class="minetophezi">
<div class="minetophezi" v-if="show">
<div class="flexone">
<div class="tieziimg tieziimgkk">
<img src="../../../assets/touxiang_img@2x.png" alt="" />
<img :src="userinfo.avatar" alt="" />
</div>
<div class="tieziright">
<div class="tiezirighttop flex">
<div>
<div class="tieziming">中面小麦</div>
<div class="tieziming">{{ userinfo.nickname }}</div>
</div>
<div>
<div class="vipimg">
<img src="../../../assets/vip_icon@2x.png" alt="" />
<div class="vipname">VIP1</div>
<div class="vipname">{{ userinfo.level.name1 }}</div>
</div>
</div>
<img
... ... @@ -37,22 +37,21 @@
<div class="tiezibto flexone"></div>
</div>
</div>
<div class="fubulist flextwo">
<div class="fabuitem flexfour">
<div class="fabuname">0</div>
<div class="fabuitem flexfour" @click="goenter(0)">
<div class="fabuname">{{ total1 }}</div>
<div class="fabuname">我的发布</div>
</div>
<div class="fabuitem flexfour">
<div class="fabuname">0</div>
<div class="fabuitem flexfour" @click="goenter(1)">
<div class="fabuname">{{ total2 }}</div>
<div class="fabuname">我的关注</div>
</div>
<div class="fabuitem flexfour">
<div class="fabuname">0</div>
<div class="fabuitem flexfour" @click="goenter(2)">
<div class="fabuname">{{ total3 }}</div>
<div class="fabuname">我的点赞</div>
</div>
<div class="fabuitem flexfour">
<div class="fabuname">0</div>
<div class="fabuitem flexfour" @click="goenter(3)">
<div class="fabuname">{{ total4 }}</div>
<div class="fabuname">我的评论</div>
</div>
</div>
... ... @@ -104,7 +103,17 @@ export default {
tabBar
},
data() {
return {};
return {
userinfo: "",
show: false,
total1: "",
total2: "",
total3: "",
total4: ""
};
},
created() {
this.getuserinfo();
},
methods: {
collect(id) {
... ... @@ -123,6 +132,50 @@ export default {
}
});
}
},
// 获取用户信息
getuserinfo() {
let that = this;
var url = "/api/member/index";
var params = {};
console.log("7766554", params);
that.$axios
.post(url, params)
.then(res => {
that.userinfo = res.data;
setTimeout(function() {
that.show = true;
}, 50);
// 获取帖子数量
that.gettiezinum();
})
.catch(err => {});
},
// 获取帖子数量
gettiezinum() {
let that = this;
var url = "/api/forum/get_total";
var params = {};
console.log("7766554", params);
that.$axios
.post(url, params)
.then(res => {
console.log(res);
that.total1 = res.data.total1;
that.total2 = res.data.total2;
that.total3 = res.data.total3;
that.total4 = res.data.total4;
})
.catch(err => {});
},
// 进入我的收藏
goenter(id) {
this.$router.push({
path: "/mycollect",
query: {
type: id
}
});
}
}
};
... ...
<template>
<div class="container">
<div class="mycollectlist">
<div class="tieziitem mycollectitem">
<div class="flextwo mykind">
<div
class="fenleiword"
:class="fenlei == 0 ? 'fenleiactive' : ''"
@click="getfen(0)"
>
我的发布
</div>
<div
class="fenleiword"
:class="fenlei == 1 ? 'fenleiactive' : ''"
@click="getfen(1)"
>
我的关注
</div>
<div
class="fenleiword"
:class="fenlei == 2 ? 'fenleiactive' : ''"
@click="getfen(2)"
>
我的点赞
</div>
<div
class="fenleiword"
:class="fenlei == 3 ? 'fenleiactive' : ''"
@click="getfen(3)"
>
我的评论
</div>
</div>
<div class="nodata" v-if="tiezilist.length == 0">暂无数据</div>
<div class="mycollectlist" v-else>
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<mytiezi :tiezilist="tiezilist" :showpull="showpull" :fenlei="fenlei" />
</van-list>
<!-- <div class="tieziitem mycollectitem">
<div class="tiezitop flexone">
<div class="tieziimg">
<img src="../../../assets/touxiang_img@2x.png" alt="" />
... ... @@ -98,15 +137,190 @@
</div>
</div>
</div>
</div>
</div> -->
</div>
</div>
</template>
<script>
export default {};
import mytiezi from "@/components/mytiezi.vue";
export default {
components: {
mytiezi
},
data() {
return {
page: 1,
tiezilist: [],
showpull: true,
loading: false,
finished: false,
fenlei: 0,
tiezilist: []
};
},
created() {
this.fenlei = this.$route.query.type;
if (this.fenlei == 0) {
this.getfabu();
} else if (this.fenlei == 1) {
this.getguanzhu();
} else if (this.fenlei == 2) {
this.getdainzian();
} else if (this.fenlei == 3) {
this.getpinglun();
}
},
methods: {
onLoad() {
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
let newpage = this.page;
newpage++;
this.page = newpage;
if (this.fenlei == 0) {
this.getfabu();
} else if (this.fenlei == 1) {
this.getguanzhu();
} else if (this.fenlei == 2) {
this.getdainzian();
} else if (this.fenlei == 3) {
this.getpinglun();
}
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (this.showpull == false) {
this.finished = true;
}
}, 1000);
},
// 头部切换
getfen(id) {
this.fenlei = id;
this.page = 1;
this.tiezilist = [];
if (this.fenlei == 0) {
this.getfabu();
} else if (this.fenlei == 1) {
this.getguanzhu();
} else if (this.fenlei == 2) {
this.getdainzian();
} else if (this.fenlei == 3) {
this.getpinglun();
}
},
// 获取我的发布
getfabu() {
let that = this;
var url = "/api/forum/get_my_forum";
var params = {
page: that.page,
pageNum: 10
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {
console.log(res);
that.tiezilist = that.tiezilist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false;
}
}
})
.catch(err => {
console.log(err);
});
},
// 获取我的关注
getguanzhu() {
let that = this;
var url = "/api/forum/get_my_forum_attention";
var params = {
page: that.page,
pageNum: 10
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {
console.log(res);
that.tiezilist = that.tiezilist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false;
}
}
})
.catch(err => {
console.log(err);
});
},
// 获取论我的点赞
getdainzian() {
let that = this;
var url = "/api/forum/get_my_forum_praise";
var params = {
page: that.page,
pageNum: 10
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {
console.log(res);
that.tiezilist = that.tiezilist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false;
}
}
})
.catch(err => {
console.log(err);
});
},
// 获取我的评论
getpinglun() {
let that = this;
var url = "/api/forum/get_my_forum_comments";
var params = {
page: that.page,
pageNum: 10
};
console.log("参数", params);
that.$axios
.post(url, params)
.then(res => {
console.log(res);
that.tiezilist = that.tiezilist.concat(res.data);
if (that.page > 1) {
if (res.data.length == 0) {
that.showpull = false;
}
}
})
.catch(err => {
console.log(err);
});
}
}
};
</script>
<style scoped>
@import "../../style/homepage.css";
.mycollectlist {
margin-top: 1rem;
}
.nodata {
color: #999;
font-size: 0.28rem;
text-align: center;
margin-top: 1.5rem;
}
</style>
... ...
... ... @@ -13,11 +13,12 @@ Vue.use(Vant);
// let vConsole = new Vconsole();
// Vue.use(vConsole);
// import { service } from "./utils/commonsec.js";
// Vue.prototype.$http = service;
// import { uploadFile } from "./utils/commonsec.js";
// Vue.prototype.$uploadFile = uploadFile;
import { service } from "./utils/commonsec.js";
Vue.prototype.$http = service;
// sessionStorage.setItem(
// "token",
// "85354709f184e1471f90a2048eb07b0f6cab95df279ec53d26b642ad080eed4d"
// );
import axios from "./utils/common.js";
Vue.prototype.$axios = axios;
... ... @@ -28,30 +29,26 @@ import uploadFile from "./utils/common.js";
Vue.prototype.$uploadFile = uploadFile;
Vue.config.productionTip = false;
console.log(8888);
sessionStorage.setItem(
"token",
"85354709f184e1471f90a2048eb07b0f6cab95df279ec53d26b642ad080eed4d"
);
let token = sessionStorage.getItem("token");
// router.beforeEach((to, from, next) => {
// const token = sessionStorage.getItem("token");
// console.log("我是token", token);
// console.log(to);
// console.log(next());
// if (!token) {
// if (to.path === "/login") {
// next();
// } else {
// sessionStorage.setItem("now_url", to.fullPath); //当前页url与参数放入缓存
// next("/login");
// }
// } else {
// next();
// }
// });
router.beforeEach((to, from, next) => {
const token = sessionStorage.getItem("token");
console.log("我是token", token);
console.log(to);
console.log(next());
if (!token) {
if (to.path === "/login") {
next();
} else {
sessionStorage.setItem("now_url", to.fullPath); //当前页url与参数放入缓存
next("/login");
}
} else {
next();
}
});
/* eslint-disable no-new */
new Vue({
... ...
... ... @@ -37,26 +37,20 @@ export default new Router({
require(["@/components/views/mine/index.vue"], resolve)
},
{
path: "/publish",
name: "publish",
path: "/videoplay",
name: "videoplay",
meta: { title: "中国面条" },
component: resolve =>
require(["@/components/views/homepage/publish.vue"], resolve)
require(["@/components/views/homepage/videoplay.vue"], resolve)
},
{
path: "/banggonglist",
name: "banggonglist",
meta: { title: "中国面条" },
component: resolve =>
require(["@/components/views/homepage/banggonglist.vue"], resolve)
},
{
path: "/zhenghunlist",
name: "zhenghunlist",
path: "/publish",
name: "publish",
meta: { title: "中国面条" },
component: resolve =>
require(["@/components/views/homepage/zhenghunlist.vue"], resolve)
require(["@/components/views/homepage/publish.vue"], resolve)
},
{
path: "/mianfanglsit",
name: "mianfanglsit",
... ...