From 8c166f81859481eb609963bca8725e3d066b87df Mon Sep 17 00:00:00 2001 From: YOS-DRVOGPU6U78\Administrator <chenky0613@qq.com> Date: 星期一, 17 七月 2023 12:20:40 +0800 Subject: [PATCH] 初始化项目 --- .gitignore | 1 pages/login/login.vue | 73 +++++++++ static/img/bg3.jpg | 0 static/img/bg1.jpg | 0 static/logo.png | 0 pages.json | 23 ++ App.vue | 21 ++ static/img/right-arrow.png | 0 uni.scss | 78 +++++++++ uni.promisify.adaptor.js | 10 + utils/common.js | 6 static/img/bg2.jpg | 0 utils/request.js | 42 +++++ manifest.json | 72 +++++++++ index.html | 20 ++ config.js | 7 main.js | 24 +++ static/img/bg.png | 0 api/login.js | 8 + pages/index/index.vue | 93 +++++++++++ 20 files changed, 478 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c901d33 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +uni_modules \ No newline at end of file diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..02a7089 --- /dev/null +++ b/App.vue @@ -0,0 +1,21 @@ +<style lang="scss"> + /* 娉ㄦ剰瑕佸啓鍦ㄧ涓�琛岋紝鍚屾椂缁檚tyle鏍囩鍔犲叆lang="scss"灞炴�� */ + @import "@/uni_modules/uview-ui/index.scss"; +</style> +<script> + export default { + onLaunch: function() { + console.log('App Launch') + }, + onShow: function() { + console.log('App Show') + }, + onHide: function() { + console.log('App Hide') + } + } +</script> + +<style> + /*姣忎釜椤甸潰鍏叡css */ +</style> diff --git a/api/login.js b/api/login.js new file mode 100644 index 0000000..039543a --- /dev/null +++ b/api/login.js @@ -0,0 +1,8 @@ +import request from "request"; + +export function login(account,passward) { + return request({ + 'url': '/login', + 'method' : 'post' + }) +} \ No newline at end of file diff --git a/config.js b/config.js new file mode 100644 index 0000000..9aeb448 --- /dev/null +++ b/config.js @@ -0,0 +1,7 @@ +module.exports = { + baseUrl:"http://localhost:9999", + projectType: 'hk',//宸茬粡闆嗘垚涔愪嚎閫歭yt,寰數wd,鏍兼灄娉癵lt锛屾尝杈綽oda + Bluetooth:'false',//鏄惁鍒濆鍖栬摑鐗欏姛鑳� + PlayYes:'false',//鏄惁鎾斁鎵爜鎴愬姛 + PlayNo:'false',//鏄惁鎾斁鎿嶄綔澶辫触 +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..c3ff205 --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8" /> + <script> + var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || + CSS.supports('top: constant(a)')) + document.write( + '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + + (coverSupport ? ', viewport-fit=cover' : '') + '" />') + </script> + <title></title> + <!--preload-links--> + <!--app-context--> + </head> + <body> + <div id="app"><!--app-html--></div> + <script type="module" src="/main.js"></script> + </body> +</html> diff --git a/main.js b/main.js new file mode 100644 index 0000000..a76e4c7 --- /dev/null +++ b/main.js @@ -0,0 +1,24 @@ +import App from './App' +import uView from '@/uni_modules/uview-ui' + +// #ifndef VUE3 +import Vue from 'vue' +import './uni.promisify.adaptor' +Vue.config.productionTip = false +App.mpType = 'app' +Vue.use(uView) +const app = new Vue({ + ...App +}) +app.$mount() +// #endif + +// #ifdef VUE3 +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +// #endif \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..64c1eb4 --- /dev/null +++ b/manifest.json @@ -0,0 +1,72 @@ +{ + "name" : "hk_pda_vue", + "appid" : "__UNI__26663F5", + "description" : "", + "versionName" : "1.0.0", + "versionCode" : "100", + "transformPx" : false, + /* 5+App鐗规湁鐩稿叧 */ + "app-plus" : { + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + /* 妯″潡閰嶇疆 */ + "modules" : {}, + /* 搴旂敤鍙戝竷淇℃伅 */ + "distribute" : { + /* android鎵撳寘閰嶇疆 */ + "android" : { + "permissions" : [ + "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", + "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", + "<uses-permission android:name=\"android.permission.VIBRATE\"/>", + "<uses-permission android:name=\"android.permission.READ_LOGS\"/>", + "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", + "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", + "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", + "<uses-permission android:name=\"android.permission.CAMERA\"/>", + "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", + "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", + "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", + "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", + "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", + "<uses-feature android:name=\"android.hardware.camera\"/>", + "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" + ] + }, + /* ios鎵撳寘閰嶇疆 */ + "ios" : {}, + /* SDK閰嶇疆 */ + "sdkConfigs" : {} + } + }, + /* 蹇簲鐢ㄧ壒鏈夌浉鍏� */ + "quickapp" : {}, + /* 灏忕▼搴忕壒鏈夌浉鍏� */ + "mp-weixin" : { + "appid" : "", + "setting" : { + "urlCheck" : false + }, + "usingComponents" : true + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "vueVersion" : "2" +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..838d646 --- /dev/null +++ b/pages.json @@ -0,0 +1,23 @@ +{ + "pages": [ + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "鐧诲綍" + } + }, + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "MES-绉诲姩缁堢" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "uniIdRouter": {} +} diff --git a/pages/index/index.vue b/pages/index/index.vue new file mode 100644 index 0000000..279764d --- /dev/null +++ b/pages/index/index.vue @@ -0,0 +1,93 @@ +<template> + <u-grid :col="3" @click="gotoPage" border> + <u-grid-item v-for="item in grid" :index="item[0]"> + <u-icon name="photo" :size="46"></u-icon> + <view class="grid-text">{{item[0]}}</view> + </u-grid-item> + </u-grid> +</template> + +<script> + export default { + data() { + return { + grid: [ + [ + "宸℃棣栨", "touliao" + ], + [ + "閲囪喘鍏ュ簱", "touliao" + ], + [ + "鐢熶骇閫�鏂�", "touliao" + ], + [ + "鍏跺畠鍏ュ簱", "touliao" + ], + [ + "鐢熶骇鍏ュ簱", "touliao" + ], + [ + "閲囪喘閫�璐�", "touliao" + ], + [ + "鍏跺畠鍑哄簱", "touliao" + ], + [ + "璋冩嫈鍑哄簱", "touliao" + ], + [ + "璋冩嫈鍏ュ簱", "touliao" + ], + [ + "鐢熶骇鎶ュ伐", "touliao" + ], + [ + "鎵撳嵃璁剧疆", "touliao" + ], + [ + "鐢熶骇澶囨枡", "touliao" + ] + + ], + title: 'Hello' + } + }, + onLoad() { + + }, + methods: { + gotoPage(e) { + console.log(this.grid[e]) + } + } + } +</script> + +<style> + .content { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + } + + .logo { + height: 200rpx; + width: 200rpx; + margin-top: 200rpx; + margin-left: auto; + margin-right: auto; + margin-bottom: 50rpx; + } + + .text-area { + display: flex; + justify-content: center; + } + + .title { + font-size: 36rpx; + color: #8f8f94; + } +</style> \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue new file mode 100644 index 0000000..ce61a34 --- /dev/null +++ b/pages/login/login.vue @@ -0,0 +1,73 @@ +<template> + <view> + <view> + <image src="../../static/img/bg2.jpg" style="width: 100%; display: block;"></image> + </view> + <view> + <u--form labelPosition="left" :model="userInfo" ref="uForm"> + <u-form-item label="鐢ㄦ埛鍚�" labelWidth=65 prop="userInfo.account" borderBottom> + <u--input v-model="userInfo.account" border="none" placeholder="璇疯緭鍏ョ敤鎴峰悕"></u--input> + </u-form-item> + <u-form-item label="瀵嗙爜" labelWidth=65 prop="userInfo.passward"> + <u--input v-model="userInfo.passward" placeholder="璇疯緭鍏ョ敤鎴峰瘑鐮�" border="none" :password="showPassward" + @click="this.showPassward = !this.showPassward " suffixIcon="eye-fill" + suffixIconStyle="color: #909399"></u--input> + </u-form-item> + </u--form> + <u-button text="鐧婚檰" type="primary" style="margin-top: 10px;" @click="login()"></u-button> + </view> + <u-toast ref="uToast" /> + </view> +</template> + +<script> + export default { + data() { + return { + showPassward: true, + userInfo: { + account: '', + passward: '' + } + } + }, + methods: { + login() { + // 杈撳叆妫�楠� + if (this.userInfo.account == null || this.userInfo.account == '') { + this.$refs.uToast.show({ + message: '鐢ㄦ埛鍚嶄负绌�', + type: 'error' + }) + return + } + + if (this.userInfo.passward == null || this.userInfo.passward == '') { + this.$refs.uToast.show({ + message: '瀵嗙爜涓虹┖', + type: 'error' + }) + return + } + + + console.log(this.userInfo) + + uni.navigateTo({ + url:'/pages/index/index' + }) + } + } + } +</script> + +<style> + .uni-input { + height: 28px; + line-height: 28px; + font-size: 15px; + padding: 0px; + flex: 1; + background-color: #FFFFFF; + } +</style> \ No newline at end of file diff --git a/static/img/bg.png b/static/img/bg.png new file mode 100644 index 0000000..5501027 --- /dev/null +++ b/static/img/bg.png Binary files differ diff --git a/static/img/bg1.jpg b/static/img/bg1.jpg new file mode 100644 index 0000000..42dac77 --- /dev/null +++ b/static/img/bg1.jpg Binary files differ diff --git a/static/img/bg2.jpg b/static/img/bg2.jpg new file mode 100644 index 0000000..715a134 --- /dev/null +++ b/static/img/bg2.jpg Binary files differ diff --git a/static/img/bg3.jpg b/static/img/bg3.jpg new file mode 100644 index 0000000..21b7dad --- /dev/null +++ b/static/img/bg3.jpg Binary files differ diff --git a/static/img/right-arrow.png b/static/img/right-arrow.png new file mode 100644 index 0000000..0477c27 --- /dev/null +++ b/static/img/right-arrow.png Binary files differ diff --git a/static/logo.png b/static/logo.png new file mode 100644 index 0000000..b5771e2 --- /dev/null +++ b/static/logo.png Binary files differ diff --git a/uni.promisify.adaptor.js b/uni.promisify.adaptor.js new file mode 100644 index 0000000..47fbce1 --- /dev/null +++ b/uni.promisify.adaptor.js @@ -0,0 +1,10 @@ +uni.addInterceptor({ + returnValue (res) { + if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) { + return res; + } + return new Promise((resolve, reject) => { + res.then((res) => res[0] ? reject(res[0]) : resolve(res[1])); + }); + }, +}); \ No newline at end of file diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000..0978977 --- /dev/null +++ b/uni.scss @@ -0,0 +1,78 @@ +/* uni.scss */ +@import '@/uni_modules/uview-ui/theme.scss'; +/** + * 杩欓噷鏄痷ni-app鍐呯疆鐨勫父鐢ㄦ牱寮忓彉閲� + * + * uni-app 瀹樻柟鎵╁睍鎻掍欢鍙婃彃浠跺競鍦猴紙https://ext.dcloud.net.cn锛変笂寰堝涓夋柟鎻掍欢鍧囦娇鐢ㄤ簡杩欎簺鏍峰紡鍙橀噺 + * 濡傛灉浣犳槸鎻掍欢寮�鍙戣�咃紝寤鸿浣犱娇鐢╯css棰勫鐞嗭紝骞跺湪鎻掍欢浠g爜涓洿鎺ヤ娇鐢ㄨ繖浜涘彉閲忥紙鏃犻渶 import 杩欎釜鏂囦欢锛夛紝鏂逛究鐢ㄦ埛閫氳繃鎼Н鏈ㄧ殑鏂瑰紡寮�鍙戞暣浣撻鏍间竴鑷寸殑App + * + */ + +/** + * 濡傛灉浣犳槸App寮�鍙戣�咃紙鎻掍欢浣跨敤鑰咃級锛屼綘鍙互閫氳繃淇敼杩欎簺鍙橀噺鏉ュ畾鍒惰嚜宸辩殑鎻掍欢涓婚锛屽疄鐜拌嚜瀹氫箟涓婚鍔熻兘 + * + * 濡傛灉浣犵殑椤圭洰鍚屾牱浣跨敤浜唖css棰勫鐞嗭紝浣犱篃鍙互鐩存帴鍦ㄤ綘鐨� scss 浠g爜涓娇鐢ㄥ涓嬪彉閲忥紝鍚屾椂鏃犻渶 import 杩欎釜鏂囦欢 + */ + +/* 棰滆壊鍙橀噺 */ + +/* 琛屼负鐩稿叧棰滆壊 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$uni-color-warning: #f0ad4e; +$uni-color-error: #dd524d; + +/* 鏂囧瓧鍩烘湰棰滆壊 */ +$uni-text-color:#333;//鍩烘湰鑹� +$uni-text-color-inverse:#fff;//鍙嶈壊 +$uni-text-color-grey:#999;//杈呭姪鐏拌壊锛屽鍔犺浇鏇村鐨勬彁绀轰俊鎭� +$uni-text-color-placeholder: #808080; +$uni-text-color-disable:#c0c0c0; + +/* 鑳屾櫙棰滆壊 */ +$uni-bg-color:#ffffff; +$uni-bg-color-grey:#f8f8f8; +$uni-bg-color-hover:#f1f1f1;//鐐瑰嚮鐘舵�侀鑹� +$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//閬僵棰滆壊 + +/* 杈规棰滆壊 */ +$uni-border-color:#c8c7cc; + +/* 灏哄鍙橀噺 */ + +/* 鏂囧瓧灏哄 */ +$uni-font-size-sm:12px; +$uni-font-size-base:14px; +$uni-font-size-lg:16; + +/* 鍥剧墖灏哄 */ +$uni-img-size-sm:20px; +$uni-img-size-base:26px; +$uni-img-size-lg:40px; + +/* Border Radius */ +$uni-border-radius-sm: 2px; +$uni-border-radius-base: 3px; +$uni-border-radius-lg: 6px; +$uni-border-radius-circle: 50%; + +/* 姘村钩闂磋窛 */ +$uni-spacing-row-sm: 5px; +$uni-spacing-row-base: 10px; +$uni-spacing-row-lg: 15px; + +/* 鍨傜洿闂磋窛 */ +$uni-spacing-col-sm: 4px; +$uni-spacing-col-base: 8px; +$uni-spacing-col-lg: 12px; + +/* 閫忔槑搴� */ +$uni-opacity-disabled: 0.3; // 缁勪欢绂佺敤鎬佺殑閫忔槑搴� + +/* 鏂囩珷鍦烘櫙鐩稿叧 */ +$uni-color-title: #2C405A; // 鏂囩珷鏍囬棰滆壊 +$uni-font-size-title:20px; +$uni-color-subtitle: #555555; // 浜岀骇鏍囬棰滆壊 +$uni-font-size-subtitle:26px; +$uni-color-paragraph: #3F536E; // 鏂囩珷娈佃惤棰滆壊 +$uni-font-size-paragraph:15px; diff --git a/utils/common.js b/utils/common.js new file mode 100644 index 0000000..f447160 --- /dev/null +++ b/utils/common.js @@ -0,0 +1,6 @@ +export function toast(content) { + uni.showToast({ + icon:'none', + title:content + }) +} \ No newline at end of file diff --git a/utils/request.js b/utils/request.js new file mode 100644 index 0000000..c2bd291 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,42 @@ +const { error } = require("jquery") +const { toast } = require("./common") + +let timeout = 10000 +const baseUrl = config.baseUrl + +const request = config => { + return new Promise((resolve,reject) => { + uni.request({ + method:config.method || 'GET', + timeout:config.timeoue || timeout, + url:config.baseUrl || baseUrl + config.url, + data:config.data, + header: config.header || {'Content-Type': 'application/json'}, + dataType: 'json' + }).then(response => { + let [error,res] = response + if(error) { + toast('缃戠粶寮傚父,璇风◢鍚庨噸璇�') + return + } + const result = res.data.result || true + const msg = errorCode[code] || res.data.msg || ErrorCode['defalut'] + + if(!res) { + toast(msg) + return + } + resolve(res.data) + }).catch(error => { + let {message} = error + if(message === 'Network Error') { + message = '鍚庣鎺ュ彛杩炴帴寮傚父' + } else if(message.includes('timeout')) { + message = '绯荤粺鎺ュ彛璇锋眰瓒呮椂' + } else if (message.includes('Request failed with status code')) { + message = '绯荤粺鎺ュ彛' + message.substr(message.length - 3) + '寮傚父' + } + toast(message) + }) + }) +} \ No newline at end of file -- Gitblit v1.9.3