Ver código fonte

feat:“添加自适应屏幕”

soobin 1 ano atrás
pai
commit
d3b4057c10

+ 1 - 0
package.json

@@ -49,6 +49,7 @@
     "eslint-plugin-vue": "^7.0.0-0",
     "less": "^3.12.2",
     "less-loader": "^7.0.2",
+    "postcss": "^8.4.38",
     "postcss-pxtorem": "^5.1.1",
     "vue-loader-v16": "^16.0.0-beta.5.4"
   },

+ 8 - 0
postcss.config.js

@@ -0,0 +1,8 @@
+module.exports = {
+    plugins: {
+        'postcss-pxtorem': {
+          rootValue: 36,
+          propList: ['*'],
+        },
+      },
+  }

+ 1 - 0
src/App.vue

@@ -20,6 +20,7 @@ import { useRouter } from "vue-router";
 import { getLocal } from "@/common/js/utils";
 import navBar from "@/components/NavBar";
 import { ref } from "vue";
+// import "@/utils/rem.js";
 
 
 export default {

+ 1 - 0
src/assets/language/en.json

@@ -41,6 +41,7 @@
     "sc": "Sevencloud",
     "MG": "Marshmallow",
     "POP": "Popcorn",
+    "ICE": "Ice cream",
     "ifForeignes": "Account type",
     "mainland": "Chinese mainland",
     "overseas": "Hong Kong, Macao, Taiwan and overseas"

+ 1 - 0
src/assets/language/ja.json

@@ -41,6 +41,7 @@
         "sc": "QIYUN",
         "MG": "わたあめ",
         "POP": "ポップコーン",
+        "ICE": "アイスクリーム",
         "ifForeignes": "アカウントの種類",
         "mainland": "中国本土",
         "overseas": "海外"

+ 1 - 0
src/assets/language/zh.json

@@ -41,6 +41,7 @@
     "sc": "七云",
     "MG": "棉花糖",
     "POP": "爆米花",
+    "ICE": "冰淇淋",
     "ifForeignes": "账号类型",
     "mainland": "大陆",
     "overseas": "港澳台及海外"

+ 1 - 0
src/components/typeSelectList/index.less

@@ -25,6 +25,7 @@
         text-overflow: ellipsis;
         white-space: nowrap;
         padding: 0 8px;
+        font-size: 14px;
       }
     }
 

+ 1 - 0
src/components/typeSelectList/index.vue

@@ -187,6 +187,7 @@ export default {
       { text: t('typeSelectList.whole'), value: '' },
       { text: t('typeSelectList.MG'), value: '0' },
       { text: t('typeSelectList.POP'), value: '1' },
+      { text: t('typeSelectList.ICE'), value: '2' },
     ];
     const machineConfirm = ({ selectedOptions }) => {
       machines.value = selectedOptions[0].text;

+ 4 - 4
src/service/login.js

@@ -10,13 +10,13 @@ export function getSys(params) {
   return axios.get(`/SZWL-SERVER/tLogo/getLogo?${stringToUrl(params)}`);
 }
 // 微信授权 -> 获取 openid
-export function getOpenid() {
-  return axios.get('/SZWL-SERVER/wxLogin/menuOauth');
+export function getOpenid(params) {
+  return axios.get(`/SZWL-SERVER/wxLogin/newMenuOauth?${stringToUrl(params)}`);
 }
 
 // 用微信code 获取openid,再获取用户信息
-export function getUserDetailByWxCode(code) {
-  return axios.get('/SZWL-SERVER/wxLogin/getUserDetailByWxCode', { params: { code } });
+export function getUserDetailByWxCode(params) {
+  return axios.get(`/SZWL-SERVER/wxLogin/newGetUserDetailByWxCode?${stringToUrl(params)}`);
 }
 
 // 微信登录

+ 4 - 4
src/styles/orderCenter/index.less

@@ -469,14 +469,14 @@
             }
 
             .word11 {
-              height: 14px;
+              // height: 14px;
               width: 4.5rem;
               overflow-wrap: break-word;
               color: rgba(64, 77, 116, 1);
               font-size: 14px;
               white-space: nowrap;
-              line-height: 14px;
-              margin-top: 10px;
+              line-height: 18px;
+              margin-top: 5px;
               overflow: hidden;
               text-overflow: ellipsis;
               white-space: nowrap;
@@ -494,7 +494,7 @@
               overflow-wrap: break-word;
               color: rgba(64, 77, 116, 1);
               font-size: 14px;
-              line-height: 15px;
+              line-height: 17px;
               display: block;
               overflow: hidden;
               text-overflow: ellipsis;

+ 23 - 0
src/utils/rem.js

@@ -0,0 +1,23 @@
+// 配置基本大小
+let baseSize = 10;
+ 
+// 设置 rem 函数
+function setRem () {
+    //当前页面宽度相对于1920px屏幕宽的缩放比例,可根据自己需要修改。
+    let scale = document.documentElement.clientWidth / 1920;
+    //设置页面根节点字体大小(“Math.min(scale, 2)” 指最高放大比例为2,可根据实际业务需求调整)
+    document.documentElement.style.fontSize = baseSize * Math.min(scale, 2) + 'px'
+}
+setRem(); //初始化
+ 
+// 适配 - 重置函数
+function resetRem (num) {
+    if(num) baseSize = Number(num);
+    setRem();
+}
+window.resetRem = resetRem; // 全局可调用(其他方式也可)
+ 
+// 改变窗口大小时重置 rem
+window.onresize = function () {
+    setRem()
+};

+ 4 - 4
src/views/login.vue

@@ -48,11 +48,11 @@
         <br>
         <br>
         <!-- 微信登录 -->
-        <!-- <div v-if="isInWeChat" class="loginWithWechatClass">
+        <div v-if="isInWeChat" class="loginWithWechatClass">
           <van-button class="wechat-btn" type="primary" size="large" @click="wxLoginHandler">
             <van-icon name="wechat" color="#1bd66c" size="40" class="wechat-icon"/>
           </van-button>
-        </div> -->
+        </div>
 
         <div class="buttonBox">
           <van-button
@@ -61,7 +61,7 @@
               class="register"
               @click="registerClick"
           >{{ $t("login.regusterButton") }}
-          </van-button>
+          </van-button> 
           <van-button round type="primary" native-type="submit">{{
               $t("login.loginButton")
             }}
@@ -246,7 +246,7 @@ export default {
       state.isLoading = true;
       try {
         // 用户静默授权,获取 用户信息
-        const {data} = await getOpenid();
+        const {data} = await getOpenid({hostName: 'Sevencloud'});
         console.log("微信登录:", data)
         if (data.code === "00000") {
           window.location.href = data.data;

+ 1 - 1
src/views/wxLogin.vue

@@ -28,7 +28,7 @@ export default {
     });
     // 登录
     const loginByCode = async (code) => {
-      const { data } = await getUserDetailByWxCode(code);
+      const { data } = await getUserDetailByWxCode({code, hostName: 'Sevencloud'});
       if (data.code === "00000") {
         setLocal("loginUser", JSON.stringify(data.data));
         console.log('loginUser JSON:', JSON.stringify(data.data));