123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <template>
- <view class="main">
- {{info}}
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- user: {},
- info: {},
- }
- },
- onLoad: async function(e) {
- const that = this;
- uni.setNavigationBarTitle({
- title: e && e.title || '分类'
- });
- await that.searchOther();
- that.searchToken();
- that.search();
- },
- methods: {
- searchToken() {
- const that = this;
- try {
- const res = uni.getStorageSync('token');
- if (res) that.$set(that, `user`, res);
- } catch (e) {
- uni.showToast({
- title: err.errmsg,
- icon: 'error',
- duration: 2000
- });
- }
- },
- // 查询
- async search() {
- const that = this;
- let res;
- res = await that.$api(`/config`, 'GET', {})
- if (res.errcode == '0') {
- that.$set(that, `info`, res.data)
- } else {
- uni.showToast({
- title: res.errmsg,
- });
- }
- },
- async searchOther() {
- const that = this;
- }
- }
- }
- </script>
- <style>
- .main {}
- </style>
|