完成设置页面

This commit is contained in:
TOP糯米 2023-03-28 00:35:13 +08:00
parent 6bb207ff97
commit 08b4626a36
5 changed files with 66 additions and 5 deletions

View File

@ -27,6 +27,9 @@ const apis = {
url: "/wxapp/index/newinfobyid", url: "/wxapp/index/newinfobyid",
showLoading: true, showLoading: true,
} }
},
config: {
url: "/wxapp/index/about",
} }
}, },
user: { user: {

View File

@ -131,5 +131,25 @@ export default {
return reject(response.msg); return reject(response.msg);
}); });
}); });
},
/**
* 平台杂项数据
*/
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

@ -14,6 +14,7 @@
<script> <script>
import AppLayout from "@/components/layout/layout"; import AppLayout from "@/components/layout/layout";
import { mapState } from "vuex";
export default { export default {
name: "detail-detail", name: "detail-detail",
data() { data() {
@ -29,7 +30,12 @@ export default {
components: { components: {
AppLayout, AppLayout,
}, },
onLoad(e) { computed: {
...mapState({
platformData: (state) => state.system.platformData,
}),
},
async onLoad(e) {
if (!e.type) { if (!e.type) {
return this.$utils.toast("参数错误").then(() => { return this.$utils.toast("参数错误").then(() => {
this.$utilst.toPage("", {}, "back"); this.$utilst.toPage("", {}, "back");
@ -62,6 +68,22 @@ export default {
content: response.data.content, content: response.data.content,
}; };
}); });
} else 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() {}, onShow() {},

View File

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

View File

@ -1,13 +1,29 @@
import system from "@/core/models/system";
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
messageTabIndex: 0, messageTabIndex: 0,
platformData: {
about: "",
privacy: "",
register: "",
serviceMobile: "",
},
}, },
getters: {}, getters: {},
mutations: { mutations: {
messageTabIndex(state, data) { messageTabIndex(state, data) {
state.messageTabIndex = data; state.messageTabIndex = data;
},
platformData(state, data) {
state.platformData = data;
} }
}, },
actions: {} actions: {
async platformData(context, data) {
await system.platformData().then(data => {
context.commit('platformData', data);
});
}
}
} }