-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
256 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,9 +89,9 @@ | |
"@dcloudio/uni-quickapp-webview": "3.0.0-4020420240722002", | ||
"@dcloudio/uni-ui": "^1.5.6", | ||
"dayjs": "1.11.12", | ||
"diamond": "file:../../thirdparty/diamond", | ||
"pinia": "2.2.0", | ||
"pinia-plugin-persistedstate": "3.2.1", | ||
"qs": "6.12.3", | ||
"vue": "3.4.21", | ||
"wot-design-uni": "^1.3.6", | ||
"z-paging": "^2.7.11" | ||
|
@@ -148,7 +148,7 @@ | |
"unplugin-auto-import": "^0.18.2", | ||
"vite": "5.2.8", | ||
"vite-plugin-restart": "^0.4.1", | ||
"vue-i18n": "^9.1.9", | ||
"vue-i18n": "9.1.9", | ||
"vue-tsc": "^2.0.29" | ||
}, | ||
"packageManager": "[email protected]+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<route lang="json5"> | ||
{ | ||
style: { | ||
navigationStyle: 'custom', | ||
navigationBarTitleText: 'wopan列表', | ||
}, | ||
} | ||
</route> | ||
<template></template> | ||
|
||
<script lang="ts" setup> | ||
defineOptions({ | ||
name: 'WopanList', | ||
}) | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<route lang="json5"> | ||
{ | ||
style: { | ||
navigationStyle: 'custom', | ||
navigationBarTitleText: 'wopan登录', | ||
}, | ||
} | ||
</route> | ||
<template> | ||
<view | ||
class="bg-white overflow-hidden pt-2 px-4" | ||
:style="{ marginTop: safeAreaInsets?.top + 'px' }" | ||
> | ||
<wd-form ref="form" :model="model"> | ||
<wd-cell-group border> | ||
<wd-input | ||
label="用户名" | ||
label-width="100px" | ||
prop="value1" | ||
clearable | ||
v-model="model.phone" | ||
placeholder="请输入用户名" | ||
:rules="[{ required: true, message: '请填写用户名' }]" | ||
/> | ||
<wd-input | ||
label="密码" | ||
label-width="100px" | ||
prop="value2" | ||
show-password | ||
clearable | ||
v-model="model.password" | ||
placeholder="请输入密码" | ||
:rules="[{ required: true, message: '请填写密码' }]" | ||
/> | ||
</wd-cell-group> | ||
<view class="footer"> | ||
<wd-button type="primary" size="large" @click="handleSubmit" block>提交</wd-button> | ||
</view> | ||
</wd-form> | ||
</view> | ||
</template> | ||
<script lang="ts" setup> | ||
import PLATFORM from '@/utils/platform' | ||
import { useToast } from 'wot-design-uni' | ||
import * as wopan from 'diamond/wopan' | ||
defineOptions({ | ||
name: 'WopanLogin', | ||
}) | ||
// 获取屏幕边界到安全区域距离 | ||
const { safeAreaInsets } = uni.getSystemInfoSync() | ||
const { success: showSuccess } = useToast() | ||
const model = reactive<{ | ||
phone: string | ||
password: string | ||
}>({ | ||
phone: '', | ||
password: '', | ||
}) | ||
onLoad(() => { | ||
console.log('a') | ||
}) | ||
const form = ref() | ||
function handleSubmit() { | ||
form.value | ||
.validate() | ||
.then(({ valid, errors }) => { | ||
if (valid) { | ||
const res = wopan.PcWebLogin(model.phone, model.password) | ||
showSuccess({ | ||
msg: '校验通过', | ||
}) | ||
} | ||
}) | ||
.catch((error) => { | ||
console.log(error, 'error') | ||
}) | ||
} | ||
</script> | ||
<style> | ||
.footer { | ||
padding: 12px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { client } from 'diamond/wopan' | ||
client.fetch = async function (url, method, headers, body) { | ||
return new Promise((resolve, reject) => { | ||
uni.request({ | ||
url, | ||
method, | ||
header: headers, | ||
data: body, | ||
success: function (res) { | ||
resolve(res) | ||
}, | ||
fail: function (err) { | ||
reject(err) | ||
}, | ||
}) | ||
}) | ||
} | ||
client.setToken(uni.getStorageSync('accessToken'), uni.getStorageSync('accessToken')) | ||
client.psToken = uni.getStorageSync('psToken') | ||
|
||
const wopanClient = client | ||
|
||
export default wopanClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import wopanClient from '@/service/wopan' | ||
import * as wopan from 'diamond/wopan' | ||
import { defineStore } from 'pinia' | ||
interface File { | ||
fid: string | ||
name: string | ||
id: string | ||
type: number | ||
subFiles: Files | ||
} | ||
|
||
interface Files { | ||
parent: File | ||
files: File[] | ||
pageNo: number | ||
pageSize: number | ||
} | ||
|
||
export interface WopanState { | ||
files: Files | ||
accessToken: string | ||
refreshToken: string | ||
psToken: string | ||
phone: string | ||
} | ||
|
||
export const state: WopanState = { | ||
files: null, | ||
} | ||
|
||
const getters = {} | ||
|
||
const actions = { | ||
async PcWebLogin(params) { | ||
try { | ||
const res = await wopan.PcWebLogin(params.phone, params.password) | ||
} catch (error: any) { | ||
console.log(error) | ||
} | ||
}, | ||
async PcLoginVerifyCode(params) { | ||
try { | ||
const res = await wopan.PcLoginVerifyCode(params.phone, params.password, params.messageCode) | ||
uni.setStorageSync('accessToken', res.access_token) | ||
uni.setStorageSync('refreshToken', res.refresh_token) | ||
await uni.navigateTo({ url: '/wopan/list' }) | ||
} catch (error: any) { | ||
console.log(error) | ||
} | ||
}, | ||
} | ||
|
||
export const useWopanStore = defineStore({ | ||
id: 'wopan', | ||
state: () => state, | ||
getters, | ||
actions, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.