From e7807e9709e4417d1a3726bb914ac68db9ab3ae3 Mon Sep 17 00:00:00 2001 From: zhangdongxue Date: Thu, 20 Jan 2022 16:06:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A5=AE=E6=B0=B4=E8=AE=B0=E5=BD=95=E9=95=BF?= =?UTF-8?q?=E6=8C=89=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=A3=9F=E8=B0=B1=E8=AF=A6=E6=83=85=E4=B8=AD=E6=90=AD?= =?UTF-8?q?=E9=85=8D=E6=8E=A8=E8=8D=90t=E9=A3=9F=E5=93=81=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/interfaces/drink.js | 15 +- components/sports/addPopup.vue | 9 +- pages/menu/details.vue | 2 +- pages/record/addExercises.vue | 315 +++---- pages/record/drink.vue | 812 ++++++++--------- pages/record/foods.vue | 908 +++++++++---------- uni_modules/onemue-USQLite/js_sdk/usqlite.js | 50 +- 7 files changed, 993 insertions(+), 1118 deletions(-) diff --git a/apis/interfaces/drink.js b/apis/interfaces/drink.js index 4d2128a..eacae00 100644 --- a/apis/interfaces/drink.js +++ b/apis/interfaces/drink.js @@ -35,8 +35,21 @@ const drinkWater = () => { method: 'POST', }) } +/** + * @description:删除喝水记录 + * @Date: 2022-01-20 15点08分 + */ +const delDrinkWater = (id) => { + return request({ + url: `health/waters/${id}`, + method: 'DELETE', + }) +} + + export { waters, setWaters, - drinkWater + drinkWater, + delDrinkWater } diff --git a/components/sports/addPopup.vue b/components/sports/addPopup.vue index e9649a9..c0ce236 100644 --- a/components/sports/addPopup.vue +++ b/components/sports/addPopup.vue @@ -37,7 +37,7 @@ v-if="selectSports.title === '编辑运动'" name="trash" color="#ddd" - size="20" + size="16" label="删除这条数据" labelColor="#ddd" :bold="true" @@ -49,6 +49,7 @@ placeholder="60" class="select-time" v-model="duration" + type="number" > diff --git a/pages/record/addExercises.vue b/pages/record/addExercises.vue index b86878c..8390a35 100644 --- a/pages/record/addExercises.vue +++ b/pages/record/addExercises.vue @@ -7,177 +7,164 @@ --> diff --git a/pages/record/drink.vue b/pages/record/drink.vue index 51ff8e4..9bfd096 100644 --- a/pages/record/drink.vue +++ b/pages/record/drink.vue @@ -7,446 +7,402 @@ --> \ No newline at end of file + diff --git a/pages/record/foods.vue b/pages/record/foods.vue index 94bc280..8b1f581 100644 --- a/pages/record/foods.vue +++ b/pages/record/foods.vue @@ -7,530 +7,446 @@ --> diff --git a/uni_modules/onemue-USQLite/js_sdk/usqlite.js b/uni_modules/onemue-USQLite/js_sdk/usqlite.js index 1c6877d..b71a836 100644 --- a/uni_modules/onemue-USQLite/js_sdk/usqlite.js +++ b/uni_modules/onemue-USQLite/js_sdk/usqlite.js @@ -2,7 +2,7 @@ * 对 SQLite 的 ORM 的封装处理 * @time 2021-12-30 11:00:00 * @version 2.0.0 - * + * * @by onemue */ @@ -38,9 +38,9 @@ class Utils { } } Utils.log(primaryKeyArr.length); - if (primaryKeyArr.length >= 1) { + if (primaryKeyArr.length>=1) { sql = `CREATE TABLE '${name}' (${sqlArr.join(', ')}, PRIMARY KEY (${primaryKeyArr.join()}))`; - } else { + }else{ sql = `CREATE TABLE '${name}' (${sqlArr.join(', ')})`; } Utils.log(`modelSql :${sql}`); @@ -119,7 +119,7 @@ class Model { * @constructor * @param {String} name 数据库表名 * @param {Object} options 数据表列对象 - * @returns + * @returns */ constructor(name, options) { let self = this; @@ -135,11 +135,11 @@ class Model { /** * @description 查询表数据 - * @param {String|Array} options + * @param {String|Array} options * - String WHERE 内容 * - Array 需要查询的列 - * @param {*} callback - * @returns + * @param {*} callback + * @returns */ find(options, callback) { let sql = ''; @@ -173,7 +173,7 @@ class Model { /** * @description 分页查询 * @param {Object} options : { where:查询条件, number: 当前页数 , count : 每页数量 } - * @param {Function} callback :(err,results)=>{} + * @param {Function} callback :(err,results)=>{} * @return */ limit(options, callback) { @@ -223,7 +223,7 @@ class Model { } else if (options.constructor == Object) { let keys = []; let values = []; - let index = arguments[3] ?? null; + let index = arguments[3]??null; for (var key in options) { keys.push(key); values.push(`'${options[key]}'`); @@ -236,13 +236,13 @@ class Model { name: config.name, sql: sql, success(e) { - if (index) { + if(index){ callback(null, e, options, index); } callback(null, e, options); }, fail(e) { - if (index) { + if(index){ callback(e, null, options, index); } callback(e, null, options); @@ -256,7 +256,7 @@ class Model { /** * @description 更新数据 * @param {Object} options:可选参数 更新条件 - * @param {Object} obj: 修改后的数据 + * @param {Object} obj: 修改后的数据 * @param {Function} callback :(err,results)=>{} */ update(options, obj, callback) { @@ -332,7 +332,7 @@ class Model { * @description 重命名或者新增列 * @param {Object} options 参数 数组为新增多列 对象为新增单列{aa} 字符串重命名 * @param {Function} callback :(err,results)=>{} - * @return: + * @return: */ alter(options, callback) { let self = this; @@ -366,11 +366,11 @@ class Model { return this; } /** - * @description + * @description * @param {Model} model 右 Model - * @param {Object} options - * @param {Function} callback - * @returns + * @param {Object} options + * @param {Function} callback + * @returns */ join(model, options, callback) { if (!model) { @@ -445,8 +445,8 @@ class Model { } /** - * @description 判断是否存在 - * @param {Function} callback + * @description 判断是否存在 + * @param {Function} callback */ isExist(callback) { let sql = `SELECT count(*) AS isExist FROM sqlite_master WHERE type='table' AND name='${this.name}'`; @@ -467,7 +467,7 @@ class Model { } /** * @description 删除数据表 **不推荐** - * @param {Function} callback + * @param {Function} callback */ drop(callback) { var sql = `DROP TABLE '${this.name}'`; @@ -490,7 +490,7 @@ class Model { /** * @description 创建数据表 **不推荐** - * @param {Function} callback + * @param {Function} callback */ create(callback) { let self = this; @@ -528,7 +528,7 @@ class Model { }); } // TODO 更新表结构 - // TODO 数据表备份?? + // TODO 数据表备份?? // TODO 多表联查 // TODO 下班了其他的想不起来 回头再说 } @@ -542,7 +542,7 @@ export class usqlite { * {name: 'demo', path: '_doc/demo.db'} * - name 数据库名称* * - path 数据库路径 - * @param {Function} callback + * @param {Function} callback */ constructor(options, callback) { console.warn('No instantiation'); @@ -553,7 +553,7 @@ export class usqlite { * {name: 'demo', path: '_doc/demo.db'} * - name 数据库名称* * - path 数据库路径 - * @param {Function} callback + * @param {Function} callback */ static connect(options, callback) { config.name = options.name; // 数据库名称* @@ -576,7 +576,7 @@ export class usqlite { } /** * @description 断开数据库 - * @param {*} callback + * @param {*} callback */ static close(callback) { plus.sqlite.closeDatabase({