This commit is contained in:
4
src/api/game.ts
Normal file
4
src/api/game.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import request from '../utils/request';
|
||||
|
||||
// 获取游戏列表
|
||||
export const getGameList = () => request('/game', {}, 'POST');
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
// font-size: 30rpx;
|
||||
// IOS安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// 用于配置项目的一些常量,如接口地址、websocket地址等
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
export const app = {
|
||||
API_URL: () => `${process.env.TARO_APP_HALL_API}`,
|
||||
API_WS: () =>
|
||||
`${process.env.TARO_APP_WS}?uid=${Taro.getStorageSync('uid')}&game_id=${
|
||||
Taro.getStorageSync('gameItem').ID
|
||||
}`,
|
||||
};
|
||||
@@ -16,6 +16,7 @@
|
||||
import { ref } from 'vue';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { getPersonalInfo } from '@/api/user';
|
||||
import { getGameList } from '@/api/game';
|
||||
|
||||
const list = ref<any[]>([]);
|
||||
|
||||
@@ -55,14 +56,8 @@ const getUserInfo = async () => {
|
||||
|
||||
const getList = async () => {
|
||||
// console.log(process.env.TARO_APP_HALL_API)
|
||||
Taro.request({
|
||||
url: `${process.env.TARO_APP_HOME}`,
|
||||
method: 'POST',
|
||||
success: ({ data: res }) => {
|
||||
list.value =
|
||||
res.data.data.sort((a: any, b: any) => b.sort - a.sort) || [];
|
||||
},
|
||||
});
|
||||
const res = await getGameList();
|
||||
list.value = res.data.data.sort((a: any, b: any) => b.sort - a.sort) || [];
|
||||
};
|
||||
|
||||
const toPage = item => {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<template>
|
||||
<view class="appUser">
|
||||
<view
|
||||
:style="{ width: isLogin ? '100%' : '70%' }"
|
||||
class="user-center-card__header__transparent"
|
||||
v-if="isLogin"
|
||||
:style="{ width: isLogin ? '100%' : '70%' }">
|
||||
v-if="isLogin">
|
||||
<view
|
||||
class="user-center-card__header__avatar"
|
||||
@click="toPage('/pages/users/user_setting/index')">
|
||||
<nut-avatar size="large">
|
||||
<img :src="userInfo.data?.avatarUrl" />
|
||||
<img :src="userInfo.data?.avatarUrl" alt="" />
|
||||
</nut-avatar>
|
||||
</view>
|
||||
<view
|
||||
@@ -34,7 +34,8 @@
|
||||
<view class="user-center-card__header__avatar">
|
||||
<nut-avatar size="large">
|
||||
<img
|
||||
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png" />
|
||||
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
|
||||
alt="" />
|
||||
</nut-avatar>
|
||||
</view>
|
||||
<view class="user-center-card__header__info">
|
||||
@@ -186,7 +187,11 @@ import { ref } from 'vue';
|
||||
import { ArrowRight, IconFont } from '@nutui/icons-vue-taro';
|
||||
import Taro from '@tarojs/taro';
|
||||
import Auth from '@/components/Auth.vue';
|
||||
import { getPersonalInfo, getPhone, bindParent } from '@/api/user';
|
||||
import {
|
||||
getPersonalInfo,
|
||||
getPhone,
|
||||
// bindParent
|
||||
} from '@/api/user';
|
||||
import { maskString } from '@/utils';
|
||||
|
||||
const isShowLogin = ref(false);
|
||||
@@ -231,15 +236,15 @@ const init_data = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const test = () => {
|
||||
console.log(process.env.TARO_APP_ID);
|
||||
Taro.openCustomerServiceChat({
|
||||
corpId: 'wwb5dd953ca36043ef',
|
||||
extInfo: {
|
||||
url: 'https://work.weixin.qq.com/kfid/kfcb2b0420e94102346',
|
||||
},
|
||||
});
|
||||
};
|
||||
// const test = () => {
|
||||
// console.log(process.env.TARO_APP_ID);
|
||||
// Taro.openCustomerServiceChat({
|
||||
// corpId: 'wwb5dd953ca36043ef',
|
||||
// extInfo: {
|
||||
// url: 'https://work.weixin.qq.com/kfid/kfcb2b0420e94102346',
|
||||
// },
|
||||
// });
|
||||
// };
|
||||
|
||||
const cancelLogin = () => {
|
||||
isShowLogin.value = false;
|
||||
@@ -327,28 +332,28 @@ const toPage = (url: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
const scanCode = () => {
|
||||
Taro.scanCode({
|
||||
onlyFromCamera: true,
|
||||
scanType: ['qrCode'],
|
||||
success: async data => {
|
||||
try {
|
||||
await bindParent({
|
||||
uid: data.result,
|
||||
});
|
||||
Taro.showToast({
|
||||
title: '绑定成功',
|
||||
icon: 'none',
|
||||
});
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: 'none',
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
// const scanCode = () => {
|
||||
// Taro.scanCode({
|
||||
// onlyFromCamera: true,
|
||||
// scanType: ['qrCode'],
|
||||
// success: async data => {
|
||||
// try {
|
||||
// await bindParent({
|
||||
// uid: data.result,
|
||||
// });
|
||||
// Taro.showToast({
|
||||
// title: '绑定成功',
|
||||
// icon: 'none',
|
||||
// });
|
||||
// } catch (error) {
|
||||
// Taro.showToast({
|
||||
// title: error.msg,
|
||||
// icon: 'none',
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
// };
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import { app } from '@/config';
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
export interface RequestParams {
|
||||
url: string;
|
||||
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
||||
header?: object;
|
||||
data?: string | object;
|
||||
}
|
||||
|
||||
const request = (request: RequestParams): Promise<any> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.request({
|
||||
url: `${app.API_URL()}${request.url}`,
|
||||
method: request.method,
|
||||
timeout: 5000,
|
||||
dataType: 'json',
|
||||
header: request.header || {},
|
||||
data: request.data || {},
|
||||
success: res => {
|
||||
resolve(res.data);
|
||||
// Taro.hideLoading()
|
||||
},
|
||||
fail: err => {
|
||||
reject(err);
|
||||
Taro.hideLoading();
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export default request;
|
||||
Reference in New Issue
Block a user