完成设置页面

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",
showLoading: true,
}
},
config: {
url: "/wxapp/index/about",
}
},
user: {

View File

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

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 limit-line clamp-1">关于我们</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 limit-line clamp-1">注册协议</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 limit-line clamp-1">隐私协议</text>
<view class="item-content">
<text class="iconfont icon-jinru"></text>

View File

@ -1,13 +1,29 @@
import system from "@/core/models/system";
export default {
namespaced: true,
state: {
messageTabIndex: 0,
platformData: {
about: "",
privacy: "",
register: "",
serviceMobile: "",
},
},
getters: {},
mutations: {
messageTabIndex(state, 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);
});
}
}
}