刘忠健 2 years ago
parent
commit
a4f1aa6ebd

+ 1 - 0
uniapp_cli/src/config.js

@@ -1,4 +1,5 @@
 const config = {
+	version: "",
 	domain: "https://ssl.ycxxkj.com/yckj_framework/api/public/",//接口网址,对应public目录,一般也是用于存放前端资源文件的根目录
 	api: "index.php",//接口文件地址
 	host: "", //接口请求地址 = config.domain + config.api

+ 13 - 0
uniapp_cli/src/libs/model/Manager.js

@@ -37,6 +37,19 @@ const Manager = {
             date
         };
         let res = await http.get(url, param);
+
+        let recordList = res.data.recordList;
+        let allLong = 1;
+        recordList.forEach((item) => {
+            if (item.record_long > allLong) {
+                allLong = item.record_long;
+            }
+        });
+        recordList.forEach((item) => {
+            item.percent = (item.record_long / allLong) * 100;
+        });
+        // this.logI(tagInfo, "recoredList", recordList);
+
         return res;
     },
     /**

+ 27 - 27
uniapp_cli/src/libs/util/UniHelper.js

@@ -1,5 +1,5 @@
 
-import MapHelper from "./map_helper";
+// import MapHelper from "./map_helper";
 import to from 'await-to-js';
 const UniHelper = {
 
@@ -130,32 +130,32 @@ const UniHelper = {
             });
         });
     },
-    getLocation(type = "gcj02") {
-        return new Promise((resolve, reject) => {
-            uni.getLocation({
-                geocode: true,
-                success: async function (res) {
-
-                    console.log("当前位置: res", res);
-                    console.log("当前位置的经度:" + res.longitude);
-                    console.log("当前位置的纬度:" + res.latitude);
-                    let res1 = MapHelper.wgs84togcj02(res.latitude, res.longitude);
-                    res.latitude = res1.lat;
-                    res.longitude = res1.lon;
-                    res.lat = res1.lat;
-                    res.lng = res1.lon;
-                    resolve(res);
-                    // uni.showModal({
-                    //     content: "当前位置的经度:" + res.longitude + "当前位置的纬度:" + res.latitude + "," + JSON.stringify(res1)
-                    // })
-
-                },
-                fail: function (res) {
-                    resolve(false);
-                }
-            });
-        });
-    }
+    /*  getLocation(type = "gcj02") {
+         return new Promise((resolve, reject) => {
+             uni.getLocation({
+                 geocode: true,
+                 success: async function (res) {
+ 
+                     console.log("当前位置: res", res);
+                     console.log("当前位置的经度:" + res.longitude);
+                     console.log("当前位置的纬度:" + res.latitude);
+                     let res1 = MapHelper.wgs84togcj02(res.latitude, res.longitude);
+                     res.latitude = res1.lat;
+                     res.longitude = res1.lon;
+                     res.lat = res1.lat;
+                     res.lng = res1.lon;
+                     resolve(res);
+                     // uni.showModal({
+                     //     content: "当前位置的经度:" + res.longitude + "当前位置的纬度:" + res.latitude + "," + JSON.stringify(res1)
+                     // })
+ 
+                 },
+                 fail: function (res) {
+                     resolve(false);
+                 }
+             });
+         });
+     } */
 
 }
 

+ 3 - 3
uniapp_cli/src/pages/index/reg.vue

@@ -4,13 +4,13 @@
 		<!-- 登录窗口 -->
 		<view class="p40">
 			<view class="p20">
-				<u-input v-model="form.login_name" maxlength="20" prefixIcon="account" placeholder="请输入账号" border="surround" clearable></u-input>
+				<u-input v-model="form.login_name" maxlength="20" prefixIcon="account" placeholder="请输入账号" :border="true" clearable></u-input>
 			</view>
 			<view class="p20">
-				<u-input v-model="form.password" maxlength="25" prefixIcon="lock" placeholder="请输入密码" border="surround" type="password" clearable></u-input>
+				<u-input v-model="form.password" maxlength="25" prefixIcon="lock" placeholder="请输入密码" :border="true" type="password" clearable></u-input>
 			</view>
 			<view class="p20">
-				<u-input v-model="form.repassword" maxlength="25" prefixIcon="lock" placeholder="请再次输入密码" border="surround" type="password" clearable></u-input>
+				<u-input v-model="form.repassword" maxlength="25" prefixIcon="lock" placeholder="请再次输入密码" :border="true" type="password" clearable></u-input>
 			</view>
 			<view class="p20">
 				<u-button type="primary" text="注册" @click="reg">注册</u-button>

+ 39 - 0
uniapp_cli/src/pages/index/template1.vue

@@ -13,6 +13,45 @@ export default {
 	},
 	onLoad() {
 		this.loadData();
+		uni.request({
+			url: "https://www.example.com/request", //仅为示例,并非真实接口地址。
+			data: {
+				text: "uni.request"
+			},
+			header: {
+				"custom-header": "hello" //自定义请求头信息
+			},
+			success: (res) => {
+				if (res.code == 0) {
+					uni.request({
+						url: "https://www.example.com/request", //仅为示例,并非真实接口地址。
+						data: {
+							text: "uni.request"
+						},
+						header: {
+							"custom-header": "hello" //自定义请求头信息
+						},
+						success: (res1) => {
+							if (res1.code == 0) {
+								uni.request({
+									url: "https://www.example.com/request", //仅为示例,并非真实接口地址。
+									data: {
+										text: "uni.request"
+									},
+									header: {
+										"custom-header": "hello" //自定义请求头信息
+									},
+									success: (res) => {
+										console.log(res.data);
+										this.text = "request success";
+									}
+								});
+							}
+						}
+					});
+				}
+			}
+		});
 	},
 	methods: {
 		async loadData() {

+ 5 - 2
uniapp_cli/src/pages/manager/edit.vue

@@ -74,6 +74,7 @@ let tagInfo = "[/pages/.vue]";
 import basePage from "@/libs/base-page.js";
 import dayjs from "dayjs";
 import Manager from "../../libs/model/Manager";
+import UniHelper from "../../libs/util/UniHelper";
 export default {
 	mixins: [basePage],
 	data() {
@@ -161,7 +162,9 @@ export default {
 				this._util.message.alert(res.msg);
 				return;
 			}
-			uni.showModal({
+			let resAlert = await UniHelper.alert("操作成功");
+			this.navigateBack();
+			/* uni.showModal({
 				content: "操作成功",
 				showCancel: false,
 				success: (res) => {
@@ -169,7 +172,7 @@ export default {
 						that.navigateBack();
 					}
 				}
-			});
+			}); */
 		},
 		async deleteRecord() {
 			let that = this;

+ 0 - 11
uniapp_cli/src/pages/manager/index.vue

@@ -67,17 +67,6 @@ export default {
 				return;
 			}
 			this.dateArr = res.data.dateArr;
-			let recordList = res.data.recordList;
-			let allLong = 1;
-			recordList.forEach((item) => {
-				if (item.record_long > allLong) {
-					allLong = item.record_long;
-				}
-			});
-			recordList.forEach((item) => {
-				item.percent = (item.record_long / allLong) * 100;
-			});
-			this.logI(tagInfo, "recoredList", recordList);
 			this.recordList = res.data.recordList;
 		},
 		dateChange(e) {