Skip to content

Commit

Permalink
Merge branch 'demo'
Browse files Browse the repository at this point in the history
  • Loading branch information
codercup2 committed Apr 5, 2024
2 parents c33faf5 + 622c695 commit 047d1a3
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions mock/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default [
response: ({ query }) => {
return {
code: 0,
result: {
data: {
name: '菲鸽',
},
}
Expand All @@ -21,7 +21,7 @@ export default [
timeout: 2000,
response: {
code: 0,
result: {
data: {
name: '菲鸽',
},
},
Expand Down
7 changes: 7 additions & 0 deletions src/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
"navigationBarTitleText": "登录"
}
},
{
"path": "pages/my/index",
"type": "page",
"style": {
"navigationBarTitleText": "我的"
}
},
{
"path": "pages/demo/base/auto-import",
"type": "page",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/demo/base/mock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const data = ref()
const getFoo = async () => {
const res = await getMockAPI('菲鸽')
data.value = res.result
data.value = res.data
originalData.value = res
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/demo/base/request.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ const originalData = ref<IResData<IFooItem>>()
const data = ref<IFooItem>()
const getFoo = async () => {
const res = await getFooAPI('菲鸽')
data.value = res.result
data.value = res.data
originalData.value = res
}
const data2 = ref<IFooItem>()
const postFoo = async () => {
const res = await postFooAPI('菲鸽2')
data2.value = res.result
data2.value = res.data
}
const reset = () => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/index/request.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ onLoad(() => {
const data = ref<IFooItem>()
const getFoo = async () => {
const res = await getFooAPI('菲鸽')
data.value = res.result
data.value = res.data
}
const data2 = ref<IFooItem>()
const postFoo = async () => {
const res = await postFooAPI('菲鸽2')
data2.value = res.result
data2.value = res.data
}
</script>
6 changes: 4 additions & 2 deletions src/pages/my/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ uni.login({
code,
},
})
openId.value = res.result.openid
userStore.setUserInfo({ openid: res.result.openid })
console.log('微信登录-1:', res)
// {code: 0, msg: "success", data: {session_key: "JTzhLVK+oM3X58uJ/heDcQ==", openid: "oSYa06xPVqjsK-eFYzt0kSPYu1q4"}}
openId.value = res.data.openid
userStore.setUserInfo({ openid: res.data.openid })
},
})
</script>
2 changes: 1 addition & 1 deletion src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
type IResData<T> = {
code: number
msg: string
result: T
data: T
}

// uni.uploadFile文件上传参数
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default ({ command, mode }) => {

plugins: [
UniPages({
exclude: ['**/components/**/**.*', '**/my/**/**.vue'],
exclude: ['**/components/**/**.*'],
routeBlockLang: 'json5', // 虽然设了默认值,但是vue文件还是要加上 lang="json5", 这样才能很好地格式化
homePage: 'pages/index/index',
subPackages: ['src/pages-sub'], // 是个数组,可以配置多个
Expand Down

0 comments on commit 047d1a3

Please sign in to comment.