Browse Source

调整逻辑

master
chengkun 3 years ago
parent
commit
80caf91d08
  1. 32
      pages.json
  2. 177
      pages/history/History.vue
  3. 37
      pages/scan/Barcode.vue
  4. 37
      pages/scan/Book.vue
  5. 37
      pages/scan/Calendar.vue
  6. 37
      pages/scan/Contacts.vue
  7. 37
      pages/scan/Email.vue
  8. 37
      pages/scan/Location.vue
  9. 153
      pages/scan/Paypal.vue
  10. 37
      pages/scan/Product.vue
  11. 153
      pages/scan/Scan.nvue
  12. 37
      pages/scan/Sms.vue
  13. 37
      pages/scan/Tel.vue
  14. 37
      pages/scan/Text.vue
  15. 152
      pages/scan/Url.vue
  16. 129
      pages/scan/Wifi.vue
  17. 34
      pages/setting/Setting.vue
  18. 26
      utils/database.js

32
pages.json

@ -10,13 +10,14 @@
"enablePullDownRefresh": false
}
},
// {
// "path": "pages/create/Create",
// "style": {
// "navigationBarTitleText": "Create",
// "enablePullDownRefresh": false
// }
// },
{
"path": "pages/create/Create",
"style": {
"navigationBarTitleText": "Create",
"enablePullDownRefresh": false
}
},{
"path": "pages/history/History",
"style": {
"navigationBarTitleText": "History",
@ -72,13 +73,6 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/scan/Paypal",
"style": {
"navigationBarTitleText": "Paypal",
"enablePullDownRefresh": false
}
},
{
"path": "pages/scan/Product",
"style": {
@ -147,12 +141,12 @@
"selectedIconPath": "static/art-select.png",
"text": "History"
},
{
"pagePath": "pages/create/Create",
"iconPath": "static/art-default.png",
"selectedIconPath": "static/art-select.png",
"text": "Create"
},
// {
// "pagePath": "pages/create/Create",
// "iconPath": "static/art-default.png",
// "selectedIconPath": "static/art-select.png",
// "text": "Create"
// },
{
"pagePath": "pages/setting/Setting",
"iconPath": "static/art-default.png",

177
pages/history/History.vue

@ -30,9 +30,9 @@
<!-- 左边图标文本显示部分 -->
<view class="list-left">
<view class="list-left-icon tn-icon-circle-fill tn-color-gray"></view>
<view class="list-left-text">
<view class="list-left-text-one">{{ item.label }}</view>
<view class="list-left-text-two">{{ item.text }}</view>
<view class="list-left-text" @click="getHistory(item.category,item.content)">
<view class="list-left-text-one">{{ item.category }}</view>
<view class="list-left-text-two">{{ item.content }}</view>
</view>
</view>
<!-- 右边操作按钮部分 -->
@ -53,7 +53,7 @@
data() {
return {
title: 'History',
tableName:"scancode",
tableName:"scan_code",
options:{
current:1, // 1
size:10,
@ -101,56 +101,100 @@
},
],
historyList:[
{
"icon":"grid-item-icon tn-icon-empty-network",
"text":"15936215478",
"sort":"0",
"label":"WIFI"
},
{
"icon":"grid-item-icon tn-icon-empty-network",
"text":"15936215478",
"sort":"1",
"label":"WIFI"
},
{
"icon":"grid-item-icon tn-icon-empty-network",
"text":"15936215478",
"sort":"2",
"label":"WIFI"
},
{
"icon":"grid-item-icon tn-icon-empty-network",
"text":"15936215478",
"sort":"3",
"label":"WIFI"
},
{
"icon":"grid-item-icon tn-icon-empty-network",
"text":"15936215478",
"sort":"4",
"label":"WIFI"
}
]
historyList: []
// historyList:[
// {
// "icon":"grid-item-icon tn-icon-empty-network",
// "text":"15936215478",
// "sort":"0",
// "label":"WIFI"
// },
// {
// "icon":"grid-item-icon tn-icon-empty-network",
// "text":"15936215478",
// "sort":"1",
// "label":"WIFI"
// },
// {
// "icon":"grid-item-icon tn-icon-empty-network",
// "text":"15936215478",
// "sort":"2",
// "label":"WIFI"
// },
// {
// "icon":"grid-item-icon tn-icon-empty-network",
// "text":"15936215478",
// "sort":"3",
// "label":"WIFI"
// },
// {
// "icon":"grid-item-icon tn-icon-empty-network",
// "text":"15936215478",
// "sort":"4",
// "label":"WIFI"
// }
// ]
}
},
onLoad() {
async onShow() {
let that = this;
//db
await that.openSqlite();
//
await that.getData();
},
async onShow(){
await this.openSqlite()
onHide() {
let that = this;
that.closedb();
},
methods: {
//
getHistory(category,data){
console.log("123")
let that = this;
if(category === 'Contacts'){
that.jumpToPage('/pages/scan/Contacts','history',data);
}else if(category === 'Email'){
that.jumpToPage('/pages/scan/Email','history',data);
}else if(category === 'Tel'){
that.jumpToPage('/pages/scan/Tel','history',data);
}else if(category === 'Product'){
that.jumpToPage('/pages/scan/Product','history',data);
}else if(category === 'Sms'){
that.jumpToPage('/pages/scan/Sms','history',data);
}else if(category === 'Text'){
that.jumpToPage('/pages/scan/Text','history',data);
}else if(category === 'Url'){
that.jumpToPage('/pages/scan/Url','history',data);
}else if(category === 'Wifi'){
that.jumpToPage('/pages/scan/Wifi','history',data);
}else if(category === 'Location'){
that.jumpToPage('/pages/scan/Location','history',data);
}else if(category === 'Calendar'){
that.jumpToPage('/pages/scan/Calendar','history',data);
}else if(category === 'Book'){
that.jumpToPage('/pages/scan/Book','history',data);
}
},
//
jumpToPage(url,category,data){
uni.navigateTo({
url: url + '?data='+ data + '&category=' + category
});
},
//
async openSqlite(){
try{
let b = await openSqlite()
uni.showToast({
title:"open db success",
icon:"none"
})
// uni.showToast({
// title:"open db success",
// icon:"none"
// })
console.log('db打开了');
}catch(e){
console.error("open db error",e)
}
@ -160,6 +204,7 @@
closedb(){
try{
closedb()
console.log('db关闭了');
}catch(e){
console.error("close db error",e)
}
@ -170,17 +215,17 @@
async getData(){
try{
let where = {}
let res = await getPageList(this.tableName,this.options,where,"fid desc")
let res = await getPageList(this.tableName,this.options,where,"id desc")
console.log("加载数据",res)
this.list = res.data.data.records
this.historyList = res.data.data.records
this.pages = res.data.data.pages
this.total = res.data.data.total
}catch(e){
uni.showToast({
title:"报错,请查看控制台",
icon:"none"
});
console.error("报错",e)
// uni.showToast({
// title:"",
// icon:"none"
// });
console.error("error",e)
}
},
@ -227,7 +272,7 @@
.settingList{
//border: 2px solid red;
width: 330px;
width: 660rpx;
//height:300px;
height: auto;
//margin-top: 10px;
@ -235,7 +280,7 @@
.listItem{
//border: 2px solid yellow;
height: 50px;
height: 100rpx;
//margin-top: 30px;
background-color: #141b29;
color: #fff;
@ -254,29 +299,29 @@
justify-content: flex-start;
.list-left-text{
width: 210px;
width: 420rpx;
.list-left-text-one{
font-size: 15px;
font-size: 30rpx;
//border: 2px solid blue;
}
.list-left-text-two{
color: grey;
font-size:13px;
font-size:26rpx;
//border: 2px solid lightsalmon;
}
}
.list-left-feedback-text{
width: 240px;
width: 480rpx;
.list-left-feedback-text-one{
font-size: 15px;
font-size: 30rpx;
//border: 2px solid blue;
}
.list-left-feedback-text-two{
color: grey;
font-size:13px;
font-size: 26rpx;
//border: 2px solid lightsalmon;
}
}
@ -284,14 +329,14 @@
.list-left-icon{
//border: 2px solid blueviolet;
margin-right: 10px;
font-size: 25px;
margin-right: 20rpx;
font-size: 50rpx;
}
.list-left-select-text{
width: 160px;
width: 320rpx;
.list-left-select-text-one{
font-size: 15px;
font-size: 30rpx;
//border: 2px solid blue;
}
}
@ -300,12 +345,12 @@
.list-right{
//border: 2px solid pink;
color: royalblue;
font-size: 20px;
font-size: 40rpx;
.list-right-icon{
//border: 2px solid gainsboro;
font-size: 25px;
margin-left: 15px;
font-size: 50rpx;
margin-left: 30rpx;
}
.list-right-text{

37
pages/scan/Barcode.vue

@ -27,6 +27,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -78,23 +79,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height:1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
text-align: center;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -103,12 +104,12 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -120,12 +121,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -134,8 +135,8 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
@ -143,7 +144,7 @@
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
@ -151,9 +152,9 @@
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

37
pages/scan/Book.vue

@ -27,6 +27,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -83,23 +84,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
text-align: center;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -108,13 +109,13 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -126,12 +127,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -140,8 +141,8 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
@ -149,7 +150,7 @@
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960px;
}
@ -157,9 +158,9 @@
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

37
pages/scan/Calendar.vue

@ -31,6 +31,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -87,23 +88,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 120px;
height: 240rpx;
text-align: start;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -112,14 +113,14 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -131,12 +132,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -145,24 +146,24 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
}
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

37
pages/scan/Contacts.vue

@ -32,6 +32,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -88,23 +89,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 180px;
height: 360rpx;
text-align: start;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -113,12 +114,12 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -130,12 +131,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -144,24 +145,24 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
}
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

37
pages/scan/Email.vue

@ -29,6 +29,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -85,23 +86,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
text-align: start;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -110,14 +111,14 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -129,12 +130,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -143,8 +144,8 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
@ -152,16 +153,16 @@
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

37
pages/scan/Location.vue

@ -28,6 +28,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -84,23 +85,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
text-align: start;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -109,14 +110,14 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -128,12 +129,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -142,24 +143,24 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
}
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

153
pages/scan/Paypal.vue

@ -1,153 +0,0 @@
<template>
<view class="content">
<tn-avatar src="/static/logo.png" class="icon" size="xl"></tn-avatar>
<tn-list-view :card="true" unlined="all" class="listView">
<tn-list-cell class="listItem-1">我是扫码内容部分</tn-list-cell>
<tn-list-cell class="listItem">
<tn-grid align="center" :col="col">
<block v-for="(item, index) in fastToolList" :key="index">
<tn-grid-item class="toolItem">
<view :class="item.icon"></view>
<view class="cutline"></view>
<view class="toolText">{{ item.text }}</view>
</tn-grid-item>
</block>
</tn-grid>
</tn-list-cell>
<view class="cutline"></view>
<tn-list-cell class="listItem-ad">我是谷歌ad部分</tn-list-cell>
<tn-list-cell class="listItemBottom">
<image src="/static/logo.png" class="buttomImg"/>
</tn-list-cell>
</tn-list-view>
<text class="bottomText">Feedback or Suggestion</text>
</view>
</template>
<script>
export default {
data() {
return {
col: 3,
fastToolList:[
{
"index": 0,
"text":"Open",
"icon": "tn-icon-plane"
},
{
"index": 1,
"text":"Copy",
"icon": "tn-icon-copy-fill"
},
{
"index": 2,
"text":"Share",
"icon": "tn-icon-share-triangle"
}
]
}
},
onLoad() {
},
methods: {
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #000000;
height:100%;
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
text-align: center;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
color: #fff;
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
text-align: center;
.toolText{
font-size: 12px;
color: #fff;
}
}
}
.listItem-ad{
background-color: #141b29;
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
background-color: #141b29;
color: #fff;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
}
}
}
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
}
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
}
.cutline{
border: 1px solid #8f8f94;
}
}
</style>

37
pages/scan/Product.vue

@ -27,6 +27,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -78,23 +79,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
text-align: center;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -103,12 +104,12 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -120,12 +121,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -134,8 +135,8 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
@ -143,7 +144,7 @@
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
@ -151,9 +152,9 @@
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

153
pages/scan/Scan.nvue

@ -16,6 +16,8 @@
<button @click="scanCode()">扫码</button>
<button type="primary" @click="clearData()">清空数据</button>
<button type="primary" @click="deleteTable()">删除数据表</button>
<!-- <button @click="writeToDb()">添加数据</button> -->
<!-- <tn-button type="primary" @click="writeToDb()">添加数据</tn-button> -->
<!-- <tn-toast ref="toast"></tn-toast> -->
@ -23,91 +25,92 @@
</template>
<script>
//import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
import { openSqlite,executeSql,closedb} from "@/utils/database";
export default {
data() {
return {
title: 'Scan',
tableName:"scancode"
tableName:"scan_code"
}
},
created() {
// this.scanCode();
},
async onShow(){
let that = this;
//打开db
await that.openSqlite();
},
onHide() {
let that = this;
that.closedb();
},
methods: {
// 打开数据库
async openSqlite(){
try{
let b = await openSqlite()
// uni.showToast({
// title:"open db success",
// icon:"none"
// })
console.log('db打开了');
}catch(e){
console.error("open db error",e)
}
},
//写入扫描记录
// async writeToDb(){
// try{
// let b = await addSql(this.tableName,{title:"你好,世界!",content:"世界:你好呀!",desc:"嘻嘻"})
// uni.showToast({
// title:"添加成功",
// icon:"none"
// });
// }catch(e){
// console.error("insert data error!",e)
// }
// },
// 关闭数据库
closedb(){
try{
closedb()
console.log('db关闭了');
}catch(e){
console.error("close db error",e)
}
// 创建表
// async createTable(){
// let sql = this.createTableSql_outbound()
// try{
// let exist = await isTable(this.tableName)
// console.log("表是否存在",exist)
// if(!exist){
// let res = await executeSql(sql)
// uni.showToast({
// title:"insert table ok",
// icon:"none"
// })
// console.log("新增表scancode",res)
// }else{
// uni.showToast({
// title:"table exist",
// icon:"none"
// })
// }
// }catch(e){
// uni.showToast({
// title:"insert table error",
// icon:"none"
// })
// console.error("新增表报错scancode",e)
// }
// },
},
// 打开数据库
// async openSqlite(){
// try{
// let b = await openSqlite()
// uni.showToast({
// title:"open db success",
// icon:"none"
// })
// }catch(e){
// console.error("open db error",e)
// }
// },
async clearData(){
try{
await executeSql("DELETE FROM scan_code")
uni.showToast({
title:"清除数据成功",
icon:"none"
});
}catch(e){
uni.showToast({
title:"清除数据报错,请查看控制台",
icon:"none"
});
console.error("清除数据报错",e)
}
},
// 关闭数据库
// closedb(){
// try{
// closedb()
// }catch(e){
// console.error("close db error",e)
// }
async deleteTable(){
try{
await executeSql("drop table scan_code")
uni.showToast({
title:"删除数据表成功",
icon:"none"
})
}catch(e){
uni.showToast({
title:"删除数据表失败",
icon:"none"
})
console.error("删除数据表失败scan_code",e)
}
// },
},
//根据扫码返回结果判断跳转到哪个指定页面
jumpToPage(url,data){
jumpToPage(url,category,data){
uni.navigateTo({
url: url + '?data='+ data
url: url + '?data='+ data + '&category=' + category
});
},
//mlkit扫码
scanCode(){
@ -144,27 +147,27 @@
})
}else{
if(type === 1){
that.jumpToPage('/pages/scan/Contacts',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Contacts','scan',JSON.stringify(data2))
}else if(type === 2){
that.jumpToPage('/pages/scan/Email',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Email','scan',JSON.stringify(data2))
}else if(type === 3){
that.jumpToPage('/pages/scan/Book',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Book','scan',JSON.stringify(data2))
}else if(type === 4){
that.jumpToPage('/pages/scan/Tel',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Tel','scan',JSON.stringify(data2))
}else if(type === 5){
that.jumpToPage('/pages/scan/Product',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Product','scan',JSON.stringify(data2))
}else if(type === 6){
that.jumpToPage('/pages/scan/Sms',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Sms','scan',JSON.stringify(data2))
}else if(type === 7){
that.jumpToPage('/pages/scan/Text',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Text','scan',JSON.stringify(data2))
}else if(type === 8){
that.jumpToPage('/pages/scan/Url',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Url','scan',JSON.stringify(data2))
}else if(type === 9){
that.jumpToPage('/pages/scan/Wifi',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Wifi','scan',JSON.stringify(data2))
}else if(type === 10){
that.jumpToPage('/pages/scan/Location',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Location','scan',JSON.stringify(data2))
}else if(type === 11){
that.jumpToPage('/pages/scan/Calendar',JSON.stringify(data2))
that.jumpToPage('/pages/scan/Calendar','scan',JSON.stringify(data2))
}
}
}

37
pages/scan/Sms.vue

@ -28,6 +28,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -84,23 +85,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
text-align: start;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -109,14 +110,14 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -128,12 +129,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -142,24 +143,24 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
}
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

37
pages/scan/Tel.vue

@ -27,6 +27,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -83,23 +84,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
text-align: start;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -108,14 +109,14 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -127,12 +128,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -141,24 +142,24 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
}
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

37
pages/scan/Text.vue

@ -27,6 +27,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -83,23 +84,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
text-align: start;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -108,14 +109,14 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -127,12 +128,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -141,24 +142,24 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
}
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

152
pages/scan/Url.vue

@ -3,7 +3,6 @@
<tn-avatar src="/static/logo.png" class="icon" size="xl"></tn-avatar>
<tn-list-view :card="true" unlined="all" class="listView">
<tn-list-cell class="listItem-1">
<view>Title: {{ urlInfo.title }}</view>
<view>Url: {{ urlInfo.url }}</view>
</tn-list-cell>
<tn-list-cell class="listItem">
@ -28,11 +27,13 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
col: 3,
urlInfo:{},
tableName: 'scan_code',
fastToolList:[
{
"index": 0,
@ -52,16 +53,121 @@
]
}
},
onLoad(option) {
async onLoad(option) {
let that = this;
that.initData(option);
//db
await that.openSqlite();
//
await that.createTable();
//scan,history
if(option.category === 'scan'){
//db
await that.initData(option.data);
}else{
//
await that.getHistoryData(option.data);
}
},
onHide() {
let that = this;
that.closedb();
},
methods: {
initData(option){
//
async openSqlite(){
try{
let b = await openSqlite()
// uni.showToast({
// title:"open db success",
// icon:"none"
// })
console.log('db打开了');
}catch(e){
console.error("open db error",e)
}
},
//
closedb(){
try{
closedb()
console.log('db关闭了');
}catch(e){
console.error("close db error",e)
}
},
//
async createTable(){
let sql = this.createTableSql_outbound()
try{
let exist = await isTable(this.tableName)
console.log("表是否存在",exist)
if(!exist){
let res = await executeSql(sql)
// uni.showToast({
// title:"insert table ok",
// icon:"none"
// })
console.log("新增表scancode",res)
}else{
// uni.showToast({
// title:"table exist",
// icon:"none"
// })
console.log("表scancode已存在")
}
}catch(e){
uni.showToast({
title:"insert table error",
icon:"none"
})
console.error("新增表报错scancode",e)
}
},
//
async writeToDb(type,params){
try{
let data = {
category: type,
content: params
}
let b = await addSql(this.tableName,data)
console.log("数据添加成功!")
}catch(e){
console.error("insert data error!",e)
}
},
//
createTableSql_outbound(){
return "CREATE TABLE IF NOT EXISTS `scan_code` (" +
" `id` INTEGER PRIMARY KEY AUTOINCREMENT," +
" `category` varchar(50) DEFAULT NULL ," +
" `content` text DEFAULT NULL ," +
" `createTime` datetime DEFAULT CURRENT_TIMESTAMP ," +
" `updateTime` datetime DEFAULT NULL default(datetime('now','localtime'))" +
"); "
},
//
async initData(params){
let that = this;
let data = JSON.parse(option.data);
let data = JSON.parse(params);
that.urlInfo = data;
console.log('urlInfo',that.urlInfo)
//db
await that.writeToDb("URL",that.urlInfo.url);
},
//
async getHistoryData(params){
let that = this;
let data = JSON.parse(params);
that.urlInfo = data;
console.log('HistotyUrlInfo',that.urlInfo)
}
}
}
@ -79,23 +185,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 180px;
height: 360rpx;
text-align: center;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -104,12 +210,12 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -121,12 +227,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -135,8 +241,8 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
@ -144,7 +250,7 @@
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
@ -152,9 +258,9 @@
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

129
pages/scan/Wifi.vue

@ -28,6 +28,7 @@
</template>
<script>
import { openSqlite,executeSql,closedb,isTable,addSql} from "@/utils/database";
export default {
data() {
return {
@ -62,13 +63,103 @@
that.initData(option);
},
methods: {
initData(option){
//
async openSqlite(){
try{
let b = await openSqlite()
// uni.showToast({
// title:"open db success",
// icon:"none"
// })
console.log('db打开了');
}catch(e){
console.error("open db error",e)
}
},
//
closedb(){
try{
closedb()
console.log('db关闭了');
}catch(e){
console.error("close db error",e)
}
},
//
async createTable(){
let sql = this.createTableSql_outbound()
try{
let exist = await isTable(this.tableName)
console.log("表是否存在",exist)
if(!exist){
let res = await executeSql(sql)
// uni.showToast({
// title:"insert table ok",
// icon:"none"
// })
console.log("新增表scancode",res)
}else{
// uni.showToast({
// title:"table exist",
// icon:"none"
// })
console.log("表scancode已存在")
}
}catch(e){
uni.showToast({
title:"insert table error",
icon:"none"
})
console.error("新增表报错scancode",e)
}
},
//
async writeToDb(type,params){
try{
let data = {
category: type,
content: params
}
let b = await addSql(this.tableName,data)
console.log("数据添加成功!")
}catch(e){
console.error("insert data error!",e)
}
},
//
createTableSql_outbound(){
return "CREATE TABLE IF NOT EXISTS `scan_code` (" +
" `id` INTEGER PRIMARY KEY AUTOINCREMENT," +
" `category` varchar(50) DEFAULT NULL ," +
" `content` text DEFAULT NULL ," +
" `createTime` datetime DEFAULT CURRENT_TIMESTAMP ," +
" `updateTime` datetime DEFAULT NULL default(datetime('now','localtime'))" +
"); "
},
//
async initData(option){
let that = this;
let data = JSON.parse(option.data);
that.wifiInfo = data;
console.log('wifiInfo',that.wifiInfo)
console.log('password',that.wifiInfo.password)
console.log('ssid',that.wifiInfo.ssid)
//db
await that.writeToDb("WIFI",that.wifiInfo);
},
//
async getHistoryData(params){
let that = this;
let data = JSON.parse(params);
that.wifiInfo = data;
console.log('HistotyWifiInfo',that.wifiInfo)
}
}
}
@ -86,23 +177,23 @@
.listView{
z-index: 0;
position: relative;
width: 330px;
height:500px;
margin-top: 50px;
width: 660rpx;
height: 1000rpx;
margin-top: 100rpx;
background-color: #141b29;
.listItem-1{
margin-top: 60px;
margin-top: 120rpx;
background-color: #141b29;
color: #fff;
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
text-align: start;
}
.listItem{
//border: 2px solid yellow;
height: 80px;
height: 160rpx;
//margin-top: 30px;
//padding-top: 30px;
background-color: #141b29;
@ -111,14 +202,14 @@
.toolItem{
//border: 2px solid red;
background-color: #141b29;
font-size: 30px;
height: 60px;
font-size: 60rpx;
height: 120rpx;
text-align: center;
.toolText{
font-size: 12px;
font-size: 24rpx;
color: #fff;
}
}
@ -130,12 +221,12 @@
text-align: center;
color: #fff;
//border: 2px solid red;
height: 80px;
height: 160rpx;
}
.listItemBottom{
height: 200px;
margin-top: 10px;
height: 400rpx;
margin-top: 20rpx;
background-color: #141b29;
color: #fff;
display: flex;
@ -144,8 +235,8 @@
justify-content: center;
.buttomImg{
width: 150px;
height: 150px;
width: 300rpx;
height: 300rpx;
}
}
@ -153,7 +244,7 @@
.icon{
z-index: 1;
position: absolute;
margin-top: -480px;
margin-top: -960rpx;
}
@ -161,9 +252,9 @@
.bottomText{
color: #fff;
text-align: center;
font-size: 12px;
margin-top: 20px;
margin-bottom: 20px;
font-size: 24rpx;
margin-top: 40rpx;
margin-bottom: 40rpx;
}
.cutline{
border: 1px solid #8f8f94;

34
pages/setting/Setting.vue

@ -255,16 +255,16 @@
.headLine{
color: royalblue;
font-size: 18px;
font-size: 36rpx;
//padding-top:30px;
//margin-right:200px;
margin-top:30px;
margin-top: 60rpx;
//border: 2px solid purple;
}
.settingList{
//border: 2px solid red;
width: 330px;
width: 660rpx;
//height:300px;
height: auto;
//margin-top: 10px;
@ -272,7 +272,7 @@
.listItem{
//border: 2px solid yellow;
height: 50px;
height: 100rpx;
//margin-top: 30px;
background-color: #141b29;
color: #fff;
@ -291,29 +291,29 @@
justify-content: flex-start;
.list-left-text{
width: 210px;
width: 420rpx;
.list-left-text-one{
font-size: 15px;
font-size: 30rpx;
//border: 2px solid blue;
}
.list-left-text-two{
color: grey;
font-size:13px;
font-size: 26rpx;
//border: 2px solid lightsalmon;
}
}
.list-left-feedback-text{
width: 240px;
width: 480rpx;
.list-left-feedback-text-one{
font-size: 15px;
font-size: 30rpx;
//border: 2px solid blue;
}
.list-left-feedback-text-two{
color: grey;
font-size:13px;
font-size: 26rpx;
//border: 2px solid lightsalmon;
}
}
@ -321,14 +321,14 @@
.list-left-icon{
//border: 2px solid blueviolet;
margin-right: 10px;
font-size: 25px;
margin-right: 20rpx;
font-size: 50rpx;
}
.list-left-select-text{
width: 160px;
width: 320rpx;
.list-left-select-text-one{
font-size: 15px;
font-size: 30rpx;
//border: 2px solid blue;
}
}
@ -337,12 +337,12 @@
.list-right{
//border: 2px solid pink;
color: royalblue;
font-size: 20px;
font-size: 40rpx;
.list-right-icon{
//border: 2px solid gainsboro;
font-size: 25px;
margin-left: 15px;
font-size: 50rpx;
margin-left: 30rpx;
}
.list-right-text{

26
utils/database.js

@ -20,7 +20,7 @@ export async function openSqlite(){
return new Promise((resolve,reject) =>{
if(isOpen()){
// console.log("数据库已经打开了")
resolve("数据库已经打开");
resolve("db has be opend");
return true
}
// console.log("开始打开数据库")
@ -65,7 +65,7 @@ export function closedb(){
export function executeSql(sql){
return new Promise((resolve,reject) =>{
//创建表格在executeSql方法里写
// console.log("开始执行自定义sql",sql)
console.log("开始执行自定义sql",sql)
plus.sqlite.executeSql({
name,
//表格创建或者打开,后面为表格结构
@ -74,7 +74,7 @@ export function executeSql(sql){
resolve(e);
},
fail(e){
console.error("自定义sql报错",e)
console.error("sql error",e)
reject(e);
}
})
@ -97,7 +97,7 @@ export const getCount = (tableName,whereObj={}) => {
sql += ` and ${i} = '${whereObj[i]}' `
}
}
console.log("getCountSQL",sql)
console.log("getCount's SQL",sql)
return selectSql(sql)
}
// 查询表是否存在
@ -136,7 +136,7 @@ export async function addSql(tableName,obj={}) {
return executeSql(sqlStr)
} else {
return new Promise((resolve, reject) => {
reject("错误")
reject("error")
})
}
}
@ -146,7 +146,7 @@ export async function addSql(tableName,obj={}) {
export async function updateSql(tableName, setData, whereObj={}){
if(!Object.keys(whereObj).length){
return new Promise((resolve, reject) => {
reject("请传whereObj")
reject("put whereObj")
});
return false
}
@ -170,7 +170,7 @@ export async function updateSql(tableName, setData, whereObj={}){
return executeSql(sql)
} else {
return new Promise((resolve, reject) => {
reject("错误")
reject("error")
});
}
}
@ -185,12 +185,12 @@ export async function deleteSql(tableName,whereObj={}){
setStr += (
`${item}='${whereObj[item]}' ${dataKeys.length - 1 !== index ? " and " : ""}`)
})
console.log("删除sql",`-- delete from ${tableName} where ${setStr}`)
console.log("delete sql",`-- delete from ${tableName} where ${setStr}`)
let sql = `delete from ${tableName} where ${setStr}`
return executeSql(sql)
} else {
return new Promise((resolve, reject) => {
reject("错误")
reject("error")
});
}
}
@ -234,7 +234,7 @@ export const getPageList = async (tableName,pageObj,whereObj={},orderBy) => {
console.log("分页sql,",sql)
if (pages < current - 1) {
return new Promise((resolve, reject) => {
reject("无数据")
reject("no datas")
});
} else {
return new Promise((resolve, reject) => {
@ -276,7 +276,7 @@ export const selectSql = (sql) => {
resolve(e);
},
fail(e) {
console.log("查询报错",e)
console.log("query error",e)
reject(e);
}
})
@ -313,7 +313,7 @@ export const selectList = (tableName,searchObj={},orderBy="") => {
return selectSql(sql)
} else {
return new Promise((resolve, reject) => {
reject("错误")
reject("error")
});
}
}
@ -345,7 +345,7 @@ export async function insertAll(tableName="",data=[]){
sql = sql.substring(0, sql.length - 1)
console.log("批量插入的sql", sql)
} else {
this.$msg("表名为空或者插入数据为空")
this.$msg("table is null or db is null")
}
}catch(e){
console.error("批量插入报错",e)

Loading…
Cancel
Save