1.问答
parent
29eb2d576b
commit
958a99f535
|
|
@ -299,7 +299,8 @@ button:before {
|
|||
.bottom-fixed {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
/* bottom: 0; */
|
||||
bottom: var(--window-bottom);
|
||||
border: none;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
|
@ -1264,7 +1265,11 @@ button[disabled].bg-grey {
|
|||
.divider-l-f5,
|
||||
.divider-r-f5,
|
||||
.divider-t-f5,
|
||||
.divider-b-f5 {
|
||||
.divider-b-f5,
|
||||
.divider-l-d,
|
||||
.divider-r-d,
|
||||
.divider-t-d,
|
||||
.divider-b-d {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
|
@ -1275,8 +1280,16 @@ button[disabled].bg-grey {
|
|||
background: #f5f5f5 !important;
|
||||
}
|
||||
|
||||
.divider-l-d::before,
|
||||
.divider-r-d::after,
|
||||
.divider-t-d::before,
|
||||
.divider-b-d::after {
|
||||
background: #dddddd !important;
|
||||
}
|
||||
|
||||
.divider-l::before,
|
||||
.divider-l-f5::before {
|
||||
.divider-l-f5::before,
|
||||
.divider-l-d::before {
|
||||
content: '';
|
||||
width: 2rpx;
|
||||
height: 65%;
|
||||
|
|
@ -1288,7 +1301,8 @@ button[disabled].bg-grey {
|
|||
}
|
||||
|
||||
.divider-r::after,
|
||||
.divider-r-f5::after {
|
||||
.divider-r-f5::after,
|
||||
.divider-r-d::after {
|
||||
content: '';
|
||||
width: 2rpx;
|
||||
height: 65%;
|
||||
|
|
@ -1300,7 +1314,8 @@ button[disabled].bg-grey {
|
|||
}
|
||||
|
||||
.divider-t::before,
|
||||
.divider-t-f5::before {
|
||||
.divider-t-f5::before,
|
||||
.divider-t-d::before {
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
|
|
@ -1310,7 +1325,8 @@ button[disabled].bg-grey {
|
|||
}
|
||||
|
||||
.divider-b::after,
|
||||
.divider-b-f5::after {
|
||||
.divider-b-f5::after,
|
||||
.divider-b-d::after {
|
||||
content: '';
|
||||
width: 100%;
|
||||
height: 2rpx;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
/* iconfont.css全局注册需要将src切换成绝对路径 */
|
||||
/* @/static/icon/ */
|
||||
/* @import url('@/static/icon/iconfont.css'); */
|
||||
@import url('https://at.alicdn.com/t/c/font_4227145_klds40ixeqs.css');
|
||||
@import url('https://at.alicdn.com/t/c/font_4227145_6avx91bpfzb.css');
|
||||
|
||||
.iconfont {
|
||||
display: inline-block;
|
||||
|
|
|
|||
66
pages.json
66
pages.json
|
|
@ -159,27 +159,6 @@
|
|||
"navigationBarTitleText": "商品收藏"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user-answer-list/user-answer-list",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "我的留言"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/answer-list/answer-list",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "问答广场"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/answer-form/answer-form",
|
||||
"style": {
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationBarTitleText": "留言"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/message/message",
|
||||
"style": {
|
||||
|
|
@ -289,6 +268,30 @@
|
|||
"enablePullDownRefresh": false,
|
||||
"navigationBarTitleText": "账号注销"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user-answers-form/user-answers-form",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "我要提问"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user-answers-detail/user-answers-detail",
|
||||
"style": {
|
||||
// #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || H5 || APP
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "提问详情"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user-answers-question/user-answers-question",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "我的提问"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [{
|
||||
|
|
@ -962,6 +965,27 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/plugins/answers",
|
||||
"pages": [{
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
// #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || H5 || APP
|
||||
"navigationStyle": "custom",
|
||||
// #endif
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "问答"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "detail/detail",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "问答详情"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,17 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="" :style="'padding-top:' + (status_bar_height > 0 ? status_bar_height + 5 : 10) + 'px;'">
|
||||
<!-- 返回 -->
|
||||
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-KUAISHOU || H5 || APP -->
|
||||
<view v-if="is_realstore_top_nav_back == 1" class="nav-back padding-horizontal-main padding-top-sm round va-m pr top-sm" @tap="top_nav_left_back_event">
|
||||
<iconfont name="icon-tongyong-fanhui" size="32rpx"></iconfont>
|
||||
</view>
|
||||
<view>
|
||||
<!-- #ifdef H5 -->
|
||||
<component-search @onsearch="search_button_event" :propIsRequired="false" propIconColor="#333" propPlaceholderClass="cr-grey-c" propPlaceholder="搜索..." propBgColor="#f6f6f6"></component-search>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view :scroll-y="true" class="scroll-box" @scrolltolower="scroll_lower" lower-threshold="60">
|
||||
<view v-if="data_list.length > 0" class="padding-horizontal-main padding-top-main">
|
||||
<view v-for="(item, index) in data_list" :key="index" class="padding-main border-radius-main bg-white oh spacing-mb">
|
||||
|
|
@ -26,149 +38,155 @@
|
|||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from "../../components/no-data/no-data";
|
||||
import componentBottomLine from "../../components/bottom-line/bottom-line";
|
||||
const app = getApp();
|
||||
import componentNoData from '../../components/no-data/no-data';
|
||||
import componentBottomLine from '../../components/bottom-line/bottom-line';
|
||||
import componentSearch from '@/components/search/search';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_is_loading: 0,
|
||||
};
|
||||
},
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
status_bar_height: parseInt(app.globalData.get_system_info('statusBarHeight', 0)),
|
||||
// 顶部导航返回按钮
|
||||
is_realstore_top_nav_back: app.globalData.data.is_realstore_top_nav_back || 0,
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_is_loading: 0,
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
},
|
||||
props: {},
|
||||
components: {
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentSearch,
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad() {},
|
||||
onLoad() {},
|
||||
|
||||
onShow() {
|
||||
this.get_data_list();
|
||||
onShow() {
|
||||
this.get_data_list();
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
methods: {
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data_bottom_line_status == true) {
|
||||
uni.stopPullDownRefresh();
|
||||
methods: {
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data_bottom_line_status == true) {
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 是否加载中
|
||||
if (this.data_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_is_loading: 1,
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
||||
// 是否加载中
|
||||
if (this.data_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
data_is_loading: 1,
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("square", "answer"),
|
||||
method: "POST",
|
||||
data: {
|
||||
page: this.data_page,
|
||||
},
|
||||
dataType: "json",
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'index', 'answer'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
page: this.data_page,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data_page + 1,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
this.setData({
|
||||
data_bottom_line_status: this.data_page > 1 && this.data_page > this.data_page_total,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
}
|
||||
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data_page + 1,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
this.setData({
|
||||
data_bottom_line_status: this.data_page > 1 && this.data_page > this.data_page_total,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_status: 2,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, "get_data_list")) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
app.globalData.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 头像加载错误
|
||||
user_avatar_error(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var temp_data_list = this.data_list;
|
||||
for (var i in temp_data_list) {
|
||||
if (i == index) {
|
||||
temp_data_list[i]['user']['avatar'] = app.globalData.data.default_user_head_src;
|
||||
break;
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 头像加载错误
|
||||
user_avatar_error(e) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var temp_data_list = this.data_list;
|
||||
for (var i in temp_data_list) {
|
||||
if (i == index) {
|
||||
temp_data_list[i]["user"]["avatar"] = app.globalData.data.default_user_head_src;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
});
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
});
|
||||
},
|
||||
search_button_event() {},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import "./answer-list.css";
|
||||
@import './answer-list.css';
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@
|
|||
<view class="botton-nav round pa oh flex-row jc-sb align-c z-i">
|
||||
<view class="flex-row align-c flex-1 flex-width">
|
||||
<view class="cart pr cp top-sm" @tap="cart_event">
|
||||
<iconfont name="icon-applet-shop-acquiesce" size="36rpx" color="#fff"></iconfont>
|
||||
<iconfont name="icon-applet-shop-acquiesce" size="36rpx" color="#666"></iconfont>
|
||||
<view v-if="(cart || null) != null && (cart.buy_number || 0) != 0" class="badge-icon pa">
|
||||
<component-badge :propNumber="cart.buy_number"></component-badge>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
.admin-img {
|
||||
width: 68rpx;
|
||||
height: 68rpx !important;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 猜你喜欢
|
||||
*/
|
||||
.guess-like {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.guess-like::before,
|
||||
.guess-like::after {
|
||||
content: "";
|
||||
width: 76px;
|
||||
height: 1px;
|
||||
background: #dddddd;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.guess-like::before {
|
||||
left: calc(100% + 20rpx);
|
||||
}
|
||||
|
||||
.guess-like::after {
|
||||
right: calc(100% + 20rpx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 底部按钮
|
||||
*/
|
||||
.answers-btn {
|
||||
height: 142rpx;
|
||||
box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.bottom-line {
|
||||
padding-bottom: calc(142rpx + var(--window-bottom));
|
||||
}
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="bg-white padding-main" :style="'padding-top:' + (status_bar_height > 0 ? status_bar_height + 5 : 10) + 'px;'">
|
||||
<view class="flex-row align-c">
|
||||
<!-- 返回 -->
|
||||
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-KUAISHOU || H5 || APP -->
|
||||
<view v-if="is_realstore_top_nav_back == 1" class="nav-back margin-right-main round va-m pr top-sm" @tap="top_nav_left_back_event">
|
||||
<iconfont name="icon-tongyong-fanhui" size="32rpx"></iconfont>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- true为空对象 false为非空对象 Object.keys(detail_data).length == 0 -->
|
||||
<view v-if="Object.keys(detail_data).length !== 0" class="answers-container bg-white spacing-mb">
|
||||
<view class="padding-main br-b-dashed">
|
||||
<view class="fw-b text-size-xl spacing-mb">{{ detail_data.title }}</view>
|
||||
<view class="cr-grey-9 text-size-xs margin-bottom-sm flex-row">
|
||||
留言时间: {{ detail_data.add_time_date }}
|
||||
<view class="fw-b padding-horizontal-xs">·</view>
|
||||
{{ detail_data.access_count || '0' }}浏览
|
||||
</view>
|
||||
<view class="text-size-md">{{ detail_data.content }}</view>
|
||||
</view>
|
||||
<view v-if="detail_data.is_reply && detail_data.is_reply === '1'" class="padding-main">
|
||||
<view class="flex-row jc-sb align-c">
|
||||
<view class="flex-row align-c">
|
||||
<image :src="answers_static_url + 'admin.png'" mode="widthFix" class="admin-img margin-right-sm"></image>
|
||||
<text>管理员</text>
|
||||
</view>
|
||||
<view class="cr-grey-9 text-size-xs">回复时间: {{ detail_data.reply_time_date }}</view>
|
||||
</view>
|
||||
<view class="text-size-md padding-top-main">{{ detail_data.reply }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 猜你喜欢 -->
|
||||
<view v-if="goods_list.length > 0" class="padding-horizontal-main">
|
||||
<view class="tc">
|
||||
<view class="guess-like fw-b text-size-md">猜你喜欢</view>
|
||||
</view>
|
||||
<component-goods-list
|
||||
class="padding-top-main"
|
||||
:propData="{ style_type: 1, goods_list: goods_list, random: random_value }"
|
||||
:propLabel="plugins_label_data"
|
||||
:propCurrencySymbol="currency_symbol"
|
||||
:propIsCartParaCurve="true"
|
||||
propSource="detail"
|
||||
@CartSuccessEvent="cart_success_event"
|
||||
></component-goods-list>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status" class="bottom-line"></component-bottom-line>
|
||||
</view>
|
||||
<view class="bottom-fixed flex-row jc-sa align-c bg-white text-size fw-b">
|
||||
<navigator url="/pages/user-answers-form/user-answers-form" hover-class="none" class="flex-1 tc answers-btn flex-col jc-c align-c">
|
||||
<view class="divider-r-d">
|
||||
<iconfont name="icon-wenda-wytw" size="30rpx" color="#333" class="margin-right-sm"></iconfont>
|
||||
我要提问
|
||||
</view>
|
||||
</navigator>
|
||||
<navigator url="/pages/user-answers-question/user-answers-question" hover-class="none" class="flex-1 tc answers-btn flex-col jc-c align-c">
|
||||
<view>
|
||||
<iconfont name="icon-wenda-wdtw" size="32rpx" color="#333" class="margin-right-sm pr top-xs"></iconfont>
|
||||
我的提问
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentGoodsList from '@/components/goods-list/goods-list';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
answers_static_url: app.globalData.get_static_url('answers', true),
|
||||
status_bar_height: parseInt(app.globalData.get_system_info('statusBarHeight', 0)),
|
||||
// 顶部导航返回按钮
|
||||
is_realstore_top_nav_back: app.globalData.data.is_realstore_top_nav_back || 0,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: true,
|
||||
detail_data: {},
|
||||
// 基础配置
|
||||
currency_symbol: app.globalData.data.currency_symbol,
|
||||
// 猜你喜欢 参数
|
||||
goods_list: [],
|
||||
goods_is_loading: 0,
|
||||
goods_total: 0,
|
||||
goods_page_total: 0,
|
||||
goods_page: 1,
|
||||
// 标签插件
|
||||
plugins_label_data: null,
|
||||
// 增加随机数,避免无法监听数据列表内部数据更新
|
||||
random_value: 0,
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentGoodsList,
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
onShow() {},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {},
|
||||
|
||||
methods: {
|
||||
get_data(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.goods_bottom_line_status == true) {
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 是否加载中
|
||||
if (this.goods_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
goods_is_loading: 1,
|
||||
});
|
||||
// 获取数据
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('detail', 'index', 'answers'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: this.$route.query.id,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
let data = res.data.data;
|
||||
this.setData({
|
||||
detail_data: data.data,
|
||||
goods_list: data.goods,
|
||||
data_list_loding_status: 3,
|
||||
goods_is_loading: 0,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
goods_is_loading: 0,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
uni.hideLoading();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
goods_is_loading: 0,
|
||||
});
|
||||
app.globalData.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 猜你喜欢加入购物车回调
|
||||
cart_success_event() {
|
||||
// 传1表示为购物车回调方法调用的此方法
|
||||
this.get_data(1);
|
||||
},
|
||||
top_nav_left_back_event() {
|
||||
var pages = getCurrentPages();
|
||||
if (pages.length <= 1) {
|
||||
uni.switchTab({
|
||||
url: app.globalData.data.tabbar_pages[0],
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './detail.css';
|
||||
</style>
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
.avatar {
|
||||
width: 35rpx;
|
||||
height: 35rpx;
|
||||
}
|
||||
|
||||
.scroll-box {
|
||||
height: calc(100vh - 314rpx - var(--status-bar-height) - var(--window-bottom));
|
||||
}
|
||||
|
||||
.status .answers-status {
|
||||
padding: 4rpx 10rpx;
|
||||
}
|
||||
|
||||
.answers-bg-green {
|
||||
background-color: #5FB95E;
|
||||
}
|
||||
|
||||
.answers-bg-yellow {
|
||||
background-color: #FAAD14;
|
||||
}
|
||||
|
||||
.status .num {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.answers-hot {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
line-height: 32rpx;
|
||||
color: #FFB868;
|
||||
}
|
||||
|
||||
.hot-bg-0 {
|
||||
background: linear-gradient(150deg, #FC6761 0%, #ED4540 100%);
|
||||
}
|
||||
|
||||
.hot-bg-1 {
|
||||
background: linear-gradient(150deg, #FFA12A 0%, #FF8605 100%);
|
||||
}
|
||||
|
||||
.hot-bg-2 {
|
||||
background: linear-gradient(150deg, #FFCE90 0%, #FFAA4E 100%);
|
||||
}
|
||||
|
||||
/**
|
||||
* 底部按钮
|
||||
*/
|
||||
.answers-btn {
|
||||
height: 142rpx;
|
||||
box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
|
@ -0,0 +1,276 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="bg-white padding-horizontal-main padding-top-main" :style="'padding-top:' + (status_bar_height > 0 ? status_bar_height + 5 : 10) + 'px;'">
|
||||
<view class="flex-row align-c spacing-mb">
|
||||
<!-- 返回 -->
|
||||
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-KUAISHOU || H5 || APP -->
|
||||
<view v-if="is_realstore_top_nav_back == 1" class="nav-back margin-right-main round va-m pr top-sm" @tap="top_nav_left_back_event">
|
||||
<iconfont name="icon-tongyong-fanhui" size="32rpx"></iconfont>
|
||||
</view>
|
||||
<!-- #ifdef H5 -->
|
||||
<component-search class="flex-1 flex-width" @onsearch="search_button_event" propIsOnEvent :propIsRequired="false" propIconColor="#ccc" propPlaceholderClass="cr-grey-c" propBgColor="#f6f6f6"></component-search>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<view v-if="nav_list.length > 0" class="answers-type flex-row jc-sa align-c">
|
||||
<view v-for="(item, index) in nav_list" :key="index" class="flex-1 padding-vertical-sm tc" :class="nav_index === index ? 'cr-main fw-b nav-active-line' : 'cr-base'" :data-index="index" :data-type="item.type" @tap="nav_change_event">{{ item.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view :scroll-y="true" class="scroll-box" @scrolltolower="scroll_lower" lower-threshold="60">
|
||||
<view v-if="data_list.length > 0" class="padding-horizontal-main padding-top-main">
|
||||
<block v-for="(item, index) in data_list" :key="index">
|
||||
<navigator :url="'/pages/plugins/answers/detail/detail?id=' + item.id" hover-class="none" class="padding-main border-radius-main bg-white oh spacing-mb flex-row">
|
||||
<view v-if="nav_index === 1">
|
||||
<view class="answers-hot border-radius-sm tc margin-right-sm va-m pr top-md" :class="index < 3 ? 'cr-white text-size-xs hot-bg-' + index : 'text-size-md'">{{ index + 1 }}</view>
|
||||
</view>
|
||||
<view class="flex-1 flex-width">
|
||||
<view class="title text-size fw-b">{{ item.title }}</view>
|
||||
<view class="content cr-base margin-top-sm padding-top-xs multi-text">{{ item.content }}</view>
|
||||
<view class="status flex-row align-c spacing-mt text-size-xs">
|
||||
<view v-if="nav_index !== 1" class="answers-status cr-white border-radius-sm text-size-xss" :class="item.is_reply === '1' ? 'answers-bg-green' : 'answers-bg-yellow'">{{ item.is_reply === '1' ? '已回' : '未回' }}</view>
|
||||
<view class="num cr-grey-9 flex-row self-c">
|
||||
{{ item.add_time_date }}
|
||||
<view class="fw-b padding-horizontal-xs">·</view>
|
||||
{{ item.access_count || '0' }}浏览
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</block>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
</scroll-view>
|
||||
<view class="bottom-fixed flex-row jc-sa align-c bg-white text-size fw-b">
|
||||
<navigator url="/pages/user-answers-form/user-answers-form" hover-class="none" class="flex-1 tc answers-btn flex-col jc-c align-c">
|
||||
<view class="divider-r-d">
|
||||
<iconfont name="icon-wenda-wytw" size="30rpx" color="#333" class="margin-right-sm"></iconfont>
|
||||
我要提问
|
||||
</view>
|
||||
</navigator>
|
||||
<navigator url="/pages/user-answers-question/user-answers-question" hover-class="none" class="flex-1 tc answers-btn flex-col jc-c align-c">
|
||||
<view>
|
||||
<iconfont name="icon-wenda-wdtw" size="32rpx" color="#333" class="margin-right-sm pr top-xs"></iconfont>
|
||||
我的提问
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
import componentSearch from '@/components/search/search';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
status_bar_height: parseInt(app.globalData.get_system_info('statusBarHeight', 0)),
|
||||
// 顶部导航返回按钮
|
||||
is_realstore_top_nav_back: app.globalData.data.is_realstore_top_nav_back || 0,
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_is_loading: 0,
|
||||
// 导航分类
|
||||
nav_list: [],
|
||||
nav_index: 0,
|
||||
nav_type: '',
|
||||
// 搜索框关键字
|
||||
search_bwg: '',
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
componentSearch,
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad() {},
|
||||
|
||||
onShow() {
|
||||
this.get_nav_list();
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
methods: {
|
||||
get_nav_list() {
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'index', 'answers'),
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.search_tab_list.length > 0) {
|
||||
this.setData({
|
||||
nav_list: res.data.data.search_tab_list || [],
|
||||
});
|
||||
this.get_data_list();
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
app.globalData.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
},
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data_bottom_line_status == true) {
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 是否加载中
|
||||
if (this.data_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
data_is_loading: 1,
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('datalist', 'index', 'answers'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
page: this.data_page,
|
||||
type: this.nav_type,
|
||||
bwd: this.search_bwg,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data_page + 1,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
this.setData({
|
||||
data_bottom_line_status: this.data_page > 1 && this.data_page > this.data_page_total,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
app.globalData.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 查询
|
||||
search_button_event(e) {
|
||||
this.setData({
|
||||
search_bwg: e || '',
|
||||
data_page: 1,
|
||||
});
|
||||
this.reset_scroll();
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 重置滑动位置
|
||||
reset_scroll() {
|
||||
this.setData({
|
||||
scroll_top: this.scroll_top_old,
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
this.setData({
|
||||
scroll_top: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 顶部返回操作
|
||||
top_nav_left_back_event(e) {
|
||||
var pages = getCurrentPages();
|
||||
if (pages.length <= 1) {
|
||||
uni.switchTab({
|
||||
url: app.globalData.data.tabbar_pages[0],
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
nav_change_event(e) {
|
||||
// 索引值
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var type = e.currentTarget.dataset.type || 0;
|
||||
this.setData({
|
||||
nav_index: index,
|
||||
nav_type: type,
|
||||
data_page: 1,
|
||||
});
|
||||
this.reset_scroll();
|
||||
this.get_data_list(1);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './index.css';
|
||||
</style>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
/**
|
||||
* 导航
|
||||
*/
|
||||
.nav-top {
|
||||
background: linear-gradient(180deg, #FF4A4A 0%, #FF5858 53%, #F5F5F5 100%);
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
<template>
|
||||
<view :style="'padding-top:' + (status_bar_height > 0 ? status_bar_height + 5 : 10) + 'px;'">
|
||||
<view class="pa top-0 left-0 right-0 nav-top">
|
||||
<image mode="widthFix" :src="answers_static_url + 'nav-top.png'" class="wh-auto"></image>
|
||||
</view>
|
||||
<!-- 返回 -->
|
||||
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-KUAISHOU || H5 || APP -->
|
||||
<view v-if="is_realstore_top_nav_back == 1" class="nav-back padding-left-main round va-m pr top-sm cr-white" @tap="top_nav_left_back_event">
|
||||
<iconfont name="icon-tongyong-fanhui" size="32rpx"></iconfont>
|
||||
</view>
|
||||
<view class="padding-main pr z-i margin-top-main">
|
||||
<view class="bg-white border-radius-main padding-main text-size">
|
||||
<view class="fw-b text-size-lg spacing-mb">提问详情</view>
|
||||
<view class="spacing-mb">
|
||||
<view class="cr-grey-9">联系人</view>
|
||||
<view class="">李小雨</view>
|
||||
</view>
|
||||
<view class="spacing-mb">
|
||||
<view class="cr-grey-9">联系电话</view>
|
||||
<view class="">15555555555</view>
|
||||
</view>
|
||||
<view class="spacing-mb">
|
||||
<view class="cr-grey-9">标题</view>
|
||||
<view class="">国庆中秋怎么过</view>
|
||||
</view>
|
||||
<view class="spacing-mb">
|
||||
<view class="cr-grey-9">内容</view>
|
||||
<view class="">这是一个demo</view>
|
||||
</view>
|
||||
<view class="spacing-mb">
|
||||
<view class="cr-grey-9">回复内容</view>
|
||||
<view class="">这是demo</view>
|
||||
</view>
|
||||
<view class="spacing-mb">
|
||||
<view class="cr-grey-9">回复时间</view>
|
||||
<view class="">2023-09-20 15:18:50</view>
|
||||
</view>
|
||||
<view class="spacing-mb">
|
||||
<view class="cr-grey-9">创建时间</view>
|
||||
<view class="">2023-09-20 15:18:50</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
answers_static_url: app.globalData.get_static_url('answers', true),
|
||||
status_bar_height: parseInt(app.globalData.get_system_info('statusBarHeight', 0)),
|
||||
// 顶部导航返回按钮
|
||||
is_realstore_top_nav_back: app.globalData.data.is_realstore_top_nav_back || 0,
|
||||
detail_data: {},
|
||||
data_list_loding_status: 1,
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData,
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad() {},
|
||||
|
||||
onShow() {
|
||||
this.init();
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1,
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
methods: {
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.globalData.user_is_need_login(user)) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login?event_callback=init',
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
get_data_list(is_mandatory) {},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 顶部返回操作
|
||||
top_nav_left_back_event(e) {
|
||||
var pages = getCurrentPages();
|
||||
if (pages.length <= 1) {
|
||||
uni.switchTab({
|
||||
url: app.globalData.data.tabbar_pages[0],
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './user-answers-detail.css';
|
||||
</style>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
.form-container .form-gorup .textarea-height {
|
||||
height: 400rpx !important;
|
||||
}
|
||||
|
||||
.form-btn {
|
||||
padding: 30rpx 90rpx;
|
||||
}
|
||||
|
||||
.form-btn button {
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
padding: 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
<template>
|
||||
<view>
|
||||
<form v-if="data_list_loding_status == 0" @submit="formSubmit" class="form-container">
|
||||
<view class="padding-main oh">
|
||||
<view class="form-gorup spacing-mb border-radius-main flex-row jc-sb align-c">
|
||||
<view class="form-gorup-title padding-right-main text-size cr-black">联系人<text class="form-group-tips-must">*</text></view>
|
||||
<input type="text" class="cr-base flex-1 flex-width tr" name="name" maxlength="30" placeholder="联系人格式 1~30 个字符之间" placeholder-class="cr-grey-9" />
|
||||
</view>
|
||||
|
||||
<view class="form-gorup spacing-mb border-radius-main flex-row jc-sb align-c">
|
||||
<view class="form-gorup-title padding-right-main text-size cr-black">联系电话<text class="form-group-tips-must">*</text></view>
|
||||
<input type="text" class="cr-base flex-1 flex-width tr" name="tel" maxlength="30" placeholder-class="cr-grey-9" placeholder="座机 或 手机" />
|
||||
</view>
|
||||
|
||||
<view class="form-gorup spacing-mb border-radius-main flex-row jc-sb align-c">
|
||||
<view class="form-gorup-title padding-right-main text-size cr-black">标题<text class="form-group-tips-must">*</text></view>
|
||||
<input type="text" class="cr-base flex-1 flex-width tr" name="title" maxlength="30" placeholder-class="cr-grey-9" placeholder="请输入标题" />
|
||||
</view>
|
||||
|
||||
<view class="form-gorup spacing-mb border-radius-main">
|
||||
<view class="form-gorup-title text-size cr-black">描述<text class="form-group-tips-must">*</text></view>
|
||||
<textarea class="cr-base textarea-height" name="content" maxlength="160" placeholder-class="cr-grey-9" placeholder="请详细描述问题,我们将尽快为您解答!"></textarea>
|
||||
</view>
|
||||
|
||||
<view class="form-gorup form-gorup-submit bottom-fixed form-btn bg-white">
|
||||
<button class="bg-main br-main cr-white round text-size" type="default" form-type="submit" hover-class="none" :loading="form_submit_loading" :disabled="form_submit_loading">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</form>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '处理错误',
|
||||
form_submit_loading: false,
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData,
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad() {},
|
||||
|
||||
onShow() {
|
||||
this.init();
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.globalData.user_is_need_login(user)) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login?event_callback=init',
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
// 开启表单
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
});
|
||||
} else {
|
||||
// 提示错误
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '用户未登录',
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
formSubmit(e) {
|
||||
// 数据验证
|
||||
var validation = [
|
||||
{ fields: 'name', msg: '请填写联系人' },
|
||||
{ fields: 'tel', msg: '请填写联系电话' },
|
||||
{ fields: 'title', msg: '请填写标题' },
|
||||
{ fields: 'content', msg: '请填写内容' },
|
||||
];
|
||||
if (app.globalData.fields_check(e.detail.value, validation)) {
|
||||
uni.showLoading({
|
||||
title: '提交中...',
|
||||
});
|
||||
this.setData({
|
||||
form_submit_loading: true,
|
||||
});
|
||||
|
||||
// 网络请求
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('add', 'answer'),
|
||||
method: 'POST',
|
||||
data: e.detail.value,
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
setTimeout(function () {
|
||||
uni.redirectTo({
|
||||
url: '/pages/plugins/answers/index/index',
|
||||
});
|
||||
}, 2000);
|
||||
} else {
|
||||
this.setData({
|
||||
form_submit_loading: false,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
this.setData({
|
||||
form_submit_loading: false,
|
||||
});
|
||||
app.globalData.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './user-answers-form.css';
|
||||
</style>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
.answers-status {
|
||||
padding: 4rpx 10rpx;
|
||||
}
|
||||
|
||||
.answers-bg-green {
|
||||
background-color: #5FB95E;
|
||||
}
|
||||
|
||||
.answers-bg-yellow {
|
||||
background-color: #FAAD14;
|
||||
}
|
||||
|
||||
|
||||
.question-btn {
|
||||
padding: 30rpx 90rpx;
|
||||
}
|
||||
|
||||
.question-btn button {
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
padding: 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="data_list.length > 0" class="padding-main">
|
||||
<view v-for="(item, index) in data_list" :key="index">
|
||||
<navigator url="/pages/user-answers-detail/user-answers-detail" hover-class="none" class="padding-main border-radius-main bg-white oh spacing-mb">
|
||||
<view class="margin-bottom-xs flex-row jc-sb align-c">
|
||||
<text class="fw-b text-size">{{ item.name }}</text>
|
||||
<text class="answers-status cr-white border-radius-sm text-size-xss" :class="item.is_reply === '1' ? 'answers-bg-green' : 'answers-bg-yellow'">{{ item.reply === '1' ? '已回' : '未回' }}</text>
|
||||
</view>
|
||||
<view class="cr-grey-9">{{ item.add_time_time }}</view>
|
||||
<view class="spacing-mt">
|
||||
<view class="margin-bottom-sm flex-row jc-sb align-c">
|
||||
<view class="padding-right-sm">标题:</view>
|
||||
<view class="cr-grey flex-1 flex-width single-text">
|
||||
{{ item.title }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="margin-bottom-sm flex-row jc-sb align-c">
|
||||
<view class="padding-right-sm">内容:</view>
|
||||
<view class="cr-grey flex-1 flex-width single-text">
|
||||
{{ item.content }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :propStatus="data_list_loding_status"></component-no-data>
|
||||
</view>
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
|
||||
<view class="bottom-fixed question-btn bg-white">
|
||||
<navigator url="/pages/user-answers-form/user-answers-form" hover-class="none">
|
||||
<button class="bg-white br-main cr-main round text-size" type="default" form-type="submit" hover-class="none">我要提问</button>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from '@/components/no-data/no-data';
|
||||
import componentBottomLine from '@/components/bottom-line/bottom-line';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
data_list_loding_status: 1,
|
||||
data_bottom_line_status: false,
|
||||
data_is_loading: 0,
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData,
|
||||
componentBottomLine,
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad() {},
|
||||
|
||||
onShow() {
|
||||
this.init();
|
||||
|
||||
// 分享菜单处理
|
||||
app.globalData.page_share_handle();
|
||||
},
|
||||
|
||||
methods: {
|
||||
init() {
|
||||
var user = app.globalData.get_user_info(this, 'init');
|
||||
if (user != false) {
|
||||
// 用户未绑定用户则转到登录页面
|
||||
if (app.globalData.user_is_need_login(user)) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login?event_callback=init',
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
// 获取数据
|
||||
this.get_data_list();
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data_bottom_line_status == true) {
|
||||
uni.stopPullDownRefresh();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 是否加载中
|
||||
if (this.data_is_loading == 1) {
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
data_is_loading: 1,
|
||||
data_list_loding_status: 1,
|
||||
});
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'answer'),
|
||||
method: 'POST',
|
||||
data: {
|
||||
page: this.data_page,
|
||||
},
|
||||
dataType: 'json',
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.data.data.length > 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = res.data.data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data_list || [];
|
||||
var temp_data = res.data.data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: res.data.data.total,
|
||||
data_page_total: res.data.data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data_page + 1,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
this.setData({
|
||||
data_bottom_line_status: this.data_page > 1 && this.data_page > this.data_page_total,
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
if (app.globalData.is_login_check(res.data, this, 'get_data_list')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_is_loading: 0,
|
||||
});
|
||||
app.globalData.showToast('服务器请求出错');
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
@import './user-answers-question.css';
|
||||
</style>
|
||||
Loading…
Reference in New Issue