| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <view class="con">
- <view class="search ddflex">
- <image src="../../static/images/ssico.png" class="ssico"></image>
- <input v-model="cTitle" placeholder="自定义话题" @input="inputTopicText" placeholder-class="placeholder" class="ipt fflex" />
- <!-- <view class="clear">取消</view> -->
- </view>
- <view class="new" v-if="cTitle && havePermissionTopic">
- <view class="tip">没有找到想要参与的话题?</view>
- <view class="create" @click="getSaveTopic()">
- 创建新话题:
- <text>{{ cTitle }}</text>
- </view>
- </view>
- <view class="list">
- <view class="li ddflex" @click="selectedBack('')">
- <image src="../static/images/ht_no.png"></image>
- <view class="fflex tover">不参与任何话题</view>
- </view>
- <view class="li ddflex" v-for="(item, index) in topicList" :key="index" @click="selectedBack(item)">
- <image src="../static/images/ht_ico.png"></image>
- <view class="fflex tover">{{ item.title }}</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- const app = getApp();
- const api = require('../../utils/api.js');
- const req = require('../../utils/request.js');
- export default {
- data() {
- return {
- isLoad: true,
- form: {
- // page: 1,
- // limit: 10
- },
- topicList: [],
- cTitle: '', //输入的话题关键词
-
- havePermissionTopic:false,//是否有创建话题的权限
- };
- },
- onLoad() {
- this.getListTopic();
- this.getUserPermission()
- },
- onReachBottom() {
- this.form.page++;
- this.getListTopic();
- },
- methods: {
- getUserPermission(){
- req.getRequest('/api/user/getUserPermission',{},res=>{
- if(res){
- this.havePermissionTopic = res.map(item=>item.permissions).indexOf('sys:topic')>-1?true:false
- }
- })
- },
- // 监听获取话题输入
- inputTopicText(e) {
- this.isLoad = true;
- this.form.page = 1;
- this.getListTopic();
- },
- selectedBack(obj) {
- let pages = getCurrentPages(); //获取所有页面栈实例列表
- let prevPage = pages[pages.length - 2]; //上一页页面实例
- prevPage.$vm.htObj = obj; //修改上一页data里面的searchVal参数值为1211
- uni.navigateBack({
- //uni.navigateTo跳转的返回,默认1为返回上一级
- delta: 1
- });
- },
- getListTopic() {
- if (!this.isLoad) return false;
- this.isLoad = false;
- let that = this;
- if (this.cTitle) {
- this.form.dialogue = this.cTitle;
- } else {
- this.form.dialogue = '';
- }
- this.form.poiLongitude = req.getStorage('loctionAddressMap').location.lng;
- this.form.poiLatitude = req.getStorage('loctionAddressMap').location.lat;
- // this.form.orderType=1;
- // '/api/v3/dialogue/list'
- req.getRequest('/api/v3/dialogue/list', this.form, data => {
- if (data && data.length >= this.form.limit) {
- this.isLoad = true;
- }
- if (that.form.page > 1) {
- data = that.topicList.concat(data);
- }
- that.topicList = data;
- });
- },
- getSaveTopic() {
- var dataP = {
- title: this.cTitle
- };
- req.postRequest('/api/v3/dialogue/save', dataP, data => {
- this.selectedBack(data);
- });
- }
- }
- };
- </script>
- <style>
- @import './topic.css';
- </style>
|