陈龙 4 ماه پیش
والد
کامیت
30c352bf74

+ 0 - 114
src/Auman.PieceWage.UniApp/pages.json

@@ -25,120 +25,6 @@
                 "navigationBarTitleText": "服务器设置",
                 "enablePullDownRefresh": false
             }
-        }, 
-        {
-            "path": "pages/outsourcedDelivery/index",
-            "style": {
-                "navigationBarTitleText": "外协送货扫描",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/completionOrder/index",
-            "style": {
-                "navigationBarTitleText": "送货单扫描",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/completionOrder/line",
-            "style": {
-                "navigationBarTitleText": "送货单行",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/completionOrder/result",
-            "style": {
-                "navigationBarTitleText": "送货单扫描结果",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/receiptOrder/index",
-            "style": {
-                "navigationBarTitleText": "入库校验",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/receiptOrder/line",
-            "style": {
-                "navigationBarTitleText": "入库单行",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/receiptOrder/result",
-            "style": {
-                "navigationBarTitleText": "入库检验扫描结果",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/outsourceCustomizeDeliveryOrder/index",
-            "style": {
-                "navigationBarTitleText": "OEM入库扫描",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/outsourceCustomizeDeliveryOrder/line",
-            "style": {
-                "navigationBarTitleText": "OEM入库扫描",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/outsourceCustomizeDeliveryOrder/result",
-            "style": {
-                "navigationBarTitleText": "OEM入库扫描",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/pickupOrder/index",
-            "style": {
-                "navigationBarTitleText": "提货单扫描",
-                "enablePullDownRefresh": false
-            }
-        }, 
-        {
-            "path": "pages/pickupOrder/view",
-            "style": {
-                "navigationBarTitleText": "未扫产品明细",
-                "enablePullDownRefresh": false
-            }
-        },
-        {
-            "path" : "pages/shipPlan/index",
-            "style" : 
-            {
-                "navigationBarTitleText" : "整车、分仓",
-                "enablePullDownRefresh": false
-            }
-        },
-        {
-            "path" : "pages/multiCustomizeDeliveryOrder/index",
-            "style" : 
-            {
-                "navigationBarTitleText" : "定制多仓位入库",
-                "enablePullDownRefresh": false
-            }
-        },
-        {
-            "path" : "pages/multiCustomizeDeliveryOrder/detail",
-            "style" : 
-            {
-                "navigationBarTitleText" : "总编号明细"
-            }
-        },
-        {
-            "path" : "pages/multiCustomizeDeliveryOrder/location",
-            "style" : 
-            {
-                "navigationBarTitleText" : "选择仓位"
-            }
         }
     ],
     "globalStyle": {

+ 34 - 19
src/Auman.PieceWage.UniApp/pages/login/index.vue

@@ -1,16 +1,20 @@
 <template>
-    <view class="status-bar-height"></view>
-    <uni-nav-bar fixed="true" title="登录" backgroundColor="#f8f8f8" :border="false" leftIcon="left" rightIcon="gear"
-        @clickRight="openSetting" @clickLeft="back"></uni-nav-bar>
-    <view class="title padding-top">
-        <view class="title-name">双虎物流平台智能客户端</view>
-    </view>
-    <view class="flex direction-column padding">
-        <uni-easyinput class="padding-top" placeholder="账号" v-model="username"></uni-easyinput>
-        <uni-easyinput class="padding-top" placeholder="密码" v-model="password" type="password"
-            @confirm="login"></uni-easyinput>
-        <view class="flex padding-top">
-            <button type="primary" class="grow-1" @tap="login">登录</button>
+    <view class="flex direction-column">
+        <view class="status-bar-height"></view>
+        <view class="flex direction-column gap grow-1">
+            <uni-nav-bar fixed="true" title="登录" backgroundColor="#f8f8f8" :border="false" leftIcon="left"
+                rightIcon="gear" @clickRight="openSetting" @clickLeft="back"></uni-nav-bar>
+            <view class="title padding-top">
+                <view class="title-name">双虎物流平台智能客户端</view>
+            </view>
+            <view class="flex direction-column padding">
+                <uni-easyinput class="padding-top" placeholder="账号" v-model="username"></uni-easyinput>
+                <uni-easyinput class="padding-top" placeholder="密码" v-model="password" type="password"
+                    @confirm="login"></uni-easyinput>
+                <view class="flex padding-top">
+                    <button type="primary" class="grow-1" @tap="login">登录</button>
+                </view>
+            </view>
         </view>
     </view>
 </template>
@@ -33,8 +37,8 @@
         onLoad(opts) {
             let info = user.getRemember();
             if (extend.isObject(info)) {
-                this.username = info.LoginName;
-                this.password = info.Password;
+                this.username = info.username;
+                this.password = info.password;
             }
             if (extend.isObject(opts)) {
                 switch (opts.type) {
@@ -59,24 +63,35 @@
 
             async login() {
                 let data = {
-                    LoginName: this.username,
-                    Password: this.password
+                    client_id: 'kapok',
+                    client_secret: 'mall',
+                    grant_type: 'password',
+                    username: this.username,
+                    password: this.password
                 };
                 uni.showLoading({
                     title: '登陆中...',
                     mask: true,
                 });
                 let res = await token.getByServer({
-                    url: 'api/PDAScan/Login',
+                    url: '/oauth2/token',
                     data: data
                 });
                 uni.hideLoading();
                 if (res.success) {
                     // 登录成功
                     user.setRemember({
-                        LoginName: this.username,
-                        Password: this.password
+                        username: this.username,
+                        password: this.password
+                    });
+
+                    let userRes = await user.getByServer({
+                        url: '/auman/user/info'
                     });
+                    console.log(userRes);
+                    if (userRes.success) {
+                        user.set(userRes.data.data);
+                    }
                     let url = extend.isNonEmptyString(this.prevPage) ? this.prevPage : '/pages/home/index';
                     uni.switchTab({
                         url: url

+ 2 - 23
src/Auman.PieceWage.UniApp/pages/login/serverSetting.vue

@@ -29,38 +29,17 @@
         list: [{
                 id: 1,
                 text: '外网',
-                url: 'http://www.sun-hoo.cn:6678/webapi/',
+                url: 'http://106.12.207.123:8081/',
                 editabled: false,
                 type: 'blue'
             },
-            {
-                id: 2,
-                text: '内网',
-                url: 'http://192.168.100.130/webapi/',
-                editabled: false,
-                type: 'green'
-            },
             {
                 id: 3,
                 text: '自定义',
                 url: '',
                 editabled: true,
                 type: 'red'
-            },
-            // {
-            //     id: 4,
-            //     text: '测试外网',
-            //     url: 'http://www.sun-hoo.cn:6699/webapi2/',
-            //     editabled: false,
-            //     type: 'gray'
-            // },
-            // {
-            //     id: 5,
-            //     text: '测试内网',
-            //     url: 'http://192.168.100.51/webapi2/',
-            //     editabled: false,
-            //     type: 'gray'
-            // },
+            }
         ],
     };
 

BIN
src/Auman.PieceWage.UniApp/static/logo.png


+ 13 - 8
src/Auman.PieceWage.UniApp/utils/request.js

@@ -3,6 +3,7 @@ import token from './token.js';
 import result from './result.js';
 import ResultData from './resultData.js';
 import Tone from './tone.js';
+import url from './url.js';
 
 /**
  * 基础链接存储键
@@ -43,16 +44,18 @@ const request = {
      * 获取基础地址
      */
     async getBaseUrl() {
-        return extend.readStorage(baseUrlKey);
+        return url.apiUrl;
+        // return extend.readStorage(baseUrlKey);
     },
 
     /**
      * 网络请求
      * @param {Object} opts - 请求参数
      * @param {string} opts.url - 请求地址
-     * @param {string} opts.method - 请求方法,默认 get
-     * @param {string} opts.dataType - 传输数据类型,默认 json
-     * @param {string} opts.responseType - 接受数据类型,默认 json
+     * @param {string} opts.method - 请求方法,合法值:get、post、put、delete,默认 get,默认 get
+     * @param {string} opts.type - 发送数据类型,合法值:json、xml、text、form、url、blob,默认 json
+     * @param {string} opts.dataType - 接收数据类型,如果设为json,会尝试对返回的数据做一次 JSON.parse,默认 json
+     * @param {string} opts.responseType - 响应数据类型,合法值:text、arraybuffer,默认 text
      * @param {Object} opts.data - 请求参数
      * @param {Object} opts.header - 请求头
      * @returns {ResultData} 结果对象
@@ -71,7 +74,9 @@ const request = {
             let baseUrl = await request.getBaseUrl();
 
             try {
-                if (!extend.isUrl(opts.url)) {
+                if (extend.isUrl(opts.url)) {
+                    url = opts.url;
+                } else {
                     if (extend.isEmptyString(baseUrl)) {
                         resolve({
                             success: false,
@@ -86,9 +91,6 @@ const request = {
                     opts.header = {};
                 }
                 switch (opts.type) {
-                    case 'json':
-                        opts.header['content-type'] = 'application/json';
-                        break;
                     case 'xml':
                         opts.header['content-type'] = 'application/xml; charset=utf-8';
                         break;
@@ -104,6 +106,9 @@ const request = {
                     case 'blob':
                         opts.header['content-type'] = 'text/plain';
                         break;
+                    case 'json':
+                    default:
+                        opts.header['content-type'] = 'application/json';
                 }
                 if (extend.isEmptyString(opts.method)) {
                     opts.method = 'get';

+ 6 - 4
src/Auman.PieceWage.UniApp/utils/token.js

@@ -2,6 +2,7 @@ import extend from './extend.js';
 import request from './request.js';
 import result from './result.js';
 import user from './user.js';
+import url from './url.js';
 
 /**
  * 默认过期时间 8 小时
@@ -90,7 +91,7 @@ export default {
         if (extend.isEmptyString(opts.url)) {
             opts.url = extend.readStorage(tokenUrlKey);
             if (extend.isEmptyString(opts.url)) {
-                opts.url = 'api/PDAScan/Login';
+                opts.url = 'oauth2/token';
             }
         } else {
             extend.addStorage(tokenUrlKey, opts.url);
@@ -105,18 +106,19 @@ export default {
             };
         }
         let res = await request.send({
-            url: opts.url,
+            url: `${url.authUrl}${opts.url}`,
             method: 'post',
+            type: 'url',
             data: opts.data
         });
         if (res.success) {
             // 登录成功
             user.setLoginInfo(opts.data);
             user.set(res.data);
-            let token = res.data.Token.token_type + ' ' + res.data.Token.access_token;
+            let token = res.data.token_type + ' ' + res.data.access_token;
             this.set({
                 token: token,
-                expires_in: res.data.Token.expires_in
+                expires_in: res.data.expires_in
             });
         }
         return res;

+ 19 - 0
src/Auman.PieceWage.UniApp/utils/url.js

@@ -0,0 +1,19 @@
+/**
+ * 地址类
+ */
+class Url {
+    /**
+     * 认证地址
+     */
+    authUrl = 'http://106.12.207.123:8087/';
+
+    /**
+     * 接口地址
+     */
+    apiUrl = 'http://106.12.207.123:8081/';
+}
+
+/**
+ * 地址类
+ */
+export default new Url();

+ 17 - 4
src/Auman.PieceWage.UniApp/utils/user.js

@@ -1,4 +1,5 @@
 import extend from '../utils/extend.js';
+import request from './request.js';
 
 /**
  * 结果键
@@ -19,6 +20,18 @@ const rememberKey = 'login_remember';
  * 用户类
  */
 export default {
+    /**
+     * 从服务器获取
+     * @param {object} opts 参数
+     * @param {string} opts.url 访问地址
+     * @param {string} opts.method 方法,合法值:get、post、put、delete,默认 get
+     */
+    async getByServer(opts) {
+        let res = await request.sendToken({
+            url: opts.url
+        });
+    },
+
     /**
      * 获取用户对象
      */
@@ -59,8 +72,8 @@ export default {
     /**
      * 设置登录信息
      * @param {object} info 登录信息
-     * @param {string} info.LoginName 登录账号
-     * @param {string} info.Password 登录密码
+     * @param {string} info.username 登录账号
+     * @param {string} info.password 登录密码
      * @returns {boolean} 设置成功标记
      */
     setLoginInfo(info) {
@@ -74,8 +87,8 @@ export default {
     /**
      * 设置登录信息
      * @param {object} info 登录信息
-     * @param {string} info.LoginName 登录账号
-     * @param {string} info.Password 登录密码
+     * @param {string} info.username 登录账号
+     * @param {string} info.password 登录密码
      * @returns {boolean} 设置成功标记
      */
     setRemember(info) {