Commit 06ad052a authored by lvtz's avatar lvtz

fix

parent 3ad5f6bd
var app = getApp();
import { pointsGoodsGet } from "../../../service/business/points.js";
import { getSubjectTemplates } from "../../../service/business/common.js";
Page({
data: {
localImageRoot: "../../../images/",
......@@ -21,7 +21,6 @@ Page({
});
this.getTemplateList("init");
},
onShow: function() {},
onReachBottom: function() {
this.getTemplateList("up");
},
......@@ -35,10 +34,8 @@ Page({
this.setData({
listLoading: true
});
pointsGoodsGet({
page: this.data.page,
perPage: this.data.perPage,
school_id: 449
getSubjectTemplates({
subject_type: 1
})
.then(res => {
const { code, data } = res;
......@@ -71,46 +68,36 @@ Page({
}
break;
case "down": // 页面下拉刷新
this.setData(
{
templateList: [data.list]
},
() => {
if (
this.data.total >
this.caculateArrLength(this.data.templateList)
) {
this.data.page = this.data.page + 1;
} else {
// 没有更多了
this.setData({
hasmore: false
});
}
}
);
this.setData({
templateList: [data.list]
});
if (
this.data.total > this.caculateArrLength(this.data.templateList)
) {
this.data.page = this.data.page + 1;
} else {
// 没有更多了
this.setData({
hasmore: false
});
}
wx.stopPullDownRefresh();
break;
case "up": // 页面上拉刷新
let list = this.data.templateList;
this.setData(
{
[`templateList[${this.data.page - 1}]`]: data.list
},
() => {
if (
this.data.total >
this.caculateArrLength(this.data.templateList)
) {
this.data.page = this.data.page + 1;
} else {
// 没有更多了
this.setData({
hasmore: false
});
}
}
);
this.setData({
[`templateList[${this.data.page - 1}]`]: data.list
});
if (
this.data.total > this.caculateArrLength(this.data.templateList)
) {
this.data.page = this.data.page + 1;
} else {
// 没有更多了
this.setData({
hasmore: false
});
}
break;
default:
break;
......@@ -141,20 +128,14 @@ Page({
},
bindTemplateSelected(e) {
const { id } = e.currentTarget.dataset;
console.log(id);
wx.showModal({
title: "提示一下",
content: `选择的id是${id},然后没有然后`,
showCancel: false,
confirmColor: "#64B8F5"
wx.showToast({
title: `模板id是${id}`,
icon: 'none'
});
},
createCustom() {
wx.showModal({
title: "提示",
content: `不知道跳哪去`,
showCancel: false,
confirmColor: "#64B8F5"
});
wx.navigateTo({
url: `/business/pages/themeeditor/index?id=0&tid=0&sid=3`
})
}
});
......@@ -3,7 +3,8 @@
<view class="list clearfix" wx:if="{{!emptyPage}}">
<block wx:for="{{templateList}}" wx:for-item="bigitem" wx:key="bigindex" wx:for-index="bigindex">
<view class="item" wx:for="{{bigitem}}" wx:for-item="item" data-id="{{item.id}}" wx:key="index" bindtap="bindTemplateSelected">
<image class="item-cover" src="{{filter.imagify(item.cover)}}" mode="aspectFill"></image>
<image class="item-cover" src="{{filter.imagify(item.cover)}}" mode="aspectFill" wx:if="{{item.cover}}"></image>
<image class="item-cover" src="https://cdn.img.shangjiadao.cn/qingxiao/daka/images/2c/sharemoretheme/newunlockbg.png" mode="aspectFill" wx:else></image>
<view class="item-title">{{item.title}}</view>
</view>
</block>
......
......@@ -157,7 +157,7 @@ Page({
}else{
this.setData({
nickname: visitor && visitor.userInfo && visitor.userInfo.nickName || '',
avatarUrl: visitor && visitor.userInfo && visitor.userInfo.avatarUrl || 'source/images/daka2b/default/logo.png',
avatarUrl: visitor && visitor.userInfo && visitor.userInfo.avatarUrl || 'qingxiao/daka/images/common/empty/avatar_user',
})
}
})
......
import constants from "../../../constants/constants.js";
import {
getInfo,
setInfo,
getCategory,
setSchoolInfo,
schoolDel
} from "../../../service/business/shopeditor.js";
import { formIdCreate, getMemberMe } from "../../../service/common.js";
import {
nicknameStore,
schoolDetailGet
} from "../../../service/business/common.js";
import {
wxAuthorize,
wxChooseLocation,
wxChooseImage,
wxUploadFile,
wxOpenSetting
} from "../../../utilities/wxApi.js";
import { bOssAccess } from "../../../service/common.js";
import {
getRandomFilename,
imagify,
LocalStorage
} from "../../../utilities/index.js";
import permissionUtils from "../../../utilities/permission.js";
var QQMapWX = require("../../../js/qqmap-wx-jssdk.min.js");
var qqmapsdk = new QQMapWX({
key: "XSZBZ-5LHCV-5I2P7-UQHPW-6456F-JBB3B" // 必填
});
var app = getApp();
Page({
data: {
......@@ -21,6 +36,8 @@ Page({
localImageRoot: "../../../images/",
imageVersion: app.globalData.imageVersion,
sid: 0,
nickname: "",
avatarUrl: "qingxiao/daka/images/common/empty/avatar_user.png",
industrys: ["单校区", "连锁", "品牌总部"],
industryIndex: -1,
allSubject: ["书法", "美术", "舞蹈", "乐器", "艺术", "英语"], // 所有科目
......@@ -33,16 +50,16 @@ Page({
latitude: "",
location_address: "",
address: "",
tel: "",
logo: "qingxiao/daka/images/2c/common/logologo.png",
type: -1,
category: "",
qr_code: ""
tel_phone: "",
province: "",
city: "",
area: "",
logo: "qingxiao/daka/images/2c/common/logologo.png"
},
mobileArr: [""],
submitting: false,
callBackSchoolId: 0,
from: 0, // 页面来源 1登录页面 2注册页面 3 校区管理的校区列表编辑按钮 4 校区详情页面的编辑按钮
from: 0 // 页面来源 1登录页面 2注册页面 3 校区管理的校区列表编辑按钮 4 校区详情页面的编辑按钮
},
onLoad: function(options) {
const visitor = LocalStorage.getItem("visitor");
......@@ -56,69 +73,15 @@ Page({
});
this.getCategory();
if (this.data.sid == 0) {
return;
}
wx.showLoading({
title: "数据加载中..."
});
schoolDetailGet({
id: this.data.sid,
school_id: this.data.sid
})
.then(res => {
wx.hideLoading();
if (res.code == 200) {
const { data } = res;
if (data) {
// 是编辑状态
const {
address,
created_at,
latitude,
location_address,
longitude,
title,
tel_phone,
logo,
type,
category,
qr_code
} = data;
let selectedArr = [];
let selectedSubjectStyle = {};
for (let i = 0; i < category.length; i++) {
// selectedArr.push(clock_category_address[i].category_id)
selectedSubjectStyle[category[i]] = true;
}
this.setData({
mobileArr: tel_phone ? JSON.parse(tel_phone) : [""],
selectedSubjectStyle: selectedSubjectStyle,
selectedSubject: category,
"params.title": title,
"params.longitude": longitude,
"params.latitude": latitude,
"params.address": address || "",
"params.location_address": location_address,
"params.addressname": "",
"params.logo": logo || "qingxiao/daka/images/2c/pclogin/logo.png",
"params.type": Number(type) - 1
});
} else {
// 是新建状态
}
}
})
.catch(() => {
wx.hideLoading();
});
},
onReady: function() {
// Do something when page ready.
},
onShow: function() {
cropperload(e) {
console.log("cropper初始化完成");
},
onShow: function() {},
//选择学科
selectSubject(event) {
const subject = event.currentTarget.dataset.activeItem;
......@@ -154,12 +117,136 @@ Page({
})
.catch(e => {});
},
proMainImgUpload(e) {
let access = {};
let filename = "";
const { type } = e.currentTarget.dataset;
bOssAccess({
school_id: this.data.sid
})
.then(acc => {
access = acc.data;
return wxChooseImage({});
})
.then(res => {
const { tempFiles } = res;
filename = `${access.dir}${getRandomFilename(tempFiles[0].path)}`;
return wxUploadFile({
url: access.host,
formData: {
key: filename,
policy: access.policy,
OSSAccessKeyId: access.accessid,
signature: access.signature,
callback: access.callback,
success_action_status: "200"
},
filePath: tempFiles[0].path,
name: "file"
});
})
.then(res => {
const { data } = res;
if (data == '{"status":"ok"}') {
this.setData({
uploadType: type,
cropperSrc: imagify(filename, "image/resize,w_1280/format,jpg"),
"cropperOpt.width": 300,
"cropperOpt.height": 300,
showCropper: true,
containerheight: "100vh"
});
} else {
wx.hideLoading();
wx.showModal({
title: "提示",
content: "上传失败",
showCancel: false
});
}
})
.catch(err => {});
},
surecropper() {
this.cropper = this.selectComponent("#image-cropper");
this.cropper._click();
},
cancelcropper() {
this.setData({
showCropper: false,
cropperSrc: "",
containerheight: ""
});
},
clickcut(e) {
let filepath = e.detail.url;
this.setData({
showCropper: false,
cropperSrc: "",
containerheight: ""
});
let filename = "";
bOssAccess({
school_id: this.data.sid
})
.then(acc => {
return acc.data;
})
.then(access => {
filename = `${access.dir}${getRandomFilename(filepath)}`;
wx.showLoading({
title: "图片上传中"
});
return wxUploadFile({
url: access.host,
formData: {
key: filename,
policy: access.policy,
OSSAccessKeyId: access.accessid,
signature: access.signature,
callback: access.callback,
success_action_status: "200"
},
filePath: filepath,
name: "file"
});
})
.then(res => {
const { data } = res;
if (data == '{"status":"ok"}') {
wx.showToast({
title: "上传成功"
});
this.setData({
showCropper: false
});
this.mycropper = null;
this.setData({
"params.logo": filename
});
} else {
wx.hideLoading();
wx.showModal({
title: "提示",
content: "上传失败",
showCancel: false
});
}
})
.catch(err => {});
},
titleInput(e) {
const { value } = e.detail;
this.setData({
"params.title": value
});
},
phoneInput(e) {
const { value } = e.detail;
this.setData({
"params.tel_phone": value
});
},
addressSelect() {
wxAuthorize("scope.userLocation")
.then(() => {
......@@ -176,12 +263,26 @@ Page({
});
return;
}
this.setData({
"params.longitude": value.longitude,
"params.latitude": value.latitude,
"params.location_address": `${value.address}${value.name}`,
"params.address": `${value.address}${value.name}`,
"params.addressname": value.name
var _this = this;
qqmapsdk.reverseGeocoder({
location: `${value.latitude},${value.longitude}` || "",
get_poi: 0, //是否返回周边POI列表:1.返回;0不返回(默认),非必须
success: function(res) {
console.log(res, "结果");
var res = res.result;
_this.setData({
"params.longitude": value.longitude,
"params.latitude": value.latitude,
"params.location_address": `${res.address_component.province}${res.address_component.city}${res.address_component.district}${value.name}`,
"params.address": value.name,
"params.province": res.address_component.province,
"params.city": res.address_component.city,
"params.area": res.address_component.district
});
},
fail: function(error) {
console.error(error, "err");
}
});
} else {
}
......@@ -205,67 +306,58 @@ Page({
addressInput(e) {
const { value } = e.detail;
this.setData({
"params.addressname": value
"params.address": value
});
},
industrySelect(e) {
const { value } = e.detail;
const that = this;
that.setData({
"params.type": value
});
},
save(e) {
wx.redirectTo({
url: "/business/pages/organizationalmgt/qxknow"
url: `/business/pages/organizationalmgt/qxknow?sid=3`
});
return;
let saveParams = this.objValueTrim(this.data.params);
saveParams.type = Number(saveParams.type) + 1;
saveParams.category = this.data.selectedSubject.join(",");
if (!saveParams.logo) {
if (!saveParams.title) {
wx.showModal({
title: "提示",
content: "请上传机构LOGO",
content: "请输入学校名称",
showCancel: false,
confirmColor: "#66B8F4"
});
return;
}
if (!saveParams.title) {
if (saveParams.title.length > 30) {
wx.showModal({
title: "提示",
content: "机构名称不能为空",
content: "学校名称不能超过30个字",
showCancel: false,
confirmColor: "#66B8F4"
});
return;
}
if (saveParams.title.length > 30) {
if (!saveParams.tel_phone) {
wx.showModal({
title: "提示",
content: "机构名称不能超过30个字",
content: "请输入电话号码",
showCancel: false,
confirmColor: "#66B8F4"
});
return;
}
if (!saveParams.category) {
if (!saveParams.longitude) {
wx.showModal({
title: "提示",
content: "请选择机构类型",
content: "请选择学校地址",
showCancel: false,
confirmColor: "#66B8F4"
});
return;
}
if (!saveParams.longitude) {
if (!saveParams.category) {
wx.showModal({
title: "提示",
content: "请选择机构地址",
content: "请选择学校类型",
showCancel: false,
confirmColor: "#66B8F4"
});
......@@ -279,13 +371,14 @@ Page({
submitting: true
});
wx.showLoading({
title: "保存中...",
title: "信息保存中...",
mask: true
});
saveParams.sort = 0;
// saveParams.sort = 0;
saveParams.id = this.data.sid;
saveParams.school_id =
this.data.sid != 0 ? this.data.sid : this.data.school_id;
// saveParams.school_id =
// this.data.sid != 0 ? this.data.sid : this.data.school_id;
console.log(saveParams, "提交参数");
setSchoolInfo(saveParams)
.then(res => {
this.setData({
......@@ -294,23 +387,14 @@ Page({
wx.hideLoading();
if (res.code == 200) {
// 成功的操作
if (this.data.sid == 0) {
// 新增的操作
LocalStorage.setItem("dakarole", 1);
permissionUtils.myMenulistGet(res.data.id);
wx.reLaunch({
url: `/business/pages/classmgt/index?sid=${res.data.id}&newcreate=1`
});
} else {
wx.showToast({
title: "保存成功",
success() {
wx.navigateBack({
delta: 1 // 回退前 delta(默认为1) 页面
});
}
});
}
wx.showToast({
title: "保存成功",
success() {
wx.redirectTo({
url: `/business/pages/organizationalmgt/qxknow?sid=${res.data.id}`
});
}
});
}
})
.catch(e => {
......
......@@ -2,6 +2,7 @@
"navigationBarTitleText": "添加学校信息",
"usingComponents": {
"expiredTip": "../../components/expiredTip",
"permission-box":"../../components/permissionbox"
"permission-box":"../../components/permissionbox",
"imagecropper": "../../../components/imagecropper"
}
}
\ No newline at end of file
<wxs src="../../../filter/index.wxs" module="filter" />
<view class="container">
<view class="page_topline"></view>
<view class="container {{showCropper? 'containerDisabledScroll':''}}">
<view class="box" style="border-bottom: 16rpx solid #f7f7f9;" wx:if="{{sid!=0}}">
<view class="line-item">
<view class="item-label" style="flex: 1;">个人头像</view>
<view class="right" bindtap="updateAvatar" style="flex: none;">
<image class="logo" src="{{filter.imagify(avatarUrl, 'image/resize,w_640/format,jpg/quality,q_50')}}"></image>
<!-- <image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image> -->
</view>
</view>
<view class="line-item">
<view class="item-label">个人昵称</view>
<view class="right">
<view class="iteminput" value="" bindtap="updateNickname">{{nickname?nickname:'输入昵称'}}</view>
<!-- <image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image> -->
</view>
</view>
</view>
<permission-box cinfigid="{{sid==0 || dakarole==1? 0: 700}}">
<view slot="menubtn">
<view class="box">
<view class="line-item" wx:if="{{sid!=0}}">
<view class="item-label" style="flex: 1;">学校LOGO <text>(建议尺寸:120*120)</text></view>
<view class="right" bindtap="proMainImgUpload" data-type="schoollogo" style="flex: none;">
<image class="logo" src="{{filter.imagify(params.logo, 'image/resize,w_640/format,jpg/quality,q_50')}}"></image>
<!-- <image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image> -->
</view>
</view>
<view class="line-item">
<view class="item-label">学校名称</view>
<view class="right">
......@@ -14,7 +38,7 @@
<view class="line-item">
<view class="item-label">联系电话</view>
<view class="right">
<input type="text" placeholder-class="placeholderclass" class="iteminput" maxlength="11" value="" bindinput="" placeholder="请输入学校联系电话"></input>
<input type="text" placeholder-class="placeholderclass" class="iteminput" maxlength="11" value="{{params.tel_phone}}" bindinput="phoneInput" placeholder="请输入学校联系电话"></input>
<!-- <image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image> -->
</view>
</view>
......@@ -22,14 +46,14 @@
<view class="item-label">地址</view>
<view class="right" bindtap="addressSelect">
<image class="icon-address" src="{{localImageRoot}}2b/organizationalmgt/icon_address.png?{{imageVersion}}"></image>
<view class="iteminput">{{params.location_address ? params.location_address : '请选择地址'}}</view>
<view class="iteminput">{{params.province ? params.province+params.city+params.area : '请选择地址'}}</view>
<!-- <image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image> -->
</view>
</view>
<view class="line-item">
<view class="item-label">详细地址</view>
<view class="right">
<textarea class="iteminput" placeholder-class="placeholderclass" bindinput="addressInput" autoHeight="true" value="{{params.addressname}}" placeholder="所在街道,楼牌号等"></textarea>
<textarea class="iteminput" placeholder-class="placeholderclass" bindinput="addressInput" autoHeight="true" value="{{params.address}}" placeholder="所在街道,楼牌号等"></textarea>
<!-- <image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image> -->
</view>
</view>
......@@ -51,4 +75,21 @@
</view>
</permission-box>
</view>
<expiredTip/>
\ No newline at end of file
<expiredTip/>
<view class="cropperdialog" wx:if="{{showCropper}}">
<imagecropper
id="image-cropper"
limit_move="{{cropperOpt.limit_move}}"
disable_rotate="{{cropperOpt.disable_rotate}}"
width="{{cropperOpt.width}}"
height="{{cropperOpt.height}}"
imgSrc="{{cropperSrc}}"
bindload="cropperload"
bindimageload="loadimage"
bindtapcut="clickcut"
></imagecropper>
<view class="cropperoperate">
<view class="" bindtap="cancelcropper">取消</view>
<view class="" bindtap="surecropper">确认</view>
</view>
</view>
\ No newline at end of file
......@@ -3,14 +3,12 @@ page {
height: 100%;
}
.container {
padding-bottom: 100rpx;
border-top: 1px solid #eee;
padding-bottom: 150rpx;
}
.placeholderclass {
color: #939393;
font-size: 26rpx;
}
.box {
background: #fff;
padding: 0 24rpx;
......@@ -50,7 +48,7 @@ page {
align-items: center;
flex: 1;
}
.icon-address{
.icon-address {
width: 24rpx;
height: 28rpx;
margin-right: 10rpx;
......@@ -59,7 +57,13 @@ page {
width: 100%;
color: #939393;
font-size: 26rpx;
word-break: break-all
word-break: break-all;
}
.line-item .right .logo {
width: 100rpx;
height: 100rpx;
z-index: 1;
border-radius: 50%;
}
.line-item .right .arrowsmall {
width: 12rpx;
......@@ -95,8 +99,8 @@ page {
position: relative;
}
.selectd-item-box-inner {
border: 1px solid #16B0FD !important;
color: #16B0FD !important;
border: 1px solid #16b0fd !important;
color: #16b0fd !important;
}
.item-box-inner .icon-select {
position: absolute;
......@@ -119,12 +123,12 @@ page {
.submitbtn {
width: 100%;
height: 90rpx;
background: #16B0FD;
background: #16b0fd;
font-size: 32rpx;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
border-radius: 49rpx;
box-shadow: 0 0 20rpx rgba(22,176,253,.8);
box-shadow: 0 0 20rpx rgba(22, 176, 253, 0.8);
}
import {
LocalStorage
} from "../../../utilities/index.js";
var app = getApp();
Page({
data: {
imgList: [
......@@ -7,10 +11,16 @@ Page({
"https://cdn.img.shangjiadao.cn/qingxiao/bargain/images/case/gif2.gif",
"https://cdn.img.shangjiadao.cn/qingxiao/bargain/images/case/gif3.gif",
"https://cdn.img.shangjiadao.cn/qingxiao/bargain/images/case/pic_03.png"
]
],
sid: 3
},
onLoad: function(options) {},
onLoad: function(options) {
const { sid } = options;
this.setData({
sid: sid || 3
});
},
onShow: function() {},
// 去创建
......@@ -21,11 +31,9 @@ Page({
},
// 跳过
bindJumpEvent () {
wx.showModal({
title: '提示',
content: '跳过',
showCancel: false,
confirmColor: '#16B0FD'
LocalStorage.setItem('dakarole', 1);
wx.reLaunch({
url: `/business/pages/deskcenter/index?sid=${this.data.sid}`,
})
},
});
......@@ -376,7 +376,7 @@ const apis = {
accountList: `${api}member/erp/account/index`,//账号下的所有身份
memberMe: `${api}member/me`,//获取当前身份
getschooluuid: `${api}member/school_uuid`,// 简单报名(加入学校)获取uuid
subjectTemplates: `${api}member/subject_templates`,//主题模板列表
},
shopeditor: {
infoGet: `${api}member/clock/address/get`,
......
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 = { 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) { 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) }, 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 }, 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 }, 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 }, 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 }) }, 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 () { } }, 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 }, checkKeyword(param) { return !this.checkParamKeyEmpty(param, 'keyword') }, 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 }, buildErrorConfig(errCode, errMsg) { return { status: errCode, message: errMsg } }, 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) { 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) } }, 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 { constructor(options) { if (!options.key) { throw Error('key值不能为空') } this.key = options.key }; 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) }; 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")) } }; 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) }; 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')) }; 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')) }; 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')) }; 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) } }; direction(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'to')) { return } var requestParam = { output: 'json', key: that.key }; if (typeof options.to == 'string') { requestParam.to = options.to } else { requestParam.to = options.to.latitude + ',' + options.to.longitude } var SET_URL_DIRECTION = null; 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;
\ No newline at end of file
......@@ -430,6 +430,19 @@ function getUuid(data){
errorresolve: 1,
})
}
// 主题模板列表
function getSubjectTemplates(data){
return wxRequest({
role: '2b',
url: `${apis.business.common.subjectTemplates}`,
method: 'GET',
data,
errorresolve: 1,
// needToken: true
})
}
export {
nicknameGet,
bOssAccess,
......@@ -472,5 +485,6 @@ export {
analyzeclasshourGet,
analyzeclasscourseGet,
analyzeDashboardGet,
getUuid
getUuid,
getSubjectTemplates
}
\ No newline at end of file
......@@ -26,7 +26,6 @@ import {
bTokenExchange
} from '../service/common.js'
import {
formIdCreate,
getActivities,
activityLog,
getMember
......@@ -303,13 +302,6 @@ Page({
}
})
},
formIdCreate(e) {
const { formId } = e.detail;
formIdCreate({
formId
})
},
// goMyLikes() {
// wx.navigateTo({
......
......@@ -41,9 +41,6 @@
<!-- <view class="right-item" bindtap="toSetting" wx:if="{{sid != 0}}">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="icon" src="{{imageRoot}}2c/optimize/icon_setting.png?{{imageVersion}}"></image>
</view> -->
</view>
......@@ -71,9 +68,6 @@
<view class="menu-box">
<view class="menu-item" bindtap="goMytask">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_zuoye.png?{{imageVersion}}"></image>
<text class="title">我的作业</text>
<text class="desc">待提交的作业</text>
......@@ -81,45 +75,30 @@
</view>
<view class="menu-item" bindtap="goMyCourses">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_mycourse.png?{{imageVersion}}"></image>
<text class="title">我的课程</text>
<text class="desc">购买的课程</text>
</view>
<view class="menu-item" bindtap="goMySchedule">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_myschedule.png?{{imageVersion}}"></image>
<text class="title">我的课表</text>
<text class="desc">上课时间在这里</text>
</view>
<view class="menu-item" bindtap="goGrowthRecord">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_growthrecord.png?{{imageVersion}}"></image>
<text class="title">我的成长</text>
<text class="desc">往期作品在这里</text>
</view>
<view class="menu-item" bindtap="goClassRecord">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_courserecord.png?{{imageVersion}}"></image>
<text class="title">上课记录</text>
<text class="desc">课消记录</text>
</view>
<view class="menu-item" bindtap="goMyAchievement">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_glory.png?{{imageVersion}}"></image>
<text class="title">我的荣誉</text>
<text class="desc">证书勋章在这里</text>
......@@ -136,9 +115,6 @@
</navigator>
<view class="menu-item" wx:if="{{cSchoolTotal > 0}}" bindtap="exchangeSchool">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_exchangeschool.png?{{imageVersion}}"></image>
<text class="title">切换校区</text>
<text class="desc"></text>
......@@ -146,9 +122,6 @@
<view class="menu-item" bindtap="loginToManager">
<loginbtn loginCode="{{loginCode}}"/>
<form report-submit="true" bindsubmit="formIdCreate" class="createidform">
<button form-type="submit" class="createidbutton">生成form</button>
</form>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_tologin.png?{{imageVersion}}"></image>
<text class="title">机构登录</text>
<text class="desc">老师/校长在这里登录</text>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment