Explorar el Código

代码数据库功能更新

oyq28 hace 4 meses
padre
commit
56aa610f35

+ 11 - 0
api/login.uts

@@ -1,4 +1,5 @@
 import request from '@/utils/request'
+import sqlite from '@/utils/sqlite'
 
 export function offlineData(data:UTSJSONObject):Promise<UTSJSONObject> {
 	return new Promise((resolve, reject) => {	
@@ -24,6 +25,11 @@ export function login(username:string, password:string, code:string, uuid:string
   	token: '123456', 
 	roles:[] as string[]
   } as UTSJSONObject
+  
+  // #ifdef APP-ANDROID
+  let result = sqlite.selectTableData('app_user','username',data['username'],'password',data['password']);
+  console.log(result)
+  // #endif
   /*
   return request({
     'url': '/login',
@@ -70,6 +76,11 @@ export function getInfo():Promise<UTSJSONObject> {
 	roles:[] as string[]
   } as UTSJSONObject
   
+  // #ifdef APP-ANDROID
+  let result = sqlite.selectTableData('app_user','username',data['username'],'password',data['password']);
+  console.log(result)
+  // #endif
+    
   return offlineData(data)
 }
 

BIN
db/qt_app_800.db


+ 214 - 0
npminstall-debug.log

@@ -0,0 +1,214 @@
+{
+  root: 'D:\\QTApp_800',
+  registry: 'https://registry.npmmirror.com',
+  pkgs: [
+    {
+      name: '@types/dcloudio__uni-app-plus',
+      version: 'latest',
+      type: 'tag',
+      alias: undefined,
+      arg: [Result]
+    }
+  ],
+  production: false,
+  cacheStrict: false,
+  cacheDir: 'C:\\Users\\phoenix9412\\.npminstall_tarball',
+  env: {
+    npm_config_registry: 'https://registry.npmmirror.com',
+    npm_config_argv: '{"remain":[],"cooked":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\phoenix9412\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","--save-dev","@types/dcloudio__uni-app-plus"],"original":["--fix-bug-versions","--china","--userconfig=C:\\\\Users\\\\phoenix9412\\\\.cnpmrc","--disturl=https://cdn.npmmirror.com/binaries/node","--registry=https://registry.npmmirror.com","--save-dev","@types/dcloudio__uni-app-plus"]}',
+    npm_config_user_agent: 'npminstall/7.12.0 npm/? node/v23.6.0 win32 x64',
+    npm_config_cache: 'C:\\Users\\phoenix9412\\.npminstall_tarball',
+    NODE: 'C:\\Program Files\\nodejs\\node.exe',
+    npm_node_execpath: 'C:\\Program Files\\nodejs\\node.exe',
+    npm_execpath: 'D:\\item\\nvm\\v23.6.0\\node_global\\node_modules\\cnpm\\node_modules\\npminstall\\bin\\install.js',
+    npm_config_userconfig: 'C:\\Users\\phoenix9412\\.cnpmrc',
+    npm_config_disturl: 'https://cdn.npmmirror.com/binaries/node',
+    npm_config_r: 'https://registry.npmmirror.com',
+    COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com',
+    EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver',
+    NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
+    NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
+    PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs',
+    CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver',
+    OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver',
+    CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip',
+    ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/',
+    ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/',
+    SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass',
+    SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc',
+    NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v',
+    PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
+    PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
+    PUPPETEER_CHROME_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
+    PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
+    PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright',
+    SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli',
+    SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl',
+    RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2',
+    RE2_DOWNLOAD_SKIP_PATH: 'true',
+    PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma',
+    npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3',
+    npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar',
+    npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
+    npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
+    npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs',
+    npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl',
+    npm_rootpath: 'D:\\QTApp_800',
+    INIT_CWD: 'D:\\QTApp_800'
+  },
+  binaryMirrors: {
+    ENVS: {
+      COREPACK_NPM_REGISTRY: 'https://registry.npmmirror.com',
+      EDGEDRIVER_CDNURL: 'https://npmmirror.com/mirrors/edgedriver',
+      NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
+      NVM_NODEJS_ORG_MIRROR: 'https://cdn.npmmirror.com/binaries/node',
+      PHANTOMJS_CDNURL: 'https://cdn.npmmirror.com/binaries/phantomjs',
+      CHROMEDRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/chromedriver',
+      OPERADRIVER_CDNURL: 'https://cdn.npmmirror.com/binaries/operadriver',
+      CYPRESS_DOWNLOAD_PATH_TEMPLATE: 'https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip',
+      ELECTRON_MIRROR: 'https://cdn.npmmirror.com/binaries/electron/',
+      ELECTRON_BUILDER_BINARIES_MIRROR: 'https://cdn.npmmirror.com/binaries/electron-builder-binaries/',
+      SASS_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-sass',
+      SWC_BINARY_SITE: 'https://cdn.npmmirror.com/binaries/node-swc',
+      NWJS_URLBASE: 'https://cdn.npmmirror.com/binaries/nwjs/v',
+      PUPPETEER_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
+      PUPPETEER_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
+      PUPPETEER_CHROME_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
+      PUPPETEER_CHROME_HEADLESS_SHELL_DOWNLOAD_BASE_URL: 'https://cdn.npmmirror.com/binaries/chrome-for-testing',
+      PLAYWRIGHT_DOWNLOAD_HOST: 'https://cdn.npmmirror.com/binaries/playwright',
+      SENTRYCLI_CDNURL: 'https://cdn.npmmirror.com/binaries/sentry-cli',
+      SAUCECTL_INSTALL_BINARY_MIRROR: 'https://cdn.npmmirror.com/binaries/saucectl',
+      RE2_DOWNLOAD_MIRROR: 'https://cdn.npmmirror.com/binaries/node-re2',
+      RE2_DOWNLOAD_SKIP_PATH: 'true',
+      PRISMA_ENGINES_MIRROR: 'https://cdn.npmmirror.com/binaries/prisma',
+      npm_config_better_sqlite3_binary_host: 'https://cdn.npmmirror.com/binaries/better-sqlite3',
+      npm_config_keytar_binary_host: 'https://cdn.npmmirror.com/binaries/keytar',
+      npm_config_sharp_binary_host: 'https://cdn.npmmirror.com/binaries/sharp',
+      npm_config_sharp_libvips_binary_host: 'https://cdn.npmmirror.com/binaries/sharp-libvips',
+      npm_config_robotjs_binary_host: 'https://cdn.npmmirror.com/binaries/robotjs',
+      npm_config_gl_binary_host: 'https://cdn.npmmirror.com/binaries/gl'
+    },
+    '@ali/s2': { host: 'https://cdn.npmmirror.com/binaries/looksgood-s2' },
+    sharp: { replaceHostFiles: [Array], replaceHostMap: [Object] },
+    '@tensorflow/tfjs-node': {
+      replaceHostFiles: [Array],
+      replaceHostRegExpMap: [Object],
+      replaceHostMap: [Object]
+    },
+    cypress: {
+      host: 'https://cdn.npmmirror.com/binaries/cypress',
+      newPlatforms: [Object]
+    },
+    'utf-8-validate': {
+      host: 'https://cdn.npmmirror.com/binaries/utf-8-validate/v{version}'
+    },
+    xprofiler: {
+      remote_path: './xprofiler/v{version}/',
+      host: 'https://cdn.npmmirror.com/binaries'
+    },
+    leveldown: { host: 'https://cdn.npmmirror.com/binaries/leveldown/v{version}' },
+    couchbase: { host: 'https://cdn.npmmirror.com/binaries/couchbase/v{version}' },
+    gl: { host: 'https://cdn.npmmirror.com/binaries/gl/v{version}' },
+    sqlite3: {
+      host: 'https://cdn.npmmirror.com/binaries/sqlite3',
+      remote_path: 'v{version}'
+    },
+    '@journeyapps/sqlcipher': { host: 'https://cdn.npmmirror.com/binaries' },
+    grpc: {
+      host: 'https://cdn.npmmirror.com/binaries',
+      remote_path: '{name}/v{version}'
+    },
+    'grpc-tools': { host: 'https://cdn.npmmirror.com/binaries' },
+    wrtc: {
+      host: 'https://cdn.npmmirror.com/binaries',
+      remote_path: '{name}/v{version}'
+    },
+    fsevents: { host: 'https://cdn.npmmirror.com/binaries/fsevents' },
+    nodejieba: { host: 'https://cdn.npmmirror.com/binaries/nodejieba' },
+    canvas: {
+      host: 'https://cdn.npmmirror.com/binaries/canvas',
+      remote_path: 'v{version}'
+    },
+    'skia-canvas': { host: 'https://cdn.npmmirror.com/binaries/skia-canvas' },
+    'flow-bin': {
+      replaceHost: 'https://github.com/facebook/flow/releases/download/v',
+      host: 'https://cdn.npmmirror.com/binaries/flow/v'
+    },
+    'jpegtran-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/jpegtran-bin'
+    },
+    'cwebp-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/cwebp-bin'
+    },
+    'zopflipng-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/zopflipng-bin'
+    },
+    'optipng-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/optipng-bin'
+    },
+    mozjpeg: {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/mozjpeg-bin'
+    },
+    gifsicle: {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/gifsicle-bin'
+    },
+    'pngquant-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/pngquant-bin',
+      replaceHostMap: [Object]
+    },
+    'pngcrush-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/pngcrush-bin'
+    },
+    'jpeg-recompress-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/jpeg-recompress-bin'
+    },
+    'advpng-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/advpng-bin'
+    },
+    'pngout-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/pngout-bin'
+    },
+    'jpegoptim-bin': {
+      replaceHost: [Array],
+      host: 'https://cdn.npmmirror.com/binaries/jpegoptim-bin'
+    },
+    argon2: { host: 'https://cdn.npmmirror.com/binaries/argon2' },
+    'ali-zeromq': { host: 'https://cdn.npmmirror.com/binaries/ali-zeromq' },
+    'ali-usb_ctl': { host: 'https://cdn.npmmirror.com/binaries/ali-usb_ctl' },
+    'gdal-async': { host: 'https://cdn.npmmirror.com/binaries/node-gdal-async' },
+    'libpg-query': { host: 'https://cdn.npmmirror.com/binaries' }
+  },
+  forbiddenLicenses: null,
+  flatten: false,
+  proxy: undefined,
+  prune: false,
+  disableFallbackStore: false,
+  workspacesMap: Map(0) {},
+  enableWorkspace: false,
+  workspaceRoot: 'D:\\QTApp_800',
+  isWorkspaceRoot: true,
+  isWorkspacePackage: false,
+  offline: false,
+  strictSSL: false,
+  ignoreScripts: false,
+  foregroundScripts: false,
+  ignoreOptionalDependencies: false,
+  detail: false,
+  forceLinkLatest: false,
+  trace: false,
+  engineStrict: false,
+  registryOnly: false,
+  client: false,
+  autoFixVersion: [Function: autoFixVersion]
+}

+ 10 - 0
package.json

@@ -0,0 +1,10 @@
+{
+  "dependencies": {
+    "@dcloudio/uni-app-plus": "^2.0.2-4070620250821001",
+    "@dcloudio/uni-i18n": "^2.0.2-4070620250821001",
+    "uni-sqlite": "^0.0.1"
+  },
+  "devDependencies": {
+    "@dcloudio/uni-app-plus": "^2.0.2-4070620250821001"
+  }
+}

+ 24 - 14
pages/register.uvue

@@ -1,33 +1,34 @@
 <template>
   <view class=" normal-login-container my-page">
     <view class=" logo-content align-center justify-center flex">
-        <image class="my-image" style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
+        <image class="my-image" style="width: 100rpx;height: 100rpx;" :src="(globalConfig['appInfo'] as UTSJSONObject)['logo'] as string" mode="widthFix">
       </image>
 	  
       <text class="title">若依移动端注册</text>
     </view>
     <view class=" login-form-content">
-      <view class=" input-item flex align-center">
+      <view class=" input-item flex align-center uni-row">
         <view class=" iconfont icon-user icon"></view>
         <input v-model="registerForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
       </view>
-      <view class=" input-item flex align-center">
+      <view class=" input-item flex align-center uni-row">
         <view class=" iconfont icon-password icon"></view>
         <input v-model="registerForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
       </view>
-      <view class=" input-item flex align-center">
+      <view class=" input-item flex align-center uni-row">
         <view class=" iconfont icon-password icon"></view>
         <input v-model="registerForm.confirmPassword" type="password" class="input" placeholder="请输入重复密码" maxlength="20" />
       </view>
+	  <!--
       <view class=" input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
         <view class=" iconfont icon-code icon"></view>
         <input v-model="registerForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
         <view class=" login-code"> 
           <image :src="codeUrl" @click="getCode" class="login-code-img my-image"></image>
         </view>
-      </view>
+      </view> -->
       <view class=" action-btn">
-        <button @click="handleRegister()" class="register-btn cu-btn block bg-blue lg round">注册</button>
+        <button @click="handleRegister()" class="register-btn block bg-blue lg round">注册</button>
       </view>
     </view>
     <view class=" xieyi text-center">
@@ -46,7 +47,7 @@ import { getCodeImg, register, RegForm} from '@/api/login'
       return {
         codeUrl: "" as string,
         captchaEnabled: true as boolean,
-        globalConfig: getApp().globalData.config as GlobalConfig,
+        globalConfig: getApp().globalData.config as UTSJSONObject,
         registerForm: {
           username: "",
           password: "",
@@ -57,7 +58,7 @@ import { getCodeImg, register, RegForm} from '@/api/login'
       } 
     },
     created() {
-      this.getCode()
+      //this.getCode()
     },
     methods: {
       // 用户登录
@@ -98,12 +99,14 @@ import { getCodeImg, register, RegForm} from '@/api/login'
             title: '两次输入的密码不一致',
             icon: 'error'
           });
-        } else if (this.registerForm.code == "" && this.captchaEnabled) {
+        } 
+		/*else if (this.registerForm.code == "" && this.captchaEnabled) {
           uni.showToast({
             title: '请输入验证码',
             icon: 'error'
           });
-        } else {
+        } */
+		else {
           uni.showLoading({
             title: '注册中,请耐心等待...'
           });
@@ -151,6 +154,8 @@ import { getCodeImg, register, RegForm} from '@/api/login'
 
   .normal-login-container {
     width: 100%;
+	align-items: center;
+	justify-content: center;
 
     .logo-content {
       width: 100%;
@@ -168,7 +173,9 @@ import { getCodeImg, register, RegForm} from '@/api/login'
     }
 
     .login-form-content {
-      text-align: center;
+     /* #ifdef APP-NVUE */
+     text-align: center;
+     /* #endif */
       margin: 20px auto;
       margin-top: 15%;
       width: 80%;
@@ -180,16 +187,19 @@ import { getCodeImg, register, RegForm} from '@/api/login'
         border-radius: 20px;
 
         .icon {
-          font-size: 38rpx;
+          /* #ifdef APP-NVUE */
+            font-size: 38rpx;
+            color: #999;
+          /* #endif */
           margin-left: 10px;
-          color: #999;
         }
 
         .input {
           width: 100%;
           font-size: 14px;
+          /* #ifdef APP-NVUE */
           line-height: 20px;
-          text-align: left;
+          /* #endif */
           padding-left: 15px;
         }
 

+ 8 - 6
pages/work/download/DownloadDetail.uvue

@@ -19,12 +19,12 @@
 		
 		<view class="section">
 			<uni-table >
-				<uni-tr v-for="(item,index) in titleList" :key="index">
+				<uni-tr class="section-title" v-for="(item,index) in titleList" :key="index">
 					<uni-td class="grid-text">{{item.title1}}</uni-td>
 					<uni-td class="grid-text">{{item.title2}}</uni-td>
 					<uni-td class="grid-text">{{item.title3}}</uni-td>				
 				</uni-tr>
-				<uni-tr v-for="(taskProcess,index2) in taskProcessList" :key="index2">
+				<uni-tr class="section-title" v-for="(taskProcess,index2) in taskProcessList" :key="index2">
 					<uni-td class="grid-text">{{taskProcess.name}}</uni-td>
 					<uni-td class="grid-text">{{taskProcess.step}}/{{taskProcess.num}}</uni-td>
 					<uni-td></uni-td>
@@ -109,11 +109,9 @@
 	}
 
 	.section-title {
-		font-size: 32rpx;
-		color: #333;
-		font-weight: bold;
-		margin-bottom: 20rpx;
 		display: flex;
+		flex-direction: row;
+		flex: 1;
 	}
 
 	.info-item {
@@ -135,10 +133,14 @@
 	}
 	
 	.grid-text {
+		/* #ifdef APP-NVUE */
 	    font-size: 24rpx;
 	    color: #000;
+		/* #endif */
 	    padding: 10rpx 0 20rpx 0rpx;
 	    box-sizing: border-box;
+		margin: 10rpx 20rpx;
+		min-width: 150rpx;
 	}
 
 	.footer-btn {

+ 0 - 0
uni_modules/uni-sqlContext/changelog.md


+ 92 - 0
uni_modules/uni-sqlContext/package.json

@@ -0,0 +1,92 @@
+{
+    "id": "uni-sqlContext",
+    "displayName": "适用于UNIAPP-X的SQLite API",
+    "version": "1.0.0",
+    "description": "createSQLiteContext",
+    "keywords": [
+        "sqlite",
+        "uni-ext-api",
+        "uniapp-x",
+        "uts"
+    ],
+    "repository": "https://gitcode.net/weixin_42521648/uni-api/-/tree/master/uni_modules/uni-createSQLiteContext",
+    "engines": {
+        "HBuilderX": "^4.19"
+    },
+    "dcloudext": {
+        "category": [
+            "UTS插件",
+            "API插件"
+        ],
+        "contact": {
+            "qq": ""
+        },
+        "declaration": {
+            "ads": "无",
+            "data": "none",
+            "permissions": "none"
+        },
+        "npmurl": ""
+    },
+    "uni_modules": {
+        "dependencies": [],
+        "uni-ext-api": {
+            "uni": {
+                "createSQLiteContext": {
+                    "name": "createSQLiteContext",
+                    "app": {
+                        "js": false,
+                        "kotlin": true,
+                        "swift": false
+                    }
+                }
+            }
+        },
+        "encrypt": [],
+        "platforms": {
+            "cloud": {
+                "tcb": "u",
+                "aliyun": "u"
+            },
+            "client": {
+                "Vue": {
+                    "vue2": "u",
+                    "vue3": "u"
+                },
+                "App": {
+                    "app-android": "u",
+                    "app-ios": "u"
+                },
+                "H5-mobile": {
+                    "Safari": "n",
+                    "Android Browser": "n",
+                    "微信浏览器(Android)": "n",
+                    "QQ浏览器(Android)": "n"
+                },
+                "H5-pc": {
+                    "Chrome": "n",
+                    "IE": "n",
+                    "Edge": "n",
+                    "Firefox": "n",
+                    "Safari": "n"
+                },
+                "小程序": {
+                    "微信": "n",
+                    "阿里": "n",
+                    "百度": "n",
+                    "字节跳动": "n",
+                    "QQ": "n",
+                    "钉钉": "u",
+                    "快手": "u",
+                    "飞书": "u",
+                    "京东": "u"
+                },
+                "快应用": {
+                    "华为": "n",
+                    "联盟": "n"
+                }
+            }
+        }
+    },
+    "name": "适用于UNIAPP-X的SQLite API"
+}

+ 56 - 0
uni_modules/uni-sqlContext/readme.md

@@ -0,0 +1,56 @@
+# uni-createSQLiteContext
+### 开发文档
+[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
+[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
+[UTS 组件插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html)
+[Hello UTS](https://gitcode.net/dcloud/hello-uts)
+
+### 注意事项
+
+本插件本质上是一个uni ext api,所以直接使用即可,无需显式调用import导入。
+
+### 使用方法
+
+```javascript
+//创建查询的上下文
+const sqliteContext = uni.createSQLiteContext({
+  name: 'test.db',
+});
+
+//执行查询
+sqliteContext.selectSql({
+  sql: 'select * from test',
+  success: function(res) {
+    console.log(res);
+  },
+  fail: function(err) {
+    console.log(err);
+  }
+})
+
+//执行事务
+sqliteContext.transaction({
+  operation:"begin", //begin,commit,rollback
+  success: function(res) {
+    console.log(res);
+  },
+  fail: function(err) {
+    console.log(err);
+  }
+})
+
+//执行增删改
+sqliteContext.executeSql({
+  sql: 'insert into test values(1, "test")',
+  success: function(res) {
+    console.log(res);
+  },
+  fail: function(err) {
+    console.log(err);
+  }
+})
+
+//关闭数据库
+sqliteContext.close()
+
+```

+ 3 - 0
uni_modules/uni-sqlContext/utssdk/app-android/config.json

@@ -0,0 +1,3 @@
+{
+  "minSdkVersion": "21"
+}

+ 136 - 0
uni_modules/uni-sqlContext/utssdk/app-android/index.uts

@@ -0,0 +1,136 @@
+import Cursor from 'android.database.Cursor';
+import SQLiteDatabase from 'android.database.sqlite.SQLiteDatabase';
+import SQLiteOpenHelper from 'android.database.sqlite.SQLiteOpenHelper';
+
+import { createSQLiteContextOptions, executeSqlOptions, selectSqlOptions, executeSqlOptionsResult, selectSqlOptionsResult, CreateSQLiteContext, transactionOptions, transactionResult } from '../interface.uts';
+import { createSQLiteContextFailImpl } from '../unierror.uts';
+
+class SQLiteContext extends SQLiteOpenHelper {
+  private dbName: string | null;
+
+  constructor(name: string) {
+    let version = 1;
+    super(UTSAndroid.getAppContext()!, name, null, version.toInt());	
+    this.dbName = name;
+  }
+
+  public executeSql(options: executeSqlOptions) {
+    const database: SQLiteDatabase = this.getReadableDatabase();
+    const SqlArray = options.sql.split(';');
+    let result: executeSqlOptionsResult = {
+		data: [] as boolean[],
+		errMsg: 'executeSql:ok',
+		errSubject: '',
+		errCode: 0,
+		cause: null
+	}
+    try {
+      for (let i = 0; i < SqlArray.length; i++) {
+        if (SqlArray[i].length > 0) {
+          const sql = SqlArray[i].replace(/^\s+/, '');
+          try {
+            database.execSQL(sql);
+            result.data.push(true);
+          } catch {
+            result.data.push(false);
+          }
+        }
+      }
+      options.success?.(result);
+    } catch (e) {
+      const data = result.data;
+      result = new createSQLiteContextFailImpl(1000002);
+      result.data = data;
+      options.fail?.(result);
+    }
+    options.complete?.(result);
+    return result;
+  }
+
+  public selectSql(options: selectSqlOptions) {
+    const database: SQLiteDatabase = this.getReadableDatabase();
+    const SqlArray = options.sql.split(';');
+    let result: selectSqlOptionsResult = {
+		data: [] as string[],
+		errMsg: 'selectSql:ok',
+		errCode: 0,
+		errSubject: '',
+		cause: null
+	}
+    try {
+      for (let i = 0; i < SqlArray.length; i++) {
+        if (SqlArray[i].length > 0) {
+          const sql = SqlArray[i].replace(/^\s+/, '');
+          try {
+            const cursor: Cursor = database.rawQuery(sql, null);
+            //获取查询结果的字符串并push到result.data中
+            if (cursor.moveToFirst()) {
+              do {
+                const row = cursor.getColumnCount();
+                //const rowArray = [] as string[];
+                for (let j = 0; j < row; j++) {
+                  result.data.push(cursor.getString(j));
+                }
+                //result.data.push(rowArray);
+              } while (cursor.moveToNext());
+            }
+            cursor.close();
+          } catch {
+            result.data.push("");
+          }
+        }
+      }
+      options.success?.(result);
+    } catch (e) {
+      const data = result.data;
+      result = new createSQLiteContextFailImpl(1000003);
+      result.data = data;
+      options.fail?.(result);
+    }
+    options.complete?.(result);
+    return result;
+  }
+
+  public transaction(options: transactionOptions) {
+    const database: SQLiteDatabase = this.getReadableDatabase();
+    const transaction = options.operation;
+    let result: transactionResult = {
+		errMsg: 'transaction:ok',
+		data: [],
+		errCode: 0,
+		errSubject: '',
+		cause: null
+	}
+    try {
+      if (transaction == 'begin') {
+        //开启事务
+        database.execSQL('BEGIN TRANSACTION');
+      } else if (transaction == 'commit') {
+        //提交事务
+        database.execSQL('COMMIT');
+      } else if (transaction == 'rollback') {
+        //回滚事务
+        database.execSQL('ROLLBACK');
+      }
+      options.success?.(result);
+    } catch (e) {
+      let errCode = 1000008;
+      if (transaction == 'begin') {
+        errCode = 1000004;
+      } else if (transaction == 'commit') {
+        errCode = 1000005;
+      } else if (transaction == 'rollback') {
+        errCode = 1000006;
+      }
+      result = new createSQLiteContextFailImpl(errCode);
+      options.fail?.(result);
+    }
+    options.complete?.(result);
+    return result;
+  }
+}
+
+export const createSQLiteContext: CreateSQLiteContext = function (options: createSQLiteContextOptions) {
+  const name = options.name + '.db';
+  return new SQLiteContext(name);
+}

+ 13 - 0
uni_modules/uni-sqlContext/utssdk/app-ios/config.json

@@ -0,0 +1,13 @@
+{
+  "deploymentTarget": "9.0",
+  "dependencies-pods": [
+    {
+      "name": "FMDB",
+      "version": "2.7.8",
+      "repo": {
+        "git": "https://github.com/ccgus/fmdb.git",
+        "tag": "2.7.8"
+      }
+    }
+  ]
+}

+ 116 - 0
uni_modules/uni-sqlContext/utssdk/app-ios/index.uts

@@ -0,0 +1,116 @@
+import { FMDatabase } from 'FMDB';
+
+import { createSQLiteContextOptions, executeSqlOptions, selectSqlOptions, executeSqlOptionsResult, selectSqlOptionsResult, CreateSQLiteContext, transactionOptions } from '../interface.uts';
+import { createSQLiteContextFailImpl } from '../unierror.uts';
+
+class SQLiteContext extends FMDatabase {
+  private databaseName: string | null;
+
+  constructor(name: string) {
+    let version = 1;
+    const path = UTSiOS.getDataPath() + '/sqlite/' + name;
+    super(path);
+    this.databaseName = name;
+  }
+
+  public executeSql(options: executeSqlOptions) {
+    const SqlArray = options.sql.split(';');
+    let result: executeSqlOptionsResult = {
+      data: [] as boolean[],
+      errMsg: 'executeSql:ok',
+    }
+    try {
+      for (let i = 0; i < SqlArray.length; i++) {
+        if (SqlArray[i].length > 0) {
+          const sql = SqlArray[i].replace(/^\s+/, '');
+          try {
+            this.executeQuery(sql);
+            result.data.push(true);
+          } catch {
+            result.data.push(false);
+          }
+        }
+      }
+      options.success?.(result);
+    } catch (e) {
+      const data = result.data;
+      result = new createSQLiteContextFailImpl(1000002);
+      result.data = data;
+      options.fail?.(result);
+    }
+    options.complete?.(result);
+    return result;
+  }
+
+  public selectSql(options: selectSqlOptions) {
+    const SqlArray = options.sql.split(';');
+    let result: selectSqlOptionsResult = {
+      data: [] as boolean[],
+      errMsg: 'selectSql:ok',
+    }
+    try {
+      for (let i = 0; i < SqlArray.length; i++) {
+        if (SqlArray[i].length > 0) {
+          const sql = SqlArray[i].replace(/^\s+/, '');
+          try {
+            const cursor = this.executeQueryWithFormat(sql);
+            //获取查询结果的字符串并push到result.data中
+            while (cursor.next()) {
+              const row = cursor.getRow();
+              result.data.push(row);
+            }
+            cursor.close();
+          } catch {
+            result.data.push("");
+          }
+        }
+      }
+      options.success?.(result);
+    } catch (e) {
+      const data = result.data;
+      result = new createSQLiteContextFailImpl(1000003);
+      result.data = data;
+      options.fail?.(result);
+    }
+    options.complete?.(result);
+    return result;
+  }
+
+  public transaction(options: transactionOptions) {
+    const transaction = options.operation;
+    let result: executeSqlOptionsResult = {
+      errMsg: 'transaction:ok',
+    }
+    try {
+      if (transaction == 'begin') {
+        //开启事务
+        this.beginTransaction();
+      } else if (transaction == 'commit') {
+        //提交事务
+        this.commit();
+      } else if (transaction == 'rollback') {
+        //回滚事务
+        this.rollback();
+      }
+      options.success?.(result);
+    } catch (e) {
+      let errCode = 1000008;
+      if (transaction == 'begin') {
+        errCode = 1000004;
+      } else if (transaction == 'commit') {
+        errCode = 1000005;
+      } else if (transaction == 'rollback') {
+        errCode = 1000006;
+      }
+      result = new createSQLiteContextFailImpl(errCode);
+      options.fail?.(result);
+    }
+    options.complete?.(result);
+    return result;
+  }
+}
+
+export const createSQLiteContext: CreateSQLiteContext = function (options: createSQLiteContextOptions) {
+  const name = options.name + '.db';
+  return new SQLiteContext(name);
+}

+ 203 - 0
uni_modules/uni-sqlContext/utssdk/interface.uts

@@ -0,0 +1,203 @@
+/**
+ * 初始化数据库时的相关配置
+ * @param name 数据库名称
+ */
+export type createSQLiteContextOptions = {
+  /**
+   * 数据库名称
+   */
+  name: string,
+}
+
+/**
+ * 执行增删改等操作的SQL语句的相关配置
+ * @param sql SQL语句
+ * @param success 成功回调
+ * @param fail 失败回调
+ * @param complete 完成回调
+ */
+export type executeSqlOptions = {
+  /**
+   * SQL语句
+   */
+  sql: string,
+  /**
+   * 执行增删改等操作的SQL语句的成功回调
+   */
+  success?: executeSqlOptionsSuccessCallback | null,
+  /**
+   * 执行增删改等操作的SQL语句的失败回调
+   */
+  fail?: executeSqlOptionsFailCallback | null,
+  /**
+   * 执行增删改等操作的SQL语句的完成回调
+   */
+  complete?: executeSqlOptionsCompleteCallback | null,
+}
+
+/**
+ * 执行增删改等操作的SQL语句的成功回调
+ */
+export type executeSqlOptionsSuccessCallback = (res: executeSqlOptionsResult) => void
+
+/**
+ * 执行增删改等操作的SQL语句的失败回调
+ */
+export type executeSqlOptionsFailCallback = (res: executeSqlOptionsResult) => void
+
+/**
+ * 执行增删改等操作的SQL语句的完成回调
+ */
+export type executeSqlOptionsCompleteCallback = (res: executeSqlOptionsResult) => void
+
+/**
+ * 执行增删改等操作的SQL语句的返回结果
+ * @param errMsg 返回的错误信息
+ * @param data 返回的数据
+ */
+export interface executeSqlOptionsResultInterface extends ICreateSQLiteContextError {
+  /**
+   * 返回的错误信息
+   */
+  errMsg: string,
+  /**
+   * 返回的数据
+   */
+  data: boolean[],
+}
+export type executeSqlOptionsResult = executeSqlOptionsResultInterface
+
+/**
+ * 执行查询操作的SQL语句的相关配置
+ */
+export type selectSqlOptions = {
+  /**
+   * SQL语句
+   */
+  sql: string,
+  /**
+   * 执行查询操作的SQL语句的成功回调
+   */
+  success?: selectSqlOptionsSuccessCallback | null,
+  /**
+   * 执行查询操作的SQL语句的失败回调
+   */
+  fail?: selectSqlOptionsFailCallback | null,
+  /**
+   * 执行查询操作的SQL语句的完成回调
+   */
+  complete?: selectSqlOptionsCompleteCallback | null,
+}
+
+/**
+ * 执行查询操作的SQL语句的成功回调
+ */
+export type selectSqlOptionsSuccessCallback = (res: selectSqlOptionsResult) => void
+
+/**
+ * 执行查询操作的SQL语句的失败回调
+ */
+export type selectSqlOptionsFailCallback = (res: selectSqlOptionsResult) => void
+
+/**
+ * 执行查询操作的SQL语句的完成回调
+ */
+export type selectSqlOptionsCompleteCallback = (res: selectSqlOptionsResult) => void
+
+/**
+ * 执行查询操作的SQL语句的返回结果
+ * @param errMsg 返回的错误信息
+ * @param data 返回的数据
+ */
+export interface selectSqlOptionsResultInterface extends ICreateSQLiteContextError {
+  /**
+   * 返回的错误信息
+   */
+  errMsg: string,
+  /**
+   * 返回的数据
+   */
+  data: string[],
+}
+export type selectSqlOptionsResult = selectSqlOptionsResultInterface
+
+/**
+ * uni.createSQLiteContext失败回调参数
+ */
+export interface ICreateSQLiteContextError extends IUniError {
+  errCode: number
+}
+
+export type CreateSQLiteContext = (options: createSQLiteContextOptions) => CreateSQLiteContextCallBack
+
+export interface CreateSQLiteContextCallBack {
+  /**
+   * 执行增删改等操作的SQL语句
+   */
+  executeSql: (options: executeSqlOptions) => executeSqlOptionsCompleteCallback,
+  /**
+   * 执行查询操作的SQL语句
+   */
+  selectSql: (options: selectSqlOptions) => selectSqlOptionsCompleteCallback,
+  /**
+   * 关闭数据库
+   */
+  close: () => void,
+  /**
+   * 开启事务
+   */
+  transaction: (options: transactionOptions) => transactionCompleteCallback,
+}
+
+export type transactionOptions = {
+  /**
+   * 事务执行的操作
+   */
+  operation: transactionOperation,
+  /**
+   * 事务执行的成功回调
+   */
+  success?: transactionSuccessCallback | null,
+  /**
+   * 事务执行的失败回调
+   */
+  fail?: transactionFailCallback | null,
+  /**
+   * 事务执行的完成回调
+   */
+  complete?: transactionCompleteCallback | null,
+}
+
+/**
+ * 事务操作类型
+ * @param begin 开始事务
+ * @param commit 提交事务
+ * @param rollback 回滚事务
+ */
+export type transactionOperation = 'begin' | 'commit' | 'rollback'
+
+/**
+ * 事务执行的成功回调
+ */
+export type transactionSuccessCallback = (res: transactionResult) => void
+
+/**
+ * 事务执行的失败回调
+ */
+export type transactionFailCallback = (res: transactionResult) => void
+
+/**
+ * 事务执行的完成回调
+ */
+export type transactionCompleteCallback = (res: transactionResult) => void
+
+/**
+ * 事务执行的返回结果
+ */
+export interface transactionResultInterface extends ICreateSQLiteContextError {
+  /**
+   * 返回的错误信息
+   */
+  errMsg: string,
+}
+export type transactionResult = transactionResultInterface

+ 57 - 0
uni_modules/uni-sqlContext/utssdk/unierror.uts

@@ -0,0 +1,57 @@
+import { ICreateSQLiteContextError } from "./interface.uts"
+
+/**
+ * 错误主题
+ */
+export const UniErrorSubject = 'uni-create-sql-context';
+
+/**
+ * 错误码
+ * @UniError
+ */
+export const UniErrors: Map<number, string> = new Map([
+  /**
+   * 数据库启动失败
+   */
+  [1000001, 'Database startup failed'],
+  /**
+   * 执行SQL增删改语句失败
+   */
+  [1000002, 'Failed to execute SQL insert, update, delete statement'],
+  /**
+   * 执行SQL查询语句失败
+   */
+  [1000003, 'Failed to execute SQL query statement'],
+  /**
+   * 事务开始失败
+   */
+  [1000004, 'Transaction start failed'],
+  /**
+   * 事务提交失败
+   */
+  [1000005, 'Transaction commit failed'],
+  /**
+   * 事务回滚失败
+   */
+  [1000006, 'Transaction rollback failed'],
+  /**
+   * 数据库关闭失败
+   */
+  [1000007, 'Database shutdown failed'],
+  /**
+   * 未知错误
+   */
+  [1000008, 'Unknown error'],
+]);
+
+export class createSQLiteContextFailImpl extends UniError implements ICreateSQLiteContextError {
+  override errCode: number
+  constructor(
+    errCode: number
+  ) {
+    super()
+    this.errSubject = UniErrorSubject
+    this.errCode = errCode
+    this.errMsg = UniErrors[errCode] ?? ''
+  }
+}

+ 33 - 26
uni_modules/uni-table/components/uni-table/uni-table.vue

@@ -15,7 +15,9 @@
 			<view v-if="noData" class="uni-table-loading">
 				<view class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</view>
 			</view>
-			<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view>
+			<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }">
+				<div class="uni-table--loader"></div>
+			</view>
 		</view>
 		<!-- #endif -->
 	</view>
@@ -82,7 +84,7 @@ export default {
 			multiTableHeads: [] as Array<any>,
 			trChildren: [] as Array<any>,
 			thChildren: [] as Array<any>,
-			theadChildren: {},
+			theadChildren: UTSJSONObject,
 			backData: [] as Array<any>,
 			backIndexData: [] as Array<number>
 		}
@@ -90,10 +92,10 @@ export default {
 	watch: {
 		loading(val) {},
 		data(newVal) {
-			let theadChildren:UniTheadComponentPublicInstance|null = this?.theadChildren as UniTheadComponentPublicInstance ?? null
+			let theadChildren = this.theadChildren as UTSJSONObject ?? null
 			let rowspan:number = 1
 			if (theadChildren != null) {
-				rowspan = theadChildren?.rowspan as number ?? 1;
+				rowspan = theadChildren?.['rowspan'] as number ?? 1;
 			}
 			
 			// this.trChildren.length - rowspan
@@ -107,10 +109,10 @@ export default {
 
 	methods: {
 		isNodata() {
-			let theadChildren:UniTheadComponentPublicInstance|null = this?.theadChildren as UniTheadComponentPublicInstance ?? null
+			let theadChildren = (this.theadChildren instanceof UTSJSONObject)? this?.theadChildren as UTSJSONObject : null
 			let rowspan:number = 1
 			if (theadChildren != null) {
-				rowspan = theadChildren?.rowspan as number ?? 1;
+				rowspan = theadChildren?.['rowspan'] as number ?? 1;
 			}
 			this.noData = this.trChildren.length - rowspan <= 0
 		},
@@ -119,16 +121,16 @@ export default {
 		 */
 		selectionAll() {
 			let startIndex:number = 1
-			let theadChildren:UniTheadComponentPublicInstance|null = this.theadChildren as UniTheadComponentPublicInstance ?? null
+			let theadChildren = this?.theadChildren as UTSJSONObject ?? null
 			if (theadChildren == null) {
-				theadChildren = this.trChildren?.[0] as UniTheadComponentPublicInstance ?? null;
+				theadChildren = this.trChildren?.[0] as UTSJSONObject ?? null;
 			} else {
-				startIndex = theadChildren?.rowspan !=null ? theadChildren.rowspan as number  - 1 : -1;
+				startIndex = theadChildren?.['rowspan'] !=null ? theadChildren?.['rowspan'] as number  - 1 : -1;
 			}
 			let isHaveData = this.data != null && (this.data as Array<UTSJSONObject>).length > 0;
 			if(theadChildren!=null){
-				theadChildren.checked = true
-				theadChildren.indeterminate = false
+				theadChildren['checked'] = true
+				theadChildren['indeterminate'] = false
 			}
 			this.trChildren.forEach((item, index) => {
 				let itemObj:UTSJSONObject|null = item as UTSJSONObject;
@@ -195,14 +197,14 @@ export default {
 		 * 用于多选表格,清空用户的选择
 		 */
 		clearSelection() {
-			let theadChildren:UniTheadComponentPublicInstance|null = this.theadChildren as UniTheadComponentPublicInstance ?? null
+			let theadChildren = this?.theadChildren as UTSJSONObject ?? null
 			if (theadChildren == null) {
-				theadChildren = this.trChildren?.[0] as UniTheadComponentPublicInstance ?? null
+				theadChildren = this.trChildren?.[0] as UTSJSONObject ?? null
 			}
 			if (theadChildren == null) return;
 			if(theadChildren!=null){
-				theadChildren.checked = true
-				theadChildren.indeterminate = false
+				theadChildren['checked'] = true
+				theadChildren['indeterminate'] = false
 			}
 			
 			this.trChildren.forEach(item => {
@@ -228,11 +230,11 @@ export default {
 		toggleAllSelection() {
 			let list = [] as UTSJSONObject[];
 			let startIndex = 1
-			let theadChildren:UniTheadComponentPublicInstance|null = this.theadChildren as UniTheadComponentPublicInstance ?? null
+			let theadChildren = this.theadChildren as UTSJSONObject ?? null
 			if (theadChildren == null) {
-				theadChildren = this.trChildren?.[0] as UniTheadComponentPublicInstance ?? null
+				theadChildren = this.trChildren?.[0] as UTSJSONObject ?? null
 			} else {
-				startIndex = theadChildren?.rowspan !=null ? theadChildren.rowspan as number  - 1 : -1;
+				startIndex = theadChildren?.['rowData'] !=null ? theadChildren?.['rowData'] as number  - 1 : -1;
 			}
 			this.trChildren.forEach((item, index) => {
 				let itemObj:UTSJSONObject|null = item as UTSJSONObject;
@@ -253,9 +255,9 @@ export default {
 		 * @param {Object} rowValue
 		 */
 	check(child: any, check: boolean, keyValue: string|null, emit: boolean) {
-			let theadChildren:UniTheadComponentPublicInstance|null = this.theadChildren as UniTheadComponentPublicInstance ?? null
+			let theadChildren = this?.theadChildren as UTSJSONObject ?? null
 			if (theadChildren == null) {
-				theadChildren = this.trChildren?.[0] as UniTheadComponentPublicInstance ?? null				
+				theadChildren = this.trChildren?.[0] as UTSJSONObject ?? null				
 			}
 				
 			let childDomIndex = this.trChildren.findIndex((item, index) => child === item)
@@ -288,15 +290,15 @@ export default {
 			const domCheckAll = (this.trChildren as UTSJSONObject[])?.find((item, index) => index > 0 && item!=null && item['checked']==null && item['disabled']==null)
 			if(theadChildren!=null){
 			  if (domCheckAll==null) {
-				theadChildren.indeterminate = false
-				theadChildren.checked = true
+				theadChildren['indeterminate'] = false
+				theadChildren['checked'] = true
 			  } else {
-				theadChildren.indeterminate = true
-				theadChildren.checked = false
+				theadChildren['indeterminate'] = true
+				theadChildren['checked'] = false
 			  }
 
 			  if (this.backIndexData.length === 0) {
-				 theadChildren.indeterminate = false
+				 theadChildren['indeterminate'] = false
 			  }
             }
 			
@@ -374,7 +376,9 @@ $border-color: #ebeef5;
 	position: relative;	
 	display: flex;	
 	height: 50px;
+	/* #ifdef H5 */
 	line-height: 50px;
+	/* #endif */
 	overflow: hidden;
 	box-sizing: border-box;
 }
@@ -385,9 +389,12 @@ $border-color: #ebeef5;
 	position: absolute;
 	right: 0;
 	left: 0;
-	text-align: center;
+	align-items: center;
+	/* #ifdef H5 */
 	font-size: 14px;
 	color: #999;
+	text-align: center;
+	/* #endif */
 }
 
 .uni-table-mask {

+ 7 - 7
uni_modules/uni-table/components/uni-td/uni-td.vue

@@ -6,7 +6,7 @@
 	<!-- #endif -->
 	<!-- #ifndef H5 -->
 	<!-- :class="{'table--border':border}"  -->
-	<view class="uni-table-td" :class="{'table--border':border}" :style="{width:width.toString() + 'px','text-align':align}">
+	<view class="uni-table-td" :class="{'table--border':border}" :style="{width:width.toString() + 'px','align-items':'center'}">
 		<slot></slot>
 	</view>
 	<!-- #endif -->
@@ -80,17 +80,17 @@
 	.uni-table-td {
 		/* #ifdef H5 */
 		display: table-cell;
+		line-height: 23px;
+		font-size: 14px;
+		color: #606266;
+		font-weight: 400;
 		/* #endif */
 		/* #ifndef H5 */
 		display: flex;
 		align-items: center;
 		/* #endif */
-		padding: 8px 10px;
-		font-size: 14px;
-		border-bottom: 1px $border-color solid;
-		font-weight: 400;
-		color: #606266;
-		line-height: 23px;
+		padding: 8px 10px;		
+		border-bottom: 1px $border-color solid;		
 		box-sizing: border-box;
 	}
 

+ 6 - 5
uni_modules/uni-table/components/uni-tr/uni-tr.vue

@@ -161,14 +161,15 @@ $border-color: #ebeef5;
 	padding-left: 12px;
 	/* #ifndef APP-ANDROID */
 	display: table-cell;
-	vertical-align: middle;
-	/* #endif */
-	color: #333;
-	/* #ifndef APP-ANDROID */
+	vertical-align: middle;	
 	font-weight: 500;
 	/* #endif */	
-	border-bottom: 1px $border-color solid;
+	/* #ifdef H5 */
 	font-size: 14px;
+	color: #333;
+	/* #endif */
+	border-bottom: 1px $border-color solid;
+	
 	// text-align: center;
 }
 

+ 361 - 0
utils/sqlite.uts

@@ -0,0 +1,361 @@
+//import plus from '@dcloudio/uni-app-plus'
+
+// 数据库名称
+const dbName = 'qt_app_800'
+
+// 数据库地址,推荐以下划线为开头   _doc/xxx.db
+// 如果路径不为_downloads/xxx.db,在手机中会找不到文件夹(强烈建议:不要修改路径)
+const dbPath = '/db/qt_app_800.db'
+
+const sqlite = uni.createSQLiteContext({
+  name: dbPath,
+});
+
+/**
+ * 数据库地址
+ * @type {String} 推荐以下划线为开头   _doc/xxx.db
+ * @description 开发环境中数据库所在地址:文件管理/Android/data/io.dcloud.HBuilder/downloads/salary.db
+ * @description 打包安装后数据库所在地址:文件管理/Android/data/uni.UNI4312312(以UNI开头接数字)/downloads/salary.db
+ */
+
+
+
+// 判断数据库是否打开(箭头函数)
+const isOpen = () => {
+  // 数据库打开了就返回 true,否则返回 false  
+  var open = sqlite.isOpenDatabase({
+    name: dbName, // 数据库名称
+    path: dbPath, // 数据库地址
+  })
+  return open
+}
+
+// 创建数据库 或 有该数据库就打开(普通函数)
+const openSqlite = () => {
+  return new Promise((resolve, reject) => {
+    // 打开数据库
+    sqlite.openDatabase({
+      name: dbName,
+      path: dbPath,
+      success(e) {
+        resolve(e) // 成功回调
+      },
+      fail(e) {
+        reject(e) // 失败回调
+      },
+    })
+  })
+}
+
+// 关闭数据库(箭头函数)
+const closeSqlite = () => {
+  return new Promise((resolve, reject) => {
+    sqlite.closeDatabase({
+      name: dbName,
+      success(e) {
+        resolve(e)
+      },
+      fail(e) {
+        reject(e)
+      },
+    })
+  })
+}
+
+// 普通函数
+// 数据库建表 sql:'CREATE TABLE IF NOT EXISTS dbTable("id" varchar(50),"name" TEXT)
+// 创建 CREATE TABLE IF NOT EXISTS 、 dbTable 是表名,不能用数字开头、括号里是表格的表头
+// @param {Object} dbTable:表名
+// @param {Object} data : 表结构
+const createTable = function (dbTable: string, data: string) {
+  return new Promise((resolve, reject) => {
+    // executeSql: 执行增删改等操作的SQL语句
+    sqlite.executeSql({
+      name: dbName,
+      sql: `CREATE TABLE IF NOT EXISTS ${dbTable}(${data})`,
+      success(e) {
+        resolve(e)
+      },
+      fail(e) {
+        reject(e)
+      },
+    })
+  })
+}
+
+// 数据库删表 sql:'DROP TABLE dbTable'(箭头函数)
+// @param {Object} dbTable:表名
+const dropTable = (dbTable: string) => {
+  return new Promise((resolve, reject) => {
+    sqlite.executeSql({
+      name: dbName,
+      sql: `DROP TABLE ${dbTable}`,
+      success(e) {
+        resolve(e)
+      },
+      fail(e) {
+        reject(e)
+      },
+    })
+  })
+}
+
+// 普通函数
+// 向表格里添加数据 sql:'INSERT INTO dbTable VALUES('x','x','x')'   对应新增
+// 或者 sql:'INSERT INTO dbTable ('x','x','x') VALUES('x','x','x')'   具体新增
+// 插入 INSERT INTO  、 dbTable 是表名、根据表头列名插入列值
+// @param {Object} dbTable:表名
+// @param {Object} data : 插入表中的值结构
+// @param {Object} condition : 插入表中对应的列的属性名称结构
+const insertTableData = function (dbTable: string, data: string, condition?: string) {
+  // 判断有没有传参
+  if (dbTable !== undefined && data !== undefined) {
+    // 判断传的参是否有值
+    var bol = JSON.stringify(data) == '{}'
+    if (!bol) {
+      if (condition == undefined) {
+        var sql = `INSERT INTO ${dbTable} VALUES (${data})`
+      } else {
+        var sql = `INSERT INTO ${dbTable} (${condition}) VALUES(${data})`
+      }
+      console.log(sql)
+      // console.log(sql);
+      return new Promise((resolve, reject) => {
+        // 表格添加数据
+        sqlite.executeSql({
+          name: dbName,
+          sql: sql,
+          success(e) {
+            resolve(e)
+          },
+          fail(e) {
+            reject(e)
+          },
+        })
+      })
+    } else {
+      return new Promise((resolve, reject) => {
+        reject('错误添加')
+      })
+    }
+  } else {
+    return new Promise((resolve, reject) => {
+      reject('错误添加')
+    })
+  }
+}
+
+// 箭头函数
+// 根据条件向表格里添加数据  有数据更新、无数据插入
+// (建表时需要设置主键) 例如 --- "roomid" varchar(50) PRIMARY KEY
+// @param {Object} dbTable:表名
+// @param {Object} data : 插入表中的值结构
+// @param {Object} condition : 插入表中对应的列的属性名称结构
+const insertOrReplaceData = (dbTable: string, data: string, condition?: string) => {
+  // 判断有没有传参
+  if (dbTable !== undefined && data !== undefined) {
+    if (condition == undefined) {
+      var sql = `INSERT OR REPLACE INTO ${dbTable} VALUES(${data})`
+    } else {
+      var sql = `INSERT OR REPLACE INTO ${dbTable} (${condition}) VALUES(${data})`
+    }
+    // console.log(sql);
+    return new Promise((resolve, reject) => {
+      // 表格添加数据
+      sqlite.executeSql({
+        name: dbName,
+        sql: sql,
+        success(e) {
+          resolve(e)
+        },
+        fail(e) {
+          reject(e)
+        },
+      })
+    })
+  } else {
+    return new Promise((resolve, reject) => {
+      reject('错误添加')
+    })
+  }
+}
+
+// 普通函数
+// 查询获取数据库里的数据 sql:'SELECT * FROM dbTable WHERE lname = 'lvalue''
+// 查询 SELECT * FROM 、 dbTable 是表名、 WHERE 查找条件 lname,lvalue 是查询条件的列名和列值
+// @param {Object} dbTable:表名
+// @param {Object} lname:列名
+// @param {Object} lvalue:列中的属性值
+const selectTableData = function (
+  dbTable: string,
+  lname?: string,
+  lvalue?: string,
+  cc?: string,
+  dd?: string,
+) {
+  if (dbTable !== undefined) {
+    // 第一个是表单名称,后两个参数是列表名,用来检索
+    if (lname !== undefined && cc !== undefined) {
+      // 两个检索条件
+      var sql = `SELECT * FROM ${dbTable} WHERE ${lname} = '${lvalue}' AND ${cc} = '${dd}'`
+    }
+    if (lname !== undefined && cc == undefined) {
+      // 一个检索条件
+      var sql = `SELECT * FROM ${dbTable} WHERE ${lname} = '${lvalue}'`
+      // console.log(sql);
+    }
+    if (lname == undefined) {
+      var sql = `SELECT * FROM ${dbTable}`
+    }
+    return new Promise((resolve, reject) => {
+      // 表格查询数据  执行查询的SQL语句
+      sqlite.selectSql({
+        name: dbName,
+        sql: sql,
+        success(e) {
+          resolve(e)
+        },
+        fail(e) {
+          reject(e)
+        },
+      })
+    })
+  } else {
+    return new Promise((resolve, reject) => {
+      reject('错误查询')
+    })
+  }
+}
+
+// 箭头函数
+// 删除表里的数据 sql:'DELETE FROM dbTable WHERE lname = 'lvalue''
+// 删除 DELETE FROM 、 dbTable 是表名、 WHERE 查找条件 lname,lvalue 是查询条件的列名和列值
+// @param {Object} dbTable:表名
+// @param {Object} lname:列名
+// @param {Object} lvalue:列中的属性值
+const deleteTableData = (
+  dbTable: string,
+  lname?: string,
+  lvalue?: string,
+  ww?: string,
+  ee?: string,
+) => {
+  if (dbTable !== undefined) {
+    if (lname == undefined) {
+      var sql = `DELETE FROM ${dbTable}`
+    } else {
+      if (ww !== undefined) {
+        // 两个检索条件
+        var sql = `DELETE FROM ${dbTable} WHERE ${lname} = '${lvalue}' AND ${ww} = '${ee}'`
+      } else {
+        // 一个检索条件
+        var sql = `DELETE FROM ${dbTable} WHERE ${lname} = '${lvalue}'`
+      }
+    }
+    return new Promise((resolve, reject) => {
+      // 删除表数据
+      sqlite.executeSql({
+        name: dbName,
+        sql: sql,
+        success(e) {
+          resolve(e)
+        },
+        fail(e) {
+          reject(e)
+        },
+      })
+    })
+  } else {
+    return new Promise((resolve, reject) => {
+      reject('错误删除')
+    })
+  }
+}
+
+// 普通函数
+// 修改数据表里的数据 sql:"UPDATE dbTable SET 列名 = '列值',列名 = '列值' WHERE lname = 'lvalue'"
+// 修改 UPDATE 、 dbTable 是表名, data: 要修改的列名=修改后列值, lname,lvalue 是查询条件的列名和列值
+// @param {Object} dbTable:表名
+// @param {Object} data : 修改表中的值结构
+// @param {Object} lname:列名
+// @param {Object} lvalue:列中的属性值
+const updateTableData = function (dbTable: string, data: string, lname?: string, lvalue?: string) {
+  if (lname == undefined) {
+    var sql = `UPDATE ${dbTable} SET ${data}`
+  } else {
+    var sql = `UPDATE ${dbTable} SET ${data} WHERE ${lname} = '${lvalue}'`
+  }
+  // WHERE 前面是要修改的列名、列值,后面是条件的列名、列值
+  return new Promise((resolve, reject) => {
+    // 修改表数据
+    sqlite.executeSql({
+      name: dbName,
+      sql: sql,
+      success(e) {
+        resolve(e)
+      },
+      fail(e) {
+        reject(e)
+      },
+    })
+  })
+}
+
+// 箭头函数
+// 获取指定数据条数  sql:"SELECT * FROM dbTable ORDER BY 'id' DESC LIMIT 15 OFFSET 'num'"
+// dbTable 表名, ORDER BY 代表排序默认正序, id 是排序的条件 DESC 代表倒序,从最后一条数据开始拿
+// LIMIT 15 OFFSET '${num}',这句的意思是跳过 num 条拿 15 条数据, num 为跳过多少条数据是动态值
+// 例 初始num设为0,就从最后的数据开始拿15条,下次不拿刚获取的数据,所以可以让num为15,这样就能一步一步的拿完所有的数据
+// @param {Object} dbTable:表名
+// @param {Object} id:数据id
+/**
+ * @param {Object} num 例子如下:
+ * select * from boot limit 10 offset 0;
+ * select * from boot limit 10 offset 10;
+ * select * from boot limit 10 offset 20;
+ * select * from boot limit 10 offset 30;
+ * 比如说每页数量为 10 条,然后我们分别获区第1、2、3、4页的数据
+ *
+ */
+const pullSQL = (dbTable: string, id: string, num: number) => {
+  return new Promise((resolve, reject) => {
+    sqlite.selectSql({
+      name: dbName,
+      sql: `SELECT * FROM ${dbTable} ORDER BY '${id}' DESC LIMIT 15 OFFSET '${num}'`,
+
+      success(e) {
+        resolve(e)
+      },
+
+      fail(e) {
+        reject(e)
+      },
+    })
+  })
+}
+
+// 导出方法
+export default {
+  // 查询数据库是否打开
+  isOpen,
+  // 创建/开启数据库
+  openSqlite,
+  // 关闭数据库
+  closeSqlite,
+  // 数据库建表
+  createTable,
+  // 数据库删表
+  dropTable,
+  // 表里新增/插入数据
+  insertTableData,
+  // 根据条件向表里插入数据、更新或覆盖
+  insertOrReplaceData,
+  // 表里查询数据
+  selectTableData,
+  // 表里删除数据
+  deleteTableData,
+  // 表里修改数据
+  updateTableData,
+  // 倒叙查询数据
+  pullSQL,
+}