找回后的代码修改
This commit is contained in:
parent
7fe51944d0
commit
8a10703e14
7
app.js
7
app.js
@ -5,9 +5,10 @@ App({
|
||||
restAjax: restAjax,
|
||||
http: request,
|
||||
apis: restAjax.apis,
|
||||
urls:request.apis,
|
||||
urls: request.apis,
|
||||
baseUrls: restAjax.baseUrl,
|
||||
onLaunch() {
|
||||
var _self = this;
|
||||
this.globalData.windowHeight = wx.getSystemInfoSync().windowHeight
|
||||
//设置状态栏
|
||||
wx.getSystemInfo({
|
||||
@ -22,7 +23,9 @@ App({
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
//获取手机屏幕高度、宽度
|
||||
_self.globalData.windowHeight = wx.getSystemInfoSync().windowHeight
|
||||
_self.globalData.windowWidth = wx.getSystemInfoSync().windowWidth
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
|
4
app.json
4
app.json
@ -1,5 +1,4 @@
|
||||
{
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
@ -97,6 +96,7 @@
|
||||
"common/corpperimg/cropperimg"
|
||||
]
|
||||
}],
|
||||
"requiredPrivateInfos": ["chooseLocation","getLocation"]
|
||||
"requiredPrivateInfos": ["chooseLocation","getLocation"],
|
||||
"plugins": {"chooseLocation":{"version": "1.0.10","provider": "wx76a9a06e5b4e693e"}}
|
||||
|
||||
}
|
@ -1,155 +1,224 @@
|
||||
var e = require("../../@babel/runtime/helpers/defineProperty"), t = getApp();
|
||||
|
||||
require("../../utils/util.js");
|
||||
const app = getApp()
|
||||
|
||||
Page({
|
||||
data: {
|
||||
preview: "",
|
||||
showHide: !1,
|
||||
isLoading: !1,
|
||||
isMain: "",
|
||||
cardPersonId: "",
|
||||
preview: '',
|
||||
showHide: false,
|
||||
isLoading: false,
|
||||
isMain: '',
|
||||
cardPersonId: '',
|
||||
choose_index: 0,
|
||||
active: 0,
|
||||
cardUrl: t.baseUrls.baseCardUrl,
|
||||
cardUrl: app.baseUrls.baseCardUrl,
|
||||
areaList: [],
|
||||
cardInfo: {},
|
||||
bgImg: "",
|
||||
bgImg: '',
|
||||
fontFamilyList: [],
|
||||
useFontFamily: "",
|
||||
cardId: "",
|
||||
cardHeight: "",
|
||||
shareTicket: "",
|
||||
encryptedData: "",
|
||||
iv: "",
|
||||
isFromOut: !1,
|
||||
token: "",
|
||||
oldToken: "",
|
||||
fromMine: !1,
|
||||
imgTempSrc: "",
|
||||
useFontFamily: '',
|
||||
cardId: '',
|
||||
cardHeight: '',
|
||||
shareTicket: '',
|
||||
encryptedData: '',
|
||||
iv: '',
|
||||
isFromOut: false,
|
||||
token: '',
|
||||
oldToken: '',
|
||||
fromMine: false,
|
||||
imgTempSrc: '',
|
||||
currentIndex: 0,
|
||||
windowWidth: t.globalData.windowWidth,
|
||||
windowWidth: app.globalData.windowWidth,
|
||||
scale: 1,
|
||||
pageType: null
|
||||
},
|
||||
tabChange: function(e) {
|
||||
tabChange: function (e) {
|
||||
this.setData({
|
||||
active: e.detail
|
||||
}), 0 == this.data.active || (1 == this.data.active ? 1 == t.globalData.servicePageType ? wx.redirectTo({
|
||||
url: "/pages/shop/catalog/bannerlist/bannerlist"
|
||||
}) : 2 == t.globalData.servicePageType ? wx.redirectTo({
|
||||
url: "/pages/shop/catalog/column/column"
|
||||
}) : 3 == t.globalData.servicePageType ? wx.redirectTo({
|
||||
url: "/pages/shop/catalog/list/list"
|
||||
}) : 4 == t.globalData.servicePageType && wx.redirectTo({
|
||||
url: "/pages/shop/bespeak/bespeak"
|
||||
}) : wx.redirectTo({
|
||||
url: "/pages/mine/index/index"
|
||||
}));
|
||||
})
|
||||
if (this.data.active == 0) {
|
||||
} else if (this.data.active == 1) {
|
||||
// 服务
|
||||
if (app.globalData.servicePageType == 1) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/shop/catalog/bannerlist/bannerlist',
|
||||
})
|
||||
} else if (app.globalData.servicePageType == 2) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/shop/catalog/column/column',
|
||||
})
|
||||
} else if (app.globalData.servicePageType == 3) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/shop/catalog/list/list',
|
||||
})
|
||||
} else if (app.globalData.servicePageType == 4) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/shop/bespeak/bespeak',
|
||||
})
|
||||
}
|
||||
} else {
|
||||
//我的
|
||||
wx.redirectTo({
|
||||
url: '/pages/mine/index/index',
|
||||
})
|
||||
}
|
||||
// this.setData({
|
||||
// active: e.detail
|
||||
// }), 0 == this.data.active || (1 == this.data.active ? 1 == app.globalData.servicePageType ? wx.redirectTo({
|
||||
// url: "/pages/shop/catalog/bannerlist/bannerlist"
|
||||
// }) : 2 == app.globalData.servicePageType ? wx.redirectTo({
|
||||
// url: "/pages/shop/catalog/column/column"
|
||||
// }) : 3 == app.globalData.servicePageType ? wx.redirectTo({
|
||||
// url: "/pages/shop/catalog/list/list"
|
||||
// }) : 4 == app.globalData.servicePageType && wx.redirectTo({
|
||||
// url: "/pages/shop/bespeak/bespeak"
|
||||
// }) : wx.redirectTo({
|
||||
// url: "/pages/mine/index/index"
|
||||
// }));
|
||||
},
|
||||
createMyCard: function() {
|
||||
var e = this;
|
||||
createMyCard: function () {
|
||||
var self = this
|
||||
wx.showLoading({
|
||||
title: "生成中...",
|
||||
success: function() {
|
||||
e.setData({
|
||||
isLoading: !0
|
||||
});
|
||||
title: '生成中...',
|
||||
success() {
|
||||
self.setData({
|
||||
isLoading: true
|
||||
})
|
||||
}
|
||||
});
|
||||
for (var a = {
|
||||
pictureTemplateId: e.data.cardId,
|
||||
})
|
||||
var content = {
|
||||
pictureTemplateId: self.data.cardId,
|
||||
cardTemplateUseAreaList: []
|
||||
}, r = 0; r < e.data.areaList.length; r++) if ("1" != e.data.areaList[r].templateAreaType) {
|
||||
var o = {
|
||||
}
|
||||
for (let i = 0; i < self.data.areaList.length; i++) {
|
||||
if (self.data.areaList[i].templateAreaType != '1') {
|
||||
var info = {
|
||||
cardTemplateUseId: "",
|
||||
picturesTemplateAreaId: e.data.areaList[r].picturesTemplateAreaId,
|
||||
templateAreaFile: e.data.areaList[r].templateAreaFile,
|
||||
templateAreaFontValue: e.data.areaList[r].templateAreaFontValue
|
||||
};
|
||||
a.cardTemplateUseAreaList.push(o);
|
||||
picturesTemplateAreaId: self.data.areaList[i].picturesTemplateAreaId,
|
||||
templateAreaFile: self.data.areaList[i].templateAreaFile,
|
||||
templateAreaFontValue: self.data.areaList[i].templateAreaFontValue
|
||||
}
|
||||
t.http.post(t.urls.creatCard, {
|
||||
data: a,
|
||||
content.cardTemplateUseAreaList.push(info)
|
||||
}
|
||||
}
|
||||
app.http.post(app.urls.creatCard, {
|
||||
data: content,
|
||||
header: {
|
||||
token: t.globalData.token
|
||||
token: app.globalData.token
|
||||
}
|
||||
}).then(function(t) {
|
||||
console.log(t), "200" == t.statusCode && e.getMineCardList();
|
||||
}).catch(function(t) {
|
||||
e.setData({
|
||||
isLoading: !1,
|
||||
showHide: !1
|
||||
});
|
||||
});
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
// "200" == t.statusCode && e.getMineCardList();
|
||||
if (res.statusCode == '200') {
|
||||
self.getMineCardList();
|
||||
}
|
||||
}).catch(res => {
|
||||
console.log(res)
|
||||
self.setData({
|
||||
isLoading: false,
|
||||
showHide: false
|
||||
})
|
||||
})
|
||||
// var e = this;
|
||||
// wx.showLoading({
|
||||
// title: "生成中...",
|
||||
// success: function () {
|
||||
// e.setData({
|
||||
// isLoading: !0
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// for (var a = {
|
||||
// pictureTemplateId: e.data.cardId,
|
||||
// cardTemplateUseAreaList: []
|
||||
// }, r = 0; r < e.data.areaList.length; r++) if ("1" != e.data.areaList[r].templateAreaType) {
|
||||
// var o = {
|
||||
// cardTemplateUseId: "",
|
||||
// picturesTemplateAreaId: e.data.areaList[r].picturesTemplateAreaId,
|
||||
// templateAreaFile: e.data.areaList[r].templateAreaFile,
|
||||
// templateAreaFontValue: e.data.areaList[r].templateAreaFontValue
|
||||
// };
|
||||
// a.cardTemplateUseAreaList.push(o);
|
||||
// }
|
||||
// app.http.post(t.urls.creatCard, {
|
||||
// data: a,
|
||||
// header: {
|
||||
// token: t.globalData.token
|
||||
// }
|
||||
// }).then(function (t) {
|
||||
// console.log(t), "200" == t.statusCode && e.getMineCardList();
|
||||
// }).catch(function (t) {
|
||||
// e.setData({
|
||||
// isLoading: !1,
|
||||
// showHide: !1
|
||||
// });
|
||||
// });
|
||||
},
|
||||
getMineCardList: function() {
|
||||
getMineCardList: function () {
|
||||
var e = this;
|
||||
t.http.get(t.urls.getMyCard, {
|
||||
app.http.get(app.urls.getMyCard, {
|
||||
header: {
|
||||
token: t.globalData.token
|
||||
token: app.globalData.token
|
||||
},
|
||||
data: {}
|
||||
}).then(function(t) {
|
||||
}).then(function (t) {
|
||||
e.setData({
|
||||
cardList: t.data
|
||||
}), t.data.length > 0 && (e.setDefaultCard(t.data[0].cardTemplateUseId), console.log(e.data.pageType),
|
||||
"org" == e.data.pageType ? e.saveOrgCard(t.data[0].cardTemplateUseId) : e.saveCardIdToSyzl(t.data[0].cardTemplateUseId));
|
||||
}).catch(function(t) {
|
||||
}).catch(function (t) {
|
||||
wx.hideLoading({}), e.setData({
|
||||
isLoading: !1,
|
||||
showHide: !1
|
||||
});
|
||||
});
|
||||
},
|
||||
saveCardIdToSyzl: function(e) {
|
||||
saveCardIdToSyzl: function (e) {
|
||||
console.log("设置网格员名片" + e);
|
||||
var a = this;
|
||||
t.restAjax.put(t.restAjax.path(t.apis.doUpdateCard, [ t.baseUrls.requestUrl, a.data.id ]), {
|
||||
app.restAjax.put(app.restAjax.path(app.apis.doUpdateCard, [app.baseUrls.requestUrl, a.data.id]), {
|
||||
cardSysId: e
|
||||
}, {
|
||||
headers: {
|
||||
token: t.globalData.token
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, function(e, t) {
|
||||
}, function (e, t) {
|
||||
console.log(e), console.log(t), "200" == e && a.onShowHintDialog();
|
||||
}, function(e, t) {
|
||||
}, function (e, t) {
|
||||
wx.hideLoading({}), wx.showToast({
|
||||
icon: "none",
|
||||
title: "设置名片失败"
|
||||
}), console.log(e), console.log(t);
|
||||
});
|
||||
},
|
||||
saveOrgCard: function(e) {
|
||||
saveOrgCard: function (e) {
|
||||
var a = this;
|
||||
t.restAjax.put(t.restAjax.path(t.apis.doUpdateOrg, [ t.baseUrls.requestUrl, a.data.id ]), {
|
||||
app.restAjax.put(app.restAjax.path(app.apis.doUpdateOrg, [app.baseUrls.requestUrl, a.data.id]), {
|
||||
cardSysId: e
|
||||
}, {
|
||||
headers: {
|
||||
token: t.globalData.token
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, function(e, t) {
|
||||
}, function (e, t) {
|
||||
"200" == e && a.onShowHintDialog();
|
||||
}, function(e, t) {
|
||||
}, function (e, t) {
|
||||
wx.hideLoading({}), wx.showToast({
|
||||
icon: "none",
|
||||
title: "设置名片失败"
|
||||
}), console.log(t);
|
||||
});
|
||||
},
|
||||
setDefaultCard: function(e) {
|
||||
t.http.put(t.urls.setDefaultCard.format({
|
||||
setDefaultCard: function (e) {
|
||||
app.http.put(app.urls.setDefaultCard.format({
|
||||
cardTemplateUseId: e
|
||||
}), {
|
||||
header: {
|
||||
token: t.globalData.token
|
||||
token: app.globalData.token
|
||||
}
|
||||
}).then(function(e) {}).catch(function(e) {});
|
||||
}).then(function (e) { }).catch(function (e) { });
|
||||
},
|
||||
onShowHintDialog: function() {
|
||||
onShowHintDialog: function () {
|
||||
var e = this;
|
||||
wx.hideLoading({
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
e.setData({
|
||||
isLoading: !1
|
||||
}), wx.showModal({
|
||||
@ -158,94 +227,171 @@ Page({
|
||||
confirmText: "返回列表",
|
||||
cancelColor: "#333333",
|
||||
confirmColor: "#333333",
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.confirm ? e.backList() : e.continueCreate();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
inputBlur: function(e) {
|
||||
inputBlur: function (e) {
|
||||
var t = e.detail.value, a = e.currentTarget.dataset.num, r = e.currentTarget.dataset.item, o = r.templateAreaFontLength;
|
||||
"" != t && o > 0 && (t = t.substr(0, o), this.data.areaList[a].templateAreaFontValue = t,
|
||||
this.data.areaList[a].focus = !1, this.setData({
|
||||
areaList: this.data.areaList
|
||||
})), "1" != r.templateAreaServerLink && this.getFileId(a);
|
||||
},
|
||||
choosePhoto: function(e) {
|
||||
choosePhoto: function (e) {
|
||||
var t = e.currentTarget.dataset.cur, a = e.currentTarget.dataset.item;
|
||||
console.log(t), this.setData({
|
||||
currentIndex: t
|
||||
});
|
||||
var r = a.templateAreaWidth / a.templateAreaHeight;
|
||||
wx.chooseImage({
|
||||
wx.chooseMedia({
|
||||
count: 1,
|
||||
sourceType: [ "album", "camera" ],
|
||||
success: function(e) {
|
||||
mediaType: ['image'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: function (e) {
|
||||
console.log(e)
|
||||
wx.navigateTo({
|
||||
url: "/packagecard/common/corpperimg/cropperimg?imgSrc=" + e.tempFiles[0].path + "&scale=" + r
|
||||
url: "/packagecard/common/corpperimg/cropperimg?imgSrc=" + e.tempFiles[0].tempFilePath + "&scale=" + r
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
doUploadImg: function(a) {
|
||||
var r = this;
|
||||
doUploadImg: function (path) {
|
||||
var _self = this
|
||||
wx.showLoading({
|
||||
title: "上传中..."
|
||||
}), t.http.upload(t.urls.doUploadImg, {
|
||||
path: a,
|
||||
name: "image",
|
||||
title: '上传中...',
|
||||
})
|
||||
app.http.upload(app.urls.doUploadImg, {
|
||||
path: path,
|
||||
name: 'image',
|
||||
header: {
|
||||
token: t.globalData.token
|
||||
token: app.globalData.token
|
||||
}
|
||||
}).then(function(t) {
|
||||
wx.hideLoading({}), t = JSON.parse(t);
|
||||
var a = "areaList[" + r.data.currentIndex + "].templateAreaFile";
|
||||
r.setData(e({}, a, t.data)), wx.showToast({
|
||||
title: "上传成功",
|
||||
}).then(res => {
|
||||
wx.hideLoading({})
|
||||
res = JSON.parse(res)
|
||||
var change = 'areaList[' + _self.data.currentIndex + '].templateAreaFile'
|
||||
_self.setData({
|
||||
[change]: res.data
|
||||
})
|
||||
wx.showToast({
|
||||
title: '上传成功',
|
||||
duration: 1500
|
||||
}), r.setData({
|
||||
imgTempSrc: "",
|
||||
})
|
||||
_self.setData({
|
||||
imgTempSrc: '',
|
||||
currentIndex: 0
|
||||
});
|
||||
}).catch(function(e) {
|
||||
r.setData({
|
||||
imgTempSrc: "",
|
||||
})
|
||||
}).catch(res => {
|
||||
_self.setData({
|
||||
imgTempSrc: '',
|
||||
currentIndex: 0
|
||||
});
|
||||
});
|
||||
})
|
||||
})
|
||||
// var r = this;
|
||||
// wx.showLoading({
|
||||
// title: "上传中..."
|
||||
// }), app.http.upload(app.urls.doUploadImg, {
|
||||
// path: a,
|
||||
// name: "image",
|
||||
// header: {
|
||||
// token: app.globalData.token
|
||||
// }
|
||||
// }).then(function (t) {
|
||||
// wx.hideLoading({}), t = JSON.parse(t);
|
||||
// var a = "areaList[" + r.data.currentIndex + "].templateAreaFile";
|
||||
// r.setData(e({}, a, t.data)), wx.showToast({
|
||||
// title: "上传成功",
|
||||
// duration: 1500
|
||||
// }), r.setData({
|
||||
// imgTempSrc: "",
|
||||
// currentIndex: 0
|
||||
// });
|
||||
// }).catch(function (e) {
|
||||
// r.setData({
|
||||
// imgTempSrc: "",
|
||||
// currentIndex: 0
|
||||
// });
|
||||
// });
|
||||
},
|
||||
getNameCard: function() {
|
||||
var e = this;
|
||||
e.data.fromMine && e.data.cardPersonId, t.http.get(t.urls.getCardDetail.format({
|
||||
cardTemplateId: e.data.cardId
|
||||
getNameCard: function () {
|
||||
var self = this;
|
||||
app.http.get(app.urls.getCardDetail.format({
|
||||
cardTemplateId: self.data.cardId
|
||||
}), {
|
||||
header: {
|
||||
token: t.globalData.token
|
||||
token: app.globalData.token
|
||||
},
|
||||
data: {}
|
||||
}).then(function(t) {
|
||||
var a = t.data.areaList, r = t.data.picturesTemplateWidth / e.data.windowWidth;
|
||||
t.data.picturesTemplateWidth = t.data.picturesTemplateWidth / r, t.data.picturesTemplateHeight = t.data.picturesTemplateHeight / r;
|
||||
for (var o = 0; o < a.length; o++) "1" == a[o].templateAreaFontCenter ? a[o].templateAreaFontCenter = "left" : "2" == a[o].templateAreaFontCenter ? a[o].templateAreaFontCenter = "center" : a[o].templateAreaFontCenter = "right",
|
||||
"0" == a[o].templateAreaFontBold ? a[o].templateAreaFontBold = "normal" : "1" == a[o].templateAreaFontBold ? a[o].templateAreaFontBold = "bold" : a[o].templateAreaFontStyle = "italic",
|
||||
a[o].templateAreaFontSize = a[o].templateAreaFontSize / r + "px", a[o].templateAreaHeight = a[o].templateAreaHeight / r,
|
||||
a[o].templateAreaWidth = a[o].templateAreaWidth / r, a[o].templateAreaDown = a[o].templateAreaDown / r,
|
||||
a[o].templateAreaTop = a[o].templateAreaTop / r, a[o].templateAreaRight = a[o].templateAreaRight / r,
|
||||
a[o].templateAreaLeft = a[o].templateAreaLeft / r;
|
||||
e.setData({
|
||||
cardInfo: t.data,
|
||||
areaList: a
|
||||
});
|
||||
}).catch(function(e) {});
|
||||
},
|
||||
getNameCradArea: function() {
|
||||
var e = this, a = [];
|
||||
t.restAjax.get(t.restAjax.path("{cardUrl}app/cardtemplatearea/listcardtemplateareabytemplateid/" + e.data.cardId, [ t.tradeUrl ]), {}, {
|
||||
headers: {
|
||||
token: t.globalData.token
|
||||
}).then(res => {
|
||||
var area = res.data.areaList
|
||||
var scale = res.data.picturesTemplateWidth / self.data.windowWidth
|
||||
res.data.picturesTemplateWidth = res.data.picturesTemplateWidth / scale
|
||||
res.data.picturesTemplateHeight = res.data.picturesTemplateHeight / scale
|
||||
for (let i = 0; i < area.length; i++) {
|
||||
if (area[i].templateAreaFontCenter == '1') {
|
||||
area[i].templateAreaFontCenter = 'left'
|
||||
} else if (area[i].templateAreaFontCenter == '2') {
|
||||
area[i].templateAreaFontCenter = 'center'
|
||||
} else {
|
||||
area[i].templateAreaFontCenter = 'right'
|
||||
}
|
||||
}, function(t, r) {
|
||||
if (area[i].templateAreaFontBold == '0') {
|
||||
area[i].templateAreaFontBold = 'normal'
|
||||
} else if (area[i].templateAreaFontBold == '1') {
|
||||
area[i].templateAreaFontBold = 'bold'
|
||||
} else {
|
||||
area[i]['templateAreaFontStyle'] = 'italic'
|
||||
}
|
||||
area[i].templateAreaFontSize = area[i].templateAreaFontSize / scale + 'px'
|
||||
area[i].templateAreaHeight = area[i].templateAreaHeight / scale
|
||||
area[i].templateAreaWidth = area[i].templateAreaWidth / scale
|
||||
area[i].templateAreaDown = area[i].templateAreaDown / scale
|
||||
area[i].templateAreaTop = area[i].templateAreaTop / scale
|
||||
area[i].templateAreaRight = area[i].templateAreaRight / scale
|
||||
area[i].templateAreaLeft = area[i].templateAreaLeft / scale
|
||||
}
|
||||
self.setData({
|
||||
cardInfo: res.data,
|
||||
areaList: area
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
|
||||
})
|
||||
// var e = this;
|
||||
// e.data.fromMine && e.data.cardPersonId, app.http.get(app.urls.getCardDetail.format({
|
||||
// cardTemplateId: e.data.cardId
|
||||
// }), {
|
||||
// header: {
|
||||
// token: app.globalData.token
|
||||
// },
|
||||
// data: {}
|
||||
// }).then(function (t) {
|
||||
// var a = t.data.areaList, r = t.data.picturesTemplateWidth / e.data.windowWidth;
|
||||
// t.data.picturesTemplateWidth = t.data.picturesTemplateWidth / r, t.data.picturesTemplateHeight = t.data.picturesTemplateHeight / r;
|
||||
// for (var o = 0; o < a.length; o++) "1" == a[o].templateAreaFontCenter ? a[o].templateAreaFontCenter = "left" : "2" == a[o].templateAreaFontCenter ? a[o].templateAreaFontCenter = "center" : a[o].templateAreaFontCenter = "right",
|
||||
// "0" == a[o].templateAreaFontBold ? a[o].templateAreaFontBold = "normal" : "1" == a[o].templateAreaFontBold ? a[o].templateAreaFontBold = "bold" : a[o].templateAreaFontStyle = "italic",
|
||||
// a[o].templateAreaFontSize = a[o].templateAreaFontSize / r + "px", a[o].templateAreaHeight = a[o].templateAreaHeight / r,
|
||||
// a[o].templateAreaWidth = a[o].templateAreaWidth / r, a[o].templateAreaDown = a[o].templateAreaDown / r,
|
||||
// a[o].templateAreaTop = a[o].templateAreaTop / r, a[o].templateAreaRight = a[o].templateAreaRight / r,
|
||||
// a[o].templateAreaLeft = a[o].templateAreaLeft / r;
|
||||
// e.setData({
|
||||
// cardInfo: t.data,
|
||||
// areaList: a
|
||||
// });
|
||||
// }).catch(function (e) { });
|
||||
},
|
||||
getNameCradArea: function () {
|
||||
var e = this, a = [];
|
||||
app.restAjax.get(app.restAjax.path("{cardUrl}app/cardtemplatearea/listcardtemplateareabytemplateid/" + e.data.cardId, [app.tradeUrl]), {}, {
|
||||
headers: {
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, function (t, r) {
|
||||
for (var o = 0; o < r.length; o++) if (r[o].focus = !1, "1" != r[o].templateAreaType) a.push(r[o]); else {
|
||||
var n = parseInt(r[o].templateAreaFontSize.replace("px", ""));
|
||||
n = Math.floor(750 * n / wx.getSystemInfoSync().windowWidth) + "rpx", r[o].templateAreaFontSize = n,
|
||||
@ -254,69 +400,71 @@ Page({
|
||||
e.setData({
|
||||
areaList: a
|
||||
});
|
||||
}, function(e, a) {
|
||||
}, function (e, a) {
|
||||
t.dialog.msg(a.msg);
|
||||
});
|
||||
},
|
||||
editInfo: function(t) {
|
||||
editInfo: function (t) {
|
||||
var a = t.currentTarget.dataset.num, r = t.detail.value, o = "areaList[" + a + "].templateAreaFontValue";
|
||||
this.setData(e({}, o, r));
|
||||
},
|
||||
giveFocus: function(t) {
|
||||
giveFocus: function (t) {
|
||||
console.log(t.currentTarget.dataset.cur);
|
||||
var a = "areaList[" + t.currentTarget.dataset.cur + "].focus";
|
||||
this.setData(e({}, a, !0));
|
||||
},
|
||||
continueCreate: function() {
|
||||
continueCreate: function () {
|
||||
this.setData({
|
||||
showHide: !1
|
||||
});
|
||||
},
|
||||
backList: function() {
|
||||
backList: function () {
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},
|
||||
getUserInfo: function() {
|
||||
t.restAjax.get(t.restAjax.path("{loginUrl}app/user/get-app-user", [ t.personIntroUrl ]), {}, {
|
||||
getUserInfo: function () {
|
||||
app.restAjax.get(app.restAjax.path("{loginUrl}app/user/get-app-user", [app.personIntroUrl]), {}, {
|
||||
headers: {
|
||||
token: t.globalData.token
|
||||
token: app.globalData.token
|
||||
}
|
||||
}, function(e, a) {
|
||||
t.globalData.userInfo = a;
|
||||
}, function(e, a) {
|
||||
t.dialog.msg(a.msg);
|
||||
}, function (e, a) {
|
||||
app.globalData.userInfo = a;
|
||||
}, function (e, a) {
|
||||
app.dialog.msg(a.msg);
|
||||
});
|
||||
},
|
||||
getFileId: function(a) {
|
||||
getFileId: function (a) {
|
||||
var r = this, o = a, n = r.data.areaList[o].templateAreaFontValue;
|
||||
console.log(n);
|
||||
var i = r.data.areaList[o].picturesTemplateAreaId;
|
||||
t.http.get(t.urls.getFileId.format({
|
||||
app.http.get(app.urls.getFileId.format({
|
||||
picturesTemplateAreaId: i
|
||||
}), {
|
||||
header: {
|
||||
token: t.globalData.token
|
||||
token: app.globalData.token
|
||||
},
|
||||
data: {
|
||||
content: n
|
||||
}
|
||||
}).then(function(t) {
|
||||
}).then(function (t) {
|
||||
console.log(t.data);
|
||||
var a = "areaList[" + o + "].templateAreaFile";
|
||||
r.setData(e({}, a, t.data.data));
|
||||
}).catch(function(e) {});
|
||||
}).catch(function (e) { });
|
||||
},
|
||||
onLoad: function(e) {
|
||||
onLoad: function (e) {
|
||||
this.setData({
|
||||
cardId: e.id,
|
||||
token: t.globalData.token,
|
||||
token: app.globalData.token,
|
||||
pageType: e.type,
|
||||
id: e.taskId
|
||||
}), this.getNameCard();
|
||||
});
|
||||
console.log(app.globalData.token)
|
||||
this.getNameCard();
|
||||
},
|
||||
postRecord: function(e) {
|
||||
t.restAjax.post(t.restAjax.path("{loginUrl}app/cardtemplateforwardingrecord/savecardtemplateforwardingrecord", [ t.tradeUrl ]), {
|
||||
postRecord: function (e) {
|
||||
app.restAjax.post(app.restAjax.path("{loginUrl}app/cardtemplateforwardingrecord/savecardtemplateforwardingrecord", [app.tradeUrl]), {
|
||||
encryptedData: e.encryptedData,
|
||||
iv: e.iv,
|
||||
templateUseId: this.data.cardId,
|
||||
@ -326,14 +474,14 @@ Page({
|
||||
headers: {
|
||||
token: this.data.token
|
||||
}
|
||||
}, function(e, t) {
|
||||
}, function (e, t) {
|
||||
console.log("1" + t);
|
||||
}, function(e, a) {
|
||||
}, function (e, a) {
|
||||
t.dialog.msg(a.msg);
|
||||
});
|
||||
},
|
||||
openPage: function() {},
|
||||
onShow: function() {
|
||||
openPage: function () { },
|
||||
onShow: function () {
|
||||
console.log(this.data.imgTempSrc), "" != this.data.imgTempSrc && this.doUploadImg(this.data.imgTempSrc);
|
||||
}
|
||||
});
|
@ -1,13 +1,34 @@
|
||||
<view style="margin:15rpx;">
|
||||
<view class="card" style="padding-bottom:{{cardInfo.picturesTemplateHeight/cardInfo.picturesTemplateWidth*100+'%'}};">
|
||||
<image alt="" class="card-bgImg" src="{{cardUrl}}{{cardInfo.picturesTemplateBackgroundImage}}" wx:if="{{cardInfo.picturesTemplateBackgroundImage}}"></image>
|
||||
<view catchtap="giveFocus" class="area-box {{item.templateAreaFontCenter=='left'?'wrap-line':''}} {{item.templateAreaFontCenter=='center'?'wrap-center':''}} {{item.templateAreaFontCenter=='right'?'wrap-line':''}} " data-cur="{{index}}" style="position:absolute;top: {{item.templateAreaTop/cardInfo.picturesTemplateHeight*100+'%'}};left:{{item.templateAreaLeft/cardInfo.picturesTemplateWidth*100+'%'}};color:{{item.templateAreaFontColor}};;width:{{item.templateAreaWidth}}px;height:{{item.templateAreaHeight}}px;font-size:{{item.templateAreaFontSize}};font-style:{{item.templateAreaFontStyle}};font-weight:{{item.templateAreaFontBold}};text-align:{{item.templateAreaFontCenter}};" wx:if="{{item.templateAreaServerLink=='1'&&item.templateAreaType!='1'}}" wx:for="{{areaList}}" wx:key="index"> {{item.templateAreaFontValue}} </view>
|
||||
<view data-cur="{{index}}" data-item="{{item}}" style="position:absolute;top: {{item.templateAreaTop/cardInfo.picturesTemplateHeight*100+'%'}};left:{{item.templateAreaLeft/cardInfo.picturesTemplateWidth*100+'%'}};color:{{item.templateAreaFontColor}};width:{{item.templateAreaWidth/cardInfo.picturesTemplateWidth*100+'%'}};height:{{item.templateAreaHeight/cardInfo.picturesTemplateHeight*100+'%'}};" wx:if="{{item.templateAreaServerLink=='2'}}" wx:for="{{areaList}}" wx:key="index">
|
||||
<view class="card"
|
||||
style="padding-bottom:{{(cardInfo.picturesTemplateHeight / cardInfo.picturesTemplateWidth) *100 +'%'}};">
|
||||
<!-- 背景图 -->
|
||||
<image src="{{cardUrl}}{{cardInfo.picturesTemplateBackgroundImage}}" alt="" class="card-bgImg"
|
||||
wx:if="{{cardInfo.picturesTemplateBackgroundImage}}"></image>
|
||||
<!-- 文字 -->
|
||||
<view
|
||||
class="area-box {{item.templateAreaFontCenter == 'left' ? 'wrap-line' :''}} {{item.templateAreaFontCenter == 'center' ? 'wrap-center' :''}} {{item.templateAreaFontCenter == 'right' ? 'wrap-line' :''}} "
|
||||
wx:for="{{areaList}}" data-cur="{{index}}" catchtap="giveFocus" wx:key="index"
|
||||
style="position:absolute;top: {{(item.templateAreaTop / cardInfo.picturesTemplateHeight) * 100 + '%'}};left:{{(item.templateAreaLeft / cardInfo.picturesTemplateWidth) * 100 + '%'}};color:{{item.templateAreaFontColor}};;width:{{item.templateAreaWidth }}px;height:{{item.templateAreaHeight}}px;font-size:{{item.templateAreaFontSize}};font-style:{{item.templateAreaFontStyle}};font-weight:{{item.templateAreaFontBold}};text-align:{{item.templateAreaFontCenter}};line-height:{{item.templateAreaHeight}}px;"
|
||||
wx:if="{{item.templateAreaServerLink == '1' && item.templateAreaType != '1'}}">
|
||||
{{item.templateAreaFontValue}}
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 图片 -->
|
||||
<!-- catchtap="choosePhoto" -->
|
||||
<view wx:for="{{areaList}}" data-cur="{{index}}" wx:key="index" data-item="{{item}}"
|
||||
style="position:absolute;top: {{(item.templateAreaTop / cardInfo.picturesTemplateHeight) * 100 + '%'}};left:{{(item.templateAreaLeft / cardInfo.picturesTemplateWidth) * 100 + '%'}};color:{{item.templateAreaFontColor}};width:{{(item.templateAreaWidth / cardInfo.picturesTemplateWidth) * 100 + '%'}};height:{{(item.templateAreaHeight / cardInfo.picturesTemplateHeight) * 100 + '%'}};"
|
||||
wx:if="{{item.templateAreaServerLink == '2'}}">
|
||||
<image src="{{cardUrl}}{{item.templateAreaFile}}" style="width: 100%;height:100%"></image>
|
||||
</view>
|
||||
<view catchtap="giveFocus" class="area-box" data-cur="{{index}}" style="position:absolute;top: {{item.templateAreaTop/cardInfo.picturesTemplateHeight*100+'%'}};left:{{item.templateAreaLeft/cardInfo.picturesTemplateWidth*100+'%'}};color:{{item.templateAreaFontColor}};width:{{item.templateAreaWidth/cardInfo.picturesTemplateWidth*100+'%'}};height:{{item.templateAreaHeight/cardInfo.picturesTemplateHeight*100+'%'}}" wx:if="{{item.templateAreaType=='1'&&item.templateAreaServerLink=='1'}}" wx:for="{{areaList}}" wx:key="index">
|
||||
|
||||
<!-- 其他 -->
|
||||
<view class="area-box" wx:for="{{areaList}}" data-cur="{{index}}" wx:key="index" catchtap="giveFocus"
|
||||
style="position:absolute;top: {{(item.templateAreaTop / cardInfo.picturesTemplateHeight) * 100 + '%'}};left:{{(item.templateAreaLeft / cardInfo.picturesTemplateWidth) * 100 + '%'}};color:{{item.templateAreaFontColor}};width:{{(item.templateAreaWidth / cardInfo.picturesTemplateWidth) * 100 + '%'}};height:{{(item.templateAreaHeight / cardInfo.picturesTemplateHeight) * 100 + '%'}}"
|
||||
wx:if="{{item.templateAreaType == '1' && item.templateAreaServerLink == '1'}}">
|
||||
<text wx:if="{{!item.templateAreaFile}}">{{item.templateAreaFontValue}}</text>
|
||||
<image src="{{cardUrl}}{{item.templateAreaFile}}" wx:else></image>
|
||||
<!-- <image src="{{cardUrl}}{{item.templateAreaFile}}" style="width: 100%;height:100%"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -15,41 +36,56 @@
|
||||
<view class="card-title">适用行业:{{cardInfo.templateIndustryName}}</view>
|
||||
<view class="card-info">
|
||||
<view class="edit-card">
|
||||
<view wx:if="{{item.templateAreaServerLink!='2'&&item.templateAreaType!='1'}}" wx:for="{{areaList}}" wx:key="index">
|
||||
<view wx:for="{{areaList}}" wx:key="index"
|
||||
wx:if="{{item.templateAreaServerLink != '2' && item.templateAreaType != '1'}}">
|
||||
<view class="row-ver">
|
||||
<view class="item-title-box">
|
||||
<view class="item-title">{{item.templateAreaName}}</view>
|
||||
<view class="hint-txt" wx:if="{{item.templateAreaFontLength>0}}">最多输入{{item.templateAreaFontLength}}个字符 </view>
|
||||
<view class="hint-txt" wx:if="{{item.templateAreaFontLength>0}}">最多输入{{item.templateAreaFontLength}}个字符
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-input">
|
||||
<input bindblur="inputBlur" data-item="{{item}}" data-num="{{index}}" focus="{{item.focus}}" type="text" value="{{item.templateAreaFontValue}}" wx:if="{{item.templateAreaServerLink!='1'}}"></input>
|
||||
<input bindblur="inputBlur" data-item="{{item}}" data-num="{{index}}" focus="{{item.focus}}" placeholder="请输入内容,最多{{item.templateAreaFontLength}}个字" type="text" value="{{item.templateAreaFontValue}}" wx:else></input>
|
||||
<input type="text" data-num="{{index}}" bindblur="inputBlur" data-item="{{item}}"
|
||||
value="{{item.templateAreaFontValue}}" focus="{{item.focus}}"
|
||||
wx:if="{{item.templateAreaServerLink != '1'}}"></input>
|
||||
<input type="text" placeholder="请输入内容,最多{{item.templateAreaFontLength}}个字" data-item="{{item}}"
|
||||
bindblur="inputBlur" data-num="{{index}}" value="{{item.templateAreaFontValue}}" focus="{{item.focus}}"
|
||||
wx:else></input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row-ver" wx:if="{{item.templateAreaServerLink=='2'&&item.templateAreaType!='1'}}" wx:for="{{areaList}}" wx:key="index">
|
||||
|
||||
<view class="row-ver" wx:for="{{areaList}}" wx:key="index"
|
||||
wx:if="{{item.templateAreaServerLink == '2' && item.templateAreaType != '1'}}">
|
||||
<view class="item-title-box">
|
||||
<view class="item-title">{{item.templateAreaName}}</view>
|
||||
<view class="hint-txt" wx:if="{{item.templateAreaFontLength>0}}">最多输入1张图片</view>
|
||||
</view>
|
||||
<view bindtap="choosePhoto" class="card-img-box" data-cur="{{index}}" data-item="{{item}}">
|
||||
<image mode="widthFix" src="{{cardUrl}}{{item.templateAreaFile}}"></image>
|
||||
<view bindtap="choosePhoto" data-cur="{{index}}" data-item="{{item}}" class="card-img-box">
|
||||
<image src="{{cardUrl}}{{item.templateAreaFile}}" mode="widthFix"></image>
|
||||
<text class="cuIcon-cameraadd" style="font-size: 100rpx;"></text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="row" wx:for="{{areaList}}" wx:key="index" wx:if="{{item.templateAreaType == '9'}}">
|
||||
<view class="item-title">二维码:</view>
|
||||
<view class="item-input item-code-input" bindtap="choosePhoto" data-cur="{{index}}">
|
||||
<image src="{{cardUrl}}route/file/download/true/{{item.templateAreaTitle}}"></image>
|
||||
点击修改
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="foot bg-white" style="padding: 15rpx;" wx:if="{{!isLoading}}">
|
||||
<button bindtap="createMyCard" class="cu-btn bg-blue" style="width:100%">生成我的名片</button>
|
||||
<button class="cu-btn bg-blue" style="width:100%" bindtap="createMyCard">生成我的名片</button>
|
||||
</view>
|
||||
<view class="hide-link" wx:if="{{showHide}}">
|
||||
<view class="hide">
|
||||
<view class="hide-title">创建成功</view>
|
||||
<view class="hide-text">恭喜您名片创建成功,如需查看请到(我的 → 我的卡包)</view>
|
||||
<view class="hide-btn-box">
|
||||
<view bindtap="continueCreate" class="hide-btn">继续创建</view>
|
||||
<view bindtap="backList" class="hide-btn">返回模板</view>
|
||||
<view class="hide-btn" bindtap="continueCreate">继续创建</view>
|
||||
<view class="hide-btn" bindtap="backList">返回模板</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
@ -1,215 +1,223 @@
|
||||
.card {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
z-index: 100;
|
||||
}
|
||||
/* text-align: center; */
|
||||
}
|
||||
|
||||
.card-bgImg {
|
||||
height: 100%;
|
||||
left: 0;
|
||||
.card-bgImg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.area-box {
|
||||
background: none!important;
|
||||
white-space: nowrap;
|
||||
z-index: 111;
|
||||
}
|
||||
|
||||
.area-box image {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.card-info {
|
||||
margin-top: 15rpx;
|
||||
.area-box {
|
||||
background: none !important;
|
||||
z-index: 111;
|
||||
}
|
||||
|
||||
.area-box image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.card-info {
|
||||
padding-bottom: 100rpx;
|
||||
width: 100%;
|
||||
}
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
background: #fff;
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
padding: 15rpx;
|
||||
background: #ffffff;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.row {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.row,.row-ver {
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.row-ver {
|
||||
background-color: #fff;
|
||||
flex-direction: column;
|
||||
padding: 15rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.row-ver:nth-child(1) {
|
||||
padding: 15rpx 15rpx 7.5rpx;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
border-bottom: 1px solid #EEE;
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.row-ver:last-child {
|
||||
padding: 7.5rpx 15rpx 15rpx;
|
||||
}
|
||||
.row-ver {
|
||||
display: flex;
|
||||
border-bottom: 1px solid #EEE;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
flex-direction: column;
|
||||
background-color: #ffffff;
|
||||
padding: 15rpx;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
color: grey;
|
||||
.row-ver:nth-child(1) {
|
||||
padding: 15rpx 15rpx 7.5rpx 15rpx;
|
||||
}
|
||||
|
||||
.row-ver:last-child {
|
||||
padding: 7.5rpx 15rpx 15rpx 15rpx;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
line-height: 50rpx;
|
||||
}
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
.item-title-box {
|
||||
.item-title-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin-top: 7.5rpx;
|
||||
}
|
||||
|
||||
.item-input,.item-title-box {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
margin-top: 7.5rpx;
|
||||
}
|
||||
|
||||
.item-input {
|
||||
box-sizing: border-box;
|
||||
.item-input {
|
||||
flex: 4;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item-input input {
|
||||
color: #333;
|
||||
font-size: 32rpx;
|
||||
height: 50rpx;
|
||||
text-align: left;
|
||||
.item-input input {
|
||||
width: 100%;
|
||||
}
|
||||
text-align: left;
|
||||
height: 50rpx;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.item-input image {
|
||||
.item-input image {
|
||||
max-width: 70%;
|
||||
}
|
||||
/* max-height: 120rpx; */
|
||||
}
|
||||
|
||||
.item-code-input image {
|
||||
max-height: 160rpx;
|
||||
.item-code-input image {
|
||||
max-width: 35%;
|
||||
}
|
||||
max-height: 160rpx;
|
||||
}
|
||||
|
||||
.hide-link {
|
||||
background: rgba(0,0,0,.6);
|
||||
|
||||
|
||||
|
||||
.hide-link {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
z-index: 1000;
|
||||
}
|
||||
}
|
||||
|
||||
.hide {
|
||||
background: #fff;
|
||||
border-radius: 10rpx;
|
||||
flex-direction: column;
|
||||
left: 50%;
|
||||
.hide {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
left: 50%;
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.hide,.hide-btn {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.hide-btn {
|
||||
background: #1d7ff0;
|
||||
border-bottom-left-radius: 10rpx;
|
||||
border-bottom-right-radius: 10rpx;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
height: 60rpx;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.hide-btn:nth-child(1) {
|
||||
background: #e6b980;
|
||||
border-bottom-left-radius: 10rpx;
|
||||
border-bottom-right-radius: 0rpx;
|
||||
}
|
||||
|
||||
.hide-btn:last-child {
|
||||
border-bottom-left-radius: 0rpx;
|
||||
border-bottom-right-radius: 10rpx;
|
||||
}
|
||||
|
||||
.hide-text {
|
||||
color: #000;
|
||||
font-size: 36rpx;
|
||||
padding: 50rpx 30rpx;
|
||||
}
|
||||
|
||||
.hide-title {
|
||||
color: #ffc107;
|
||||
font-size: 43rpx;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.hide-btn-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.input-box {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content-box {
|
||||
align-items: center;
|
||||
transform: translate(-50%, -50%);
|
||||
border-radius: 10rpx;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 15rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.cuIcon-cameraadd {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
|
||||
.card-img-box {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.hide-btn {
|
||||
display: flex;
|
||||
width: 50%;
|
||||
height: 60rpx;
|
||||
background: #1d7ff0;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-bottom-left-radius: 10rpx;
|
||||
border-bottom-right-radius: 10rpx;
|
||||
}
|
||||
|
||||
.hide-btn:nth-child(1) {
|
||||
background: #E6B980;
|
||||
border-bottom-left-radius: 10rpx;
|
||||
border-bottom-right-radius: 0rpx;
|
||||
}
|
||||
|
||||
.hide-btn:last-child {
|
||||
border-bottom-left-radius: 0rpx;
|
||||
border-bottom-right-radius: 10rpx;
|
||||
}
|
||||
|
||||
.hide-text {
|
||||
font-size: 36rpx;
|
||||
color: #000;
|
||||
padding: 50rpx 30rpx;
|
||||
}
|
||||
|
||||
.hide-title {
|
||||
font-size: 43rpx;
|
||||
color: #ffC107;
|
||||
padding: 10rpx;
|
||||
}
|
||||
|
||||
.hide-btn-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.input-box {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content-box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 15rpx;
|
||||
}
|
||||
|
||||
.cuIcon-cameraadd {
|
||||
font-size: 60rpx;
|
||||
}
|
||||
|
||||
.card-img-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-right: 40rpx;
|
||||
}
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.card-img-box image {
|
||||
height: 200rpx;
|
||||
.card-img-box image {
|
||||
width: 200rpx;
|
||||
}
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.hint-txt {
|
||||
.hint-txt {
|
||||
text-align: right;
|
||||
color: #fd9494;
|
||||
font-size: 24rpx;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.wrap-line {
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.wrap-center {
|
||||
/* 换行 */
|
||||
.wrap-line {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
/* 居中 */
|
||||
.wrap-center {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
overflow-wrap: break-word;
|
||||
}
|
@ -8,49 +8,56 @@ Page({
|
||||
width: 250,
|
||||
height: 250
|
||||
},
|
||||
onLoad: function(e) {
|
||||
onLoad: function (e) {
|
||||
console.log(e.imgSrc)
|
||||
wx.setNavigationBarTitle({
|
||||
title: "图片裁剪"
|
||||
}), this.cropper = this.selectComponent("#image-cropper"), this.setData({
|
||||
src: e.imgSrc
|
||||
}), wx.showLoading({
|
||||
});
|
||||
this.cropper = this.selectComponent("#image-cropper");
|
||||
this.setData({
|
||||
src: e.imgSrc,
|
||||
scale:e.scale
|
||||
});
|
||||
wx.showLoading({
|
||||
title: "加载中"
|
||||
});
|
||||
},
|
||||
cropperload: function(e) {
|
||||
cropperload: function (e) {
|
||||
console.log("cropper初始化完成");
|
||||
},
|
||||
loadimage: function(e) {
|
||||
console.log("图片加载完成", e.detail), wx.hideLoading(), this.cropper.imgReset();
|
||||
loadimage: function (e) {
|
||||
console.log("图片加载完成", e.detail);
|
||||
wx.hideLoading();
|
||||
this.cropper.imgReset();
|
||||
},
|
||||
clickcut: function(e) {
|
||||
clickcut: function (e) {
|
||||
console.log(e.detail);
|
||||
var t = getCurrentPages();
|
||||
(t.length >= 2 ? t[t.length - 2] : void 0).setData({
|
||||
imgTempSrc: e.detail.url
|
||||
}), wx.navigateBack({});
|
||||
},
|
||||
cropperDone: function(e) {
|
||||
cropperDone: function (e) {
|
||||
var t = e.detail, o = t.src, a = (t.cropperData, getCurrentPages());
|
||||
(a.length >= 2 ? a[a.length - 2] : void 0).setData({
|
||||
imgTempSrc: o
|
||||
});
|
||||
},
|
||||
cropperCancel: function() {
|
||||
cropperCancel: function () {
|
||||
wx.navigateBack({});
|
||||
},
|
||||
doCropperDone: function(e) {
|
||||
doCropperDone: function (e) {
|
||||
var t = getCurrentPages();
|
||||
(t.length >= 2 ? t[t.length - 2] : void 0).setData({
|
||||
imgTempSrc: e
|
||||
}), wx.navigateBack({});
|
||||
},
|
||||
cropperFail: function(e) {
|
||||
cropperFail: function (e) {
|
||||
e.detail;
|
||||
console.log(e), wx.showToast({
|
||||
title: "裁剪失败,请重试",
|
||||
icon: "none",
|
||||
success: function() {
|
||||
success: function () {
|
||||
wx.navigateBack({});
|
||||
}
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"image-cropper": "/vant/dist/cropper/index",
|
||||
"image-cropper": "/vant/dist/cropper/image-cropper",
|
||||
"van-tabbar": "/vant/dist/tabbar/index",
|
||||
"van-tabbar-item": "/vant/dist/tabbar-item/index",
|
||||
"van-swipe-cell": "/vant/dist/swipe-cell/index",
|
||||
|
@ -1,4 +1,4 @@
|
||||
var t = require("../../../@babel/runtime/helpers/defineProperty"), a = getApp(), e = wx.getRecorderManager(), i = wx.createInnerAudioContext(), s = requirePlugin("chooseLocation"), n = {
|
||||
var a = getApp(); var e = wx.getRecorderManager(); var i = wx.createInnerAudioContext(); var s = requirePlugin("chooseLocation"); var n = {
|
||||
latitude: 39.89631551,
|
||||
longitude: 116.323459711
|
||||
};
|
||||
@ -42,7 +42,7 @@ Page({
|
||||
curLng: 0,
|
||||
isRecording: !1,
|
||||
maxDuration: 60,
|
||||
displayType: [ {
|
||||
displayType: [{
|
||||
name: "九宫格",
|
||||
id: 1
|
||||
}, {
|
||||
@ -54,11 +54,11 @@ Page({
|
||||
}, {
|
||||
name: "平铺",
|
||||
id: 4
|
||||
} ],
|
||||
}],
|
||||
selDisplayType: 1,
|
||||
displayTypeStr: "九宫格"
|
||||
},
|
||||
onLoad: function(t) {
|
||||
onLoad: function (t) {
|
||||
this.setData({
|
||||
columnId: t.id,
|
||||
uId: t.uid,
|
||||
@ -68,7 +68,7 @@ Page({
|
||||
});
|
||||
this.checkPermission(), this.getMomentContent();
|
||||
},
|
||||
getMomentContent: function() {
|
||||
getMomentContent: function () {
|
||||
wx.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
@ -80,15 +80,15 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(a) {
|
||||
}).then(function (a) {
|
||||
wx.hideLoading({}), t.buildDetail(a.data);
|
||||
}).catch(function(t) {
|
||||
}).catch(function (t) {
|
||||
wx.hideLoading({}), console.log(t);
|
||||
});
|
||||
},
|
||||
buildDetail: function(t) {
|
||||
buildDetail: function (t) {
|
||||
var e = this;
|
||||
t.list.forEach(function(t) {
|
||||
t.list.forEach(function (t) {
|
||||
switch (t.dataType) {
|
||||
case "2":
|
||||
var i = t.value.split("@"), s = i[0].split(",");
|
||||
@ -121,7 +121,7 @@ Page({
|
||||
});
|
||||
}
|
||||
var n = [];
|
||||
s.forEach(function(t) {
|
||||
s.forEach(function (t) {
|
||||
if (t.length > 0) {
|
||||
var e = {
|
||||
id: t,
|
||||
@ -148,7 +148,7 @@ Page({
|
||||
|
||||
case "3":
|
||||
s = t.value.split(","), n = [];
|
||||
s.forEach(function(t) {
|
||||
s.forEach(function (t) {
|
||||
if (t.length > 0) {
|
||||
var e = t.split("&"), i = "00:00", s = 100;
|
||||
if (e.length > 1) {
|
||||
@ -173,7 +173,7 @@ Page({
|
||||
|
||||
case "6":
|
||||
s = t.value.split("-"), n = [];
|
||||
s.forEach(function(t) {
|
||||
s.forEach(function (t) {
|
||||
if (t.length > 0) {
|
||||
var a = t.split(","), e = {
|
||||
name: "",
|
||||
@ -187,14 +187,14 @@ Page({
|
||||
break;
|
||||
|
||||
case "8":
|
||||
t.dictionariesList.forEach(function(a) {
|
||||
t.dictionariesList.forEach(function (a) {
|
||||
-1 != t.value.indexOf(a.dataId) && (t.selValue = a.dataName);
|
||||
});
|
||||
break;
|
||||
|
||||
case "9":
|
||||
var c = "";
|
||||
t.dictionariesList.forEach(function(a) {
|
||||
t.dictionariesList.forEach(function (a) {
|
||||
-1 != t.value.indexOf(a.dataId) ? (c += a.dataName + ",", a.isSel = !0) : a.isSel = !1;
|
||||
}), c = c.substr(0, c.length - 1), t.selValue = c;
|
||||
}
|
||||
@ -202,13 +202,13 @@ Page({
|
||||
fieldList: t.list
|
||||
});
|
||||
},
|
||||
showMutliSel: function(t) {
|
||||
showMutliSel: function (t) {
|
||||
this.setData({
|
||||
isShowTags: !0,
|
||||
currentIndex: t.currentTarget.dataset.index
|
||||
});
|
||||
},
|
||||
pickerChange: function(t) {
|
||||
pickerChange: function (t) {
|
||||
var a = t.currentTarget.dataset.index, e = t.detail.value;
|
||||
this.data.fieldList[a].index = e, this.data.fieldList[a].value = this.data.fieldList[a].dictionariesList[e].dataId,
|
||||
this.data.fieldList[a].selValue = this.data.fieldList[a].dictionariesList[e].dataName,
|
||||
@ -216,25 +216,25 @@ Page({
|
||||
fieldList: this.data.fieldList
|
||||
});
|
||||
},
|
||||
inputText: function(t) {
|
||||
inputText: function (t) {
|
||||
var a = t.currentTarget.dataset.index;
|
||||
this.data.fieldList[a].value = t.detail.value, this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
});
|
||||
},
|
||||
checkPermission: function() {
|
||||
checkPermission: function () {
|
||||
var t = this;
|
||||
wx.getSetting({
|
||||
success: function(a) {
|
||||
success: function (a) {
|
||||
var e = a.authSetting["scope.record"];
|
||||
void 0 === e ? wx.authorize({
|
||||
scope: "scope.record",
|
||||
success: function() {
|
||||
success: function () {
|
||||
t.setData({
|
||||
isAuthAudio: !0
|
||||
});
|
||||
},
|
||||
fail: function() {
|
||||
fail: function () {
|
||||
t.setData({
|
||||
isAuthAudio: !1
|
||||
});
|
||||
@ -243,18 +243,18 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
openSetting: function() {
|
||||
openSetting: function () {
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "发布内容需要您授权录音权限.",
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.confirm && wx.openSetting({
|
||||
withSubscriptions: !0
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onShow: function() {
|
||||
onShow: function () {
|
||||
if (null != s.getLocation()) {
|
||||
var t = this.data.fieldList[this.data.curMapIndex];
|
||||
t.valueList.length < t.maxCount && (this.data.fieldList[this.data.curMapIndex].valueList.push(s.getLocation()),
|
||||
@ -265,7 +265,7 @@ Page({
|
||||
var a = this;
|
||||
wx.getSetting({
|
||||
withSubscriptions: !0,
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
var e = t.authSetting["scope.record"];
|
||||
a.setData({
|
||||
isAuthAudio: e
|
||||
@ -273,28 +273,28 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
onUnload: function() {
|
||||
onUnload: function () {
|
||||
s.setLocation(null), this.setData({
|
||||
map: null
|
||||
});
|
||||
},
|
||||
chooseVideo: function(t) {
|
||||
chooseVideo: function (t) {
|
||||
var a = this, e = t.currentTarget.dataset.item, i = e.maxCount - e.valueList.length, s = t.currentTarget.dataset.index;
|
||||
wx.chooseMedia({
|
||||
count: Number.parseInt(i),
|
||||
mediaType: [ "video" ],
|
||||
sourceType: [ "camera", "album" ],
|
||||
mediaType: ["video"],
|
||||
sourceType: ["camera", "album"],
|
||||
maxDuration: 60,
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.tempFiles.length > 0 && (t.tempFiles[0].duration <= a.data.maxDuration ? a.doUploadVideo(s, t.tempFiles, a.data.uploadVideoCount) : wx.showToast({
|
||||
title: "视频最长60秒",
|
||||
icon: "none"
|
||||
}));
|
||||
},
|
||||
fail: function(t) {}
|
||||
fail: function (t) { }
|
||||
});
|
||||
},
|
||||
doUploadVideo: function(t, e, i) {
|
||||
doUploadVideo: function (t, e, i) {
|
||||
wx.showLoading({
|
||||
title: "上传中..."
|
||||
});
|
||||
@ -305,11 +305,11 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(a) {
|
||||
}).then(function (a) {
|
||||
wx.hideLoading({});
|
||||
var i = JSON.parse(a).data;
|
||||
s.doUploadVideoImg(t, i, e, s.data.uploadVideoCount);
|
||||
}).catch(function(a) {
|
||||
}).catch(function (a) {
|
||||
wx.hideLoading({}), s.setData({
|
||||
uploadVideoCount: ++s.data.uploadVideoCount
|
||||
}), s.doUploadVideo(t, e, s.data.uploadVideoCount);
|
||||
@ -317,7 +317,7 @@ Page({
|
||||
uploadVideoCount: 0
|
||||
}));
|
||||
},
|
||||
doUploadVideoImg: function(t, e, i, s) {
|
||||
doUploadVideoImg: function (t, e, i, s) {
|
||||
wx.showLoading({
|
||||
title: "上传中..."
|
||||
});
|
||||
@ -328,7 +328,7 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(s) {
|
||||
}).then(function (s) {
|
||||
console.log(s), wx.hideLoading({});
|
||||
var o = a.baseUrls.baseCardUrl + e, d = a.baseUrls.baseCardUrl + JSON.parse(s).data, r = JSON.parse(s).data, l = {
|
||||
id: e,
|
||||
@ -341,38 +341,38 @@ Page({
|
||||
}), n.setData({
|
||||
uploadVideoCount: ++n.data.uploadVideoCount
|
||||
}), n.doUploadVideo(t, i, n.data.uploadVideoCount);
|
||||
}).catch(function(a) {
|
||||
}).catch(function (a) {
|
||||
console.log(a), wx.hideLoading({}), n.setData({
|
||||
uploadVideoCount: ++n.data.uploadVideoCount
|
||||
}), n.doUploadVideo(t, i, n.data.uploadVideoCount);
|
||||
});
|
||||
},
|
||||
viewVideo: function(t) {
|
||||
var a = [ {
|
||||
viewVideo: function (t) {
|
||||
var a = [{
|
||||
url: t.currentTarget.dataset.url,
|
||||
type: "video"
|
||||
} ];
|
||||
}];
|
||||
wx.previewMedia({
|
||||
sources: a,
|
||||
current: 0,
|
||||
showmenu: !1
|
||||
});
|
||||
},
|
||||
delVideo: function(t) {
|
||||
delVideo: function (t) {
|
||||
var a = this, e = t.currentTarget.dataset.index, i = t.currentTarget.dataset.idx;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该视频吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.confirm && (a.data.fieldList[e].valueList.splice(i, 1), a.setData({
|
||||
fieldList: a.data.fieldList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
addLink: function() {
|
||||
addLink: function () {
|
||||
for (var t = null, a = 0; a < this.data.items.length; a++) if ("LINK" == this.data.items[a].type) {
|
||||
t = this.data.items[a];
|
||||
break;
|
||||
@ -390,7 +390,7 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
addDesc: function() {
|
||||
addDesc: function () {
|
||||
for (var t = null, a = 0; a < this.data.items.length; a++) if ("TEXTAREA" == this.data.items[a].type) {
|
||||
t = this.data.items[a];
|
||||
break;
|
||||
@ -408,7 +408,7 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
addStr: function() {
|
||||
addStr: function () {
|
||||
for (var t = null, a = 0; a < this.data.items.length; a++) if ("TEXT" == this.data.items[a].type) {
|
||||
t = this.data.items[a];
|
||||
break;
|
||||
@ -426,49 +426,49 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
delText: function(t) {
|
||||
delText: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该条数据吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.textList.splice(t.currentTarget.dataset.index, 1), a.setData({
|
||||
textList: a.data.textList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
delLink: function(t) {
|
||||
delLink: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该条数据吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.linkList.splice(t.currentTarget.dataset.index, 1), a.setData({
|
||||
linkList: a.data.linkList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
delDesc: function(t) {
|
||||
delDesc: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该条数据吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.textareaList.splice(t.currentTarget.dataset.index, 1), a.setData({
|
||||
textareaList: a.data.textareaList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
confirmSel: function(t) {
|
||||
confirmSel: function (t) {
|
||||
var a = t.detail, e = (a.piacker, a.value);
|
||||
this.setData({
|
||||
selDisplayType: e.id,
|
||||
@ -476,15 +476,15 @@ Page({
|
||||
isShowType: !1
|
||||
});
|
||||
},
|
||||
cancelSel: function(t) {
|
||||
cancelSel: function (t) {
|
||||
this.setData({
|
||||
isShowType: !1
|
||||
});
|
||||
},
|
||||
textInput: function(a) {
|
||||
textInput: function (a) {
|
||||
this.setData(t({}, a.currentTarget.id, a.detail.value));
|
||||
},
|
||||
onHide: function(t) {
|
||||
onHide: function (t) {
|
||||
this.setData({
|
||||
isShowText: !1,
|
||||
isShowDesc: !1,
|
||||
@ -495,44 +495,44 @@ Page({
|
||||
isShowTags: !1
|
||||
});
|
||||
},
|
||||
chooseTags: function(t) {
|
||||
chooseTags: function (t) {
|
||||
var a = t.currentTarget.dataset.idx;
|
||||
this.data.fieldList[this.data.currentIndex].dictionariesList[a].isSel = !this.data.fieldList[this.data.currentIndex].dictionariesList[a].isSel,
|
||||
this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
});
|
||||
var e = "", i = "";
|
||||
this.data.fieldList[this.data.currentIndex].dictionariesList.forEach(function(t) {
|
||||
this.data.fieldList[this.data.currentIndex].dictionariesList.forEach(function (t) {
|
||||
t.isSel && (e += t.dataName + ",", i += t.dataId + ",");
|
||||
}), e = e.substr(0, e.length - 1), i = i.substr(0, i.length - 1), this.data.fieldList[this.data.currentIndex].selValue = e,
|
||||
this.data.fieldList[this.data.currentIndex].value = i, this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
});
|
||||
},
|
||||
selTags: function() {
|
||||
selTags: function () {
|
||||
this.setData({
|
||||
isShowTags: !1
|
||||
});
|
||||
},
|
||||
choosePhoto: function(t) {
|
||||
choosePhoto: function (t) {
|
||||
var a = this, e = t.currentTarget.dataset.item, i = t.currentTarget.dataset.index, s = e.maxCount - e.valueList.length;
|
||||
wx.chooseImage({
|
||||
count: Number.parseInt(s),
|
||||
sourceType: [ "album", "camera" ],
|
||||
success: function(t) {
|
||||
sourceType: ["album", "camera"],
|
||||
success: function (t) {
|
||||
a.doUploadImg(i, t.tempFilePaths, a.data.uploadCount);
|
||||
},
|
||||
fail: function(t) {}
|
||||
fail: function (t) { }
|
||||
});
|
||||
},
|
||||
delImg: function(t) {
|
||||
delImg: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该图片吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.fieldList[t.currentTarget.dataset.itemindex].valueList.splice(t.currentTarget.dataset.index, 1),
|
||||
a.setData({
|
||||
fieldList: a.data.fieldList
|
||||
@ -540,14 +540,14 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
viewImg: function(t) {
|
||||
var a = [ t.currentTarget.dataset.url ];
|
||||
viewImg: function (t) {
|
||||
var a = [t.currentTarget.dataset.url];
|
||||
wx.previewImage({
|
||||
urls: a,
|
||||
current: t.currentTarget.dataset.url
|
||||
});
|
||||
},
|
||||
doUploadImg: function(t, e, i) {
|
||||
doUploadImg: function (t, e, i) {
|
||||
wx.showLoading({
|
||||
title: "上传中..."
|
||||
});
|
||||
@ -558,7 +558,7 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(i) {
|
||||
}).then(function (i) {
|
||||
wx.hideLoading({});
|
||||
var n = JSON.parse(i).data, o = {
|
||||
id: n,
|
||||
@ -569,7 +569,7 @@ Page({
|
||||
}), s.setData({
|
||||
uploadCount: ++s.data.uploadCount
|
||||
}), s.doUploadImg(t, e, s.data.uploadCount);
|
||||
}).catch(function(a) {
|
||||
}).catch(function (a) {
|
||||
wx.hideLoading({}), s.setData({
|
||||
uploadCount: ++s.data.uploadCount
|
||||
}), s.doUploadImg(t, e, s.data.uploadCount);
|
||||
@ -577,7 +577,7 @@ Page({
|
||||
uploadCount: 0
|
||||
}));
|
||||
},
|
||||
chooseLocation: function(t) {
|
||||
chooseLocation: function (t) {
|
||||
var a = t.currentTarget.dataset.index;
|
||||
this.setData({
|
||||
curMapIndex: a
|
||||
@ -587,14 +587,14 @@ Page({
|
||||
url: "plugin://chooseLocation/index?key=".concat("HVDBZ-KJGKF-DNMJR-JHEWI-H2HN7-23BMS", "&referer=").concat("市域自治与互助", "&location=").concat(e, "&category=").concat("生活服务,娱乐休闲")
|
||||
});
|
||||
},
|
||||
delMap: function(t) {
|
||||
delMap: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该条数据吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.fieldList[t.currentTarget.dataset.index].valueList.splice(t.currentTarget.dataset.idx, 1),
|
||||
a.setData({
|
||||
fieldList: a.data.fieldList
|
||||
@ -602,7 +602,7 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
delAudio: function(t) {
|
||||
delAudio: function (t) {
|
||||
console.log(t);
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
@ -610,7 +610,7 @@ Page({
|
||||
content: "确定要删除该音频吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.fieldList[t.currentTarget.dataset.index].valueList.splice(t.currentTarget.dataset.idx, 1),
|
||||
a.setData({
|
||||
fieldList: a.data.fieldList
|
||||
@ -618,22 +618,22 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
doStartRecord: function() {
|
||||
doStartRecord: function () {
|
||||
var t = this;
|
||||
wx.getSetting({
|
||||
success: function(a) {
|
||||
success: function (a) {
|
||||
a.authSetting["scope.record"] ? t.startRecord() : wx.authorize({
|
||||
scope: "scope.record",
|
||||
success: function() {
|
||||
success: function () {
|
||||
t.startRecord();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
startRecord: function() {
|
||||
startRecord: function () {
|
||||
var t = this;
|
||||
t.data.setInter = setInterval(function() {
|
||||
t.data.setInter = setInterval(function () {
|
||||
var a = parseInt(t.data.speck_time + 1);
|
||||
t.setData({
|
||||
speck_time: parseInt(a),
|
||||
@ -646,7 +646,7 @@ Page({
|
||||
}));
|
||||
}, 1e3);
|
||||
},
|
||||
doEndRecord: function() {
|
||||
doEndRecord: function () {
|
||||
clearInterval(this.data.setInter), this.data.speck_time > 3 ? (clearInterval(this.data.setInter),
|
||||
this.stop(!0), this.setData({
|
||||
speck_time: "0",
|
||||
@ -660,23 +660,23 @@ Page({
|
||||
isStartRecord: !1
|
||||
}));
|
||||
},
|
||||
start: function() {
|
||||
start: function () {
|
||||
e.start({
|
||||
duration: 6e4,
|
||||
format: "mp3"
|
||||
}), e.onStart(function() {
|
||||
}), e.onStart(function () {
|
||||
console.log("recorder start");
|
||||
}), e.onError(function(t) {
|
||||
}), e.onError(function (t) {
|
||||
console.log(t), _self.stop(!1);
|
||||
});
|
||||
},
|
||||
stop: function(t) {
|
||||
stop: function (t) {
|
||||
var a = this;
|
||||
e.stop(), e.onStop(function(e) {
|
||||
e.stop(), e.onStop(function (e) {
|
||||
t && a.doUploadAudio(e);
|
||||
});
|
||||
},
|
||||
doUploadAudio: function(t) {
|
||||
doUploadAudio: function (t) {
|
||||
wx.showLoading({
|
||||
title: "上传中..."
|
||||
});
|
||||
@ -687,7 +687,7 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(i) {
|
||||
}).then(function (i) {
|
||||
if (wx.hideLoading({}), e.data.fieldList[e.data.currentIndex].valueList.length < e.data.currentItem.maxCount) {
|
||||
wx.hideLoading({});
|
||||
var s = JSON.parse(i).data, n = a.baseUrls.baseCardUrl + s, o = parseInt(t.duration / 1e3), d = parseInt(o / 60), r = parseInt(o % 60), l = {
|
||||
@ -705,35 +705,35 @@ Page({
|
||||
isShowAudio: !1
|
||||
});
|
||||
}
|
||||
}).catch(function(t) {});
|
||||
}).catch(function (t) { });
|
||||
},
|
||||
play: function(t) {
|
||||
play: function (t) {
|
||||
var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.idx, s = t.currentTarget.dataset.item, n = this;
|
||||
n.data.fieldList[a].valueList.forEach(function(t) {
|
||||
n.data.fieldList[a].valueList.forEach(function (t) {
|
||||
t.isPlay && i.stop(), t.isPlay = !1, t.curDuation = 0, t.curDuationStr = "00:00";
|
||||
}), s.isPlay || ((i = wx.createInnerAudioContext()).src = n.data.fieldList[a].valueList[e].path,
|
||||
i.autoplay = !0), i.onPlay(function() {
|
||||
i.autoplay = !0), i.onPlay(function () {
|
||||
n.data.fieldList[a].valueList[e].isPlay = !0, n.setData({
|
||||
fieldList: n.data.fieldList
|
||||
});
|
||||
}), i.onCanplay(function(t) {}), i.onStop(function(t) {
|
||||
}), i.onCanplay(function (t) { }), i.onStop(function (t) {
|
||||
n.data.fieldList[a].valueList[e].isPlay = !1, n.data.fieldList[a].valueList[e].curDuration = 0,
|
||||
n.data.fieldList[a].valueList[e].curDurationStr = "00:00", n.setData({
|
||||
fieldList: n.data.fieldList
|
||||
});
|
||||
}), i.onEnded(function(t) {
|
||||
}), i.onEnded(function (t) {
|
||||
n.data.fieldList[a].valueList[e].isPlay = !1, n.data.fieldList[a].valueList[e].curDuration = 0,
|
||||
n.data.fieldList[a].valueList[e].curDurationStr = "00:00", n.setData({
|
||||
fieldList: n.data.fieldList
|
||||
});
|
||||
}), i.onError(function(t) {
|
||||
}), i.onError(function (t) {
|
||||
n.data.fieldList[a].valueList[e].isPlay = !1, n.data.fieldList[a].valueList[e].curDuration = 0,
|
||||
n.data.fieldList[a].valueList[e].curDurationStr = "00:00", n.setData({
|
||||
fieldList: n.data.fieldList
|
||||
});
|
||||
}), i.onSeeking(function() {
|
||||
}), i.onSeeking(function () {
|
||||
console.log(i.currentTime);
|
||||
}), i.onWaiting(function() {}), i.onTimeUpdate(function() {
|
||||
}), i.onWaiting(function () { }), i.onTimeUpdate(function () {
|
||||
if (i.duration != 1 / 0) {
|
||||
n.data.fieldList[a].valueList[e].curDuration = parseInt(i.currentTime), n.data.fieldList[a].valueList[e].duration = parseInt(i.duration),
|
||||
console.log(i.duration);
|
||||
@ -745,31 +745,31 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
rewind: function(t) {
|
||||
rewind: function (t) {
|
||||
var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.idx;
|
||||
t.currentTarget.dataset.item.isPlay && (this.data.fieldList[a].valueList[e].curDuration = this.data.fieldList[a].valueList[e].curDuration - this.data.speedStep,
|
||||
i.seek(this.data.fieldList[a].valueList[e].curDuration), this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
}));
|
||||
},
|
||||
speed: function(t) {
|
||||
speed: function (t) {
|
||||
var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.idx;
|
||||
t.currentTarget.dataset.item.isPlay && (this.data.fieldList[a].valueList[e].curDuration = this.data.fieldList[a].valueList[e].curDuration + this.data.speedStep,
|
||||
i.seek(this.data.fieldList[a].valueList[e].curDuration), this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
}));
|
||||
},
|
||||
slider4change: function(t) {
|
||||
slider4change: function (t) {
|
||||
t.currentTarget.dataset.item.isPlay && i.seek(t.detail.value);
|
||||
},
|
||||
showDialog: function(t) {
|
||||
showDialog: function (t) {
|
||||
console.log(t), this.setData({
|
||||
isShowAudio: !0,
|
||||
currentItem: t.currentTarget.dataset.item,
|
||||
currentIndex: t.currentTarget.dataset.index
|
||||
});
|
||||
},
|
||||
doPublish: function() {
|
||||
doPublish: function () {
|
||||
if (this.checkParams()) {
|
||||
wx.showToast({
|
||||
title: "保存中..."
|
||||
@ -782,7 +782,7 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(t) {
|
||||
}).then(function (t) {
|
||||
wx.hideLoading({});
|
||||
var a = getCurrentPages();
|
||||
a[a.length - 2].setData({
|
||||
@ -790,12 +790,12 @@ Page({
|
||||
}), wx.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}).catch(function(t) {
|
||||
}).catch(function (t) {
|
||||
console.log(t);
|
||||
});
|
||||
}
|
||||
},
|
||||
checkParams: function() {
|
||||
checkParams: function () {
|
||||
for (var t = !0, a = 0; a < this.data.fieldList.length; a++) {
|
||||
var e = this.data.fieldList[a];
|
||||
if (e.must) if ("1" == e.dataType || "7" == e.dataType || "8" == e.dataType || "9" == e.dataType) {
|
||||
@ -816,29 +816,29 @@ Page({
|
||||
}
|
||||
return t;
|
||||
},
|
||||
buildParams: function() {
|
||||
buildParams: function () {
|
||||
for (var t = {
|
||||
uid: this.data.uId
|
||||
}, a = 0; a < this.data.fieldList.length; a++) {
|
||||
var e = this.data.fieldList[a];
|
||||
if ("1" == e.dataType || "7" == e.dataType || "8" == e.dataType || "9" == e.dataType) e.value.length > 0 && (t[e.name] = e.value); else if (e.valueList.length > 0) {
|
||||
var i = "";
|
||||
"6" == e.dataType ? e.valueList.forEach(function(t) {
|
||||
"6" == e.dataType ? e.valueList.forEach(function (t) {
|
||||
i += t.latitude + "," + t.longitude + "-";
|
||||
}) : "4" == e.dataType ? e.valueList.forEach(function(t) {
|
||||
}) : "4" == e.dataType ? e.valueList.forEach(function (t) {
|
||||
i += t.id + "&" + t.thumbId + ",";
|
||||
}) : "3" == e.dataType ? e.valueList.forEach(function(t) {
|
||||
}) : "3" == e.dataType ? e.valueList.forEach(function (t) {
|
||||
i += t.id + "&" + t.duration + ",";
|
||||
}) : "2" == e.dataType ? (e.valueList.forEach(function(t) {
|
||||
}) : "2" == e.dataType ? (e.valueList.forEach(function (t) {
|
||||
i += t.id + ",";
|
||||
}), i = i.substr(0, i.length - 1), i += "@" + this.data.selDisplayType) : e.valueList.forEach(function(t) {
|
||||
}), i = i.substr(0, i.length - 1), i += "@" + this.data.selDisplayType) : e.valueList.forEach(function (t) {
|
||||
i += t.id + ",";
|
||||
}), "2" != e.dataType && (i = i.substr(0, i.length - 1)), t[e.name] = i;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
},
|
||||
showDisplayType: function(t) {
|
||||
showDisplayType: function (t) {
|
||||
this.setData({
|
||||
isShowType: !0
|
||||
});
|
||||
|
@ -1,12 +1,22 @@
|
||||
var t = getApp(), a = wx.getRecorderManager(), e = wx.createInnerAudioContext(), i = requirePlugin("chooseLocation"), s = {
|
||||
// var t = getApp(), a = wx.getRecorderManager(), , i = requirePlugin("chooseLocation"), s = {
|
||||
// latitude: 39.90877,
|
||||
// longitude: 116.39695
|
||||
// };
|
||||
|
||||
|
||||
const app = getApp()
|
||||
const recorderManager = wx.getRecorderManager()
|
||||
var e = wx.createInnerAudioContext();
|
||||
const chooseLocation = requirePlugin('chooseLocation');
|
||||
var location = {
|
||||
latitude: 39.90877,
|
||||
longitude: 116.39695
|
||||
};
|
||||
}; //默认坐标点
|
||||
|
||||
Page({
|
||||
data: {
|
||||
maringHeight: t.globalData.CustomBar,
|
||||
fieldList: [ {
|
||||
maringHeight: app.globalData.CustomBar,
|
||||
fieldList: [{
|
||||
type: "text"
|
||||
}, {
|
||||
type: "video"
|
||||
@ -22,7 +32,7 @@ Page({
|
||||
type: "link"
|
||||
}, {
|
||||
type: "photo"
|
||||
} ],
|
||||
}],
|
||||
valueList: [],
|
||||
isShowInput: !1,
|
||||
isShowPhoto: !1,
|
||||
@ -50,7 +60,7 @@ Page({
|
||||
speedStep: 5,
|
||||
sourceType: "add",
|
||||
insertIndex: -1,
|
||||
optionsList: [ {
|
||||
optionsList: [{
|
||||
id: "1",
|
||||
name: "选项一",
|
||||
isSel: !1
|
||||
@ -70,25 +80,25 @@ Page({
|
||||
id: "5",
|
||||
name: "选项五",
|
||||
isSel: !1
|
||||
} ]
|
||||
}]
|
||||
},
|
||||
onLoad: function(t) {
|
||||
onLoad: function (t) {
|
||||
this.setData({
|
||||
columnId: t.id
|
||||
}), this.checkPermission(), this.countBoxHeight();
|
||||
},
|
||||
countBoxHeight: function() {
|
||||
countBoxHeight: function () {
|
||||
var t = this, a = wx.createSelectorQuery();
|
||||
a.select("#top-box").boundingClientRect(), a.exec(function(a) {
|
||||
a.select("#top-box").boundingClientRect(), a.exec(function (a) {
|
||||
t.setData({
|
||||
topBoxHeight: a[0].height + 7
|
||||
});
|
||||
});
|
||||
},
|
||||
onShow: function() {
|
||||
onShow: function () {
|
||||
var t = this;
|
||||
if (null != i.getLocation()) {
|
||||
var a = i.getLocation(), e = {
|
||||
if (null != chooseLocation.getLocation()) {
|
||||
var a = chooseLocation.getLocation(), e = {
|
||||
type: "map"
|
||||
};
|
||||
e.value = a, "add" == t.data.sourceType ? t.data.valueList.push(e) : t.data.valueList.splice(t.data.currentIndex, "edit" == t.data.sourceType ? 1 : 0, e),
|
||||
@ -98,7 +108,7 @@ Page({
|
||||
}
|
||||
wx.getSetting({
|
||||
withSubscriptions: !0,
|
||||
success: function(a) {
|
||||
success: function (a) {
|
||||
var e = a.authSetting["scope.record"];
|
||||
t.setData({
|
||||
isAuthAudio: e
|
||||
@ -106,7 +116,7 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
showType: function(t) {
|
||||
showType: function (t) {
|
||||
switch (t.currentTarget.dataset.type) {
|
||||
case "text":
|
||||
case "textarea":
|
||||
@ -143,13 +153,13 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
chooseImg: function() {
|
||||
chooseImg: function () {
|
||||
var t = this;
|
||||
wx.chooseImage({
|
||||
count: 9,
|
||||
sourceType: [ "album", "camera" ],
|
||||
success: function(a) {
|
||||
console.log(a), a.tempFilePaths.forEach(function(a) {
|
||||
sourceType: ["album", "camera"],
|
||||
success: function (a) {
|
||||
console.log(a), a.tempFilePaths.forEach(function (a) {
|
||||
var e = {};
|
||||
e.path = a, t.data.photoList.push(e);
|
||||
}), t.setData({
|
||||
@ -157,7 +167,7 @@ Page({
|
||||
isShowPhoto: !0
|
||||
});
|
||||
},
|
||||
fail: function(t) {
|
||||
fail: function (t) {
|
||||
-1 == t.errMsg.indexOf("fail cancel") && wx.showToast({
|
||||
title: "请重新选择",
|
||||
icon: "error"
|
||||
@ -165,15 +175,15 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseVideo: function() {
|
||||
chooseVideo: function () {
|
||||
var t = this;
|
||||
wx.chooseMedia({
|
||||
count: 9,
|
||||
mediaType: [ "video" ],
|
||||
sourceType: [ "album", "camera" ],
|
||||
mediaType: ["video"],
|
||||
sourceType: ["album", "camera"],
|
||||
maxDuration: 60,
|
||||
success: function(a) {
|
||||
a.tempFiles.forEach(function(a) {
|
||||
success: function (a) {
|
||||
a.tempFiles.forEach(function (a) {
|
||||
var e = {};
|
||||
e.path = a.tempFilePath, e.coverPath = a.thumbTempFilePath, t.data.videoList.push(e);
|
||||
}), t.setData({
|
||||
@ -181,7 +191,7 @@ Page({
|
||||
isShowVideo: !0
|
||||
});
|
||||
},
|
||||
fail: function(t) {
|
||||
fail: function (t) {
|
||||
-1 == t.errMsg.indexOf("fail cancel") && wx.showToast({
|
||||
title: "请重新选择",
|
||||
icon: "error"
|
||||
@ -189,7 +199,7 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
showEditBox: function(t) {
|
||||
showEditBox: function (t) {
|
||||
var a = t.currentTarget.dataset.idx;
|
||||
this.data.currentIndex == a ? this.setData({
|
||||
currentIndex: -1
|
||||
@ -197,41 +207,41 @@ Page({
|
||||
currentIndex: a
|
||||
});
|
||||
},
|
||||
chooseDirection: function(t) {
|
||||
chooseDirection: function (t) {
|
||||
var a = t.currentTarget.dataset.idx;
|
||||
this.setData({
|
||||
selDirection: a
|
||||
});
|
||||
},
|
||||
choosePhotoDisplay: function(t) {
|
||||
choosePhotoDisplay: function (t) {
|
||||
var a = t.currentTarget.dataset.type;
|
||||
this.setData({
|
||||
curSelPhotoDisplay: a
|
||||
});
|
||||
},
|
||||
chooseVideoDisplay: function(t) {
|
||||
chooseVideoDisplay: function (t) {
|
||||
var a = t.currentTarget.dataset.type;
|
||||
this.setData({
|
||||
curVideoDisplay: a
|
||||
});
|
||||
},
|
||||
chooseTextAlign: function(t) {
|
||||
chooseTextAlign: function (t) {
|
||||
var a = t.currentTarget.dataset.type;
|
||||
this.setData({
|
||||
curTextAlign: a
|
||||
});
|
||||
},
|
||||
chooseFieldType: function(t) {
|
||||
chooseFieldType: function (t) {
|
||||
var a = t.currentTarget.dataset.idx, e = t.currentTarget.dataset.type;
|
||||
this.setData({
|
||||
curFieldTypeIndex: a,
|
||||
curFieldType: e
|
||||
});
|
||||
},
|
||||
confirmPhoto: function() {
|
||||
confirmPhoto: function () {
|
||||
if (this.data.photoList.length > 0) {
|
||||
var t = [];
|
||||
this.data.photoList.forEach(function(a) {
|
||||
this.data.photoList.forEach(function (a) {
|
||||
var e = {};
|
||||
e.path = a.path, t.push(e);
|
||||
});
|
||||
@ -250,10 +260,10 @@ Page({
|
||||
icon: "error"
|
||||
});
|
||||
},
|
||||
confirmVideo: function() {
|
||||
confirmVideo: function () {
|
||||
if (this.data.videoList.length > 0) {
|
||||
var t = [];
|
||||
this.data.videoList.forEach(function(a) {
|
||||
this.data.videoList.forEach(function (a) {
|
||||
var e = {};
|
||||
e.path = a.path, e.coverPath = a.coverPath, t.push(e);
|
||||
});
|
||||
@ -274,7 +284,7 @@ Page({
|
||||
icon: "error"
|
||||
});
|
||||
},
|
||||
doInsert: function() {
|
||||
doInsert: function () {
|
||||
var t = -1;
|
||||
switch (t = 1 == this.data.selDirection ? this.data.currentIndex : ++this.data.currentIndex,
|
||||
this.setData({
|
||||
@ -317,12 +327,12 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
hideEditBox: function() {
|
||||
hideEditBox: function () {
|
||||
this.setData({
|
||||
currentIndex: -1
|
||||
});
|
||||
},
|
||||
onClose: function() {
|
||||
onClose: function () {
|
||||
this.setData({
|
||||
isShowInput: !1,
|
||||
isShowLink: !1,
|
||||
@ -330,17 +340,17 @@ Page({
|
||||
sourceType: "add"
|
||||
});
|
||||
},
|
||||
inputWatch: function(t) {
|
||||
inputWatch: function (t) {
|
||||
this.setData({
|
||||
curTextValue: t.detail.value
|
||||
});
|
||||
},
|
||||
inputLink: function(t) {
|
||||
inputLink: function (t) {
|
||||
this.setData({
|
||||
curLinkText: t.detail.value
|
||||
});
|
||||
},
|
||||
doConfirmLink: function() {
|
||||
doConfirmLink: function () {
|
||||
if ("" == this.data.curLinkText) wx.showToast({
|
||||
title: "请输入链接",
|
||||
icon: "error"
|
||||
@ -356,7 +366,7 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
doConfirmInput: function() {
|
||||
doConfirmInput: function () {
|
||||
if ("" == this.data.curTextValue) wx.showToast({
|
||||
title: "请输入内容",
|
||||
icon: "error"
|
||||
@ -387,19 +397,19 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
checkPermission: function() {
|
||||
checkPermission: function () {
|
||||
var t = this;
|
||||
wx.getSetting({
|
||||
success: function(a) {
|
||||
success: function (a) {
|
||||
var e = a.authSetting["scope.record"];
|
||||
void 0 === e ? wx.authorize({
|
||||
scope: "scope.record",
|
||||
success: function() {
|
||||
success: function () {
|
||||
t.setData({
|
||||
isAuthAudio: !0
|
||||
});
|
||||
},
|
||||
fail: function() {
|
||||
fail: function () {
|
||||
t.setData({
|
||||
isAuthAudio: !1
|
||||
});
|
||||
@ -408,62 +418,62 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
openSetting: function() {
|
||||
openSetting: function () {
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "发布内容需要您授权录音权限.",
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.confirm && wx.openSetting({
|
||||
withSubscriptions: !0
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
viewPhoto: function(t) {
|
||||
viewPhoto: function (t) {
|
||||
var a = t.currentTarget.dataset.url;
|
||||
wx.previewImage({
|
||||
urls: [ a ]
|
||||
urls: [a]
|
||||
});
|
||||
},
|
||||
delPhoto: function(t) {
|
||||
delPhoto: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该图片吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.photoList.splice(t.currentTarget.dataset.index, 1), a.setData({
|
||||
photoList: a.data.photoList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
viewVideo: function(t) {
|
||||
viewVideo: function (t) {
|
||||
var a = t.currentTarget.dataset.idx, e = t.currentTarget.dataset.index, i = this.data.valueList[e].valueList[a].path, s = {};
|
||||
s.url = i, s.type = "video", wx.previewMedia({
|
||||
sources: [ s ]
|
||||
sources: [s]
|
||||
});
|
||||
},
|
||||
delVideo: function(t) {
|
||||
delVideo: function (t) {
|
||||
var a = this, e = t.currentTarget.dataset.index;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该视频吗?",
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.confirm && (a.data.videoList.splice(e, 1), a.setData({
|
||||
videoList: a.data.videoList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
doChooseLocation: function(t) {
|
||||
doChooseLocation: function (t) {
|
||||
var a = JSON.stringify(s);
|
||||
wx.navigateTo({
|
||||
url: "plugin://chooseLocation/index?key=".concat("HVDBZ-KJGKF-DNMJR-JHEWI-H2HN7-23BMS", "&referer=").concat("市域自治与互助", "&location=").concat(a, "&category=").concat("生活服务,娱乐休闲")
|
||||
});
|
||||
},
|
||||
editItem: function(t) {
|
||||
editItem: function (t) {
|
||||
var a = t.currentTarget.dataset.index;
|
||||
switch (this.setData({
|
||||
sourceType: "edit"
|
||||
@ -514,17 +524,17 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
insertItem: function(t) {
|
||||
insertItem: function (t) {
|
||||
this.setData({
|
||||
isInsert: !this.data.isInsert
|
||||
});
|
||||
},
|
||||
delItem: function(t) {
|
||||
delItem: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该条数据吗?",
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.confirm && (a.data.valueList.splice(a.data.currentIndex, 1), a.setData({
|
||||
valueList: a.data.valueList,
|
||||
currentIndex: -1
|
||||
@ -532,21 +542,21 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseTags: function(t) {
|
||||
chooseTags: function (t) {
|
||||
var a = t.currentTarget.dataset.idx, e = t.currentTarget.dataset.item;
|
||||
this.data.optionsList[a].isSel = !e.isSel, this.setData({
|
||||
optionsList: this.data.optionsList
|
||||
});
|
||||
},
|
||||
doConfirmSel: function() {
|
||||
doConfirmSel: function () {
|
||||
var t = [];
|
||||
this.data.optionsList.forEach(function(a) {
|
||||
this.data.optionsList.forEach(function (a) {
|
||||
a.isSel && t.push(a);
|
||||
});
|
||||
var a = {
|
||||
type: "select"
|
||||
};
|
||||
a.valueList = t, this.data.valueList.push(a), this.data.optionsList.forEach(function(t) {
|
||||
a.valueList = t, this.data.valueList.push(a), this.data.optionsList.forEach(function (t) {
|
||||
t.isSel = !1;
|
||||
}), this.setData({
|
||||
valueList: this.data.valueList,
|
||||
@ -554,7 +564,7 @@ Page({
|
||||
optionsList: this.data.optionsList
|
||||
});
|
||||
},
|
||||
doConfirmAudio: function() {
|
||||
doConfirmAudio: function () {
|
||||
this.data.audioFile.isPlay && e.stop();
|
||||
var t = {
|
||||
type: "audio"
|
||||
@ -567,15 +577,15 @@ Page({
|
||||
isShowAudio: !1
|
||||
});
|
||||
},
|
||||
checkRecordPermission: function() {
|
||||
checkRecordPermission: function () {
|
||||
var t = this;
|
||||
wx.getSetting({
|
||||
success: function(a) {
|
||||
success: function (a) {
|
||||
a.authSetting["scope.record"] ? t.setData({
|
||||
isShowAudio: !0
|
||||
}) : wx.authorize({
|
||||
scope: "scope.record",
|
||||
success: function() {
|
||||
success: function () {
|
||||
t.setData({
|
||||
isShowAudio: !0
|
||||
});
|
||||
@ -584,9 +594,9 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
startRecord: function() {
|
||||
startRecord: function () {
|
||||
var t = this;
|
||||
t.data.setInter = setInterval(function() {
|
||||
t.data.setInter = setInterval(function () {
|
||||
var a = parseInt(t.data.audioDuration + 1);
|
||||
t.setData({
|
||||
audioDuration: parseInt(a),
|
||||
@ -594,20 +604,22 @@ Page({
|
||||
});
|
||||
}, 1e3), t.start();
|
||||
},
|
||||
start: function() {
|
||||
start: function () {
|
||||
console.log("开始录音");
|
||||
a.start({
|
||||
recorderManager.start({
|
||||
duration: 6e4,
|
||||
format: "mp3"
|
||||
}), a.onStart(function() {
|
||||
}), recorderManager.onStart(function () {
|
||||
console.log("recorder start");
|
||||
}), a.onError(function(t) {
|
||||
}), recorderManager.onError(function (t) {
|
||||
console.log(t), _self.stop(!1);
|
||||
});
|
||||
},
|
||||
doEndRecord: function() {
|
||||
doEndRecord: function () {
|
||||
var t = this;
|
||||
clearInterval(t.data.setInter), a.stop(), a.onStop(function(a) {
|
||||
clearInterval(t.data.setInter);
|
||||
recorderManager.stop();
|
||||
recorderManager.onStop(function (a) {
|
||||
t.data.audioDuration < 10 ? wx.showToast({
|
||||
title: "录音时长需大于10秒",
|
||||
icon: "none"
|
||||
@ -621,25 +633,25 @@ Page({
|
||||
});
|
||||
});
|
||||
},
|
||||
delAudio: function() {
|
||||
delAudio: function () {
|
||||
var t = this;
|
||||
wx.showModal({
|
||||
title: "警告",
|
||||
content: "确定要删除该条录音吗?",
|
||||
success: function(a) {
|
||||
success: function (a) {
|
||||
a.confirm && t.setData({
|
||||
audioFile: null
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
closePop: function(t) {
|
||||
closePop: function (t) {
|
||||
var a = t.currentTarget.dataset.type, i = this;
|
||||
a && "audio" == a && (null != i.data.audioFile ? (i.data.audioFile.isPlay && e.stop(),
|
||||
wx.showModal({
|
||||
title: "警告",
|
||||
content: "关闭录音弹窗将清除当前录制的音频文件,确定要关闭吗?",
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.confirm && i.setData({
|
||||
audioFile: null,
|
||||
isShowAudio: !1
|
||||
@ -655,9 +667,12 @@ Page({
|
||||
sourceType: "add"
|
||||
});
|
||||
},
|
||||
slider4change: function(t) {
|
||||
var a = t.currentTarget.dataset.item, i = t.currentTarget.dataset.type, s = t.currentTarget.dataset.idx, o = Number.parseInt(t.detail.value);
|
||||
a.isPlay && (e.pause(), e.seek(o), setTimeout(function() {
|
||||
slider4change: function (t) {
|
||||
var a = t.currentTarget.dataset.item;
|
||||
i = t.currentTarget.dataset.type;
|
||||
s = t.currentTarget.dataset.idx;
|
||||
o = Number.parseInt(t.detail.value);
|
||||
a.isPlay && (e.pause(), e.seek(o), setTimeout(function () {
|
||||
e.play();
|
||||
}, 500), "record" == i ? (this.data.audioFile.curDuration = o, this.data.audioFile.curDurationStr = "00:" + (o > 9 ? o : "0" + o),
|
||||
console.log(this.data.audioFile), this.setData({
|
||||
@ -667,25 +682,25 @@ Page({
|
||||
valueList: this.data.valueList
|
||||
})));
|
||||
},
|
||||
play: function(t) {
|
||||
play: function (t) {
|
||||
var a = t.currentTarget.dataset.item, i = this, s = t.currentTarget.dataset.type, o = t.currentTarget.dataset.idx;
|
||||
a.isPlay ? e.stop() : ((e = wx.createInnerAudioContext()).src = a.tempFilePath,
|
||||
e.autoplay = !0), e.onPlay(function() {
|
||||
e.autoplay = !0), e.onPlay(function () {
|
||||
"record" == s ? (i.data.audioFile.isPlay = !0, i.setData({
|
||||
audioFile: i.data.audioFile
|
||||
})) : (i.data.valueList[o].value.isPlay = !0, i.setData({
|
||||
valueList: i.data.valueList
|
||||
}));
|
||||
}), e.onStop(function(t) {
|
||||
}), e.onStop(function (t) {
|
||||
"record" == s ? i.setAudioDefault() : i.setShowAudioDefault(o);
|
||||
}), e.onEnded(function(t) {
|
||||
}), e.onEnded(function (t) {
|
||||
"record" == s ? i.setAudioDefault() : i.setShowAudioDefault(o);
|
||||
}), e.onError(function(t) {
|
||||
}), e.onError(function (t) {
|
||||
wx.showToast({
|
||||
title: "播放失败",
|
||||
icon: "error"
|
||||
}), "record" == s ? i.setAudioDefault() : i.setShowAudioDefault(o);
|
||||
}), e.onTimeUpdate(function() {
|
||||
}), e.onTimeUpdate(function () {
|
||||
var t = e.currentTime;
|
||||
if ("record" == s) {
|
||||
i.data.audioFile.curDuration = t;
|
||||
@ -702,19 +717,19 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
setAudioDefault: function() {
|
||||
setAudioDefault: function () {
|
||||
null != this.data.audioFile && (this.data.audioFile.curDurationStr = "00:00", this.data.audioFile.curDuration = 0,
|
||||
this.data.audioFile.isPlay = !1, this.setData({
|
||||
audioFile: this.data.audioFile
|
||||
}));
|
||||
},
|
||||
setShowAudioDefault: function(t) {
|
||||
setShowAudioDefault: function (t) {
|
||||
this.data.valueList[t].value.curDurationStr = "00:00", this.data.valueList[t].value.curDuration = 0,
|
||||
this.data.valueList[t].value.isPlay = !1, this.setData({
|
||||
valueList: this.data.valueList
|
||||
});
|
||||
},
|
||||
rewind: function(t) {
|
||||
rewind: function (t) {
|
||||
var a = t.currentTarget.dataset.item, i = t.currentTarget.dataset.idx, s = t.currentTarget.dataset.type;
|
||||
a.isPlay && ("record" == s ? (this.data.audioFile.curDuration = this.data.audioFile.curDuration - this.data.speedStep,
|
||||
e.seek(this.data.audioFile.curDuration), this.setData({
|
||||
@ -724,7 +739,7 @@ Page({
|
||||
valueList: this.data.valueList
|
||||
})));
|
||||
},
|
||||
speed: function(t) {
|
||||
speed: function (t) {
|
||||
var a = t.currentTarget.dataset.item, i = t.currentTarget.dataset.idx, s = t.currentTarget.dataset.type;
|
||||
a.isPlay && ("record" == s ? (this.data.audioFile.curDuration = this.data.audioFile.curDuration + this.data.speedStep,
|
||||
e.seek(this.data.audioFile.curDuration), this.setData({
|
||||
@ -734,7 +749,7 @@ Page({
|
||||
valueList: this.data.valueList
|
||||
})));
|
||||
},
|
||||
onUnload: function() {
|
||||
onUnload: function () {
|
||||
i.setLocation(null), this.setData({
|
||||
map: null
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
var t = require("../../../@babel/runtime/helpers/defineProperty"), a = getApp(), e = wx.getRecorderManager(), i = wx.createInnerAudioContext(), s = requirePlugin("chooseLocation"), n = {
|
||||
var a = getApp(); var e = wx.getRecorderManager(); var i = wx.createInnerAudioContext(); var s = requirePlugin("chooseLocation"); var n = {
|
||||
latitude: 39.90877,
|
||||
longitude: 116.39695
|
||||
};
|
||||
@ -38,7 +38,7 @@ Page({
|
||||
isAuthAudio: !1,
|
||||
title: "栏目内容发布",
|
||||
curMutliIndex: 0,
|
||||
displayType: [ {
|
||||
displayType: [{
|
||||
name: "九宫格",
|
||||
id: 1
|
||||
}, {
|
||||
@ -50,12 +50,12 @@ Page({
|
||||
}, {
|
||||
name: "平铺",
|
||||
id: 4
|
||||
} ],
|
||||
}],
|
||||
selDisplayType: 1,
|
||||
displayTypeStr: "九宫格",
|
||||
maxDuration: 60
|
||||
},
|
||||
onLoad: function(t) {
|
||||
onLoad: function (t) {
|
||||
this.setData({
|
||||
columnId: t.id,
|
||||
title: t.title + "发布"
|
||||
@ -64,7 +64,7 @@ Page({
|
||||
});
|
||||
this.checkPermission(), this.getFieldList();
|
||||
},
|
||||
getFieldList: function() {
|
||||
getFieldList: function () {
|
||||
wx.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
@ -75,8 +75,8 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(a) {
|
||||
wx.hideLoading({}), a.data.forEach(function(t, a) {
|
||||
}).then(function (a) {
|
||||
wx.hideLoading({}), a.data.forEach(function (t, a) {
|
||||
switch (t.order = a, t.dataType) {
|
||||
case "2":
|
||||
case "3":
|
||||
@ -91,18 +91,18 @@ Page({
|
||||
break;
|
||||
|
||||
case "9":
|
||||
t.selValue = "请选择", t.selIndexs = [], t.dictionariesList.forEach(function(t) {
|
||||
t.selValue = "请选择", t.selIndexs = [], t.dictionariesList.forEach(function (t) {
|
||||
t.isSel = !1;
|
||||
});
|
||||
}
|
||||
}), t.setData({
|
||||
fieldList: a.data
|
||||
});
|
||||
}).catch(function(t) {
|
||||
}).catch(function (t) {
|
||||
wx.hideLoading({}), console.log(t);
|
||||
});
|
||||
},
|
||||
inputText: function(t) {
|
||||
inputText: function (t) {
|
||||
var a, e = t.currentTarget.dataset.index;
|
||||
1 != t.currentTarget.dataset.type ? ((a = this).data.fieldList[e].value = t.detail.value,
|
||||
a.setData({
|
||||
@ -111,19 +111,19 @@ Page({
|
||||
fieldList: a.data.fieldList
|
||||
}));
|
||||
},
|
||||
checkPermission: function() {
|
||||
checkPermission: function () {
|
||||
var t = this;
|
||||
wx.getSetting({
|
||||
success: function(a) {
|
||||
success: function (a) {
|
||||
var e = a.authSetting["scope.record"];
|
||||
void 0 === e ? wx.authorize({
|
||||
scope: "scope.record",
|
||||
success: function() {
|
||||
success: function () {
|
||||
t.setData({
|
||||
isAuthAudio: !0
|
||||
});
|
||||
},
|
||||
fail: function() {
|
||||
fail: function () {
|
||||
t.setData({
|
||||
isAuthAudio: !1
|
||||
});
|
||||
@ -132,18 +132,18 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
openSetting: function() {
|
||||
openSetting: function () {
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "发布内容需要您授权录音权限.",
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.confirm && wx.openSetting({
|
||||
withSubscriptions: !0
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onShow: function() {
|
||||
onShow: function () {
|
||||
if (null != s.getLocation()) {
|
||||
var t = this.data.fieldList[this.data.curMapIndex];
|
||||
t.valueList.length < t.maxCount && (this.data.fieldList[this.data.curMapIndex].valueList.push(s.getLocation()),
|
||||
@ -154,7 +154,7 @@ Page({
|
||||
var a = this;
|
||||
wx.getSetting({
|
||||
withSubscriptions: !0,
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
var e = t.authSetting["scope.record"];
|
||||
a.setData({
|
||||
isAuthAudio: e
|
||||
@ -162,14 +162,14 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
pickerChange: function(t) {
|
||||
pickerChange: function (t) {
|
||||
var a = t.currentTarget.dataset.index, e = t.detail.value;
|
||||
this.data.fieldList[a].index = e, this.data.fieldList[a].value = this.data.fieldList[a].dictionariesList[e].dataId,
|
||||
this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
});
|
||||
},
|
||||
confirmSel: function(t) {
|
||||
confirmSel: function (t) {
|
||||
var a = t.detail, e = (a.piacker, a.value);
|
||||
this.setData({
|
||||
selDisplayType: e.id,
|
||||
@ -177,33 +177,33 @@ Page({
|
||||
isShowType: !1
|
||||
});
|
||||
},
|
||||
cancelSel: function(t) {
|
||||
cancelSel: function (t) {
|
||||
this.setData({
|
||||
isShowType: !1
|
||||
});
|
||||
},
|
||||
onUnload: function() {
|
||||
onUnload: function () {
|
||||
s.setLocation(null), this.setData({
|
||||
map: null
|
||||
});
|
||||
},
|
||||
chooseVideo: function(t) {
|
||||
chooseVideo: function (t) {
|
||||
var a = this, e = t.currentTarget.dataset.item, i = e.maxCount - e.valueList.length, s = t.currentTarget.dataset.index;
|
||||
wx.chooseMedia({
|
||||
count: Number.parseInt(i),
|
||||
mediaType: [ "video" ],
|
||||
sourceType: [ "camera", "album" ],
|
||||
mediaType: ["video"],
|
||||
sourceType: ["camera", "album"],
|
||||
maxDuration: 60,
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
console.log(t), t.tempFiles.length > 0 && (t.tempFiles[0].duration <= a.data.maxDuration ? a.doUploadVideo(s, t.tempFiles, a.data.uploadVideoCount) : wx.showToast({
|
||||
title: "视频最长60秒",
|
||||
icon: "none"
|
||||
}));
|
||||
},
|
||||
fail: function(t) {}
|
||||
fail: function (t) { }
|
||||
});
|
||||
},
|
||||
doUploadVideo: function(t, e, i) {
|
||||
doUploadVideo: function (t, e, i) {
|
||||
wx.showLoading({
|
||||
title: "上传中..."
|
||||
});
|
||||
@ -214,11 +214,11 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(a) {
|
||||
}).then(function (a) {
|
||||
wx.hideLoading({});
|
||||
var i = JSON.parse(a).data;
|
||||
s.doUploadVideoImg(t, i, e, s.data.uploadVideoCount);
|
||||
}).catch(function(a) {
|
||||
}).catch(function (a) {
|
||||
wx.hideLoading({}), s.setData({
|
||||
uploadVideoCount: ++s.data.uploadVideoCount
|
||||
}), s.doUploadVideo(t, e, s.data.uploadVideoCount);
|
||||
@ -226,7 +226,7 @@ Page({
|
||||
uploadVideoCount: 0
|
||||
}));
|
||||
},
|
||||
doUploadVideoImg: function(t, e, i, s) {
|
||||
doUploadVideoImg: function (t, e, i, s) {
|
||||
wx.showLoading({
|
||||
title: "上传中..."
|
||||
});
|
||||
@ -237,7 +237,7 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(s) {
|
||||
}).then(function (s) {
|
||||
console.log(s), wx.hideLoading({});
|
||||
var o = a.baseUrls.baseCardUrl + e, d = a.baseUrls.baseCardUrl + JSON.parse(s).data, r = JSON.parse(s).data, l = {
|
||||
id: e,
|
||||
@ -250,38 +250,38 @@ Page({
|
||||
}), n.setData({
|
||||
uploadVideoCount: ++n.data.uploadVideoCount
|
||||
}), n.doUploadVideo(t, i, n.data.uploadVideoCount);
|
||||
}).catch(function(a) {
|
||||
}).catch(function (a) {
|
||||
console.log(a), wx.hideLoading({}), n.setData({
|
||||
uploadVideoCount: ++n.data.uploadVideoCount
|
||||
}), n.doUploadVideo(t, i, n.data.uploadVideoCount);
|
||||
});
|
||||
},
|
||||
viewVideo: function(t) {
|
||||
var a = [ {
|
||||
viewVideo: function (t) {
|
||||
var a = [{
|
||||
url: t.currentTarget.dataset.url,
|
||||
type: "video"
|
||||
} ];
|
||||
}];
|
||||
wx.previewMedia({
|
||||
sources: a,
|
||||
current: 0,
|
||||
showmenu: !1
|
||||
});
|
||||
},
|
||||
delVideo: function(t) {
|
||||
delVideo: function (t) {
|
||||
var a = this, e = t.currentTarget.dataset.index, i = t.currentTarget.dataset.idx;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该视频吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(t) {
|
||||
success: function (t) {
|
||||
t.confirm && (a.data.fieldList[e].valueList.splice(i, 1), a.setData({
|
||||
fieldList: a.data.fieldList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
addLink: function() {
|
||||
addLink: function () {
|
||||
for (var t = null, a = 0; a < this.data.items.length; a++) if ("LINK" == this.data.items[a].type) {
|
||||
t = this.data.items[a];
|
||||
break;
|
||||
@ -299,7 +299,7 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
addDesc: function() {
|
||||
addDesc: function () {
|
||||
for (var t = null, a = 0; a < this.data.items.length; a++) if ("TEXTAREA" == this.data.items[a].type) {
|
||||
t = this.data.items[a];
|
||||
break;
|
||||
@ -317,7 +317,7 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
addStr: function() {
|
||||
addStr: function () {
|
||||
for (var t = null, a = 0; a < this.data.items.length; a++) if ("TEXT" == this.data.items[a].type) {
|
||||
t = this.data.items[a];
|
||||
break;
|
||||
@ -335,52 +335,52 @@ Page({
|
||||
});
|
||||
}
|
||||
},
|
||||
delText: function(t) {
|
||||
delText: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该条数据吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.textList.splice(t.currentTarget.dataset.index, 1), a.setData({
|
||||
textList: a.data.textList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
delLink: function(t) {
|
||||
delLink: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该条数据吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.linkList.splice(t.currentTarget.dataset.index, 1), a.setData({
|
||||
linkList: a.data.linkList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
delDesc: function(t) {
|
||||
delDesc: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该条数据吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.textareaList.splice(t.currentTarget.dataset.index, 1), a.setData({
|
||||
textareaList: a.data.textareaList
|
||||
}));
|
||||
}
|
||||
});
|
||||
},
|
||||
textInput: function(a) {
|
||||
textInput: function (a) {
|
||||
this.setData(t({}, a.currentTarget.id, a.detail.value));
|
||||
},
|
||||
onHide: function(t) {
|
||||
onHide: function (t) {
|
||||
this.setData({
|
||||
isShowText: !1,
|
||||
isShowDesc: !1,
|
||||
@ -392,44 +392,44 @@ Page({
|
||||
isShowType: !1
|
||||
});
|
||||
},
|
||||
chooseTags: function(t) {
|
||||
chooseTags: function (t) {
|
||||
var a = t.currentTarget.dataset.idx;
|
||||
this.data.fieldList[this.data.currentIndex].dictionariesList[a].isSel = !this.data.fieldList[this.data.currentIndex].dictionariesList[a].isSel,
|
||||
this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
});
|
||||
var e = "", i = "";
|
||||
this.data.fieldList[this.data.currentIndex].dictionariesList.forEach(function(t) {
|
||||
this.data.fieldList[this.data.currentIndex].dictionariesList.forEach(function (t) {
|
||||
t.isSel && (e += t.dataName + ",", i += t.dataId + ",");
|
||||
}), e = e.substr(0, e.length - 1), i = i.substr(0, i.length - 1), this.data.fieldList[this.data.currentIndex].selValue = e,
|
||||
this.data.fieldList[this.data.currentIndex].value = i, this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
});
|
||||
},
|
||||
selTags: function() {
|
||||
selTags: function () {
|
||||
this.setData({
|
||||
isShowTags: !1
|
||||
});
|
||||
},
|
||||
choosePhoto: function(t) {
|
||||
choosePhoto: function (t) {
|
||||
var a = this, e = t.currentTarget.dataset.item, i = t.currentTarget.dataset.index, s = e.maxCount - e.valueList.length;
|
||||
wx.chooseImage({
|
||||
count: Number.parseInt(s),
|
||||
sourceType: [ "album", "camera" ],
|
||||
success: function(t) {
|
||||
sourceType: ["album", "camera"],
|
||||
success: function (t) {
|
||||
console.log(t), a.doUploadImg(i, t.tempFilePaths, a.data.uploadCount);
|
||||
},
|
||||
fail: function(t) {}
|
||||
fail: function (t) { }
|
||||
});
|
||||
},
|
||||
delImg: function(t) {
|
||||
delImg: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该图片吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.fieldList[t.currentTarget.dataset.itemindex].valueList.splice(t.currentTarget.dataset.index, 1),
|
||||
a.setData({
|
||||
fieldList: a.data.fieldList
|
||||
@ -437,14 +437,14 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
viewImg: function(t) {
|
||||
var a = [ t.currentTarget.dataset.url ];
|
||||
viewImg: function (t) {
|
||||
var a = [t.currentTarget.dataset.url];
|
||||
wx.previewImage({
|
||||
urls: a,
|
||||
current: t.currentTarget.dataset.url
|
||||
});
|
||||
},
|
||||
doUploadImg: function(t, e, i) {
|
||||
doUploadImg: function (t, e, i) {
|
||||
wx.showLoading({
|
||||
title: "上传中..."
|
||||
});
|
||||
@ -455,7 +455,7 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(i) {
|
||||
}).then(function (i) {
|
||||
wx.hideLoading({});
|
||||
var n = JSON.parse(i).data, o = {
|
||||
id: n,
|
||||
@ -466,7 +466,7 @@ Page({
|
||||
}), s.setData({
|
||||
uploadCount: ++s.data.uploadCount
|
||||
}), s.doUploadImg(t, e, s.data.uploadCount);
|
||||
}).catch(function(a) {
|
||||
}).catch(function (a) {
|
||||
wx.hideLoading({}), s.setData({
|
||||
uploadCount: ++s.data.uploadCount
|
||||
}), s.doUploadImg(t, e, s.data.uploadCount);
|
||||
@ -474,7 +474,7 @@ Page({
|
||||
uploadCount: 0
|
||||
}));
|
||||
},
|
||||
chooseLocation: function(t) {
|
||||
chooseLocation: function (t) {
|
||||
var a = t.currentTarget.dataset.index;
|
||||
this.setData({
|
||||
curMapIndex: a
|
||||
@ -484,13 +484,13 @@ Page({
|
||||
url: "plugin://chooseLocation/index?key=".concat("HVDBZ-KJGKF-DNMJR-JHEWI-H2HN7-23BMS", "&referer=").concat("市域自治与互助", "&location=").concat(e, "&category=").concat("生活服务,娱乐休闲")
|
||||
});
|
||||
},
|
||||
delMap: function(t) {
|
||||
delMap: function (t) {
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该条数据吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(a) {
|
||||
success: function (a) {
|
||||
a.confirm && (_self.data.fieldList[t.currentTarget.dataset.index].valueList.splice(t.currentTarget.dataset.idx, 1),
|
||||
_self.setData({
|
||||
fieldList: _self.data.fieldList
|
||||
@ -498,14 +498,14 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
delAudio: function(t) {
|
||||
delAudio: function (t) {
|
||||
var a = this;
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确定要删除该音频吗?",
|
||||
cancelText: "取消",
|
||||
confirmText: "确定",
|
||||
success: function(e) {
|
||||
success: function (e) {
|
||||
e.confirm && (a.data.fieldList[t.currentTarget.dataset.index].valueList.splice(t.currentTarget.dataset.idx, 1),
|
||||
a.setData({
|
||||
fieldList: a.data.fieldList
|
||||
@ -513,22 +513,22 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
doStartRecord: function() {
|
||||
doStartRecord: function () {
|
||||
var t = this;
|
||||
wx.getSetting({
|
||||
success: function(a) {
|
||||
success: function (a) {
|
||||
a.authSetting["scope.record"] ? t.startRecord() : wx.authorize({
|
||||
scope: "scope.record",
|
||||
success: function() {
|
||||
success: function () {
|
||||
t.startRecord();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
startRecord: function() {
|
||||
startRecord: function () {
|
||||
var t = this;
|
||||
t.data.setInter = setInterval(function() {
|
||||
t.data.setInter = setInterval(function () {
|
||||
var a = parseInt(t.data.speck_time + 1);
|
||||
t.setData({
|
||||
speck_time: parseInt(a),
|
||||
@ -541,7 +541,7 @@ Page({
|
||||
}));
|
||||
}, 1e3);
|
||||
},
|
||||
doEndRecord: function() {
|
||||
doEndRecord: function () {
|
||||
clearInterval(this.data.setInter), this.data.speck_time > 10 ? (clearInterval(this.data.setInter),
|
||||
this.stop(!0), this.setData({
|
||||
speck_time: "0",
|
||||
@ -555,23 +555,23 @@ Page({
|
||||
isStartRecord: !1
|
||||
}));
|
||||
},
|
||||
start: function() {
|
||||
start: function () {
|
||||
e.start({
|
||||
duration: 6e4,
|
||||
format: "mp3"
|
||||
}), e.onStart(function() {
|
||||
}), e.onStart(function () {
|
||||
console.log("recorder start");
|
||||
}), e.onError(function(t) {
|
||||
}), e.onError(function (t) {
|
||||
console.log(t), _self.stop(!1);
|
||||
});
|
||||
},
|
||||
stop: function(t) {
|
||||
stop: function (t) {
|
||||
var a = this;
|
||||
e.stop(), e.onStop(function(e) {
|
||||
e.stop(), e.onStop(function (e) {
|
||||
t && a.doUploadAudio(e);
|
||||
});
|
||||
},
|
||||
doUploadAudio: function(t) {
|
||||
doUploadAudio: function (t) {
|
||||
wx.showLoading({
|
||||
title: "上传中..."
|
||||
});
|
||||
@ -582,7 +582,7 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(i) {
|
||||
}).then(function (i) {
|
||||
if (wx.hideLoading({}), e.data.fieldList[e.data.currentIndex].valueList.length < e.data.currentItem.maxCount) {
|
||||
wx.hideLoading({});
|
||||
var s = JSON.parse(i).data, n = a.baseUrls.baseCardUrl + s, o = parseInt(t.duration / 1e3), d = parseInt(o / 60), r = parseInt(o % 60), l = {
|
||||
@ -600,43 +600,43 @@ Page({
|
||||
isShowAudio: !1
|
||||
});
|
||||
}
|
||||
}).catch(function(t) {});
|
||||
}).catch(function (t) { });
|
||||
},
|
||||
play: function(t) {
|
||||
play: function (t) {
|
||||
var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.idx, s = t.currentTarget.dataset.item, n = this;
|
||||
n.data.fieldList[a].valueList.forEach(function(t) {
|
||||
n.data.fieldList[a].valueList.forEach(function (t) {
|
||||
t.isPlay && i.stop(), t.isPlay = !1, t.curDuation = 0, t.curDuationStr = "00:00";
|
||||
}), s.isPlay || ((i = wx.createInnerAudioContext()).src = n.data.fieldList[a].valueList[e].path,
|
||||
i.autoplay = !0), i.onPlay(function() {
|
||||
i.autoplay = !0), i.onPlay(function () {
|
||||
n.data.fieldList[a].valueList[e].isPlay = !0, n.setData({
|
||||
fieldList: n.data.fieldList
|
||||
});
|
||||
}), i.onCanplay(function(t) {
|
||||
}), i.onCanplay(function (t) {
|
||||
n.data.waitFlag && (i.play(), n.setData({
|
||||
waitFlag: !1
|
||||
}));
|
||||
}), i.onStop(function(t) {
|
||||
}), i.onStop(function (t) {
|
||||
n.data.fieldList[a].valueList[e].isPlay = !1, n.data.fieldList[a].valueList[e].curDuration = 0,
|
||||
n.data.fieldList[a].valueList[e].curDurationStr = "00:00", n.setData({
|
||||
fieldList: n.data.fieldList
|
||||
});
|
||||
}), i.onEnded(function(t) {
|
||||
}), i.onEnded(function (t) {
|
||||
n.data.fieldList[a].valueList[e].isPlay = !1, n.data.fieldList[a].valueList[e].curDuration = 0,
|
||||
n.data.fieldList[a].valueList[e].curDurationStr = "00:00", n.setData({
|
||||
fieldList: n.data.fieldList
|
||||
});
|
||||
}), i.onError(function(t) {
|
||||
}), i.onError(function (t) {
|
||||
n.data.fieldList[a].valueList[e].isPlay = !1, n.data.fieldList[a].valueList[e].curDuration = 0,
|
||||
n.data.fieldList[a].valueList[e].curDurationStr = "00:00", n.setData({
|
||||
fieldList: n.data.fieldList
|
||||
});
|
||||
}), i.onSeeking(function() {
|
||||
}), i.onSeeking(function () {
|
||||
console.log(i.currentTime);
|
||||
}), i.onWaiting(function() {
|
||||
}), i.onWaiting(function () {
|
||||
i.pause(), n.setData({
|
||||
waitFlag: !0
|
||||
});
|
||||
}), i.onTimeUpdate(function() {
|
||||
}), i.onTimeUpdate(function () {
|
||||
if (i.duration != 1 / 0) {
|
||||
n.data.fieldList[a].valueList[e].curDuration = parseInt(i.currentTime), n.data.fieldList[a].valueList[e].duration = parseInt(i.duration),
|
||||
console.log(i.duration);
|
||||
@ -648,48 +648,48 @@ Page({
|
||||
}
|
||||
});
|
||||
},
|
||||
rewind: function(t) {
|
||||
rewind: function (t) {
|
||||
var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.idx;
|
||||
t.currentTarget.dataset.item.isPlay && (this.data.fieldList[a].valueList[e].curDuration = this.data.fieldList[a].valueList[e].curDuration - this.data.speedStep,
|
||||
i.seek(this.data.fieldList[a].valueList[e].curDuration), this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
}));
|
||||
},
|
||||
speed: function(t) {
|
||||
speed: function (t) {
|
||||
var a = t.currentTarget.dataset.index, e = t.currentTarget.dataset.idx;
|
||||
t.currentTarget.dataset.item.isPlay && (this.data.fieldList[a].valueList[e].curDuration = this.data.fieldList[a].valueList[e].curDuration + this.data.speedStep,
|
||||
i.seek(this.data.fieldList[a].valueList[e].curDuration), this.setData({
|
||||
fieldList: this.data.fieldList
|
||||
}));
|
||||
},
|
||||
slider4change: function(t) {
|
||||
slider4change: function (t) {
|
||||
t.currentTarget.dataset.item.isPlay && i.seek(t.detail.value);
|
||||
},
|
||||
showDialog: function(t) {
|
||||
showDialog: function (t) {
|
||||
console.log(t), this.setData({
|
||||
isShowAudio: !0,
|
||||
currentItem: t.currentTarget.dataset.item,
|
||||
currentIndex: t.currentTarget.dataset.index
|
||||
});
|
||||
},
|
||||
showDisplayType: function(t) {
|
||||
showDisplayType: function (t) {
|
||||
this.setData({
|
||||
isShowType: !0
|
||||
});
|
||||
},
|
||||
chooseDisplayType: function(t) {
|
||||
chooseDisplayType: function (t) {
|
||||
var a = t.currentTarget.dataset.id;
|
||||
this.setData({
|
||||
selDisplayType: a
|
||||
});
|
||||
},
|
||||
showMutliSel: function(t) {
|
||||
showMutliSel: function (t) {
|
||||
this.setData({
|
||||
isShowTags: !0,
|
||||
currentIndex: t.currentTarget.dataset.index
|
||||
});
|
||||
},
|
||||
doPublish: function() {
|
||||
doPublish: function () {
|
||||
if (this.checkParams()) {
|
||||
wx.showToast({
|
||||
title: "保存中..."
|
||||
@ -702,7 +702,7 @@ Page({
|
||||
header: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}).then(function(t) {
|
||||
}).then(function (t) {
|
||||
wx.hideLoading({});
|
||||
var a = getCurrentPages();
|
||||
a[a.length - 2].setData({
|
||||
@ -710,12 +710,12 @@ Page({
|
||||
}), wx.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}).catch(function(t) {
|
||||
}).catch(function (t) {
|
||||
console.log(t);
|
||||
});
|
||||
}
|
||||
},
|
||||
checkParams: function() {
|
||||
checkParams: function () {
|
||||
for (var t = !0, a = 0; a < this.data.fieldList.length; a++) {
|
||||
var e = this.data.fieldList[a];
|
||||
if (e.must) if ("1" == e.dataType || "7" == e.dataType || "8" == e.dataType || "9" == e.dataType) {
|
||||
@ -736,20 +736,20 @@ Page({
|
||||
}
|
||||
return t;
|
||||
},
|
||||
buildParams: function() {
|
||||
buildParams: function () {
|
||||
for (var t = {}, a = 0; a < this.data.fieldList.length; a++) {
|
||||
var e = this.data.fieldList[a];
|
||||
if ("1" == e.dataType || "7" == e.dataType || "8" == e.dataType || "9" == e.dataType) e.value.length > 0 && (t[e.name] = e.value); else if (e.valueList.length > 0) {
|
||||
var i = "";
|
||||
"6" == e.dataType ? e.valueList.forEach(function(t) {
|
||||
"6" == e.dataType ? e.valueList.forEach(function (t) {
|
||||
i += t.latitude + "," + t.longitude + "-";
|
||||
}) : "4" == e.dataType ? e.valueList.forEach(function(t) {
|
||||
}) : "4" == e.dataType ? e.valueList.forEach(function (t) {
|
||||
i += t.id + "&" + t.thumbId + ",";
|
||||
}) : "3" == e.dataType ? e.valueList.forEach(function(t) {
|
||||
}) : "3" == e.dataType ? e.valueList.forEach(function (t) {
|
||||
i += t.id + "&" + t.duration + ",";
|
||||
}) : "2" == e.dataType ? (e.valueList.forEach(function(t) {
|
||||
}) : "2" == e.dataType ? (e.valueList.forEach(function (t) {
|
||||
i += t.id + ",";
|
||||
}), i = i.substr(0, i.length - 1), i += "@" + this.data.selDisplayType) : e.valueList.forEach(function(t) {
|
||||
}), i = i.substr(0, i.length - 1), i += "@" + this.data.selDisplayType) : e.valueList.forEach(function (t) {
|
||||
i += t.id + ",";
|
||||
}), "2" != e.dataType && (i = i.substr(0, i.length - 1)), t[e.name] = i;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
var t = require("../../../@babel/runtime/helpers/defineProperty"), e = getApp();
|
||||
var e = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
var e = require("../../@babel/runtime/helpers/defineProperty"), a = getApp();
|
||||
var a = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@ -17,31 +17,35 @@ Page({
|
||||
areaCode: ""
|
||||
}
|
||||
},
|
||||
getAreaList: function() {
|
||||
getAreaList: function () {
|
||||
var t = this;
|
||||
a.restAjax.get(a.restAjax.path(a.apis.getArea, [ a.baseUrls.serviceUrl, "110889" ]), {}, {
|
||||
a.restAjax.get(a.restAjax.path(a.apis.getArea, [a.baseUrls.serviceUrl, "110889"]), {}, {
|
||||
headers: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}, function(a, r) {
|
||||
for (var n = t.data.areaList, o = 0; o < r.length; o++) n.push(r[o].areaName);
|
||||
t.setData(e({
|
||||
}, function (a, r) {
|
||||
for (var n = t.data.areaList, o = 0; o < r.length; o++) {
|
||||
n.push(r[o].areaName)
|
||||
}
|
||||
t.setData({
|
||||
areaList: n,
|
||||
areaAll: r,
|
||||
areaSelected: r[0].areaCode,
|
||||
areaName: r[0].areaName
|
||||
}, "page.areaCode", r[0].areaCode)), t.getCommunity();
|
||||
}, function(e, a) {
|
||||
areaName: r[0].areaName,
|
||||
"page.areaCode": r[0].areaCode
|
||||
});
|
||||
t.getCommunity();
|
||||
}, function (e, a) {
|
||||
console.log(a);
|
||||
});
|
||||
},
|
||||
getCommunity: function() {
|
||||
getCommunity: function () {
|
||||
var t = this, r = t.data.page;
|
||||
t.data.keywords && (r.keywords = t.data.keywords), a.restAjax.get(a.restAjax.path(a.apis.getCommunityListPage, [ a.baseUrls.communityUrl ]), r, {
|
||||
t.data.keywords && (r.keywords = t.data.keywords), a.restAjax.get(a.restAjax.path(a.apis.getCommunityListPage, [a.baseUrls.communityUrl]), r, {
|
||||
headers: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}, function(a, r) {
|
||||
}, function (a, r) {
|
||||
if (1 == t.data.page.page) t.setData({
|
||||
communityList: r.rows
|
||||
}); else if (r.rows.length > 0) {
|
||||
@ -53,38 +57,41 @@ Page({
|
||||
r.rows.length < 10 && t.setData({
|
||||
haveMore: !1
|
||||
});
|
||||
}, function(e, a) {
|
||||
}, function (e, a) {
|
||||
console.log(a);
|
||||
});
|
||||
},
|
||||
bindAreaPickerChange: function(a) {
|
||||
var t;
|
||||
this.setData((t = {
|
||||
bindAreaPickerChange: function (a) {
|
||||
var _self = this;
|
||||
_self.setData({
|
||||
areaIndex: a.detail.value,
|
||||
areaSelected: this.data.areaAll[a.detail.value].areaCode
|
||||
}, e(t, "page.areaCode", this.data.areaAll[a.detail.value].areaCode), e(t, "page.page", 1),
|
||||
e(t, "haveMore", !0), t)), this.getCommunity();
|
||||
areaSelected: _self.data.areaAll[a.detail.value].areaCode,
|
||||
"page.areaCode": _self.data.areaAll[a.detail.value].areaCode,
|
||||
"page.page": 1,
|
||||
"haveMore": !0
|
||||
})
|
||||
_self.getCommunity();
|
||||
},
|
||||
getMyCommunity: function() {
|
||||
getMyCommunity: function () {
|
||||
var e = this;
|
||||
a.restAjax.get(a.restAjax.path(a.apis.mycommunity, [ a.baseUrls.requestUrl ]), {}, {
|
||||
a.restAjax.get(a.restAjax.path(a.apis.mycommunity, [a.baseUrls.requestUrl]), {}, {
|
||||
headers: {
|
||||
token: a.globalData.token
|
||||
}
|
||||
}, function(a, t) {
|
||||
}, function (a, t) {
|
||||
e.setData({
|
||||
myCommunityList: t
|
||||
});
|
||||
}, function(e, a) {
|
||||
}, function (e, a) {
|
||||
console.log(a);
|
||||
});
|
||||
},
|
||||
otherCommunity: function() {
|
||||
otherCommunity: function () {
|
||||
wx.navigateTo({
|
||||
url: "./selectCommunity"
|
||||
});
|
||||
},
|
||||
selectCommunity: function(e) {
|
||||
selectCommunity: function (e) {
|
||||
var t = {
|
||||
communityId: e.currentTarget.dataset.item.communityId,
|
||||
communityName: e.currentTarget.dataset.item.communityName
|
||||
@ -105,7 +112,7 @@ Page({
|
||||
url: "../index/index"
|
||||
});
|
||||
},
|
||||
selectMyCommunity: function(e) {
|
||||
selectMyCommunity: function (e) {
|
||||
var t = {
|
||||
communityId: e.currentTarget.dataset.item.communityId,
|
||||
communityName: e.currentTarget.dataset.item.communityName
|
||||
@ -126,10 +133,13 @@ Page({
|
||||
url: "../index/index"
|
||||
});
|
||||
},
|
||||
loadMore: function() {
|
||||
this.setData(e({}, "page.page", this.data.page.page + 1)), this.getCommunity();
|
||||
loadMore: function () {
|
||||
this.setData({
|
||||
"page.page": this.data.page.page + 1
|
||||
});
|
||||
this.getCommunity();
|
||||
},
|
||||
enterCurrentArea: function() {
|
||||
enterCurrentArea: function () {
|
||||
wx.setStorage({
|
||||
data: this.data.areaAll[this.data.areaIndex].areaName,
|
||||
key: "curCommunityName"
|
||||
@ -146,14 +156,9 @@ Page({
|
||||
url: "../index/index"
|
||||
});
|
||||
},
|
||||
onLoad: function(e) {
|
||||
this.getAreaList(), this.getMyCommunity();
|
||||
onLoad: function (e) {
|
||||
this.getAreaList();
|
||||
this.getMyCommunity();
|
||||
},
|
||||
onReady: function() {},
|
||||
onShow: function() {},
|
||||
onHide: function() {},
|
||||
onUnload: function() {},
|
||||
onPullDownRefresh: function() {},
|
||||
onReachBottom: function() {},
|
||||
onShareAppMessage: function() {}
|
||||
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
var e = require("../../@babel/runtime/helpers/defineProperty"), a = getApp();
|
||||
var a = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
|
@ -105,7 +105,7 @@ Page({
|
||||
});
|
||||
},
|
||||
doLogin: function () {
|
||||
var _self= this;
|
||||
var _self = this;
|
||||
wx.login({
|
||||
success: function (a) {
|
||||
t.restAjax.post(t.restAjax.path(t.apis.doLogin, [t.baseUrls.serviceUrl]), {
|
||||
@ -243,7 +243,10 @@ Page({
|
||||
onLoad: function (e) {
|
||||
e.cardTemplateDispatchId && this.setData({
|
||||
cardTemplateDispatchId: e.cardTemplateDispatchId
|
||||
}), this.doLogin(), this.checkPermission(), wx.setStorage({
|
||||
});
|
||||
this.doLogin();
|
||||
this.checkPermission();
|
||||
wx.setStorage({
|
||||
data: "1",
|
||||
key: "gridMiniId"
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
var t = require("../../../@babel/runtime/helpers/defineProperty"), a = getApp();
|
||||
var a = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
var t = require("../../../@babel/runtime/helpers/defineProperty"), e = getApp();
|
||||
var e = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
var e = require("../../../@babel/runtime/helpers/defineProperty"), t = getApp();
|
||||
var t = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@ -13,13 +13,13 @@ Page({
|
||||
serviceUrl: t.baseUrls.serviceUrl,
|
||||
baseImgUrl: t.baseUrls.baseImgUrl
|
||||
},
|
||||
getHelpList: function() {
|
||||
getHelpList: function () {
|
||||
var a = this;
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getHelpList, [ t.baseUrls.requestUrl ]), a.data.page, {
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getHelpList, [t.baseUrls.requestUrl]), a.data.page, {
|
||||
headers: {
|
||||
token: t.globalData.token
|
||||
}
|
||||
}, function(t, o) {
|
||||
}, function (t, o) {
|
||||
for (var s = 0; s < o.rows.length; s++) o.rows[s].photo && (o.rows[s].photo = o.rows[s].photo.split(","));
|
||||
if (1 == a.data.page.page) a.setData({
|
||||
helpList: o.rows
|
||||
@ -35,29 +35,29 @@ Page({
|
||||
o.rows.length < 10 && a.setData({
|
||||
haveMore: !1
|
||||
});
|
||||
}, function(e, t) {
|
||||
}, function (e, t) {
|
||||
console.log(t);
|
||||
});
|
||||
},
|
||||
checkHelpDetail: function(e) {
|
||||
checkHelpDetail: function (e) {
|
||||
var t = e.currentTarget.dataset.id;
|
||||
wx.navigateTo({
|
||||
url: "./helpDetail?neighborId=" + t
|
||||
});
|
||||
},
|
||||
loadMore: function() {
|
||||
loadMore: function () {
|
||||
this.setData(e({}, "page.page", this.data.page.page + 1)), this.getHelpList();
|
||||
},
|
||||
onLoad: function(a) {
|
||||
onLoad: function (a) {
|
||||
var o;
|
||||
this.setData((e(o = {}, "page.communityId", a.communityId), e(o, "token", t.globalData.token),
|
||||
o)), this.getHelpList();
|
||||
},
|
||||
onReady: function() {},
|
||||
onShow: function() {},
|
||||
onHide: function() {},
|
||||
onUnload: function() {},
|
||||
onPullDownRefresh: function() {},
|
||||
onReachBottom: function() {},
|
||||
onShareAppMessage: function() {}
|
||||
onReady: function () { },
|
||||
onShow: function () { },
|
||||
onHide: function () { },
|
||||
onUnload: function () { },
|
||||
onPullDownRefresh: function () { },
|
||||
onReachBottom: function () { },
|
||||
onShareAppMessage: function () { }
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
var t = require("../../@babel/runtime/helpers/defineProperty"), e = getApp();
|
||||
var e = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
var e = require("../../@babel/runtime/helpers/defineProperty"), t = getApp();
|
||||
var t = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@ -16,71 +16,86 @@ Page({
|
||||
serviceUrl: t.baseUrls.serviceUrl,
|
||||
baseImgUrl: t.baseUrls.baseImgUrl
|
||||
},
|
||||
getNewsType: function() {
|
||||
getNewsType: function () {
|
||||
var a = this;
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getNewsType, [ t.baseUrls.requestUrl ]), {
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getNewsType, [t.baseUrls.requestUrl]), {
|
||||
showArea: "6dcbb862-4b48-4dca-aee1-d78fd76adc05"
|
||||
}, {
|
||||
headers: {
|
||||
token: a.data.token
|
||||
}
|
||||
}, function(t, s) {
|
||||
}, function (t, s) {
|
||||
var n;
|
||||
a.setData((e(n = {
|
||||
newsType: s
|
||||
}, "page.newsTypeId", s[0].newsTypeId), e(n, "curType", s[0].newsTypeId), n)), a.getNewsList();
|
||||
}, function(e, t) {
|
||||
a.setData({
|
||||
newsType: s,
|
||||
"page.newsTypeId": s[0].newsTypeId,
|
||||
"curType": s[0].newsTypeId
|
||||
});
|
||||
a.getNewsList();
|
||||
}, function (e, t) {
|
||||
console.log(t);
|
||||
});
|
||||
},
|
||||
changeType: function(t) {
|
||||
changeType: function (t) {
|
||||
var a, s = t.currentTarget.dataset.id;
|
||||
this.setData((e(a = {
|
||||
curType: s
|
||||
}, "page.newsTypeId", s), e(a, "page.page", 1), a)), this.getNewsList();
|
||||
this.setData({
|
||||
curType: s,
|
||||
"page.newsTypeId": s,
|
||||
"page.page": 1,
|
||||
});
|
||||
this.getNewsList();
|
||||
},
|
||||
getNewsList: function() {
|
||||
getNewsList: function () {
|
||||
var a = this;
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getNewsList, [ t.baseUrls.requestUrl ]), a.data.page, {
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getNewsList, [t.baseUrls.requestUrl]), a.data.page, {
|
||||
headers: {
|
||||
token: a.data.token
|
||||
}
|
||||
}, function(t, s) {
|
||||
for (var n = 0; n < s.rows.length; n++) s.rows[n].photo && (s.rows[n].photo = s.rows[n].photo.split(","));
|
||||
if (1 == a.data.page.page) a.setData({
|
||||
newsList: s.rows
|
||||
}); else if (s.rows.length > 0) {
|
||||
}, function (t, s) {
|
||||
for (var n = 0; n < s.rows.length; n++) {
|
||||
s.rows[n].photo && (s.rows[n].photo = s.rows[n].photo.split(","));
|
||||
}
|
||||
if(1==a.data.page.page){
|
||||
a.setData({
|
||||
newsList:s.rows
|
||||
})
|
||||
}else if(s.rows.length>0){
|
||||
for (var o = a.data.newsList, r = 0; r < s.rows.length; r++) o.push(s.rows[r]);
|
||||
a.setData({
|
||||
newsList: o
|
||||
});
|
||||
} else wx.showToast({
|
||||
title: "暂无更多",
|
||||
icon: "none"
|
||||
}), a.setData(e({}, "page.page", a.data.page.page - 1));
|
||||
}, function(e, t) {
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: '暂无更多',
|
||||
icon:'none'
|
||||
})
|
||||
a.setData({
|
||||
"page.page":a.data.page.page-1
|
||||
})
|
||||
}
|
||||
}, function (e, t) {
|
||||
console.log(t);
|
||||
});
|
||||
},
|
||||
checkDetail: function(e) {
|
||||
checkDetail: function (e) {
|
||||
var t = e.currentTarget.dataset.id;
|
||||
wx.navigateTo({
|
||||
url: "./newsDetail?newsId=" + t
|
||||
});
|
||||
},
|
||||
onLoad: function(a) {
|
||||
this.setData(e({
|
||||
token: t.globalData.token
|
||||
}, "page.areaCode", wx.getStorageSync("areaCode") ? wx.getStorageSync("areaCode") : "")),
|
||||
onLoad: function (a) {
|
||||
this.setData({
|
||||
token: t.globalData.token,
|
||||
"page.areaCode": wx.getStorageSync("areaCode") ? wx.getStorageSync("areaCode") : ""
|
||||
})
|
||||
this.getNewsType();
|
||||
},
|
||||
onReady: function() {},
|
||||
onShow: function() {},
|
||||
onHide: function() {},
|
||||
onUnload: function() {},
|
||||
onPullDownRefresh: function() {},
|
||||
onReachBottom: function() {
|
||||
this.setData(e({}, "page.page", this.data.page.page + 1)), this.getNewsList();
|
||||
|
||||
onReachBottom: function () {
|
||||
this.setData({
|
||||
"page.page": this.data.page.page + 1,
|
||||
|
||||
});
|
||||
this.getNewsList();
|
||||
},
|
||||
onShareAppMessage: function() {}
|
||||
});
|
@ -21,5 +21,5 @@
|
||||
"van-collapse": "/vant/dist/collapse/index",
|
||||
"van-collapse-item": "/vant/dist/collapse-item/index"
|
||||
},
|
||||
"navigationBarTitleText": "事件上报"
|
||||
"navigationBarTitleText": "述求上报"
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
var e = require("../../@babel/runtime/helpers/defineProperty"), t = getApp();
|
||||
var t = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@ -14,36 +14,42 @@ Page({
|
||||
serviceUrl: t.baseUrls.serviceUrl,
|
||||
baseImgUrl: t.baseUrls.baseImgUrl
|
||||
},
|
||||
getNewsType: function() {
|
||||
getNewsType: function () {
|
||||
var a = this;
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getNewsType, [ t.baseUrls.requestUrl ]), {
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getNewsType, [t.baseUrls.requestUrl]), {
|
||||
showArea: "6dcbb862-4b48-4dca-aee1-d78fd76adc05"
|
||||
}, {
|
||||
headers: {
|
||||
token: a.data.token
|
||||
}
|
||||
}, function(t, s) {
|
||||
}, function (t, s) {
|
||||
var n;
|
||||
a.setData((e(n = {
|
||||
newsType: s
|
||||
}, "page.newsTypeId", s[0].newsTypeId), e(n, "curType", s[0].newsTypeId), n)), a.getNewsList();
|
||||
}, function(e, t) {
|
||||
a.setData({
|
||||
newsType: s,
|
||||
"page.newsTypeId": s[0].newsTypeId,
|
||||
"curType": s[0].newsTypeId
|
||||
});
|
||||
a.getNewsList();
|
||||
}, function (e, t) {
|
||||
console.log(t);
|
||||
});
|
||||
},
|
||||
changeType: function(t) {
|
||||
changeType: function (t) {
|
||||
var a, s = t.currentTarget.dataset.id;
|
||||
this.setData((e(a = {
|
||||
curType: s
|
||||
}, "page.newsTypeId", s), e(a, "page.page", 1), a)), this.getNewsList();
|
||||
this.setData({
|
||||
curType: s,
|
||||
"page.newsTypeId": s,
|
||||
"page.page": 1
|
||||
});
|
||||
this.getNewsList();
|
||||
},
|
||||
getNewsList: function() {
|
||||
getNewsList: function () {
|
||||
var a = this;
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getNewsList, [ t.baseUrls.requestUrl ]), a.data.page, {
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getNewsList, [t.baseUrls.requestUrl]), a.data.page, {
|
||||
headers: {
|
||||
token: a.data.token
|
||||
}
|
||||
}, function(t, s) {
|
||||
}, function (t, s) {
|
||||
for (var n = 0; n < s.rows.length; n++) s.rows[n].photo && (s.rows[n].photo = s.rows[n].photo.split(","));
|
||||
if (1 == a.data.page.page) a.setData({
|
||||
newsList: s.rows
|
||||
@ -56,28 +62,28 @@ Page({
|
||||
title: "暂无更多",
|
||||
icon: "none"
|
||||
}), a.setData(e({}, "page.page", a.data.page.page - 1));
|
||||
}, function(e, t) {
|
||||
}, function (e, t) {
|
||||
console.log(t);
|
||||
});
|
||||
},
|
||||
checkDetail: function(e) {
|
||||
checkDetail: function (e) {
|
||||
var t = e.currentTarget.dataset.id;
|
||||
wx.navigateTo({
|
||||
url: "../news/newsDetail?newsId=" + t
|
||||
});
|
||||
},
|
||||
onLoad: function(e) {
|
||||
onLoad: function (e) {
|
||||
this.setData({
|
||||
token: t.globalData.token
|
||||
}), this.getNewsType();
|
||||
},
|
||||
onReady: function() {},
|
||||
onShow: function() {},
|
||||
onHide: function() {},
|
||||
onUnload: function() {},
|
||||
onPullDownRefresh: function() {},
|
||||
onReachBottom: function() {
|
||||
onReady: function () { },
|
||||
onShow: function () { },
|
||||
onHide: function () { },
|
||||
onUnload: function () { },
|
||||
onPullDownRefresh: function () { },
|
||||
onReachBottom: function () {
|
||||
this.setData(e({}, "page.page", this.data.page.page + 1)), this.getNewsList();
|
||||
},
|
||||
onShareAppMessage: function() {}
|
||||
onShareAppMessage: function () { }
|
||||
});
|
@ -1,4 +1,4 @@
|
||||
var e = require("../../@babel/runtime/helpers/defineProperty"), t = getApp();
|
||||
var t = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
@ -13,16 +13,16 @@ Page({
|
||||
baseImgUrl: t.baseUrls.baseImgUrl,
|
||||
isShowMenu: !1
|
||||
},
|
||||
getTalkList: function() {
|
||||
getTalkList: function () {
|
||||
var a = this;
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getTalkList, [ t.baseUrls.requestUrl ]), {
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getTalkList, [t.baseUrls.requestUrl]), {
|
||||
pages: a.data.page,
|
||||
areaCode: wx.getStorageSync("areaCode")
|
||||
}, {
|
||||
headers: {
|
||||
token: t.globalData.token
|
||||
}
|
||||
}, function(t, o) {
|
||||
}, function (t, o) {
|
||||
if (o.rows.length > 0) {
|
||||
for (var s = 0; s < o.rows.length; s++) o.rows[s].photo && (o.rows[s].photo = o.rows[s].photo.split(","));
|
||||
if (1 == a.data.page.page) a.setData({
|
||||
@ -37,58 +37,58 @@ Page({
|
||||
title: "暂无更多",
|
||||
icon: "none"
|
||||
}), a.data.page.page > 1 && a.setData(e({}, "page.page", a.data.page.page - 1));
|
||||
}, function(e, t) {
|
||||
}, function (e, t) {
|
||||
console.log(t);
|
||||
});
|
||||
},
|
||||
newTalk: function() {
|
||||
newTalk: function () {
|
||||
wx.navigateTo({
|
||||
url: "./newTalk"
|
||||
});
|
||||
},
|
||||
checkMyTalk: function() {
|
||||
checkMyTalk: function () {
|
||||
wx.navigateTo({
|
||||
url: "./myTalk"
|
||||
});
|
||||
},
|
||||
checkDetail: function(e) {
|
||||
checkDetail: function (e) {
|
||||
var t = e.currentTarget.dataset.id;
|
||||
wx.navigateTo({
|
||||
url: "./talkDetail?trifleMyselfId=" + t
|
||||
});
|
||||
},
|
||||
clickVideo: function() {},
|
||||
onLoad: function(e) {},
|
||||
getMenuIsShow: function() {
|
||||
clickVideo: function () { },
|
||||
onLoad: function (e) { },
|
||||
getMenuIsShow: function () {
|
||||
var e = this;
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getBtnIsShow, [ t.baseUrls.requestUrl, "talk" ]), null, {
|
||||
t.restAjax.get(t.restAjax.path(t.apis.getBtnIsShow, [t.baseUrls.requestUrl, "talk"]), null, {
|
||||
headers: {
|
||||
token: t.globalData.token
|
||||
}
|
||||
}, function(t, a) {
|
||||
}, function (t, a) {
|
||||
null != a && null != a ? e.setData({
|
||||
isShowMenu: 1 == a.isShow
|
||||
}) : e.setData({
|
||||
isShowMenu: !1
|
||||
});
|
||||
}, function(t, a) {
|
||||
}, function (t, a) {
|
||||
e.setData({
|
||||
isShowMenu: !1
|
||||
});
|
||||
});
|
||||
},
|
||||
onReady: function() {},
|
||||
onShow: function() {
|
||||
onReady: function () { },
|
||||
onShow: function () {
|
||||
this.setData({
|
||||
token: t.globalData.token
|
||||
}), this.getTalkList(), this.getMenuIsShow();
|
||||
},
|
||||
onHide: function() {},
|
||||
onUnload: function() {},
|
||||
onPullDownRefresh: function() {},
|
||||
onReachBottom: function() {
|
||||
onHide: function () { },
|
||||
onUnload: function () { },
|
||||
onPullDownRefresh: function () { },
|
||||
onReachBottom: function () {
|
||||
var t = this.data.page.page + 1;
|
||||
this.setData(e({}, "page.page", t)), this.getTalkList();
|
||||
},
|
||||
onShareAppMessage: function() {}
|
||||
onShareAppMessage: function () { }
|
||||
});
|
@ -1,11 +1,5 @@
|
||||
{
|
||||
"appid": "wxa5e5552f8a3b1616",
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.31.1",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"coverView": true,
|
||||
"es6": true,
|
||||
@ -19,11 +13,18 @@
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
},
|
||||
"condition": false
|
||||
"condition": false,
|
||||
"ignoreUploadUnusedFiles": true
|
||||
},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 2
|
||||
}
|
||||
"tabSize": 4
|
||||
},
|
||||
"libVersion": "2.31.1",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"appid": "wxa5e5552f8a3b1616"
|
||||
}
|
@ -6,7 +6,9 @@ var baseUrls = {
|
||||
caseUrl: "https://www.wlcbsyzl.cn/case/",
|
||||
sourceUrl: "https://www.wlcbsyzl.cn/systemmunicipalmini/assets/weCharMiniFile/images/",
|
||||
baseCardUrl: "https://www.wlcbsyzl.cn/citycard/route/file/download/true/",
|
||||
// baseCardUrl: "http://192.168.0.115:8089/citycard/route/file/download/true/",
|
||||
url: "https://www.wlcbsyzl.cn/citycard/"
|
||||
// url: "http://192.168.0.115:8089/citycard/"
|
||||
}
|
||||
|
||||
|
||||
|
@ -266,6 +266,7 @@ function upload(url, params) {
|
||||
}
|
||||
},
|
||||
fail: function (response) {
|
||||
console.log(response)
|
||||
wx.hideLoading({})
|
||||
try {
|
||||
if (typeof (response.data.msg) != undefined) {
|
||||
|
1117
vant/dist/cropper/image-cropper.js
vendored
Executable file
1117
vant/dist/cropper/image-cropper.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
3
vant/dist/cropper/image-cropper.json
vendored
Executable file
3
vant/dist/cropper/image-cropper.json
vendored
Executable file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
24
vant/dist/cropper/image-cropper.wxml
vendored
Executable file
24
vant/dist/cropper/image-cropper.wxml
vendored
Executable file
@ -0,0 +1,24 @@
|
||||
<view class='image-cropper' catchtouchmove='_preventTouchMove'>
|
||||
<view class='main' bindtouchend="_cutTouchEnd" bindtouchstart="_cutTouchStart" bindtouchmove="_cutTouchMove" bindtap="_click">
|
||||
<view class='content'>
|
||||
<view class='content_top bg_gray {{_flag_bright?"":"bg_black"}}' style="height:{{cut_top}}px;transition-property:{{_cut_animation?'':'background'}}"></view>
|
||||
<view class='content_middle' style="height:{{height}}px;">
|
||||
<view class='content_middle_left bg_gray {{_flag_bright?"":"bg_black"}}' style="width:{{cut_left}}px;transition-property:{{_cut_animation?'':'background'}}"></view>
|
||||
<view class='content_middle_middle' style="width:{{width}}px;height:{{height}}px;transition-duration: .3s;transition-property:{{_cut_animation?'':'background'}};">
|
||||
<view class="border border-top-left"></view>
|
||||
<view class="border border-top-right"></view>
|
||||
<view class="border border-right-top"></view>
|
||||
<view class="border border-right-bottom"></view>
|
||||
<view class="border border-bottom-right"></view>
|
||||
<view class="border border-bottom-left"></view>
|
||||
<view class="border border-left-bottom"></view>
|
||||
<view class="border border-left-top"></view>
|
||||
</view>
|
||||
<view class='content_middle_right bg_gray {{_flag_bright?"":"bg_black"}}' style="transition-property:{{_cut_animation?'':'background'}}"></view>
|
||||
</view>
|
||||
<view class='content_bottom bg_gray {{_flag_bright?"":"bg_black"}}' style="transition-property:{{_cut_animation?'':'background'}}"></view>
|
||||
</view>
|
||||
<image bindload="imageLoad" bindtouchstart="_start" bindtouchmove="_move" bindtouchend="_end" style="width:{{img_width ? img_width + 'px' : 'auto'}};height:{{img_height ? img_height + 'px' : 'auto'}};transform:translate3d({{_img_left-img_width/2}}px,{{_img_top-img_height/2}}px,0) scale({{scale}}) rotate({{angle}}deg);transition-duration:{{_cut_animation?.4:0}}s;" class='img' src='{{imgSrc}}'></image>
|
||||
</view>
|
||||
<canvas canvas-id='image-cropper' disable-scroll="true" style="width:{{_canvas_width * export_scale}}px;height:{{_canvas_height * export_scale}}px;left:{{canvas_left}}px;top:{{canvas_top}}px" class='image-cropper-canvas'></canvas>
|
||||
</view>
|
143
vant/dist/cropper/image-cropper.wxss
vendored
Executable file
143
vant/dist/cropper/image-cropper.wxss
vendored
Executable file
@ -0,0 +1,143 @@
|
||||
.image-cropper {
|
||||
background: rgba(14, 13, 13, .8);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.image-cropper .main {
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-cropper .content {
|
||||
z-index: 9;
|
||||
position: absolute;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.image-cropper .bg_black {
|
||||
background: rgba(0, 0, 0, 0.8) !important;
|
||||
}
|
||||
|
||||
.image-cropper .bg_gray {
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
transition-duration: .35s;
|
||||
}
|
||||
|
||||
.image-cropper .content>.content_top {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.image-cropper .content>.content_middle {
|
||||
display: flex;
|
||||
height: 200px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.image-cropper .content_middle_middle {
|
||||
width: 200px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
transition-duration: .3s;
|
||||
}
|
||||
|
||||
.image-cropper .content_middle_right {
|
||||
flex: auto;
|
||||
}
|
||||
|
||||
.image-cropper .content>.content_bottom {
|
||||
flex: auto;
|
||||
}
|
||||
|
||||
.image-cropper .img {
|
||||
z-index: 2;
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
border: none;
|
||||
width: 100%;
|
||||
backface-visibility: hidden;
|
||||
transform-origin: center;
|
||||
}
|
||||
|
||||
.image-cropper .image-cropper-canvas {
|
||||
position: fixed;
|
||||
background: white;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
z-index: 10;
|
||||
top: -200%;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.image-cropper .border {
|
||||
background: white;
|
||||
pointer-events: auto;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.image-cropper .border-top-left {
|
||||
left: -2.5px;
|
||||
top: -2.5px;
|
||||
height: 2.5px;
|
||||
width: 33rpx;
|
||||
}
|
||||
|
||||
.image-cropper .border-top-right {
|
||||
right: -2.5px;
|
||||
top: -2.5px;
|
||||
height: 2.5px;
|
||||
width: 33rpx;
|
||||
}
|
||||
|
||||
.image-cropper .border-right-top {
|
||||
top: -1px;
|
||||
width: 2.5px;
|
||||
height: 30rpx;
|
||||
right: -2.5px;
|
||||
}
|
||||
|
||||
.image-cropper .border-right-bottom {
|
||||
width: 2.5px;
|
||||
height: 30rpx;
|
||||
right: -2.5px;
|
||||
bottom: -1px;
|
||||
}
|
||||
|
||||
.image-cropper .border-bottom-left {
|
||||
height: 2.5px;
|
||||
width: 33rpx;
|
||||
bottom: -2.5px;
|
||||
left: -2.5px;
|
||||
}
|
||||
|
||||
.image-cropper .border-bottom-right {
|
||||
height: 2.5px;
|
||||
width: 33rpx;
|
||||
bottom: -2.5px;
|
||||
right: -2.5px;
|
||||
}
|
||||
|
||||
.image-cropper .border-left-top {
|
||||
top: -1px;
|
||||
width: 2.5px;
|
||||
height: 30rpx;
|
||||
left: -2.5px;
|
||||
}
|
||||
|
||||
.image-cropper .border-left-bottom {
|
||||
width: 2.5px;
|
||||
height: 30rpx;
|
||||
left: -2.5px;
|
||||
bottom: -1px;
|
||||
}
|
381
vant/dist/cropper/index.js
vendored
381
vant/dist/cropper/index.js
vendored
@ -1,381 +0,0 @@
|
||||
const defaultData = {
|
||||
isShowCropper:false,
|
||||
// 初始化的宽高
|
||||
cropperInitW: 750,
|
||||
cropperInitH: 750,
|
||||
// 动态的宽高
|
||||
cropperW: 750,
|
||||
cropperH: 750,
|
||||
// 动态的left top值
|
||||
cropperL: 0,
|
||||
cropperT: 0,
|
||||
|
||||
transL: 0,
|
||||
transT: 0,
|
||||
|
||||
// 图片缩放值
|
||||
scaleP: 0,
|
||||
imageW: 0,
|
||||
imageH: 0,
|
||||
|
||||
// 裁剪框 宽高
|
||||
cutL: 0,
|
||||
cutT: 0,
|
||||
cutB: 0,
|
||||
cutR: 0,
|
||||
|
||||
qualityWidth: '',
|
||||
innerAspectRadio: 750 / wx.getSystemInfoSync().windowWidth,
|
||||
|
||||
C_CONSTANTS:{
|
||||
SCREEN_WIDTH : 750,
|
||||
PAGE_X:0, // 手按下的x位置
|
||||
PAGE_Y:0, // 手按下y的位置
|
||||
PR : wx.getSystemInfoSync().pixelRatio, // dpi
|
||||
T_PAGE_X:{}, // 手移动的时候x的位置
|
||||
T_PAGE_Y:{}, // 手移动的时候Y的位置
|
||||
CUT_L:0, // 初始化拖拽元素的left值
|
||||
CUT_T:0, // 初始化拖拽元素的top值
|
||||
CUT_R:0, // 初始化拖拽元素的
|
||||
CUT_B:0, // 初始化拖拽元素的
|
||||
CUT_W:0, // 初始化拖拽元素的宽度
|
||||
CUT_H:0, // 初始化拖拽元素的高度
|
||||
IMG_RATIO:0, // 图片比例
|
||||
IMG_REAL_W:0, // 图片实际的宽度
|
||||
IMG_REAL_H:0, // 图片实际的高度
|
||||
IMG_TYPE:'',//图片的格式
|
||||
DRAFG_MOVE_RATIO : 750 / wx.getSystemInfoSync().windowWidth //移动时候的比例
|
||||
}
|
||||
};
|
||||
let data = {};
|
||||
|
||||
try{
|
||||
data = JSON.parse(JSON.stringify(defaultData));
|
||||
}catch(e){console.log(e)};
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
imageSrc:{
|
||||
type:String,
|
||||
value:'',
|
||||
observer(newVal, oldVal) {
|
||||
if(newVal !== oldVal){
|
||||
this.setData({
|
||||
isShowCropper:true
|
||||
},() => {
|
||||
this.loadImage();
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
isCircleCrop:{
|
||||
type:Boolean,
|
||||
value:false
|
||||
},
|
||||
enableScale:{
|
||||
type:Boolean,
|
||||
value:false
|
||||
},
|
||||
ratio:{
|
||||
type:Number,
|
||||
value:1
|
||||
}
|
||||
},
|
||||
data,
|
||||
ready(){
|
||||
if(this.data.isCircleCrop){
|
||||
//圆形裁剪 强制比例为1
|
||||
this.setData({
|
||||
ratio:1
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadImage() {
|
||||
let {ratio,imageSrc} = this.data;
|
||||
let {IMG_REAL_W,IMG_REAL_H,IMG_RATIO,SCREEN_WIDTH,IMG_TYPE} = this.data.C_CONSTANTS;
|
||||
wx.getImageInfo({
|
||||
src: imageSrc,
|
||||
success: res => {
|
||||
IMG_REAL_W = res.width;
|
||||
IMG_REAL_H = res.height;
|
||||
IMG_RATIO = IMG_REAL_W / IMG_REAL_H;
|
||||
IMG_TYPE = res.type === 'png' ? 'png' : 'jpg';
|
||||
// 根据图片的宽高显示不同的效果 保证图片可以正常显示
|
||||
let temp = {};
|
||||
let cropperData = {};
|
||||
if (IMG_RATIO >= 1) {
|
||||
cropperData = {
|
||||
cropperW: SCREEN_WIDTH,
|
||||
cropperH: SCREEN_WIDTH / IMG_RATIO,
|
||||
// 初始化left right
|
||||
cropperL: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH) / 2),
|
||||
cropperT: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO) / 2)
|
||||
}
|
||||
if(ratio > 1){
|
||||
temp = {
|
||||
cutL: (SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO) / 2,
|
||||
cutT: (SCREEN_WIDTH / IMG_RATIO - SCREEN_WIDTH / IMG_RATIO / ratio ) / 2,
|
||||
cutR: SCREEN_WIDTH - (SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO) / 2 - SCREEN_WIDTH / IMG_RATIO,
|
||||
cutB: SCREEN_WIDTH / IMG_RATIO - (SCREEN_WIDTH / IMG_RATIO - SCREEN_WIDTH / IMG_RATIO / ratio ) / 2 - SCREEN_WIDTH / IMG_RATIO / ratio
|
||||
}
|
||||
}else{
|
||||
temp = {
|
||||
cutT:0,
|
||||
cutB:0,
|
||||
cutL:(SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO * ratio) / 2,
|
||||
cutR: SCREEN_WIDTH - (SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO * ratio) / 2 - SCREEN_WIDTH / IMG_RATIO * ratio
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cropperData = {
|
||||
cropperW: SCREEN_WIDTH * IMG_RATIO,
|
||||
cropperH: SCREEN_WIDTH,
|
||||
// 初始化left right
|
||||
cropperL: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO) / 2),
|
||||
cropperT: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH) / 2)
|
||||
}
|
||||
if(ratio > 1){
|
||||
temp = {
|
||||
cutL:0,
|
||||
cutR:0,
|
||||
cutT: (SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO / ratio) / 2,
|
||||
cutB: SCREEN_WIDTH - (SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO / ratio) / 2 - SCREEN_WIDTH * IMG_RATIO / ratio
|
||||
}
|
||||
}else{
|
||||
temp = {
|
||||
cutL: (SCREEN_WIDTH * IMG_RATIO - SCREEN_WIDTH * IMG_RATIO * ratio) / 2,
|
||||
cutR: SCREEN_WIDTH * IMG_RATIO - (SCREEN_WIDTH * IMG_RATIO - SCREEN_WIDTH * IMG_RATIO * ratio) / 2 - SCREEN_WIDTH * IMG_RATIO * ratio,
|
||||
cutT: (SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO) / 2,
|
||||
cutB: SCREEN_WIDTH - (SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO) / 2 - SCREEN_WIDTH * IMG_RATIO
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
C_CONSTANTS:Object.assign({},this.data.C_CONSTANTS,{
|
||||
IMG_REAL_W,
|
||||
IMG_REAL_H,
|
||||
IMG_RATIO,
|
||||
IMG_TYPE
|
||||
}),
|
||||
isShowCropper: true,
|
||||
// 图片缩放值
|
||||
scaleP: IMG_REAL_W / SCREEN_WIDTH,
|
||||
qualityWidth: IMG_REAL_W,
|
||||
innerAspectRadio: IMG_RATIO,
|
||||
...temp,
|
||||
...cropperData
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
contentStartMove(e) {
|
||||
this.setData({
|
||||
'C_CONSTANTS.PAGE_X':e.touches[0].pageX,
|
||||
'C_CONSTANTS.PAGE_Y':e.touches[0].pageY
|
||||
})
|
||||
},
|
||||
// 拖动时候触发的touchMove事件
|
||||
contentMoveing(e) {
|
||||
let {PAGE_X,PAGE_Y,DRAFG_MOVE_RATIO} = this.data.C_CONSTANTS;
|
||||
let {cutL,cutR,cutT,cutB} = this.data;
|
||||
let dragLengthX = (PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
|
||||
let dragLengthY = (PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
|
||||
// 左移
|
||||
if (dragLengthX > 0) {
|
||||
if (cutL - dragLengthX < 0) dragLengthX = cutL
|
||||
} else {
|
||||
if (cutR + dragLengthX < 0) dragLengthX = -cutR
|
||||
}
|
||||
|
||||
if (dragLengthY > 0) {
|
||||
if (cutT - dragLengthY < 0) dragLengthY = cutT
|
||||
} else {
|
||||
if (cutB + dragLengthY < 0) dragLengthY = -cutB
|
||||
}
|
||||
this.setData({
|
||||
cutL: cutL - dragLengthX,
|
||||
cutT: cutT - dragLengthY,
|
||||
cutR: cutR + dragLengthX,
|
||||
cutB: cutB + dragLengthY,
|
||||
'C_CONSTANTS.PAGE_X':e.touches[0].pageX,
|
||||
'C_CONSTANTS.PAGE_Y':e.touches[0].pageY
|
||||
});
|
||||
},
|
||||
// 设置大小的时候触发的touchStart事件
|
||||
dragStart(e) {
|
||||
let {cutL,cutR,cutT,cutB} = this.data;
|
||||
this.setData({
|
||||
C_CONSTANTS:Object.assign({},this.data.C_CONSTANTS,{
|
||||
T_PAGE_X : e.touches[0].pageX,
|
||||
T_PAGE_Y : e.touches[0].pageY,
|
||||
CUT_L : cutL,
|
||||
CUT_R : cutR,
|
||||
CUT_B : cutB,
|
||||
CUT_T : cutT
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
// 设置大小的时候触发的touchMove事件
|
||||
dragMove(e) {
|
||||
let dragType = e.target.dataset.drag
|
||||
let {ratio,cropperW,cropperH,cutL,cutT,cutR,cutB,enableScale} = this.data;
|
||||
let {CUT_R,CUT_L,CUT_T,CUT_B,T_PAGE_X,T_PAGE_Y,DRAFG_MOVE_RATIO} = this.data.C_CONSTANTS;
|
||||
let dragLength;
|
||||
switch (dragType) {
|
||||
case 'right':
|
||||
dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
|
||||
if (CUT_R + dragLength < 0) dragLength = -CUT_R
|
||||
cutR = CUT_R + dragLength;
|
||||
if(enableScale){
|
||||
cutT = CUT_T + dragLength / ratio;
|
||||
}
|
||||
if(cutR < 0 || cutT < 0 || cutT > cropperH || cutR > cropperW) return;
|
||||
break;
|
||||
case 'left':
|
||||
dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
|
||||
if (CUT_L - dragLength < 0) dragLength = CUT_L
|
||||
if ((CUT_L - dragLength) > (this.data.cropperW - this.data.cutR)) dragLength = CUT_L - (this.data.cropperW - this.data.cutR)
|
||||
cutL = CUT_L - dragLength;
|
||||
if(enableScale){
|
||||
cutT = CUT_T - dragLength / ratio;
|
||||
}
|
||||
if(cutL < 0 || cutT < 0 || cutT > cropperH || cutL > cropperW) return;
|
||||
break;
|
||||
case 'top':
|
||||
dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
|
||||
if (CUT_T - dragLength < 0) dragLength = CUT_T
|
||||
if ((CUT_T - dragLength) > (this.data.cropperH - this.data.cutB)) dragLength = CUT_T - (this.data.cropperH - this.data.cutB)
|
||||
cutT = CUT_T - dragLength;
|
||||
if(enableScale){
|
||||
cutR = CUT_R - dragLength * ratio;
|
||||
}
|
||||
break;
|
||||
case 'bottom':
|
||||
dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
|
||||
if (CUT_B + dragLength < 0) dragLength = -CUT_B
|
||||
cutB = CUT_B + dragLength;
|
||||
if(enableScale){
|
||||
cutR = CUT_R + dragLength * ratio;
|
||||
}
|
||||
if(cutR < 0 || cutT < 0 || cutT > cropperH || cutR > cropperW) return;
|
||||
break;
|
||||
default:'';
|
||||
}
|
||||
this.setData({
|
||||
cutL,
|
||||
cutT,
|
||||
cutR,
|
||||
cutB
|
||||
});
|
||||
},
|
||||
contentTouchEnd(){},
|
||||
// 获取图片
|
||||
confirmCropper() {
|
||||
const {isCircleCrop} = this.data;;
|
||||
if(isCircleCrop){
|
||||
this.circleCrop()
|
||||
}else{
|
||||
this.normalCropper();
|
||||
}
|
||||
},
|
||||
|
||||
normalCropper(){
|
||||
let {imageSrc,cropperW,cropperH,cutL,cutT,cutR,cutB} = this.data;
|
||||
let {IMG_REAL_W,IMG_REAL_H,IMG_TYPE} = this.data.C_CONSTANTS;
|
||||
// 将图片写入画布
|
||||
const ctx = wx.createCanvasContext('cropper',this)
|
||||
ctx.drawImage(imageSrc, 0, 0, IMG_REAL_W, IMG_REAL_H);
|
||||
ctx.draw(true, () => {
|
||||
// 获取画布要裁剪的位置和宽度 均为百分比 * 画布中图片的宽度 保证了在微信小程序中裁剪的图片模糊 位置不对的问题 canvasT = (_this.data.cutT / _this.data.cropperH) * (_this.data.imageH / pixelRatio)
|
||||
let canvasW = ((cropperW - cutL - cutR) / cropperW) * IMG_REAL_W
|
||||
let canvasH = ((cropperH - cutT - cutB) / cropperH) * IMG_REAL_H
|
||||
let canvasL = (cutL / cropperW) * IMG_REAL_W
|
||||
let canvasT = (cutT / cropperH) * IMG_REAL_H
|
||||
wx.canvasToTempFilePath({
|
||||
x: canvasL,
|
||||
y: canvasT,
|
||||
width: canvasW,
|
||||
height: canvasH,
|
||||
destWidth: canvasW,
|
||||
destHeight: canvasH,
|
||||
fileType:IMG_TYPE || 'jpg',
|
||||
canvasId: 'cropper',
|
||||
success: (res) => {
|
||||
//图片裁剪成功
|
||||
this.cancelCropper();
|
||||
this.triggerEvent('cropperDone', {
|
||||
src:res.tempFilePath,
|
||||
cropperData:{
|
||||
x: canvasL,
|
||||
y: canvasT,
|
||||
width: canvasW,
|
||||
height: canvasH
|
||||
}
|
||||
})
|
||||
},
|
||||
fail:err =>{
|
||||
this.triggerEvent('cropperFail',err)
|
||||
}
|
||||
},this);
|
||||
})
|
||||
},
|
||||
|
||||
circleCrop(){
|
||||
let {imageSrc,cropperW,cropperH,cutL,cutT,cutR,cutB} = this.data;
|
||||
let {IMG_REAL_W,IMG_REAL_H,IMG_TYPE} = this.data.C_CONSTANTS;
|
||||
// 将图片写入画布
|
||||
const ctx = wx.createCanvasContext('cropper',this)
|
||||
let canvasW = ((cropperW - cutL - cutR) / cropperW) * IMG_REAL_W
|
||||
let canvasL = (cutL / cropperW) * IMG_REAL_W
|
||||
let canvasT = (cutT / cropperH) * IMG_REAL_H
|
||||
|
||||
this.setData({
|
||||
canvasW:canvasW,
|
||||
canvasH:canvasW
|
||||
},() => {
|
||||
ctx.arc(canvasW / 2,canvasW / 2,canvasW / 2,0,2 * Math.PI);
|
||||
ctx.clip();
|
||||
ctx.drawImage(imageSrc, canvasL, canvasT, canvasW, canvasW,0,0,canvasW,canvasW);
|
||||
ctx.draw(true, () => {
|
||||
wx.canvasToTempFilePath({
|
||||
fileType:IMG_TYPE || 'jpg',
|
||||
canvasId: 'cropper',
|
||||
success: (res) => {
|
||||
//图片裁剪成功
|
||||
this.cancelCropper();
|
||||
this.triggerEvent('cropperDone', {
|
||||
src:res.tempFilePath,
|
||||
cropperData:{
|
||||
x: canvasL,
|
||||
y: canvasT,
|
||||
width: canvasW,
|
||||
height: canvasW
|
||||
}
|
||||
})
|
||||
},
|
||||
fail:err =>{
|
||||
this.triggerEvent('cropperFail',err)
|
||||
}
|
||||
},this);
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
cancelCropper(){
|
||||
let originData = {}
|
||||
try{
|
||||
originData = JSON.parse(JSON.stringify(defaultData))
|
||||
}catch(e){};
|
||||
|
||||
this.setData({
|
||||
...originData
|
||||
});
|
||||
this.triggerEvent('cropperCancel')
|
||||
}
|
||||
}
|
||||
})
|
3
vant/dist/cropper/index.json
vendored
3
vant/dist/cropper/index.json
vendored
@ -1,3 +0,0 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
44
vant/dist/cropper/index.wxml
vendored
44
vant/dist/cropper/index.wxml
vendored
@ -1,44 +0,0 @@
|
||||
<view class="wx-cropper-info" wx:if="{{isShowCropper}}">
|
||||
<view class='cropper-content'>
|
||||
<!-- {{cropperInitH}}rpx -->
|
||||
<view class="wx-corpper" style="width:{{cropperInitW}}rpx;height:85%;background:#000;display: flex;justify-content: center;align-items: center;">
|
||||
<!-- left:{{cropperL}}rpx;top:{{cropperT}}rpx -->
|
||||
<view class="wx-corpper-content" style="width:{{cropperW}}rpx;height:{{cropperH}}rpx;">
|
||||
<image class="img" src="{{imageSrc}}" style="width:{{cropperW}}rpx;height:{{cropperH}}rpx"></image>
|
||||
<view class="wx-corpper-crop-box" bindtouchstart="contentStartMove" bindtouchmove="contentMoveing"
|
||||
bindtouchend="contentTouchEnd" style="left:{{cutL}}rpx;top:{{cutT}}rpx;right:{{cutR}}rpx;bottom:{{cutB}}rpx">
|
||||
<view class="wx-cropper-view-box">
|
||||
<view class="wx-cropper-dashed-h"></view>
|
||||
<view class="wx-cropper-dashed-v"></view>
|
||||
<view class="wx-cropper-line-t" data-drag="top" catchtouchstart="dragStart" catchtouchmove="dragMove"></view>
|
||||
<view class="wx-cropper-line-r" data-drag="right" catchtouchstart="dragStart"
|
||||
catchtouchmove="dragMove"></view>
|
||||
<view class="wx-cropper-line-b" data-drag="bottom" catchtouchstart="dragStart"
|
||||
catchtouchmove="dragMove"></view>
|
||||
<view class="wx-cropper-line-l" data-drag="left" catchtouchstart="dragStart" catchtouchmove="dragMove"></view>
|
||||
<view class="wx-cropper-point point-t" data-drag="top" catchtouchstart="dragStart"
|
||||
catchtouchmove="dragMove"></view>
|
||||
<view class="wx-cropper-point point-tr" data-drag="topTight"></view>
|
||||
<view class="wx-cropper-point point-r" data-drag="right" catchtouchstart="dragStart"
|
||||
catchtouchmove="dragMove"></view>
|
||||
<view class="wx-cropper-point point-rb" data-drag="rightBottom" catchtouchstart="dragStart"
|
||||
catchtouchmove="dragMove"></view>
|
||||
<view class="wx-cropper-point point-b" data-drag="bottom" catchtouchstart="dragStart"
|
||||
catchtouchmove="dragMove" catchtouchend="dragEnd"></view>
|
||||
<view class="wx-cropper-point point-bl" data-drag="bottomLeft"></view>
|
||||
<view class="wx-cropper-point point-l" data-drag="left" catchtouchstart="dragStart"
|
||||
catchtouchmove="dragMove"></view>
|
||||
<view class="wx-cropper-point point-lt" data-drag="leftTop"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='cropper-config'>
|
||||
<button type="primary reverse" class="btn" bindtap="cancelCropper" style='margin-top: 30rpx;'> 取消 </button>
|
||||
<button type="primary" class="cropper-confirm btn" bindtap="confirmCropper" style='margin-top: 30rpx;'> 确认 </button>
|
||||
</view>
|
||||
<canvas wx:if="{{!isCircleCrop}}" canvas-id="cropper" style="position:absolute;border: 1px solid red; width:{{qualityWidth}}px;height:{{qualityWidth/innerAspectRadio}}px;top:-9999px;left:-9999px;"></canvas>
|
||||
<canvas wx:else canvas-id="cropper" style="position:absolute;border: 1px solid red; width:{{canvasW}}px;height:{{canvasH}}px;top:-9999px;left:-9999px;"></canvas>
|
||||
</view>
|
||||
|
296
vant/dist/cropper/index.wxss
vendored
296
vant/dist/cropper/index.wxss
vendored
@ -1,296 +0,0 @@
|
||||
/* pages/wx-cropper/index.wxss */
|
||||
.wx-cropper-info {
|
||||
position: fixed;
|
||||
top: 140rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: block;
|
||||
z-index: 10000;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
background: #000;
|
||||
}
|
||||
|
||||
.cropper-config {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
bottom: 20rpx;
|
||||
}
|
||||
|
||||
.cropper-config .btn {
|
||||
min-width: 300rpx;
|
||||
}
|
||||
|
||||
.cropper-config .cropper-confirm {
|
||||
background: #fac208;
|
||||
}
|
||||
|
||||
.cropper-content {
|
||||
min-height: 750rpx;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.wx-corpper {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-touch-callout: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.wx-corpper-content {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wx-corpper-content .img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-width: 0 !important;
|
||||
max-width: none !important;
|
||||
height: 100%;
|
||||
min-height: 0 !important;
|
||||
max-height: none !important;
|
||||
image-orientation: 0deg !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* 移动图片效果 */
|
||||
.wx-cropper-drag-box {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
cursor: move;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* 内部的信息 */
|
||||
.wx-corpper-crop-box {
|
||||
position: absolute;
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.wx-corpper-crop-box .wx-cropper-view-box {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: visible;
|
||||
outline: 1px solid #69f;
|
||||
outline-color: rgba(102, 153, 255, .75)
|
||||
}
|
||||
|
||||
/* 横向虚线 */
|
||||
.wx-cropper-dashed-h {
|
||||
position: absolute;
|
||||
top: 33.33333333%;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 33.33333333%;
|
||||
border-top: 1px dashed rgba(255, 255, 255, 0.5);
|
||||
border-bottom: 1px dashed rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
/* 纵向虚线 */
|
||||
.wx-cropper-dashed-v {
|
||||
position: absolute;
|
||||
left: 33.33333333%;
|
||||
top: 0;
|
||||
width: 33.33333333%;
|
||||
height: 100%;
|
||||
border-left: 1px dashed rgba(255, 255, 255, 0.5);
|
||||
border-right: 1px dashed rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
/* 四个方向的线 为了之后的拖动事件*/
|
||||
.wx-cropper-line-t {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 100%;
|
||||
background-color: #69f;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 1px;
|
||||
opacity: 0.1;
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.wx-cropper-line-t::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0rpx;
|
||||
width: 100%;
|
||||
-webkit-transform: translate3d(0, -50%, 0);
|
||||
transform: translate3d(0, -50%, 0);
|
||||
bottom: 0;
|
||||
height: 41rpx;
|
||||
background: transparent;
|
||||
z-index: 11;
|
||||
}
|
||||
|
||||
.wx-cropper-line-r {
|
||||
position: absolute;
|
||||
display: block;
|
||||
background-color: #69f;
|
||||
top: 0;
|
||||
right: 0px;
|
||||
width: 1px;
|
||||
opacity: 0.1;
|
||||
height: 100%;
|
||||
cursor: e-resize;
|
||||
}
|
||||
|
||||
.wx-cropper-line-r::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
width: 41rpx;
|
||||
-webkit-transform: translate3d(-50%, 0, 0);
|
||||
transform: translate3d(-50%, 0, 0);
|
||||
bottom: 0;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
z-index: 11;
|
||||
}
|
||||
|
||||
.wx-cropper-line-b {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 100%;
|
||||
background-color: #69f;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: 1px;
|
||||
opacity: 0.1;
|
||||
cursor: s-resize;
|
||||
}
|
||||
|
||||
.wx-cropper-line-b::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 0rpx;
|
||||
width: 100%;
|
||||
-webkit-transform: translate3d(0, -50%, 0);
|
||||
transform: translate3d(0, -50%, 0);
|
||||
bottom: 0;
|
||||
height: 41rpx;
|
||||
background: transparent;
|
||||
z-index: 11;
|
||||
}
|
||||
|
||||
.wx-cropper-line-l {
|
||||
position: absolute;
|
||||
display: block;
|
||||
background-color: #69f;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1px;
|
||||
opacity: 0.1;
|
||||
height: 100%;
|
||||
cursor: w-resize;
|
||||
}
|
||||
|
||||
.wx-cropper-line-l::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
width: 41rpx;
|
||||
-webkit-transform: translate3d(-50%, 0, 0);
|
||||
transform: translate3d(-50%, 0, 0);
|
||||
bottom: 0;
|
||||
height: 100%;
|
||||
background: transparent;
|
||||
z-index: 11;
|
||||
}
|
||||
|
||||
.wx-cropper-point {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
background-color: #69f;
|
||||
opacity: .75;
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.point-t {
|
||||
top: -3px;
|
||||
left: 50%;
|
||||
margin-left: -3px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.point-tr {
|
||||
top: -3px;
|
||||
left: 100%;
|
||||
margin-left: -3px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.point-r {
|
||||
top: 50%;
|
||||
left: 100%;
|
||||
margin-left: -3px;
|
||||
margin-top: -3px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.point-rb {
|
||||
left: 100%;
|
||||
top: 100%;
|
||||
-webkit-transform: translate3d(-50%, -50%, 0);
|
||||
transform: translate3d(-50%, -50%, 0);
|
||||
cursor: n-resize;
|
||||
/* width: 24rpx; */
|
||||
/* height: 24rpx; */
|
||||
background-color: #69f;
|
||||
position: absolute;
|
||||
z-index: 1112;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.point-b {
|
||||
left: 50%;
|
||||
top: 100%;
|
||||
margin-left: -3px;
|
||||
margin-top: -3px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.point-bl {
|
||||
left: 0%;
|
||||
top: 100%;
|
||||
margin-left: -3px;
|
||||
margin-top: -3px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.point-l {
|
||||
left: 0%;
|
||||
top: 50%;
|
||||
margin-left: -3px;
|
||||
margin-top: -3px;
|
||||
cursor: n-resize;
|
||||
}
|
||||
|
||||
.point-lt {
|
||||
left: 0%;
|
||||
top: 0%;
|
||||
margin-left: -3px;
|
||||
margin-top: -3px;
|
||||
cursor: n-resize;
|
||||
}
|
133
vant/dist/tabs/index.js
vendored
133
vant/dist/tabs/index.js
vendored
@ -1,17 +1,17 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { touch } from '../mixins/touch';
|
||||
import {
|
||||
getAllRect,
|
||||
getRect,
|
||||
groupSetData,
|
||||
nextTick,
|
||||
requestAnimationFrame,
|
||||
} from '../common/utils';
|
||||
import { getAllRect, getRect, groupSetData, nextTick, requestAnimationFrame, } from '../common/utils';
|
||||
import { isDef } from '../common/validator';
|
||||
import { useChildren } from '../common/relation';
|
||||
VantComponent({
|
||||
mixins: [touch],
|
||||
classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class'],
|
||||
classes: [
|
||||
'nav-class',
|
||||
'tab-class',
|
||||
'tab-active-class',
|
||||
'line-class',
|
||||
'wrap-class',
|
||||
],
|
||||
relation: useChildren('tab', function () {
|
||||
this.updateTabs();
|
||||
}),
|
||||
@ -25,9 +25,7 @@ VantComponent({
|
||||
animated: {
|
||||
type: Boolean,
|
||||
observer() {
|
||||
this.children.forEach((child, index) =>
|
||||
child.updateRender(index === this.data.currentIndex, this)
|
||||
);
|
||||
this.children.forEach((child, index) => child.updateRender(index === this.data.currentIndex, this));
|
||||
},
|
||||
},
|
||||
lineWidth: {
|
||||
@ -81,6 +79,10 @@ VantComponent({
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
useBeforeChange: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
tabs: [],
|
||||
@ -89,14 +91,17 @@ VantComponent({
|
||||
currentIndex: 0,
|
||||
container: null,
|
||||
skipTransition: true,
|
||||
scrollWithAnimation: false,
|
||||
lineOffsetLeft: 0,
|
||||
inited: false,
|
||||
},
|
||||
mounted() {
|
||||
requestAnimationFrame(() => {
|
||||
this.swiping = true;
|
||||
this.setData({
|
||||
container: () => this.createSelectorQuery().select('.van-tabs'),
|
||||
});
|
||||
this.resize(true);
|
||||
this.resize();
|
||||
this.scrollIntoView();
|
||||
});
|
||||
},
|
||||
@ -105,52 +110,45 @@ VantComponent({
|
||||
const { children = [], data } = this;
|
||||
this.setData({
|
||||
tabs: children.map((child) => child.data),
|
||||
scrollable:
|
||||
this.children.length > data.swipeThreshold || !data.ellipsis,
|
||||
scrollable: this.children.length > data.swipeThreshold || !data.ellipsis,
|
||||
});
|
||||
this.setCurrentIndexByName(data.active || this.getCurrentName());
|
||||
},
|
||||
trigger(eventName, child) {
|
||||
const { currentIndex } = this.data;
|
||||
const currentChild = child || this.children[currentIndex];
|
||||
if (!isDef(currentChild)) {
|
||||
const data = this.getChildData(currentIndex, child);
|
||||
if (!isDef(data)) {
|
||||
return;
|
||||
}
|
||||
this.$emit(eventName, {
|
||||
index: currentChild.index,
|
||||
name: currentChild.getComputedName(),
|
||||
title: currentChild.data.title,
|
||||
});
|
||||
this.$emit(eventName, data);
|
||||
},
|
||||
onTap(event) {
|
||||
const { index } = event.currentTarget.dataset;
|
||||
const child = this.children[index];
|
||||
if (child.data.disabled) {
|
||||
this.trigger('disabled', child);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
this.onBeforeChange(index).then(() => {
|
||||
this.setCurrentIndex(index);
|
||||
nextTick(() => {
|
||||
this.trigger('click');
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// correct the index of active tab
|
||||
setCurrentIndexByName(name) {
|
||||
const { children = [] } = this;
|
||||
const matched = children.filter(
|
||||
(child) => child.getComputedName() === name
|
||||
);
|
||||
const matched = children.filter((child) => child.getComputedName() === name);
|
||||
if (matched.length) {
|
||||
this.setCurrentIndex(matched[0].index);
|
||||
}
|
||||
},
|
||||
setCurrentIndex(currentIndex) {
|
||||
const { data, children = [] } = this;
|
||||
if (
|
||||
!isDef(currentIndex) ||
|
||||
if (!isDef(currentIndex) ||
|
||||
currentIndex >= children.length ||
|
||||
currentIndex < 0
|
||||
) {
|
||||
currentIndex < 0) {
|
||||
return;
|
||||
}
|
||||
groupSetData(this, () => {
|
||||
@ -162,13 +160,18 @@ VantComponent({
|
||||
});
|
||||
});
|
||||
if (currentIndex === data.currentIndex) {
|
||||
if (!data.inited) {
|
||||
this.resize();
|
||||
}
|
||||
return;
|
||||
}
|
||||
const shouldEmitChange = data.currentIndex !== null;
|
||||
this.setData({ currentIndex });
|
||||
nextTick(() => {
|
||||
requestAnimationFrame(() => {
|
||||
this.resize();
|
||||
this.scrollIntoView();
|
||||
});
|
||||
nextTick(() => {
|
||||
this.trigger('input');
|
||||
if (shouldEmitChange) {
|
||||
this.trigger('change');
|
||||
@ -181,11 +184,11 @@ VantComponent({
|
||||
return activeTab.getComputedName();
|
||||
}
|
||||
},
|
||||
resize(skipTransition = false) {
|
||||
resize() {
|
||||
if (this.data.type !== 'line') {
|
||||
return;
|
||||
}
|
||||
const { currentIndex, ellipsis } = this.data;
|
||||
const { currentIndex, ellipsis, skipTransition } = this.data;
|
||||
Promise.all([
|
||||
getAllRect(this, '.van-tab'),
|
||||
getRect(this, '.van-tabs__line'),
|
||||
@ -199,15 +202,19 @@ VantComponent({
|
||||
.reduce((prev, curr) => prev + curr.width, 0);
|
||||
lineOffsetLeft +=
|
||||
(rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8);
|
||||
this.setData({
|
||||
lineOffsetLeft,
|
||||
skipTransition,
|
||||
});
|
||||
this.setData({ lineOffsetLeft, inited: true });
|
||||
this.swiping = true;
|
||||
if (skipTransition) {
|
||||
// waiting transition end
|
||||
setTimeout(() => {
|
||||
this.setData({ skipTransition: false });
|
||||
}, this.data.duration);
|
||||
}
|
||||
});
|
||||
},
|
||||
// scroll active tab into view
|
||||
scrollIntoView() {
|
||||
const { currentIndex, scrollable } = this.data;
|
||||
const { currentIndex, scrollable, scrollWithAnimation } = this.data;
|
||||
if (!scrollable) {
|
||||
return;
|
||||
}
|
||||
@ -222,50 +229,74 @@ VantComponent({
|
||||
this.setData({
|
||||
scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2,
|
||||
});
|
||||
if (!scrollWithAnimation) {
|
||||
nextTick(() => {
|
||||
this.setData({ scrollWithAnimation: true });
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onTouchScroll(event) {
|
||||
this.$emit('scroll', event.detail);
|
||||
},
|
||||
onTouchStart(event) {
|
||||
if (!this.data.swipeable) return;
|
||||
if (!this.data.swipeable)
|
||||
return;
|
||||
this.swiping = true;
|
||||
this.touchStart(event);
|
||||
},
|
||||
onTouchMove(event) {
|
||||
if (!this.data.swipeable) return;
|
||||
if (!this.data.swipeable || !this.swiping)
|
||||
return;
|
||||
this.touchMove(event);
|
||||
},
|
||||
// watch swipe touch end
|
||||
onTouchEnd() {
|
||||
if (!this.data.swipeable) return;
|
||||
if (!this.data.swipeable || !this.swiping)
|
||||
return;
|
||||
const { direction, deltaX, offsetX } = this;
|
||||
const minSwipeDistance = 50;
|
||||
if (direction === 'horizontal' && offsetX >= minSwipeDistance) {
|
||||
const index = this.getAvaiableTab(deltaX);
|
||||
if (index !== -1) {
|
||||
this.setCurrentIndex(index);
|
||||
this.onBeforeChange(index).then(() => this.setCurrentIndex(index));
|
||||
}
|
||||
}
|
||||
this.swiping = false;
|
||||
},
|
||||
getAvaiableTab(direction) {
|
||||
const { tabs, currentIndex } = this.data;
|
||||
const step = direction > 0 ? -1 : 1;
|
||||
for (
|
||||
let i = step;
|
||||
currentIndex + i < tabs.length && currentIndex + i >= 0;
|
||||
i += step
|
||||
) {
|
||||
for (let i = step; currentIndex + i < tabs.length && currentIndex + i >= 0; i += step) {
|
||||
const index = currentIndex + i;
|
||||
if (
|
||||
index >= 0 &&
|
||||
if (index >= 0 &&
|
||||
index < tabs.length &&
|
||||
tabs[index] &&
|
||||
!tabs[index].disabled
|
||||
) {
|
||||
!tabs[index].disabled) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
onBeforeChange(index) {
|
||||
const { useBeforeChange } = this.data;
|
||||
if (!useBeforeChange) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$emit('before-change', Object.assign(Object.assign({}, this.getChildData(index)), { callback: (status) => (status ? resolve() : reject()) }));
|
||||
});
|
||||
},
|
||||
getChildData(index, child) {
|
||||
const currentChild = child || this.children[index];
|
||||
if (!isDef(currentChild)) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
index: currentChild.index,
|
||||
name: currentChild.getComputedName(),
|
||||
title: currentChild.data.title,
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
8
vant/dist/tabs/index.wxml
vendored
8
vant/dist/tabs/index.wxml
vendored
@ -1,7 +1,7 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view class="custom-class {{ utils.bem('tabs', [type]) }}">
|
||||
<view class="custom-class {{ utils.bem('tabs') }}">
|
||||
<van-sticky
|
||||
disabled="{{ !sticky }}"
|
||||
z-index="{{ zIndex }}"
|
||||
@ -9,18 +9,18 @@
|
||||
container="{{ container }}"
|
||||
bind:scroll="onTouchScroll"
|
||||
>
|
||||
<view class="{{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }}">
|
||||
<view class="{{ utils.bem('tabs--') + type }} {{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }} wrap-class">
|
||||
<slot name="nav-left" />
|
||||
|
||||
<scroll-view
|
||||
scroll-x="{{ scrollable }}"
|
||||
scroll-with-animation
|
||||
scroll-with-animation="{{ scrollWithAnimation }}"
|
||||
scroll-left="{{ scrollLeft }}"
|
||||
class="{{ utils.bem('tabs__scroll', [type]) }}"
|
||||
style="{{ color ? 'border-color: ' + color : '' }}"
|
||||
>
|
||||
<view class="{{ utils.bem('tabs__nav', [type, { complete: !ellipsis }]) }} nav-class" style="{{ computed.navStyle(color, type) }}">
|
||||
<view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth }) }}" />
|
||||
<view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth, inited }) }}" />
|
||||
<view
|
||||
wx:for="{{ tabs }}"
|
||||
wx:key="index"
|
||||
|
1
vant/dist/tabs/index.wxs
vendored
1
vant/dist/tabs/index.wxs
vendored
@ -60,6 +60,7 @@ function trackStyle(data) {
|
||||
function lineStyle(data) {
|
||||
return style({
|
||||
width: utils.addUnit(data.lineWidth),
|
||||
opacity: data.inited ? 1 : 0,
|
||||
transform: 'translateX(' + data.lineOffsetLeft + 'px)',
|
||||
'-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)',
|
||||
'background-color': data.color,
|
||||
|
2
vant/dist/tabs/index.wxss
vendored
2
vant/dist/tabs/index.wxss
vendored
@ -1 +1 @@
|
||||
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{display:-webkit-flex;display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{-webkit-flex:1 0 auto!important;flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-right:8px;padding-left:8px}.van-tabs__scroll{background-color:#fff;background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{margin:0 16px;margin:0 var(--padding-md,16px)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:30px;height:var(--tabs-card-height,30px);border:1px solid #ee0a24;border:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24);border-radius:2px;border-radius:var(--border-radius-sm,2px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--tabs-default-color,#ee0a24);line-height:28px;line-height:calc(var(--tabs-card-height, 30px) - var(--border-width-base, 1px)*2);border-right:1px solid #ee0a24;border-right:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;height:var(--tabs-bottom-bar-height,3px);border-radius:3px;border-radius:var(--tabs-bottom-bar-height,3px);background-color:#ee0a24;background-color:var(--tabs-bottom-bar-color,#ee0a24)}.van-tabs__track{position:relative;width:100%;height:100%}.van-tabs__track--animated{display:-webkit-flex;display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tab{position:relative;-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;text-align:center;cursor:pointer;color:#646566;color:var(--tab-text-color,#646566);font-size:14px;font-size:var(--tab-font-size,14px);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;font-weight:var(--font-weight-bold,500);color:#323233;color:var(--tab-active-text-color,#323233)}.van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}
|
||||
@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff);overflow:auto}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;opacity:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line{height:var(--tabs-line-height,44px)}.van-tabs--card{height:var(--tabs-card-height,30px)}.van-tab{box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;transform:translateX(0)!important}
|
Loading…
Reference in New Issue
Block a user