shuishen
2025-12-16 0b3c4a0ffa0ff53e892e5fdacc7c4ac196393a70
feat:部署微信小程序测试
10 files modified
1 files added
284 ■■■■■ changed files
src/App.vue 6 ●●●● patch | view | raw | blame | history
src/config/env.js 27 ●●●● patch | view | raw | blame | history
src/manifest.json 2 ●●● patch | view | raw | blame | history
src/pages.json 8 ●●●●● patch | view | raw | blame | history
src/pages/login/index.vue 77 ●●●● patch | view | raw | blame | history
src/pages/map/index copy.vue 10 ●●●● patch | view | raw | blame | history
src/pages/placeholder/placeholder.vue 11 ●●●●● patch | view | raw | blame | history
src/pages/user/index.vue 103 ●●●● patch | view | raw | blame | history
src/static/fonts/font.css 13 ●●●●● patch | view | raw | blame | history
src/subPackages/404/index.vue 9 ●●●●● patch | view | raw | blame | history
src/utils/common/index.js 18 ●●●●● patch | view | raw | blame | history
src/App.vue
@@ -6,7 +6,7 @@
const appStore = useAppStore();
const userStore = useUserStore();
useGlobalWS()
useGlobalWS();
onShow(() => {
  console.log("App Show");
@@ -23,7 +23,7 @@
    //不存在则跳转至登录页
    uni.reLaunch({
      url: "/pages/login/index",
    })
    });
  }
});
</script>
@@ -41,7 +41,7 @@
}
page {
  background-image: url('~@/static/images/user/bg.png');
  background-image: url("https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_app_assets/images/user/bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
src/config/env.js
@@ -1,26 +1,43 @@
/*
 * @Author       : yuan
 * @Date         : 2025-12-15 17:51:08
 * @LastEditors  : yuan
 * @LastEditTime : 2025-12-16 15:01:04
 * @FilePath     : \src\config\env.js
 * @Description  :
 * Copyright 2025 OBKoro1, All Rights Reserved.
 * 2025-12-15 17:51:08
 */
// 如果是打包app,需要改这里,h5不需要改这里
const development = {
  VITE_APP_ENV:'development',
  // 开发环境这里改为自己的
  // VITE_APP_WEBVIEW_URL: 'https://wrj.shuixiongit.com/drone-app-web-view/#/webViewWrapper',
  VITE_APP_WEBVIEW_URL: 'http://localhost:5173/drone-app-web-view/#/webViewWrapper',
  VITE_APP_WEBVIEW_URL: 'https://wrj.shuixiongit.com/drone-app-web-view/#/webViewWrapper',
  // VITE_APP_WEBVIEW_URL: 'http://localhost:5173/drone-app-web-view/#/webViewWrapper',
  VITE_API_BASE_URL: 'https://wrj.shuixiongit.com/api',
  // VITE_API_BASE_URL: 'https://aisky.org.cn/api',
  VITE_APP_WS_API_URL:'wss://wrj.shuixiongit.com/drone-wss/api/v1/ws'
  VITE_APP_WS_API_URL:'wss://wrj.shuixiongit.com/drone-wss/api/v1/ws',
  // 静态资源存放地址'
  VITE_APP_ASSETS_URL: 'https://wrj.shuixiongit.com/drone-app/assets/static'
}
const test = {
  VITE_APP_ENV:'test',
  VITE_APP_WEBVIEW_URL: 'https://wrj.shuixiongit.com/drone-app-web-view/#/webViewWrapper',
  VITE_API_BASE_URL: 'https://wrj.shuixiongit.com/api',
  VITE_APP_WS_API_URL:'wss://wrj.shuixiongit.com/drone-wss/api/v1/ws'
  VITE_APP_WS_API_URL: 'wss://wrj.shuixiongit.com/drone-wss/api/v1/ws',
  // 静态资源存放地址'
  VITE_APP_ASSETS_URL: 'https://wrj.shuixiongit.com/drone-app/assets/static'
}
const production = {
  VITE_APP_ENV:'production',
  VITE_APP_WEBVIEW_URL: 'https://aisky.org.cn/drone-app-web-view/#/webViewWrapper',
  VITE_API_BASE_URL: 'https://aisky.org.cn/api',
  VITE_APP_WS_API_URL:'wss://aisky.org.cn/drone-wss/api/v1/ws'
  VITE_APP_WS_API_URL: 'wss://aisky.org.cn/drone-wss/api/v1/ws',
  // 静态资源存放地址'
  VITE_APP_ASSETS_URL: 'https://wrj.shuixiongit.com/drone-app/assets/static'
}
export default {
src/manifest.json
@@ -89,7 +89,7 @@
    "quickapp" : {},
    /* 小程序特有相关 */
    "mp-weixin" : {
        "appid" : "wx1ff4bbc24b343ef1",
        "appid" : "wx7ad823321a1e4fdd",
        "setting" : {
            "urlCheck" : false
        },
src/pages.json
@@ -42,7 +42,14 @@
        "navigationBarTitleText": "登录页",
        "navigationStyle": "custom"
      }
    },
    {
      "path": "pages/placeholder/placeholder",
      "style": {
        "navigationBarTitleText": "占位页面"
    }
    }
  ],
  "subPackages": [
    {
@@ -174,6 +181,7 @@
        "pagePath": "subPackages/taskDetail/addTask/index"
      },
      {
        "pagePath": "pages/placeholder/placeholder",
        "iconPath": "static/images/tabbar/drone.png",
        "visible": "true"
      },
src/pages/login/index.vue
@@ -9,43 +9,44 @@
        </div>
        <div class="pass-word">
            <image :src="passwordSvg" />
            <input v-model="loginForm.password" type="password" placeholder="请输入密码" />
      <input
        v-model="loginForm.password"
        type="password"
        placeholder="请输入密码"
      />
        </div>
        <div class="remember-password">
            <label>
                <checkbox-group @change="toggleRemember">
                    <checkbox :checked="rememberPassword" color="#1D6FE9" style="transform:scale(0.7)" />
          <checkbox
            :checked="rememberPassword"
            color="#1D6FE9"
            style="transform: scale(0.7)"
          />
                </checkbox-group>
                记住密码
            </label>
        </div>
        <button class="login-btn"  :style="[inputStyle]" @tap="submit">
            登录
        </button>
    <button class="login-btn" :style="[inputStyle]" @tap="submit">登录</button>
        <image class="lowerRightCorner" :src="droneSvg" />
    </view>
</template>
<script setup>
import { getAssetsImage } from "@/utils/index.js";
    import md5 from "js-md5";
    import {
        loginByUsername
    } from "@/api/user/index.js";
    import {
        useUserStore
    } from "@/store/index.js";
    import droneSvg from '@/static/images/login/droneSvg.svg'
    import usernameSvg from '@/static/images/login/username.svg'
    import passwordSvg from '@/static/images/login/password.svg'
    import logoSvg from '@/static/images/login/logo.svg'
    import {
        HOME_PATH,
        LOGIN_PATH,
        removeQueryString
    } from "@/router";
    import { onMounted } from 'vue';
import { loginByUsername } from "@/api/user/index.js";
import { useUserStore } from "@/store/index.js";
import { HOME_PATH, LOGIN_PATH, removeQueryString } from "@/router";
import { onMounted } from "vue";
const droneSvg = getAssetsImage("/images/login/droneSvg.svg");
const usernameSvg = getAssetsImage("/images/login/username.svg");
const passwordSvg = getAssetsImage("/images/login/password.svg");
const logoSvg = getAssetsImage("/images/login/logo.svg");
    const userStore = useUserStore();
    const loginForm = ref({
@@ -57,7 +58,7 @@
        const style = {};
        if (loginForm.value.username && loginForm.value.password) {
            style.color = "#fff";
            style.backgroundColor = '#1D6FE9';
    style.backgroundColor = "#1D6FE9";
        }
        return style;
    });
@@ -71,7 +72,7 @@
            uni.showToast({
              title: "请输入用户名",
              icon: "none",
              duration: 2000
      duration: 2000,
            });
            return; 
          }
@@ -80,7 +81,7 @@
            uni.showToast({
              title: "请输入密码",
              icon: "none",
              duration: 2000
      duration: 2000,
            });
            return; 
          }
@@ -96,12 +97,12 @@
        };
        if (rememberPassword.value) {
            uni.setStorageSync('rememberedUser', {
    uni.setStorageSync("rememberedUser", {
                username: loginForm.value.username,
                password: loginForm.value.password
      password: loginForm.value.password,
            });
        } else {
            uni.removeStorageSync('rememberedUser');
    uni.removeStorageSync("rememberedUser");
        }
        try {
@@ -120,18 +121,21 @@
                url: "/pages/map/index",
            });
        } catch (error) {
            const errorMsg =error.data?.error_description !=="Bad credentials" ? error.data?.error_description:  "登录失败,请重试";
    const errorMsg =
      error.data?.error_description !== "Bad credentials"
        ? error.data?.error_description
        : "登录失败,请重试";
            uni.showToast({
                title: errorMsg,
                icon: "none",
                duration: 2000
      duration: 2000,
            });
        }
    }
    // 从本地存储加载记住的密码
    onMounted(() => {
        const savedUserInfo = uni.getStorageSync('rememberedUser');
        console.log('记住密码',savedUserInfo)
  const savedUserInfo = uni.getStorageSync("rememberedUser");
  console.log("记住密码", savedUserInfo);
        if (savedUserInfo) {
            loginForm.value.username = savedUserInfo.username;
            loginForm.value.password = savedUserInfo.password;
@@ -143,7 +147,6 @@
            redirect = decodeURIComponent(options.redirect);
        }
    });
</script>
<style lang="scss" scoped>
@@ -179,7 +182,7 @@
            text-align: center;
            font-style: normal;
            text-transform: none;
            color: #1452D3;
    color: #1452d3;
            text-align: center;
            margin-bottom: 168rpx;
        }
@@ -192,7 +195,7 @@
            margin-left: 62rpx;
            margin-right: 58rpx;
            height: 118rpx;
            border-bottom: 2rpx solid #E3E3E3;
    border-bottom: 2rpx solid #e3e3e3;
            image {
                width: 40rpx;
@@ -209,7 +212,7 @@
            :deep(.uni-input-placeholder) {
                font-size: 32rpx;
                color: #E3E3E3;
      color: #e3e3e3;
                font-weight: 500;
            }
        }
@@ -243,7 +246,7 @@
        .login-btn {
            z-index: 1;
            @apply flex items-center justify-center py-12rpx px-0 text-30rpx border-none;
            background: #1D6FE9;
    background: #1d6fe9;
            color: white;
            width: 590rpx;
            height: 76rpx;
src/pages/map/index copy.vue
@@ -89,12 +89,12 @@
  const mapStore = useMapStore()
  const layers = [{
      src: "/static/images/sl.png",
      src: "https://wrj.shuixiongit.com/drone-app/assets/static/images/sl.png",
      name: '标准地图',
      key: 1,
    },
    {
      src: "/static/images/yx.png",
      src: "https://wrj.shuixiongit.com/drone-app/assets/static/images/yx.png",
      name: '卫星地图',
      key: 2,
    }
@@ -218,13 +218,13 @@
  let map = null
  const layers = [{
      src: "/static/images/sl.png",
      src: "https://wrj.shuixiongit.com/drone-app/assets/static/images/sl.png",
      name: '标准地图',
      key: 1,
      map: basemap0
    },
    {
      src: "/static/images/yx.png",
      src: "https://wrj.shuixiongit.com/drone-app/assets/static/images/yx.png",
      name: '卫星地图',
      key: 2,
      map: basemap1
@@ -308,7 +308,7 @@
        // 创建一个自定义的图片图标
        const customIcon = L.icon({
          iconUrl: './static/images/logo.png', // 替换为你的图片路径
          iconUrl: 'https://wrj.shuixiongit.com/drone-app/assets/static/images/logo.png', // 替换为你的图片路径
          iconSize: [32, 32], // 图标大小
          iconAnchor: [16, 16], // 图标的锚点(设置图片的底部中心)
        });
src/pages/placeholder/placeholder.vue
New file
@@ -0,0 +1,11 @@
<!-- 登录页 -->
<template>
  <view>占位页</view>
</template>
<script setup>
</script>
<style lang="scss" scoped>
</style>
src/pages/user/index.vue
@@ -9,24 +9,39 @@
        <view class="flex-1">
          <view class="userName">{{ userStore?.userInfo?.nick_name }}</view>
          <view class="departs">
            <image src="@/static/images/user/mobile.svg" alt="" />
            <image
              src="https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_app_assets/images/user/mobile.svg"
              alt=""
            />
            <span>{{user.deptName}}</span>
          </view>
        </view>
        <view class="rightLogo">
          <image src="@/static/images/user/logo2.png" alt="" />
          <image
            src="https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/ztzf_app_assets/images/user/logo2.png"
            alt=""
          />
        </view>
      </view>
      <view class="personalInformation">
        <div class="message">
          <div class="messagebox">个人信息</div>
          <div class="editInfo" @click="handelEdit(1)">点击编辑
            <image src="@/static/images/user/rightBtn.svg" alt="" />
          <div class="editInfo" @click="handelEdit(1)">
            点击编辑
            <image
              :src="rightImage"
              alt=""
            />
          </div>
        </div>
        <div class="passwordBox">
          <div class="messagebox">修改密码</div>
          <div class="editInfo" @click="handelEdit(2)">点击编辑 <image src="@/static/images/user/rightBtn.svg" alt="" />
          <div class="editInfo" @click="handelEdit(2)">
            点击编辑
            <image
              :src="rightImage"
              alt=""
            />
          </div>
        </div>
      </view>
@@ -34,74 +49,66 @@
      <view class="mt-20rpx">
        <div class="goOutStyle" @click="logOut">退出登录</div>
      </view>
      <div class="bottomLogo"><image src="@/static/images/user/logo1.png" alt="" /></div>
      <div class="bottomLogo">
        <image
          :src="logoImage"
          alt=""
        />
      </div>
  </view>
  </view>
</template>
<script setup>
  import {
    getUserInfo,
import { getAssetsImage } from "@/utils/index.js";
import { getUserInfo } from "@/api/user/index.js";
import { useClipboard } from "@/hooks";
import { useUserStore } from "@/store/index.js";
import { onShow } from "@dcloudio/uni-app";
import { getDeviceRegionApi } from "@/api/map.js";
  } from '@/api/user/index.js';
  import {
    useClipboard
  } from "@/hooks";
  import {
    useUserStore
  } from "@/store/index.js";
  import {
    onShow
  } from "@dcloudio/uni-app";
  import {
    getDeviceRegionApi
  } from "@/api/map.js";
const { setClipboardData, getClipboardData } = useClipboard();
  const {
    setClipboardData,
    getClipboardData
  } = useClipboard();
const rightImage = getAssetsImage("/images/user/rightBtn.svg");
const logoImage = getAssetsImage("/images/user/logo1.png");
  const userStore = useUserStore();
  const user = ref('')
const user = ref("");
  const getUserInfoData = () => {
    getUserInfo().then(res => {
  getUserInfo().then((res) => {
      user.value = res.data.data;
    });
  };
  function logOut() {
    userStore.setUserInfo(null)
  userStore.setUserInfo(null);
    uni.reLaunch({
      url: '/pages/login/index'
    })
    url: "/pages/login/index",
  });
  }
  function getDeviceRegion() {
    getDeviceRegionApi().then(res => {
    })
  getDeviceRegionApi().then((res) => {});
  }
  const handelEdit = (val) => {
    if (val === 1) {
      uni.navigateTo({
        url: `/subPackages/userDetail/infos/index`
      url: `/subPackages/userDetail/infos/index`,
      });
    } else {
      uni.navigateTo({
        url: `/subPackages/userDetail/password/index`
      url: `/subPackages/userDetail/password/index`,
      });
    }
  }
};
  // 登录鉴权,微信小程序端点击tabbar的底层逻辑不触发uni.switchTab,需要在页面onShow生命周期中校验权限
  onShow(async () => {
    getDeviceRegion()
    getUserInfoData()
  getDeviceRegion();
  getUserInfoData();
    uni.setTabBarItem({
      index: 2, // Tab 的索引(从0开始)
      visible: false,
    })
  });
    uni.setTabBarItem({
      index: 3, // Tab
      visible: true,
@@ -112,7 +119,6 @@
  .page-wrap {
    width: 100%;
    height: 100%;
  }
.userBox {
     padding-top: 88rpx;
@@ -121,7 +127,6 @@
    font-weight: 700;
    font-size: 36rpx;
    color: #000000;
  }
  .departs {
@@ -170,12 +175,12 @@
  .goOutStyle {
    width: 590rpx;
    height: 76rpx;
    background: #1D6FE9;
  background: #1d6fe9;
    border-radius: 40rpx;
    font-family: "Source Han Sans CN";
    font-weight: 400;
    font-size: 28rpx;
    color: #FFFFFF;
  color: #ffffff;
    text-align: center;
    line-height: 76rpx;
    margin: auto;
@@ -217,15 +222,15 @@
    }
    .message {
      background: url(@/static/images/user/info.png) no-repeat center;
    background: url(https://wrj.shuixiongit.com/drone-app/assets/static/images/user/info.png)
      no-repeat center;
      background-size: 100% 100%;
    }
    .passwordBox {
      background: url(@/static/images/user/password.png) no-repeat center;
    background: url(https://wrj.shuixiongit.com/drone-app/assets/static/images/user/password.png)
      no-repeat center;
      background-size: 100% 100%;
    }
  }
</style>
src/static/fonts/font.css
@@ -1,6 +1,6 @@
@font-face {
  font-family: "Source Han Sans CN";
  src: url("SourceHanSansCN-Regular.woff2") format("opentype");
  src: url("./SourceHanSansCN-Regular.woff2") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
@@ -8,35 +8,32 @@
@font-face {
  font-family: "Source Han Sans CN";
  src: url("SourceHanSansCN-Bold.woff2") format("opentype") ;
  src: url("./SourceHanSansCN-Bold.woff2") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Segoe UI";
  src: url("SourceHanSansCN-Regular.woff2") format("opentype");
  src: url("./SourceHanSansCN-Regular.woff2") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Segoe UI";
  src: url("SourceHanSansCN-Bold.woff2") format("opentype") ;
  src: url("./SourceHanSansCN-Bold.woff2") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* 额外的标题字体 */
@font-face {
  font-family: "YouSheBiaoTiHei";
  src: url("YouSheBiaoTiHei.TTF") format("truetype");
  src: url("./YouSheBiaoTiHei.TTF") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
src/subPackages/404/index.vue
@@ -2,8 +2,8 @@
 * @Author       : yuan
 * @Date         : 2025-09-28 09:31:16
 * @LastEditors  : yuan
 * @LastEditTime : 2025-09-28 09:50:32
 * @FilePath     : \src\pages\common\404\index.vue
 * @LastEditTime : 2025-12-16 11:02:27
 * @FilePath     : \src\subPackages\404\index.vue
 * @Description  : 
 * Copyright 2025 OBKoro1, All Rights Reserved. 
 * 2025-09-28 09:31:16
@@ -15,7 +15,7 @@
      mode="page"
      text-size="20"
      text="页面不存在"
      icon="/static/images/404.png"
      :icon="errorImage"
      width="380"
      height="380"
    />
@@ -23,8 +23,11 @@
</template>
<script setup>
import { getAssetsImage } from "@/utils/index.js";
import { HOME_PATH } from "@/router";
const errorImage = getAssetsImage("/404.png");
function handleBack() {
  uni.$u.route({
    type: "switchTab",
src/utils/common/index.js
@@ -10,8 +10,8 @@
 */
// 小程序更新检测
import { useUserStore } from "@/store/index.js"
import configEnv from "@/config/env.js";
import process from "node:process";
import configEnv from "@/config/env.js"
import process from "node:process"
export function mpUpdate () {
  const updateManager = uni.getUpdateManager()
@@ -42,20 +42,21 @@
}
export function getStatusBarHeight() {
  try {
    const systemInfo = uni.getSystemInfoSync();
    return systemInfo.statusBarHeight || 0;
    const systemInfo = uni.getSystemInfoSync()
    return systemInfo.statusBarHeight || 0
  } catch (error) {
    return 0;
    return 0
  }
}
export function getEnvObj() {
  return configEnv[__APP_ENV__?.ENV_NAME] || {}
}
export function getWebViewUrl (targetUrl, otherParams) {
  const userStore = useUserStore()
  const url = getEnvObj().VITE_APP_WEBVIEW_URL
  const uniPlatform = __APP_ENV__.UNI_PLATFORM
  const statusBarHeight = getStatusBarHeight();
  const statusBarHeight = getStatusBarHeight()
  // 1. 处理用户参数
  const userParams = userStore?.userInfo ? JSON.stringify(userStore.userInfo) : '{}'
  // 2. 构建查询参数字符串
@@ -73,3 +74,8 @@
  // 4. 拼接完整 URL
  return `${url}${targetUrl}?${queryString}`
}
export function getAssetsImage (targetUrl) {
  const url = getEnvObj().VITE_APP_ASSETS_URL
  return `${url}${targetUrl}`
}