完成设置页面

This commit is contained in:
TOP糯米 2023-03-28 00:35:28 +08:00
parent 9c21668daa
commit 9d01577024
6 changed files with 143 additions and 4 deletions
src
core
pages.json
pages
store/modules

View File

@ -14,6 +14,9 @@ export default {
showLoading: true,
}
},
config: {
url: "/wxapp/index/about",
}
},
index: {
banner: {

View File

@ -104,5 +104,25 @@ export default {
return reject(response.msg);
}).catch(e => { throw e; });
});
},
/**
* 平台杂项数据
*/
platformData() {
return new Promise((resolve, reject) => {
prototype.$request({
api: "system.config",
}).then(response => {
if (response.code == 1) {
return resolve({
about: response.data.about,
privacy: response.data.xieyi,
register: response.data.zhuce,
serviceMobile: response.data.mobile,
});
}
return reject(response.msg);
}).catch(e => { });
});
}
}

View File

@ -150,6 +150,12 @@
"style": {
"navigationBarTitleText": "其他服务"
}
},
{
"path": "pages/detail/detail",
"style": {
"navigationBarTitleText": "详情"
}
}
],
"globalStyle": {

View File

@ -0,0 +1,94 @@
<template>
<app-layout :title="pageTitle">
<div class="message-container">
<view class="head">
<text class="title limit-line clamp-1">{{ info.title }}</text>
<text class="date">{{ info.date }}</text>
</view>
<view class="body">
<rich-text :nodes="info.content"></rich-text>
</view>
</div>
</app-layout>
</template>
<script>
import AppLayout from "@/components/layout/layout";
import { mapState } from "vuex";
export default {
name: "detail-detail",
data() {
return {
pageTitle: "",
info: {
title: "",
date: "",
content: "",
},
};
},
components: {
AppLayout,
},
computed: {
...mapState({
platformData: (state) => state.system.platformData,
}),
},
async onLoad(e) {
if (!e.type) {
return this.$utils.toast("参数错误").then(() => {
this.$utilst.toPage("", {}, "back");
});
}
if (e.type == "about" || e.type == "privacy" || e.type == "register") {
await this.$store.dispatch("system/platformData");
if (e.type == "about") {
this.pageTitle = "关于我们";
this.info.content = this.platformData.about;
} else if (e.type == "privacy") {
this.pageTitle = "隐私协议";
this.info.content = this.platformData.privacy;
} else {
this.pageTitle = "注册协议";
this.info.content = this.platformData.register;
}
this.info.content = this.info.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto"');
uni.setNavigationBarTitle({
title: this.pageTitle,
});
}
},
onShow() {},
onReady() {},
onHide() {},
onReachBottom() {},
onPullDownRefresh() {},
methods: {},
};
</script>
<style lang="less" scoped>
.message-container {
width: 100%;
box-sizing: border-box;
padding: 40rpx;
.head {
width: 100%;
font-size: 30rpx;
font-weight: bold;
line-height: 30rpx;
.title {
color: #333333;
}
.date {
display: inline-block;
color: #999999;
margin-top: 24rpx;
}
}
.body {
margin-top: 40rpx;
}
}
</style>

View File

@ -14,19 +14,19 @@
<text class="iconfont icon-jinru"></text>
</view>
</view>
<view class="widget-item">
<view class="widget-item" @click="toPage('/pages/detail/detail?type=about')">
<text class="title">关于我们</text>
<view class="item-content">
<text class="iconfont icon-jinru"></text>
</view>
</view>
<view class="widget-item">
<view class="widget-item" @click="toPage('/pages/detail/detail?type=register')">
<text class="title">注册协议</text>
<view class="item-content">
<text class="iconfont icon-jinru"></text>
</view>
</view>
<view class="widget-item">
<view class="widget-item" @click="toPage('/pages/detail/detail?type=privacy')">
<text class="title">隐私协议</text>
<view class="item-content">
<text class="iconfont icon-jinru"></text>

View File

@ -1,8 +1,15 @@
import system from "@/core/models/system";
export default {
namespaced: true,
state: {
currentCateId: 0,
currentOrderTabIndex: 0,
platformData: {
about: "",
privacy: "",
register: "",
serviceMobile: "",
},
},
getters: {},
mutations: {
@ -11,7 +18,16 @@ export default {
},
currentOrderTabIndex(state, data) {
state.currentOrderTabIndex = data;
},
platformData(state, data) {
state.platformData = data;
}
},
actions: {}
actions: {
async platformData(context, data) {
await system.platformData().then(data => {
context.commit('platformData', data);
});
}
}
}