|
|
@@ -31,15 +31,27 @@
|
|
|
<view class="contact-item">
|
|
|
<text class="contact-text">{{userRole}}</text>
|
|
|
</view>
|
|
|
-
|
|
|
+ <view class="menu-section">
|
|
|
+ <view class="menu-item" @click="handlePassword()">
|
|
|
+ <image class="menu-icon" src="/static/images/profile/7.png" mode="aspectFit"></image>
|
|
|
+ <text class="menu-title">修改密码</text>
|
|
|
+ <text class="menu-arrow">›</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="menu-item" @longpress="handleVersionClick()">
|
|
|
+ <image class="menu-icon" src="/static/images/profile/5.png" mode="aspectFit"></image>
|
|
|
+ <text class="menu-title">{{version}}</text>
|
|
|
+ <text class="menu-arrow">›</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<!-- 功能菜单 -->
|
|
|
- <view class="menu-section">
|
|
|
+ <!-- <view class="menu-section">
|
|
|
<view v-for="(item, index) in menuList" :key="index" class="menu-item" @click="handleMenuClick(item)">
|
|
|
- <image class="menu-icon" :src="item.icon" mode="aspectFit"></image>
|
|
|
- <text class="menu-title">{{ item.title }}</text>
|
|
|
+ <image class="menu-icon" src="/static/images/profile/7.png" mode="aspectFit"></image>
|
|
|
+ <text class="menu-title">修改密码</text>
|
|
|
<text class="menu-arrow">›</text>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
|
|
|
<!-- 注销账号 -->
|
|
|
<view class="logout-wrapper">
|
|
|
@@ -56,6 +68,7 @@
|
|
|
import { useAuth } from '../../composables/useAuth'
|
|
|
import { encryptAES, decryptAES } from '../../utils/crypto'
|
|
|
import { getIsKey } from '../../api/auth/login'
|
|
|
+ import { getBaseUrl } from '../../utils/request'
|
|
|
|
|
|
// @ts-ignore
|
|
|
import manifest from '@/manifest.json'
|
|
|
@@ -119,6 +132,18 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ const handlePassword = (): void =>{
|
|
|
+ uni.navigateTo({
|
|
|
+ url:"/pages/profile/password/index",
|
|
|
+ fail: (err: any) => {
|
|
|
+ uni.showToast({
|
|
|
+ title: '功能开发中',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
// 菜单点击
|
|
|
const handleMenuClick = (item: MenuItem): void => {
|
|
|
if (item.action == 'version') {
|
|
|
@@ -171,6 +196,105 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ // 安装APK的单独函数
|
|
|
+ const installApkFile = (filePath: string): void => {
|
|
|
+ uni.installApk({
|
|
|
+ filePath: filePath,
|
|
|
+ success: () => {
|
|
|
+ console.log('安装成功');
|
|
|
+ uni.showToast({
|
|
|
+ title: '安装成功',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: (error) => {
|
|
|
+ console.error('安装失败:', error);
|
|
|
+ uni.showToast({
|
|
|
+ title: '安装失败',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ complete: (res) => {
|
|
|
+ console.log('安装完成:', res);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const installApkWithProgress = (): void => {
|
|
|
+ // #ifdef APP-ANDROID
|
|
|
+ // 显示下载进度
|
|
|
+ uni.showLoading({
|
|
|
+ title: '下载中...',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ let donwloadUrl = '';
|
|
|
+ donwloadUrl = getBaseUrl() + '/prod-api/profile/app/gxt-release.apk'
|
|
|
+
|
|
|
+ // 下载APK
|
|
|
+ const downloadTask = uni.downloadFile({
|
|
|
+ url: donwloadUrl,
|
|
|
+ filePath: `${uni.env.USER_DATA_PATH}/${Date.now()}_test.apk`, // 使用时间戳防止重名
|
|
|
+ success: (downloadRes) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ if (downloadRes.statusCode == 200) {
|
|
|
+ // 确认安装
|
|
|
+ uni.showModal({
|
|
|
+ title: '安装提示',
|
|
|
+ content: '下载完成,是否立即安装?',
|
|
|
+ success: (modalRes) => {
|
|
|
+ if (modalRes.confirm) {
|
|
|
+ installApkFile(downloadRes.tempFilePath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '下载失败',
|
|
|
+ icon: 'error'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (error) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ uni.showToast({
|
|
|
+ title: '下载失败',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ console.error('下载失败:', error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 监听下载进度
|
|
|
+ downloadTask.onProgressUpdate((res) => {
|
|
|
+ console.log('下载进度:', res.progress + '%');
|
|
|
+ // 如果需要,可以更新UI显示进度
|
|
|
+ uni.showLoading({
|
|
|
+ title: `下载中 ${res.progress}%`,
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ // #ifdef APP-HARMONY
|
|
|
+ uni.showToast({
|
|
|
+ title: '请登录PC端,扫描二维码下载并安装',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ // #ifdef APP-IOS
|
|
|
+ uni.showToast({
|
|
|
+ title: '请登录PC端,扫描二维码下载并安装',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
+
|
|
|
+ // 菜单点击
|
|
|
+ const handleVersionClick = (): void => {
|
|
|
+ installApkWithProgress();
|
|
|
+ }
|
|
|
+
|
|
|
// 初始化
|
|
|
onMounted(() => {
|
|
|
const userInfo = getUserInfo()
|