Jelajahi Sumber

定位相关模块

学习?学个屁 20 jam lalu
induk
melakukan
1af8d630c4

+ 1122 - 0
src/libs/qqmap-wx-jssdk.js

@@ -0,0 +1,1122 @@
+/**
+ * 微信小程序JavaScriptSDK
+ * 
+ * @version 1.2
+ * @date 2019-03-06
+ */
+
+var ERROR_CONF = {
+    KEY_ERR: 311,
+    KEY_ERR_MSG: 'key格式错误',
+    PARAM_ERR: 310,
+    PARAM_ERR_MSG: '请求参数信息有误',
+    SYSTEM_ERR: 600,
+    SYSTEM_ERR_MSG: '系统错误',
+    WX_ERR_CODE: 1000,
+    WX_OK_CODE: 200
+};
+var BASE_URL = 'https://apis.map.qq.com/ws/';
+var URL_SEARCH = BASE_URL + 'place/v1/search';
+var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion';
+var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/';
+var URL_CITY_LIST = BASE_URL + 'district/v1/list';
+var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren';
+var URL_DISTANCE = BASE_URL + 'distance/v1/';
+var URL_DIRECTION = BASE_URL + 'direction/v1/';
+var MODE = {
+  driving: 'driving',
+  transit: 'transit'
+};
+var EARTH_RADIUS = 6378136.49;
+var Utils = {
+  /**
+  * md5加密方法
+  * 版权所有©2011 Sebastian Tschan,https://blueimp.net
+  */
+  safeAdd(x, y) {
+    var lsw = (x & 0xffff) + (y & 0xffff);
+    var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
+    return (msw << 16) | (lsw & 0xffff);
+  },
+  bitRotateLeft(num, cnt) {
+    return (num << cnt) | (num >>> (32 - cnt));
+  },
+  md5cmn(q, a, b, x, s, t) {
+    return this.safeAdd(this.bitRotateLeft(this.safeAdd(this.safeAdd(a, q), this.safeAdd(x, t)), s), b);
+  },
+  md5ff(a, b, c, d, x, s, t) {
+    return this.md5cmn((b & c) | (~b & d), a, b, x, s, t);
+  },
+  md5gg(a, b, c, d, x, s, t) {
+    return this.md5cmn((b & d) | (c & ~d), a, b, x, s, t);
+  },
+  md5hh(a, b, c, d, x, s, t) {
+    return this.md5cmn(b ^ c ^ d, a, b, x, s, t);
+  },
+  md5ii(a, b, c, d, x, s, t) {
+    return this.md5cmn(c ^ (b | ~d), a, b, x, s, t);
+  },
+  binlMD5(x, len) {
+    /* append padding */
+    x[len >> 5] |= 0x80 << (len % 32);
+    x[((len + 64) >>> 9 << 4) + 14] = len;
+
+    var i;
+    var olda;
+    var oldb;
+    var oldc;
+    var oldd;
+    var a = 1732584193;
+    var b = -271733879;
+    var c = -1732584194;
+    var d = 271733878;
+
+    for (i = 0; i < x.length; i += 16) {
+      olda = a;
+      oldb = b;
+      oldc = c;
+      oldd = d;
+
+      a = this.md5ff(a, b, c, d, x[i], 7, -680876936);
+      d = this.md5ff(d, a, b, c, x[i + 1], 12, -389564586);
+      c = this.md5ff(c, d, a, b, x[i + 2], 17, 606105819);
+      b = this.md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
+      a = this.md5ff(a, b, c, d, x[i + 4], 7, -176418897);
+      d = this.md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
+      c = this.md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
+      b = this.md5ff(b, c, d, a, x[i + 7], 22, -45705983);
+      a = this.md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
+      d = this.md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
+      c = this.md5ff(c, d, a, b, x[i + 10], 17, -42063);
+      b = this.md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
+      a = this.md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
+      d = this.md5ff(d, a, b, c, x[i + 13], 12, -40341101);
+      c = this.md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
+      b = this.md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
+
+      a = this.md5gg(a, b, c, d, x[i + 1], 5, -165796510);
+      d = this.md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
+      c = this.md5gg(c, d, a, b, x[i + 11], 14, 643717713);
+      b = this.md5gg(b, c, d, a, x[i], 20, -373897302);
+      a = this.md5gg(a, b, c, d, x[i + 5], 5, -701558691);
+      d = this.md5gg(d, a, b, c, x[i + 10], 9, 38016083);
+      c = this.md5gg(c, d, a, b, x[i + 15], 14, -660478335);
+      b = this.md5gg(b, c, d, a, x[i + 4], 20, -405537848);
+      a = this.md5gg(a, b, c, d, x[i + 9], 5, 568446438);
+      d = this.md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
+      c = this.md5gg(c, d, a, b, x[i + 3], 14, -187363961);
+      b = this.md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
+      a = this.md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
+      d = this.md5gg(d, a, b, c, x[i + 2], 9, -51403784);
+      c = this.md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
+      b = this.md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
+
+      a = this.md5hh(a, b, c, d, x[i + 5], 4, -378558);
+      d = this.md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
+      c = this.md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
+      b = this.md5hh(b, c, d, a, x[i + 14], 23, -35309556);
+      a = this.md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
+      d = this.md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
+      c = this.md5hh(c, d, a, b, x[i + 7], 16, -155497632);
+      b = this.md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
+      a = this.md5hh(a, b, c, d, x[i + 13], 4, 681279174);
+      d = this.md5hh(d, a, b, c, x[i], 11, -358537222);
+      c = this.md5hh(c, d, a, b, x[i + 3], 16, -722521979);
+      b = this.md5hh(b, c, d, a, x[i + 6], 23, 76029189);
+      a = this.md5hh(a, b, c, d, x[i + 9], 4, -640364487);
+      d = this.md5hh(d, a, b, c, x[i + 12], 11, -421815835);
+      c = this.md5hh(c, d, a, b, x[i + 15], 16, 530742520);
+      b = this.md5hh(b, c, d, a, x[i + 2], 23, -995338651);
+
+      a = this.md5ii(a, b, c, d, x[i], 6, -198630844);
+      d = this.md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
+      c = this.md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
+      b = this.md5ii(b, c, d, a, x[i + 5], 21, -57434055);
+      a = this.md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
+      d = this.md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
+      c = this.md5ii(c, d, a, b, x[i + 10], 15, -1051523);
+      b = this.md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
+      a = this.md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
+      d = this.md5ii(d, a, b, c, x[i + 15], 10, -30611744);
+      c = this.md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
+      b = this.md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
+      a = this.md5ii(a, b, c, d, x[i + 4], 6, -145523070);
+      d = this.md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
+      c = this.md5ii(c, d, a, b, x[i + 2], 15, 718787259);
+      b = this.md5ii(b, c, d, a, x[i + 9], 21, -343485551);
+
+      a = this.safeAdd(a, olda);
+      b = this.safeAdd(b, oldb);
+      c = this.safeAdd(c, oldc);
+      d = this.safeAdd(d, oldd);
+    }
+    return [a, b, c, d];
+  },
+  binl2rstr(input) {
+    var i;
+    var output = '';
+    var length32 = input.length * 32;
+    for (i = 0; i < length32; i += 8) {
+      output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff);
+    }
+    return output;
+  },
+  rstr2binl(input) {
+    var i;
+    var output = [];
+    output[(input.length >> 2) - 1] = undefined;
+    for (i = 0; i < output.length; i += 1) {
+      output[i] = 0;
+    }
+    var length8 = input.length * 8;
+    for (i = 0; i < length8; i += 8) {
+      output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32);
+    }
+    return output;
+  },
+  rstrMD5(s) {
+    return this.binl2rstr(this.binlMD5(this.rstr2binl(s), s.length * 8));
+  },
+  rstrHMACMD5(key, data) {
+    var i;
+    var bkey = this.rstr2binl(key);
+    var ipad = [];
+    var opad = [];
+    var hash;
+    ipad[15] = opad[15] = undefined;
+    if (bkey.length > 16) {
+      bkey = this.binlMD5(bkey, key.length * 8);
+    }
+    for (i = 0; i < 16; i += 1) {
+      ipad[i] = bkey[i] ^ 0x36363636;
+      opad[i] = bkey[i] ^ 0x5c5c5c5c;
+    }
+    hash = this.binlMD5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8);
+    return this.binl2rstr(this.binlMD5(opad.concat(hash), 512 + 128));
+  },
+  rstr2hex(input) {
+    var hexTab = '0123456789abcdef';
+    var output = '';
+    var x;
+    var i;
+    for (i = 0; i < input.length; i += 1) {
+      x = input.charCodeAt(i);
+      output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);
+    }
+    return output;
+  },
+  str2rstrUTF8(input) {
+    return unescape(encodeURIComponent(input));
+  },
+  rawMD5(s) {
+    return this.rstrMD5(this.str2rstrUTF8(s));
+  },
+  hexMD5(s) {
+    return this.rstr2hex(this.rawMD5(s));
+  },
+  rawHMACMD5(k, d) {
+    return this.rstrHMACMD5(this.str2rstrUTF8(k), str2rstrUTF8(d));
+  },
+  hexHMACMD5(k, d) {
+    return this.rstr2hex(this.rawHMACMD5(k, d));
+  },
+
+  md5(string, key, raw) {
+    if (!key) {
+      if (!raw) {
+        return this.hexMD5(string);
+      }
+      return this.rawMD5(string);
+    }
+    if (!raw) {
+      return this.hexHMACMD5(key, string);
+    }
+    return this.rawHMACMD5(key, string);
+  },
+  /**
+   * 得到md5加密后的sig参数
+   * @param {Object} requestParam 接口参数
+   * @param {String} sk签名字符串
+   * @param {String} featrue 方法名
+   * @return 返回加密后的sig参数
+   */
+  getSig(requestParam, sk, feature, mode) {
+    var sig = null;
+    var requestArr = [];
+    Object.keys(requestParam).sort().forEach(function(key){
+      requestArr.push(key + '=' + requestParam[key]);
+    });
+    if (feature == 'search') {
+      sig = '/ws/place/v1/search?' + requestArr.join('&') + sk;
+    }
+    if (feature == 'suggest') {
+      sig = '/ws/place/v1/suggestion?' + requestArr.join('&') + sk;
+    }
+    if (feature == 'reverseGeocoder') {
+      sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk;
+    }
+    if (feature == 'geocoder') {
+      sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk;
+    }
+    if (feature == 'getCityList') {
+      sig = '/ws/district/v1/list?' + requestArr.join('&') + sk;
+    }
+    if (feature == 'getDistrictByCityId') {
+      sig = '/ws/district/v1/getchildren?' + requestArr.join('&') + sk;
+    }
+    if (feature == 'calculateDistance') {
+      sig = '/ws/distance/v1/?' + requestArr.join('&') + sk;
+    }
+    if (feature == 'direction') {
+      sig = '/ws/direction/v1/' + mode + '?' + requestArr.join('&') + sk;
+    }
+    sig = this.md5(sig);
+    return sig;
+  },
+    /**
+     * 得到终点query字符串
+     * @param {Array|String} 检索数据
+     */
+    location2query(data) {
+        if (typeof data == 'string') {
+            return data;
+        }
+        var query = '';
+        for (var i = 0; i < data.length; i++) {
+            var d = data[i];
+            if (!!query) {
+                query += ';';
+            }
+            if (d.location) {
+                query = query + d.location.lat + ',' + d.location.lng;
+            }
+            if (d.latitude && d.longitude) {
+                query = query + d.latitude + ',' + d.longitude;
+            }
+        }
+        return query;
+    },
+
+    /**
+     * 计算角度
+     */
+    rad(d) {
+      return d * Math.PI / 180.0;
+    },  
+    /**
+     * 处理终点location数组
+     * @return 返回终点数组
+     */
+    getEndLocation(location){
+      var to = location.split(';');
+      var endLocation = [];
+      for (var i = 0; i < to.length; i++) {
+        endLocation.push({
+          lat: parseFloat(to[i].split(',')[0]),
+          lng: parseFloat(to[i].split(',')[1])
+        })
+      }
+      return endLocation;
+    },
+
+    /**
+     * 计算两点间直线距离
+     * @param a 表示纬度差
+     * @param b 表示经度差
+     * @return 返回的是距离,单位m
+     */
+    getDistance(latFrom, lngFrom, latTo, lngTo) {
+      var radLatFrom = this.rad(latFrom);
+      var radLatTo = this.rad(latTo);
+      var a = radLatFrom - radLatTo;
+      var b = this.rad(lngFrom) - this.rad(lngTo);
+      var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(radLatTo) * Math.pow(Math.sin(b / 2), 2)));
+      distance = distance * EARTH_RADIUS;
+      distance = Math.round(distance * 10000) / 10000;
+      return parseFloat(distance.toFixed(0));
+    },
+    /**
+     * 使用微信接口进行定位
+     */
+    getWXLocation(success, fail, complete) {
+        wx.getLocation({
+            type: 'gcj02',
+            success: success,
+            fail: fail,
+            complete: complete
+        });
+    },
+
+    /**
+     * 获取location参数
+     */
+    getLocationParam(location) {
+        if (typeof location == 'string') {
+            var locationArr = location.split(',');
+            if (locationArr.length === 2) {
+                location = {
+                    latitude: location.split(',')[0],
+                    longitude: location.split(',')[1]
+                };
+            } else {
+                location = {};
+            }
+        }
+        return location;
+    },
+
+    /**
+     * 回调函数默认处理
+     */
+    polyfillParam(param) {
+        param.success = param.success || function () { };
+        param.fail = param.fail || function () { };
+        param.complete = param.complete || function () { };
+    },
+
+    /**
+     * 验证param对应的key值是否为空
+     * 
+     * @param {Object} param 接口参数
+     * @param {String} key 对应参数的key
+     */
+    checkParamKeyEmpty(param, key) {
+        if (!param[key]) {
+            var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key +'参数格式有误');
+            param.fail(errconf);
+            param.complete(errconf);
+            return true;
+        }
+        return false;
+    },
+
+    /**
+     * 验证参数中是否存在检索词keyword
+     * 
+     * @param {Object} param 接口参数
+     */
+    checkKeyword(param){
+        return !this.checkParamKeyEmpty(param, 'keyword');
+    },
+
+    /**
+     * 验证location值
+     * 
+     * @param {Object} param 接口参数
+     */
+    checkLocation(param) {
+        var location = this.getLocationParam(param.location);
+        if (!location || !location.latitude || !location.longitude) {
+            var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误');
+            param.fail(errconf);
+            param.complete(errconf);
+            return false;
+        }
+        return true;
+    },
+
+    /**
+     * 构造错误数据结构
+     * @param {Number} errCode 错误码
+     * @param {Number} errMsg 错误描述
+     */
+    buildErrorConfig(errCode, errMsg) {
+        return {
+            status: errCode,
+            message: errMsg
+        };
+    },
+
+    /**
+     * 
+     * 数据处理函数
+     * 根据传入参数不同处理不同数据
+     * @param {String} feature 功能名称
+     * search 地点搜索
+     * suggest关键词提示
+     * reverseGeocoder逆地址解析
+     * geocoder地址解析
+     * getCityList获取城市列表:父集
+     * getDistrictByCityId获取区县列表:子集
+     * calculateDistance距离计算
+     * @param {Object} param 接口参数
+     * @param {Object} data 数据
+     */
+    handleData(param,data,feature){
+      if (feature == 'search') {
+        var searchResult = data.data;
+        var searchSimplify = [];
+        for (var i = 0; i < searchResult.length; i++) {
+          searchSimplify.push({
+            id: searchResult[i].id || null,
+            title: searchResult[i].title || null,
+            latitude: searchResult[i].location && searchResult[i].location.lat || null,
+            longitude: searchResult[i].location && searchResult[i].location.lng || null,
+            address: searchResult[i].address || null,
+            category: searchResult[i].category || null,
+            tel: searchResult[i].tel || null,
+            adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null,
+            city: searchResult[i].ad_info && searchResult[i].ad_info.city || null,
+            district: searchResult[i].ad_info && searchResult[i].ad_info.district || null,
+            province: searchResult[i].ad_info && searchResult[i].ad_info.province || null
+          })
+        }
+        param.success(data, {
+          searchResult: searchResult,
+          searchSimplify: searchSimplify
+        })
+      } else if (feature == 'suggest') {
+        var suggestResult = data.data;
+        var suggestSimplify = [];
+        for (var i = 0; i < suggestResult.length; i++) {
+          suggestSimplify.push({
+            adcode: suggestResult[i].adcode || null,
+            address: suggestResult[i].address || null,
+            category: suggestResult[i].category || null,
+            city: suggestResult[i].city || null,
+            district: suggestResult[i].district || null,
+            id: suggestResult[i].id || null,
+            latitude: suggestResult[i].location && suggestResult[i].location.lat || null,
+            longitude: suggestResult[i].location && suggestResult[i].location.lng || null,
+            province: suggestResult[i].province || null,
+            title: suggestResult[i].title || null,
+            type: suggestResult[i].type || null
+          })
+        }
+        param.success(data, {
+          suggestResult: suggestResult,
+          suggestSimplify: suggestSimplify
+          })
+      } else if (feature == 'reverseGeocoder') {
+        var reverseGeocoderResult = data.result;
+        var reverseGeocoderSimplify = {
+          address: reverseGeocoderResult.address || null,
+          latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null,
+          longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null,
+          adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null,
+          city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null,
+          district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null,
+          nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null,
+          province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null,
+          street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null,
+          street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null,
+          recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null,
+          rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null
+        };
+        if (reverseGeocoderResult.pois) {//判断是否返回周边poi
+          var pois = reverseGeocoderResult.pois;
+          var poisSimplify = [];
+          for (var i = 0;i < pois.length;i++) {
+            poisSimplify.push({
+              id: pois[i].id || null,
+              title: pois[i].title || null,
+              latitude: pois[i].location && pois[i].location.lat || null,
+              longitude: pois[i].location && pois[i].location.lng || null,
+              address: pois[i].address || null,
+              category: pois[i].category || null,
+              adcode: pois[i].ad_info && pois[i].ad_info.adcode || null,
+              city: pois[i].ad_info && pois[i].ad_info.city || null,
+              district: pois[i].ad_info && pois[i].ad_info.district || null,
+              province: pois[i].ad_info && pois[i].ad_info.province || null
+            })
+          }
+          param.success(data,{
+            reverseGeocoderResult: reverseGeocoderResult,
+            reverseGeocoderSimplify: reverseGeocoderSimplify,
+            pois: pois,
+            poisSimplify: poisSimplify
+          })
+        } else {
+          param.success(data, {
+            reverseGeocoderResult: reverseGeocoderResult,
+            reverseGeocoderSimplify: reverseGeocoderSimplify
+          })
+        }
+      } else if (feature == 'geocoder') {
+        var geocoderResult = data.result;
+        var geocoderSimplify = {
+          title: geocoderResult.title || null,
+          latitude: geocoderResult.location && geocoderResult.location.lat || null,
+          longitude: geocoderResult.location && geocoderResult.location.lng || null,
+          adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null,
+          province: geocoderResult.address_components && geocoderResult.address_components.province || null,
+          city: geocoderResult.address_components && geocoderResult.address_components.city || null,
+          district: geocoderResult.address_components && geocoderResult.address_components.district || null,
+          street: geocoderResult.address_components && geocoderResult.address_components.street || null,
+          street_number: geocoderResult.address_components && geocoderResult.address_components.street_number || null,
+          level: geocoderResult.level || null
+        };
+        param.success(data,{
+          geocoderResult: geocoderResult,
+          geocoderSimplify: geocoderSimplify
+        });
+      } else if (feature == 'getCityList') {
+        var provinceResult = data.result[0];
+        var cityResult = data.result[1];
+        var districtResult = data.result[2];
+        param.success(data,{
+          provinceResult: provinceResult,
+          cityResult: cityResult,
+          districtResult: districtResult
+        });
+      } else if (feature == 'getDistrictByCityId') {
+        var districtByCity = data.result[0];
+        param.success(data, districtByCity);
+      } else if (feature == 'calculateDistance') {
+        var calculateDistanceResult = data.result.elements;  
+        var distance = [];
+        for (var i = 0; i < calculateDistanceResult.length; i++){
+          distance.push(calculateDistanceResult[i].distance);
+        }   
+        param.success(data, {
+          calculateDistanceResult: calculateDistanceResult,
+          distance: distance
+          });
+      } else if (feature == 'direction') {
+        var direction = data.result.routes;
+        param.success(data,direction);
+      } else {
+        param.success(data);
+      }
+    },
+
+    /**
+     * 构造微信请求参数,公共属性处理
+     * 
+     * @param {Object} param 接口参数
+     * @param {Object} param 配置项
+     * @param {String} feature 方法名
+     */
+    buildWxRequestConfig(param, options, feature) {
+        var that = this;
+        options.header = { "content-type": "application/json" };
+        options.method = 'GET';
+        options.success = function (res) {
+            var data = res.data;
+            if (data.status === 0) {
+              that.handleData(param, data, feature);
+            } else {
+                param.fail(data);
+            }
+        };
+        options.fail = function (res) {
+            res.statusCode = ERROR_CONF.WX_ERR_CODE;
+            param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
+        };
+        options.complete = function (res) {
+            var statusCode = +res.statusCode;
+            switch(statusCode) {
+                case ERROR_CONF.WX_ERR_CODE: {
+                    param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
+                    break;
+                }
+                case ERROR_CONF.WX_OK_CODE: {
+                    var data = res.data;
+                    if (data.status === 0) {
+                        param.complete(data);
+                    } else {
+                        param.complete(that.buildErrorConfig(data.status, data.message));
+                    }
+                    break;
+                }
+                default:{
+                    param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG));
+                }
+
+            }
+        };
+        return options;
+    },
+
+    /**
+     * 处理用户参数是否传入坐标进行不同的处理
+     */
+    locationProcess(param, locationsuccess, locationfail, locationcomplete) {
+        var that = this;
+        locationfail = locationfail || function (res) {
+            res.statusCode = ERROR_CONF.WX_ERR_CODE;
+            param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
+        };
+        locationcomplete = locationcomplete || function (res) {
+            if (res.statusCode == ERROR_CONF.WX_ERR_CODE) {
+                param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg));
+            }
+        };
+        if (!param.location) {
+            that.getWXLocation(locationsuccess, locationfail, locationcomplete);
+        } else if (that.checkLocation(param)) {
+            var location = Utils.getLocationParam(param.location);
+            locationsuccess(location);
+        }
+    }
+};
+
+
+class QQMapWX {
+
+    /**
+     * 构造函数
+     * 
+     * @param {Object} options 接口参数,key 为必选参数
+     */
+    constructor(options) {
+        if (!options.key) {
+            throw Error('key值不能为空');
+        }
+        this.key = options.key;
+    };
+
+    /**
+     * POI周边检索
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 参数对象结构可以参考
+     * @see http://lbs.qq.com/webservice_v1/guide-search.html
+     */
+    search(options) {
+        var that = this;
+        options = options || {};
+
+        Utils.polyfillParam(options);
+
+        if (!Utils.checkKeyword(options)) {
+            return;
+        }
+
+        var requestParam = {
+            keyword: options.keyword,
+            orderby: options.orderby || '_distance',
+            page_size: options.page_size || 10,
+            page_index: options.page_index || 1,
+            output: 'json',
+            key: that.key
+        };
+
+        if (options.address_format) {
+            requestParam.address_format = options.address_format;
+        }
+
+        if (options.filter) {
+            requestParam.filter = options.filter;
+        }
+
+        var distance = options.distance || "1000";
+        var auto_extend = options.auto_extend || 1;
+        var region = null;
+        var rectangle = null;
+
+        //判断城市限定参数
+        if (options.region) {
+          region = options.region;
+        }
+
+        //矩形限定坐标(暂时只支持字符串格式)
+        if (options.rectangle) {
+          rectangle = options.rectangle;
+        }
+
+        var locationsuccess = function (result) {        
+          if (region && !rectangle) {
+            //城市限定参数拼接
+            requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," + result.longitude + ")";
+            if (options.sig) {
+              requestParam.sig = Utils.getSig(requestParam, options.sig, 'search');
+            }
+          } else if (rectangle && !region) {
+            //矩形搜索
+            requestParam.boundary = "rectangle(" + rectangle + ")";
+            if (options.sig) {
+              requestParam.sig = Utils.getSig(requestParam, options.sig, 'search');
+            }
+            } else {
+              requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")";
+            if (options.sig) {
+              requestParam.sig = Utils.getSig(requestParam, options.sig, 'search');
+            }
+            }            
+            wx.request(Utils.buildWxRequestConfig(options, {
+                url: URL_SEARCH,
+                data: requestParam
+            }, 'search'));
+        };
+        Utils.locationProcess(options, locationsuccess);
+    };
+
+    /**
+     * sug模糊检索
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 参数对象结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-suggestion.html
+     */
+    getSuggestion(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+
+        if (!Utils.checkKeyword(options)) {
+            return;
+        }
+
+        var requestParam = {
+            keyword: options.keyword,
+            region: options.region || '全国',
+            region_fix: options.region_fix || 0,
+            policy: options.policy || 0,
+            page_size: options.page_size || 10,//控制显示条数
+            page_index: options.page_index || 1,//控制页数
+            get_subpois : options.get_subpois || 0,//返回子地点
+            output: 'json',
+            key: that.key
+        };
+        //长地址
+        if (options.address_format) {
+          requestParam.address_format = options.address_format;
+        }
+        //过滤
+        if (options.filter) {
+          requestParam.filter = options.filter;
+        }
+        //排序
+        if (options.location) {
+          var locationsuccess = function (result) {
+            requestParam.location = result.latitude + ',' + result.longitude;
+            if (options.sig) {
+              requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest');
+            }
+            wx.request(Utils.buildWxRequestConfig(options, {
+              url: URL_SUGGESTION,
+              data: requestParam
+            }, "suggest"));      
+          };
+          Utils.locationProcess(options, locationsuccess);
+        } else {
+          if (options.sig) {
+            requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest');
+          }
+          wx.request(Utils.buildWxRequestConfig(options, {
+            url: URL_SUGGESTION,
+            data: requestParam
+          }, "suggest"));      
+        }        
+    };
+
+    /**
+     * 逆地址解析
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-gcoder.html
+     */
+    reverseGeocoder(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+        var requestParam = {
+            coord_type: options.coord_type || 5,
+            get_poi: options.get_poi || 0,
+            output: 'json',
+            key: that.key
+        };
+        if (options.poi_options) {
+            requestParam.poi_options = options.poi_options
+        }
+
+        var locationsuccess = function (result) {
+            requestParam.location = result.latitude + ',' + result.longitude;
+          if (options.sig) {
+            requestParam.sig = Utils.getSig(requestParam, options.sig, 'reverseGeocoder');
+          }
+            wx.request(Utils.buildWxRequestConfig(options, {
+                url: URL_GET_GEOCODER,
+                data: requestParam
+            }, 'reverseGeocoder'));
+        };
+        Utils.locationProcess(options, locationsuccess);
+    };
+
+    /**
+     * 地址解析
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-geocoder.html
+     */
+    geocoder(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+
+        if (Utils.checkParamKeyEmpty(options, 'address')) {
+            return;
+        }
+
+        var requestParam = {
+            address: options.address,
+            output: 'json',
+            key: that.key
+        };
+
+        //城市限定
+        if (options.region) {
+          requestParam.region = options.region;
+        }
+
+        if (options.sig) {
+          requestParam.sig = Utils.getSig(requestParam, options.sig, 'geocoder');
+        }
+
+        wx.request(Utils.buildWxRequestConfig(options, {
+            url: URL_GET_GEOCODER,
+            data: requestParam
+        },'geocoder'));
+    };
+
+
+    /**
+     * 获取城市列表
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-region.html
+     */
+    getCityList(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+        var requestParam = {
+            output: 'json',
+            key: that.key
+        };
+
+        if (options.sig) {
+          requestParam.sig = Utils.getSig(requestParam, options.sig, 'getCityList');
+        }
+
+        wx.request(Utils.buildWxRequestConfig(options, {
+            url: URL_CITY_LIST,
+            data: requestParam
+        },'getCityList'));
+    };
+
+    /**
+     * 获取对应城市ID的区县列表
+     *
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-region.html
+     */
+    getDistrictByCityId(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+
+        if (Utils.checkParamKeyEmpty(options, 'id')) {
+            return;
+        }
+
+        var requestParam = {
+            id: options.id || '',
+            output: 'json',
+            key: that.key
+        };
+
+        if (options.sig) {
+          requestParam.sig = Utils.getSig(requestParam, options.sig, 'getDistrictByCityId');
+        }
+
+        wx.request(Utils.buildWxRequestConfig(options, {
+            url: URL_AREA_LIST,
+            data: requestParam
+        },'getDistrictByCityId'));
+    };
+
+    /**
+     * 用于单起点到多终点的路线距离(非直线距离)计算:
+     * 支持两种距离计算方式:步行和驾车。
+     * 起点到终点最大限制直线距离10公里。
+     *
+     * 新增直线距离计算。
+     * 
+     * @param {Object} options 接口参数对象
+     * 
+     * 请求参数结构可以参考
+     * http://lbs.qq.com/webservice_v1/guide-distance.html
+     */
+    calculateDistance(options) {
+        var that = this;
+        options = options || {};
+        Utils.polyfillParam(options);
+
+        if (Utils.checkParamKeyEmpty(options, 'to')) {
+            return;
+        }
+
+        var requestParam = {
+            mode: options.mode || 'walking',
+            to: Utils.location2query(options.to),
+            output: 'json',
+            key: that.key
+        };
+
+        if (options.from) {
+          options.location = options.from;
+        }
+
+        //计算直线距离
+        if(requestParam.mode == 'straight'){        
+          var locationsuccess = function (result) {
+            var locationTo = Utils.getEndLocation(requestParam.to);//处理终点坐标
+            var data = {
+              message:"query ok",
+              result:{
+                elements:[]
+              },
+              status:0
+            };
+            for (var i = 0; i < locationTo.length; i++) {
+              data.result.elements.push({//将坐标存入
+                distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i].lat, locationTo[i].lng),
+                duration:0,
+                from:{
+                  lat: result.latitude,
+                  lng:result.longitude
+                },
+                to:{
+                  lat: locationTo[i].lat,
+                  lng: locationTo[i].lng
+                }
+              });            
+            }
+            var calculateResult = data.result.elements;
+            var distanceResult = [];
+            for (var i = 0; i < calculateResult.length; i++) {
+              distanceResult.push(calculateResult[i].distance);
+            }  
+            return options.success(data,{
+              calculateResult: calculateResult,
+              distanceResult: distanceResult
+            });
+          };
+          
+          Utils.locationProcess(options, locationsuccess);
+        } else {
+          var locationsuccess = function (result) {
+            requestParam.from = result.latitude + ',' + result.longitude;
+            if (options.sig) {
+              requestParam.sig = Utils.getSig(requestParam, options.sig, 'calculateDistance');
+            }
+            wx.request(Utils.buildWxRequestConfig(options, {
+              url: URL_DISTANCE,
+              data: requestParam
+            },'calculateDistance'));
+          };
+
+          Utils.locationProcess(options, locationsuccess);
+        }      
+    };
+
+  /**
+   * 路线规划:
+   * 
+   * @param {Object} options 接口参数对象
+   * 
+   * 请求参数结构可以参考
+   * https://lbs.qq.com/webservice_v1/guide-road.html
+   */
+  direction(options) {
+    var that = this;
+    options = options || {};
+    Utils.polyfillParam(options);
+
+    if (Utils.checkParamKeyEmpty(options, 'to')) {
+      return;
+    }
+
+    var requestParam = {
+      output: 'json',
+      key: that.key
+    };
+
+    //to格式处理
+    if (typeof options.to == 'string') {
+      requestParam.to = options.to;
+    } else {
+      requestParam.to = options.to.latitude + ',' + options.to.longitude;
+    }
+    //初始化局部请求域名
+    var SET_URL_DIRECTION = null;
+    //设置默认mode属性
+    options.mode = options.mode || MODE.driving;
+
+    //设置请求域名
+    SET_URL_DIRECTION = URL_DIRECTION + options.mode;
+
+    if (options.from) {
+      options.location = options.from;
+    }
+
+    if (options.mode == MODE.driving) {
+      if (options.from_poi) {
+        requestParam.from_poi = options.from_poi;
+      }
+      if (options.heading) {
+        requestParam.heading = options.heading;
+      }
+      if (options.speed) {
+        requestParam.speed = options.speed;
+      }
+      if (options.accuracy) {
+        requestParam.accuracy = options.accuracy;
+      }
+      if (options.road_type) {
+        requestParam.road_type = options.road_type;
+      }
+      if (options.to_poi) {
+        requestParam.to_poi = options.to_poi;
+      }
+      if (options.from_track) {
+        requestParam.from_track = options.from_track;
+      }
+      if (options.waypoints) {
+        requestParam.waypoints = options.waypoints;
+      }
+      if (options.policy) {
+        requestParam.policy = options.policy;
+      }
+      if (options.plate_number) {
+        requestParam.plate_number = options.plate_number;
+      }
+    }
+
+    if (options.mode == MODE.transit) {
+      if (options.departure_time) {
+        requestParam.departure_time = options.departure_time;
+      }
+      if (options.policy) {
+        requestParam.policy = options.policy;
+      }
+    } 
+
+    var locationsuccess = function (result) {
+      requestParam.from = result.latitude + ',' + result.longitude;
+      if (options.sig) {
+        requestParam.sig = Utils.getSig(requestParam, options.sig, 'direction',options.mode);
+      }
+      wx.request(Utils.buildWxRequestConfig(options, {
+        url: SET_URL_DIRECTION,
+        data: requestParam
+      }, 'direction'));
+    };
+
+    Utils.locationProcess(options, locationsuccess);
+  }
+};
+
+module.exports = QQMapWX;

File diff ditekan karena terlalu besar
+ 0 - 0
src/libs/qqmap-wx-jssdk.min.js


+ 36 - 33
src/pages/index/attestation/index.vue

@@ -63,7 +63,7 @@ const formData = ref({
 	idCardFrontImg: '',
 	idCardBackImg: '',
 	realNameImg: '',
-	realNameStatus: 1,//0未实名,1实名
+	realNameStatus: null,//0未实名,1实名
 })
 
 const frontImg = ref('')
@@ -94,48 +94,51 @@ const handleChange = (e) => {
 }
 
 const submit = () => {
-	startVerification()
-	return
 	if (!formData.value.idCardFrontImg) return TipsUtils.tips_toast('请上传人像面');
 	if (!formData.value.idCardBackImg) return TipsUtils.tips_toast('请上传国徽面');
 	if (!formData.value.fullName) return TipsUtils.tips_toast('请输入姓名');
 	if (!ValidateUtils.validateIdCard(formData.value.identityCard)) return TipsUtils.tips_toast('身份证号码格式不正确');
 	if (!ValidateUtils.validatePhone(formData.value.phone)) return TipsUtils.tips_toast('手机号格式不正确');
 	if (!formData.value.realNameImg) return TipsUtils.tips_toast('请上传本人近期高清、无遮挡照片');
-	http.post('/my/familyMembers/addFamilyMembers', { ...formData.value }, { loading: true }).then((res) => {
-		TipsUtils.tips_toast(res.message)
-		formData.value.fullName = ''
-		formData.value.identityCard = ''
-		formData.value.phone = ''
-		formData.value.idCardFrontImg = ''
-		formData.value.idCardBackImg = ''
-		formData.value.realNameImg = ''
-		frontImg.value = ''
-		flipSideImg.value = ''
-	})
+	getFaceRecognition()
 }
 
 // 开始身份验证
 const verifyToken = ref('')
-const startVerification = () => {
-	console.log('开始身份验证');
-	startEid({
-		data: {
-			token: verifyToken.value,
-			needJumpPage: true
-		},
-		verifyDoneCallback(res) {
-			console.log('收到核身完成的res:', res);
-			const { token, verifyDone } = res;
-			console.log('收到核身完成的res:', res);
-			console.log('核身的token是:', token);
-			console.log('是否完成核身:', verifyDone);
-			if (verifyDone) {
-				formData.value.realNameStatus = 1;
-				verifyToken.value = token;
-			}
-		},
-	});
+const getFaceRecognition = () => {
+	http.get('/user/faceRecognition', { data: { idCard: formData.value.identityCard, name: formData.value.fullName } }).then(res => {
+		verifyToken.value = JSON.parse(res.result).EidToken
+		startEid({
+			data: {
+				token: verifyToken.value,
+				needJumpPage: true
+			},
+			verifyDoneCallback(res) {
+				const { token, verifyDone } = res;
+				console.log('收到核身完成的res:', res);
+				console.log('核身的token是:', token);
+				console.log('是否完成核身:', verifyDone);
+				if (verifyDone) {
+					formData.value.realNameStatus = 1;
+					verifyToken.value = token;
+					http.post('/my/familyMembers/addFamilyMembers', { ...formData.value }, { loading: true }).then((res) => {
+						TipsUtils.tips_toast(res.message)
+						formData.value.fullName = ''
+						formData.value.identityCard = ''
+						formData.value.phone = ''
+						formData.value.idCardFrontImg = ''
+						formData.value.idCardBackImg = ''
+						formData.value.realNameImg = ''
+						frontImg.value = ''
+						flipSideImg.value = ''
+						uni.navigateBack()
+					})
+				}else{
+					TipsUtils.tips_toast('人脸核身失败')
+				}
+			},
+		});
+	})
 }
 </script>
 

+ 13 - 1
src/pages/index/courseDetail/index.vue

@@ -31,7 +31,7 @@
 		</view>
 		<view class="c-detail-info">
 			<view class="c-time">课时:{{ courseDetailInfo.startTime }}-{{ courseDetailInfo.endTime }}</view>
-			<view class="c-address">
+			<view class="c-address" @click="openMap">
 				<view class="">上课地点:{{ courseDetailInfo.address }} | {{ courseDetailInfo.km.toFixed(2) }} km</view>
 				<zzx-icon name="ashRight" size="10"></zzx-icon>
 			</view>
@@ -185,6 +185,18 @@ onMounted(() => {
 	getFindByOrderPage()
 })
 
+const openMap=()=>{
+	uni.openLocation({
+		latitude: courseDetailInfo.value.latitude,
+		longitude: courseDetailInfo.value.longitude,
+		name: courseDetailInfo.value.name,
+		address:courseDetailInfo.value.address,
+		success: function () {
+			console.log('success');
+		}
+	});
+}
+
 // 获取所有模块的位置信息
 const getSectionsTop = () => {
 	const ids = ['detail', 'notice', 'schedule', 'appraise'];

+ 1 - 1
src/pages/index/detail/components/venue.vue

@@ -3,7 +3,7 @@
 		<image :src="item.cover" mode=""></image>
 		<view class="venue-info">
 			<view class="info-title">
-				<view class="title textHidden">{{ item.name }}</view>
+				<view class="title textHidden">学校场地预约</view>
 				<view class="sales">年售{{ item.sales }}</view>
 			</view>
 			<view class="type">

+ 2 - 2
src/pages/index/detail/index.vue

@@ -27,7 +27,7 @@
 			</view>
 			<view class="star">
 				<zzx-icon name="star" size="12"></zzx-icon>
-				<text>{{ detailInfo.goodRate }}</text>
+				<text>{{ detailInfo.goodRate||0 }}</text>
 			</view>
 		</view>
 		<view class="open-time">
@@ -75,7 +75,7 @@
 		</uv-sticky>
 		<view class="toggle" v-if="sel_index === 0">
 			<venue :listData="detailInfo.placeInfoMsgVO" />
-			<zs-empty v-if="detailInfo.placeInfoMsgVO.length < 1"></zs-empty>
+			<zs-empty v-if="detailInfo.placeInfoMsgVO?.length < 1"></zs-empty>
 		</view>
 		<view class="toggle" v-else-if="sel_index === 1">
 			<course :selectList="allCategoryList" :listData="courseList" :laoding="courseLoading" @change="onchange" />

+ 1 - 1
src/pages/index/events/index.vue

@@ -23,7 +23,7 @@
 					<view class="e-time">
 						<zzx-icon name="clock" size="12"></zzx-icon>
 						<text>{{ DateUtils.formatDateToMMDD(item.startTime)
-						}}-{{ DateUtils.formatDateToMMDD(item.endTime) }}</text>
+						}}{{ DateUtils.formatDateToMMDD(item.endTime) }}</text>
 					</view>
 				</view>
 			</view>

+ 3 - 9
src/pages/index/eventsDetail/index.vue

@@ -140,7 +140,7 @@
 		<view class="d-explain" id="notice">
 			<view class="explain-title">图文说明</view>
 			<view class="d-explain-card">
-				<rich-text class="rich-text" :nodes="eventsInfoObj.reminder" />
+				<rich-text class="rich-text" :nodes="fixImgStyle(eventsInfoObj.reminder)" />
 			</view>
 		</view>
 	</view>
@@ -156,15 +156,11 @@ import { ref, onMounted, computed, onUnmounted, getCurrentInstance, nextTick } f
 import { http } from '@/utils/http';
 import { useCacheStore } from '@/stores/cache';
 import zzxNavbar from '@/components/zzx-navbar/zzx-navbar.vue';
-import { RouterUtils, TipsUtils } from '@/utils/util';
+import { RouterUtils, TipsUtils,fixImgStyle } from '@/utils/util';
 import { onLoad, onPageScroll } from '@dcloudio/uni-app';
 const statusBarHeight = ref(0);
 const cache = useCacheStore()
-const messages = ref([
-	'张**报名了',
-	'李**报名了',
-	'王**报名了'
-]);
+const messages = ref([]);
 const sectionTops = ref<number[]>([]);
 const isScrollingByTab = ref(false);
 const scrollTimer = ref<any>(null);
@@ -359,8 +355,6 @@ const get_location = () => {
 				type: 'gcj02',
 				success: function (res) {
 					uni.hideLoading()
-					// cache.set('LON', res.longitude)
-					// cache.set('LAT', res.latitude)
 				},
 				fail: function (err) {
 					if (err.errMsg === 'getFuzzyLocation:fail system permission denied') {

+ 14 - 15
src/pages/index/gymDetail/components/popup.vue

@@ -1,5 +1,5 @@
 <template>
-	<uni-popup ref="selectPopup" :safe-area="false" type="bottom"  :animation="false">
+	<uni-popup ref="selectPopup" :safe-area="false" type="bottom">
 		<view class="header-text">开场前{{ listData.earlyRefundTime || '--' }}分钟随时退</view>
 		<view class="select-popup">
 			<view class="pop-title">选择场次</view>
@@ -17,7 +17,7 @@
 				<view class="time-list">
 					<view class="time-title">时间段</view>
 					<block
-						v-for="(concert, index) in listData.stadiumConcertsVOList[0].concertsVOList[0].concertsDetailsVOList"
+						v-for="(concert, index) in listData?.stadiumConcertsVOList?.[0]?.concertsVOList?.[0]?.concertsDetailsVOList || []"
 						:key="index">
 						<view class="item-time">{{ concert.startTime }}-{{ concert.endTime }}</view>
 					</block>
@@ -86,7 +86,7 @@
 					<view class="p-price">
 						<view class="text">商品总价(共{{ previewgymOrderDetail.timePeriod.length }}场)</view>
 						<view class="price"><text class="mini-text">¥</text>{{ previewgymOrderDetail.subtotal.toFixed(2)
-							}}</view>
+						}}</view>
 					</view>
 					<view class="p-subtotal">
 						<text>小计</text>
@@ -131,7 +131,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, onMounted, computed, watch,getCurrentInstance } from 'vue';
+import { ref, onMounted, computed, watch,nextTick } from 'vue';
 import { http } from '@/utils/http'
 import { TipsUtils, phoneHide, RouterUtils } from '@/utils/util';
 interface Props {
@@ -148,11 +148,11 @@ const props = withDefaults(defineProps<Props>(), {
 });
 const selectPopup = ref();
 const orderPopup = ref();
-const that=getCurrentInstance()
+const weekDayDate = ref('');
 onMounted(() => {
-})
-const emit = defineEmits(['change']);
 
+})
+const emit = defineEmits(['changess']);
 // 监听 props.deteObj 或 listData 变化,设置 weekDayDate 为匹配项的 weekDayDate
 
 watch(
@@ -164,7 +164,7 @@ watch(
 			typeof deteSelIndex === 'number' &&
 			listData.stadiumConcertsVOList[deteSelIndex]
 		) {
-			weekDayDate.value = listData.stadiumConcertsVOList[deteSelIndex].weekDayDate;
+			weekDayDate.value = listData.stadiumConcertsVOList[deteSelIndex||0].weekDayDate;
 		} else if (deteObj && deteObj.dateLabel && listData && Array.isArray(listData.stadiumConcertsVOList)) {
 			const match = listData.stadiumConcertsVOList.find(item => item.weekDayAndDate === deteObj.dateLabel);
 			weekDayDate.value = match ? match.weekDayDate : '';
@@ -177,9 +177,6 @@ watch(
 
 const opens = () => {
 	// 打开弹窗时赋值默认日期,优先根据deteSelIndex
-	// that.refs.selectPopup?.open();
-	// console.log(getCurrentInstance(),'that.$refs');
-	selectPopup.value?.open('top');
 	if (
 		props.listData &&
 		Array.isArray(props.listData.stadiumConcertsVOList) &&
@@ -191,13 +188,15 @@ const opens = () => {
 		const match = props.listData.stadiumConcertsVOList.find(item => item.weekDayAndDate === props.deteObj.dateLabel);
 		weekDayDate.value = match ? match.weekDayDate : '';
 	} else {
-		weekDayDate.value = '';
+		weekDayDate.value = null;
 	}
+	nextTick(() => {
+		selectPopup.value?.open();
+	});
 }
-defineExpose({opens})
-const weekDayDate = ref();
+defineExpose({ opens })
 const sel_tab = (e, i) => {
-	emit('change', e, i);
+	emit('changes', e, i);
 	weekDayDate.value = e.weekDayDate
 }
 

+ 22 - 17
src/pages/index/gymDetail/index.vue

@@ -25,7 +25,7 @@
 			</view>
 			<view class="star">
 				<zzx-icon name="star" size="12"></zzx-icon>
-				<text>{{ detailInfo.goodRate }}</text>
+				<text>{{ detailInfo.goodRate||'0.0'}}</text>
 			</view>
 		</view>
 		<view class="open-time" v-if="teachingDay">
@@ -62,7 +62,7 @@
 			</view>
 		</view>
 	</view>
-	<view class="content"  v-if="charteredList">
+	<view class="content" v-if="charteredList">
 		<uv-sticky offset-top="74">
 			<view class="detail-select">
 				<view :class="sel_index === index ? 'select-text' : 'notsel-text'" v-for="(item, index) in selectList"
@@ -98,9 +98,9 @@
 								:key="item.id" @click="open_popup(item, index)">
 								<view class="today">{{ item.dateLabel }}</view>
 								<view class="time">最早{{ item.startTime }}可订</view>
-								<view class="price">¥{{ item.sellingPrice.toFixed(2) }}起</view>
+								<view class="price" v-if="item.sellingPrice">¥{{ item.sellingPrice.toFixed(2) }}起</view>
 							</view>
-							<view class="not-data" v-if="charteredList.timeSlot.length < 1">暂无可选时间</view>
+							<view class="not-data" v-if="charteredList.timeSlot?.length < 1">暂无可选时间</view>
 						</scroll-view>
 					</view>
 				</view>
@@ -122,8 +122,8 @@
 						</view> -->
 						<view class="price-info">
 							<view class="price">
-								<view class="">¥{{ item.sellingPrice.toFixed(2) }}</view>
-								<view class="">¥{{ item.originalPrice.toFixed(2) }}</view>
+								<view class="" v-if="item.sellingPrice">¥{{ item.sellingPrice.toFixed(2) }}</view>
+								<view class="" v-if="item.originalPrice">¥{{ item.originalPrice.toFixed(2) }}</view>
 							</view>
 							<view class="price-btn"
 								@click="RouterUtils.to_page(`/pages/index/gymPay/index?type=1&placeId=${item.id}`)">抢购
@@ -145,7 +145,7 @@
 						</view> -->
 					</view>
 				</view>
-				<view class="not-data" v-if="detailInfo.placeInfoMsgVO.length < 1">暂无场地数据</view>
+				<view class="not-data" v-if="detailInfo.placeInfoMsgVO?.length < 1">暂无场地数据</view>
 			</view>
 		</view>
 		<view class="course-card" id="notice">
@@ -188,12 +188,12 @@
 				</view>
 			</block>
 			<loading v-else />
-			<view class="not-data" v-if="courseList.length < 1 && !courseLoading">暂无数据</view>
+			<view class="not-data" v-if="courseList?.length < 1 && !courseLoading">暂无数据</view>
 			<!-- <view class="more">查看更多</view> -->
 		</view>
 		<view class="instructor-card" id="schedule">
 			<view class="card-title" @click="RouterUtils.to_page('/pages/index/allInstructor/index')">
-				<view class="">教练({{ detailInfo.instructorVOList.length }})</view>
+				<view class="">教练({{ detailInfo.instructorVOList?.length }})</view>
 				<zzx-icon name="right" size="12"></zzx-icon>
 			</view>
 			<scroll-view class="header-swiper content" scroll-x="true" :show-scrollbar="false">
@@ -245,8 +245,8 @@
 		</view>
 	</view>
 	<view style="position: relative;z-index: 99999;">
-		<selPopup :listData="placedata" :itemList="selItems" :deteObj="dateIndex" :deteSelIndex="selIndex"
-			@change="onchange" ref="openPopup" />
+		<selPopup ref="openPopup" :listData="placedata" :itemList="selItems" :deteObj="dateIndex"
+			:deteSelIndex="selIndex" @changes="onchange" />
 		<uni-popup ref="placeInfoPopup" :safe-area="false" type="bottom">
 			<view class="buyTips-box">
 				<view class="buyTips-title">购买须知</view>
@@ -299,6 +299,7 @@ onMounted(() => {
 	get_placeInfo()
 	get_allCategory()
 	getFindByOrderPage()
+	console.log('组件已挂载:', openPopup.value)
 })
 const get_navheight = () => {
 	const systemInfo = uni.getSystemInfoSync();
@@ -309,14 +310,13 @@ const get_navheight = () => {
 const dateIndex = ref()
 const selIndex = ref()
 const openPopup = ref(null);
-const open_popup = (e, i) => {
+const open_popup = async (e, i) => {
 	selIndex.value = i
 	dateIndex.value = e
 	get_placeInfoDetail(categoryId.value, i)
-	// console.log(openPopup.value, 'openPopup');
+	await nextTick()
 	openPopup.value?.opens()
-	console.log(openPopup.value,'openPopup');
-	
+	console.log(openPopup.value, 'openPopup');
 }
 
 // 获取所有模块的位置信息
@@ -327,8 +327,10 @@ const getSectionsTop = () => {
 		query.select(`#${id}`).boundingClientRect();
 	});
 	query.exec((rects) => {
-		// 计算各模块相对于页面顶部的距离
-		sectionTops.value = rects.map((rect: any) => rect.top - 130);
+		// 添加空值检查
+		sectionTops.value = rects
+			.filter((rect: any) => rect !== null)
+			.map((rect: any) => rect.top - 130);
 	})
 };
 //滚动事件
@@ -345,6 +347,9 @@ const updateActiveTab = (scrollTop: number) => {
 	const offset = 130;
 	const scrollPosition = scrollTop + offset;
 	let activeIndex = 0;
+	if (!sectionTops.value || !Array.isArray(sectionTops.value)) {
+		return
+	}
 	for (let i = 0; i < sectionTops.value.length; i++) {
 		if (scrollPosition >= sectionTops.value[i]) {
 			activeIndex = i;

+ 13 - 13
src/pages/index/gymPay/index.vue

@@ -7,7 +7,7 @@
 				<view class="shoping-info">
 					<view class="name">{{ previewCourseInfo.placeName||previewCourseInfo.name }}</view>
 					<view class="price-info">
-						<view class="price"><text class="mini-text">¥</text>{{ previewCourseInfo.sellingPrice.toFixed(2) }}</view>
+						<view class="price"><text class="mini-text">¥</text>{{ previewCourseInfo?.sellingPrice.toFixed(2) }}</view>
 						<view class="price-stepper">
 							<view class="minus" @click="minusNum">-</view>
 							<input v-model="countTotal" disabled type="number" />
@@ -19,7 +19,7 @@
 			<view class="g-shoping-total">
 				<view class="total-price">
 					<view class="">商品总价(共1件)</view>
-					<view class="">¥{{ previewCourseInfo.sellingPrice.toFixed(2) }}</view>
+					<view class="">¥{{ previewCourseInfo?.sellingPrice.toFixed(2) }}</view>
 				</view>
 				<view class="total-price">
 					<view class="">
@@ -27,12 +27,12 @@
 						<text v-if="buyType == 0 || placeId">团购优惠</text>
 					</view>
 					<view class="">-¥
-						<text v-if="buyType == 0 || !placeId">{{ previewCourseInfo.discountPrice }}</text>
-						<text v-else>{{ (previewCourseInfo.originalPrice - previewCourseInfo.sellingPrice).toFixed(2) }}</text>
+						<text v-if="buyType == 0 || !placeId">{{ previewCourseInfo?.discountPrice }}</text>
+						<text v-else>{{ (previewCourseInfo?.originalPrice - previewCourseInfo?.sellingPrice).toFixed(2) }}</text>
 					</view>
 				</view>
 			</view>
-			<view class="subtotal">小计 ¥{{totalPriceDisplay }}</view>
+			<view class="subtotal">小计 ¥{{previewCourseInfo?.discountPrice?totalPriceDisplay-previewCourseInfo?.discountPrice:totalPriceDisplay }}</view>
 		</view>
 		<!-- 课程进入 -->
 		<view class="r-insurance" v-for="item in insureIdList" :key="item.id">
@@ -115,10 +115,10 @@
 			<view class="use-title">{{ placeId ? '使用须知' : '购买须知' }}</view>
 			<view class="use-text">
 				<view class="item-text">
-					<rich-text :nodes="previewCourseInfo.reminder"></rich-text>
+					<rich-text :nodes="previewCourseInfo?.reminder"></rich-text>
 				</view>
 			</view>
-			<view class="use-tips-more" @click="RouterUtils.to_page('/pages/index/useNotice/index')">
+			<view class="use-tips-more" @click="RouterUtils.to_page(`/pages/index/useNotice/index?reminder=${previewCourseInfo?.reminder}`)">
 				<view class="more-text">查看更多</view>
 				<view class="use-line"></view>
 			</view>
@@ -127,27 +127,27 @@
 			<view class="use-title">服务保障</view>
 			<view class="use-text">
 				<view class="item-text">
-					{{ previewCourseInfo.refundType == 1 ? '未消费随时退款,过期未消费自动退款。' : '不支退款,请慎重考虑后购买。' }}
+					{{ previewCourseInfo?.refundType == 1 ? '未消费随时退款,过期未消费自动退款。' : '不支退款,请慎重考虑后购买。' }}
 				</view>
 			</view>
-			<view class="use-tips-more" @click="RouterUtils.to_page('/pages/index/useNotice/index')">
+			<!-- <view class="use-tips-more">
 				<view class="more-text">查看更多</view>
 				<view class="use-line"></view>
-			</view>
+			</view> -->
 		</view>
 		<view style="height: 166rpx;"></view>
 		<view class="footer footer-box">
 			<view class="footer-price">
 				<view class="total-price">合计:</view>
 				<view class="price"><text class="mini-text">¥</text>
-					<text>{{ totalPriceDisplay }}</text>
+					<text>{{ previewCourseInfo?.discountPrice?totalPriceDisplay-previewCourseInfo?.discountPrice:totalPriceDisplay }}</text>
 				</view>
-				<view class="discount">优惠¥{{ previewCourseInfo.totalDiscount }}</view>
+				<view class="discount">优惠¥{{ previewCourseInfo?.totalDiscount }}</view>
 			</view>
 			<view class="footer-btn" @click="submitOrder">
 				<button>
 					<view class="btn-price">
-						<text> ¥{{ totalPriceDisplay }}</text>
+						<text> ¥{{ previewCourseInfo?.discountPrice?totalPriceDisplay-previewCourseInfo?.discountPrice:totalPriceDisplay  }}</text>
 					</view>
 					<view class="btn-price">立即支付</view>
 				</button>

+ 649 - 620
src/pages/index/index.vue

@@ -1,18 +1,18 @@
 <template>
 	<view class="nav-title"
-		:style="{height:navBarHeight+'px',opacity: navOpacity,transition: 'opacity 0.3s ease-in-out',background: backgroundColor }">
-		<view class="back-icon" :style="{paddingTop:statusBarHeight+'px'}" @click="openSellocation">
+		:style="{ height: navBarHeight + 'px', opacity: navOpacity, transition: 'opacity 0.3s ease-in-out', background: backgroundColor }">
+		<view class="back-icon" :style="{ paddingTop: statusBarHeight + 'px' }" @click="openSellocation">
 			<zzx-icon name="location" size="13"></zzx-icon>
-			<view class="location-text textHidden">{{addressName}}</view>
+			<view class="location-text textHidden">{{ addressName }}</view>
 			<zzx-icon name="right" size="10"></zzx-icon>
 		</view>
 	</view>
 	<view class="index-header">
 		<image class="header-bg" src="@/static/index_bg.png" mode="widthFix"></image>
-		<view class="back-icon" :style="{paddingTop:(statusBarHeight+10)+'px'}" v-if="navOpacity==0"
+		<view class="back-icon" :style="{ paddingTop: (statusBarHeight + 10) + 'px' }" v-if="navOpacity == 0"
 			@click="openSellocation">
 			<zzx-icon name="location" size="13"></zzx-icon>
-			<view class="location-text textHidden">{{addressName}}</view>
+			<view class="location-text textHidden">{{ addressName }}</view>
 			<zzx-icon name="right" size="10"></zzx-icon>
 		</view>
 		<view class="content" style="padding-top:180rpx;">
@@ -20,8 +20,8 @@
 				<zzx-icon name="search" size="18"></zzx-icon>
 				<swiper class="i-search-swiper" :vertical="true" :circular="true" :autoplay="true" :interval="5000"
 					:duration="1000" @click="gotoPage('/pages/index/search/index')" @change="transitionChange">
-					<swiper-item v-for="(item,index) in searchList" :key="item.id">
-						<view class="">{{item.searchContent}}</view>
+					<swiper-item v-for="(item, index) in searchList" :key="item.id">
+						<view class="">{{ item.searchContent }}</view>
 					</swiper-item>
 				</swiper>
 				<!-- <input type="text" placeholder="搜索俱乐部名称" /> -->
@@ -35,21 +35,22 @@
 				<zs-loading></zs-loading>
 			</view>
 			<swiper class="header-swiper" :autoplay="true" :current="currentIndex" :circular="true"
-				previous-margin="80rpx" next-margin="80rpx" :interval="4000" :duration="500" @change="swierChange">
-				<swiper-item v-for="(item,i) in bannerList" :key="i">
-					<image :src="item.imageUrl" class="slide-image" :class="currentIndex === i?'active':''"></image>
+				previous-margin="80rpx" next-margin="80rpx" :interval="4000" :duration="500" @change="swierChange"
+				v-else>
+				<swiper-item v-for="(item, i) in bannerList" :key="i">
+					<image :src="item.imageUrl" class="slide-image" :class="currentIndex === i ? 'active' : ''"></image>
 				</swiper-item>
 			</swiper>
 		</view>
 	</view>
 	<view class="content">
-		<view class="announcement" @click="gotoPage('/pages/index/messageNotice/index')" v-if="indexMsg.length>0">
+		<view class="announcement" @click="gotoPage('/pages/index/messageNotice/index')" v-if="indexMsg.length > 0">
 			<image src="/src/static/gg-icon.png" mode="heightFix"></image>
 			<view class="">
 				<swiper class="announcement-swiper" :vertical="true" :circular="true" :autoplay="true" :interval="3000"
 					:duration="1000">
-					<swiper-item v-for="(item,index) in indexMsg" :key="item.id">
-						<view class="swiper-item textHidden">{{item.titile}}</view>
+					<swiper-item v-for="(item, index) in indexMsg" :key="item.id">
+						<view class="swiper-item textHidden">{{ item.titile }}</view>
 					</swiper-item>
 				</swiper>
 			</view>
@@ -103,7 +104,7 @@
 				<view class="audition-detail">
 					<view class="detail-list" v-for="item in stCourseList" :key="item.id">
 						<image :src="item.cover"></image>
-						<view class="detail-text">¥{{item.sellingPrice||'0'}}</view>
+						<view class="detail-text">¥{{ item.sellingPrice || '0' }}</view>
 					</view>
 				</view>
 			</view>
@@ -123,10 +124,10 @@
 			</view>
 			<view class="i-info-card">
 				<view class="i-card-list"
-					:style="{background:index % 2=== 0?'linear-gradient(179deg, #FFD5FB 0%, #FFFFFF 40%)':'linear-gradient( 179deg, #F2FFBE 0%, #FFFFFF 40%)'}"
-					v-for="(item,index) in instructorList" :key="item.id">
+					:style="{ background: index % 2 === 0 ? 'linear-gradient(179deg, #FFD5FB 0%, #FFFFFF 40%)' : 'linear-gradient( 179deg, #F2FFBE 0%, #FFFFFF 40%)' }"
+					v-for="(item, index) in instructorList" :key="item.id">
 					<view class="i-info" @click="gotoPage(`/pages/index/instructorDetail/index?id=${item.id}`)">
-						<view class="header" :style="{background:index % 2=== 0?'#FFB8F9':'#C8FF0C'}">
+						<view class="header" :style="{ background: index % 2 === 0 ? '#FFB8F9' : '#C8FF0C' }">
 							<image class="head-img" :src="item.avatar" mode=""></image>
 							<image class="head-tag" src="/src/static/badge.png" mode=""></image>
 						</view>
@@ -134,15 +135,15 @@
 							<view class="name-tag">
 								<view class="name">
 									<view>
-										<text class="textHidden" style="width: 130rpx;">{{item.name}}</text>
+										<text class="textHidden" style="width: 130rpx;">{{ item.name }}</text>
 									</view>
-									<image v-if="index % 2=== 0" src="/src/static/name_bg.png" mode=""></image>
+									<image v-if="index % 2 === 0" src="/src/static/name_bg.png" mode=""></image>
 									<image v-else src="/src/static/name_bg1.png" mode=""></image>
 								</view>
-								<view class="tag" v-for="(tag,index) in item.list">{{tag}}</view>
+								<view class="tag" v-for="(tag, index) in item.list">{{ tag }}</view>
 							</view>
-							<view class="ascription textHidden">{{item.orgName}}</view>
-							<view class="sign textHidden">{{item.teachingPhilosophy}}</view>
+							<view class="ascription textHidden">{{ item.orgName }}</view>
+							<view class="sign textHidden">{{ item.teachingPhilosophy }}</view>
 						</view>
 						<view class="type-icon">
 							<image src="/src/static/hot-icon2.png" mode=""></image>
@@ -151,31 +152,31 @@
 					<view class="i-data">
 						<view class="acclaim">
 							<zzx-icon name="acclaim"></zzx-icon>
-							<view style="color: #FFCC00;">好评 {{item.goodRate}}%</view>
+							<view style="color: #FFCC00;">好评 {{ item.goodRate }}%</view>
 						</view>
 						<view class="acclaim">
 							<zzx-icon name="order"></zzx-icon>
-							<view style="color: #4DDF96;">订单数 {{item.orderCount||'0'}}</view>
+							<view style="color: #4DDF96;">订单数 {{ item.orderCount || '0' }}</view>
 						</view>
 						<view class="acclaim">
 							<zzx-icon name="number"></zzx-icon>
-							<view style="color: #AB7BFF;">授课人数 {{item.teachingCount}}</view>
+							<view style="color: #AB7BFF;">授课人数 {{ item.teachingCount }}</view>
 						</view>
 					</view>
-					<view class="i-skill">{{item.excelMsg}}</view>
-					<view class="i-course" v-for="(course,index) in item.courseList" :key="course.id">
+					<view class="i-skill">{{ item.excelMsg }}</view>
+					<view class="i-course" v-for="(course, index) in item.courseList" :key="course.id">
 						<view class="course-name">
-							<view class="price">¥{{(course.sellingPrice).toFixed(2)||'0.00'}}</view>
-							<view class="name textHidden">{{course.name}}</view>
+							<view class="price">¥{{ (course.sellingPrice).toFixed(2) || '0.00' }}</view>
+							<view class="name textHidden">{{ course.name }}</view>
 						</view>
-						<view class="num">已售{{item.count||'0'}}</view>
+						<view class="num">已售{{ item.count || '0' }}</view>
 					</view>
 					<view class="more" @click="gotoPage(`/pages/index/instructorDetail/index?id=${item.id}`)">更多课程
 					</view>
 				</view>
 			</view>
 			<!-- <view style="position: relative;z-index: 1;"> -->
-			<zs-empty v-if="!loading && instructorList.length === 0" />
+			<zs-empty v-if="!indexLoading && instructorList.length === 0" />
 			<!-- </view> -->
 		</view>
 		<view class="login-tips" v-if="!token">
@@ -186,744 +187,772 @@
 </template>
 
 <script setup lang="ts">
-	import zsLoading from '@/components/zzx-loading/zzx-loading.vue'
-	import { ref, onMounted, computed } from 'vue'
-	import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
-	import zsEmpty from '@/components/zs-empty/index.vue'
-	import { RouterUtils, TipsUtils } from '@/utils/util';
-	import { http } from '@/utils/http'
-	import { useCacheStore } from '@/stores/cache'
-	const cache = useCacheStore()
-	const token = computed(() => {
-		return cache.get('TOKEN')
+import zsLoading from '@/components/zzx-loading/zzx-loading.vue'
+import { ref, onMounted, computed } from 'vue'
+import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
+import zsEmpty from '@/components/zs-empty/index.vue'
+import { TipsUtils } from '@/utils/util';
+import { http } from '@/utils/http'
+import { useCacheStore } from '@/stores/cache'
+const cache = useCacheStore()
+import QQMapWX from '@/libs/qqmap-wx-jssdk.js'
+const token = computed(() => {
+	return cache.get('TOKEN')
+})
+const navBarHeight = ref(0);
+const statusBarHeight = ref(0);
+const titleBarHeight = ref(0);
+const navOpacity = ref(0);
+const backgroundColor = ref('#D2FD73');
+const instructorList = ref();
+const indexLoading = ref(true)
+onLoad(() => {
+	get_location()
+})
+onPullDownRefresh(() => {
+	get_indexInfo()
+	get_message()
+	get_searchList()
+})
+onMounted(() => {
+	get_navheight()
+	get_indexInfo()
+	get_message()
+	get_searchList()
+})
+onPageScroll((e) => {
+	navOpacity.value = Math.min(Math.max(e.scrollTop / navBarHeight.value, 0), 1);
+})
+const get_navheight = () => {
+	const systemInfo = uni.getSystemInfoSync();
+	statusBarHeight.value = systemInfo.statusBarHeight || 0;
+	const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
+	const titleBarHeightCalc = (menuButtonInfo.top - statusBarHeight.value) * 2 + menuButtonInfo.height;
+	titleBarHeight.value = titleBarHeightCalc;
+	navBarHeight.value = statusBarHeight.value + titleBarHeight.value;
+}
+
+const currentIndex = ref(0);
+const bannerList = ref([])
+const swierChange = (e) => {
+	currentIndex.value = e.detail.current
+}
+
+const gotoPage = (path: string) => {
+	if (!token.value) return TipsUtils.tips_alert('请先登录~', false)
+	uni.navigateTo({
+		url: path
 	})
-	const navBarHeight = ref(0);
-	const statusBarHeight = ref(0);
-	const titleBarHeight = ref(0);
-	const navOpacity = ref(0);
-	const backgroundColor = ref('#D2FD73');
-	const instructorList = ref();
-	onLoad(() => {
-		get_location()
+}
+
+const submitLogin = () => {
+	uni.login({
+		provider: 'weixin',
+		success: (res) => {
+			get_logininfo(res.code)
+		}
 	})
-	onPullDownRefresh(() => {
+}
+
+const get_logininfo = (item: string) => {
+	http.get('/user/loginByCode', { data: { code: item }, loading: true }).then(res => {
+		cache.set('TOKEN', res.result.token)
+		cache.set('USER_INFO', res.result)
 		get_indexInfo()
 		get_message()
 		get_searchList()
+		get_userinfo()
+		TipsUtils.tips_toast('登录成功')
 	})
-	onMounted(() => {
-		get_navheight()
-		get_indexInfo()
-		get_message()
-		get_searchList()
+}
+
+const get_userinfo = () => {
+	http.get('/user/getUserInfo', { loading: true }).then(res => {
+		cache.set('USER_INFO', res.result)
 	})
-	onPageScroll((e) => {
-		navOpacity.value = Math.min(Math.max(e.scrollTop / navBarHeight.value, 0), 1);
+}
+
+const get_location = () => {
+	uni.authorize({
+		scope: 'scope.userLocation',
+		isHighAccuracy: true,
+		success() {
+			uni.getSystemInfo({
+				success: function (res) {
+					let locationEnabled = res.locationEnabled; //判断手机定位服务是否开启
+					let locationAuthorized = res.locationAuthorized; //判断定位服务是否允许微信授权
+					if (locationEnabled == false || locationAuthorized == false) {
+						TipsUtils.tips_alert('请开启手机定位以提供更好服务', true)
+					}
+				}
+			})
+			uni.getLocation({
+				type: 'gcj02',
+				success: function (res) {
+					uni.hideLoading()
+					cache.set('LON', res.longitude)
+					cache.set('LAT', res.latitude)
+					getAddressInfo()
+				},
+				fail: function (err) {
+					if (err.errMsg === 'getFuzzyLocation:fail system permission denied') {
+						TipsUtils.tips_alert('系统定位未开启,请开启定位以便提供更好服务', false)
+					} else if (err.errMsg === 'getFuzzyLocation:fail:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF' ||
+						err.errMsg === 'getFuzzyLocation:fail system permission denied' ||
+						err.errMsg === 'getFuzzyLocation:fail:system permission denied' || err.errMsg === 'getFuzzyLocation:fail auth deny') {
+						showAuthGuide()
+					}
+					console.log(err, '错误信息')
+				}
+			});
+		},
+		fail: (err) => {
+			showAuthGuide()
+		}
+	});
+}
+
+// 经纬度逆解析获取当前位置信息
+const getAddressInfo = () => {
+	const qqmapsdk = new QQMapWX({ key: 'IPQBZ-NTL35-DCDI7-IU6JL-LUMO2-5XB3W' });
+	qqmapsdk.reverseGeocoder({
+		location: {
+			latitude: cache.get('LAT'),
+			longitude: cache.get('LON')
+		},
+		success: function (res: any) {
+			addressName.value = res.result.address
+		},
+		fail: function (err: any) {
+			TipsUtils.tips_toast('定位失败,请重试')
+			console.log(err);
+		}
 	})
-	const get_navheight = () => {
-		const systemInfo = uni.getSystemInfoSync();
-		statusBarHeight.value = systemInfo.statusBarHeight || 0;
-		const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
-		const titleBarHeightCalc = (menuButtonInfo.top - statusBarHeight.value) * 2 + menuButtonInfo.height;
-		titleBarHeight.value = titleBarHeightCalc;
-		navBarHeight.value = statusBarHeight.value + titleBarHeight.value;
-	}
-
-	const currentIndex = ref(0);
-	const bannerList = ref([{
-		img: 'https://bpic.588ku.com/element_origin_min_pic/23/07/11/d32dabe266d10da8b21bd640a2e9b611.jpg!r650'
-	}, {
-		img: 'https://ts1.tc.mm.bing.net/th/id/R-C.6f18e58bf3bacbcee226cb76dfc089a3?rik=61%2bMLnhOzFiZOg&riu=http%3a%2f%2fimages.shejidaren.com%2fwp-content%2fuploads%2f2014%2f07%2f085628m6c.jpg&ehk=v1vDvzVgPRc3irw6n%2bs5gF%2b5SEc1uCstErDhRaxqlgE%3d&risl=&pid=ImgRaw&r=0'
-	}, {
-		img: 'https://ts1.tc.mm.bing.net/th/id/R-C.a8553f142638e741396e386b43c2bca7?rik=dzSGk6XRsxAAsQ&riu=http%3a%2f%2fseopic.699pic.com%2fphoto%2f50062%2f5890.jpg_wh1200.jpg&ehk=BgxiqxvzoNQd0pZHWV4VPOMbYgqM76WDMt8RDzCjoYY%3d&risl=&pid=ImgRaw&r=0'
-	}])
-	const swierChange = (e) => {
-		currentIndex.value = e.detail.current
-	}
-
-	const gotoPage = (path : string) => {
-		if (!token.value) return TipsUtils.tips_alert('请先登录~', false)
-		uni.navigateTo({
-			url: path
-		})
-	}
+}
 
-	const submitLogin = () => {
-		uni.login({
-			provider: 'weixin',
-			success: (res) => {
-				get_logininfo(res.code)
-			}
-		})
+// 引导操作
+const showAuthGuide = async () => {
+	let res: any = await TipsUtils.tips_alert('授权定位以提供更好服务', true)
+	if (res.confirm) {
+		uni.openSetting()
 	}
+}
+
+// 手动选择
+const addressName = ref('选择定位')
+const openSellocation = () => {
+	uni.chooseLocation({
+		success: function (res) {
+			addressName.value = res.name
+			cache.set('LON', res.longitude)
+			cache.set('LAT', res.latitude)
+		},
+		fail(err) {
+			console.log(err);
+			// showAuthGuide()
+		}
+	});
+}
+
+// 首页基础信息
+const gyCourseList = ref()
+const stCourseList = ref()
+const get_indexInfo = () => {
+	http.get('/home/homeInfo').then((res) => {
+		indexLoading.value = false
+		bannerList.value = res.result.bannerList
+		gyCourseList.value = res.result.courseList.filter(item => item.priceType === 0)
+		stCourseList.value = res.result.courseList.filter(item => item.priceType === 1)
+		instructorList.value = res.result.instructorList
+		uni.stopPullDownRefresh()
+	})
+}
 
-	const get_logininfo = (item : string) => {
-		http.get('/user/loginByCode', { data: { code: item }, loading: true }).then(res => {
-			cache.set('TOKEN', res.result.token)
-			cache.set('USER_INFO', res.result)
-			get_indexInfo()
-			get_message()
-			get_searchList()
-			get_userinfo()
-			TipsUtils.tips_toast('登录成功')
-		})
-	}
+// 消息通知
+const indexMsg = ref([])
+const get_message = () => {
+	http.get('/home/getMsg').then((res) => {
+		indexMsg.value = res.result
+	})
+}
 
-	const get_userinfo = () => {
-		http.get('/user/getUserInfo', { loading: true }).then(res => {
-			cache.set('USER_INFO', res.result)
+// 搜索相关
+const searchList = ref([])
+const get_searchList = () => {
+	http.get('/home/getHotSearch').then((res) => {
+		searchList.value = res.result
+	})
+}
+const searchCurrent = ref()
+const transitionChange = (e) => {
+	searchCurrent.value = e.detail.current
+}
+const searchInfoBtn = () => {
+	if (searchList.value < 1) return TipsUtils.tips_toast('请输入关键词')
+	let keyword = ''
+	let venueType = null
+	if (searchList.value.length > 1) {
+		keyword = searchList.value[searchCurrent.value].searchContent
+		venueType = searchList.value[searchCurrent.value].venueType
+	} else {
+		searchList.value.map((item) => {
+			keyword = item.searchContent
+			venueType = item.venueType
 		})
 	}
+	gotoPage(`/pages/index/searchPage/index?keyword=${keyword}&venueType=${venueType}`)
+}
+</script>
 
-	const get_location = () => {
-		uni.authorize({
-			scope: 'scope.userLocation',
-			success() {
-				uni.getLocation({
-					type: 'gcj02',
-					success: function (res) {
-						uni.hideLoading()
-						cache.set('LON', res.longitude)
-						cache.set('LAT', res.latitude)
-					},
-					fail: function (err) {
-						if (err.errMsg === 'getFuzzyLocation:fail system permission denied') {
-							TipsUtils.tips_alert('系统定位未开启,请开启定位以便提供更好服务', false)
-						} else if (err.errMsg === 'getFuzzyLocation:fail:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF' ||
-							err.errMsg === 'getFuzzyLocation:fail system permission denied' ||
-							err.errMsg === 'getFuzzyLocation:fail:system permission denied' || err.errMsg === 'getFuzzyLocation:fail auth deny') {
-							showAuthGuide()
-						}
-						console.log(err, '错误信息')
-					}
-				});
-			},
-			fail: (err) => {
-				showAuthGuide()
-			}
-		});
-	}
+<style lang="less" scoped>
+.nav-title {
+	position: fixed;
+	width: 100%;
+	text-align: center;
+	font-size: 28rpx;
+	z-index: 9999;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+
+	.back-icon {
+		position: absolute;
+		left: 20rpx;
+		z-index: 9999;
+		display: flex;
+		align-items: center;
+		gap: 10rpx;
+		font-weight: 800;
+		font-size: 28rpx;
+		color: #222222;
 
-	// 引导操作
-	const showAuthGuide = async () => {
-		let res : any = await TipsUtils.tips_alert('授权定位以提供更好服务', true)
-		if (res.confirm) {
-			uni.openSetting()
+		.location-text {
+			max-width: 460rpx;
 		}
 	}
-	
-	// 手动选择
-	const addressName = ref('选择定位')
-	const openSellocation = () => {
-		uni.chooseLocation({
-			success: function (res) {
-				addressName.value = res.name
-				cache.set('LON', res.longitude)
-				cache.set('LAT', res.latitude)
-			},
-			fail(res) {
-				console.log(res);
-				// showAuthGuide()
-			}
-		});
-	}
+}
 
-	// 首页基础信息
-	const gyCourseList = ref()
-	const stCourseList = ref()
-	const indexLoading = ref(true)
-	const get_indexInfo = () => {
-		http.get('/home/homeInfo').then((res) => {
-			indexLoading.value = false
-			bannerList.value = res.result.bannerList
-			gyCourseList.value = res.result.courseList.filter(item => item.priceType === 0)
-			stCourseList.value = res.result.courseList.filter(item => item.priceType === 1)
-			instructorList.value = res.result.instructorList
-			uni.stopPullDownRefresh()
-		})
-	}
-
-	// 消息通知
-	const indexMsg = ref([])
-	const get_message = () => {
-		http.get('/home/getMsg').then((res) => {
-			indexMsg.value = res.result
-		})
-	}
+.index-header {
+	position: relative;
+	height: 580rpx;
 
-	// 搜索相关
-	const searchList = ref([])
-	const get_searchList = () => {
-		http.get('/home/getHotSearch').then((res) => {
-			searchList.value = res.result
-		})
-	}
-	const searchCurrent = ref()
-	const transitionChange = (e) => {
-		searchCurrent.value = e.detail.current
-	}
-	const searchInfoBtn = () => {
-		if (searchList.value < 1) return TipsUtils.tips_toast('请输入关键词')
-		let keyword = ''
-		let venueType = null
-		if (searchList.value.length > 1) {
-			keyword = searchList.value[searchCurrent.value].searchContent
-			venueType = searchList.value[searchCurrent.value].venueType
-		} else {
-			searchList.value.map((item) => {
-				keyword = item.searchContent
-				venueType = item.venueType
-			})
-		}
-		gotoPage(`/pages/index/searchPage/index?keyword=${keyword}&venueType=${venueType}`)
+	.header-bg {
+		position: absolute;
+		width: 100%;
 	}
-</script>
 
-<style lang="less" scoped>
-	.nav-title {
-		position: fixed;
-		width: 100%;
-		text-align: center;
-		font-size: 28rpx;
+	.back-icon {
+		position: absolute;
+		left: 20rpx;
 		z-index: 9999;
 		display: flex;
-		justify-content: center;
 		align-items: center;
+		gap: 10rpx;
+		font-weight: 800;
+		font-size: 28rpx;
+		color: #222222;
 
-		.back-icon {
-			position: absolute;
-			left: 20rpx;
-			z-index: 9999;
-			display: flex;
-			align-items: center;
-			gap: 10rpx;
-			font-weight: 800;
-			font-size: 28rpx;
-			color: #222222;
-
-			.location-text {
-				max-width: 460rpx;
-			}
+		.location-text {
+			max-width: 460rpx;
 		}
 	}
 
-	.index-header {
-		position: relative;
-		height: 580rpx;
-		.header-bg {
-			position: absolute;
-			width: 100%;
+	.header-search {
+		position: absolute;
+		display: flex;
+		align-items: center;
+		gap: 10rpx;
+		background: #fff;
+		width: 685rpx;
+		padding: 8rpx;
+		border-radius: 40rpx;
+
+		.i-search-swiper {
+			height: 40rpx;
+			line-height: 40rpx;
+			width: 670rpx;
+			font-weight: bold;
+			font-size: 24rpx;
+			color: #CCCCCC;
 		}
 
-		.back-icon {
-			position: absolute;
-			left: 20rpx;
-			z-index: 9999;
-			display: flex;
-			align-items: center;
-			gap: 10rpx;
-			font-weight: 800;
+		.search-btn {
+			width: 144rpx;
+			height: 52rpx;
+			background: #222222;
+			border-radius: 28rpx;
+			font-weight: bold;
 			font-size: 28rpx;
-			color: #222222;
-
-			.location-text {
-				max-width: 460rpx;
-			}
+			color: #C8FF0C;
+			line-height: 52rpx;
+			text-align: center;
 		}
+	}
 
-		.header-search {
-			position: absolute;
-			display: flex;
-			align-items: center;
-			gap: 10rpx;
-			background: #fff;
-			width: 685rpx;
-			padding: 8rpx;
-			border-radius: 40rpx;
-
-			.i-search-swiper {
-				height: 40rpx;
-				line-height: 40rpx;
-				width: 670rpx;
-				font-weight: bold;
-				font-size: 24rpx;
-				color: #CCCCCC;
-			}
+	.header-banner {
+		position: absolute;
+		top: 240rpx;
+		left: 0;
+		width: 100%;
+		height: 340rpx;
 
-			.search-btn {
-				width: 144rpx;
-				height: 52rpx;
-				background: #222222;
-				border-radius: 28rpx;
-				font-weight: bold;
-				font-size: 28rpx;
-				color: #C8FF0C;
-				line-height: 52rpx;
-				text-align: center;
-			}
+		.header-swiper {
+			height: 340rpx;
 		}
 
-		.header-banner {
+		.slide-image {
 			position: absolute;
-			top: 240rpx;
-			left: 0;
-			width: 100%;
-			height: 340rpx;
+			height: 200rpx;
+			width: 570rpx;
+			border-radius: 15rpx;
+			z-index: 5;
+			opacity: 0.7;
+			top: 18%;
+			margin: 0 20rpx;
+		}
 
-			.header-swiper {
-				height: 340rpx;
-			}
+		swiper {
+			height: 430rpx;
+		}
 
-			.slide-image {
-				position: absolute;
-				height: 200rpx;
-				width: 570rpx;
-				border-radius: 15rpx;
-				z-index: 5;
-				opacity: 0.7;
-				top: 18%;
-				margin: 0 20rpx;
-			}
+		.active {
+			opacity: 1;
+			z-index: 10;
+			height: 316rpx;
+			width: 572rpx;
+			top: 7%;
+			transition: all 0.2s ease-in 0s;
+		}
+	}
+}
+
+.announcement {
+	margin-top: 20rpx;
+	padding: 20rpx;
+	background: #FFFFFF;
+	border-radius: 32rpx;
+	display: flex;
+	justify-content: space-around;
+	z-index: 9999;
+
+	&>image {
+		height: 32rpx;
+	}
 
-			swiper {
-				height: 430rpx;
-			}
+	&>view {
+		font-size: 28rpx;
+		color: #222222;
+		width: 440rpx;
 
-			.active {
-				opacity: 1;
-				z-index: 10;
-				height: 316rpx;
-				width: 572rpx;
-				top: 7%;
-				transition: all 0.2s ease-in 0s;
-			}
+		.announcement-swiper {
+			height: 40rpx;
 		}
 	}
 
-	.announcement {
-		margin-top: 20rpx;
-		padding: 20rpx;
-		background: #FFFFFF;
-		border-radius: 32rpx;
-		display: flex;
-		justify-content: space-around;
-		z-index: 9999;
+}
 
-		&>image {
-			height: 32rpx;
-		}
+.grid-card {
+	padding: 20rpx;
+	background: #FFFFFF;
+	border-radius: 32rpx;
+	display: flex;
+	justify-content: space-around;
+	margin-top: 20rpx;
 
-		&>view {
-			font-size: 28rpx;
-			color: #222222;
-			width: 440rpx;
+	.grid-item {
+		display: flex;
+		flex-direction: column;
+		align-items: center;
 
-			.announcement-swiper {
-				height: 40rpx;
+		.item-icon {
+			width: 80rpx;
+			height: 80rpx;
+
+			&>image {
+				width: 80rpx;
+				height: 80rpx;
 			}
 		}
 
+		.item-text {
+			font-size: 24rpx;
+			color: #222222;
+			margin-top: 20rpx;
+		}
 	}
+}
 
-	.grid-card {
-		padding: 20rpx;
-		background: #FFFFFF;
+.course-card {
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+	margin-top: 20rpx;
+
+	.commonweal {
+		background: #C8FF0C;
 		border-radius: 32rpx;
-		display: flex;
-		justify-content: space-around;
-		margin-top: 20rpx;
+		padding: 20rpx;
 
-		.grid-item {
+		.commonweal-title {
 			display: flex;
-			flex-direction: column;
 			align-items: center;
+			justify-content: space-between;
 
-			.item-icon {
-				width: 80rpx;
-				height: 80rpx;
+			.title-left {
+				font-weight: 800;
+				font-size: 32rpx;
+				color: #222222;
+				display: flex;
+				gap: 10rpx;
 
 				&>image {
-					width: 80rpx;
-					height: 80rpx;
+					width: 40rpx;
+					height: 40rpx;
 				}
 			}
-
-			.item-text {
-				font-size: 24rpx;
-				color: #222222;
-				margin-top: 20rpx;
-			}
 		}
-	}
-
-	.course-card {
-		display: flex;
-		align-items: center;
-		justify-content: space-between;
-		margin-top: 20rpx;
 
-		.commonweal {
-			background: #C8FF0C;
-			border-radius: 32rpx;
-			padding: 20rpx;
+		.commonweal-detail {
+			display: flex;
+			justify-content: space-around;
+			gap: 20rpx;
+			margin-top: 20rpx;
 
-			.commonweal-title {
+			.detail-list {
 				display: flex;
+				flex-direction: column;
 				align-items: center;
-				justify-content: space-between;
 
-				.title-left {
-					font-weight: 800;
-					font-size: 32rpx;
-					color: #222222;
-					display: flex;
-					gap: 10rpx;
+				&>image {
+					width: 80rpx;
+					height: 80rpx;
+					border-radius: 50%;
+				}
 
-					&>image {
-						width: 40rpx;
-						height: 40rpx;
-					}
+				.detail-text {
+					text-align: center;
+					margin-top: 16rpx;
+					font-size: 24rpx;
+					color: #222222;
 				}
 			}
+		}
+	}
 
-			.commonweal-detail {
-				display: flex;
-				justify-content: space-around;
-				gap: 20rpx;
-				margin-top: 20rpx;
+	.audition {
+		background: #AB7BFF;
+		border-radius: 32rpx;
+		padding: 20rpx;
 
-				.detail-list {
-					display: flex;
-					flex-direction: column;
-					align-items: center;
+		.audition-title {
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
 
-					&>image {
-						width: 80rpx;
-						height: 80rpx;
-						border-radius: 50%;
-					}
+			.title-left {
+				font-weight: 800;
+				font-size: 32rpx;
+				color: #FFFFFF;
+				display: flex;
+				gap: 10rpx;
 
-					.detail-text {
-						text-align: center;
-						margin-top: 16rpx;
-						font-size: 24rpx;
-						color: #222222;
-					}
+				&>image {
+					width: 40rpx;
+					height: 40rpx;
 				}
 			}
 		}
 
-		.audition {
-			background: #AB7BFF;
-			border-radius: 32rpx;
-			padding: 20rpx;
+		.audition-detail {
+			display: flex;
+			justify-content: space-around;
+			gap: 20rpx;
+			margin-top: 20rpx;
 
-			.audition-title {
+			.detail-list {
 				display: flex;
+				flex-direction: column;
 				align-items: center;
-				justify-content: space-between;
-
-				.title-left {
-					font-weight: 800;
-					font-size: 32rpx;
-					color: #FFFFFF;
-					display: flex;
-					gap: 10rpx;
+				text-align: center;
 
-					&>image {
-						width: 40rpx;
-						height: 40rpx;
-					}
+				&>image {
+					width: 80rpx;
+					height: 80rpx;
+					border-radius: 50%;
 				}
-			}
-
-			.audition-detail {
-				display: flex;
-				justify-content: space-around;
-				gap: 20rpx;
-				margin-top: 20rpx;
 
-				.detail-list {
-					display: flex;
-					flex-direction: column;
-					align-items: center;
+				.detail-text {
 					text-align: center;
-
-					&>image {
-						width: 80rpx;
-						height: 80rpx;
-						border-radius: 50%;
-					}
-
-					.detail-text {
-						text-align: center;
-						margin-top: 16rpx;
-						font-size: 24rpx;
-						color: #fff;
-					}
+					margin-top: 16rpx;
+					font-size: 24rpx;
+					color: #fff;
 				}
 			}
 		}
 	}
+}
+
+.hot-instructor {
+	margin-top: 20rpx;
+	position: relative;
 
-	.hot-instructor {
-		margin-top: 20rpx;
-		position: relative;
-		.i-title {
+	.i-title {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		background-color: #fff;
+		padding: 0 20rpx 0 20rpx;
+		border-radius: 32rpx 32rpx 0 0;
+
+		.i-hot {
 			display: flex;
 			align-items: center;
-			justify-content: space-between;
-			background-color: #fff;
-			padding: 0 20rpx 0 20rpx;
-			border-radius: 32rpx 32rpx 0 0;
+			font-weight: bold;
+			font-size: 32rpx;
+			color: #222222;
+			position: relative;
+			height: 100rpx;
 
-			.i-hot {
-				display: flex;
-				align-items: center;
-				font-weight: bold;
-				font-size: 32rpx;
-				color: #222222;
+			.i-text {
 				position: relative;
-				height: 100rpx;
-				.i-text {
-					position: relative;
-					width: 130rpx;
-					margin-top: 30rpx;
-
-					&>text {
-						position: absolute;
-						bottom: 0;
-						z-index: 1;
-					}
-				}
+				width: 130rpx;
+				margin-top: 30rpx;
 
-				.i-text::after {
+				&>text {
 					position: absolute;
-					content: '';
-					bottom: -6rpx;
-					left: 20rpx;
-					width: 80rpx;
-					height: 20rpx;
-					background-color: #D3FD76;
-					border-radius: 4rpx;
+					bottom: 0;
+					z-index: 1;
 				}
+			}
 
-				&>image {
-					position: absolute;
-					width: 300rpx;
-					top: 0;
-					left: 140rpx;
-				}
+			.i-text::after {
+				position: absolute;
+				content: '';
+				bottom: -6rpx;
+				left: 20rpx;
+				width: 80rpx;
+				height: 20rpx;
+				background-color: #D3FD76;
+				border-radius: 4rpx;
 			}
 
-			.i-more {
-				font-size: 24rpx;
-				color: #AAAAAA;
-				display: flex;
-				align-items: center;
-				gap: 10rpx;
+			&>image {
+				position: absolute;
+				width: 300rpx;
+				top: 0;
+				left: 140rpx;
 			}
 		}
 
-		.i-info-card {
-			position: absolute;
+		.i-more {
+			font-size: 24rpx;
+			color: #AAAAAA;
+			display: flex;
+			align-items: center;
+			gap: 10rpx;
+		}
+	}
 
-			.i-card-list {
-				margin-bottom: 24rpx;
-				border-radius: 32rpx;
-				padding: 20rpx;
-				width: 670rpx;
-				max-height: 480rpx;
-			}
+	.i-info-card {
+		position: absolute;
 
-			.i-info {
-				display: flex;
-				align-items: center;
-				justify-content: space-around;
+		.i-card-list {
+			margin-bottom: 24rpx;
+			border-radius: 32rpx;
+			padding: 20rpx;
+			width: 670rpx;
+			max-height: 480rpx;
+		}
+
+		.i-info {
+			display: flex;
+			align-items: center;
+			justify-content: space-around;
+
+			.header {
+				width: 150rpx;
+				height: 150rpx;
+				border-radius: 32rpx;
+				// background: #FFB8F9;
+				padding: 4rpx;
+				position: relative;
 
-				.header {
+				.head-img {
 					width: 150rpx;
 					height: 150rpx;
 					border-radius: 32rpx;
-					// background: #FFB8F9;
-					padding: 4rpx;
-					position: relative;
-
-					.head-img {
-						width: 150rpx;
-						height: 150rpx;
-						border-radius: 32rpx;
-					}
+				}
 
-					.head-tag {
-						position: absolute;
-						bottom: 0;
-						right: -14rpx;
-						width: 36rpx;
-						height: 36rpx;
-					}
+				.head-tag {
+					position: absolute;
+					bottom: 0;
+					right: -14rpx;
+					width: 36rpx;
+					height: 36rpx;
 				}
+			}
 
-				.i-name-tag {
-					.name-tag {
-						display: flex;
-						align-items: center;
-						gap: 8rpx;
-						.name {
-							width: 134rpx;
-							height: 60rpx;
-							font-weight: 800;
-							font-size: 28rpx;
-							color: #222222;
-							position: relative;
-
-							&>view {
-								&>text {
-									position: absolute;
-									z-index: 1;
-									top: 10rpx;
-								}
-							}
+			.i-name-tag {
+				.name-tag {
+					display: flex;
+					align-items: center;
+					gap: 8rpx;
+
+					.name {
+						width: 134rpx;
+						height: 60rpx;
+						font-weight: 800;
+						font-size: 28rpx;
+						color: #222222;
+						position: relative;
 
-							&>image {
-								top: 0;
-								left: 0;
+						&>view {
+							&>text {
 								position: absolute;
-								width: 133rpx;
-								height: 48rpx;
+								z-index: 1;
+								top: 10rpx;
 							}
 						}
 
-						.tag {
-							font-size: 24rpx;
-							color: #AAAAAA;
+						&>image {
+							top: 0;
+							left: 0;
+							position: absolute;
+							width: 133rpx;
+							height: 48rpx;
 						}
 					}
 
-					.ascription {
-						max-width: 360rpx;
-						font-size: 24rpx;
-						color: #222222;
-					}
-
-					.sign {
-						width: 360rpx;
-						margin-top: 20rpx;
-						font-weight: bold;
+					.tag {
 						font-size: 24rpx;
-						color: #222222;
+						color: #AAAAAA;
 					}
 				}
 
-				.type-icon {
-					&>image {
-						width: 106rpx;
-						height: 100rpx;
-					}
+				.ascription {
+					max-width: 360rpx;
+					font-size: 24rpx;
+					color: #222222;
 				}
-			}
 
-			.i-data {
-				display: flex;
-				align-items: center;
-				gap: 28rpx;
-				margin-top: 20rpx;
-
-				.acclaim {
-					display: flex;
-					align-items: center;
-					gap: 10rpx;
+				.sign {
+					width: 360rpx;
+					margin-top: 20rpx;
+					font-weight: bold;
 					font-size: 24rpx;
+					color: #222222;
 				}
 			}
 
-			.i-skill {
-				width: 700rpx;
-				margin-top: 20rpx;
-				font-size: 24rpx;
-				color: #AAAAAA;
+			.type-icon {
+				&>image {
+					width: 106rpx;
+					height: 100rpx;
+				}
 			}
+		}
+
+		.i-data {
+			display: flex;
+			align-items: center;
+			gap: 28rpx;
+			margin-top: 20rpx;
 
-			.i-course {
+			.acclaim {
 				display: flex;
 				align-items: center;
-				justify-content: space-between;
-				margin-top: 20rpx;
+				gap: 10rpx;
+				font-size: 24rpx;
+			}
+		}
 
-				.course-name {
-					display: flex;
-					align-items: center;
-					gap: 20rpx;
+		.i-skill {
+			width: 700rpx;
+			margin-top: 20rpx;
+			font-size: 24rpx;
+			color: #AAAAAA;
+		}
 
-					.price {
-						font-weight: bold;
-						font-size: 28rpx;
-						color: #FB5B5B;
-					}
+		.i-course {
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			margin-top: 20rpx;
 
-					.name {
-						width: 440rpx;
-						font-weight: bold;
-						font-size: 28rpx;
-						color: #222222;
-					}
+			.course-name {
+				display: flex;
+				align-items: center;
+				gap: 20rpx;
+
+				.price {
+					font-weight: bold;
+					font-size: 28rpx;
+					color: #FB5B5B;
 				}
 
-				.num {
-					font-size: 24rpx;
-					color: #AAAAAA;
+				.name {
+					width: 440rpx;
+					font-weight: bold;
+					font-size: 28rpx;
+					color: #222222;
 				}
 			}
 
-			.more {
-				margin: auto;
-				width: 100rpx;
-				margin-top: 20rpx;
-				text-align: center;
+			.num {
 				font-size: 24rpx;
-				color: #CCCCCC;
-				position: relative;
-			}
-
-			.more::after {
-				position: absolute;
-				bottom: -10rpx;
-				left: 25rpx;
-				content: '';
-				width: 38rpx;
-				height: 4rpx;
-				border-radius: 2rpx;
-				background-color: #CCCCCC;
+				color: #AAAAAA;
 			}
 		}
-	}
 
-	.login-tips {
-		position: fixed;
-		bottom: 22rpx;
-		width: 686rpx;
-		display: flex;
-		align-items: center;
-		justify-content: space-between;
-		padding: 10rpx;
-		background: rgba(0, 0, 0, 0.6);
-		border-radius: 8rpx;
-		z-index: 9999;
-
-		&>view:first-child {
-			font-size: 28rpx;
-			color: #FFFFFF;
+		.more {
+			margin: auto;
+			width: 100rpx;
+			margin-top: 20rpx;
+			text-align: center;
+			font-size: 24rpx;
+			color: #CCCCCC;
+			position: relative;
 		}
 
-		&>view:last-child {
-			width: 160rpx;
-			height: 60rpx;
-			background: #C8FF0C;
-			border-radius: 8rpx;
-			font-size: 28rpx;
-			color: #222222;
-			text-align: center;
-			line-height: 60rpx;
+		.more::after {
+			position: absolute;
+			bottom: -10rpx;
+			left: 25rpx;
+			content: '';
+			width: 38rpx;
+			height: 4rpx;
+			border-radius: 2rpx;
+			background-color: #CCCCCC;
 		}
 	}
+}
+
+.login-tips {
+	position: fixed;
+	bottom: 22rpx;
+	width: 686rpx;
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+	padding: 10rpx;
+	background: rgba(0, 0, 0, 0.6);
+	border-radius: 8rpx;
+	z-index: 9999;
+
+	&>view:first-child {
+		font-size: 28rpx;
+		color: #FFFFFF;
+	}
+
+	&>view:last-child {
+		width: 160rpx;
+		height: 60rpx;
+		background: #C8FF0C;
+		border-radius: 8rpx;
+		font-size: 28rpx;
+		color: #222222;
+		text-align: center;
+		line-height: 60rpx;
+	}
+}
 </style>

+ 5 - 5
src/pages/index/instructorDetail/index.vue

@@ -1,13 +1,13 @@
 <template>
 	<zzx-navbar :scrollable="true" :back="true" title="详情"></zzx-navbar>
-	<view class="detail-header">
-		<image class="header-bg" :src="detailObj.backgroundImg" mode="widthFix"></image>
+	<view class="detail-header" v-if="detailObj">
+		<image class="header-bg":src="detailObj.backgroundImg" mode="widthFix"></image>
 		<view class="back-icon" :style="{ paddingTop: (statusBarHeight + 10) + 'px' }" @click="RouterUtils.back()">
 			<zzx-icon name="back"></zzx-icon>
 		</view>
 		<view :style="{ height: (statusBarHeight + 100) + 'px' }"></view>
 	</view>
-	<view class="content">
+	<view class="content" v-if="detailObj">
 		<view class="i-info-card">
 			<view class="i-userinfo">
 				<view class="user-header">
@@ -63,8 +63,8 @@
 						</view>
 						<view class="address">上课地点:{{ item.address }} | {{ item.km }}km</view>
 						<view class="list-price">
-							<view class="left-price">¥{{ item.sellingPrice.toFixed(2) }}</view>
-							<view class="right-price">¥{{ item.originalPrice.toFixed(2) }}</view>
+							<view class="left-price" v-if="item.sellingPrice">¥{{ item.sellingPrice.toFixed(2) }}</view>
+							<view class="right-price" v-if="item.originalPrice">¥{{ item.originalPrice.toFixed(2) }}</view>
 						</view>
 						<view class="sale-data">已售{{ item.saleNum }} {{ item.goodRate }}%好评</view>
 						<view class="course-num">

+ 1 - 1
src/pages/index/search/index.vue

@@ -74,7 +74,7 @@
 		background: #F6F6F6;
 		width: 700rpx;
 		border-radius: 40rpx;
-
+		padding: 0 20rpx;
 		&>input {
 			width: 670rpx;
 			font-weight: bold;

+ 3 - 3
src/pages/index/searchPage/index.vue

@@ -32,7 +32,7 @@
 							<view class="name">{{venue.name}}</view>
 							<view class="appraise">
 								<zzx-icon name="star" size="12"></zzx-icon>
-								<view class="app-text"><text style="color: #FDD143	;">{{venue.goodRate}}</text> | 37条评论</view>
+								<view class="app-text"><text style="color: #FDD143	;">{{venue.goodRate||0}}</text> | 37条评论</view>
 							</view>
 							<view class="address">{{venue.address}} | {{venue.km}}km</view>
 							<view class="tags-box">
@@ -54,7 +54,7 @@
 				<view class="s-training-card" v-for="(venue,index) in searchList" :key="venue.id" @click="RouterUtils.to_page(`/pages/index/courseDetail/index?id=${venue.id}`)">
 					<view class="training-box">
 						<view class="training-img">
-							<image class="t-img" src="https://img.keaitupian.cn/newupload/08/1629449018344288.jpg" mode="">
+							<image class="t-img" :src="venue.cover" mode="">
 							</image>
 						</view>
 						<view class="training-info">
@@ -314,7 +314,7 @@
 							display: flex;
 							align-items: center;
 							gap: 12rpx;
-
+							flex-wrap: wrap;
 							.tags {
 								width: 92rpx;
 								height: 36rpx;

+ 5 - 4
src/pages/index/submitOrder/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="s-header-card">
 		<zzx-icon name="location" size="14"></zzx-icon>
-		<text>{{ timeList.name }}</text>
+		<text>{{ timeList?.name }}</text>
 	</view>
 	<view class="content">
 		<view class="s-selectdate-card">
@@ -25,13 +25,13 @@
 			<view class="select-card-list">
 				<scroll-view class="scroll-view_H" scroll-x="true">
 					<view class="item-card" :style="{ background: `${check_index == index ? '#F0FFBB' : '#F6F6F6'}` }"
-						v-for="(item, index) in timeList.timeSlot" @click="check_item(item, index)">
+						v-for="(item, index) in timeList?.timeSlot" @click="check_item(item, index)">
 						<view class="time">{{ item.name }}</view>
 						<view class="allowance">余{{ item.inventory }}</view>
 						<view class="price">¥{{ item.price || '0.00' }}</view>
 					</view>
 				</scroll-view>
-				<view class="not-data" v-if="timeList.timeSlot.length < 1">暂无可选时段</view>
+				<view class="not-data" v-if="timeList?.timeSlot.length < 1">暂无可选时段</view>
 			</view>
 		</view>
 		<view class="r-insurance" v-for="item in insureIdList" :key="item.id">
@@ -260,6 +260,7 @@ const toRefuse = () => {
 const userData = ref([])
 const get_userData = () => {
 	uni.$on('userData', function (data) {
+		console.log(data,'携带用户');
 		userData.value = data
 		if (data.length > 0) {
 			let familyIds = data.map(item => item.id)
@@ -292,7 +293,7 @@ let orderFormData = ref({
 	}
 })
 const submitBooking = () => {
-	if(userData.vlaue<1) return TipsUtils.tips_toast('请添加成员')
+	if(userData.value.length === 0) return TipsUtils.tips_toast('请添加成员')
 	let data = { ...orderFormData.value };
 	if (!insureData.value || insureData.value.length === 0) {
 		delete data.insureOrderInfoForm;

+ 1 - 2
src/pages/index/toBeUsed/index.vue

@@ -189,8 +189,7 @@
 				<zzx-icon name="ashRight" size="12"></zzx-icon>
 			</view> -->
 		</view>
-		<view class="t-use-card"
-			v-if="orderPageInfo?.orderType == 0 || orderPageInfo?.orderType == 5 && orderDetailInfo?.insureOrderInfoList">
+		<view class="t-use-card" v-if="orderDetailInfo?.insureOrderInfoList">
 			<view class="use-tips">
 				<view class="title">参赛意外险</view>
 				<view class="t-use-insureOrder">

+ 12 - 4
src/pages/index/useNotice/index.vue

@@ -1,14 +1,22 @@
 <template>
 	<view class="content">
 		<view class="u-tips-card">
-			<view class="item-tips">1.学校为公共场所,请发护公共设施;</view>
-			<view class="item-tips">1.学校为公共场所,请发护公共设施;</view>
-			<view class="item-tips">1.学校为公共场所,请发护公共设施;</view>
+			<view class="item-tips">
+				<rich-text :nodes="notice"></rich-text>
+			</view>
 		</view>
 	</view>
 </template>
 
-<script>
+<script setup>
+import { ref, onMounted, computed } from 'vue';
+import { onLoad } from '@dcloudio/uni-app';
+import { http } from '@/utils/http'
+
+const notice = ref('')
+onLoad((options) => {
+    notice.value = options.reminder || ''
+})
 </script>
 
 <style lang="less" scoped>

+ 3 - 3
src/pages/index/venue/index.vue

@@ -24,14 +24,14 @@
 					<view class="venues-comments">
 						<view class="star">
 							<zzx-icon name="star" size="12"></zzx-icon>
-							<text>{{item.goodRate}}</text>
+							<text style="margin-bottom: 4rpx;">{{item.goodRate||0}}</text>
 						</view>
 						<view class="comment">
 							{{item.comments||0}}条评论
 						</view>
 					</view>
 					<view class="venues-address">
-						{{item.address}} | {{item.km.toFixed(2)}}km
+						{{item.address||'暂无地址'}} | {{item.km.toFixed(2)}}km
 					</view>
 					<view class="venues-type">
 						<view class="type-tags" v-for="(tags,index) in item.category" :key="index">
@@ -266,7 +266,7 @@
 				align-items: center;
 				gap: 10rpx;
 				margin-top: 16rpx;
-
+				flex-wrap: wrap;
 				.type-tags {
 					width: 92rpx;
 					height: 36rpx;

+ 0 - 1
src/pages/mine/index.vue

@@ -63,7 +63,6 @@ const token = computed(() => {
 const userinfo = computed(() => {
 	return cache.get('USER_INFO')
 })
-const userAvatar = ref('/src/static/default-header.png')
 const cardList = ref([{
 	name: '全部订单',
 	icon: 'm-allorder'

+ 1 - 1
src/pages/mine/mineComments/index.vue

@@ -6,7 +6,7 @@
 		<view class="m-comments-card" v-for="item in commentsList" :key="item.id">
 			<view class="m-comments-name">
 				<zzx-icon name="venue-icon4" size="14"></zzx-icon>
-				<view class="name">{{item.address}}</view>
+				<view class="name">{{item.departName}}</view>
 				<zzx-icon name="ashRight" size="12"></zzx-icon>
 			</view>
 			<view class="line"></view>

+ 20 - 1
src/pages/mp_ecard_sdk/constants/log.js

@@ -1 +1,20 @@
-const Log={version:"uni_1.0.5__stable",SourceType:"mp_sdk_uni",getIntoIndexPage:"START_INDEX",initSdk:"INIT_SDK",getConfig:"GET_CONFIG",getConfigRetry:"GET_CONFIG_BY_RETRY",webViewResult:"WEBVIEW_RESULT",webViewError:"WEBVIEW_ERROR",navigateToEid:"NAVIGATE_TO_EID",navigateBackFromEid:"NAVIGATE_BACK_FROM_EID",navigateBackFromEidFail:"NAVIGATE_BACK_FROM_EID_FAIL",startEid:"START_EID",startEidFail:"START_EID_FAIL",eidVerifyDone:"EID_VERIFY_DONE",requestFail:"REQUEST_FAIL",requestCatch:"REQUEST_CATCH",onAppShow:"ON_APP_SHOW"};export default Log;
+const Log = {
+  version: "uni_1.0.5__stable",
+  SourceType: "mp_sdk_uni",
+  getIntoIndexPage: "START_INDEX",
+  initSdk: "INIT_SDK",
+  getConfig: "GET_CONFIG",
+  getConfigRetry: "GET_CONFIG_BY_RETRY",
+  webViewResult: "WEBVIEW_RESULT",
+  webViewError: "WEBVIEW_ERROR",
+  navigateToEid: "NAVIGATE_TO_EID",
+  navigateBackFromEid: "NAVIGATE_BACK_FROM_EID",
+  navigateBackFromEidFail: "NAVIGATE_BACK_FROM_EID_FAIL",
+  startEid: "START_EID",
+  startEidFail: "START_EID_FAIL",
+  eidVerifyDone: "EID_VERIFY_DONE",
+  requestFail: "REQUEST_FAIL",
+  requestCatch: "REQUEST_CATCH",
+  onAppShow: "ON_APP_SHOW",
+};
+export default Log;

+ 73 - 1
src/pages/mp_ecard_sdk/index.css

@@ -1 +1,73 @@
-.auth{margin-top:128rpx;display:flex;flex-direction:column;align-items:center}.auth-logo{width:200rpx;height:200rpx}.auth-logo image{height:100%;width:100%}.title{margin-top:20rpx;font-size:36rpx;line-height:56rpx}.merchant-name{display:inline;font-weight:700}.sub-title{margin-top:8rpx;font-size:34rpx;line-height:52rpx}.button-area{margin-top:48rpx}.button-area button{width:622rpx;height:96rpx;background:#fff;border:2rpx solid #ddd;font-size:32rpx;font-weight:400;line-height:96rpx;padding:0}.redirect{margin-top:272rpx;display:flex;flex-direction:column;align-items:center}.loading{height:160rpx;width:160rpx;margin-bottom:32rpx}.loading image{height:100%;width:100%}.title{font-size:34rpx;line-height:52rpx}
+.auth {
+    margin-top: 128rpx;
+    display: flex;
+    flex-direction: column;
+    align-items: center
+}
+
+.auth-logo {
+    width: 200rpx;
+    height: 200rpx
+}
+
+.auth-logo image {
+    height: 100%;
+    width: 100%
+}
+
+.title {
+    margin-top: 20rpx;
+    font-size: 36rpx;
+    line-height: 56rpx
+}
+
+.merchant-name {
+    display: inline;
+    font-weight: 700
+}
+
+.sub-title {
+    margin-top: 8rpx;
+    font-size: 34rpx;
+    line-height: 52rpx
+}
+
+.button-area {
+    margin-top: 48rpx
+}
+
+.button-area button {
+    width: 622rpx;
+    height: 96rpx;
+    background: #C8FF0C;
+    border: 2rpx solid #C8FF0C;
+    font-size: 32rpx;
+    font-weight: 400;
+    line-height: 96rpx;
+    padding: 0;
+    border-radius: 48rpx;
+    color: #000000
+}
+
+.redirect {
+    margin-top: 272rpx;
+    display: flex;
+    flex-direction: column;
+    align-items: center
+}
+
+.loading {
+    height: 160rpx;
+    width: 160rpx;
+    margin-bottom: 32rpx
+}
+
+.loading image {
+    height: 100%;
+    width: 100%
+}
+
+.title {
+    font-size: 34rpx;
+    line-height: 52rpx
+}

+ 25 - 1
src/pages/mp_ecard_sdk/index/index.js

@@ -1 +1,25 @@
-import Log from"../constants/log.js";import{navigateToEid,reportStat}from"../utils/index";export default{data(){return{token:""}},onLoad(t){var{token:t,needJumpPage:e}=t;this.token=t,uni.reportLogToEid({token:t,event:Log.getIntoIndexPage,errMsg:`进入配置首页,token:${t},needJumpPage:`+e}),reportStat({module:"StartIndex",action:"enter"})},onUnload(){reportStat({module:"StartIndex",action:"leave"})},methods:{handleStart(){navigateToEid(this.token)}}};
+import Log from "../constants/log.js";
+import { navigateToEid, reportStat } from "../utils/index";
+export default {
+  data() {
+    return { token: "" };
+  },
+  onLoad(t) {
+    var { token: t, needJumpPage: e } = t;
+    (this.token = t),
+      uni.reportLogToEid({
+        token: t,
+        event: Log.getIntoIndexPage,
+        errMsg: `进入配置首页,token:${t},needJumpPage:` + e,
+      }),
+      reportStat({ module: "StartIndex", action: "enter" });
+  },
+  onUnload() {
+    reportStat({ module: "StartIndex", action: "leave" });
+  },
+  methods: {
+    handleStart() {
+      navigateToEid(this.token);
+    },
+  },
+};

+ 2 - 2
src/pages/mp_ecard_sdk/index/index.vue

@@ -1,10 +1,10 @@
 <template>
 	<view class="auth">
 		<view class="auth-logo">
-			<image src="https://faceid-h5-1254418846.file.myqcloud.com/mp_verify_sdk/images/ecard/logo.png" />
+			<image src="https://national-motion.oss-cn-beijing.aliyuncs.com/opt/upFiles/gOWlIFba9SbLdf159ac68faeda1b74a07bb1bc237ce1_1756113770004.png" />
 		</view>
 		<view class="title">
-			即将进入"eID数字身份"小程序
+			即将进入"全龄运动数字身份"小程序
 		</view>
 		<view class="button-area">
 			<button @click='handleStart' >

+ 0 - 1
src/pages/mp_ecard_sdk/main.js

@@ -97,7 +97,6 @@ function startEid(e) {
       (uni.VerifyEid_TOKEN = i),
       reportStat({ module: "EidStart", action: "enter" }),
       (uni.handleEidVerifyDone = (e) => {
-        console.log('赋值是否成功:', e);
         const o = e["token"];
         reportStat({ module: "EidEnd", action: "leave" }),
           t

+ 65 - 1
src/pages/mp_ecard_sdk/utils/http.js

@@ -1 +1,65 @@
-import Log from"../constants/log.js";const request=function(e,t){const{token:o="",url:a,method:r="POST",data:s,reTry:d,header:u={"Content-Type":"application/json"}}=e;try{uni.request({url:uni.eidBaseUrl+a,method:r,data:s,header:u,success(r){console.log("request success:",r),200===r.statusCode&&r.data?0==r.data.ErrorCode||0==r.data.code?t({ErrorCode:0,ErrorMsg:r.data.ErrorMsg,Data:r.data.Data||r.data.data,reTry:d}):t({ErrorCode:r.data.ErrorCode,ErrorMsg:r.data.ErrorMsg,Data:r.data.Data||r.data.data}):t({ErrorCode:-101,ErrorMsg:"请求错误,请稍后重试"})},fail(r){console.log("request error:",r),d&&d.tryCount&&0<d.tryCount?(d.tryCount--,uni.eidBaseUrl=uni.eidBackUpUrl,setTimeout(()=>{request(e,t)},d.retryDelay||0)):t({ErrorCode:-107,ErrorMsg:"request请求异常,请稍后重试"}),uni.reportLogToEid({token:o,event:Log.requestFail,errCode:"-1",errMsg:"requestFail 调用失败",data:{url:""+(uni.eidBaseUrl+a),err:r}})}})}catch(r){console.log("request error:",r),t({ErrorCode:-109,ErrorMsg:"request方法异常,请稍后重试"}),uni.reportLogToEid({token:o,event:Log.requestCatch,errCode:"-1",errMsg:"requestFail 调用失败",data:{url:""+(uni.eidBaseUrl+a),err:r}})}},$http=request;export{$http};
+import Log from "../constants/log.js";
+const request = function (e, t) {
+    const {
+      token: o = "",
+      url: a,
+      method: r = "POST",
+      data: s,
+      reTry: d,
+      header: u = { "Content-Type": "application/json" },
+    } = e;
+    try {
+      uni.request({
+        url: uni.eidBaseUrl + a,
+        method: r,
+        data: s,
+        header: u,
+        success(r) {
+          console.log("request success:", r),
+            200 === r.statusCode && r.data
+              ? 0 == r.data.ErrorCode || 0 == r.data.code
+                ? t({
+                    ErrorCode: 0,
+                    // ErrorMsg: r.data.ErrorMsg,
+                    Data: r.data.Data || r.data.data,
+                    reTry: d,
+                  })
+                : t({
+                    ErrorCode: r.data.ErrorCode,
+                    // ErrorMsg: r.data.ErrorMsg,
+                    Data: r.data.Data || r.data.data,
+                  })
+              : t({ ErrorCode: -101, ErrorMsg: "" });
+        },
+        fail(r) {
+          console.log("request error:", r),
+            d && d.tryCount && 0 < d.tryCount
+              ? (d.tryCount--,
+                (uni.eidBaseUrl = uni.eidBackUpUrl),
+                setTimeout(() => {
+                  request(e, t);
+                }, d.retryDelay || 0))
+              : t({ ErrorCode: -107, ErrorMsg: "request请求异常,请稍后重试" }),
+            uni.reportLogToEid({
+              token: o,
+              event: Log.requestFail,
+              errCode: "-1",
+              errMsg: "requestFail 调用失败",
+              data: { url: "" + (uni.eidBaseUrl + a), err: r },
+            });
+        },
+      });
+    } catch (r) {
+      console.log("request error:", r),
+        t({ ErrorCode: -109, ErrorMsg: "request方法异常,请稍后重试" }),
+        uni.reportLogToEid({
+          token: o,
+          event: Log.requestCatch,
+          errCode: "-1",
+          errMsg: "requestFail 调用失败",
+          data: { url: "" + (uni.eidBaseUrl + a), err: r },
+        });
+    }
+  },
+  $http = request;
+export { $http };

+ 61 - 1
src/pages/mp_ecard_sdk/utils/index.js

@@ -1 +1,61 @@
-import Log from"../constants/log";const navigateToEid=o=>{console.log("navigateToEid",uni.eidEnvVersion),reportStat({module:"showNavigateToEidDialog",action:"enter"}),(uni.enableEmbedded&&uni.openEmbeddedMiniProgram?uni.openEmbeddedMiniProgram:uni.navigateToMiniProgram)({appId:"wx0e2cb0b052a91c92",path:"pages/huiyan/index",envVersion:uni.eidEnvVersion,allowFullScreen:uni.allowFullScreen,extraData:{useHuiyan:!0,huiyanToken:o},success(e){console.log("success",e),uni.eidTokenToCallback=o,reportStat({module:"NavigateToEid",action:"confirm"}),reportStat({module:"showNavigateToEidDialog",action:"leave"})},fail(e){console.log("err",e),reportStat({module:"NavigateToEid",action:"cancel"})},complete(e){reportStat({module:"NavigateToEidDailog",action:"leave"}),uni.reportLogToEid({token:o,event:Log.navigateToEid,errMsg:e.errMsg})}})},reportStat=async({token:e=uni.VerifyEid_TOKEN,module:a,action:n})=>{if(console.log("reportStat",a,n),e)return console.log("上报埋点:",a,n),new Promise((o,i)=>{uni.request({url:uni.eidBaseUrl+"/api/report/EidEvents?token="+e,method:"POST",data:{token:e,eidSDKVersion:Log.version,enableEmbedded:uni.enableEmbedded,dataList:[{startTimestamp:Date.now(),module:a,action:n}]},success(e){o(e)},fail(e){i(e)}})})};export{navigateToEid,reportStat};
+import Log from "../constants/log";
+const navigateToEid = (o) => {
+    console.log("navigateToEid", uni.eidEnvVersion),
+      reportStat({ module: "showNavigateToEidDialog", action: "enter" }),
+      (uni.enableEmbedded && uni.openEmbeddedMiniProgram
+        ? uni.openEmbeddedMiniProgram
+        : uni.navigateToMiniProgram)({
+        appId: "wx0e2cb0b052a91c92",
+        path: "pages/huiyan/index",
+        envVersion: uni.eidEnvVersion,
+        allowFullScreen: uni.allowFullScreen,
+        extraData: { useHuiyan: !0, huiyanToken: o },
+        success(e) {
+          console.log("success", e),
+            (uni.eidTokenToCallback = o),
+            reportStat({ module: "NavigateToEid", action: "confirm" }),
+            reportStat({ module: "showNavigateToEidDialog", action: "leave" });
+        },
+        fail(e) {
+          console.log("err", e),
+            reportStat({ module: "NavigateToEid", action: "cancel" });
+        },
+        complete(e) {
+          reportStat({ module: "NavigateToEidDailog", action: "leave" }),
+            uni.reportLogToEid({
+              token: o,
+              event: Log.navigateToEid,
+              errMsg: e.errMsg,
+            });
+        },
+      });
+  },
+  reportStat = async ({
+    token: e = uni.VerifyEid_TOKEN,
+    module: a,
+    action: n,
+  }) => {
+    if ((console.log("reportStat", a, n), e))
+      return (
+        console.log("上报埋点:", a, n),
+        new Promise((o, i) => {
+          uni.request({
+            url: uni.eidBaseUrl + "/api/report/EidEvents?token=" + e,
+            method: "POST",
+            data: {
+              token: e,
+              eidSDKVersion: Log.version,
+              enableEmbedded: uni.enableEmbedded,
+              dataList: [{ startTimestamp: Date.now(), module: a, action: n }],
+            },
+            success(e) {
+              o(e);
+            },
+            fail(e) {
+              i(e);
+            },
+          });
+        })
+      );
+  };
+export { navigateToEid, reportStat };

+ 4 - 1
src/pages/mp_ecard_sdk/utils/validate.js

@@ -1 +1,4 @@
-function isValidateToken(e){return/^[a-zA-Z0-9-]{36}$/.test(e)}export default{isValidateToken:isValidateToken};
+function isValidateToken(e) {
+  return /^[a-zA-Z0-9-]{36}$/.test(e);
+}
+export default { isValidateToken: isValidateToken };

+ 4 - 4
src/utils/http/index.ts

@@ -122,7 +122,7 @@ export class HttpClient {
                 resolve(res as T)
               } else {
                 uni.showToast({
-                  title: res.message || '请求失败',
+                  title: res.message,
                   icon: 'none'
                 })
                 reject(res)
@@ -179,8 +179,8 @@ export class HttpClient {
 
 // 创建实例
 export const http = new HttpClient({
-  baseURL: 'http://192.168.1.34:8080/jeecg-boot/app',
-  // baseURL: 'http://192.168.1.166:8080/jeecg-boot/app',
+  // baseURL: 'http://192.168.1.34:8080/jeecg-boot/app',
+  baseURL: 'http://192.168.1.166:8080/jeecg-boot/app',
   // baseURL: 'http://192.168.0.11:8080/jeecg-boot/app',
   headers: {
     'Content-Type': 'application/json'
@@ -227,7 +227,7 @@ uni.addInterceptor('request', {
       }
     } else if (data.code !== 200) {
       uni.showToast({
-        title: data.message || '请求失败',
+        title: data.message,
         icon: 'none'
       })
       return {

+ 41 - 21
src/utils/util/index.ts

@@ -86,7 +86,17 @@ export class RouterUtils {
 	* @param path - 页面路径
 	*/
 	static to_page(path: string) {
-		if (!uni.getStorageSync('TOKEN')) return TipsUtils.tips_alert('请先登录~', false)
+		if (!uni.getStorageSync('TOKEN')) {
+			TipsUtils.tips_alert('请先登录~', true).then((res) => {
+				console.log(res,'res');
+				if (res.confirm) {
+					uni.switchTab({
+						url: '/pages/index/index'
+					})
+				}
+			})
+			return
+		}
 		uni.navigateTo({
 			url: path
 		})
@@ -123,32 +133,32 @@ export class DateUtils {
 	 * @param dateString - 日期字符串
 	 * @returns MM-DD 格式的日期字符串
 	 */
-static formatDateToMMDD(dateString: any) {
-	let str = dateString;
-	if (typeof str === 'string' && str.indexOf('T') === -1 && str.indexOf(' ') > 0) {
-		str = str.replace(' ', 'T');
+	static formatDateToMMDD(dateString: any) {
+		let str = dateString;
+		if (typeof str === 'string' && str.indexOf('T') === -1 && str.indexOf(' ') > 0) {
+			str = str.replace(' ', 'T');
+		}
+		const date = new Date(str);
+		const month = (date.getMonth() + 1).toString().padStart(2, '0');
+		const day = date.getDate().toString().padStart(2, '0');
+		return `${month}-${day}`;
 	}
-	const date = new Date(str);
-	const month = (date.getMonth() + 1).toString().padStart(2, '0');
-	const day = date.getDate().toString().padStart(2, '0');
-	return `${month}-${day}`;
-}
 
 	/**
 	 * 日期字符串转为HH:mm格式
 	 * @param dateString - 日期字符串
 	 * @returns HH:mm 格式的时间字符串
 	 */
-static formatDateToHHmm(dateString: any) {
-	let str = dateString;
-	if (typeof str === 'string' && str.indexOf('T') === -1 && str.indexOf(' ') > 0) {
-		str = str.replace(' ', 'T');
+	static formatDateToHHmm(dateString: any) {
+		let str = dateString;
+		if (typeof str === 'string' && str.indexOf('T') === -1 && str.indexOf(' ') > 0) {
+			str = str.replace(' ', 'T');
+		}
+		const date = new Date(str);
+		const hours = date.getHours().toString().padStart(2, '0');
+		const minutes = date.getMinutes().toString().padStart(2, '0');
+		return `${hours}:${minutes}`;
 	}
-	const date = new Date(str);
-	const hours = date.getHours().toString().padStart(2, '0');
-	const minutes = date.getMinutes().toString().padStart(2, '0');
-	return `${hours}:${minutes}`;
-}
 
 	/**
 	 * 
@@ -221,8 +231,18 @@ export const idCardHide = (card: any) => {
  * @returns 脱敏后的手机号字符串
  */
 export const phoneHide = (phone: any) => {
-	 if (!phone) return '';
+	if (!phone) return '';
 	const reg = /^(\d{3})\d{4}(\d{4})$/;
 	const maskedPhone = phone.replace(reg, '$1****$2');
 	return maskedPhone;
-}
+}
+
+/**
+ *修复HTML字符串中图片样式
+ * @param html - 富文本字符串
+ * @returns 
+ */
+export const fixImgStyle = (html: string) => {
+		if (!html) return html;
+		return html.replace(/<img/gi, '<img style="max-width:100%;height:auto;display:block;"');
+	};

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini