1 Star 0 Fork 2

studyinglover/In XUPT

forked from Marston/In XUPT 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
App.vue 14.53 KB
一键复制 编辑 原始数据 按行查看 历史
王晨辉 提交于 2021-05-28 10:48 . 帖子发布页更新
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
<script>
import checkappupdate from 'common/checkappupdate.js';
import BaseUrl from 'common/config.js';
import { opdb } from 'common/in-xupt-functions.js';
export default {
methods: {
creatTable: function() {
plus.sqlite.executeSql({
name:'notice',
sql: [
// 创建回复提醒表
`CREATE TABLE if not exists reply_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"sender_id" TEXT NOT NULL,
"source_content" TEXT NOT NULL,
"reply_content" TEXT,
"send_time" TEXT NOT NULL,
"source_type" INTEGER(2) NOT NULL,
"post_type" INTEGER(2) NOT NULL,
"source_id" INTEGER(11) NOT NULL)`,
// 创建艾特提醒表
`CREATE TABLE if not exists at_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"sender_id" TEXT NOT NULL,
"source_id" INTEGER(11) NOT NULL,
"action" TEXT NOT NULL,
"source_type" TEXT NOT NULL,
"post_type" INTEGER(2) NOT NULL,
"source_content" TEXT NOT NULL,
"send_time" TEXT NOT NULL)`,
// 创建动态提醒表
`CREATE TABLE if not exists news_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"sender_id" TEXT NOT NULL,
"source_content" TEXT NOT NULL,
"send_time" TEXT NOT NULL,
"source_id" INTEGER(11) NOT NULL,
"post_type" INTEGER(2) NOT NULL)`,
// 创建系统提醒表
`CREATE TABLE if not exists system_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"publish_time" TEXT NOT NULL)`
],
success: () => {
console.log("表创建成功!")
plus.sqlite.closeDatabase({
name: 'notice',
success: (e) => {
console.log("close db after creat table")
},
fail: (err) => {
console.log(err)
console.log("fail to close")
}
})
},
fail: (e) => {
console.log("表创建失败!")
console.log(e)
}
})
}
},
onLaunch: function() {
console.log('App Launch');
let ifFirstLaunch = uni.getStorageSync('ifFirstLaunch')
if(ifFirstLaunch === undefined) {
console.log("first",ifFirstLaunch)
uni.setStorageSync('ifFirstLaunch', true);
}else if (ifFirstLaunch === true) {
console.log("notFirst",ifFirstLaunch)
uni.setStorageSync('ifFirstLaunch', false);
}else {
console.log("notFirst",ifFirstLaunch)
}
// uni.setStorageSync('ifFirstLaunch', true);
let that = this;
// 定义是否刷新的全局变量,直接挂载到uni原型下
uni.isRefresh = false;
var temp=Object.assign(uni.previewImage);
uni.previewImage = function(obj){
temp(obj).then(()=>{
uni.isPriview = true;
})
}
// 在APP环境下
// #ifdef APP-PLUS
// 调用函数打开或者创建数据库
if(!plus.sqlite.isOpenDatabase('notice','_doc/notice.db')) {
opdb('notice','_doc/a.db')
.then(() => {
// 创建数据表
that.creatTable();
// 调试使用清除数据表
// plus.sqlite.executeSql({
// name: 'notice',
// sql: [
// 'drop table reply_messages',
// 'drop table news_messages'
// ],
// success: (e) => {
// console.log(e)
// console.log("成功删除所有数据表")
// },
// fail: (err) =>{
// console.log(err)
// }
// })
})
}
// 禁止用户横屏操作
plus.screen.lockOrientation('portrait-primary');
// 调用函数检查更新
checkappupdate.check({
// {} 里配置参数, 默认如下,其中api是接口地址,必须填写
title:"检测到有新版本!",
content:"请升级app到最新版本!",
canceltext:"暂不升级",
oktext:"立即升级",
api: BaseUrl + '/version'
})
// #endif
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
}
</script>
<style lang="less">
/*每个页面公共css */
@import url('@/common/iconfont.css');
view {
font-size: 16px;
}
page {
background-color: @g-background;
}
// 页面中设置高度100% 可实现 ————小鸽子
uni-page-body,
#app {
height: 100%;
}
image {
background-color: #F0F0F0;
}
.bottom_box {
height: 50px;
}
.uni-tabbar {
box-shadow: 0px 10px 20px 0px #888;
background-color: #fff !important;
}
.uni-tabbar-border {
background-color: transparent !important;
}
</style>
=======
<script>
import checkappupdate from 'common/checkappupdate.js';
import BaseUrl from 'common/config.js';
import { opdb } from 'common/in-xupt-functions.js';
export default {
methods: {
creatTable: function() {
plus.sqlite.executeSql({
name:'notice',
sql: [
// 创建回复提醒表
`CREATE TABLE if not exists reply_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"sender_id" TEXT NOT NULL,
"source_content" TEXT NOT NULL,
"reply_content" TEXT,
"send_time" TEXT NOT NULL,
"source_type" INTEGER(2) NOT NULL,
"post_type" INTEGER(2) NOT NULL,
"source_id" INTEGER(11) NOT NULL)`,
// 创建艾特提醒表
`CREATE TABLE if not exists at_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"sender_id" TEXT NOT NULL,
"source_id" INTEGER(11) NOT NULL,
"action" TEXT NOT NULL,
"source_type" TEXT NOT NULL,
"post_type" INTEGER(2) NOT NULL,
"source_content" TEXT NOT NULL,
"send_time" TEXT NOT NULL)`,
// 创建动态提醒表
`CREATE TABLE if not exists news_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"sender_id" TEXT NOT NULL,
"source_content" TEXT NOT NULL,
"send_time" TEXT NOT NULL,
"source_id" INTEGER(11) NOT NULL,
"post_type" INTEGER(2) NOT NULL)`,
// 创建系统提醒表
`CREATE TABLE if not exists system_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"publish_time" TEXT NOT NULL)`
],
success: () => {
console.log("表创建成功!")
plus.sqlite.closeDatabase({
name: 'notice',
success: (e) => {
console.log("close db after creat table")
},
fail: (err) => {
console.log(err)
console.log("fail to close")
}
})
},
fail: (e) => {
console.log("表创建失败!")
console.log(e)
}
})
}
},
onLaunch: function() {
console.log('App Launch');
let ifFirstLaunch = uni.getStorageSync('ifFirstLaunch')
if(ifFirstLaunch === undefined) {
console.log("first",ifFirstLaunch)
uni.setStorageSync('ifFirstLaunch', true);
}else if (ifFirstLaunch === true) {
console.log("notFirst",ifFirstLaunch)
uni.setStorageSync('ifFirstLaunch', false);
}else {
console.log("notFirst",ifFirstLaunch)
}
// uni.setStorageSync('ifFirstLaunch', true);
let that = this;
// 定义是否刷新的全局变量,直接挂载到uni原型下
uni.isRefresh = false;
var temp=Object.assign(uni.previewImage);
uni.previewImage = function(obj){
temp(obj).then(()=>{
uni.isPriview = true;
})
}
// 在APP环境下
// #ifdef APP-PLUS
// 调用函数打开或者创建数据库
if(!plus.sqlite.isOpenDatabase('notice','_doc/notice.db')) {
opdb('notice','_doc/a.db')
.then(() => {
// 创建数据表
that.creatTable();
// 调试使用清除数据表
// plus.sqlite.executeSql({
// name: 'notice',
// sql: [
// 'drop table reply_messages',
// 'drop table news_messages'
// ],
// success: (e) => {
// console.log(e)
// console.log("成功删除所有数据表")
// },
// fail: (err) =>{
// console.log(err)
// }
// })
})
}
// 禁止用户横屏操作
plus.screen.lockOrientation('portrait-primary');
// 调用函数检查更新
checkappupdate.check({
// {} 里配置参数, 默认如下,其中api是接口地址,必须填写
title:"检测到有新版本!",
content:"请升级app到最新版本!",
canceltext:"暂不升级",
oktext:"立即升级",
api: BaseUrl + '/version'
})
// #endif
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
}
</script>
<style lang="less">
/*每个页面公共css */
@import url('@/common/iconfont.css');
view {
font-size: 16px;
}
page {
background-color: @g-background;
}
// 页面中设置高度100% 可实现 ————小鸽子
uni-page-body,
#app {
height: 100%;
}
image {
background-color: #F0F0F0;
}
.bottom_box {
height: 50px;
}
.uni-tabbar {
box-shadow: 0px 10px 20px 0px #888;
background-color: #fff !important;
}
.uni-tabbar-border {
background-color: transparent !important;
}
</style>
>>>>>>> d4605a47e0508be7845427ffacd11ec91f4c5549
=======
<script>
import checkappupdate from 'common/checkappupdate.js';
import BaseUrl from 'common/config.js';
import { opdb } from 'common/in-xupt-functions.js';
export default {
methods: {
creatTable: function() {
plus.sqlite.executeSql({
name:'notice',
sql: [
// 创建回复提醒表
`CREATE TABLE if not exists reply_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"sender_id" TEXT NOT NULL,
"source_content" TEXT NOT NULL,
"reply_content" TEXT,
"send_time" TEXT NOT NULL,
"source_type" INTEGER(2) NOT NULL,
"post_type" INTEGER(2) NOT NULL,
"source_id" INTEGER(11) NOT NULL)`,
// 创建艾特提醒表
`CREATE TABLE if not exists at_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"sender_id" TEXT NOT NULL,
"source_id" INTEGER(11) NOT NULL,
"action" TEXT NOT NULL,
"source_type" TEXT NOT NULL,
"post_type" INTEGER(2) NOT NULL,
"source_content" TEXT NOT NULL,
"send_time" TEXT NOT NULL)`,
// 创建动态提醒表
`CREATE TABLE if not exists news_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"sender_id" TEXT NOT NULL,
"source_content" TEXT NOT NULL,
"send_time" TEXT NOT NULL,
"source_id" INTEGER(11) NOT NULL,
"post_type" INTEGER(2) NOT NULL)`,
// 创建系统提醒表
`CREATE TABLE if not exists system_messages (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"user_id" INTEGER(11) NOT NULL,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"publish_time" TEXT NOT NULL)`
],
success: () => {
console.log("表创建成功!")
plus.sqlite.closeDatabase({
name: 'notice',
success: (e) => {
console.log("close db after creat table")
},
fail: (err) => {
console.log(err)
console.log("fail to close")
}
})
},
fail: (e) => {
console.log("表创建失败!")
console.log(e)
}
})
}
},
onLaunch: function() {
console.log('App Launch');
let ifFirstLaunch = uni.getStorageSync('ifFirstLaunch')
if(ifFirstLaunch === undefined) {
console.log("first",ifFirstLaunch)
uni.setStorageSync('ifFirstLaunch', true);
}else if (ifFirstLaunch === true) {
console.log("notFirst",ifFirstLaunch)
uni.setStorageSync('ifFirstLaunch', false);
}else {
console.log("notFirst",ifFirstLaunch)
}
// uni.setStorageSync('ifFirstLaunch', true);
let that = this;
// 定义是否刷新的全局变量,直接挂载到uni原型下
uni.isRefresh = false;
var temp=Object.assign(uni.previewImage);
uni.previewImage = function(obj){
temp(obj).then(()=>{
uni.isPriview = true;
})
}
// 在APP环境下
// #ifdef APP-PLUS
// 调用函数打开或者创建数据库
if(!plus.sqlite.isOpenDatabase('notice','_doc/notice.db')) {
opdb('notice','_doc/a.db')
.then(() => {
// 创建数据表
that.creatTable();
// 调试使用清除数据表
// plus.sqlite.executeSql({
// name: 'notice',
// sql: [
// 'drop table reply_messages',
// 'drop table news_messages'
// ],
// success: (e) => {
// console.log(e)
// console.log("成功删除所有数据表")
// },
// fail: (err) =>{
// console.log(err)
// }
// })
})
}
// 禁止用户横屏操作
plus.screen.lockOrientation('portrait-primary');
// 调用函数检查更新
checkappupdate.check({
// {} 里配置参数, 默认如下,其中api是接口地址,必须填写
title:"检测到有新版本!",
content:"请升级app到最新版本!",
canceltext:"暂不升级",
oktext:"立即升级",
api: BaseUrl + '/version'
})
// #endif
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
}
</script>
<style lang="less">
/*每个页面公共css */
@import url('@/common/iconfont.css');
view {
font-size: 16px;
}
page {
background-color: @g-background;
}
// 页面中设置高度100% 可实现 ————小鸽子
uni-page-body,
#app {
height: 100%;
}
image {
background-color: #F0F0F0;
}
.bottom_box {
height: 50px;
}
.uni-tabbar {
box-shadow: 0px 10px 20px 0px #888;
background-color: #fff !important;
}
.uni-tabbar-border {
background-color: transparent !important;
}
</style>
>>>>>>> d4605a47e0508be7845427ffacd11ec91f4c5549
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/StudyingLover/In-XUPT.git
git@gitee.com:StudyingLover/In-XUPT.git
StudyingLover
In-XUPT
In XUPT
develop

搜索帮助

0d507c66 1850385 C8b1a773 1850385